Branch: Tag:

2016-07-08

2016-07-08 14:35:01 by Martin Nilsson <nilsson@fastmail.com>

Implement ->= in dirnode and joinnode. Symbols still leak from nodes to the module, but fixing that requires a rewrite.

1918:       // Maps a base name like "Bar" to an ordered array of file paths,    // e.g. ({ "/lib/Foo.pmod/Bar.pmod", "/lib/Foo.pmod/Bar.so" }). -  mapping(string:array(string)) file_paths = ([]); +  protected mapping(string:array(string)) file_paths = ([]);      #ifdef __NT__   #define FIX_CASE(X) lower_case(X)
2181:    error("No such variable (%s) in object.\n", index);    }    +  protected mixed `->=(string index, mixed value) +  { +  return `[]=(index, value); +  } +     protected mixed `[](string index)    {    mixed ret;
2218:    return ret;    }    -  mixed safe_index(string index) +  protected mixed `->(string index)    { -  +  if( (< "is_resolv_dirnode", "module", "cache" >)[index] ) +  return ::`->(index); +  return `[](index); +  } +  +  protected mixed safe_index(string index) +  {    mixed err;    resolv_debug ("dirnode(%O): %O...\n", dirname, index);    if (err = catch { return `[](index); }) {
2232:    }       protected int(0..1) _cache_full; -  void fill_cache() +  protected void fill_cache()    {    if (_cache_full) {    return;
2417:    error("No such variable (%s) in object.\n", index);    }    +  protected mixed `->=(string index, mixed value) +  { +  return `[]=(index, value); +  } +     protected mixed `[](string index)    {    mixed ret;
2440:    return ret;    }    +  protected mixed `->(string index) +  { +  if( (< "is_resolv_joinnode", "cache", "add_path", "rem_path", +  "delete_value", "_encode", "_decode" >)[index] ) +  return ::`->(index); +  return `[](index); +  } +     protected int _cache_full;    -  void fill_cache() +  protected void fill_cache()    { - #if 0 -  werror(call_describe_backtrace(({ "Filling cache in joinnode\n", -  backtrace() }))); - #endif +     if (_cache_full) {    return;    }