Some operand work for right. Needs work.

This commit is contained in:
barant 2025-01-09 17:11:15 -08:00
parent 3f4ca13f3f
commit 6516aee6cc
6 changed files with 29 additions and 3 deletions

View File

@ -64,7 +64,20 @@ namespace jet {
} else } else
throw coreutils::Exception("Expecting ) at end of EXPR expression."); throw coreutils::Exception("Expecting ) at end of EXPR expression.");
} else if(in.ifNextIgnoreCase("RIGHT")) { } else if(in.ifNextIgnoreCase("RIGHT")) {
if(!in.ifNext("("))
throw coreutils::Exception("Expecting ( for RIGHT parameters.");
Operand parm1(in, tag);
if(!in.ifNext(","))
throw coreutils::Exception("Expecting , in RIGHT expression.");
Operand parm2(in, tag);
if(in.ifNext(")")) {
int len = parm1.string.getLength();
int start = len - parm2.string.asInteger();
std::cout << "len: " << len << "; start: " << start << ";" << std::endl;
string = parm1.string.substring(0, parm2.string.asInteger());
std::cout << "string: " << string << std::endl;
} else
throw coreutils::Exception("Expecting ) at end of RIGHT expression.");
} else if(in.ifNextIgnoreCase("TRIM")) { } else if(in.ifNextIgnoreCase("TRIM")) {
} else if(in.ifNextIgnoreCase("TOUPPER")) { } else if(in.ifNextIgnoreCase("TOUPPER")) {

View File

@ -4,3 +4,10 @@
3) Create a method to upload a file directly to a file name to bypass 3) Create a method to upload a file directly to a file name to bypass
buffering on large files. buffering on large files.
4) Allow the cookie tag only if CGI mode selected. 4) Allow the cookie tag only if CGI mode selected.
5) Call tag is acting wierd. Look at testcall.jet.
6) Create a tag for uploading of URL data to a specific file instead
of buffering in an internal variable. Use <upload />. See testcgi.jet
7) For CGI image and other mime type fields you should be able to get
file name and content length from variable. $[data(filename)] and
$[data(length)] possibly.
8)

View File

@ -5,4 +5,7 @@
test1=$[test1] test1=$[test1]
name1=$[%name1] name1=$[%name1]
error=$[error] error=$[error]
<call error="rc" pgm="/usr/bin/ls" arg1="-al" />
$[rc]
</jet> </jet>

View File

@ -6,4 +6,6 @@ $[test2]=10
<set name="numbers">0123456789</set> <set name="numbers">0123456789</set>
<set name="lefty" expr="left($[numbers],5)" /> <set name="lefty" expr="left($[numbers],5)" />
$[lefty]=01234 $[lefty]=01234
<set name="righty" expr="right($[numbers],5)" />
$[righty]=56789
</jet> </jet>

View File

@ -40,9 +40,9 @@
<set name="noeval" eval="no">this is the value store in $[%name1].</set> <set name="noeval" eval="no">this is the value store in $[%name1].</set>
<set name="thename" eval="yes">this is the value store in $[%name1].</set> <set name="thename" eval="yes">this is the value store in $[%name1].</set>
<set name="newname" scope="global">another container value</set> <set name="newname" scope="global">another container value</set>
<comment><include file="./testinclude.jet" /> <include file="./testinclude.jet" />
include: $[include] include: $[include]
localvar='#[localvar]'</comment> localvar='#[localvar]'
>>>$[noeval]<<< >>>$[noeval]<<<
>>>$[thename]<<< >>>$[thename]<<<
<set name="iz" value="data" /> <set name="iz" value="data" />

View File

@ -1,4 +1,5 @@
#!../jet-2.0 #!../jet-2.0
<upload name="imagefiledata" path="images/%name" />
<jet cgi="true"> <jet cgi="true">
$[:name] $[:name]
$[:name:1] $[:name:1]