Branch: Tag:

2008-05-14

2008-05-14 18:02:38 by Henrik Grubbström (Grubba) <grubba@grubba.org>

describe_{function,module,object,program}() now perform a reverse lookup in all_constants().
FIXME: This code probably ought to be optimized.

Rev: lib/master.pike.in:1.418

6:   // Pike is distributed under GPL, LGPL and MPL. See the file COPYING   // for more information.   // - // $Id: master.pike.in,v 1.417 2008/05/12 13:54:14 grubba Exp $ + // $Id: master.pike.in,v 1.418 2008/05/14 18:02:38 grubba Exp $      #pike __REAL_VERSION__   //#pragma strict_types
608:      mapping (program:object|NoValue) objects=([    this_program : this, -  object_program(_static_modules): _static_modules +  object_program(_static_modules): _static_modules,   ]);      mapping(string:object|NoValue) fc=([]);
3605:    return (objectp (objects[parent_fun]) && programs["/master"] != parent_fun?    res+".":res+"->");    }; +  string res = search(all_constants(), mod); +  if (res) return res;    }    if (!object_program(parent_fun)) {    // We might be a top-level entity.
3662:    string s;    if(zero_type (o)) return 0; // Destructed.    -  if (o == _static_modules) return "_static_modules"; +  // Handled by the search of all_constants() below. +  // if (o == _static_modules) return "_static_modules";       program|function(mixed...:void|object) parent_fun = object_program(o);   
3684:    }    }    }; +  if ((s = search(all_constants(), o))) return s;    // When running with RESOLV_DEBUG this function may    // get called before objects has been initialized.    if(objects && objectp (objects[parent_fun]))
3721:    if(s=Builtin.program_defined(p))    return BASENAME(s);    -  return 0; +  return search(all_constants(), p);   }      //!
3731:       string name;    +  if (name = search(all_constants(), f)) return name; +     if(string s = programs_reverse_lookup (f))    {    if(has_suffix(s, ".pmod"))