pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:93:    ptrdiff_t len;   };      struct cpp;   struct define_struct;   typedef void (*magic_define_fun)(struct cpp *,    struct define_struct *,    struct pike_string *,    struct string_builder *);    - struct define_struct + DECLARATIONS; +  + PIKECLASS define   { -  struct hash_entry link; /* must be first */ -  magic_define_fun magic; -  int args; -  ptrdiff_t num_parts; -  short inside; /* 1 - Don't expand. 2 - In use. */ -  short varargs; -  struct pike_string *first; -  struct define_part *parts; - }; +  CVAR struct hash_entry link; /* must be first */ +  CVAR magic_define_fun magic; +  CVAR int args; +  CVAR ptrdiff_t num_parts; +  CVAR short inside; /* 1 - Don't expand. 2 - In use. */ +  CVAR short varargs; +  CVAR struct pike_string *first; +  CVAR struct define_part *parts;    - static void init_define_struct(struct object *UNUSED(o)) +  DECLARE_STORAGE; +  + INIT   {    struct define_struct *def = (struct define_struct *)(Pike_fp->current_storage);    def->magic=0;    def->args=-1;    def->inside=0;    def->varargs=0;    def->parts = NULL;    def->num_parts=0;    def->first=0;    def->link.s = NULL;   }    - static void exit_define_struct(struct object *UNUSED(o)) + EXIT   {    struct define_struct *d = (struct define_struct *)(Pike_fp->current_storage);    INT32 e;    for (e = 0; e < d->num_parts; e++)    free_string(d->parts[e].postfix);    if (d->parts)    free(d->parts);    if (d->link.s)    free_string(d->link.s);    if(d->first)    free_string(d->first);   } -  + }    - static struct program *define_program = NULL; -  +    struct cpp   {    struct mapping *defines;    INT_TYPE current_line;    INT32 compile_errors;    struct pike_string *current_file;    struct string_builder buf;    struct object *handler;    struct object *compat_handler;    INT_TYPE compat_major;
pike.git/src/cpp.cmod:161:      static struct define_struct *find_define(struct cpp *this, struct pike_string *n)   {    struct svalue *s;    if (!this->defines) return NULL;    if (!(s = low_mapping_string_lookup(this->defines, n))) return NULL;    if (TYPEOF(*s) != T_OBJECT) return NULL;    return (struct define_struct *)get_storage(s->u.object, define_program);   }    - DECLARE_STORAGE; -  +    static void cpp_error(struct cpp *this, const char *err) ATTRIBUTE((noinline));   static void cpp_error_vsprintf (struct cpp *this, const char *fmt,    va_list args) ATTRIBUTE((noinline));   static void cpp_error_sprintf(struct cpp *this, const char *fmt, ...) ATTRIBUTE((noinline));   static void cpp_handle_exception(struct cpp *this,    const char *cpp_error_fmt, ...) ATTRIBUTE((noinline));   static void cpp_warning(struct cpp *this, const char *cpp_warn_fmt, ...) ATTRIBUTE((noinline));   struct define_struct *defined_macro = NULL;   static struct svalue defined_macro_sval;   
pike.git/src/cpp.cmod:3615:    else Pike_error ("Initial predefines already taken over.\n");   }      /*! @endmodule    */      void init_cpp()   {    struct svalue s;    -  start_new_program(); -  ADD_STORAGE(struct define_struct); -  set_init_callback(init_define_struct); -  set_exit_callback(exit_define_struct); -  define_program = end_program(); -  -  defined_macro=alloc_empty_define(make_shared_string("defined"),0); -  defined_macro->magic=check_defined; -  defined_macro->args=1; -  defined_macro_sval = Pike_sp[-1]; -  Pike_sp--; -  +     efun_str = make_shared_string ("efun");    constant_str = make_shared_string ("constant");    defined_str = make_shared_string ("defined");       use_initial_predefs = 1;       INIT;    -  +  defined_macro=alloc_empty_define(make_shared_string("defined"),0); +  defined_macro->magic=check_defined; +  defined_macro->args=1; +  defined_macro_sval = Pike_sp[-1]; +  Pike_sp--; +     ADD_INT_CONSTANT("__HAVE_CPP_PREFIX_SUPPORT__", 1, 0);       /* Somewhat tricky to add a _constant_ function in _static_modules.Builtin. */    SET_SVAL(s, T_FUNCTION, FUNCTION_BUILTIN, efun,    make_callable (f__take_over_initial_predefines,    "_take_over_initial_predefines",    "function(void:mapping(string:string))",    OPT_SIDE_EFFECT, NULL, NULL));    simple_add_constant ("_take_over_initial_predefines", &s, 0);    free_svalue (&s);
pike.git/src/cpp.cmod:3695:    free(tmp->value);    first_predef=tmp->next;    free(tmp);    }    free_svalue(&defined_macro_sval);       free_string (efun_str);    free_string (constant_str);    free_string (defined_str);    -  free_program(define_program); +    #endif   }