pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   /* -*- Pike -*-    * -  * $Id: master.pike.in,v 1.100 2000/02/13 16:24:13 grubba Exp $ +  * $Id: master.pike.in,v 1.101 2000/02/19 21:30:28 nilsson Exp $    *    * Master-file for Pike.    *    * Based on master.pike 1.67.    */      // Some configurable parameters useful for debugging      #define PIKE_AUTORELOAD   
pike.git/lib/master.pike.in:47:    p=replace(p,"\\","/");   #define EXPLODE_PATH(X) (replace((X),"\\","/")/"/")   #else   #define EXPLODE_PATH(X) ((X)/"/")   #endif    return p/"/";   }      string dirname(string x)   { -  string *tmp=EXPLODE_PATH(x); +  array(string) tmp=EXPLODE_PATH(x);    return tmp[..sizeof(tmp)-2]*"/";   }      string basename(string x)   { -  string *tmp=EXPLODE_PATH(x); +  array(string) tmp=EXPLODE_PATH(x);    return tmp[-1];   }   #define DIRNAME dirname   #define BASENAME(X) (EXPLODE_PATH(X)[-1])      #define GETCWD_CACHE   #define FILE_STAT_CACHE      #define UNDEFINED (([])[0])   #define error(X) throw( ({ (X), backtrace()/*[0..sizeof(backtrace())-2]*/ }) )    - string describe_backtrace(mixed *trace); + string describe_backtrace(array trace);   object low_cast_to_object(string oname, string current_file);    - string *pike_include_path=({}); - string *pike_module_path=({}); - string *pike_program_path=({}); + array(string) pike_include_path=({}); + array(string) pike_module_path=({}); + array(string) pike_program_path=({});   int want_warnings;      #ifdef PIKE_AUTORELOAD      int autoreload_on;   int newest;      #define AUTORELOAD_CHECK_FILE(X) \    if(autoreload_on) if(mixed fnord=master_file_stat(X)) if(fnord[3]>newest) newest=fnord[3];   
pike.git/lib/master.pike.in:144:    return combine_path(IS_ABSOLUTE_PATH(path)?"/":getcwd(),path);   }      #ifdef FILE_STAT_CACHE      #define FILE_STAT_CACHE_TIME 20      int invalidate_time;   mapping(string:multiset(string)) dir_cache = ([]);    - mixed *master_file_stat(string x) + array master_file_stat(string x)   {    string file, dir=combine_path_with_cwd(x);       file=BASENAME(dir);    dir=DIRNAME(dir);       multiset(string) d;    if(time() > invalidate_time)    {    dir_cache=([]);    invalidate_time=time()+FILE_STAT_CACHE_TIME;    }    if(zero_type(d=dir_cache[dir]))    { -  if(string *tmp=get_dir(dir)) +  if(array(string) tmp=get_dir(dir))    {    d=dir_cache[dir]=aggregate_multiset(@tmp);    }else{    dir_cache[dir]=0;    }    }       if(d && !d[file]) return 0;       return predef::file_stat(x);
pike.git/lib/master.pike.in:746:    return values(cache);    }   };      // Variables mustn't be static to allow for replace_master().   // /grubba 1998-04-10   mapping(string:mixed) fc=([]);      object findmodule(string fullname)   { -  mixed *stat; +  array stat;    object o;    if(!zero_type(o=fc[fullname]))    {    return o;    }    -  if(mixed *stat=master_file_stat(fullname+".pmod")) +  if(array stat=master_file_stat(fullname+".pmod"))    {    if(stat[1]==-2)    return fc[fullname]=dirnode(fullname+".pmod");    }       if(o=low_cast_to_object(fullname+".pmod","/."))    return fc[fullname]=o;      #if constant(load_module)    if(master_file_stat(fullname+".so"))    return fc[fullname]=low_cast_to_object(fullname,"/.");   #endif       return fc[fullname]=UNDEFINED;   }      mixed handle_import(string what, string|void current_file, object|void handler)   { -  string *tmp,path; +  array(string) tmp; +  string path;    if(current_file)    {    tmp=EXPLODE_PATH(current_file);    tmp[-1]=what;    path=combine_path_with_cwd( tmp*"/");    }    return fc[path]=dirnode(path);   }      mixed resolv_base(string identifier, string|void current_file)
pike.git/lib/master.pike.in:843:   // with the same options as this one was started with.   string _pike_file_name;   string _master_file_name;      /* This function is called when all the driver is done with all setup    * of modules, efuns, tables etc. etc. and is ready to start executing    * _real_ programs. It receives the arguments not meant for the driver    * and an array containing the environment variables on the same form as    * a C program receives them.    */ - void _main(string *orig_argv, string *env) + void _main(array(string) orig_argv, array(string) env)   { -  string *argv=copy_value(orig_argv); +  array(string) argv=copy_value(orig_argv);    int i,debug,trace;    object script;    object tmp;    string a,b; -  mixed *q; +  array q;       _pike_file_name = orig_argv[0];       foreach(env,a)    {    if(sscanf(a,"%s=%s",a,b))    {    if(a=="") // Special hack for NT    {    sscanf(b,"%s=%s",a,b);
pike.git/lib/master.pike.in:966:    case "warnings":    want_warnings++;    break;       case "master":    _master_file_name = q[i][1];    break;    }    }    -  foreach(q, mixed *opts) +  foreach(q, array opts)    {    switch(opts[0])    {    case "version":    werror(version() + " Copyright (C) 1994-1997 Fredrik Hübinette\n"    "Pike comes with ABSOLUTELY NO WARRANTY; This is free software and you are\n"    "welcome to redistribute it under certain conditions; Read the files\n"    "COPYING and DISCLAIMER in the Pike distribution for more details.\n");    exit(0);   
pike.git/lib/master.pike.in:1211:   /* This function is called whenever an #include directive is encountered    * it receives the argument for #include and should return the file name    * of the file to include    * Note that previous_object cannot be trusted in ths function, because    * the compiler calls this function.    */   string handle_include(string f,    string current_file,    int local_include)   { -  string *tmp, path; +  array(string) tmp; +  string path;       if(local_include)    {    tmp=EXPLODE_PATH(current_file);    tmp[-1]=f;    path=combine_path_with_cwd(tmp*"/");    }    else    {    foreach(pike_include_path, path)