📄 fpl.h
字号:
#ifndef FPL_H#define FPL_H/*** $Filename: libraries/FPL.h $** $Release: 14.11 $** $Date: 1997/04/01 $**** (C) Copyright 1992, 1993 by FrexxWare** All Rights Reserved*//************************************************************************ * * * fpl.library - A shared library interpreting script langauge. * * Copyright (C) 1992-1997 FrexxWare * * Author: Daniel Stenberg * * * * This program is free software; you may redistribute for non * * commercial purposes only. Commercial programs must have a written * * permission from the author to use FPL. FPL is *NOT* public domain! * * Any provided source code is only for reference and for assurance * * that users should be able to compile FPL on any operating system * * he/she wants to use it in! * * * * You may not change, resource, patch files or in any way reverse * * engineer anything in the FPL package. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * * * Daniel Stenberg * * Ankdammsgatan 36, 4tr * * S-171 43 Solna * * Sweden * * * * FidoNet 2:201/328 email:Daniel.Stenberg@sth.frontec.se * * * ************************************************************************/#ifdef DEFAULT_CHAR_IS_SIGNED/* * We introduce two new variable declarators to make all 'char' variables * clearly stated either signed or unsigned, to remain untied by stupid * compilers [different] defaults! * * (Still not properly used due to problems, beats me why!) */typedef signed char schar; /* 'schar' for -127 to 128 */typedef unsigned char uchar; /* 'uchar' for 0 to 255 */#elif defined(WIN32)typedef unsigned char uchar;#else/* * If we use some compiler switch or default that makes 'char' unsigned, * we can live with simply 'char' instead of 'unsigned char'. */typedef char uchar;#endif/* * OBSOLETE RETURN CODES! USE THE NEW 'FPLERR_*' ONES!!! */#ifndef OUTDATE_OLDenum { FPL_COULDNT_OPEN_DOS = 2, FPL_DIVISION_BY_ZERO, FPL_ILLEGAL_ANCHOR, FPL_ILLEGAL_ARRAY, FPL_ILLEGAL_ASSIGN, FPL_ILLEGAL_BREAK, FPL_ILLEGAL_CONDOP, FPL_ILLEGAL_CONTINUE, FPL_ILLEGAL_DECLARE, FPL_ILLEGAL_PARAMETER, FPL_ILLEGAL_PREOPERATION, FPL_ILLEGAL_PROTOTYPE, FPL_ILLEGAL_RESIZE, FPL_ILLEGAL_STATEMENT, FPL_ILLEGAL_VARIABLE, FPL_INTERNAL_ERROR, FPL_INSIDE_NOT_FOUND, FPL_MISSING_APOSTROPHE, FPL_MISSING_ARGUMENT, FPL_MISSING_BRACE, FPL_MISSING_BRACKET, FPL_MISSING_OPERAND, FPL_MISSING_PARENTHESES, FPL_MISSING_SEMICOLON, FPL_NO_ACTION, FPL_OPEN_ERROR, FPL_OUT_OF_MEMORY, FPL_OUT_OF_REACH, FPL_OUT_OF_STACK, FPL_PROGRAM_STOPPED, FPL_READONLY_VIOLATE, FPL_SYNTAX_ERROR, FPL_UNBALANCED_COMMENT, FPL_UNEXPECTED_END, FPL_UNMATCHED_BRACE, FPL_IDENTIFIER_NOT_FOUND, FPL_IDENTIFIER_USED, FPL_UNKNOWN_ERROR /* this or higher is unknown error codes! */};#endif/***** ALL BY FPL SUPPLIED, IMPLEMENTED AND SUPPORTED RETURN CODES: ******/typedef enum { FPL_OK, FPL_EXIT_OK, /* no error, the program stated simply exit() */ FPLERR_COULDNT_OPEN_DOS, /* NOT USED */ FPLERR_DIVISION_BY_ZERO, FPLERR_ILLEGAL_ANCHOR, FPLERR_ILLEGAL_ARRAY, FPLERR_ILLEGAL_ASSIGN, FPLERR_ILLEGAL_BREAK, FPLERR_ILLEGAL_CONDOP, FPLERR_ILLEGAL_CONTINUE, FPLERR_ILLEGAL_DECLARE, FPLERR_ILLEGAL_PARAMETER, FPLERR_ILLEGAL_PREOPERATION, FPLERR_ILLEGAL_PROTOTYPE, FPLERR_ILLEGAL_RESIZE, FPLERR_ILLEGAL_STATEMENT, FPLERR_ILLEGAL_VARIABLE, FPLERR_INTERNAL_ERROR, FPLERR_INSIDE_NOT_FOUND, FPLERR_MISSING_APOSTROPHE, FPLERR_MISSING_ARGUMENT, FPLERR_MISSING_BRACE, FPLERR_MISSING_BRACKET, FPLERR_MISSING_OPERAND, FPLERR_MISSING_PARENTHESES, FPLERR_MISSING_SEMICOLON, FPLERR_NO_ACTION, FPLERR_OPEN_ERROR, FPLERR_OUT_OF_MEMORY, FPLERR_OUT_OF_REACH, FPLERR_OUT_OF_STACK, FPLERR_PROGRAM_STOPPED, FPLERR_READONLY_VIOLATE, FPLERR_SYNTAX_ERROR, FPLERR_UNBALANCED_COMMENT, FPLERR_UNEXPECTED_END, FPLERR_UNMATCHED_BRACE, FPLERR_IDENTIFIER_NOT_FOUND, FPLERR_IDENTIFIER_USED, FPLERR_MISSING_COLON, /* new from version 7 */ FPLERR_MISSING_WHILE, /* new from version 7 */ /* NEW ONES FROM V11: */ FPLERR_ILLEGAL_CASE, FPLERR_ILLEGAL_DEFAULT, FPLERR_UNEXPECTED_INT_STATEMENT, FPLERR_UNEXPECTED_STRING_STATEMENT, FPLERR_STRING_INDEX, FPLERR_ILLEGAL_REFERENCE, FPLERR_TOO_MANY_PARAMETERS, FPLERR_UNKNOWN_ERROR /* this or higher is unknown error codes! */ } ReturnCode;/********************************************************************* * * Parameter and return type defines: * */#define FPL_STRVARARG 'C' /* as in 'C'haracter variable */#define FPL_INTVARARG 'N' /* as in 'N'numeric variable */#define FPL_STRVARARG_OPT (FPL_STRVARARG^32)#define FPL_INTVARARG_OPT (FPL_INTVARARG^32)#define FPL_OPTVARARG 'R' /* as in 'R'eference to C or N */#define FPL_STRARRAYVARARG 'B' /* string array reference */#define FPL_INTARRAYVARARG 'D' /* integer array reference */#define FPL_VOIDARG 'V' /* as in 'V'oid, no return values */#define FPL_OPTARG 'A' /* like in 'A'll accepted, which then can be any one of CNSI */#define FPL_STRARG 'S' /* as in 'S'tring */#define FPL_INTARG 'I' /* as in 'I'nteger */#define FPL_OPTEXPRARG 'O' /* as in 'O'ptionally S or I */#define FPL_STRARG_OPT (FPL_STRARG^32)#define FPL_INTARG_OPT (FPL_INTARG^32)#define FPL_OPTARG_OPT (FPL_OPTARG^32)#define FPL_ARGLIST '>'/********************************************************************* * fplInit() and fplReset() tags: ********************************************************************/#define FPLTAG_END 0#define FPLTAG_DONE 0#define FPLSEND_DONE 0#define FPLSEND_END 0#define FPLREF_DONE 0#define FPLREF_END 0/* End of tag list defines! */#define FPLTAG_INTERVAL 1 /* data is a function pointer *//* Define the interval function pointer! */#define FPLTAG_ZERO_TERMINATE 2 /* obsolete tag from version 5*/#define FPLTAG_STACK 3 /* data is size in bytes *//* Important only for the Amiga library version! Default startup size of the library stack. */#define FPLTAG_USERDATA 4 /* data is free to use to anything! *//* Userdata able to read anywhere with GetUserdata(): */#define FPLTAG_FUNCDATA FPLTAG_USERDATA /* data is free to use *//* Specifies private data to a specific function. */#define FPLTAG_FUNCTION 5 /* data is a function pointer *//* fplAddFunction() tag only. function handler routine for this function. */#define FPLTAG_MAXSTACK 6 /* OBSOLETE from version 9.5 */#define FPLTAG_STACKLIMIT 7 /* data is size in bytes *//* (Amiga) Absolute maximum memory area used as stack by one single FPL program. *//* removed obsolete tag `FPLTAG_FREE' ! */#define FPLTAG_INTERNAL_ALLOC 9 /* data is function pointer *//* To a "void *(*)(long)" (on Amiga, the parameter will be sent in d0 and *not* on the stack)! */#define FPLTAG_INTERNAL_DEALLOC 10 /* data is function pointer *//* To a "void (*)(void *, long);" (on Amiga, the parameters will be sent in the registers a1 and d0 and *NOT* on the stack as all other functions do. */#define FPLTAG_INTERPRET 11 /* data is a char pointer *//* To a fully FPL syntax statement to be interpreted instead of the actual main function of the program that is about to get started. */#define FPLTAG_STARTPOINT 12 /* data is a char pointer *//* To the alternative start position of this program. */#define FPLTAG_STARTLINE 13 /* data is integer *//* The line of the upper start point if not 1. */#define FPLTAG_STOREGLOBALS 14 /* data is boolean *//* This enables/disables the FPL global symbol storage ability. */#define FPLTAG_CACHEALLFILES 15 /* data is one of the defines below *//* Should FPL cache all files exporting functions? */#define FPLTAG_CACHEFILE 16 /* data is one of the defines below *//* Should FPL cache this file. Default is FPLTAG_CACHEALLFILES or false. */#define FPLCACHE_NONE 0 /* never cache */#define FPLCACHE_ALWAYS 1 /* always cache */#define FPLCACHE_EXPORTS 2 /* cache if symbols were exported */#define FPLTAG_FILEID 17 /* data is a unique file identification 32-bit *//* This fileID is used by FPL. Associate this program with this fileID! If you ever make a FPLSEND_FLUSHCACHEDFILES and this file is removed from memory, FPL will use this when requesting the file from you! If this file doesn't declare any `export' functions, if you never flushes this file or if you don't allow saved export variables, this tag can be ignored (FPL will then create a temporary fileID to use). */#define FPLTAG_PROGNAME 18 /* data is char pointer to zero terminated name *//* When using fplExecuteScript(), FPL does not have a name for the program. If you want anything but <unknown program> in a possible error report, you should use this. fplEXecuteFile() automatically sets this tag, but if you don't want the program to be named as the file name, use this tag then too! */#define FPLTAG_FILEGLOBALS 19 /* data is pointer to long */#define FPLTAG_ISCACHED FPLTAG_FILEGLOBALS/* Supply this tag with a pointer to a `long' and receive a zero (0) if no global symbols was declared, or a non-zero (_not_ the number of symbols) value if any global symbols were declared. If this leaves a non-zero value, it means that FPL has stored symbols associated with this program's ID. If you do not want them, use the {FPLSEND_FREEFILE, filename} tag to clean up. If you want to be able to start the same program using the old global symbol values (and not confusing the interpreter), use the same file name on next start. */#define FPLTAG_FILENAMEGET 20 /* data is boolean *//* This tag tells FPL that the program name is ok to use as file name to load the program from after a flush. fplExecuteFile() uses this tag as default. */#define FPLTAG_MINSTACK 21 /* OBSOLETE from version 9.5 */#define FPLTAG_LOCKUSED 22 /* OBSOLETE from version 13 *//**** NEW FROM VERSION 5: ****/#define FPLTAG_HASH_TABLE_SIZE 23 /* data is a long *//* This sets the hash table size. USE ONLY IN fplInit()!!! */#define FPLTAG_NEWLINE_HOOK 24 /* data is a standard long (*)(void *); *//* Called after every newline character read. The argument is sent in register A0 in the Amiga version. The argument is so far only the fplinit() return code. This might be subject to change to next release!! If you intend to use this, use caution! *//**** NEW FROM VERSION 5.3: ****/#define FPLTAG_ALLFUNCTIONS 25 /* data is boolean *//* Enables the FPL_UNKNOWN_FUNCTION interface message. Whenever FPL finds a function not recognized, it will still parse all arguments and call the interface function. *//**** NEW FROM VERSION 6: ****/#define FPLTAG_STRING_RETURN 27 /* data is pointer to a char pointer *//* enables the top level FPL program to return a string to the calling program in the pointer the data supplies a pointer to. NULL disables the ability. The string should be freed using the brand new function fplFreeString() *//**** NEW FROM VERSION >6: ****/#define FPLTAG_NESTED_COMMENTS 28 /* data is boolean *//* This fplInit() tag makes FPL allow nested comments. Default is off. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -