File:  [gforth] / gforth / engine / libcc.h.in
Revision 1.4: download - view: text, annotated - select for diffs
Thu Sep 18 02:42:24 2008 UTC (15 years, 7 months ago) by pazsan
Branches: MAIN
CVS tags: HEAD
Windows version of libcc interface (first attempt)

    1: /* header file for libcc-generated C code
    2: 
    3:   Copyright (C) 2006,2007 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__)
   24: #undef HAS_BACKLINK
   25: #else
   26: #define HAS_BACKLINK 1
   27: #endif
   28: 
   29: typedef CELL_TYPE Cell;
   30: typedef double Float;
   31: 
   32: #define Clongest long long
   33: typedef unsigned Clongest UClongest;
   34: 
   35: #ifdef HAS_BACKLINK
   36: extern Cell *gforth_SP;
   37: extern Float *gforth_FP;
   38: extern Cell *gforth_RP;
   39: extern char *gforth_LP;
   40: extern char *gforth_UP;
   41: extern void *gforth_engine(void *, Cell *, Cell *, Float *, char *, char *);
   42: #define GFORTH_ARGS void
   43: #else
   44: #define gforth_SP *((Cell **)(gforth_pointers[0]))
   45: #define gforth_FP *((Float **)(gforth_pointers[1]))
   46: #define gforth_LP *((char **)(gforth_pointers[2]))
   47: #define gforth_RP *((Cell **)(gforth_pointers[3]))
   48: #define gforth_UP *((char **)(gforth_pointers[4]))
   49: #define gforth_engine ((char *(*)(Xt *, Cell *, Cell *, Float *, char *, char *))(((void **)(gforth_pointers[5]))))
   50: #define GFORTH_ARGS void ** gforth_pointers 
   51: #endif
   52: 
   53: #define CELL_BITS	(sizeof(Cell) * 8)
   54: 
   55: #define gforth_d2ll(lo,hi) \
   56:   ((sizeof(Cell) < sizeof(Clongest)) \
   57:    ? (((UClongest)(lo))|(((UClongest)(hi))<<CELL_BITS)) \
   58:    : (lo))
   59: 
   60: #define gforth_ll2d(ll,lo,hi) \
   61:   do { \
   62:     UClongest _ll = (ll); \
   63:     (lo) = (Cell)_ll; \
   64:     (hi) = ((sizeof(Cell) < sizeof(Clongest)) \
   65:             ? (_ll >> CELL_BITS) \
   66:             : 0); \
   67:   } while (0);

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