pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   // -*- Pike -*-   //   // Master Control Program for Pike.   //   // This file is part of Pike. For copyright information see COPYRIGHT.   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.394 2007/06/12 14:29:14 mbaehr Exp $ + // $Id: master.pike.in,v 1.395 2007/06/13 13:30:51 mbaehr Exp $      #pike __REAL_VERSION__   //#pragma strict_types      // Some programs destroys character pairs beginning with the currency   // symbol when running in chinese locale.   #if "ยค/" != "\244/"   #error "master.pike.in is corrupted."   #endif   
pike.git/lib/master.pike.in:355:    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); -  cache_source(ret, filename, source); +  cache_source(ret, source);    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;
pike.git/lib/master.pike.in:503:   //!   //! @seealso   //! @[compile()], @[compile_string()], @[cpp()]   //!   program compile_file(string filename,    object|void handler,    void|program p,    void|object o)   {    AUTORELOAD_CHECK_FILE(filename); -  program ret = compile(cpp(master_read_file(filename), +  return compile(cpp(master_read_file(filename),    filename,    1,    handler,    compat_major,    compat_minor),    handler,    compat_major,    compat_minor,    p,    o); -  cache_source(ret, filename); -  return ret; +    }            #if 0   variant mapping(string:string) getenv()   {    return environment + ([]);   }   
pike.git/lib/master.pike.in:753:    if (has_suffix(fname, ".pmod")) return 3;    if (has_suffix(fname, ".so")) return 2;    if (has_suffix(fname, ".pike")) return 1;       // FIXME: Warn here?    return 0;   }      //! Used to capture the source from programs being compiled to allow later   //! extraction of documentation - static void cache_source(mixed ret, string fname, void|string source) + static void cache_source(mixed ret, string source)   { -  if (documentation && !documentation[ret] && (fname||source)) +  if (documentation && !documentation[ret]) +  documentation[ret] = ([ "source":source ]); + } +  + //! Find the files in which @[mod] is defined, as they may be hidden away in + //! joinnodes and dirnodes + //! + //! @param mod + //! The module we are looking for. + //! + //! @returns + //! An array of strings with filenames. + //! (one for each file in a joinnode, or just one otherwise) + array(string) module_defined(object mod)   { -  if (fname) -  documentation[ret] = ([ "fname":fname ]); +  array mods; +  array files = ({}); +  if (mod->is_resolv_joinnode) +  mods = mod->joined_modules;    else -  documentation[ret] = ([ "source":source ]); +  mods = ({ mod }); +  +  foreach (mods;; object mod) +  { +  if (mod->is_resolv_dirnode) +  files += ({ Builtin()->program_defined(object_program(mod->module)) }); +  else +  files += ({ Builtin()->program_defined(object_program(mod)) });    } -  +  return files;   }      //! Show documentation for the item @[obj]   //!   //! @param obj   //! The object for which the documentation should be shown   //!   //! @returns   //! an AutoDoc object   object show_doc(program|object|function obj)   {    object doc_extractor = main_resolv("Tools.AutoDoc.PikeExtractor.extractClass");    string child;    program prog; -  +  string fname; +     if (programp(obj))    prog = obj;    if (functionp(obj))    {    prog = function_program(obj);    child = ((describe_function(obj)||"")/"->")[-1];    }    if (objectp(obj))    {    if (obj->is_resolv_joinnode)    obj = obj->joined_modules[0]; // FIXME: check for multiples    if (obj->is_resolv_dirnode)    prog = object_program(obj->module);    }    -  if (doc_extractor && documentation[prog] && !documentation[prog]->doc) +  fname = Builtin()->program_defined(prog); +  +  if (doc_extractor && (!documentation[prog] || !documentation[prog]->doc))    { -  documentation[prog]->doc = doc_extractor(documentation[prog]->source||master_read_file(documentation[prog]->fname)||"", sprintf("%O", prog)); -  documentation[prog]->source = 0; // source not needed once anymore +  documentation[prog] = ([ "doc":doc_extractor(documentation[prog]->source||master_read_file(fname)||"", sprintf("%O", prog)) ]);    } -  +     if (documentation[prog] && documentation[prog]->doc)    {    if (child)    return documentation[prog]->doc->findObject(child);    else    return documentation[prog]->doc;    }   }      
pike.git/lib/master.pike.in:859:   #endif       if( (s=master_file_stat(fakeroot(fname))) && s->isreg )    {   #ifdef PIKE_AUTORELOAD    if(!autoreload_on || load_time[fname] >= s->mtime)   #endif    {    if(!zero_type (ret=programs[fname]) && ret != no_value) {    resolv_debug ("low_findprog %s: returning cached (no autoreload)\n", fname); -  cache_source(ret, fname); +     return ret;    }    }       AUTORELOAD_BEGIN();      #ifdef PIKE_AUTORELOAD    if (load_time[fname] >= s->mtime)    if (!zero_type (ret=programs[fname]) && ret != no_value) {    resolv_debug ("low_findprog %s: returning cached (autoreload)\n", fname); -  cache_source(ret, fname); +     return ret;    }   #endif       switch(ext)    {    case "":    case ".pike":    foreach(query_precompiled_names(fname), string oname) {    if(Stat s2=master_file_stat(fakeroot(oname)))
pike.git/lib/master.pike.in:900:    get_codec)(fname, mkobj, handler));    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: dump decode ok\n", fname);    if (ret && ret->this_program_does_not_exist) {    resolv_debug ("low_findprog %s: program claims not to exist\n",    fname);    return programs[fname] = 0;    }    else {    resolv_debug("low_findprog %s: returning %O\n", fname, ret); -  cache_source(ret, fname); +     return programs[fname]=ret;    }    };    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: dump decode failed\n", fname);    programs[fname] = no_value;    call_compile_warning (handler, oname,    "Decode failed: " + describe_error(err));    } else if (out_of_date_warning) {    call_compile_warning (handler, oname,
pike.git/lib/master.pike.in:942:    } )    {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: compilation failed\n", fname);    objects[ret] = no_value;    ret=programs[fname]=0; // Negative cache.    throw(e);    }    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: compilation ok\n", fname); -  cache_source(ret, fname); +     break;      #if constant(load_module)    case ".so":    if (fname == "") {    werror( "low_findprog(%O, %O) => load_module(\"\")\n"    "%s\n", pname, ext, describe_backtrace(backtrace()) );    }       if (array|object err = catch (ret = load_module(fakeroot(fname)))) {
pike.git/lib/master.pike.in:985:    }       AUTORELOAD_FINISH(ret,programs,fname);       if (ret && ret->this_program_does_not_exist) {    resolv_debug ("low_findprog %s: program says it doesn't exist\n", fname);    return programs[fname] = 0;    }    else {    resolv_debug("low_findprog %s: returning %O\n", fname, ret); -  cache_source(ret, fname); +     return programs[fname]=ret;    }    }       resolv_debug ("low_findprog %s: file not found\n", fname);    return 0;   }      //   // This function is called by the compiler when a delayed compilation
pike.git/lib/master.pike.in:1076:    }    else {    ext="";    }       if(IS_ABSOLUTE_PATH(pname))    {    program|NoValue prog = programs[pname];    if ((!zero_type(prog)) && (prog != no_value))    { -  cache_source(prog, pname); +     return prog;    }    pname=combine_path("",pname);    return findprog(pname,ext,handler,mkobj);    }    else {    string cwd;    if(current_file)    {    cwd=dirname(current_file);