123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- #ifndef __NS_EELINT_H__
- #define __NS_EELINT_H__
- #ifdef _WIN32
- #include <windows.h>
- #else
- #include "../wdltypes.h"
- #endif
- #include "ns-eel.h"
- #include "ns-eel-addfuncs.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- #define FN_ASSIGN 0
- #define FN_MULTIPLY 1
- #define FN_DIVIDE 2
- #define FN_MODULO 3
- #define FN_ADD 4
- #define FN_SUB 5
- #define FN_AND 6
- #define FN_OR 7
- #define FN_UMINUS 8
- #define FN_UPLUS 9
- #define MATH_SIMPLE 0
- #define MATH_FN 1
- #define YYSTYPE INT_PTR
- #define NSEEL_CLOSEFACTOR 0.00001
- typedef struct
- {
- int srcByteCount;
- int destByteCount;
- } lineRecItem;
- typedef struct _compileContext
- {
- EEL_F **varTable_Values;
- char **varTable_Names;
- int varTable_numBlocks;
- int errVar;
- int colCount;
- INT_PTR result;
- char last_error_string[256];
- YYSTYPE yylval;
- int yychar;
- int yynerrs;
- char yytext[256];
- char lastVar[256];
- char *llsave[16];
- char llbuf[100];
- char *llp1;
- char *llp2;
- char *llend;
- char *llebuf;
- int lleof;
- int yyline;
- void *tmpblocks_head,*blocks_head;
- int computTableTop;
- int l_stats[4];
- lineRecItem *compileLineRecs;
- int compileLineRecs_size;
- int compileLineRecs_alloc;
- void *ram_blocks;
- int ram_needfree;
- void *gram_blocks;
- void *caller_this;
- }
- compileContext;
- #define NSEEL_VARS_PER_BLOCK 64
- typedef struct {
- const char *name;
- void *afunc;
- void *func_e;
- int nParams;
- void *replptrs[4];
- NSEEL_PPPROC pProc;
- } functionType;
- extern functionType *nseel_getFunctionFromTable(int idx);
- INT_PTR nseel_createCompiledValue(compileContext *ctx, EEL_F value, EEL_F *addrValue);
- INT_PTR nseel_createCompiledFunction1(compileContext *ctx, int fntype, INT_PTR fn, INT_PTR code);
- INT_PTR nseel_createCompiledFunction2(compileContext *ctx, int fntype, INT_PTR fn, INT_PTR code1, INT_PTR code2);
- INT_PTR nseel_createCompiledFunction3(compileContext *ctx, int fntype, INT_PTR fn, INT_PTR code1, INT_PTR code2, INT_PTR code3);
- extern EEL_F nseel_globalregs[100];
- void nseel_resetVars(compileContext *ctx);
- EEL_F *nseel_getVarPtr(compileContext *ctx, char *varName);
- EEL_F *nseel_registerVar(compileContext *ctx, char *varName);
- INT_PTR *EEL_GLUE_set_immediate(void *_p, void *newv);
- INT_PTR nseel_setVar(compileContext *ctx, INT_PTR varNum);
- INT_PTR nseel_getVar(compileContext *ctx, INT_PTR varNum);
- void *nseel_compileExpression(compileContext *ctx, char *txt);
- #define VALUE 258
- #define IDENTIFIER 259
- #define FUNCTION1 260
- #define FUNCTION2 261
- #define FUNCTION3 262
- #define UMINUS 263
- #define UPLUS 264
- INT_PTR nseel_translate(compileContext *ctx, int type);
- void nseel_count(compileContext *ctx);
- void nseel_setLastVar(compileContext *ctx);
- INT_PTR nseel_lookup(compileContext *ctx, int *typeOfObject);
- int nseel_yyerror(compileContext *ctx);
- int nseel_yylex(compileContext *ctx, char **exp);
- int nseel_yyparse(compileContext *ctx, char *exp);
- void nseel_llinit(compileContext *ctx);
- int nseel_gettoken(compileContext *ctx, char *lltb, int lltbsiz);
- struct lextab {
- int llendst;
- char *lldefault;
- char *llnext;
- char *llcheck;
- int *llbase;
- int llnxtmax;
- int (*llmove)();
- char *llfinal;
- int (*llactr)();
- int *lllook;
- char *llign;
- char *llbrk;
- char *llill;
- };
- extern struct lextab nseel_lextab;
- EEL_F * NSEEL_CGEN_CALL __NSEEL_RAMAlloc(EEL_F ***blocks, int w);
- EEL_F * NSEEL_CGEN_CALL __NSEEL_RAMAllocGMEM(EEL_F ***blocks, int w);
- EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemSet(EEL_F ***blocks,EEL_F *dest, EEL_F *v, EEL_F *lenptr);
- EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemFree(EEL_F ***blocks, EEL_F *which);
- EEL_F * NSEEL_CGEN_CALL __NSEEL_RAM_MemCpy(EEL_F ***blocks,EEL_F *dest, EEL_F *src, EEL_F *lenptr);
- #ifndef max
- #define max(x,y) ((x)<(y)?(y):(x))
- #define min(x,y) ((x)<(y)?(x):(y))
- #endif
- #ifdef __ppc__
- #define EEL_F2int(x) ((int)(x))
- #elif defined (_WIN64)
-
- #define EEL_F2int(x) ((int)(x))
- #elif defined(_MSC_VER)
- static __inline int EEL_F2int(EEL_F d)
- {
- int tmp;
- __asm {
- fld d
- fistp tmp
- }
- return tmp;
- }
- #else
- static inline int EEL_F2int(EEL_F d)
- {
- int tmp;
- __asm__ __volatile__ ("fistpl %0" : "=m" (tmp) : "t" (d) : "st") ;
- return tmp;
- }
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|