📄 yabasic.h
字号:
#ifndef __YABASIC_H__#define __YABASIC_H__/* YABASIC --- a simple Basic Interpreter written by Marc-Oliver Ihm 1995-2004 homepage: www.yabasic.de yabasic.h --- function prototypes and global variables This file is part of yabasic and may be copied only under the terms of either the Artistic License or the GNU General Public License (GPL), both of which can be found at www.yabasic.de*/#define YABLICENSE \" Yabasic may only be copied under the terms of either the \n"\" Artistic License or the GNU General Public License (GPL), \n"\" both of which can be found at www.yabasic.de. \n"\" The choice, which license you want to apply, is yours, \n"\" but you must stick to the license you have chosen for \n"\" at least one version of yabasic. \n"\"\n"\" Most people will want to use and distribute yabasic under the \n"\" terms of the Artistic License. It gives you the right to use \n"\" and distribute yabasic in a more-or-less customary fashion, \n"\" plus the right to make reasonable modifications and distribute \n"\" (or even sell) such a modified version under a different name. \n"\" However, the original author and copyright holder still reserves \n"\" himself some sort of artistic control over the development \n"\" of yabasic itself. \n"\"\n"\" However, as many people already know the GPL, yabasic may be \n"\" distributed under this license as well. \n"#define YABASIC_INCLUDED/* ------------- defines ---------------- *//* Define one and only one of the following symbols, depending on your System: - UNIX: uses some UNIX-features and X11 - WINDOWS: uses WIN32-features*/#if defined(UNIX) && defined(WINDOWS)UNIX and WINDOWS are defined at once; check your compiler settings#endif#define WINDOWS 1/* ------------- includes ---------------- */// zhou edit//#include <config.h>#include <stdio.h>#include <stdlib.h>#include <float.h>#include <math.h>#include <time.h>#include <limits.h>#include <errno.h>#ifdef WINDOWS#include <string.h>#include <windows.h>#include <io.h>#define ARCHITECTURE "windows"#ifdef __LCC__ /* fix for lccwin32 */#include <winspool.h>#endif#endif#ifdef UNIX#define ARCHITECTURE UNIX_ARCHITECTURE#ifdef HAS_STRING_HEADER#include <string.h>#elif HAS_STRINGS_HEADER#include <strings.h>#endif#include <sys/time.h>#include <sys/wait.h>#include <sys/ipc.h>#include <X11/Xlib.h>#include <X11/Xutil.h>#include <X11/Intrinsic.h>#define XK_LATIN1#define XK_MISCELLANY#include <X11/keysymdef.h>#include <unistd.h>#include <fcntl.h>#ifdef HAVE_NCURSES_HEADER#include <ncurses.h>#else#ifdef HAVE_CURSES_HEADER#include <curses.h>#endif#endif#ifndef KEY_MAX#define KEY_MAX 0777#endif#endif#ifndef FOPEN_MAX#define FOPEN_MAX 9#endif#include <signal.h>#include <ctype.h>#ifdef UNIX#ifndef LIBRARY_PATH#define LIBRARY_PATH "/usr/lib"#endif#endif#define OPEN_HAS_STREAM 1#define OPEN_HAS_MODE 2#define OPEN_PRINTER 8#define STDIO_STREAM 1234/* -------- variables needed in all files and defined in ... -------- *//* main.c */extern struct command *current; /* currently executed command */extern struct command *cmdroot; /* first command */extern struct command *cmdhead; /* next command */extern struct command *lastcmd; /* last command */extern int infolevel; /* controls issuing of error messages */extern int errorlevel; /* highest level of error message seen til now */extern int interactive; /* true, if commands come from stdin */extern char *progname; /* name of yabasic-program */extern char *explanation[]; /* explanations of commands */extern char **yabargv; /* arguments for yabasic */extern int yabargc; /* number of arguments in yabargv */extern time_t compilation_start,compilation_end,execution_end;extern char *string; /* for trash-strings */extern char *errorstring; /* for error-strings */extern int errorcode; /* error-codes */extern char library_path[]; /* full path to search libraries */extern int program_state; /* state of program */extern int check_compat; /* true, if compatibility should be checked */extern int is_bound; /* true, if this executable is bound *//* io.c */extern FILE *streams[]; /* file streams */extern int read_controls; /* TRUE, if input should read control characters */extern int stream_modes[]; /* modes for streams */extern int curinized; /* true, if curses has been initialized */extern int badstream(int,int); /* test for valid stream id */void myseek(struct command *); /* reposition file pointer */#ifdef WINDOWSextern HANDLE wantkey; /* mutex to signal key desire */extern HANDLE gotkey; /* mutex to signal key reception */extern HANDLE wthandle; /* handle of win thread */extern HANDLE kthandle; /* handle of inkey thread */extern DWORD ktid; /* id of inkey thread */extern int LINES; /* number of lines on screen */extern int COLS; /* number of columns on screen */extern HANDLE ConsoleInput; /* handle for console input */extern HANDLE ConsoleOutput; /* handle for console output */#elseextern int winpid; /* pid of process waiting for window keys */extern int termpid; /* pid of process waiting for terminal keys */#endif/* graphic.c *//* printing and plotting */extern int print_to_file; /* print to file ? */#ifdef WINDOWSextern HFONT printerfont; /* handle of printer-font */extern HDC printer; /* handle of printer */#endifextern FILE *printerfile; /* file to print on */extern double xoff; /* offset for x-mapping */extern double xinc; /* inclination of x-mapping */extern double yoff; /* offset for y-mapping */extern double yinc; /* inclination for y-mapping *//* window coordinates */extern int winopened; /* flag if window is open already */extern char *winorigin; /* e.g. "lt","rc"; defines origin of grafic window */extern int winwidth,winheight; /* size of window *//* mouse, console and keyboard */extern int mousex,mousey,mouseb,mousemod; /* last know mouse coordinates */extern char *ykey[]; /* keys returned by inkey *//* text and font */extern char *getreg(char *); /* get defaults from Registry */extern char *text_align; /* specifies alignement of text */extern int fontheight; /* height of font in pixel */#ifdef WINDOWSextern HFONT myfont; /* handle of font for screen */#endif/* general window stuff */extern char *foreground;extern char *background;extern char *geometry;extern char *displayname;extern char *font;extern int drawmode;#ifdef WINDOWSextern HWND window; /* handle of my window */extern HANDLE mainthread; /* handle to main thread */extern HANDLE this_instance;extern WNDCLASS myclass; /* window class for my program */extern char *my_class;extern BOOL Commandline; /* true if launched from command line */#elseextern int backpid; /* pid of process waiting for redraw events */#endif/* function.c */extern struct command *datapointer; /* current location for read-command *//* symbol.c */extern struct stackentry *stackroot; /* first element of stack */extern struct stackentry *stackhead; /* last element of stack */extern void query_array(struct command *cmd); /* query array */extern struct command *lastref; /* last command in UDS referencing a symbol */extern struct command *firstref; /* first command in UDS referencing a symbol */extern int labelcount; /* count self-generated labels *//* flex.c */extern int include_stack_ptr; /* Lex buffer for any imported file */extern struct libfile_name *libfile_stack[]; /* stack for library file names */extern struct libfile_name *currlib; /* current libfile as relevant to bison */extern int inlib; /* true, while in library */extern int fi_pending; /* true, if within a short if */extern int libfile_chain_length; /* length of libfile_chain */extern struct libfile_name *libfile_chain[]; /* list of all library file names *//* bison.c */extern char *current_function; /* name of currently parsed function */extern int yydebug;extern int missing_endif;extern int missing_endif_line;extern int in_loop;/*-------------------------- defs and undefs ------------------------*//* undef symbols */#undef FATAL#undef ERROR#undef WARNING#undef NOTE#undef DEBUG#undef DUMP#if !defined(TRUE)#define TRUE (1==1)#endif#ifndef FALSE#define FALSE (1!=1)#endif/* I've been told, that some symbols are missing under SunOs ... */#ifndef RAND_MAX#define RAND_MAX 32767#endif/* length of buffers for system() and input */#define SYSBUFFLEN 100#define INBUFFLEN 10000/* ---------------------- enum types ------------------------------- */enum error { /* error levels */ FATAL,ERROR,INFO,DUMP,WARNING,NOTE,DEBUG};enum endreasons { /* ways to end the program */ erNONE,erERROR,erREQUEST,erEOF};enum streammodes { /* ways to access a stream */ smCLOSED=0,smREAD=1,smWRITE=2,smPRINT=4};enum functions { /* functions in yabasic (sorted by number of arguments) */ fRAN2,fDATE,fTIME, fZEROARGS, fINKEY,fMOUSEX,fMOUSEY,fMOUSEB,fMOUSEMOD, fSIN,fASIN,fCOS,fACOS,fTAN, fATAN,fSYSTEM,fSYSTEM2,fPEEK,fPEEK2,fPEEK4,fTELL,fEXP,fLOG,fLEN,fSTR, fSQRT,fSQR,fFRAC,fABS,fSIG,fRAN,fINT,fVAL,fASC,fHEX,fBIN,fDEC,fUPPER,fLOWER, fLTRIM,fRTRIM,fTRIM,fCHR,fONEARGS,fDEC2,fATAN2,fLEFT,fAND,fOR,fEOR,fLOG2, fRIGHT,fINSTR,fRINSTR,fSTR2,fMOD,fMIN,fMAX,fPEEK3,fMID2, fTWOARGS, fMID,fINSTR2,fRINSTR2,fSTR3, fTHREEARGS, fGETBIT,fGETCHAR};enum arraymode { /* type of array access */ CALLARRAY,ASSIGNARRAY,CALLSTRINGARRAY,ASSIGNSTRINGARRAY,GETSTRINGPOINTER};enum drawing_modes { /* various ways to draw */ dmNORMAL=0,dmCLEAR=1,dmFILL=2};enum cmd_type { /* type of command */ cFIRST_COMMAND, /* no command, just marks start of list */ cLABEL,cSUBLINK,cGOTO,cQGOTO,cGOSUB,cQGOSUB,cRETURN, /* flow control */ cEND,cEXIT,cBIND,cDECIDE,cSKIPPER,cNOP,cFINDNOP,cEXCEPTION,cANDSHORT, cORSHORT,cSKIPONCE,cRESETSKIPONCE,cCOMPILE,cEXECUTE,cEXECUTE2, cDIM,cFUNCTION,cDOARRAY,cARRAYLINK,cPUSHARRAYREF,cCLEARREFS, /* everything with "()" */ cARDIM,cARSIZE,cTOKEN,cTOKEN2,cTOKENALT,cTOKENALT2, cSPLIT,cSPLIT2,cSPLITALT,cSPLITALT2, cSTARTFOR,cFORCHECK,cFORINCREMENT, /* for for-loops */ cSWITCH_COMPARE,cNEXT_CASE,cBREAK,cMINOR_BREAK, /* break-continue-switch */ cCONTINUE,cBREAK_HERE,cCONTINUE_HERE,cCONTINUE_CORRECTION, cBREAK_MARK,cPUSH_SWITCH_MARK,cCLEAN_SWITCH_MARK, cDBLADD,cDBLMIN,cDBLMUL,cDBLDIV,cDBLPOW, /* double operations */ cNEGATE,cPUSHDBLSYM,cPOP,cPOPDBLSYM,cPUSHDBL, cREQUIRE,cPUSHFREE,cMAKELOCAL,cMAKESTATIC,cNUMPARAM, /* functions and procedures */ cCALL,cQCALL,cPUSHSYMLIST,cPOPSYMLIST,cRET_FROM_FUN, cUSER_FUNCTION,cRETVAL,cEND_FUNCTION, cFUNCTION_OR_ARRAY,cSTRINGFUNCTION_OR_ARRAY, cPOKE,cPOKEFILE,cSWAP,cDUPLICATE,cDOCU, /* internals */ cAND,cOR,cNOT,cLT,cGT,cLE,cGE,cEQ,cNE, /* comparisons */ cSTREQ,cSTRNE,cSTRLT,cSTRLE,cSTRGT,cSTRGE,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -