script.h
来自「类PASCAL语言的编译器,LINUX环境的,我没试过是否正确.」· C头文件 代码 · 共 1,385 行 · 第 1/4 页
H
1,385 行
unsigned long flags; /* Flags. See defines below! */ long data; /* The result of the interfunc. */ long FPLret; /* FPL return code = the result of the "exit(RETURN_CODE);" call! */ long *returnint; /* pointer to the above if an integer actually was returned */ long hash_size; /* hash table size! */ struct Identifier **hash; /* Must be set to NULL before doing anything major... like using fplAddFunction() or calling fplExecute[File]() The NULL-setting is done by fplInit(). */ struct Local *usersym; /* Pointer to list holding all global symbols declared in another FPL program run. These symbols are legal global symbols */ struct MemInfo *MallocKey[2]; /* We have two mallockey pointers because we have two different kinds of Malloc()s! One for each execution and one for each fplInit(). */ struct FreeBlock *blox[BLOCK_ENTRIES]; /* memory caching tables */ long blockcount[BLOCK_ENTRIES]; /* memory caching table counters */ struct Identifier *func; /* pointer to the current interpreted function or NULL */ long runs; uchar **string_return; /* whether this program should allow strings to be returned to the host program (set with the FPLTAG_STRING_RETURN tag to 'fplExecuteXXX()'). */ uchar *identifier; /* host program identifier. This should point to a unique string to enable separation between different processes use of FPL library functions! */ void *debugentry; /* used by the debugger alone! *Hands off!* */ uchar *error; /* pointer to error message buffer or NULL */ long breaks; /* number of levels possible to break! Each nested for, do, while and switch increases, each end of the same decreases as well as break, return and exit */#define ADDBUFFER_SIZE 32 /* buffered size; before appending string */ uchar addchar_buffer[ADDBUFFER_SIZE]; long addchar_len;#ifdef AMIGA struct Library *FPLBase; /* * Pointer to our own library base. * Could become handy for the debugger and/or other * external programs to control FPL internal * affairs!! */#endif struct CompiledInfo localinfo; /* local symbol list */ struct CompiledInfo *globalinfo; /* global symbol list, points to the corresponding struct in the appropriate struct Program */ struct fplArgument *arg; /* argument info since last function invoke */};/***** Data.flags: *****/#define FPLDATA_ALLFUNCTIONS (1<<0)/* Accept all functions, even if not found! */#define FPLDATA_CACHEFILE (1<<1)/* This file should be cached among the other global data. */#define FPLDATA_CACHEALLFILES (1<<2)/* This makes FPL store all files in memory that it has to remember */#define FPLDATA_CACHEEXPORTS (1<<3)/* This makes FPL store all files in memory that exports symbols */#define FPLDATA_NESTED_COMMENTS (1<<6)/* Allow nested comments */#define FPLDATA_REREAD_CHANGES (1<<7)/* Mark all files by default to get reread into memory when its accessed and the actual file is changed on disk, the symbols for that file will be removed and the file re-read into memory! */#define FPLDATA_FLUSH_NOT_IN_USE (1<<8)/* Mark all files by default to be flushed from memory when not used! */#define FPLDATA_DEBUG_MODE (1<<9) /* currently running in debug mode! */#define FPLDATA_DEBUG_GLOBAL (1<<10) /* always debug mode! */#define FPLDATA_DEBUG (FPLDATA_DEBUG_MODE|FPLDATA_DEBUG_GLOBAL)#define FPLDATA_KIDNAP_CACHED (1<<11) /* kidnap mode default */#define FPLDATA_PREVENT_RUNNING_SAME (1<<12) /* never execute a file that is cached and hasn't been changed since last execution */#define FPLDATA_ISOLATE (1<<13) /* this script cannot export symbols, nor can it access other exported symbols! */#define FPLDATA_AUTOCOMPILE (1<<14)#define FPLDATA_AUTORUN (1<<15) struct fplMsg { struct fplMsg *next; /* next message struct */ struct fplMsg *prev; /* when priority is allowed, things might be inserted virtually anywhere in the list */ uchar type; /* type of message. See defined below! */ void *message[1]; /* different meanings depending on the type */ uchar flags; /* new from version 12.6 */};/* When the FPLMSG_RETURN type is used, these 'flags' bits tell which type that actually was returned! */#define FPLMSG_FLG_STRING (1<<0)#define FPLMSG_FLG_INT (1<<1)#define FPLMSG_FLG_BITS (FPLMSG_FLG_STRING | FPLMSG_FLG_INT)#define FPLMSG_RETURN 1 /* general return type message, see the 'flags' field for data type! */#define FPLMSG_STOP 3 /* message[0] is to be stored in Data->data as the "result of the last interfunc". */#define FPLMSG_PROGRAM 4 /* message[0] is a (uchar **) to the program array, message[1] is zero or the new number of lines and message[2] is zero or the new program size. */#define FPLMSG_CONFIRM 5 /* message[0] is TRUE/FALSE */#define FPLMSG_GLOBAL 6 /* Global symbol reading is ordered. (FPLSEND_GLOBALSYMBOLS) message[0] holds the current pointer to a struct Local *//********************************************************************** * * * All functions used from external functions. * * * **********************************************************************/ReturnCode PREFIX fplExecuteScript(AREG(0) struct Data *, AREG(1) uchar **, DREG(1) long, AREG(2) unsigned long *);ReturnCode PREFIX fplExecuteFile(AREG(0) struct Data *, AREG(1) uchar *, AREG(2) unsigned long *);PREFIX uchar * fplGetErrorMsg(AREG(0) struct Data *, DREG(0) long, AREG(1) uchar *);void * ASM fplInit(AREG(0) long (*)(void *), AREG(1) unsigned long *);void PREFIX fplFree(AREG(0) struct Data *);ReturnCode PREFIX fplAddFunction(AREG(0) struct Data *, AREG(1) uchar *, DREG(0) long, DREG(1) uchar, AREG(2) uchar *, AREG(3) unsigned long *);ReturnCode PREFIX fplDelFunction(AREG(0) struct Data *, AREG(1) uchar *);ReturnCode PREFIX fplReset(AREG(0) struct Data *, AREG(1) unsigned long *);ReturnCode PREFIX fplSend(AREG(0) struct Data *, AREG(1) unsigned long *);void PREFIX *fplAlloc(AREG(0) struct Data *, DREG(0) long);void PREFIX fplDealloc(AREG(0) struct Data *, AREG(1) void *);void PREFIX *fplAlloca(AREG(0) struct Data *, DREG(0) long);void PREFIX fplDealloca(AREG(0) struct Data *, AREG(1) void *);long PREFIX fplConvertString(AREG(0) struct Data *, AREG(1) uchar *, AREG(2) uchar *);ReturnCode PREFIX fplCallFunction(AREG(0) struct Data *, AREG(1) uchar *, DREG(0) long, AREG(2) void **, AREG(3) uchar *format, AREG(4) unsigned long *);void PREFIX *fplAllocString(AREG(0) struct Data *, DREG(0) long);void PREFIX fplFreeString(AREG(0) struct Data *, AREG(1) void *);#ifdef AMIGAlong PREFIX fplOpenLib(AREG(0) struct Data *, AREG(1) uchar *, DREG(0) long, DREG(1) long);long PREFIX fplCloseLib(AREG(0) struct Data *, AREG(1) uchar *, DREG(0) long);#endifReturnCode PREFIX fplAddVariable(AREG(0) struct Data *, AREG(1) uchar *, DREG(0) long, DREG(1) uchar, AREG(2) void *, AREG(3) unsigned long *);ReturnCode PREFIX fplReference(AREG(0) struct Data *, AREG(1) struct Identifier *, AREG(2) unsigned long *);/********************************************************************** * All functions used globally in the library. * **********************************************************************//* * Mixed */ ReturnCode REGARGS Expression(struct Expr *, struct Data *, long, struct Identifier *);ReturnCode REGARGS Eat(struct Data *);ReturnCode REGARGS Getword(struct Data *);uchar * REGARGS GetErrorMsg(struct Data *, long, uchar *);#if defined(UNIX) || defined(WIN32)/* The Amiga version has this function coded in assembler */long InterfaceCall(struct Data *, void *, long (*)(void *));#define InterfaceCallNoStack InterfaceCall /* make them call the same func */#endifReturnCode REGARGS DelProgram(struct Data *, struct Program *);ReturnCode REGARGS ReadFile(void *, uchar *, struct Program *);ReturnCode REGARGS Newline(struct Data *);long REGARGS Strtol(uchar *, long, uchar **);ReturnCode REGARGS NewMember(struct Data *, struct Expr **);ReturnCode REGARGS ReturnChar(struct Data *, long *, uchar);ReturnCode REGARGS GetEnd(struct Data *, uchar, uchar, uchar);ReturnCode REGARGS CmpAssign(struct Data *, long, long *, long, uchar);ReturnCode REGARGS StrAssign(struct fplStr *, struct Data *, struct fplStr **, uchar);ReturnCode REGARGS AppendStringToString(struct Data *, struct fplStr **, uchar *, long);ReturnCode REGARGS Send(struct Data *, unsigned long *);ReturnCode REGARGS GetProgram(struct Data *, struct Program *);ReturnCode REGARGS LeaveProgram(struct Data *, struct Program *);ReturnCode REGARGS Warn(struct Data *, ReturnCode);ReturnCode REGARGS DeleteMessage(struct Data *, struct fplMsg *);ReturnCode REGARGS GetMessage(struct Data *, uchar, struct fplMsg **);ReturnCode REGARGS functions(struct fplArgument *);/* * From script.c */ReturnCode ASM Script(AREG(2) struct Data *, AREG(3) struct Expr *, DREG(2) short, AREG(1) struct Condition *);ReturnCode REGARGS ArrayResize(struct Data *, long, long *, struct Identifier *);void REGARGS CleanUp(struct Data *, long, long);long REGARGS BitToggle(long, long, long);/* * From memory.c */void ASM *DefaultAlloc(DREG(0) long, AREG(0) void *);void ASM DefaultDealloc(AREG(1) void *, DREG(0) long, AREG(0) void *);uchar REGARGS TypeMem(void *);void REGARGS SwapMem(struct Data *, void *, uchar);void ASM Free(AREG(0) struct Data *, AREG(1) void *, DREG(0) uchar);void REGARGS FreeCycle(struct Data *, void *);void REGARGS FreeAll(struct Data *, uchar);void ASM *Malloc(AREG(0) struct Data *, DREG(0) long, DREG(1) uchar DEBUGPARAMETERS1);void *MallocCycle(struct Data *, long DEBUGPARAMETERS2);void REGARGS InitFree(struct Data *);void REGARGS FlushFree(struct Data *);void REGARGS FreeKind(struct Data *, void *);#ifdef DEBUGReturnCode REGARGS CheckMem(struct Data *, void *);#endif/* * From hash.c */ReturnCode REGARGS AddToList(struct Data *, struct Identifier *, struct Local **);ReturnCode REGARGS AddVar(struct Data *, struct Identifier *, struct Local **);ReturnCode REGARGS DelLocalVar(struct Data *, struct Local **);ReturnCode REGARGS AddLevel(struct Data *);ReturnCode REGARGS RenameIdentifier(struct Data *, struct Identifier *, uchar *);ReturnCode REGARGS GetIdentifier(struct Data *, uchar *, struct Identifier **);ReturnCode REGARGS DelIdentifier(struct Data *, uchar *, struct Identifier *);/* * From numexpr.c */long REGARGS ArrayNum(long, long, long *, long *);ReturnCode REGARGS AddUnary(struct Data *, struct Expr *, Operator);ReturnCode REGARGS Calc(struct Data *, struct Expr *, struct Expr *);void REGARGS Clean(struct Data *, struct Expr *);ReturnCode REGARGS CallFunction(struct Data *, struct fplArgument *, struct Identifier *);/* * From scan.c */ReturnCode REGARGS ScanForNext(struct Data *, Operator); /* previous operator *//* * From statement.c */ReturnCode REGARGS StringExpr(struct Expr *, struct Data *);long REGARGS my_memicmp(uchar *, uchar *, long);/* * From sprintf.c */ReturnCode REGARGS Sprintf(struct Data *, struct fplStr **, uchar *, void **, uchar *, long);ReturnCode REGARGS AddCharBuffer(struct Data *, struct fplStr **, long);#define ADD_RESET -1 /* reset buffer */#define ADD_FLUSH -2 /* flush buffer *//* * From sscanf.c */long Sscanf(struct Data *, uchar *, uchar *, long, void **, uchar *);#if defined(AMIGA) /* * These are functions for funclibs only: */ReturnCode REGARGS OpenLib(struct Data *, uchar *, long, long *, uchar);ReturnCode REGARGS CloseLib(struct Data *, uchar *, long, long *);#endif/* * Compilation function prototypes. * From compile.c */ReturnCode REGARGS SetupCompiled(struct Program *);ReturnCode REGARGS CmpExpr(struct Expr *, struct Data *, long );ReturnCode REGARGS CmpReset(struct Data *, long);ReturnCode REGARGS AssignArg(struct Data *);ReturnCode REGARGS CmpExport(struct Data *);ReturnCode REGARGS CmpSwitch(struct Data *, struct Expr *);ReturnCode REGARGS CmpBreak(struct Data *, struct Expr *);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?