From 6516aee6cc833132926badd3cbe3c11452462267 Mon Sep 17 00:00:00 2001 From: barant Date: Thu, 9 Jan 2025 17:11:15 -0800 Subject: [PATCH] Some operand work for right. Needs work. --- Operand.cpp | 15 ++++++++++++++- TODO.txt | 7 +++++++ tests/testcall.jet | 3 +++ tests/testexpr.jet | 2 ++ tests/testjet.jet | 4 ++-- tests/testpost.jet | 1 + 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Operand.cpp b/Operand.cpp index 0523861..95e89d5 100644 --- a/Operand.cpp +++ b/Operand.cpp @@ -64,7 +64,20 @@ namespace jet { } else throw coreutils::Exception("Expecting ) at end of EXPR expression."); } 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("TOUPPER")) { diff --git a/TODO.txt b/TODO.txt index 7dec809..9014ad7 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,3 +4,10 @@ 3) Create a method to upload a file directly to a file name to bypass buffering on large files. 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 . 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) diff --git a/tests/testcall.jet b/tests/testcall.jet index 1cd8fb0..3ef97fc 100755 --- a/tests/testcall.jet +++ b/tests/testcall.jet @@ -5,4 +5,7 @@ test1=$[test1] name1=$[%name1] error=$[error] + +$[rc] + diff --git a/tests/testexpr.jet b/tests/testexpr.jet index 879b35d..3ef780f 100755 --- a/tests/testexpr.jet +++ b/tests/testexpr.jet @@ -6,4 +6,6 @@ $[test2]=10 0123456789 $[lefty]=01234 + +$[righty]=56789 diff --git a/tests/testjet.jet b/tests/testjet.jet index 96c6e86..30ed941 100755 --- a/tests/testjet.jet +++ b/tests/testjet.jet @@ -40,9 +40,9 @@ this is the value store in $[%name1]. this is the value store in $[%name1]. another container value - + include: $[include] - localvar='#[localvar]' + localvar='#[localvar]' >>>$[noeval]<<< >>>$[thename]<<< diff --git a/tests/testpost.jet b/tests/testpost.jet index a659d2b..b18ca64 100755 --- a/tests/testpost.jet +++ b/tests/testpost.jet @@ -1,4 +1,5 @@ #!../jet-2.0 + $[:name] $[:name:1]