Branch: Tag:

2007-11-15

2007-11-15 16:26:47 by Martin Stjernholm <mast@lysator.liu.se>

Always store the complete dirnode paths (i.e. with the ".pmod" suffix)
in the fc mapping. This should fix codec problems since reverse
lookups get well defined.

The change makes findmodule() incompatible; it now expects a path with
a suffix like ".pmod" or ".so". Afaics the function is only used in
the default codec so that shouldn't be much of a problem.

Rev: lib/master.pike.in:1.405

6:   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.404 2007/10/02 16:52:25 grubba Exp $ + // $Id: master.pike.in,v 1.405 2007/11/15 16:26:47 mast Exp $      #pike __REAL_VERSION__   //#pragma strict_types
1406:    resolv_debug("Creating dirnode(%O, %O)...\n", d, h);       fc[dirname]=this; -  if(has_suffix(FIX_CASE(dirname),".pmod")) { -  fc[dirname[..<5]]=this; -  } +        array(string) files = sort(master_get_dir(d)||({}));    if (!sizeof(d)) return ZERO_TYPE();
1539:    dirname=d;    compilation_handler=h;    fc[dirname]=this; -  if(has_suffix(FIX_CASE(dirname),".pmod")) { -  fc[dirname[..<5]]=this; -  } +     array(string) files = sort(master_get_dir(d)||({}));    if (!sizeof(d)) return;    array(string) bases = map(files, base_from_filename);
2074:    return node;   }    - // Probably not used anymore. +    program|object findmodule(string fullname, object|void handler)   {    program|object o;
2090:    return UNDEFINED;    }    -  if(Stat stat=master_file_stat(fakeroot(fullname+".pmod"))) +  if(Stat stat=master_file_stat(fakeroot(fullname)))    {    if(stat->isdir)    {    resolv_debug ("findmodule(%O) => new dirnode\n", fullname); -  return fc[fullname] = dirnode(fullname+".pmod", handler); +  return fc[fullname] = dirnode(fullname, handler);    } -  + #if constant (load_module) +  else if (has_suffix (fullname, ".so")) { +  o = fc[fullname] = low_cast_to_object(fullname, "/.", handler); +  DEC_RESOLV_MSG_DEPTH(); +  resolv_debug ("findmodule(%O) => got .so object %O\n", fullname, o); +  return o;    } -  + #endif +  }       INC_RESOLV_MSG_DEPTH();    -  if(objectp (o = low_cast_to_object(fullname+".pmod", "/.", handler))) { +  if(objectp (o = low_cast_to_object(fullname, "/.", handler))) {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("findmodule(%O) => got object %O\n", fullname, o);    return fc[fullname]=o;    }    - #if constant(load_module) -  if(master_file_stat(fakeroot(fullname+".so"))) { -  o = fc[fullname] = low_cast_to_object(fullname, "/.", handler); -  DEC_RESOLV_MSG_DEPTH(); -  resolv_debug ("findmodule(%O) => got .so object %O\n", fullname, o); -  return o; -  } - #endif -  +     if (programp (o = low_cast_to_program(fullname, "/.", handler))) {    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("findmodule(%O) => got .pike program %O\n", fullname, o);