1/* header file for libcc-generated C code 2 3 Copyright (C) 2006,2007,2008 Free Software Foundation, Inc. 4 5 This file is part of Gforth. 6 7 Gforth is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License 9 as published by the Free Software Foundation, either version 3 10 of the License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program. If not, see http://www.gnu.org/licenses/. 19*/ 20 21#include <gforth/@PACKAGE_VERSION@/config.h> 22 23#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 24#undef HAS_BACKLINK 25#else 26#define HAS_BACKLINK 1 27#endif 28 29typedef CELL_TYPE Cell; 30typedef double Float; 31 32#define Clongest long long 33typedef unsigned Clongest UClongest; 34 35#ifdef HAS_BACKLINK 36extern Cell *gforth_SP; 37extern Float *gforth_FP; 38extern Cell *gforth_RP; 39extern char *gforth_LP; 40extern char *gforth_UP; 41extern void *gforth_engine(void *, Cell *, Cell *, Float *, char *, char *); 42extern char *cstr(char *from, Cell size, int clear); 43extern char *tilde_cstr(char *from, Cell size, int clear); 44#define GFORTH_ARGS void 45#else 46#define gforth_SP *((Cell **)(gforth_pointers[0])) 47#define gforth_FP *((Float **)(gforth_pointers[1])) 48#define gforth_LP *((char **)(gforth_pointers[2])) 49#define gforth_RP *((Cell **)(gforth_pointers[3])) 50#define gforth_UP *((char **)(gforth_pointers[4])) 51#define gforth_engine ((char *(*)(Xt *, Cell *, Cell *, Float *, char *, char *))(((void **)(gforth_pointers[5])))) 52#define cstr ((char *(*)(char *, Cell, int))(((void **)(gforth_pointers[6])))) 53#define tilde_cstr ((char *(*)(char *, Cell, int))(((void **)(gforth_pointers[7])))) 54#define GFORTH_ARGS void ** gforth_pointers 55#endif 56 57#define CELL_BITS (sizeof(Cell) * 8) 58 59#define gforth_d2ll(lo,hi) \ 60 ((sizeof(Cell) < sizeof(Clongest)) \ 61 ? (((UClongest)(lo))|(((UClongest)(hi))<<CELL_BITS)) \ 62 : (lo)) 63 64#define gforth_ll2d(ll,lo,hi) \ 65 do { \ 66 UClongest _ll = (ll); \ 67 (lo) = (Cell)_ll; \ 68 (hi) = ((sizeof(Cell) < sizeof(Clongest)) \ 69 ? (_ll >> CELL_BITS) \ 70 : 0); \ 71 } while (0); 72