📄 script.h
字号:
/****************************************************************************** * FREXX PROGRAMMING LANGUAGE * ****************************************************************************** Script.h Script structures and defines! *****************************************************************************//************************************************************************ * * * fpl.library - A shared library interpreting script langauge. * * Copyright (C) 1992-1994 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:dast@sth.frontec.se * * * ************************************************************************/#define OUTDATE_OLD /* to outdate the old error enums! */#include <string.h>#include <stdlib.h> /* for malloc() and free() */#include "FPL.h"#include "cmdline.h"#include "debugmem.h" /* re-define certain memory functions *//********************************************************************** * * Global defines: * *********************************************************************/#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endif#define FPLTEXT_UNKNOWN_PROGRAM "<unknown program>"/* When requesting the name of a program, and no program is available or no name has been given. This string will be returned! */#define MAX_DIMS 40 /* Maximum number of array dimensions */#define IDENTIFIER_LEN 64/* maximum number of characters in a function-, variable- or label name ANSI C Standard X3J11 states that there should be at least "31 significant initial characters in an internal identifier or a macro name" */#define ADDSTRING_DEFAULT 16 /* default length of a string expression */#define ADDSTRING_INC 63 /* string expression length increase step */#define MAX_ARGUMENTS 63 /* number of parsed function arguments before realloc is done */#define FPL_HASH_SIZE 67/* Default hash table size. This should not be dividable with 2, 3, 4 or 5 */#define FPL_MIN_HASH 10/* The smallest acceptable hash table size */#define BUF_SIZE (IDENTIFIER_LEN+3) /* "global" FPL buffer size */#define MAX_FILENAME_LENGTH 256#if defined(AMIGA) && defined(SHARED)#define FPL_MIN_STACK 8000 /* smallest required stack */#define FPL_MAX_STACK 20000 /* maximum stack left after a run */#define FPL_MAX_LIMIT 40000 /* default maximum stack use possible */#define FPLSTACK_MINIMUM 1000 /* Stack margin. When the stack space is below, this, than realloc to a bigger one! */#endif/* * Flags to use with the exists() function: */#define EXISTS_FUNCTION 'f'#define EXISTS_VARIABLE 'v'#define EXISTS_STRING 's'#define EXISTS_INTEGER 'i'/********************************************************************** * * Different character defines: * **********************************************************************/#define _U (1<<0) /* upper case */#define _L (1<<1) /* lower case */#define _W (1<<2) /* also included as a valid identifier character */#define _N (1<<3) /* numerical digit 0-9 */#define _S (1<<4) /* white space */#define _C (1<<5) /* control character */#define _P (1<<6) /* punctation characters */#define _X (1<<7) /* hexadecimal digit */extern const uchar type[257];#define CHAR_OPEN_BRACE '{'#define CHAR_CLOSE_BRACE '}'#define CHAR_OPEN_PAREN '('#define CHAR_CLOSE_PAREN ')'#define CHAR_OPEN_BRACKET '['#define CHAR_CLOSE_BRACKET ']'#define CHAR_COMMA ','#define CHAR_SEMICOLON ';'#define CHAR_PLUS '+'#define CHAR_MINUS '-'#define CHAR_ONCE_COMPLEMENT '~'#define CHAR_NOT_OPERATOR '!'#define CHAR_MULTIPLY '*'#define CHAR_DIVIDE '/'#define CHAR_AND '&'#define CHAR_OR '|'#define CHAR_XOR '^'#define CHAR_REMAIN '%'#define CHAR_QUESTION '?'#define CHAR_COLON ':'#define CHAR_ASSIGN '='#define CHAR_LESS_THAN '<'#define CHAR_GREATER_THAN '>'#define CHAR_SPACE ' '#define CHAR_DOLLAR '$'#define CHAR_HASH '#'#define CHAR_ZERO '0'#define CHAR_ONE '1'#define CHAR_TWO '2'#define CHAR_THREE '3'#define CHAR_FOUR '4'#define CHAR_FIVE '5'#define CHAR_SIX '6'#define CHAR_SEVEN '7'#define CHAR_EIGHT '8'#define CHAR_NINE '9'#define CHAR_UPPER_A 'A'#define CHAR_A 'a'#define CHAR_UPPER_B 'B'#define CHAR_B 'b'#define CHAR_UPPER_C 'C'#define CHAR_C 'c'#define CHAR_D 'd'#define CHAR_F 'f'#define CHAR_UPPER_I 'I'#define CHAR_I 'i'#define CHAR_UPPER_N 'N'#define CHAR_N 'n'#define CHAR_O 'o'#define CHAR_R 'r'#define CHAR_UPPER_S 'S'#define CHAR_S 's'#define CHAR_T 't'#define CHAR_V 'v'#define CHAR_UPPER_X 'X'#define CHAR_X 'x'#define CHAR_APOSTROPHE '\''#define CHAR_NEWLINE '\n'#define CHAR_VERTICAL_TAB '\v'#define CHAR_CARRIAGE_RETURN '\r'#define CHAR_ALERT '\a'#define CHAR_QUOTATION_MARK '\"'#define CHAR_BACKSLASH '\\'#define CHAR_FORMFEED '\f'#define CHAR_BACKSPACE '\b'#define CHAR_TAB '\t'#define CHAR_ASCII_ZERO '\0'#define CASE_BIT ('a'-'A')/********************************************************************** * * A bunch of useful enums: * **********************************************************************/typedef enum { /* all FPL operators */ OP_NOTHING, OP_PLUS, OP_MINUS, OP_DIVISION, OP_MULTIPLY, OP_SHIFTL, OP_SHIFTR, OP_REMAIN, OP_BINAND, OP_BINOR, OP_BINXOR, OP_LOGAND, OP_LOGOR, OP_COMPL, OP_COND1, OP_COND2, OP_EQUAL, OP_LESSEQ, OP_GRETEQ, OP_LESS, OP_GRET, OP_NOTEQ, OP_NOT, OP_PREINC, /* pre increment */ OP_PREDEC /* pre decrement */} Operator;typedef enum { /* the internal functions and keywords */ CMD_AUTO=-200, CMD_BREAK, CMD_CASE, CMD_CONST, CMD_CONTINUE, CMD_DEFAULT, CMD_DO, CMD_DOUBLE, CMD_ELSE, /* here just to force error if used misplaced */ CMD_ENUM, CMD_EXIT, CMD_EXPORT, CMD_FLOAT, CMD_FOR, CMD_IF, CMD_INT, CMD_REGISTER, CMD_RESIZE, CMD_RETURN, CMD_SIGNED, CMD_STATIC, CMD_STRING, CMD_STRUCT, CMD_SWITCH, CMD_TYPEDEF, CMD_UNION, CMD_UNSIGNED, CMD_VOID, CMD_VOLATILE, CMD_WHILE, FNC_ABS=-100, FNC_ATOI, FNC_DEBUG, FNC_EVAL, FNC_EXISTS, FNC_INTERPRET, FNC_ITOA, FNC_ITOC, FNC_JOINSTR, FNC_LTOSTR, FNC_RENAME, FNC_SPRINTF, FNC_SSCANF, FNC_STRCMP, FNC_STRICMP, FNC_STRISTR, FNC_STRLEN, FNC_STRNCMP, FNC_STRNICMP, FNC_STRSTR, FNC_STRTOL, FNC_SUBSTR, FNC_OPENLIB, /* amiga only */ FNC_CLOSELIB, /* amiga only */ LAST_INTERNAL /* must be the last of these ones! */ } Funcs;#define KEYWORD_ELSE "else" /* the "else" keyword define !! *//********************************************************************** * * Script() control bits: * *********************************************************************/#define SCR_NORMAL 0 /* Nothing! */#define SCR_IF (1<<0)#define SCR_WHILE (1<<1)#define SCR_DO (1<<2)#define SCR_FOR (1<<3)#define SCR_LOOP (SCR_WHILE|SCR_DO|SCR_FOR)#define SCR_FUNCTION (1<<4)#define SCR_BRACE (1<<5) /* Declaration is allowed! This started with a brace - should end with a brace, return(), break or exit() */#define SCR_RETURN_STRING (1<<6)/* This function is declared to return a string */#define SCR_GLOBAL (1<<7)#define SCR_SWITCH (1<<8)#define SCR_FILE (1<<9) /* this is the file level, on this level the program can end with a '\0' char! */#define SCR_DEBUG (1<<10) /* this level runs in debug mode! *//*********************************************************************** * * Expression() control bits: * **********************************************************************/#define CON_NORMAL 0 /* normal statement */#define CON_DECLINT (1<<0) /* int declaration statement */#define CON_DECLSTR (1<<1) /* string declaration statement */#define CON_GROUNDLVL (1<<2) /* this statement starts at the ground level */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -