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

1.1       anton       1: /* header file for libcc-generated C code
                      2: 
1.19    ! anton       3:   Copyright (C) 2006,2007,2008,2012 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>
                     22: 
1.13      pazsan     23: #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) || defined(__ANDROID__)
1.4       pazsan     24: #undef HAS_BACKLINK
                     25: #else
                     26: #define HAS_BACKLINK 1
                     27: #endif
                     28: 
1.1       anton      29: typedef CELL_TYPE Cell;
1.15      pazsan     30: typedef unsigned char Char;
1.1       anton      31: typedef double Float;
1.15      pazsan     32: typedef Char *Address;
                     33: typedef void **Xt;
1.1       anton      34: 
                     35: #define Clongest long long
                     36: typedef unsigned Clongest UClongest;
                     37: 
1.15      pazsan     38: typedef struct {
                     39:   Cell next_task;
                     40:   Cell prev_task;
                     41:   Cell save_task;
                     42:   Cell* sp0;
                     43:   Cell* rp0;
                     44:   Float* fp0;
                     45:   Address lp0;
                     46:   Xt *throw_entry;
                     47: } user_area;
                     48: 
1.4       pazsan     49: #ifdef HAS_BACKLINK
1.10      pazsan     50: extern __thread Cell *gforth_SP;
                     51: extern __thread Float *gforth_FP;
                     52: extern __thread Cell *gforth_RP;
                     53: extern __thread char *gforth_LP;
                     54: extern __thread char *gforth_UP;
1.16      pazsan     55: extern void *gforth_engine(void *);
1.10      pazsan     56: extern char *cstr(char *from, Cell size);
                     57: extern char *tilde_cstr(char *from, Cell size);
1.17      pazsan     58: extern __thread void *throw_jmp_handler;
1.18      pazsan     59: extern user_area* gforth_stacks(Cell dsize, Cell rsize, Cell fsize, Cell lsize);
                     60: extern void gforth_free_stacks(user_area* t);
1.4       pazsan     61: #define GFORTH_ARGS void
                     62: #else
1.12      pazsan     63: #define gforth_SP *((Cell **)(gforth_pointers(0)))
                     64: #define gforth_FP *((Float **)(gforth_pointers(1)))
                     65: #define gforth_LP *((char **)(gforth_pointers(2)))
                     66: #define gforth_RP *((Cell **)(gforth_pointers(3)))
                     67: #define gforth_UP *((char **)(gforth_pointers(4)))
1.16      pazsan     68: #define gforth_engine ((char *(*)(void *))gforth_pointers(5))
1.15      pazsan     69: #define cstr ((char *(*)(char *, Cell))gforth_pointers(6))
                     70: #define tilde_cstr ((char *(*)(char *, Cell))gforth_pointers(7))
1.17      pazsan     71: #define throw_jmp_handler *((void**)(gforth_pointers(8)))
1.18      pazsan     72: #define gforth_stacks ((user_area *(*)(Cell, Cell, Cell, Cell))gforth_pointers(9))
                     73: #define gforth_free_stacks ((void(*)(user_area* t))gforth_pointers(10))
1.12      pazsan     74: #define GFORTH_ARGS void *(*gforth_pointers)(Cell)
1.4       pazsan     75: #endif
1.1       anton      76: 
                     77: #define CELL_BITS      (sizeof(Cell) * 8)
                     78: 
                     79: #define gforth_d2ll(lo,hi) \
                     80:   ((sizeof(Cell) < sizeof(Clongest)) \
                     81:    ? (((UClongest)(lo))|(((UClongest)(hi))<<CELL_BITS)) \
                     82:    : (lo))
                     83: 
                     84: #define gforth_ll2d(ll,lo,hi) \
                     85:   do { \
                     86:     UClongest _ll = (ll); \
                     87:     (lo) = (Cell)_ll; \
                     88:     (hi) = ((sizeof(Cell) < sizeof(Clongest)) \
                     89:             ? (_ll >> CELL_BITS) \
                     90:             : 0); \
                     91:   } while (0);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>