pike.git / src / cpp.cmod

version» Context lines:

pike.git/src/cpp.cmod:93:    struct define_struct *,    struct pike_string *,    struct string_builder *);      DECLARATIONS;      #define CPP_MACRO_DISABLED 1 /* Don't expand. */   #define CPP_MACRO_IN_USE 2 /* In use. */   #define CPP_MACRO_VARARGS 4 /* Varargs. */    + /*! @class CompilerEnvironment +  */ +    /* Consider    *    * class Preprocessor    * {    * class Macro    * {    * }    *    * mapping(string:Macro) macros;    *
pike.git/src/cpp.cmod:344:    */      /*! @class CPP    *!    *! The state for an instance of the preprocessor.    *!    *! @seealso    *! @[predef::cpp()]    */   PIKECLASS CPP +  program_flags PROGRAM_USES_PARENT|PROGRAM_NEEDS_PARENT;   {    /*! @decl inherit Reporter    */    INHERIT reporter;       PIKEVAR mapping(string:object(define)) defines flags ID_PRIVATE|ID_PROTECTED;    PIKEVAR int current_line;    PIKEVAR int compile_errors;    PIKEVAR string current_file;    PIKEVAR string charset;
pike.git/src/cpp.cmod:522:    args = 5;    message = Pike_sp[-1].u.string;    }    ref_push_string(filename);    push_int(linenumber);    ref_push_string(message);    apply_low(found, fun, 3);    }    return;    } -  apply_current(f_inherited_Reporter_report_fun_num, args); +  /* Nothing apropriate in any handlers. +  * Call the report() in our parent. +  */ +  apply_external(1, CE_REPORT_FUN_NUM, args);   }      static void cpp_report_vsprintf(struct CPP_struct *this, int severity,    const char *fmt, va_list args)    ATTRIBUTE((noinline));   static void cpp_report(struct CPP_struct *this, int severity,    const char *fmt, ...)    ATTRIBUTE((noinline));   static void cpp_error(struct CPP_struct *this, const char *err) ATTRIBUTE((noinline));   static void cpp_error_sprintf(struct CPP_struct *this, const char *fmt, ...) ATTRIBUTE((noinline));
pike.git/src/cpp.cmod:5069:   #endif    simple_add_define(this, "SIZEOF_INT",    " " DEFINETOSTR(SIZEOF_INT) " ");    simple_add_define(this, "SIZEOF_FLOAT",    " " DEFINETOSTR(SIZEOF_FLOAT) " ");    }   }   /*! @endclass CPP    */    + /*! @endclass CompilerEnvironment +  */ +    /*! @decl string cpp(string data, mapping|string|void current_file, @    *! int|string|void charset, object|void handler, @    *! void|int compat_major, void|int compat_minor, @    *! void|int picky_cpp)    *!    *! Run a string through the preprocessor.    *!    *! Preprocesses the string @[data] with Pike's builtin ANSI-C look-alike    *! preprocessor. If the @[current_file] argument has not been specified,    *! it will default to @expr{"-"@}. @[charset] defaults to @expr{"ISO-10646"@}.
pike.git/src/cpp.cmod:5122:   PIKEFUN string cpp(string data,    mapping|string|void opts_or_file,    int|string|void charset_sv,    object|void handler,    int|void compat_major_sv,    int|void compat_minor_sv,    int|void picky_cpp_sv)    efun;   {    struct svalue *save_sp = Pike_sp - args; -  struct object *cpp_obj = clone_object(CPP_program, args-1); +  struct object *cpp_obj = +  parent_clone_object(CPP_program, +  compilation_environment, CPP_program_fun_num, +  args-1);    struct CPP_struct *this =    (struct CPP_struct *)get_storage(cpp_obj, CPP_program);    struct mapping *predefs = NULL;      #ifdef PIKE_DEBUG    ONERROR tmp;   #endif /* PIKE_DEBUG */       push_object(cpp_obj);   
pike.git/src/cpp.cmod:5326:    free(tmp);    }    last_predef = 0;    }    else Pike_error ("Initial predefines already taken over.\n");   }      /*! @endmodule    */    - void init_cpp() + void init_cpp_compilerenv_classes(void)   { -  struct svalue s; +  /* NB: This function is called *early* (during compilation +  * of the CompilerEnvironment class). This means that +  * there are some limitations to what is possible to use. +  * +  * NB: This also means that all symbols declared above that +  * aren't efuns will show up in CompilerEnvironment. +  */       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(defined_str);    defined_macro->magic=check_defined;    defined_macro->args=1;    defined_macro_sval = Pike_sp[-1];    Pike_sp--; -  + }    -  + void init_cpp(void) + { +  struct svalue s; +     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);