⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 script.h

📁 类PASCAL语言的编译器,LINUX环境的,我没试过是否正确.
💻 H
📖 第 1 页 / 共 3 页
字号:
#define CON_SEMICOLON  (1<<3) /* forces Statement() to return positive on ";"				 statement. Designed to support "for(;;)". */#define CON_PAREN      (1<<4) /* support for the last expression of the for(;;)				 ones */#define CON_ACTION     (1<<5) /* This flag forces Statement() to report errror				 if no "action" was made in the statement just				 parsed. */#define CON_END        (1<<6) /* Tell statement() there can be no				 "UNEXPECTED_END".*/#define CON_NUM        (1<<7) /* Only accept numerical statements! */#define CON_STRING     (1<<8) /* Hint about this being a string statement! */#define CON_DECLVOID   (1<<9) /* Declaration of a `void' function! */#define CON_DECLEXP    (1<<10) /* Declaration of an `export' symbol */#define CON_DECLGLOB   (1<<11) /* Declaration of a global symbol! */#define CON_IDENT      (1<<12) /* The local parameter points to an already				  parsed "struct Identifier" */#define CON_DECL8      (1<<13) /* Declaration of an eight bit variable */#define CON_DECL16     (1<<14) /* Declaration of an sixteen bit variable */#define CON_DECLUNSIGN (1<<15) /* Unsigned declaration */#define CON_DECLCONST  (1<<16) /* Constant declaration (read only) */#define CON_DECLSTATIC (1<<17) /* Static declaration */#define CON_LEVELOK    (1<<18) /* Disables same "proper level" controls */#define CON_LESSTHAN32 (CON_DECL8|CON_DECL16)#define CON_DECLARE (CON_DECLINT|CON_DECLSTR|CON_DECLVOID) /* declaration *//*********************************************************************** * * A bunch of useful macros: * **********************************************************************/#define isalpha(c)  ((type+1)[c] & (_U|_L))#define isupper(c)  ((type+1)[c] & _U)#define islower(c)  ((type+1)[c] & _L)#define isdigit(c)  ((type+1)[c] & _N)#define isxdigit(c) ((type+1)[c] & _X)#define isalnum(c)  ((type+1)[c] & (_U|_L|_N))#define isspace(c)  ((type+1)[c] & _S)#define ispunct(c)  ((type+1)[c] & _P)#define isprint(c)  ((type+1)[c] & (_U|_L|_N|_P))#define iscntrl(c)  ((type+1)[c] & _C)#define isascii(c)  (!((c) & ~127))#define isgraph(c)  ((type+1)[c] & (_U|_L|_N|_P))#define toascii(c)  ((c) & 127)#define toupper(c)  ((type+1)[c] & _L? (c)-CASE_BIT: c)#define tolower(c)  ((type+1)[c] & _U? (c)+CASE_BIT: c)#define isodigit(c) ((c) >= CHAR_ZERO && (c) <= CHAR_SEVEN)#define isident(c)  ((type+1)[c] & (_U|_L|_W))#define isidentnum(c)  ((type+1)[c] & (_U|_L|_W|_N))  /* CALL - macro performing the instruction inside parentheses and receiving     the return code in `ret'. If `ret' happens to become non-zero, a     "return(ret);" will be performed! */#define CALL(func) if(ret=(func)) return(ret)  /* GETMEM - macro allocating memory and returning FPLERR_OUT_OF_MEMORY if it     fails! */#define GETMEM(var,size) if(!(var=(void *)MALLOC(size))) \  return(FPLERR_OUT_OF_MEMORY);  /* GETMEMA - macro allocating static memory and returning FPLERR_OUT_OF_MEMORY     if it fails! */#define GETMEMA(x,y) GETMEM(x,y)  /* STRDUP - macro instead of the common strdup() ! */#define STRDUP(var, pointer) \  GETMEM(var, strlen((uchar *)(pointer))+1);\  strcpy(var, (pointer));  /* STRDUPA - macro instead of the common strdup() for STATIC allocs ! */#define STRDUPA(x,y) STRDUP(x,y)  /* UPPER - returns uppercase version any a-z character */#define UPPER(x) ((x)&~CASE_BIT)  /* ABS - returns the absolute value of the argument */#define ABS(x) ((x)>0?x:-x)  /* MIN - returns the minimum value of the two input arguments */#define MIN(x,y) ((x)<(y)?(x):(y))  /* MIN3 - returns the minimum value of the three input arguments */#define MIN3(x,y,z) MIN( MIN((x),(y)) ,(z))  /* Here follows the define for strdup() of a string stored in a     (struct fplStr *) */#define STRFPLDUP(dest,source)\   do {\     GETMEM(dest, sizeof(struct fplStr)+source->len); /* get string space */\     memcpy(dest->string, source->string, source->len); /* copy string */\     dest->len=dest->alloc=source->len; /* set alloc and length */\     dest->string[dest->len]='\0'; /* zero terminate! */\   } while(0)#define ASSIGN_OPERATOR ( \			 (scr->text[0]==CHAR_ASSIGN &&		\			  scr->text[1]!=CHAR_ASSIGN) ||		\			 ((scr->text[0]==CHAR_PLUS ||		\			  scr->text[0]==CHAR_MINUS ||		\			  scr->text[0]==CHAR_MULTIPLY ||	\			  scr->text[0]==CHAR_DIVIDE ||		\			  scr->text[0]==CHAR_AND ||		\			  scr->text[0]==CHAR_OR ||		\			  scr->text[0]==CHAR_REMAIN ||		\			  scr->text[0]==CHAR_XOR) &&		\			 scr->text[1]==CHAR_ASSIGN) ||		\			 !strncmp("<<=", scr->text, 3) ||	\			 !strncmp(">>=", scr->text, 3)		\			)/*********************************************************************** * * Defines: * **********************************************************************/#define MALLOC(x) malloc(x)#define FREE(x) free((void *)(x))#define FREEALL  DBG_FreeAll  /* this is from the debugmem bunch *//* compatibility mode: */#define FREEA FREE#define MALLOCA MALLOC#define FREEALLA FREEALL/* old version:   #define GETSTRLEN(str) ((long)*(long *)(str))   */#define GETSTRLEN(str) (((struct fplStr *)(((uchar *)str)-offsetof(struct fplStr, string)))->len)#if defined(AMIGA)  /*   * We have to make all external referenced functions to receive the   * parameters in certain registers and restore the A4 register.   */#define PREFIX#define AREG(x)#define DREG(x)#define REGARGS __regargs#define ASM /***************************************  *  * funclib specific defines:  *  **************************************/#else  /*   * No need for any of those!   */#define PREFIX#define REGARGS#define AREG(x)#define DREG(x)#define ASMtypedef unsigned char BOOL;#endif#if defined(AMIGA) /* the amiga library defines... */#define INLINE __inline#else#define INLINE#endif/********************************************************************** * * Create some structures and define their flags: * *********************************************************************/struct Unary {  Operator unary;  struct Unary *next;};struct InsideFunction {  /*   * Used for `inside' functions.   */  uchar ret;  uchar *format;     long col; /* column number of the inside function position. */  long prg; /* line number of the function */  uchar *file; /* name of file where this function resides */  long virprg; /* virtual line number */  uchar *virfile; /* virtual file name */};struct ExternalFunction {  /*   * Used for all other functions and keywords.   */  uchar ret; /* 'I' - returns an integer	       'S' - returns a string	       */  uchar *format; /* Parameter format. Zero terminated. Unlimited length.		   'I' - integer		   'S' - string		   'C' - string variable structure		   'N' - integer variable structure		   '>' - variable number of the previous type.		   NULL pointer - no argument at all.		   lower case - optional (must only be to the right of		   the required)		     		   Ex: "ISsc"		   means that the function requires two parameters:		   one integer and one string. It has two optional		   parameters: one string and one string variable. */  long ID; /* Identifier ID. This information is sent in the	      fplArgument structure.	      <0 is reserved for FPL internals. */};struct fplStr {  /*   * FPL 'string' structure!   */  long alloc;     /* Allocated length of following string. That goes for the		     string *only*! The structure's size have to be added if		     the entire alloc is wanted! Notice that the first (or		     last) byte in the string belongs to the structure and		     not the 'string'!!! */  long len;	  /* length of following string */  uchar string[1]; /* memory included in the string! */};struct fplVariable {  long num;    /* Number of dimensions */};struct Identifier {  /* This structure is used to store all identifiers in when they are "hashed     in". Notice that *ALL* data in this structure is pointing and referring     to the very same data as was sent to it, which means that you must keep     that data intact while using FPL. */  uchar *name; /* Indentifier. Must be absolutely unique and not more than		 MAX_COMMAND_LEN characters long. */  long number; /* identifier number */  long linenum; /* virtual line number of the variable declaration/definition */    union {    struct ExternalFunction external;    struct InsideFunction inside;    struct fplVariable variable;  } data;    unsigned long flags; /* See below! */  uchar *file;	/* file name of the file in which we find this identifier */    struct Identifier *func; /* It exists only under this function. Pointer might			      be NULL if in no function! */  long level; /* In which level this exists.		 Variables exist in all levels below (with a higher number)		 where it was declared. Two declarations using the same		 name in the same level is not allowed!		 LONG_MAX if global! */    unsigned long hash; /* Hash value. To get the proper hash table entry for			 this, use [hash%HASH_TABLE_SIZE] */    /* Bidirectional links to keep a hash value sorted order among     functions using the same hash table entry: */  struct Identifier *prev;  struct Identifier *next;};/****** Identifier.flags defines:  ******//* Data type */#define FPL_STRING_VARIABLE   (1<<0)  /* string variable */#define FPL_INT_VARIABLE      (1<<1)  /* integer variable */#define FPL_REFERENCE         (1<<2)  /* identifier reference */#define FPL_INTERNAL_FUNCTION (1<<3)  /* internal FPL function */#define FPL_EXTERNAL_FUNCTION (1<<4)  /* user supplied external function */#define FPL_INSIDE_FUNCTION   (1<<5)  /* inside function in any program */#define FPL_KEYWORD	      (1<<6)  /* this is a keyword identifier! */#define FPL_KEYWORD_DECLARE   (1<<7)  /* declaring keyword */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -