pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:101:   #define Stat Files.Stat   #define capitalize(X) (upper_case((X)[..0])+(X)[1..])   #define trim_all_whites(X) (Builtin.string_trim_all_whites (X))      private function write = Files()->_stdout->write;   private function werror = Files()->_stderr->write;      // Tell Pike.count_memory this is global.   constant pike_cycle_depth = 0;    - #ifdef RESOLV_DEBUG + //#define RECUR_COMPILE_DEBUG + // More brief than RESOLV_DEBUG. Usually enough to find those pesky + // "Recursive module dependency" bugs. :P    -  + #if defined (RESOLV_DEBUG) || defined (RECUR_COMPILE_DEBUG) +    #if constant (thread_local) - protected object resolv_msg_depth = thread_local(); + protected object _msg_depth = thread_local();   // NOTE: May be used before __INIT has completed. - #define GET_RESOLV_MSG_DEPTH (resolv_msg_depth && resolv_msg_depth->get()) - #define INC_RESOLV_MSG_DEPTH() (resolv_msg_depth && resolv_msg_depth->set (resolv_msg_depth->get() + 1)) - #define DEC_RESOLV_MSG_DEPTH() (resolv_msg_depth && resolv_msg_depth->set (resolv_msg_depth->get() - 1)) + #define GET_MSG_DEPTH (_msg_depth && _msg_depth->get()) + #define INC_MSG_DEPTH() (_msg_depth && _msg_depth->set (_msg_depth->get() + 1)) + #define DEC_MSG_DEPTH() (_msg_depth && _msg_depth->set (_msg_depth->get() - 1))   #else - protected int resolv_msg_depth; - #define GET_RESOLV_MSG_DEPTH resolv_msg_depth - #define INC_RESOLV_MSG_DEPTH() (++resolv_msg_depth) - #define DEC_RESOLV_MSG_DEPTH() (--resolv_msg_depth) + protected int _msg_depth; + #define GET_MSG_DEPTH _msg_depth + #define INC_MSG_DEPTH() (++_msg_depth) + #define DEC_MSG_DEPTH() (--_msg_depth)   #endif    -  + #endif +  + #ifdef RESOLV_DEBUG +  + #define GET_RESOLV_MSG_DEPTH GET_MSG_DEPTH + #define INC_RESOLV_MSG_DEPTH INC_MSG_DEPTH + #define DEC_RESOLV_MSG_DEPTH DEC_MSG_DEPTH +    void resolv_debug (sprintf_format fmt, sprintf_args... args)   {    string pad = " " * GET_RESOLV_MSG_DEPTH;    if (sizeof (args)) fmt = sprintf (fmt, @args);    if (fmt[-1] == '\n')    fmt = pad + replace (fmt[..<1], "\n", "\n" + pad) + "\n";    else    fmt = pad + replace (fmt, "\n", "\n" + pad);    if (!werror) werror = Files()->_stderr->write;    werror (fmt);
pike.git/lib/master.pike.in:1147:   //!   //! @seealso   //! @[compile()], @[cpp()], @[compile_file()]   //!   program compile_string(string source, void|string filename,    object|void handler,    void|program p,    void|object o,    void|int _show_if_constant_errors)   { + #ifdef RECUR_COMPILE_DEBUG +  werror ("%*s>>> compile_string %O\n", GET_MSG_DEPTH, "", filename); +  INC_MSG_DEPTH(); + #endif    program ret = compile(cpp(source, filename||"-", 1, handler,    compat_major, compat_minor,    (zero_type(_show_if_constant_errors)?    show_if_constant_errors:    _show_if_constant_errors)),    handler,    compat_major,    compat_minor,    p,    o);    if (source_cache)    source_cache[ret] = source; -  + #ifdef RECUR_COMPILE_DEBUG +  DEC_MSG_DEPTH(); +  werror ("%*s<<< compile_string %O\n", GET_MSG_DEPTH, "", filename); + #endif    return ret;   }      //!   string master_read_file(string file)   {    object o=Files()->Fd();    if( ([function(string, string : int)]o->open)(fakeroot(file),"r") )    return ([function(void : string)]o->read)();    return 0;