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

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;
1.15    ! pazsan     31: typedef unsigned char Char;
1.1       anton      32: typedef double Float;
1.15    ! pazsan     33: typedef Char *Address;
        !            34: typedef void **Xt;
1.1       anton      35: 
                     36: #define Clongest long long
                     37: typedef unsigned Clongest UClongest;
                     38: 
1.15    ! pazsan     39: typedef struct {
        !            40:   Cell next_task;
        !            41:   Cell prev_task;
        !            42:   Cell save_task;
        !            43:   Cell* sp0;
        !            44:   Cell* rp0;
        !            45:   Float* fp0;
        !            46:   Address lp0;
        !            47:   Xt *throw_entry;
        !            48: } user_area;
        !            49: 
1.4       pazsan     50: #ifdef HAS_BACKLINK
1.10      pazsan     51: extern __thread Cell *gforth_SP;
                     52: extern __thread Float *gforth_FP;
                     53: extern __thread Cell *gforth_RP;
                     54: extern __thread char *gforth_LP;
                     55: extern __thread char *gforth_UP;
1.11      pazsan     56: extern void *gforth_engine(void *, Cell *, Cell *, Float *, char *);
1.10      pazsan     57: extern char *cstr(char *from, Cell size);
                     58: extern char *tilde_cstr(char *from, Cell size);
1.14      pazsan     59: extern __thread jmp_buf *throw_jmp_handler;
1.15    ! pazsan     60: extern user_area* gforth_stacks();
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.15    ! pazsan     68: #define gforth_engine ((char *(*)(void *, Cell *, Cell *, Float *, char *))gforth_pointers(5))
        !            69: #define cstr ((char *(*)(char *, Cell))gforth_pointers(6))
        !            70: #define tilde_cstr ((char *(*)(char *, Cell))gforth_pointers(7))
1.14      pazsan     71: #define throw_jmp_handler *((jmp_buf**)(gforth_pointers(8)))
1.15    ! pazsan     72: #define gforth_stacks ((user_area *(*)())gforth_pointers(9))
1.12      pazsan     73: #define GFORTH_ARGS void *(*gforth_pointers)(Cell)
1.4       pazsan     74: #endif
1.1       anton      75: 
                     76: #define CELL_BITS      (sizeof(Cell) * 8)
                     77: 
                     78: #define gforth_d2ll(lo,hi) \
                     79:   ((sizeof(Cell) < sizeof(Clongest)) \
                     80:    ? (((UClongest)(lo))|(((UClongest)(hi))<<CELL_BITS)) \
                     81:    : (lo))
                     82: 
                     83: #define gforth_ll2d(ll,lo,hi) \
                     84:   do { \
                     85:     UClongest _ll = (ll); \
                     86:     (lo) = (Cell)_ll; \
                     87:     (hi) = ((sizeof(Cell) < sizeof(Clongest)) \
                     88:             ? (_ll >> CELL_BITS) \
                     89:             : 0); \
                     90:   } while (0);

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