📄 yabasic.h
字号:
cPUSHSTRSYM,cPOPSTRSYM,cPUSHSTR,cCONCAT, /* string operations */ cPUSHSTRPTR,cCHANGESTRING,cGLOB, cPRINT,cREAD,cRESTORE,cQRESTORE,cONESTRING, /* i/o operations */ cREADDATA,cDATA,cOPEN,cCHECKOPEN,cCHECKSEEK,cCLOSE,cPUSHSTREAM,cPOPSTREAM, cSEEK,cSEEK2,cTESTEOF,cWAIT,cBELL,cMOVE, cCLEARSCR,cCOLOUR,cCHKPROMPT,cERROR, cOPENWIN,cDOT,cLINE,cCIRCLE,cTEXT,cCLOSEWIN,cCLEARWIN, /* grafics */ cOPENPRN,cCLOSEPRN,cMOVEORIGIN,cRECT, cPUTBIT,cPUTCHAR, cLAST_COMMAND /* no command, just marks end of list */};enum stackentries { /* different types of stackentries */ stGOTO,stSTRING,stSTRINGARRAYREF,stNUMBER,stNUMBERARRAYREF,stLABEL,stRETADD,stRETADDCALL,stFREE,stROOT, stANY,stSTRING_OR_NUMBER,stSTRING_OR_NUMBER_ARRAYREF, /* these will never appear on stack but are used to check with pop */ stSWITCH_MARK, /* used to clean up stack after switch-statement */ stSWITCH_STRING,stSWITCH_NUMBER /* only used in switch statement, compares true to every string or number */};enum symbols { /* different types of symbols */ sySTRING,syNUMBER,syFREE,syARRAY};enum function_type { /* different types of functions */ ftNONE,ftNUMBER,ftSTRING};enum addmodes { /* different modes for adding symbols */ amSEARCH,amSEARCH_PRE,amADD_LOCAL,amADD_GLOBAL,amSEARCH_VERY_LOCAL};enum states { /* current state of program */ HATCHED,INITIALIZED,COMPILING,RUNNING,FINISHED};enum yabkeys { /* recognized special keys */ kERR,kUP,kDOWN,kLEFT,kRIGHT,kDEL,kINS,kCLEAR,kHOME,kEND, kF0,kF1,kF2,kF3,kF4,kF5,kF6,kF7,kF8,kF9,kF10,kF11,kF12, kF13,kF14,kF15,kF16,kF17,kF18,kF19,kF20,kF21,kF22,kF23,kF24, kBACKSPACE,kSCRNDOWN,kSCRNUP,kENTER,kESC,kTAB,kLASTKEY};enum searchmodes { /* modes for searching labels */ smSUB=1,smLINK=2,smLABEL=4,smGLOBAL=8};/* ------------- global types ---------------- */ struct stackentry { /* one element on stack */ int type; /* contents of entry */ struct stackentry *next; struct stackentry *prev; void *pointer; /* multiuse ptr */ double value; /* double value, only one of pointer or value is used */};/* symbols are organized as a stack of lists: for every procedure call a new list is pushed onto the stack; all local variables of this function are chained into this list. After return from this procedure, the whole list is discarded and one element is popped from the stack.*/struct symstack { /* stack of symbol lists */ struct symbol *next_in_list; struct symstack *next_in_stack; struct symstack *prev_in_stack;};struct symbol { /* general symbol; either variable, string */ int type; struct symbol *link; /* points to linked symbol, if any */ struct symbol *next_in_list; /* next symbol in symbollist */ char *name; /* name of symbol */ void *pointer; /* pointer to string contents (if any) */ char *args; /* used to store number of arguments for functions/array */ double value;};struct command { /* one interpreter command */ int type; /* type of command */ int cnt; /* count of this command */ struct command *prev; /* link to previous command */ struct command *next; /* link to next command */ void *pointer; /* pointer to data */ void *symbol; /* pointer to symbol (or data within symbol) associated with command */ struct command *jump; /* pointer to jump destination */ char *name; /* name of symbol associated with command */ struct command *nextref; /* next cmd within function referencing a symbol */ struct command *nextassoc; /* next cmd within within chain of associated commands */ int args; /* number of arguments for function/array call */ /* or stream number for open/close */ int tag; /* char/int to pass some information */ int line; /* line this command has been created for */ struct libfile_name *lib; /* associated library */ int switch_id; /* TRUE, if in switch, FALSE else; used to check gotos */};struct array { /* data structure for arrays */ int bounds[10]; /* index boundaries */ int dimension; /* dimension of array */ void *pointer; /* contents of array */ char type; /* decide between string- ('s') and double-Arrays ('d') */};struct buff_chain { /* buffer chain for system-input */ char buff[SYSBUFFLEN+1]; /* content of buffer */ int len; /* used length of buff */ struct buff_chain *next; /* next buffer in chain */};struct libfile_name { /* used to store library names */ char *l; /* long version, including path */ int llen; /* length of l */ char *s; /* short version */ int slen; /* length of s */ int lineno; /* linenumber within file */ struct command *datapointer; /* data pointer of this library */ struct command *firstdata; /* first data-command in library */ struct libfile_name *next; /* next in chain */};/* ------------- function prototypes defined in ... ---------------- *//* main.c */void error(int,char *); /* reports an error and possibly exits */void error_with_line(int,char *,int); /* reports an error and possibly exits */void *my_malloc(unsigned); /* my own version of malloc */void my_free(void *); /* free memory */char *my_strerror(int); /* return description of error messages */struct command *add_command(int,char *); /* get room for new command */void signal_handler(int); /* handle various signals */char *my_strdup(char *); /* my own version of strdup */char *my_strndup(char *,int); /* own version of strndup */struct libfile_name *new_file(char *,char *); /* create a new structure for library names */char *dotify(char *,int); /* add library name, if not already present */char *strip(char *); /* strip off to minimal name */void do_error(struct command *); /* issue user defined error */void create_docu(char *); /* create command 'docu' */extern void add_variables(char *); /* add pi and e to symbol table */void compile(void); /* create a subroutine at runtime */void create_execute(int); /* create command 'cEXECUTE' */void execute(struct command *); /* execute a subroutine */int isbound(void); /* check if this interpreter is bound to a program *//* io.c */void checkopen(void); /* check, if open has been sucessfull */void create_colour(int); /* create command 'reverse' */void colour(struct command *cmd); /* switch reverse-printing */void create_print(char); /* create command 'print' */void print(struct command *); /* print on screen */void create_myread(char,int); /* create command 'read' */void myread(struct command *); /* read from file or stdin */void create_onestring(char *); /* write string to file */void onestring(char *); /* write string to file */void chkprompt(void); /* print an intermediate prompt if necessary */void create_myopen(int); /* create command 'myopen' */void myopen(struct command *); /* open specified file for given name */void testeof(struct command *); /* close the specified stream */void myclose(); /* close the specified stream */void create_pps(int,int); /* create command pushswitch or popswitch */void push_switch(struct command *); /* push current stream on stack and switch to new one */void pop_switch(void); /* pop current stream from stack and switch to it */void mymove(); /* move to specific position on screen */void clearscreen(); /* clear entire screen */char *inkey(double); /* gets char from keyboard, blocks and doesn磘 print */char *replace(char *); /* replace \n,\a, etc. *//* graphic.c */void create_openwin(int); /* create Command 'openwin' */void openwin(struct command *); /* open a Window */void create_openprinter(int); /* create command 'openprinter' */void openprinter(struct command *); /* opens a printer for WIN95 */void closeprinter(void); /* closes printer for WIN95 */void putindrawmode(int); /* store drawmode in previous command */void dot(struct command *); /* draw a dot */void create_line(int); /* create Command 'line' */void line(struct command *); /* draw a line */void moveorigin(); /* move origin of window */int check_alignement(char *); /* checks, if text-alignement is valid */void circle(struct command *cmd); /* draw a circle */void create_text(int); /* create Command 'text' */void text(struct command *); /* write a text */void closewin(void); /* close the window */void clearwin(void); /* clear the window */void rect(struct command *); /* draw a (filled) rect */void putbit(void); /* put rect onto window */void putchars(void); /* put rect onto screen */void create_marker(int); /* create command 'cMARKER' */void marker(struct command *); /* draw a marker */void getwinkey(char *); /* read a key from grafics window */void gettermkey(char *); /* read a key from terminal */char *getbit(int,int,int,int); /* get rect from window */char *getchars(int,int,int,int); /* get rect from screen */#ifdef WINDOWSLRESULT CALLBACK mywindowproc(HWND,unsigned,UINT,DWORD);#elsevoid calc_psscale(void); /* calculate scale-factor for postscript */#endif/* function.c */void create_exception(int); /* create command 'exception' */void exception(struct command *); /* change handling of exceptions */void create_poke(char); /* create Command 'POKE' */void poke(); /* poke in internals */void pokefile(struct command *); /* poke into file */void create_dblrelop(char); /* create command dblrelop */ void dblrelop(struct command *); /* compare topmost double-values */void concat(void); /* concetenates two strings from stack */void create_strrelop(char); /* create command strrelop */ void strrelop(struct command *); /* compare topmost string-values */void create_changestring(int); /* create command 'changestring' */void changestring(struct command *); /* changes a string */void glob(void); /* check, if pattern globs string */void create_boole(char); /* create command boole */ void boole(struct command *); /* perform and/or/not */void create_function(int); /* create command 'function' */void function(struct command *); /* performs a function */int myformat(char *,double,char *,char *); /* format number */void create_restore(char *); /* create command 'restore' */void restore(struct command *); /* reset data pointer to given label */void create_dbldata(double); /* create command dbldata */void create_strdata(char *); /* create command strdata */void create_readdata(char); /* create command readdata */void readdata(struct command *); /* read data items */void mywait(); /* wait given number of seconds */void mybell(); /* ring ascii bell */void getmousexybm(char *,int *,int *,int *,int *); /* get mouse coordinates */void token(struct command *); /* extract token from variable */void tokenalt(struct command *); /* extract token from variable with alternate semantics *//* symbol.c */struct array *create_array(int,int); /* create an array */void clearrefs(struct command *); /* clear references for commands within function */void duplicate(void); /* duplicate topmost element of stack */void negate(void); /* negates top of stack */void create_require(int); /* create command 'cREQUIRE' */void require(struct command *); /* check item on stack has right type */void create_makelocal(char *,int); /* create command 'cMAKELOCAL' */void create_makestatic(char *,int); /* create command 'cMAKESTATIC' */void create_arraylink(char *,int); /* create command 'cARRAYLINK' */void create_pusharrayref(char *,int); /* create command 'cPUSHARRAYREF' */void pusharrayref(struct command *); /* push an array reference onto stack */void arraylink(struct command *); /* link a local symbol to a global array */void makestatic(struct command *); /* makes symbol static */void makelocal(struct command *); /* makes symbol local */void create_numparam(void); /* create command 'cNUMPARAM' */void numparam(struct command *); /* count number of function parameters */void pushdblsym(struct command *); /* push double symbol onto stack */void popdblsym(struct command *); /* pop double from stack */void create_pushdbl(double); /* create command 'pushdbl' */void pushdbl(struct command *); /* push double onto stack */void create_dblbin(char); /* create binary expression calculation */void dblbin(struct command *); /* compute with two numbers from stack */void pushstrsym(struct command *); /* push string symbol onto stack */void popstrsym(struct command *); /* pop string from stack */void create_pushstr(char *); /* creates command pushstr */void pushstr(struct command *); /* push string onto stack */void pushname(char *); /* push a name on stack */void pushstrptr(struct command *); /* push string-pointer onto stack */void forcheck(void); /* check, if for-loop is done */void forincrement(void); /* increment value on stack */void startfor(void); /* compute initial value of for-variable */void create_goto(char *); /* creates command goto */void create_gosub(char *); /* creates command gosub */void create_call(char *); /* creates command function call */void create_label(char *,int); /* creates command label */void create_sublink(char *); /* create link to subroutine */void pushgoto(void); /* generate label and push goto on stack */void popgoto(void); /* pops a goto and generates the matching command */void jump(struct command *); /* jump to specific Label */void myreturn(struct command *); /* return from gosub */void findnop(); /* used for on_gosub, find trailing nop command */void skipper(void); /* used for on_goto/gosub, skip commands */void skiponce(struct command *); /* skip next command once */void resetskiponce(struct command *); /* find and reset next skip */void decide(void); /* skips next command, if not 0 on stack */void logical_shortcut(struct command *type); /* shortcut and/or if possible */ void create_doarray(char *,int); /* creates array-commands */ void doarray(struct command *); /* call an array */void create_dim(char *,char); /* create command 'dim' */void dim(struct command *); /* get room for array */void pushlabel(void); /* generate goto and push label on stack */void poplabel(void); /* pops a label and generates the matching command */void storelabel(); /* push label on stack */void matchgoto(); /* generate goto matching label on stack */void swap(void); /*swap topmost elements on stack */struct stackentry *push(void); /* push element on stack and enlarge it*/struct stackentry *pop(int); /* pops element to memory */struct symbol *get_sym(char *,int,int); /* find and/or add a symbol */void link_symbols(struct symbol *,struct symbol *); /* link one symbol to the other */void pushsymlist(void); /* push a new list on symbol stack */void popsymlist(void); /* pop list of symbols and free symbol contents */void dump_sym(); /* dump the stack of lists of symbols */void dump_sub(int); /* dump the stack of subroutine calls */void create_retval(int,int); /* create command 'cRETVAL' */void retval(struct command *); /* check return value of function */void create_endfunction(void); /* create command cEND_FUNCTION */void function_or_array(struct command *); /* decide whether to do perform function or array */struct command *search_label(char *,int); /* search label */void reshufflestack(struct stackentry *); /* reorganize stack for function call */void push_switch_mark(void); /* push a switch mark */void create_clean_switch_mark(int,int); /* add command clean_switch_mark */void clean_switch_mark(struct command *); /* pop everything up to (and including) first switch_mark from stack */void push_switch_id(void); /* generate a new switch id */void pop_switch_id(void); /* get previous switch id */int get_switch_depth(void); /* get current depth of switch id stack *//* flex.c */void yyerror(char *); /* yyerror message */void open_main(FILE *,char *,char *); /* switch to file */void open_string(char *); /* open string with commands */FILE *open_library(char *,char **,int); /* search and open a library */void switchlib(void); /* switch library, called by bison */// zhou edit -- begin/* ------------- defines ---------------- */#define DONE {current=current->next;break;} /* reduces type-work */#define COPYRIGHT "Copyright 1995-2004 by Marc-Oliver Ihm"// zhou edit -- add two lines#define VERSION "2.751"#define BUILD_TIME "2005-03-30"#define WM_WANTKEY 1000//#define BANNER \//"\nThis is yabasic version " VERSION ",\nbuilt on "\//ARCHITECTURE " at " BUILD_TIME "\n\n " COPYRIGHT "\n\n"//#define BANNER_VERSION \//"yabasic " VERSION ", built on " ARCHITECTURE "\n" COPYRIGHT#define YABFORHELP "(type 'yabasic -help' for help)"#define YABMAGIC "__YaBaSiC_MaGiC_CoOkIe__"// zhou edit -- end#endif // __YABASIC_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -