cb2256 | 1995-10-11 | Fredrik Hübinette (Hubbe) | | |
06983f | 1996-09-22 | Fredrik Hübinette (Hubbe) | | ||| This file a part of Pike, and is copyright by Fredrik Hubinette
||| Pike is distributed as GPL (General Public License)
|
cb2256 | 1995-10-11 | Fredrik Hübinette (Hubbe) | | ||| See the files COPYING and DISCLAIMER for more information.
\*/
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | #ifndef INTERPRET_H
#define INTERPRET_H
|
442aea | 1997-01-28 | Fredrik Hübinette (Hubbe) | | #include "global.h"
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | #include "program.h"
|
dfa5b3 | 1996-12-05 | Fredrik Hübinette (Hubbe) | | #ifndef STRUCT_FRAME_DECLARED
#define STRUCT_FRAME_DECLARED
#endif
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | struct frame
{
unsigned char *pc;
struct frame *parent_frame;
struct svalue *locals;
INT32 args;
struct object *current_object;
struct inherit context;
char *current_storage;
INT32 fun;
INT16 num_locals;
INT16 num_args;
};
#ifdef DEBUG
|
fa382f | 1996-06-21 | Fredrik Hübinette (Hubbe) | | #define debug_check_stack() do{if(sp<evaluator_stack)fatal("Stack error.\n");}while(0)
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | #else
|
fa382f | 1996-06-21 | Fredrik Hübinette (Hubbe) | | #define debug_check_stack()
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | #endif
|
fa382f | 1996-06-21 | Fredrik Hübinette (Hubbe) | |
#define pop_stack() do{ free_svalue(--sp); debug_check_stack(); }while(0)
|
2d1234 | 1997-03-10 | Fredrik Hübinette (Hubbe) | |
|
04925b | 1996-09-29 | Fredrik Hübinette (Hubbe) | | #define push_program(P) do{ struct program *_=(P); sp->u.program=_; sp++->type=T_PROGRAM; }while(0)
#define push_int(I) do{ INT32 _=(I); sp->u.integer=_;sp->type=T_INT;sp++->subtype=NUMBER_NUMBER; }while(0)
#define push_mapping(M) do{ struct mapping *_=(M); sp->u.mapping=_; sp++->type=T_MAPPING; }while(0)
#define push_array(A) do{ struct array *_=(A); sp->u.array=_ ;sp++->type=T_ARRAY; }while(0)
#define push_multiset(L) do{ struct multiset *_=(L); sp->u.multiset=_; sp++->type=T_MULTISET; }while(0)
|
591c0c | 1997-01-19 | Fredrik Hübinette (Hubbe) | | #define push_string(S) do{ struct pike_string *_=(S); sp->subtype=0; sp->u.string=_; sp++->type=T_STRING; }while(0)
|
04925b | 1996-09-29 | Fredrik Hübinette (Hubbe) | | #define push_object(O) do{ struct object *_=(O); sp->u.object=_; sp++->type=T_OBJECT; }while(0)
#define push_float(F) do{ float _=(F); sp->u.float_number=_; sp++->type=T_FLOAT; }while(0)
#define push_text(T) push_string(make_shared_string((T)))
|
b1f4eb | 1998-01-13 | Fredrik Hübinette (Hubbe) | | #define push_constant_text(T) do{ sp->subtype=0; MAKE_CONSTANT_SHARED_STRING(sp->u.string,T); sp++->type=T_STRING; }while(0)
|
2d1234 | 1997-03-10 | Fredrik Hübinette (Hubbe) | |
#define ref_push_program(P) do{ struct program *_=(P); _->refs++; sp->u.program=_; sp++->type=T_PROGRAM; }while(0)
#define ref_push_mapping(M) do{ struct mapping *_=(M); _->refs++; sp->u.mapping=_; sp++->type=T_MAPPING; }while(0)
#define ref_push_array(A) do{ struct array *_=(A); _->refs++; sp->u.array=_ ;sp++->type=T_ARRAY; }while(0)
#define ref_push_multiset(L) do{ struct multiset *_=(L); _->refs++; sp->u.multiset=_; sp++->type=T_MULTISET; }while(0)
#define ref_push_string(S) do{ struct pike_string *_=(S); _->refs++; sp->subtype=0; sp->u.string=_; sp++->type=T_STRING; }while(0)
#define ref_push_object(O) do{ struct object *_=(O); _->refs++; sp->u.object=_; sp++->type=T_OBJECT; }while(0)
|
04925b | 1996-09-29 | Fredrik Hübinette (Hubbe) | | #define push_svalue(S) do { struct svalue *_=(S); assign_svalue_no_free(sp,_); sp++; }while(0)
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | |
|
b1f4eb | 1998-01-13 | Fredrik Hübinette (Hubbe) | | enum apply_type
{
APPLY_STACK,
APPLY_SVALUE,
APPLY_LOW
};
#define apply_low(O,FUN,ARGS) \
mega_apply(APPLY_LOW, (ARGS), (void*)(O),(void*)(FUN))
#define strict_apply_svalue(SVAL,ARGS) \
mega_apply(APPLY_SVALUE, (ARGS), (void*)(SVAL),0)
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | #define APPLY_MASTER(FUN,ARGS) \
do{ \
static int fun_,master_cnt=0; \
struct object *master_ob=master(); \
if(master_cnt != master_ob->prog->id) \
{ \
fun_=find_identifier(FUN,master_ob->prog); \
master_cnt = master_ob->prog->id; \
} \
apply_low(master_ob, fun_, ARGS); \
}while(0)
#define SAFE_APPLY_MASTER(FUN,ARGS) \
do{ \
static int fun_,master_cnt=0; \
struct object *master_ob=master(); \
if(master_cnt != master_ob->prog->id) \
{ \
fun_=find_identifier(FUN,master_ob->prog); \
master_cnt = master_ob->prog->id; \
} \
safe_apply_low(master_ob, fun_, ARGS); \
}while(0)
|
0a861b | 1997-09-17 | Fredrik Hübinette (Hubbe) | | #define check_threads_etc() \
call_callback(& evaluator_callbacks, (void *)0)
|
c84698 | 1997-10-13 | Fredrik Hübinette (Hubbe) | | #ifdef DEBUG
#define fast_check_threads_etc(X) do { \
static int div_; if(d_flag || !(div_++& ((1<<(X))-1))) check_threads_etc(); } while(0)
#else
|
0a861b | 1997-09-17 | Fredrik Hübinette (Hubbe) | | #define fast_check_threads_etc(X) do { \
static int div_; if(!(div_++& ((1<<(X))-1))) check_threads_etc(); } while(0)
|
c84698 | 1997-10-13 | Fredrik Hübinette (Hubbe) | | #endif
|
0a861b | 1997-09-17 | Fredrik Hübinette (Hubbe) | |
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | |
|
be478c | 1997-08-30 | Henrik Grubbström (Grubba) | | void push_sp_mark(void);
int pop_sp_mark(void);
void init_interpreter(void);
|
fa382f | 1996-06-21 | Fredrik Hübinette (Hubbe) | | void check_stack(INT32 size);
void check_mark_stack(INT32 size);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | void lvalue_to_svalue_no_free(struct svalue *to,struct svalue *lval);
void assign_lvalue(struct svalue *lval,struct svalue *from);
union anything *get_pointer_if_this_type(struct svalue *lval, TYPE_T t);
|
be478c | 1997-08-30 | Henrik Grubbström (Grubba) | | void print_return_value(void);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | void pop_n_elems(INT32 x);
|
be478c | 1997-08-30 | Henrik Grubbström (Grubba) | | void reset_evaluator(void);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | struct backlog;
|
5683de | 1995-11-06 | Fredrik Hübinette (Hubbe) | | void dump_backlog(void);
|
b1f4eb | 1998-01-13 | Fredrik Hübinette (Hubbe) | | void mega_apply(enum apply_type type, INT32 args, void *arg1, void *arg2);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | int apply_low_safe_and_stupid(struct object *o, INT32 offset);
void safe_apply_low(struct object *o,int fun,int args);
|
5683de | 1995-11-06 | Fredrik Hübinette (Hubbe) | | void safe_apply(struct object *o, char *fun ,INT32 args);
|
b208c1 | 1996-08-03 | Fredrik Hübinette (Hubbe) | | void apply_lfun(struct object *o, int fun, int args);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | void apply_shared(struct object *o,
|
06983f | 1996-09-22 | Fredrik Hübinette (Hubbe) | | struct pike_string *fun,
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | int args);
void apply(struct object *o, char *fun, int args);
void apply_svalue(struct svalue *s, INT32 args);
|
be478c | 1997-08-30 | Henrik Grubbström (Grubba) | | void slow_check_stack(void);
void cleanup_interpret(void);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | |
extern struct svalue *sp;
extern struct svalue **mark_sp;
|
b208c1 | 1996-08-03 | Fredrik Hübinette (Hubbe) | | extern struct svalue *evaluator_stack;
extern struct svalue **mark_stack;
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | extern struct frame *fp;
|
0f887e | 1996-08-12 | Fredrik Hübinette (Hubbe) | | extern int stack_size;
|
07513e | 1996-10-04 | Fredrik Hübinette (Hubbe) | | extern int evaluator_stack_malloced, mark_stack_malloced;
|
a29e02 | 1996-10-15 | Fredrik Hübinette (Hubbe) | | struct callback;
|
81b84e | 1996-12-03 | Fredrik Hübinette (Hubbe) | | extern struct callback_list evaluator_callbacks;
|
b504ed | 1997-09-21 | Fredrik Hübinette (Hubbe) | | extern void call_callback(struct callback_list *, void *);
|
5267b7 | 1995-08-09 | Fredrik Hübinette (Hubbe) | | #endif
|