pike.git / src / program.h

version» Context lines:

pike.git/src/program.h:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/      /* -  * $Id: program.h,v 1.145 2001/10/05 01:30:14 hubbe Exp $ +  * $Id: program.h,v 1.146 2001/10/05 22:58:38 hubbe Exp $    */   #ifndef PROGRAM_H   #define PROGRAM_H      #include <stdarg.h>   #include "global.h"   #include "pike_types.h"   #include "pike_macros.h"   #include "svalue.h"   #include "time_stuff.h"
pike.git/src/program.h:141:   #define IDENTIFIER_ALIAS 128 /* This identifier is an alias. */      #define IDENTIFIER_IS_FUNCTION(X) ((X) & IDENTIFIER_FUNCTION)   #define IDENTIFIER_IS_PIKE_FUNCTION(X) ((X) & IDENTIFIER_PIKE_FUNCTION)   #define IDENTIFIER_IS_CONSTANT(X) ((X) & IDENTIFIER_CONSTANT)   #define IDENTIFIER_IS_VARIABLE(X) (!((X) & (IDENTIFIER_FUNCTION | IDENTIFIER_CONSTANT)))   #define IDENTIFIER_IS_ALIAS(X) ((X) & IDENTIFIER_ALIAS)      #define IDENTIFIER_MASK 255    + /* +  * Every constant, class, function and variable +  * get's exactly one of these. +  */   struct identifier   {    struct pike_string *name;    struct pike_type *type;    unsigned INT8 identifier_flags; /* IDENTIFIER_??? */    unsigned INT8 run_time_type; /* PIKE_T_??? */    unsigned INT16 opt_flags; /* OPT_??? */   #ifdef PROFILING    unsigned INT32 num_calls;    unsigned INT32 total_time;    unsigned INT32 self_time;   #endif /* PROFILING */    union idptr func;   };    -  + /* +  * This is used to store constants, both +  * inline constants and those defined explicitly with +  * the constant keyword. +  */   struct program_constant   {    struct svalue sval;    struct pike_string *name;   };      /*    * in the bytecode, a function starts with:    * char num_args    * char num_locals
pike.git/src/program.h:187:   #define ID_OPTIONAL 0x100 /* Symbol is not required by the interface */   #define ID_EXTERN 0x200 /* Symbol is defined later */   #define ID_VARIANT 0x400 /* Function is overloaded by argument. */   #define ID_ALIAS 0x800 /* Variable is an overloaded alias. */      #define ID_MODIFIER_MASK 0x0fff      #define ID_STRICT_TYPES 0x8000 /* #pragma strict_types */   #define ID_SAVE_PARENT 0x10000 /* pragma save_parent */    +  + /* +  * All identifiers in this program +  * and all identifiers in inherited programs +  * needs to have a 'struct reference' in this +  * program. When we overload a function, we simply +  * change the reference to point to the new 'struct identifier'. +  */   struct reference   {    unsigned INT16 inherit_offset;    unsigned INT16 identifier_offset;    INT16 id_flags; /* static, private etc.. */   };    -  + /* +  * Each program has an array of these, +  * the first entry points to itself, the +  * rest are from inherited programs. +  * Note that when a program is inherited, +  * all 'struct inherit' from that program is +  * copied, so the whole tree of inherits is +  * represented. +  */   struct inherit   {    INT16 inherit_level;    INT16 identifier_level;    INT16 parent_identifier;    INT16 parent_offset;    ptrdiff_t storage_offset;    struct object *parent;    struct program *prog;    struct pike_string *name;   };    -  +  + /* +  * Storage struct for a trampoline object +  * (not a part of the program type) +  */   struct pike_trampoline   {    struct pike_frame *frame;    INT32 func;   };            /* program parts have been realloced into one block */   #define PROGRAM_OPTIMIZED 1
pike.git/src/program.h:271:   #define PROG_EVENT_GC_RECURSE 2   #define PROG_EVENT_GC_CHECK 3   #define NUM_PROG_EVENTS 4      /* These macros should only be used if (p->flags & PROGRAM_USES_PARENT)    * is true    */   #define LOW_PARENT_INFO(O,P) ((struct parent_info *)(PIKE_OBJ_STORAGE((O)) + (P)->parent_info_storage))   #define PARENT_INFO(O) LOW_PARENT_INFO( (O), (O)->prog)    + /* +  * Objects which needs to access their parent +  * have to allocate one of these structs in +  * the object data area. +  * The parent_info_storage member of the program +  * struct tells us where in the object to find this +  * data. +  */   struct parent_info   {    struct object *parent;    INT16 parent_identifier;   };      struct program   {    PIKE_MEMORY_OBJECT_MEMBERS; /* Must be first */