--- stack/stack.h 2003/08/08 14:20:49 1.25 +++ stack/stack.h 2003/08/11 14:31:48 1.26 @@ -43,6 +43,8 @@ #include /* waitpid */ #include +/* va_list, va_start, va_arg, va_end */ +#include #ifdef __linux__ /* mtrace, muntrace */ @@ -65,18 +67,22 @@ typedef void (*funcp)(struct environment_struct*); /* funcp is a pointer to a void function (environment *) */ +enum type_enum { + unknown, + empty, /* The empty list */ + integer, + tfloat, + string, + func, /* Function pointer */ + symb, /* Symbol */ + tcons, /* A pair of two values */ + port /* An I/O port */ +}; /* Type of stack element */ + + /* A value of some type */ typedef struct { - enum { - empty, /* The empty list */ - integer, - tfloat, - string, - func, /* Function pointer */ - symb, /* Symbol */ - tcons, /* A pair of two values */ - port /* An I/O port */ - } type:4; /* Type of stack element */ + enum type_enum type:4; union { struct { @@ -130,6 +136,7 @@ value *head; /* Head of the stack */ hashtbl symbols; /* Hash table of all variable bindings */ int err; /* Error flag */ + char *errsymb; char *in_string; /* Input pending to be read */ char *free_string; /* Free this string when all input is read from in_string */ @@ -144,7 +151,7 @@ void init_env(environment*); -void printerr(const char*); +void printerr(environment*, const char*); extern void toss(environment*); symbol **hash(hashtbl, const char*); value* new_val(environment*); @@ -231,3 +238,4 @@ extern void sx_646f(environment *); extern void sx_6f70656e(environment*); extern void sx_636c6f7365(environment*); +int check_args(environment*, ...);