cb22561995-10-11Fredrik Hübinette (Hubbe) /*\
06983f1996-09-22Fredrik Hübinette (Hubbe) ||| This file a part of Pike, and is copyright by Fredrik Hubinette ||| Pike is distributed as GPL (General Public License)
cb22561995-10-11Fredrik Hübinette (Hubbe) ||| See the files COPYING and DISCLAIMER for more information. \*/
24ddc71998-03-28Henrik Grubbström (Grubba)  /*
f80d571999-11-23Henrik Grubbström (Grubba)  * $Id: program.h,v 1.67 1999/11/23 03:12:03 grubba Exp $
24ddc71998-03-28Henrik Grubbström (Grubba)  */
5580691996-06-21Fredrik Hübinette (Hubbe) #ifndef PROGRAM_H #define PROGRAM_H
5267b71995-08-09Fredrik Hübinette (Hubbe)  #include <stdarg.h>
afa6941997-01-28Fredrik Hübinette (Hubbe) #include "global.h"
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) #include "pike_types.h"
90e9781999-01-31Fredrik Hübinette (Hubbe) #include "pike_macros.h"
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) #include "svalue.h"
05590d1998-04-23Fredrik Hübinette (Hubbe) #include "time_stuff.h"
5267b71995-08-09Fredrik Hübinette (Hubbe) 
bcd5741999-03-17Fredrik Hübinette (Hubbe) #ifdef PIKE_DEBUG #define PROGRAM_LINE_ARGS int line, char *file #else #define PROGRAM_LINE_ARGS void #endif
5580691996-06-21Fredrik Hübinette (Hubbe) #define LFUN___INIT 0 #define LFUN_CREATE 1 #define LFUN_DESTROY 2 #define LFUN_ADD 3 #define LFUN_SUBTRACT 4 #define LFUN_AND 5 #define LFUN_OR 6 #define LFUN_XOR 7 #define LFUN_LSH 8 #define LFUN_RSH 9 #define LFUN_MULTIPLY 10 #define LFUN_DIVIDE 11 #define LFUN_MOD 12 #define LFUN_COMPL 13 #define LFUN_EQ 14 #define LFUN_LT 15 #define LFUN_GT 16 #define LFUN___HASH 17 #define LFUN_CAST 18 #define LFUN_NOT 19
774b061996-08-03Fredrik Hübinette (Hubbe) #define LFUN_INDEX 20 #define LFUN_ASSIGN_INDEX 21
dffa011997-01-15Fredrik Hübinette (Hubbe) #define LFUN_ARROW 22 #define LFUN_ASSIGN_ARROW 23
0683be1997-01-26Fredrik Hübinette (Hubbe) #define LFUN__SIZEOF 24 #define LFUN__INDICES 25 #define LFUN__VALUES 26 #define LFUN_CALL 27
1b89ad1997-10-10Fredrik Hübinette (Hubbe) #define LFUN_RADD 28 #define LFUN_RSUBTRACT 29 #define LFUN_RAND 30 #define LFUN_ROR 31 #define LFUN_RXOR 32 #define LFUN_RLSH 33 #define LFUN_RRSH 34 #define LFUN_RMULTIPLY 35 #define LFUN_RDIVIDE 36 #define LFUN_RMOD 37
ee37801999-02-09Fredrik Hübinette (Hubbe) #define LFUN_ADD_EQ 38
aa73fc1999-10-21Fredrik Hübinette (Hubbe) #define LFUN__IS_TYPE 39 #define LFUN__SPRINTF 40
2ba9191999-10-23Fredrik Hübinette (Hubbe) #define LFUN__EQUAL 41
5580691996-06-21Fredrik Hübinette (Hubbe) 
2ba9191999-10-23Fredrik Hübinette (Hubbe) #define NUM_LFUNS 42
5580691996-06-21Fredrik Hübinette (Hubbe)  extern char *lfun_names[];
dfa5b31996-12-05Fredrik Hübinette (Hubbe) #ifndef STRUCT_SVALUE_DECLARED #define STRUCT_SVALUE_DECLARED
5267b71995-08-09Fredrik Hübinette (Hubbe) struct svalue;
dfa5b31996-12-05Fredrik Hübinette (Hubbe) #endif
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) #ifndef STRUCT_NODE_S_DECLARED #define STRUCT_NODE_S_DECLARED struct node_s; #endif
dfa5b31996-12-05Fredrik Hübinette (Hubbe) #ifndef STRUCT_OBJECT_DECLARED #define STRUCT_OBJECT_DECLARED
5267b71995-08-09Fredrik Hübinette (Hubbe) struct object;
dfa5b31996-12-05Fredrik Hübinette (Hubbe) #endif
5267b71995-08-09Fredrik Hübinette (Hubbe) 
d429a71998-02-24Fredrik Hübinette (Hubbe) struct program_state;
5267b71995-08-09Fredrik Hübinette (Hubbe) /* I need: * a) one type that can point to a callable function. * (C function, or object->fun) * This can for instance be an svalue. * * b) one type that once the object/program is known can point
06983f1996-09-22Fredrik Hübinette (Hubbe)  * to the C/PIKE function body.
5267b71995-08-09Fredrik Hübinette (Hubbe)  * * c) A number of flags to send to 'add_simul_efun' to specify side effects * and such. */ /* * Max program dimensions:
5580691996-06-21Fredrik Hübinette (Hubbe)  * 2^16 functions + global variables
5267b71995-08-09Fredrik Hübinette (Hubbe)  * 2^16 inherits
06983f1996-09-22Fredrik Hübinette (Hubbe)  * 2^16 arguments to pike functions
5580691996-06-21Fredrik Hübinette (Hubbe)  * 2^32 efuns
5267b71995-08-09Fredrik Hübinette (Hubbe)  * 2^8 local variables (and arguments) */ union idptr { void (*c_fun)(INT32); INT32 offset; };
06983f1996-09-22Fredrik Hübinette (Hubbe) #define IDENTIFIER_PIKE_FUNCTION 1
5267b71995-08-09Fredrik Hübinette (Hubbe) #define IDENTIFIER_C_FUNCTION 2 #define IDENTIFIER_FUNCTION 3
61e9a01998-01-25Fredrik Hübinette (Hubbe) #define IDENTIFIER_CONSTANT 4 #define IDENTIFIER_VARARGS 8
6bc9281998-04-10Fredrik Hübinette (Hubbe) #define IDENTIFIER_PROTOTYPED 16
d2c6081996-11-07Fredrik Hübinette (Hubbe)  #define IDENTIFIER_IS_FUNCTION(X) ((X) & IDENTIFIER_FUNCTION)
1994251999-09-06Fredrik Hübinette (Hubbe) #define IDENTIFIER_IS_PIKE_FUNCTION(X) ((X) & IDENTIFIER_PIKE_FUNCTION)
5267b71995-08-09Fredrik Hübinette (Hubbe)  struct identifier {
06983f1996-09-22Fredrik Hübinette (Hubbe)  struct pike_string *name; struct pike_string *type;
7fda7a1997-09-08Fredrik Hübinette (Hubbe)  unsigned INT16 identifier_flags; /* IDENTIFIER_??? */
5267b71995-08-09Fredrik Hübinette (Hubbe)  unsigned INT16 run_time_type;
be478c1997-08-30Henrik Grubbström (Grubba) #ifdef PROFILING unsigned INT32 num_calls;
a2a8801998-03-18Per Hedbor  unsigned INT32 total_time;
6189631998-11-12Fredrik Hübinette (Hubbe)  unsigned INT32 self_time;
be478c1997-08-30Henrik Grubbström (Grubba) #endif /* PROFILING */
5267b71995-08-09Fredrik Hübinette (Hubbe)  union idptr func; };
454d541999-09-18Fredrik Hübinette (Hubbe) struct program_constant { struct svalue sval; struct pike_string *name; };
5267b71995-08-09Fredrik Hübinette (Hubbe) /* * in the bytecode, a function starts with: * char num_args * char num_locals * char code[] */
f80d571999-11-23Henrik Grubbström (Grubba) #define ID_STATIC 0x01 #define ID_PRIVATE 0x02 #define ID_NOMASK 0x04 #define ID_PUBLIC 0x08 #define ID_PROTECTED 0x10 #define ID_INLINE 0x20 #define ID_HIDDEN 0x40 /* needed? */ #define ID_INHERITED 0x80 #define ID_MODIFIER_MASK 0x00ff #define ID_STRICT_TYPES 0x8000
5267b71995-08-09Fredrik Hübinette (Hubbe)  struct reference {
cb22561995-10-11Fredrik Hübinette (Hubbe)  unsigned INT16 inherit_offset; unsigned INT16 identifier_offset;
b1f4eb1998-01-13Fredrik Hübinette (Hubbe)  INT16 id_flags; /* static, private etc.. */
5267b71995-08-09Fredrik Hübinette (Hubbe) };
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) 
5267b71995-08-09Fredrik Hübinette (Hubbe) struct inherit { INT16 inherit_level; /* really needed? */ INT16 identifier_level;
b1f4eb1998-01-13Fredrik Hübinette (Hubbe)  INT16 parent_identifier;
61e9a01998-01-25Fredrik Hübinette (Hubbe)  INT16 parent_offset;
5267b71995-08-09Fredrik Hübinette (Hubbe)  INT32 storage_offset;
b1f4eb1998-01-13Fredrik Hübinette (Hubbe)  struct object *parent; struct program *prog; struct pike_string *name;
5267b71995-08-09Fredrik Hübinette (Hubbe) };
454d541999-09-18Fredrik Hübinette (Hubbe) struct pike_trampoline { struct pike_frame *frame; INT32 func; };
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) /* program parts have been realloced into one block */ #define PROGRAM_OPTIMIZED 1 /* program has gone through pass 1 of compiler, prototypes etc. will * not change from now on */ #define PROGRAM_FIXED 2 /* Program is done and can be cloned */ #define PROGRAM_FINISHED 4 /* Program has gone through first compiler pass */ #define PROGRAM_PASS_1_DONE 8
8aae6d1999-08-19Fredrik Hübinette (Hubbe) /* Program will be destructed as soon at it runs out of references. * Normally only used for mutex lock keys and similar */
5a7ab61998-01-31Fredrik Hübinette (Hubbe) #define PROGRAM_DESTRUCT_IMMEDIATE 16
b504ed1997-09-21Fredrik Hübinette (Hubbe) 
8aae6d1999-08-19Fredrik Hübinette (Hubbe) /* Self explanatory, automatically detected */
05590d1998-04-23Fredrik Hübinette (Hubbe) #define PROGRAM_HAS_C_METHODS 32
8aae6d1999-08-19Fredrik Hübinette (Hubbe) /* All non-static functions are inlinable */ #define PROGRAM_CONSTANT 64
1994251999-09-06Fredrik Hübinette (Hubbe) /* */ #define PROGRAM_USES_PARENT 128
1b0ac81999-10-29Martin Stjernholm /* Objects should not be destructed even when they only has weak * references left. */ #define PROGRAM_NO_WEAK_DESTRUCT 256 /* Objects should not be destructed by f_destruct(). */ #define PROGRAM_NO_EXPLICIT_DESTRUCT 512
5267b71995-08-09Fredrik Hübinette (Hubbe) struct program { INT32 refs;
7e97c31999-01-21Fredrik Hübinette (Hubbe) #ifdef PIKE_SECURITY struct object *prot; #endif
5267b71995-08-09Fredrik Hübinette (Hubbe)  INT32 id; /* used to identify program in caches */
2ad3c01999-09-16Fredrik Hübinette (Hubbe)  /* storage_needed - storage needed in object struct * the first inherit[0].storage_offset bytes are not used and are * subtracted when inheriting. */
5267b71995-08-09Fredrik Hübinette (Hubbe)  INT32 storage_needed; /* storage needed in the object struct */
8f29a31999-09-15Fredrik Hübinette (Hubbe)  INT16 flags; /* PROGRAM_* */
90e9781999-01-31Fredrik Hübinette (Hubbe)  unsigned INT8 alignment_needed;
05590d1998-04-23Fredrik Hübinette (Hubbe)  struct timeval timestamp;
5267b71995-08-09Fredrik Hübinette (Hubbe)  struct program *next; struct program *prev;
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) 
06983f1996-09-22Fredrik Hübinette (Hubbe)  void (*init)(struct object *); void (*exit)(struct object *);
d4828c1997-07-17Fredrik Hübinette (Hubbe)  void (*gc_marked)(struct object *);
f0c3d31998-04-05Fredrik Hübinette (Hubbe)  void (*gc_check)(struct object *);
71f3a21998-11-22Fredrik Hübinette (Hubbe) #ifdef PIKE_DEBUG
5267b71995-08-09Fredrik Hübinette (Hubbe)  unsigned INT32 checksum; #endif
be478c1997-08-30Henrik Grubbström (Grubba) #ifdef PROFILING unsigned INT32 num_clones; #endif /* PROFILING */
5267b71995-08-09Fredrik Hübinette (Hubbe)  SIZE_T total_size;
b1f4eb1998-01-13Fredrik Hübinette (Hubbe)  #define FOO(NUMTYPE,TYPE,NAME) TYPE * NAME ; #include "program_areas.h" #define FOO(NUMTYPE,TYPE,NAME) NUMTYPE PIKE_CONCAT(num_,NAME) ; #include "program_areas.h"
5580691996-06-21Fredrik Hübinette (Hubbe)  INT16 lfuns[NUM_LFUNS];
5267b71995-08-09Fredrik Hübinette (Hubbe) };
3c43b81999-03-19Fredrik Hübinette (Hubbe) #define INHERIT_FROM_PTR(P,X) (dmalloc_touch(struct program *,(P))->inherits + (X)->inherit_offset) #define PROG_FROM_PTR(P,X) (dmalloc_touch(struct program *,INHERIT_FROM_PTR(P,X)->prog))
5267b71995-08-09Fredrik Hübinette (Hubbe) #define ID_FROM_PTR(P,X) (PROG_FROM_PTR(P,X)->identifiers+(X)->identifier_offset) #define INHERIT_FROM_INT(P,X) INHERIT_FROM_PTR(P,(P)->identifier_references+(X)) #define PROG_FROM_INT(P,X) PROG_FROM_PTR(P,(P)->identifier_references+(X)) #define ID_FROM_INT(P,X) ID_FROM_PTR(P,(P)->identifier_references+(X))
3c43b81999-03-19Fredrik Hübinette (Hubbe) #define FIND_LFUN(P,N) ( dmalloc_touch(struct program *,(P))->flags & PROGRAM_FIXED?((P)->lfuns[(N)]):find_identifier(lfun_names[(N)],(P)) )
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) 
a3c6ad1998-01-29Fredrik Hübinette (Hubbe) #define free_program(p) do{ struct program *_=(p); debug_malloc_touch(_); if(!--_->refs) really_free_program(_); }while(0)
5267b71995-08-09Fredrik Hübinette (Hubbe) 
1994981998-04-07Fredrik Hübinette (Hubbe) 
10e16f1999-11-04Henrik Grubbström (Grubba) extern struct object *error_handler;
6d22541998-01-28Fredrik Hübinette (Hubbe) extern struct object *fake_object;
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) extern struct program *new_program;
1ca3ba1997-10-13Fredrik Hübinette (Hubbe) extern struct program *first_program;
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) extern int compiler_pass;
48cffa1998-01-22Henrik Grubbström (Grubba) extern long local_class_counter;
9649491998-02-27Fredrik Hübinette (Hubbe) extern int catch_level;
05590d1998-04-23Fredrik Hübinette (Hubbe) extern INT32 num_used_modules;
4218011999-01-31Fredrik Hübinette (Hubbe) extern struct program *pike_trampoline_program;
9649491998-02-27Fredrik Hübinette (Hubbe) 
8aae6d1999-08-19Fredrik Hübinette (Hubbe) /* Flags for identifier finding... */ #define SEE_STATIC 1 #define SEE_PRIVATE 2
9649491998-02-27Fredrik Hübinette (Hubbe) #define COMPILER_IN_CATCH 1
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) 
90e9781999-01-31Fredrik Hübinette (Hubbe) #define ADD_STORAGE(X) low_add_storage(sizeof(X), ALIGNOF(X),0)
1f5bfe1999-09-28Fredrik Hübinette (Hubbe) #define STORAGE_NEEDED(X) ((X)->storage_needed - (X)->inherits[0].storage_offset)
90e9781999-01-31Fredrik Hübinette (Hubbe) 
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) #define FOO(NUMTYPE,TYPE,NAME) void PIKE_CONCAT(add_to_,NAME(TYPE ARG)); #include "program_areas.h"
5267b71995-08-09Fredrik Hübinette (Hubbe)  /* Prototypes begin here */
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) void ins_int(INT32 i, void (*func)(char tmp)); void ins_short(INT16 i, void (*func)(char tmp));
591c0c1997-01-19Fredrik Hübinette (Hubbe) void use_module(struct svalue *s);
05590d1998-04-23Fredrik Hübinette (Hubbe) void unuse_modules(INT32 howmany);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) struct node_s *find_module_identifier(struct pike_string *ident); struct program *parent_compilation(int level);
b8cda21997-01-21Fredrik Hübinette (Hubbe) struct program *id_to_program(INT32 id);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) void optimize_program(struct program *p);
05590d1998-04-23Fredrik Hübinette (Hubbe) int program_function_index_compare(const void *a,const void *b);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) void fixate_program(void);
05590d1998-04-23Fredrik Hübinette (Hubbe) struct program *low_allocate_program(void);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) void low_start_new_program(struct program *p, struct pike_string *name, int flags);
bcd5741999-03-17Fredrik Hübinette (Hubbe) void debug_start_new_program(PROGRAM_LINE_ARGS);
5267b71995-08-09Fredrik Hübinette (Hubbe) void really_free_program(struct program *p);
5683de1995-11-06Fredrik Hübinette (Hubbe) void dump_program_desc(struct program *p);
e964ae1998-04-08Fredrik Hübinette (Hubbe) int sizeof_variable(int run_time_type);
624d091996-02-24Fredrik Hübinette (Hubbe) void check_program(struct program *p);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) struct program *end_first_pass(int finish);
3c0c281998-01-26Fredrik Hübinette (Hubbe) struct program *debug_end_program(void);
1016021999-10-28Fredrik Hübinette (Hubbe) SIZE_T low_add_storage(SIZE_T size, SIZE_T alignment, int modulo_orig);
06983f1996-09-22Fredrik Hübinette (Hubbe) void set_init_callback(void (*init)(struct object *)); void set_exit_callback(void (*exit)(struct object *));
d4828c1997-07-17Fredrik Hübinette (Hubbe) void set_gc_mark_callback(void (*m)(struct object *));
f0c3d31998-04-05Fredrik Hübinette (Hubbe) void set_gc_check_callback(void (*m)(struct object *));
d429a71998-02-24Fredrik Hübinette (Hubbe) int low_reference_inherited_identifier(struct program_state *q, int e,
8aae6d1999-08-19Fredrik Hübinette (Hubbe)  struct pike_string *name, int flags);
d429a71998-02-24Fredrik Hübinette (Hubbe) node *reference_inherited_identifier(struct pike_string *super_name,
06983f1996-09-22Fredrik Hübinette (Hubbe)  struct pike_string *function_name); void rename_last_inherit(struct pike_string *n);
61e9a01998-01-25Fredrik Hübinette (Hubbe) void low_inherit(struct program *p, struct object *parent, int parent_identifier, int parent_offset, INT32 flags, struct pike_string *name); void do_inherit(struct svalue *s,
b1f4eb1998-01-13Fredrik Hübinette (Hubbe)  INT32 flags, struct pike_string *name);
61e9a01998-01-25Fredrik Hübinette (Hubbe) void compiler_do_inherit(node *n, INT32 flags, struct pike_string *name);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) void simple_do_inherit(struct pike_string *s, INT32 flags, struct pike_string *name);
06983f1996-09-22Fredrik Hübinette (Hubbe) int isidentifier(struct pike_string *s);
05c7cd1997-07-19Fredrik Hübinette (Hubbe) int low_define_variable(struct pike_string *name, struct pike_string *type, INT32 flags, INT32 offset, INT32 run_time_type); int map_variable(char *name, char *type, INT32 flags, INT32 offset, INT32 run_time_type);
06983f1996-09-22Fredrik Hübinette (Hubbe) int define_variable(struct pike_string *name, struct pike_string *type,
5267b71995-08-09Fredrik Hübinette (Hubbe)  INT32 flags);
5740881998-01-01Fredrik Hübinette (Hubbe) int simple_add_variable(char *name, char *type, INT32 flags);
d2c6081996-11-07Fredrik Hübinette (Hubbe) int add_constant(struct pike_string *name, struct svalue *c, INT32 flags);
5c0a101997-02-06Fredrik Hübinette (Hubbe) int simple_add_constant(char *name, struct svalue *c, INT32 flags);
e43ca21996-11-15Fredrik Hübinette (Hubbe) int add_integer_constant(char *name, INT32 i, INT32 flags);
45ee5d1999-02-10Fredrik Hübinette (Hubbe) int quick_add_integer_constant(char *name, int name_length, INT32 i, INT32 flags);
5c0a101997-02-06Fredrik Hübinette (Hubbe) int add_float_constant(char *name, double f, INT32 flags); int add_string_constant(char *name, char *str, INT32 flags); int add_program_constant(char *name, struct program *p, INT32 flags);
f0c3d31998-04-05Fredrik Hübinette (Hubbe) int add_object_constant(char *name, struct object *o, INT32 flags);
c152401997-02-10Fredrik Hübinette (Hubbe) int add_function_constant(char *name, void (*cfun)(INT32), char * type, INT16 flags);
45ee5d1999-02-10Fredrik Hübinette (Hubbe) int debug_end_class(char *name, int namelen, INT32 flags);
06983f1996-09-22Fredrik Hübinette (Hubbe) INT32 define_function(struct pike_string *name, struct pike_string *type,
5267b71995-08-09Fredrik Hübinette (Hubbe)  INT16 flags, INT8 function_flags, union idptr *func);
c0e4461998-06-23Fredrik Hübinette (Hubbe) int really_low_find_shared_string_identifier(struct pike_string *name, struct program *prog,
1016021999-10-28Fredrik Hübinette (Hubbe)  int flags);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) int low_find_shared_string_identifier(struct pike_string *name, struct program *prog);
5267b71995-08-09Fredrik Hübinette (Hubbe) struct ff_hash;
06983f1996-09-22Fredrik Hübinette (Hubbe) int find_shared_string_identifier(struct pike_string *name,
5267b71995-08-09Fredrik Hübinette (Hubbe)  struct program *prog); int find_identifier(char *name,struct program *prog);
06983f1996-09-22Fredrik Hübinette (Hubbe) int store_prog_string(struct pike_string *str);
1016021999-10-28Fredrik Hübinette (Hubbe) int store_constant(struct svalue *foo, int equal, struct pike_string *constant_name);
15ff8c1998-05-25Henrik Grubbström (Grubba) struct array *program_indices(struct program *p); struct array *program_values(struct program *p);
e435831998-05-25Henrik Grubbström (Grubba) void program_index_no_free(struct svalue *to, struct program *p, struct svalue *ind);
1016021999-10-28Fredrik Hübinette (Hubbe) int get_small_number(char **q);
5267b71995-08-09Fredrik Hübinette (Hubbe) void start_line_numbering(void);
06983f1996-09-22Fredrik Hübinette (Hubbe) void store_linenumber(INT32 current_line, struct pike_string *current_file);
5267b71995-08-09Fredrik Hübinette (Hubbe) char *get_line(unsigned char *pc,struct program *prog,INT32 *linep);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) void my_yyerror(char *fmt,...) ATTRIBUTE((format(printf,1,2)));
10e16f1999-11-04Henrik Grubbström (Grubba) struct program *compile(struct pike_string *prog, struct object *handler);
0542ef1999-11-17Fredrik Hübinette (Hubbe) int pike_add_function(char *name,void (*cfun)(INT32),char *type,INT16 flags);
45ee5d1999-02-10Fredrik Hübinette (Hubbe) int quick_add_function(char *name, int name_length, void (*cfun)(INT32), char *type, int type_length, INT16 flags, int opt_flags);
be478c1997-08-30Henrik Grubbström (Grubba) void check_all_programs(void);
4218011999-01-31Fredrik Hübinette (Hubbe) void init_program(void);
be478c1997-08-30Henrik Grubbström (Grubba) void cleanup_program(void);
c94c371996-03-28Fredrik Hübinette (Hubbe) void gc_mark_program_as_referenced(struct program *p);
be478c1997-08-30Henrik Grubbström (Grubba) void gc_check_all_programs(void); void gc_mark_all_programs(void); void gc_free_all_unreferenced_programs(void);
c3c7031996-12-04Fredrik Hübinette (Hubbe) void count_memory_in_programs(INT32 *num_, INT32 *size_);
4218011999-01-31Fredrik Hübinette (Hubbe) void push_compiler_frame(int lexical_scope);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) void pop_local_variables(int level); void pop_compiler_frame(void);
6bc9281998-04-10Fredrik Hübinette (Hubbe) int low_get_storage(struct program *o, struct program *p);
cff0d71997-03-23Fredrik Hübinette (Hubbe) char *get_storage(struct object *o, struct program *p);
b1f4eb1998-01-13Fredrik Hübinette (Hubbe) struct program *low_program_from_function(struct program *p, INT32 i); struct program *program_from_function(struct svalue *f); struct program *program_from_svalue(struct svalue *s); struct find_child_cache_s; int find_child(struct program *parent, struct program *child); void yywarning(char *fmt, ...) ATTRIBUTE((format(printf,1,2)));
0ee27b1998-04-14Fredrik Hübinette (Hubbe) struct implements_cache_s; int implements(struct program *a, struct program *b);
5267b71995-08-09Fredrik Hübinette (Hubbe) /* Prototypes end here */
5267b71995-08-09Fredrik Hübinette (Hubbe) 
0542ef1999-11-17Fredrik Hübinette (Hubbe) #ifndef NO_PIKE_SHORTHAND #define add_function pike_add_function
5267b71995-08-09Fredrik Hübinette (Hubbe) #endif
3c0c281998-01-26Fredrik Hübinette (Hubbe) 
0542ef1999-11-17Fredrik Hübinette (Hubbe) #endif /* PROGRAM_H */
3c0c281998-01-26Fredrik Hübinette (Hubbe) #ifdef DEBUG_MALLOC
d00c501999-03-11Henrik Grubbström (Grubba) #define end_program() ((struct program *)debug_malloc_pass(debug_end_program()))
45ee5d1999-02-10Fredrik Hübinette (Hubbe) #define end_class(NAME, FLAGS) do { debug_malloc_touch(new_program); debug_end_class(NAME, CONSTANT_STRLEN(NAME), FLAGS); }while(0)
3c0c281998-01-26Fredrik Hübinette (Hubbe) #else
45ee5d1999-02-10Fredrik Hübinette (Hubbe) #define end_class(NAME,FLAGS) debug_end_class(NAME, CONSTANT_STRLEN(NAME), FLAGS)
3c0c281998-01-26Fredrik Hübinette (Hubbe) #define end_program debug_end_program #endif
bcd5741999-03-17Fredrik Hübinette (Hubbe)  #ifdef PIKE_DEBUG #define start_new_program() debug_start_new_program(__LINE__,__FILE__) #else #define start_new_program() debug_start_new_program() #endif