pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:49:   // Enables the out of date warning in low_findprog().   #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;      // FIXME: PATH_SEPARATOR and UPDIR should probably be exported,   // or at least some functions that use them should be.   // cf Tools.Shoot.runpike.   // /grubba 2004-04-11 - #if defined(__NT__) || defined(__amigaos__) || defined(__OS2__) + #if defined(__NT__)   #define PATH_SEPARATOR ";"   #else   #define PATH_SEPARATOR ":"   #endif    - #ifdef __amigaos__ - #define UPDIR "/" - #else +    #define UPDIR "../" - #endif +       //! @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.      //! If not zero compilation warnings will be written out on stderr.   int want_warnings = PIKE_WARNINGS;      //! Major pike version to emulate.
pike.git/lib/master.pike.in:513:   #define fakeroot relocate_module   #endif // PIKE_MODULE_RELOC         //! Check if a path @[p] is fully qualified (ie not relative).   //!   //! @returns   //! Returns 1 if the path is absolute, 0 otherwise.   int is_absolute_path(string p)   { - #ifdef __amigaos__ - #define IS_ABSOLUTE_PATH(X) (search((X),":")>0) -  return IS_ABSOLUTE_PATH(p); - #else - #if defined(__NT__) || defined(__OS2__) + #if defined(__NT__)    p=replace(p,"\\","/");    if(sscanf(p,"%[a-zA-Z]:%*c",string s)==2 && sizeof(s)==1)    return 1;   #define IS_ABSOLUTE_PATH is_absolute_path   #else   #define IS_ABSOLUTE_PATH(X) has_prefix((X),"/")   #endif    return has_prefix(p,"/"); - #endif +    }    - #if defined(__NT__) || defined(__OS2__) + #if defined(__NT__)   #define EXPLODE_PATH(X) (replace((X),"\\","/")/"/")   #else   #define EXPLODE_PATH(X) ((X)/"/")   #endif      //! Split a path @[p] into its components.   //!   //! This function divides a path into its components. This might seem like   //! it could be done by dividing the string on <tt>"/"</tt>, but that will   //! not work on some operating systems. To turn the components back into   //! a path again, use @[combine_path()].   //!   array(string) explode_path(string p)   { - #ifdef __amigaos__ -  int colon = search(reverse(p), ":"); -  if(colon >= 0) -  return ({ p[..<colon] }) + explode_path(p[<colon+1..]); -  array(string) r = p/"/"; -  return replace(r[..<1], "", "/")+r[<0..]; - #else +     array(string) r = EXPLODE_PATH(p);    if(r[0] == "" && sizeof(p))    r[0] = "/";    return r; - #endif +    }      //! Returns all but the last segment of a path. Some example inputs and   //! outputs:   //!   //! @xml{<matrix>   //! <r><c><b>Expression</b></c><c><b>Value</b></c></r>   //! <r><c>dirname("/a/b")</c><c>"/a"</c></r>   //! <r><c>dirname("/a/")</c><c>"/a"</c></r>   //! <r><c>dirname("/a")</c><c>"/"</c></r>   //! <r><c>dirname("/")</c><c>"/"</c></r>   //! <r><c>dirname("")</c><c>""</c></r>   //! </matrix>@}   //!   //! @seealso   //! @[basename()], @[explode_path()]   string dirname(string x)   {    if(x=="") return ""; - #ifdef __amigaos__ +     array(string) tmp=x/":";    array(string) tmp2=tmp[-1]/"/";    tmp[-1]=tmp2[..<1]*"/";    if(sizeof(tmp2) >= 2 && tmp2[-2]=="") tmp[-1]+="/";    return tmp*":"; - #else -  array(string) tmp=EXPLODE_PATH(x); -  if(x[0]=='/' && sizeof(tmp)<3) return "/"; -  return tmp[..<1]*"/"; - #endif +    }      //! Returns the last segment of a path.   //!   //! @seealso   //! @[dirname()], @[explode_path()]   string basename(string x)   { - #ifdef __amigaos__ -  return ((x/":")[-1]/"/")[-1]; - #define BASENAME(X) ((((X)/":")[-1]/"/")[-1]) - #else +     array(string) tmp=EXPLODE_PATH(x);    return tmp[-1];   #define BASENAME(X) (EXPLODE_PATH(X)[-1]) - #endif +    }      #ifdef PIKE_AUTORELOAD      int autoreload_on;   int newest;      #define AUTORELOAD_BEGIN() \    int ___newest=newest; \    newest=0
pike.git/lib/master.pike.in:2620:       void _decode (array(object) joined_modules)    {    this::joined_modules = joined_modules;    }   }      joinnode handle_import(string path, string|void current_file,    object|void current_handler)   { - #ifdef __amigaos__ -  if(path == ".") -  path = ""; - #endif +     if(current_file)    {    path = combine_path_with_cwd(dirname(current_file), path);    } else {    path = combine_path_with_cwd(path);    }       // FIXME: Need caching!!!   #if 0    // FIXME: This caching strategy could be improved,