From 3f4ca13f3f4cda940f09b9a74b3a5131bbc38af1 Mon Sep 17 00:00:00 2001 From: barant Date: Thu, 9 Jan 2025 13:57:12 -0800 Subject: [PATCH] fixed call tag completely. Should be done for now. --- Tag.cpp | 6 ++++++ __call.cpp | 6 ++++-- tests/testcall.jet | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Tag.cpp b/Tag.cpp index 0feb989..cb96be6 100644 --- a/Tag.cpp +++ b/Tag.cpp @@ -443,6 +443,12 @@ namespace jet { } void Tag::storeVariable(coreutils::ZString variable, coreutils::MString value, coreutils::ZString scope) { + if((scope == "global") || (scope == "")) + global.variables[variable] = value; + else if(scope == "local") + local->variables[variable] = value; + else if(scope == "parent") + local->parent->variables[variable] = value; } void Tag::storeVariable(coreutils::ZString variable) { diff --git a/__call.cpp b/__call.cpp index 5f6c235..a9ecdf1 100644 --- a/__call.cpp +++ b/__call.cpp @@ -31,7 +31,7 @@ namespace jet { close(fdo[0]); dup2(fdo[1], 1); if(keywordDefined("input")) { - coreutils::ZString input(resolveKeyword("input")); + coreutils::MString input(resolveKeyword("input")); pipe(fdi); if(fork() == 0) { close(fdi[0]); @@ -48,7 +48,9 @@ namespace jet { } close(fdo[1]); if(keywordDefined("name")) { - storeVariable(resolveKeyword("name")); + coreutils::MString value; + value.read(fdo[0]); + storeVariable(resolveKeyword("name"), value, resolveKeyword("scope")); } else out.read(fdo[0]); waitpid(pid, &status, 0); diff --git a/tests/testcall.jet b/tests/testcall.jet index be1f8bb..1cd8fb0 100755 --- a/tests/testcall.jet +++ b/tests/testcall.jet @@ -3,6 +3,6 @@ test1=$[test1] -name1=#[localname] +name1=$[%name1] error=$[error]