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.384 2006/01/21 14:35:45 grubba Exp $ + // $Id: master.pike.in,v 1.385 2006/01/25 21:07:58 grubba 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:3204:   //! @expr{"/path/to/pike/lib/modules/Foo.pmod/Bar.pmod"@} to a module   //! identifier on the form @expr{"Foo.Bar"@}.   //!   //! If @[module_prefix] or @[module_suffix] are given, they are   //! prepended and appended, respectively, to the returned string if   //! it's a module file (i.e. ends with @expr{".pmod"@} or   //! @expr{".so"@}). If @[object_suffix] is given, it's appended to the   //! returned string if it's an object file (i.e. ends with   //! @expr{".pike"@}).   { +  if (path == "/master") return "master" + (object_suffix || ""); +     array(string) sort_paths_by_length(array(string) paths)    {    sort(map(paths, sizeof), paths);    return reverse(paths);    };    -  if (path == "/master") return "master" + (object_suffix || ""); +  string prefix = "";    -  foreach(sort_paths_by_length(map(pike_module_path - ({""}), +  array(Version) versions = reverse(sort(indices(compat_handler_cache))); +  find_prefix: +  foreach(versions, Version version) { +  CompatResolver r = compat_handler_cache[version]; +  if (!r) continue; // Protection against the gc... +  +  foreach(sort_paths_by_length(map(r->pike_module_path - ({""}),    lambda(string s) {    if (s[-1] == '/') return s;    return s+"/";    })), -  string prefix) { -  if (has_prefix(path, prefix)) { -  path = path[sizeof(prefix)..]; -  break; +  string path_prefix) { +  if (has_prefix(path, path_prefix)) { +  path = path[sizeof(path_prefix)..]; +  if (version != currentversion) { +  prefix = ((string)version) + "::";    } -  +  break find_prefix;    } -  +  } +  }      #if 0    // This seems broken. Why should the current directory or the    // setting of SHORT_PIKE_ERRORS etc affect the module identifiers?    // /mast    path = trim_file_name(path);   #endif       string modname = replace(path, ".pmod/", ".");    if(search(modname, "/")<0) path=modname;    -  +  path = prefix + path; +     if (has_suffix(path, ".module.pmod")) {    return (module_prefix || "") + path[..<12] + (module_suffix || "");    }    if (has_suffix(path, ".pmod")) {    return (module_prefix || "") + path[..<5] + (module_suffix || "");    }    if (has_suffix(path, ".so")) {    return (module_prefix || "") + path[..<3] + (module_suffix || "");    }    if (has_suffix(path, ".pike")) {
pike.git/lib/master.pike.in:4417:    {    switch(type)    {    case "string":    return sprintf("%d.%d",major,minor);    }    }   }      //! Version information about the current Pike version. - Version currentversion=Version(__MAJOR__,__MINOR__); + Version currentversion = Version(__REAL_MAJOR__, __REAL_MINOR__);    - mapping(Version:CompatResolver) compat_handler_cache = set_weak_flag( ([]), 1); + mapping(Version:CompatResolver) compat_handler_cache = ([ +  currentversion:this_object(), + ]);      CompatResolver get_compilation_handler(int major, int minor)   {    Version v=Version(major,minor);       if(v > currentversion)    { -  /* do we want to make an error if major.minor > __MAJOR__.__MINOR ? */ +  /* Do we want to make an error if major.minor > __MAJOR__.__MINOR ? +  * +  * No; it's useful for referring to the next version when writing +  * compat modules. +  */    return 0;    }       CompatResolver ret;       if(!zero_type(ret=compat_handler_cache[v])) return ret;       array(string) files;    array(Version) available=({});