2004-04-19 19:32:07 +00:00
|
|
|
/* acid.h */
|
2005-02-11 16:54:25 +00:00
|
|
|
#undef OAPPEND
|
|
|
|
|
2004-04-19 19:32:07 +00:00
|
|
|
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 nlcount;
|
|
|
|
Extern int remote;
|
|
|
|
Extern int text;
|
|
|
|
Extern int cor;
|
|
|
|
Extern int silent;
|
|
|
|
Extern Fhdr *fhdr;
|
|
|
|
Extern Fhdr *chdr;
|
|
|
|
Extern int line;
|
|
|
|
Extern Biobuf* bout;
|
|
|
|
Extern Biobuf* io[32];
|
|
|
|
Extern int iop;
|
|
|
|
Extern int pid;
|
|
|
|
Extern char symbol[Strsize];
|
|
|
|
Extern int interactive;
|
|
|
|
Extern Node* code;
|
|
|
|
Extern int na;
|
|
|
|
Extern int wtflag;
|
Working on better handling of multithreading in general
and core dumps in particular. See notes:
new types: register is something that when dereferenced gives you
the registers. the Ureg is no longer mapped at 0.
refconst is something that gives a constant when dereferenced.
new builtin register("AX") creates register values
new builtin refconst(0x123) creates refconst values
new builtin var("foo") is equivalent to the variable foo
(it returns foo but can also be used as the lhs of an assignment).
new acid function getregs() returns a list of the current values of registers.
new acid function setregs() sets the current registers to those values.
note that getregs and setregs operate on register locations, not the
register values themselves.
new acid function resetregs() sets registers to register("AX"), etc.
new acid function clearregs() sets all registers to constant -1.
the default register settings are as in resetregs(), not small numbers.
new acid variables coretext, pids, systype, corefile, cmdline.
new behavior: local variable lookup, stk, etc., use the acid values of registers
(*PC, *SP, and so on), so the thread support code can change the context
completely.
unary + is applicable to more data types and prints more often.
2005-01-23 22:48:19 +00:00
|
|
|
Extern Regs* acidregs;
|
2004-04-19 19:32:07 +00:00
|
|
|
Extern Regs* correg;
|
|
|
|
Extern Map* cormap;
|
|
|
|
Extern Map* symmap;
|
|
|
|
Extern Lsym* hash[Hashsize];
|
|
|
|
Extern long dogc;
|
|
|
|
Extern Rplace* ret;
|
|
|
|
Extern char* symfil;
|
|
|
|
Extern char* corfil;
|
|
|
|
Extern int gotint;
|
|
|
|
Extern long flen;
|
|
|
|
Extern Gc* gcl;
|
|
|
|
Extern int stacked;
|
2004-04-20 00:20:36 +00:00
|
|
|
#define err aciderrjmp
|
2004-04-19 19:32:07 +00:00
|
|
|
Extern jmp_buf err;
|
|
|
|
Extern Node* prnt;
|
|
|
|
Extern Node* fomt;
|
|
|
|
Extern List* tracelist;
|
|
|
|
Extern int initialising;
|
|
|
|
Extern int quiet;
|
|
|
|
Extern Fhdr* corhdr;
|
|
|
|
Extern Fhdr* symhdr;
|
|
|
|
|
|
|
|
extern void (*expop[])(Node*, Node*);
|
|
|
|
#define expr(n, r) (r)->store.comt=0; (*expop[(unsigned char)((n)->op)])(n, r);
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
TINT,
|
|
|
|
TFLOAT,
|
|
|
|
TSTRING,
|
|
|
|
TLIST,
|
|
|
|
TCODE,
|
Working on better handling of multithreading in general
and core dumps in particular. See notes:
new types: register is something that when dereferenced gives you
the registers. the Ureg is no longer mapped at 0.
refconst is something that gives a constant when dereferenced.
new builtin register("AX") creates register values
new builtin refconst(0x123) creates refconst values
new builtin var("foo") is equivalent to the variable foo
(it returns foo but can also be used as the lhs of an assignment).
new acid function getregs() returns a list of the current values of registers.
new acid function setregs() sets the current registers to those values.
note that getregs and setregs operate on register locations, not the
register values themselves.
new acid function resetregs() sets registers to register("AX"), etc.
new acid function clearregs() sets all registers to constant -1.
the default register settings are as in resetregs(), not small numbers.
new acid variables coretext, pids, systype, corefile, cmdline.
new behavior: local variable lookup, stk, etc., use the acid values of registers
(*PC, *SP, and so on), so the thread support code can change the context
completely.
unary + is applicable to more data types and prints more often.
2005-01-23 22:48:19 +00:00
|
|
|
TREG,
|
|
|
|
TCON,
|
2004-04-20 01:42:20 +00:00
|
|
|
NUMT,
|
2004-04-19 19:32:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2005-02-11 00:01:49 +00:00
|
|
|
struct {
|
|
|
|
char *name;
|
|
|
|
uint thread;
|
|
|
|
} reg;
|
Working on better handling of multithreading in general
and core dumps in particular. See notes:
new types: register is something that when dereferenced gives you
the registers. the Ureg is no longer mapped at 0.
refconst is something that gives a constant when dereferenced.
new builtin register("AX") creates register values
new builtin refconst(0x123) creates refconst values
new builtin var("foo") is equivalent to the variable foo
(it returns foo but can also be used as the lhs of an assignment).
new acid function getregs() returns a list of the current values of registers.
new acid function setregs() sets the current registers to those values.
note that getregs and setregs operate on register locations, not the
register values themselves.
new acid function resetregs() sets registers to register("AX"), etc.
new acid function clearregs() sets all registers to constant -1.
the default register settings are as in resetregs(), not small numbers.
new acid variables coretext, pids, systype, corefile, cmdline.
new behavior: local variable lookup, stk, etc., use the acid values of registers
(*PC, *SP, and so on), so the thread support code can change the context
completely.
unary + is applicable to more data types and prints more often.
2005-01-23 22:48:19 +00:00
|
|
|
Node* con;
|
2004-04-19 19:32:07 +00:00
|
|
|
} u;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct List
|
|
|
|
{
|
|
|
|
Gc gc;
|
|
|
|
List* next;
|
|
|
|
char type;
|
|
|
|
Store store;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Value
|
|
|
|
{
|
|
|
|
char set;
|
|
|
|
char type;
|
|
|
|
Store 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 gc;
|
|
|
|
char op;
|
|
|
|
char type;
|
|
|
|
Node* left;
|
|
|
|
Node* right;
|
|
|
|
Lsym* sym;
|
|
|
|
int builtin;
|
|
|
|
Store store;
|
|
|
|
};
|
|
|
|
#define ZN (Node*)0
|
|
|
|
|
|
|
|
struct String
|
|
|
|
{
|
|
|
|
Gc gc;
|
|
|
|
char *string;
|
|
|
|
int len;
|
|
|
|
};
|
|
|
|
|
Working on better handling of multithreading in general
and core dumps in particular. See notes:
new types: register is something that when dereferenced gives you
the registers. the Ureg is no longer mapped at 0.
refconst is something that gives a constant when dereferenced.
new builtin register("AX") creates register values
new builtin refconst(0x123) creates refconst values
new builtin var("foo") is equivalent to the variable foo
(it returns foo but can also be used as the lhs of an assignment).
new acid function getregs() returns a list of the current values of registers.
new acid function setregs() sets the current registers to those values.
note that getregs and setregs operate on register locations, not the
register values themselves.
new acid function resetregs() sets registers to register("AX"), etc.
new acid function clearregs() sets all registers to constant -1.
the default register settings are as in resetregs(), not small numbers.
new acid variables coretext, pids, systype, corefile, cmdline.
new behavior: local variable lookup, stk, etc., use the acid values of registers
(*PC, *SP, and so on), so the thread support code can change the context
completely.
unary + is applicable to more data types and prints more often.
2005-01-23 22:48:19 +00:00
|
|
|
int acidregsrw(Regs*, char*, ulong*, int);
|
2004-04-19 19:32:07 +00:00
|
|
|
List* addlist(List*, List*);
|
|
|
|
void addvarsym(Fhdr*);
|
|
|
|
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(int);
|
|
|
|
List* construct(Node*);
|
|
|
|
void ctrace(int);
|
|
|
|
void decl(Node*);
|
|
|
|
void defcomplex(Node*, Node*);
|
|
|
|
void deinstall(int);
|
|
|
|
void delete(List*, int n, Node*);
|
|
|
|
void delvarsym(char*);
|
|
|
|
void dostop(int);
|
|
|
|
Lsym* enter(char*, int);
|
|
|
|
void error(char*, ...);
|
|
|
|
void execute(Node*);
|
|
|
|
void fatal(char*, ...);
|
|
|
|
ulong findframe(ulong);
|
|
|
|
void flatten(Node**, Node*);
|
|
|
|
void gc(void);
|
|
|
|
char* getstatus(int);
|
|
|
|
void* gmalloc(long);
|
|
|
|
void indir(Map*, ulong, char, Node*);
|
Working on better handling of multithreading in general
and core dumps in particular. See notes:
new types: register is something that when dereferenced gives you
the registers. the Ureg is no longer mapped at 0.
refconst is something that gives a constant when dereferenced.
new builtin register("AX") creates register values
new builtin refconst(0x123) creates refconst values
new builtin var("foo") is equivalent to the variable foo
(it returns foo but can also be used as the lhs of an assignment).
new acid function getregs() returns a list of the current values of registers.
new acid function setregs() sets the current registers to those values.
note that getregs and setregs operate on register locations, not the
register values themselves.
new acid function resetregs() sets registers to register("AX"), etc.
new acid function clearregs() sets all registers to constant -1.
the default register settings are as in resetregs(), not small numbers.
new acid variables coretext, pids, systype, corefile, cmdline.
new behavior: local variable lookup, stk, etc., use the acid values of registers
(*PC, *SP, and so on), so the thread support code can change the context
completely.
unary + is applicable to more data types and prints more often.
2005-01-23 22:48:19 +00:00
|
|
|
void indirreg(Regs*, char*, char, Node*);
|
2004-04-20 01:42:20 +00:00
|
|
|
void initexpr(void);
|
|
|
|
void initprint(void);
|
2004-04-19 19:32:07 +00:00
|
|
|
void installbuiltin(void);
|
|
|
|
void kinit(void);
|
|
|
|
int Zfmt(Fmt*);
|
|
|
|
int listcmp(List*, List*);
|
|
|
|
int listlen(List*);
|
|
|
|
List* listvar(char*, long);
|
|
|
|
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 pushfd(int);
|
|
|
|
void pushfile(char*);
|
|
|
|
void pushstr(Node*);
|
|
|
|
ulong raddr(char*);
|
|
|
|
void readtext(char*);
|
|
|
|
void readcore(void);
|
|
|
|
void restartio(void);
|
|
|
|
String *runenode(Rune*);
|
|
|
|
int scmp(String*, String*);
|
|
|
|
void sproc(int);
|
|
|
|
String* stradd(String*, String*);
|
|
|
|
String* strnode(char*);
|
|
|
|
String* strnodlen(char*, int);
|
|
|
|
#define system acidsystem
|
|
|
|
char* system(void);
|
|
|
|
int trlist(Map*, Regs*, ulong, ulong, Symbol*, int);
|
|
|
|
void unwind(void);
|
|
|
|
void userinit(void);
|
|
|
|
void varreg(void);
|
|
|
|
void varsym(void);
|
|
|
|
void whatis(Lsym*);
|
Working on better handling of multithreading in general
and core dumps in particular. See notes:
new types: register is something that when dereferenced gives you
the registers. the Ureg is no longer mapped at 0.
refconst is something that gives a constant when dereferenced.
new builtin register("AX") creates register values
new builtin refconst(0x123) creates refconst values
new builtin var("foo") is equivalent to the variable foo
(it returns foo but can also be used as the lhs of an assignment).
new acid function getregs() returns a list of the current values of registers.
new acid function setregs() sets the current registers to those values.
note that getregs and setregs operate on register locations, not the
register values themselves.
new acid function resetregs() sets registers to register("AX"), etc.
new acid function clearregs() sets all registers to constant -1.
the default register settings are as in resetregs(), not small numbers.
new acid variables coretext, pids, systype, corefile, cmdline.
new behavior: local variable lookup, stk, etc., use the acid values of registers
(*PC, *SP, and so on), so the thread support code can change the context
completely.
unary + is applicable to more data types and prints more often.
2005-01-23 22:48:19 +00:00
|
|
|
void windir(Map*, Node, Node*, Node*);
|
|
|
|
void windirreg(Regs*, char*, Node*, Node*);
|
2004-04-19 19:32:07 +00:00
|
|
|
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,
|
Working on better handling of multithreading in general
and core dumps in particular. See notes:
new types: register is something that when dereferenced gives you
the registers. the Ureg is no longer mapped at 0.
refconst is something that gives a constant when dereferenced.
new builtin register("AX") creates register values
new builtin refconst(0x123) creates refconst values
new builtin var("foo") is equivalent to the variable foo
(it returns foo but can also be used as the lhs of an assignment).
new acid function getregs() returns a list of the current values of registers.
new acid function setregs() sets the current registers to those values.
note that getregs and setregs operate on register locations, not the
register values themselves.
new acid function resetregs() sets registers to register("AX"), etc.
new acid function clearregs() sets all registers to constant -1.
the default register settings are as in resetregs(), not small numbers.
new acid variables coretext, pids, systype, corefile, cmdline.
new behavior: local variable lookup, stk, etc., use the acid values of registers
(*PC, *SP, and so on), so the thread support code can change the context
completely.
unary + is applicable to more data types and prints more often.
2005-01-23 22:48:19 +00:00
|
|
|
OUPLUS,
|
2004-04-20 01:42:20 +00:00
|
|
|
NUMO,
|
2004-04-19 19:32:07 +00:00
|
|
|
};
|