Annotation of gforth/engine/libcc.h.in, revision 1.14

1.1       anton       1: /* header file for libcc-generated C code
                      2: 
1.9       anton       3:   Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
1.1       anton       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
1.3       anton       9:   as published by the Free Software Foundation, either version 3
1.1       anton      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
1.3       anton      18:   along with this program. If not, see http://www.gnu.org/licenses/.
1.1       anton      19: */
                     20: 
                     21: #include <gforth/@PACKAGE_VERSION@/config.h>
1.12      pazsan     22: #include <setjmp.h>
1.1       anton      23: 
1.13      pazsan     24: #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || defined(__ANDROID__)
1.4       pazsan     25: #undef HAS_BACKLINK
                     26: #else
                     27: #define HAS_BACKLINK 1
                     28: #endif
                     29: 
1.1       anton      30: typedef CELL_TYPE Cell;
                     31: typedef double Float;
                     32: 
                     33: #define Clongest long long
                     34: typedef unsigned Clongest UClongest;
                     35: 
1.4       pazsan     36: #ifdef HAS_BACKLINK
1.10      pazsan     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;
1.11      pazsan     42: extern void *gforth_engine(void *, Cell *, Cell *, Float *, char *);
1.10      pazsan     43: extern char *cstr(char *from, Cell size);
                     44: extern char *tilde_cstr(char *from, Cell size);
1.14    ! pazsan     45: extern __thread jmp_buf *throw_jmp_handler;
1.4       pazsan     46: #define GFORTH_ARGS void
                     47: #else
1.12      pazsan     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)))))
1.14    ! pazsan     56: #define throw_jmp_handler *((jmp_buf**)(gforth_pointers(8)))
1.12      pazsan     57: #define GFORTH_ARGS void *(*gforth_pointers)(Cell)
1.4       pazsan     58: #endif
1.1       anton      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>