Moved keywords from local variables to keywords map.
This commit is contained in:
1 parent
907f449ecc
commit
9622b5cf8c
23 files changed
+221
-220
No files matched your search
+14
-14
@@ -12,18 +12,18 @@ namespace jet {
|
||||
__call::__call(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, local) {
|
||||
if(hasContainer)
|
||||
throw coreutils::Exception("call tag cannot have a container.");
|
||||
if(!variableDefined("pgm"))
|
||||
if(!keywordDefined("pgm"))
|
||||
throw coreutils::Exception("pgm keyword must be specified.");
|
||||
resolveKeyword("pgm");
|
||||
for(ix = 0; ix <= 50; ++ix)
|
||||
argv[ix] = NULL;
|
||||
argv[0] = variables["pgm"].c_str(); // TODO: Need to peel off the program name only and pass as argv[0].
|
||||
argv[0] = keywords["pgm"].c_str(); // TODO: Need to peel off the program name only and pass as argv[0].
|
||||
for(ix = 1; ix <= 50; ++ix) {
|
||||
coreutils::MString arg("arg");
|
||||
arg << ix;
|
||||
if(variableDefined(arg)) {
|
||||
if(keywordDefined(arg)) {
|
||||
resolveKeyword(arg);
|
||||
argv[ix] = variables[arg].c_str();
|
||||
argv[ix] = keywords[arg].c_str();
|
||||
} else
|
||||
break;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ namespace jet {
|
||||
if(pid == 0) {
|
||||
close(fdo[0]);
|
||||
dup2(fdo[1], 1);
|
||||
if(variableDefined("input")) {
|
||||
if(keywordDefined("input")) {
|
||||
resolveKeyword("input");
|
||||
coreutils::ZString input(variables["input"]);
|
||||
pipe(fdi);
|
||||
@@ -50,23 +50,23 @@ namespace jet {
|
||||
exit(errno);
|
||||
}
|
||||
close(fdo[1]);
|
||||
if(variableDefined("name")) {
|
||||
if(keywordDefined("name")) {
|
||||
resolveKeyword("name");
|
||||
if(!variableDefined("scope") || (variables["scope"] == "global"))
|
||||
global.variables[variables["name"]].read(fdo[0]);
|
||||
else if(variables["scope"] == "local")
|
||||
this->local->variables[variables["name"]].read(fdo[0]);
|
||||
else if(variables["scope"] == "parent")
|
||||
this->local->parent->local->variables[variables["name"]].read(fdo[0]);
|
||||
if(!keywordDefined("scope") || (keywords["scope"] == "global"))
|
||||
global.variables[keywords["name"]].read(fdo[0]);
|
||||
else if(keywords["scope"] == "local")
|
||||
this->local->variables[keywords["name"]].read(fdo[0]);
|
||||
else if(keywords["scope"] == "parent")
|
||||
this->local->parent->local->variables[keywords["name"]].read(fdo[0]);
|
||||
else
|
||||
throw coreutils::Exception("scope value is not valid.");
|
||||
|
||||
} else
|
||||
out.read(fdo[0]);
|
||||
waitpid(pid, &status, 0);
|
||||
if(variableDefined("error")) {
|
||||
if(keywordDefined("error")) {
|
||||
resolveKeyword("error");
|
||||
global.variables[variables["error"]] = (status >> 8 & 255);
|
||||
global.variables[keywords["error"]] = (status >> 8 & 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user