pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1:   /* -*- Pike -*-    * -  * $Id: master.pike.in,v 1.173 2001/10/28 17:54:43 nilsson Exp $ +  * $Id: master.pike.in,v 1.174 2001/11/07 21:51:19 nilsson Exp $    *    * Master-file for Pike.    *    * Based on master.pike 1.67.    */      // Some configurable parameters useful for debugging      #pike __REAL_VERSION__   #define PIKE_AUTORELOAD      // Used by describe_backtrace() et al.   #if !defined(BT_MAX_STRING_LEN) || (BT_MAX_STRING_LEN <= 0)   #undef BT_MAX_STRING_LEN   #define BT_MAX_STRING_LEN 200   #endif /* !defined(BT_MAX_STRING_LEN) || (BT_MAX_STRING_LEN <= 0) */   constant bt_max_string_len = BT_MAX_STRING_LEN;    - //! @decl constant bt_max_string_len = int + //! @decl constant bt_max_string_len = 200 + //! This constant contains the maximum number of lines a backtrace may + //! contain. Defaults to 200 if no BT_MAX_STRING_LEN define has been + //! given.      // Enables the out of date warning in low_find_prog().   #ifndef OUT_OF_DATE_WARNING   #define OUT_OF_DATE_WARNING 1   #endif /* OUT_OF_DATE_WARNING */   constant out_of_date_warning = OUT_OF_DATE_WARNING;    - //! @decl constant out_of_date_warning = int(0..1) + //! @decl constant out_of_date_warning = 1 + //! Should Pike complain about out of date compiled files. + //! 1 means yes and 0 means no. Controlled by the OUT_OF_DATE_WARNING + //! define.      #ifndef PIKE_WARNINGS   #define PIKE_WARNINGS 0   #endif /* PIKE_WARNINGS */      #undef PIKE_MODULE_RELOC      /*    * Functions begin here.    */    -  + // FIXME: Should the pikeroot-things be private?   #ifdef PIKE_FAKEROOT   object o;   string fakeroot(string s)   {    string tmp1=combine_path_with_cwd(s);   #ifdef PIKE_FAKEROOT_OMIT    foreach(PIKE_FAKEROOT_OMIT/":", string x)    if(glob(x,tmp1))    return s;   #endif
pike.git/lib/master.pike.in:1135:      //!   class CompatResolver   {    array(string) pike_include_path=({});    array(string) pike_module_path=({});    array(string) pike_program_path=({});    int want_warnings = PIKE_WARNINGS;    string ver;    -  void create(mixed v) +  //! The ComparResolver is initialized with a value that can be +  //! casted into a "%d.%d" string, e.g. a version object. +  void create(mixed version)    { -  ver=(string)v; +  ver=(string)version;    }    -  //! @appears add_include_path +     //! Add a directory to search for include files.    //!    //! This is the same as the command line option @tt{-I@}.    //!    //! @note    //! Note that the added directory will only be searched when using    //! < > to quote the included file.    //!    //! @seealso    //! @[remove_include_path()]    //!    void add_include_path(string tmp)    {    tmp=normalize_path(combine_path_with_cwd(tmp));    pike_include_path-=({tmp});    pike_include_path=({tmp})+pike_include_path;    }    -  //! @appears remove_include_path +     //! Remove a directory to search for include files.    //!    //! This function performs the reverse operation of @[add_include_path()].    //!    //! @seealso    //! @[add_include_path()]    //!    void remove_include_path(string tmp)    {    tmp=normalize_path(combine_path_with_cwd(tmp));    pike_include_path-=({tmp});    }    -  //! @appears add_module_path +     //! Add a directory to search for modules.    //!    //! This is the same as the command line option @tt{-M@}.    //!    //! @seealso    //! @[remove_module_path()]    //!    void add_module_path(string tmp)    {    tmp=normalize_path(combine_path_with_cwd(tmp));    pike_module_path-=({tmp});    pike_module_path=({tmp})+pike_module_path;    }    -  -  //! @appears remove_module_path +     //! Remove a directory to search for modules.    //!    //! This function performs the reverse operation of @[add_module_path()].    //!    //! @seealso    //! @[add_module_path()]    //!    void remove_module_path(string tmp)    {    tmp=normalize_path(combine_path_with_cwd(tmp));    pike_module_path-=({tmp});    }    -  -  //! @appears add_program_path +     //! Add a directory to search for programs.    //!    //! This is the same as the command line option @tt{-P@}.    //!    //! @seealso    //! @[remove_program_path()]    //!    void add_program_path(string tmp)    {    tmp=normalize_path(combine_path_with_cwd(tmp));    pike_program_path-=({tmp});    pike_program_path=({tmp})+pike_program_path;    }    -  -  //! @appears remove_program_path +     //! Remove a directory to search for programs.    //!    //! This function performs the reverse operation of @[add_program_path()].    //!    //! @seealso    //! @[add_program_path()]    //!    void remove_program_path(string tmp)    {    tmp=normalize_path(combine_path_with_cwd(tmp));    pike_program_path-=({tmp});    }    -  +  //!    mapping get_default_module()    {    /* This is an ugly kluge to avoid an infinite recursion.    * The infinite recursion occurs because this function is    * called for every file when the compat_major/minor is set.    * This kluge could cause problems with threads if the    * compiler was threaded. -Hubbe    */    int saved_compat_minor=compat_minor;    int saved_compat_major=compat_major;
pike.git/lib/master.pike.in:1258:    mixed err =catch {    if(x=resolv("__default.all_constants")) x=x();    };       compat_major=saved_compat_major;    compat_minor=saved_compat_minor;    if(err) throw(err);    return x;    }    +  //!    mixed resolv_base(string identifier, string|void current_file,    object|void current_handler)    {   // werror("Resolv_base(%O)\n",identifier);    array(mixed) tmp = ({});    string dir=current_file ? dirname(current_file) : "/";       foreach(pike_module_path, string path)    {    string file=combine_path(dir, path, identifier);
pike.git/lib/master.pike.in:1300:    if (sizeof(tmp)) {    if (sizeof(tmp) == 1) {    return(tmp[0]);    }    return joinnode(tmp);    }    return UNDEFINED;    }       mapping resolv_cache = set_weak_flag( ([]), 1 ); +  +  //!    mixed resolv(string identifier, string|void current_file,    object|void current_handler)    {   // werror("Resolv(%O)\n",identifier);       // FIXME: Support having the cache in the handler?    if( no_resolv[ identifier ] )    return UNDEFINED;       if (current_file && !stringp(current_file)) {
pike.git/lib/master.pike.in:1362:    break;    else    path=0;    }       }       return path;    }    +  //!    string read_include(string f)    {    AUTORELOAD_CHECK_FILE(f)    return master_read_file(f);    }    -  +     string _sprintf()    {    return sprintf("CompatResolver(%s)",ver);    }   }      inherit CompatResolver;      //! These are useful if you want to start other Pike processes   //! with the same options as this one was started with.
pike.git/lib/master.pike.in:2547:    error("Cannot encode objects yet.\n");    }          void decode_object(object o, mixed data)    {    o->_decode(data);    }   }    -  + //! Contains version information about a Pike version.   class Version   { -  +  +  //! The major and minor parts of the version.    int major;    int minor; -  +  +  //! @decl void create(int major, int minor) +  //! Set the version in the object.    void create(int maj, int min)    { -  major=maj; -  minor=min; +  major = maj; +  minor = min;    }      #define CMP(X) ((major - (X)->major) || (minor - (X)->minor))    -  +  //! Methods define so that version objects +  //! can be compared and ordered.    int `<(Version v) { return CMP(v) < 0; }    int `>(Version v) { return CMP(v) > 0; }    int `==(Version v) { return CMP(v)== 0; }    int _hash() { return major * 4711 + minor ; }       string _sprintf() { return sprintf("%d.%d",major,minor); } -  +  +  //! The version object can be casted into a string.    mixed cast(string type)    {    switch(type)    {    case "string":    return sprintf("%d.%d",major,minor);    }    }   }    -  + //! Version information about the current Pike version.   Version currentversion=Version(__MAJOR__,__MINOR__); -  +    mapping(Version:CompatResolver) compat_handler_cache=set_weak_flag( ([]), 1);      CompatResolver get_compilation_handler(int major, int minor)   {    CompatResolver ret;       Version v=Version(major,minor);       if(v > currentversion)    {