123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- /* acid.h */
- enum
- {
- Eof = -1,
- Strsize = 4096,
- Hashsize = 128,
- Maxarg = 512,
- NFD = 100,
- Maxproc = 50,
- Maxval = 10,
- Mempergc = 1024*1024,
- };
- #pragma varargck type "L" void
- typedef struct Node Node;
- typedef struct String String;
- typedef struct Lsym Lsym;
- typedef struct List List;
- typedef struct Store Store;
- typedef struct Gc Gc;
- typedef struct Strc Strc;
- typedef struct Rplace Rplace;
- typedef struct Ptab Ptab;
- typedef struct Value Value;
- typedef struct Type Type;
- typedef struct Frtype Frtype;
- Extern int kernel;
- Extern int remote;
- Extern int text;
- Extern int silent;
- Extern Fhdr fhdr;
- Extern int line;
- Extern Biobuf* bout;
- Extern Biobuf* io[32];
- Extern int iop;
- Extern char symbol[Strsize];
- Extern int interactive;
- Extern int na;
- Extern int wtflag;
- Extern Map* cormap;
- Extern Map* symmap;
- Extern Lsym* hash[Hashsize];
- Extern long dogc;
- Extern Rplace* ret;
- Extern char* aout;
- Extern int gotint;
- Extern Gc* gcl;
- Extern int stacked;
- Extern jmp_buf err;
- Extern Node* prnt;
- Extern List* tracelist;
- Extern int initialising;
- Extern int quiet;
- extern void (*expop[])(Node*, Node*);
- #define expr(n, r) (r)->comt=0; (*expop[(n)->op])(n, r);
- extern int fmtsize(Value *v) ;
- enum
- {
- TINT,
- TFLOAT,
- TSTRING,
- TLIST,
- TCODE,
- };
- struct Type
- {
- Type* next;
- int offset;
- char fmt;
- char depth;
- Lsym* type;
- Lsym* tag;
- Lsym* base;
- };
- struct Frtype
- {
- Lsym* var;
- Type* type;
- Frtype* next;
- };
- struct Ptab
- {
- int pid;
- int ctl;
- };
- Extern Ptab ptab[Maxproc];
- struct Rplace
- {
- jmp_buf rlab;
- Node* stak;
- Node* val;
- Lsym* local;
- Lsym** tail;
- };
- struct Gc
- {
- char gcmark;
- Gc* gclink;
- };
- struct Store
- {
- char fmt;
- Type* comt;
- union {
- vlong ival;
- double fval;
- String* string;
- List* l;
- Node* cc;
- };
- };
- struct List
- {
- Gc;
- List* next;
- char type;
- Store;
- };
- struct Value
- {
- char set;
- char type;
- Store;
- Value* pop;
- Lsym* scope;
- Rplace* ret;
- };
- struct Lsym
- {
- char* name;
- int lexval;
- Lsym* hash;
- Value* v;
- Type* lt;
- Node* proc;
- Frtype* local;
- void (*builtin)(Node*, Node*);
- };
- struct Node
- {
- Gc;
- char op;
- char type;
- Node* left;
- Node* right;
- Lsym* sym;
- int builtin;
- Store;
- };
- #define ZN (Node*)0
- struct String
- {
- Gc;
- char *string;
- int len;
- };
- List* addlist(List*, List*);
- List* al(int);
- Node* an(int, Node*, Node*);
- void append(Node*, Node*, Node*);
- int bool(Node*);
- void build(Node*);
- void call(char*, Node*, Node*, Node*, Node*);
- void catcher(void*, char*);
- void checkqid(int, int);
- void cmd(void);
- Node* con(vlong);
- List* construct(Node*);
- void ctrace(int);
- void decl(Node*);
- void defcomplex(Node*, Node*);
- void deinstall(int);
- void delete(List*, int n, Node*);
- void dostop(int);
- Lsym* enter(char*, int);
- void error(char*, ...);
- void execute(Node*);
- void fatal(char*, ...);
- void flatten(Node**, Node*);
- void gc(void);
- char* getstatus(int);
- void* gmalloc(long);
- void indir(Map*, uvlong, char, Node*);
- void installbuiltin(void);
- void kinit(void);
- int Lfmt(Fmt*);
- int listcmp(List*, List*);
- int listlen(List*);
- List* listvar(char*, vlong);
- void loadmodule(char*);
- void loadvars(void);
- Lsym* look(char*);
- void ltag(char*);
- void marklist(List*);
- Lsym* mkvar(char*);
- void msg(int, char*);
- void notes(int);
- int nproc(char**);
- void nthelem(List*, int, Node*);
- int numsym(char);
- void odot(Node*, Node*);
- void pcode(Node*, int);
- void pexpr(Node*);
- int popio(void);
- void pstr(String*);
- void pushfile(char*);
- void pushstr(Node*);
- void readtext(char*);
- void restartio(void);
- uvlong rget(Map*, char*);
- String *runenode(Rune*);
- int scmp(String*, String*);
- void sproc(int);
- String* stradd(String*, String*);
- String* straddrune(String*, Rune);
- String* strnode(char*);
- String* strnodlen(char*, int);
- char* system(void);
- void trlist(Map*, uvlong, uvlong, Symbol*);
- void unwind(void);
- void userinit(void);
- void varreg(void);
- void varsym(void);
- Waitmsg* waitfor(int);
- void whatis(Lsym*);
- void windir(Map*, Node*, Node*, Node*);
- void yyerror(char*, ...);
- int yylex(void);
- int yyparse(void);
- enum
- {
- ONAME,
- OCONST,
- OMUL,
- ODIV,
- OMOD,
- OADD,
- OSUB,
- ORSH,
- OLSH,
- OLT,
- OGT,
- OLEQ,
- OGEQ,
- OEQ,
- ONEQ,
- OLAND,
- OXOR,
- OLOR,
- OCAND,
- OCOR,
- OASGN,
- OINDM,
- OEDEC,
- OEINC,
- OPINC,
- OPDEC,
- ONOT,
- OIF,
- ODO,
- OLIST,
- OCALL,
- OCTRUCT,
- OWHILE,
- OELSE,
- OHEAD,
- OTAIL,
- OAPPEND,
- ORET,
- OINDEX,
- OINDC,
- ODOT,
- OLOCAL,
- OFRAME,
- OCOMPLEX,
- ODELETE,
- OCAST,
- OFMT,
- OEVAL,
- OWHAT,
- };
|