1
0
Fork 0

nasal now returns constant and readable ghosttypes, so we do no longer

need the symbol table and comparison with the ghosttype of props._globals()
This commit is contained in:
mfranz 2008-11-13 12:00:23 +00:00
parent c6cd898f64
commit 81e967a609
2 changed files with 3 additions and 14 deletions

View file

@ -64,15 +64,13 @@ var _path = func(s) globals.string.color("36", s); # /some/property/
var _internal = func(s) globals.string.color("35", s); # me parents
var _varname = func(s) s; # variable_name
var ghosttypes = {};
##
# Turn p into props.Node (if it isn't yet), or return nil.
#
var propify = func(p, create = 0) {
var type = typeof(p);
if (type == "ghost" and ghosttype(p) == ghosttype(props.globals._g))
if (type == "ghost" and ghosttype(p) == "prop")
return props.wrapNode(p);
if (type == "scalar" and num(p) == nil)
return props.globals.getNode(p, create);
@ -217,10 +215,7 @@ var string = func(o) {
return _brace("{") ~ " " ~ s ~ " " ~ _brace("}");
} elsif (t == "ghost") {
var gt = ghosttype(o);
if (contains(ghosttypes, gt))
gt = ghosttypes[gt];
return _angle("<") ~ _nil(gt) ~ _angle(">");
return _angle("<") ~ _nil(ghosttype(o)) ~ _angle(">");
} else {
return _angle("<") ~ _vartype(t) ~ _angle(">");
@ -319,9 +314,3 @@ var printerror = func(err) {
}
_setlistener("/sim/signals/nasal-dir-initialized", func {
ghosttypes[ghosttype(props._globals())] = "PropertyNode";
ghosttypes[ghosttype(io.stderr)] = "FileHandle";
});

View file

@ -237,7 +237,7 @@ var nodeList = func {
list ~= nodeList(a[i]);
elsif(t == "func")
list ~= nodeList(a());
elsif(t == "ghost" and ghosttype(a) == ghosttype(_globals()))
elsif(t == "ghost" and ghosttype(a) == "prop")
append(list, wrapNode(a));
else
die("nodeList: invalid nil property");