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: #include <setjmp.h>
23:
24: #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
25: #undef HAS_BACKLINK
26: #else
27: #define HAS_BACKLINK 1
28: #endif
29:
30: typedef CELL_TYPE Cell;
31: typedef double Float;
32:
33: #define Clongest long long
34: typedef unsigned Clongest UClongest;
35:
36: #ifdef HAS_BACKLINK
37: extern __thread Cell *gforth_SP;
38: extern __thread Float *gforth_FP;
39: extern __thread Cell *gforth_RP;
40: extern __thread char *gforth_LP;
41: extern __thread char *gforth_UP;
42: extern void *gforth_engine(void *, Cell *, Cell *, Float *, char *);
43: extern char *cstr(char *from, Cell size);
44: extern char *tilde_cstr(char *from, Cell size);
45: extern __thread jmp_buf throw_jmp_buf;
46: #define GFORTH_ARGS void
47: #else
48: #define gforth_SP *((Cell **)(gforth_pointers(0)))
49: #define gforth_FP *((Float **)(gforth_pointers(1)))
50: #define gforth_LP *((char **)(gforth_pointers(2)))
51: #define gforth_RP *((Cell **)(gforth_pointers(3)))
52: #define gforth_UP *((char **)(gforth_pointers(4)))
53: #define gforth_engine ((char *(*)(void *, Cell *, Cell *, Float *, char *))(((void **)(gforth_pointers(5)))))
54: #define cstr ((char *(*)(char *, Cell))(((void **)(gforth_pointers(6)))))
55: #define tilde_cstr ((char *(*)(char *, Cell))(((void **)(gforth_pointers(7)))))
56: #define throw_jmp_buf *((jmp_buf*)(gforth_pointers(8)))
57: #define GFORTH_ARGS void *(*gforth_pointers)(Cell)
58: #endif
59:
60: #define CELL_BITS (sizeof(Cell) * 8)
61:
62: #define gforth_d2ll(lo,hi) \
63: ((sizeof(Cell) < sizeof(Clongest)) \
64: ? (((UClongest)(lo))|(((UClongest)(hi))<<CELL_BITS)) \
65: : (lo))
66:
67: #define gforth_ll2d(ll,lo,hi) \
68: do { \
69: UClongest _ll = (ll); \
70: (lo) = (Cell)_ll; \
71: (hi) = ((sizeof(Cell) < sizeof(Clongest)) \
72: ? (_ll >> CELL_BITS) \
73: : 0); \
74: } while (0);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>