From 4955f0f6a5505e251c85a0cc880fcd3d662e65e2 Mon Sep 17 00:00:00 2001 From: Laurent Huberdeau Date: Sun, 29 Sep 2024 23:30:48 -0400 Subject: [PATCH] Regenerate examples --- examples/compiled/all-chars.sh | 2 +- examples/compiled/base64.sh | 10 ++--- examples/compiled/c4.sh | 64 +++++++++++++++--------------- examples/compiled/cat.sh | 4 +- examples/compiled/cp.sh | 2 +- examples/compiled/echo.sh | 2 +- examples/compiled/fib.sh | 2 +- examples/compiled/non_zero.sh | 2 +- examples/compiled/print-reverse.sh | 6 +-- examples/compiled/repl.sh | 32 +++++++-------- examples/compiled/reverse.sh | 2 +- examples/compiled/select-file.sh | 8 ++-- examples/compiled/sha256sum.sh | 24 +++++------ examples/compiled/sum-array.sh | 6 +-- examples/compiled/wc-stdin.sh | 2 +- examples/compiled/wc.sh | 6 +-- examples/compiled/welcome.sh | 2 +- examples/compiled/winterpi.sh | 6 +-- 18 files changed, 91 insertions(+), 91 deletions(-) diff --git a/examples/compiled/all-chars.sh b/examples/compiled/all-chars.sh index 4b993753..0b3083d0 100755 --- a/examples/compiled/all-chars.sh +++ b/examples/compiled/all-chars.sh @@ -6,7 +6,7 @@ LC_ALL=C _main() { let c c=0 - while [ $c -lt 128 ] ; do + while [ $c -lt 128 ]; do printf \\$((c/64))$((c/8%8))$((c%8)) : $((c += 1)) done diff --git a/examples/compiled/base64.sh b/examples/compiled/base64.sh index e45ee2ee..bf91bb75 100755 --- a/examples/compiled/base64.sh +++ b/examples/compiled/base64.sh @@ -74,7 +74,7 @@ _codes=$__str_0 : $((b3 = b2 = b1 = 0)) _encode() { let b1; let b2; let b3 - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do _getchar b1 if [ $b1 -lt 0 ] ; then break @@ -107,7 +107,7 @@ defarr _lut 256 : $((__t1 = c = 0)) _get() { let c; let __t1 - while _getchar __t1; [ $((c = __t1)) -ge 0 ] ; do + while _getchar __t1; [ $((c = __t1)) -ge 0 ]; do if [ $((c = _$((_lut + c)))) -ge 0 ] ; then break fi @@ -120,16 +120,16 @@ _get() { _decode() { let i; let c1; let c2; let c3; let c4; let __t1 i=0 - while [ $i -lt 256 ] ; do + while [ $i -lt 256 ]; do : $((_$((_lut + i)) = -1)) : $((i += 1)) done i=0 - while [ $i -lt 64 ] ; do + while [ $i -lt 64 ]; do : $((_$((_lut + 255 & _$((_codes + i)))) = i)) : $((i += 1)) done - while _get __t1; [ $((c1 = __t1)) -ge 0 ] ; do + while _get __t1; [ $((c1 = __t1)) -ge 0 ]; do if _get __t1; [ $((c2 = __t1)) -lt 0 ] ; then exit 1 fi diff --git a/examples/compiled/c4.sh b/examples/compiled/c4.sh index 16fff17e..03f8cbaf 100755 --- a/examples/compiled/c4.sh +++ b/examples/compiled/c4.sh @@ -9,7 +9,7 @@ _memset() { # b: $2, c: $3, len: $4 c=$3 len=$4 p=$b - while [ $(((len -= 1) + 1)) != 0 ] ; do + while [ $(((len -= 1) + 1)) != 0 ]; do : $((_$(((p += 1) - 1)) = c)) done : $(($1 = b)) @@ -24,7 +24,7 @@ _memcmp() { # vl: $2, vr: $3, n: $4 n=$4 l=$vl r=$vr - while [ $n != 0 ] && [ $((_$l)) = $((_$r)) ] ; do + while [ $n != 0 ] && [ $((_$l)) = $((_$r)) ]; do : $((n -= 1)) : $((l += 1)) : $((r += 1)) @@ -143,13 +143,13 @@ readonly _Idsz=9 : $((__t1 = pp = 0)) _next() { set $@ $pp $__t1 - while [ $((_tk = _$_p)) != 0 ] ; do + while [ $((_tk = _$_p)) != 0 ]; do : $((_p += 1)) if [ $_tk = $__NEWLINE__ ] ; then if [ $_src != 0 ] ; then printf "%d: (%d - %d = %d) %.*s" $_line $_p $_lp $((_p - _lp)) $((_p - _lp)) "$(_put_pstr __ $_lp)" _lp=$_p - while [ $_le -lt $_e ] ; do + while [ $_le -lt $_e ]; do defstr __str_0 "LEA ,IMM ,JMP ,JSR ,BZ ,BNZ ,ENT ,ADJ ,LEV ,LI ,LC ,SI ,SC ,PSH ,OR ,XOR ,AND ,EQ ,NE ,LT ,GT ,LE ,GE ,SHL ,SHR ,ADD ,SUB ,MUL ,DIV ,MOD ,OPEN,READ,CLOS,PRTF,MALC,FREE,MSET,MCMP,EXIT," printf "%8.4s" "$(_put_pstr __ $((__str_0 + _$((_le += 1)) * 5)))" if [ $((_$_le)) -le $_ADJ ] ; then @@ -161,17 +161,17 @@ _next() { fi : $((_line += 1)) elif [ $_tk = $__SHARP__ ] ; then - while [ $((_$_p)) != 0 ] && [ $((_$_p)) != $__NEWLINE__ ] ; do + while [ $((_$_p)) != 0 ] && [ $((_$_p)) != $__NEWLINE__ ]; do : $((_p += 1)) done elif { [ $_tk -ge $__a__ ] && [ $_tk -le $__z__ ]; } || { [ $_tk -ge $__A__ ] && [ $_tk -le $__Z__ ]; } || [ $_tk = $__UNDERSCORE__ ] ; then pp=$((_p - 1)) - while { [ $((_$_p)) -ge $__a__ ] && [ $((_$_p)) -le $__z__ ]; } || { [ $((_$_p)) -ge $__A__ ] && [ $((_$_p)) -le $__Z__ ]; } || { [ $((_$_p)) -ge $__0__ ] && [ $((_$_p)) -le $__9__ ]; } || [ $((_$_p)) = $__UNDERSCORE__ ] ; do + while { [ $((_$_p)) -ge $__a__ ] && [ $((_$_p)) -le $__z__ ]; } || { [ $((_$_p)) -ge $__A__ ] && [ $((_$_p)) -le $__Z__ ]; } || { [ $((_$_p)) -ge $__0__ ] && [ $((_$_p)) -le $__9__ ]; } || [ $((_$_p)) = $__UNDERSCORE__ ]; do _tk=$(((_tk * 147) + _$(((_p += 1) - 1)))) done _tk=$(((_tk << 6) + (_p - pp))) _id=$_sym - while [ $((_$((_id + _Tk)))) != 0 ] ; do + while [ $((_$((_id + _Tk)))) != 0 ]; do if [ $_tk = $((_$((_id + _Hash)))) ] && { _memcmp __t1 $((_$((_id + _Name)))) $pp $((_p - pp)); [ $((!__t1)) != 0 ]; } ; then _tk=$((_$((_id + _Tk)))) : $((__tmp = $1)) $((pp = $2)) $((__t1 = $3)) $(($1 = __tmp)) @@ -185,15 +185,15 @@ _next() { break elif [ $_tk -ge $__0__ ] && [ $_tk -le $__9__ ] ; then if [ $((_ival = _tk - __0__)) != 0 ] ; then - while [ $((_$_p)) -ge $__0__ ] && [ $((_$_p)) -le $__9__ ] ; do + while [ $((_$_p)) -ge $__0__ ] && [ $((_$_p)) -le $__9__ ]; do _ival=$((((_ival * 10) + _$(((_p += 1) - 1))) - __0__)) done elif [ $((_$_p)) = $__x__ ] || [ $((_$_p)) = $__X__ ] ; then - while [ $((_tk = _$((_p += 1)))) != 0 ] && { { [ $_tk -ge $__0__ ] && [ $_tk -le $__9__ ]; } || { [ $_tk -ge $__a__ ] && [ $_tk -le $__f__ ]; } || { [ $_tk -ge $__A__ ] && [ $_tk -le $__F__ ]; }; } ; do + while [ $((_tk = _$((_p += 1)))) != 0 ] && { { [ $_tk -ge $__0__ ] && [ $_tk -le $__9__ ]; } || { [ $_tk -ge $__a__ ] && [ $_tk -le $__f__ ]; } || { [ $_tk -ge $__A__ ] && [ $_tk -le $__F__ ]; }; }; do _ival=$(((_ival * 16) + (_tk & 15) + ((_tk >= __A__) ? 9: 0))) done else - while [ $((_$_p)) -ge $__0__ ] && [ $((_$_p)) -le $__7__ ] ; do + while [ $((_$_p)) -ge $__0__ ] && [ $((_$_p)) -le $__7__ ]; do _ival=$((((_ival * 8) + _$(((_p += 1) - 1))) - __0__)) done fi @@ -202,7 +202,7 @@ _next() { elif [ $_tk = $__SLASH__ ] ; then if [ $((_$_p)) = $__SLASH__ ] ; then : $((_p += 1)) - while [ $((_$_p)) != 0 ] && [ $((_$_p)) != $__NEWLINE__ ] ; do + while [ $((_$_p)) != 0 ] && [ $((_$_p)) != $__NEWLINE__ ]; do : $((_p += 1)) done else @@ -211,7 +211,7 @@ _next() { fi elif [ $_tk = $__QUOTE__ ] || [ $_tk = $__DQUOTE__ ] ; then pp=$_data - while [ $((_$_p)) != 0 ] && [ $((_$_p)) != $_tk ] ; do + while [ $((_$_p)) != 0 ] && [ $((_$_p)) != $_tk ]; do if [ $((_ival = _$(((_p += 1) - 1)))) = $__BACKSLASH__ ] ; then if [ $((_ival = _$(((_p += 1) - 1)))) = $__n__ ] ; then _ival=$__NEWLINE__ @@ -334,7 +334,7 @@ _expr() { # lev: $2 : $((_$((_e += 1)) = _IMM)) : $((_$((_e += 1)) = _ival)) _next __ - while [ $_tk = $__DQUOTE__ ] ; do + while [ $_tk = $__DQUOTE__ ]; do _next __ done _data=$(((_data + 1) & -(1))) @@ -354,7 +354,7 @@ _expr() { # lev: $2 _next __ _ty=$_CHAR fi - while [ $_tk = $_Mul ] ; do + while [ $_tk = $_Mul ]; do _next __ _ty=$((_ty + _PTR)) done @@ -373,7 +373,7 @@ _expr() { # lev: $2 if [ $_tk = $__LPAREN__ ] ; then _next __ t=0 - while [ $_tk != $__RPAREN__ ] ; do + while [ $_tk != $__RPAREN__ ]; do _expr __ $_Assign : $((_$((_e += 1)) = _PSH)) : $((t += 1)) @@ -418,7 +418,7 @@ _expr() { # lev: $2 if [ $_tk = $_Int ] || [ $_tk = $_Char ] ; then t=$(((_tk == _Int) ? _INT: _CHAR)) _next __ - while [ $_tk = $_Mul ] ; do + while [ $_tk = $_Mul ]; do _next __ t=$((t + _PTR)) done @@ -515,7 +515,7 @@ _expr() { # lev: $2 printf "%d: bad expression\n" $_line exit -1 fi - while [ $_tk -ge $lev ] ; do + while [ $_tk -ge $lev ]; do t=$_ty if [ $_tk = $_Assign ] ; then _next __ @@ -787,7 +787,7 @@ _stmt() { fi elif [ $_tk = $__LBRACE__ ] ; then _next __ - while [ $_tk != $__RBRACE__ ] ; do + while [ $_tk != $__RBRACE__ ]; do _stmt __ done _next __ @@ -864,12 +864,12 @@ _main() { # argc: $2, argv: $3 defstr __str_1 "char else enum if int return sizeof while open read close printf malloc free memset memcmp exit void main" _p=$__str_1 i=$_Char - while [ $i -le $_While ] ; do + while [ $i -le $_While ]; do _next __ : $((_$((_id + _Tk)) = (i += 1) - 1)) done i=$_OPEN - while [ $i -le $_EXIT ] ; do + while [ $i -le $_EXIT ]; do _next __ : $((_$((_id + _Class)) = _Sys)) : $((_$((_id + _Type)) = _INT)) @@ -895,7 +895,7 @@ _main() { # argc: $2, argv: $3 _close __ $fd _line=1 _next __ - while [ $_tk != 0 ] ; do + while [ $_tk != 0 ]; do bt=$_INT if [ $_tk = $_Int ] ; then _next __ @@ -910,7 +910,7 @@ _main() { # argc: $2, argv: $3 if [ $_tk = $__LBRACE__ ] ; then _next __ i=0 - while [ $_tk != $__RBRACE__ ] ; do + while [ $_tk != $__RBRACE__ ]; do if [ $_tk != $_Id ] ; then printf "%d: bad enum identifier %d\n" $_line $_tk : $(($1 = -1)) @@ -939,9 +939,9 @@ _main() { # argc: $2, argv: $3 _next __ fi fi - while [ $_tk != $__SEMICOLON__ ] && [ $_tk != $__RBRACE__ ] ; do + while [ $_tk != $__SEMICOLON__ ] && [ $_tk != $__RBRACE__ ]; do ty=$bt - while [ $_tk = $_Mul ] ; do + while [ $_tk = $_Mul ]; do _next __ ty=$((ty + _PTR)) done @@ -964,7 +964,7 @@ _main() { # argc: $2, argv: $3 : $((_$((_id + _Val)) = (_e + 1))) _next __ i=0 - while [ $_tk != $__RPAREN__ ] ; do + while [ $_tk != $__RPAREN__ ]; do ty=$_INT if [ $_tk = $_Int ] ; then _next __ @@ -972,7 +972,7 @@ _main() { # argc: $2, argv: $3 _next __ ty=$_CHAR fi - while [ $_tk = $_Mul ] ; do + while [ $_tk = $_Mul ]; do _next __ ty=$((ty + _PTR)) done @@ -1008,12 +1008,12 @@ _main() { # argc: $2, argv: $3 fi _loc=$((i += 1)) _next __ - while [ $_tk = $_Int ] || [ $_tk = $_Char ] ; do + while [ $_tk = $_Int ] || [ $_tk = $_Char ]; do bt=$(((_tk == _Int) ? _INT: _CHAR)) _next __ - while [ $_tk != $__SEMICOLON__ ] ; do + while [ $_tk != $__SEMICOLON__ ]; do ty=$bt - while [ $_tk = $_Mul ] ; do + while [ $_tk = $_Mul ]; do _next __ ty=$((ty + _PTR)) done @@ -1044,12 +1044,12 @@ _main() { # argc: $2, argv: $3 done : $((_$((_e += 1)) = _ENT)) : $((_$((_e += 1)) = i - _loc)) - while [ $_tk != $__RBRACE__ ] ; do + while [ $_tk != $__RBRACE__ ]; do _stmt __ done : $((_$((_e += 1)) = _LEV)) _id=$_sym - while [ $((_$((_id + _Tk)))) != 0 ] ; do + while [ $((_$((_id + _Tk)))) != 0 ]; do if [ $((_$((_id + _Class)))) = $_Loc ] ; then : $((_$((_id + _Class)) = _$((_id + _HClass)))) : $((_$((_id + _Type)) = _$((_id + _HType)))) @@ -1087,7 +1087,7 @@ _main() { # argc: $2, argv: $3 : $((_$((sp -= 1)) = argv_)) : $((_$((sp -= 1)) = t)) cycle=0 - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do i=$((_$(((pc += 1) - 1)))) : $((cycle += 1)) if [ $_debug != 0 ] ; then diff --git a/examples/compiled/cat.sh b/examples/compiled/cat.sh index d1fb0448..68d01130 100755 --- a/examples/compiled/cat.sh +++ b/examples/compiled/cat.sh @@ -17,7 +17,7 @@ defarr _buf 1024 _cat_fd() { let fd $2 let n; let __t1 n=1024 - while [ $n = 1024 ] ; do + while [ $n = 1024 ]; do _read n $fd $_buf 1024 if [ $n -lt 0 ] || { _write __t1 1 $_buf $n; [ $__t1 != $n ]; } ; then exit 1 @@ -43,7 +43,7 @@ _main() { let argc $2; let myargv $3 let i if [ $argc -ge 2 ] ; then i=1 - while [ $i -lt $argc ] ; do + while [ $i -lt $argc ]; do if [ $((_$((_$((myargv + i)) + 0)))) = $__MINUS__ ] && [ $((_$((_$((myargv + i)) + 1)))) = $__NUL__ ] ; then _cat_fd __ 0 else diff --git a/examples/compiled/cp.sh b/examples/compiled/cp.sh index d0524c73..f8e28326 100755 --- a/examples/compiled/cp.sh +++ b/examples/compiled/cp.sh @@ -39,7 +39,7 @@ _main() { let argc $2; let args $3 if [ $dst = 0 ] ; then _file_error __ $((_$((args + 2)))) fi - while _read __t1 $src $_buffer 1024; [ $((len = __t1)) != 0 ] ; do + while _read __t1 $src $_buffer 1024; [ $((len = __t1)) != 0 ]; do _write __ $dst $_buffer $len done endlet $1 __t1 len c dst src args argc diff --git a/examples/compiled/echo.sh b/examples/compiled/echo.sh index be6d6196..432f525c 100755 --- a/examples/compiled/echo.sh +++ b/examples/compiled/echo.sh @@ -6,7 +6,7 @@ LC_ALL=C _main() { let argc $2; let argv_ $3 let i i=1 - while [ $i -lt $argc ] ; do + while [ $i -lt $argc ]; do _put_pstr __ $((_$((argv_ + i)))) printf " " : $((i += 1)) diff --git a/examples/compiled/fib.sh b/examples/compiled/fib.sh index b09886a9..6f1bb7b6 100755 --- a/examples/compiled/fib.sh +++ b/examples/compiled/fib.sh @@ -19,7 +19,7 @@ _fib() { let n $2 _main() { let n; let i i=0 - while [ $i -lt 20 ] ; do + while [ $i -lt 20 ]; do _fib n $i printf "fib(%d) = %d\n" $i $n : $((i += 1)) diff --git a/examples/compiled/non_zero.sh b/examples/compiled/non_zero.sh index 7c0ae482..e1abe4c9 100755 --- a/examples/compiled/non_zero.sh +++ b/examples/compiled/non_zero.sh @@ -9,7 +9,7 @@ _main() { while :; do printf "Enter a non-zero single-digit number:\r\n" _getchar n - while _getchar __t1; [ $__NEWLINE__ != $__t1 ] ; do + while _getchar __t1; [ $__NEWLINE__ != $__t1 ]; do : done [ $n = $__0__ ] || [ $((!((n >= __0__) && (n <= __9__)))) != 0 ]|| break diff --git a/examples/compiled/print-reverse.sh b/examples/compiled/print-reverse.sh index 5742e4e5..02a7f106 100755 --- a/examples/compiled/print-reverse.sh +++ b/examples/compiled/print-reverse.sh @@ -7,11 +7,11 @@ _reverse_str() { let str $2 let end; let tmp; let len; let i end=$str i=0 - while [ $((_$(((end += 1) - 1)))) != 0 ] ; do + while [ $((_$(((end += 1) - 1)))) != 0 ]; do : done len=$(((end - str) - 1)) - while [ $i -lt $((len / 2)) ] ; do + while [ $i -lt $((len / 2)) ]; do tmp=$((_$((str + i)))) : $((_$((str + i)) = _$((str + ((len - 1) - i))))) : $((_$((str + (len - 1) - i)) = tmp)) @@ -24,7 +24,7 @@ _reverse_str() { let str $2 _main() { let argc $2; let argv_ $3 let i i=1 - while [ $i -lt $argc ] ; do + while [ $i -lt $argc ]; do _reverse_str __ $((_$((argv_ + i)))) _put_pstr __ $i printf "\n" diff --git a/examples/compiled/repl.sh b/examples/compiled/repl.sh index 3fffbfa3..b4d589d3 100755 --- a/examples/compiled/repl.sh +++ b/examples/compiled/repl.sh @@ -192,7 +192,7 @@ _input=$__str_0 _putstr() { # s: $2 set $@ $s s=$2 - while [ $((_$s)) != 0 ] ; do + while [ $((_$s)) != 0 ]; do printf \\$(((_$s)/64))$(((_$s)/8%8))$(((_$s)%8)) : $(((s += 1) - 1)) done @@ -273,7 +273,7 @@ _gc() { _copy _pc $_pc _copy _FALSE $_FALSE _scan=$to_space - while [ $_scan != $_alloc ] ; do + while [ $_scan != $_alloc ]; do _copy _$_scan $((_$_scan)) : $(((_scan += 1) - 1)) done @@ -341,7 +341,7 @@ _list_tail() { # lst: $2, i: $3 set $@ $lst $i lst=$2 i=$3 - while [ $(((i -= 1) + 1)) != 0 ] ; do + while [ $(((i -= 1) + 1)) != 0 ]; do lst=$((_$((lst + __field1)))) done : $(($1 = lst)) @@ -353,7 +353,7 @@ _inst_tail() { # lst: $2, i: $3 set $@ $lst $i lst=$2 i=$3 - while [ $(((i -= 1) + 1)) != 0 ] ; do + while [ $(((i -= 1) + 1)) != 0 ]; do lst=$((_$((lst + __field2)))) done : $(($1 = lst)) @@ -388,7 +388,7 @@ _get_opnd() { # o: $2 _get_cont() { set $@ $s s=$_stack - while [ $((!(_$((s + __field2)) >> 1))) != 0 ] ; do + while [ $((!(_$((s + __field2)) >> 1))) != 0 ]; do s=$((_$((s + __field1)))) done : $(($1 = s)) @@ -400,7 +400,7 @@ _lst_length() { # list: $2 set $@ $list $l list=$2 l=0 - while [ $((!(list & 1))) != 0 ] && [ $((_$((list + __field2)) >> 1)) = 0 ] ; do + while [ $((!(list & 1))) != 0 ] && [ $((_$((list + __field2)) >> 1)) = 0 ]; do : $((l += 1)) list=$((_$((list + __field1)))) done @@ -461,13 +461,13 @@ _create_sym() { # name: $2 _build_sym_table() { set $@ $n $accum $c $__t1 _get_int n 0 - while [ $n -gt 0 ] ; do + while [ $n -gt 0 ]; do : $(((n -= 1) + 1)) _create_sym __t1 $((_$((_FALSE + __field1)))) _symbol_table=$__t1 done accum=$((_$((_FALSE + __field1)))) - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do _get_byte c if [ $c = 44 ] ; then _create_sym __t1 $accum @@ -510,11 +510,11 @@ _init_weights() { : $((__t1 = c = x = op = d = n = 0)) _decode() { set $@ $n $d $op $x $c $__t1 - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do _get_code x n=$x op=-1 - while [ $n -gt $((2 + (d = _$((_weights + (op += 1)))))) ] ; do + while [ $n -gt $((2 + (d = _$((_weights + (op += 1)))))) ]; do : $((n -= (d + 3))) done if [ $x -gt 90 ] ; then @@ -573,7 +573,7 @@ _scm2str() { # s: $2 current=$((_$((s + __field0)))) _malloc str $((length + 1)) i=0 - while [ $i -lt $length ] ; do + while [ $i -lt $length ]; do : $((_$((str + i)) = (_$((current + __field0)) >> 1))) current=$((_$((current + __field1)))) : $(((i += 1) - 1)) @@ -661,7 +661,7 @@ _prim() { # no: $2 num_args=0 : $((_$((_$((_FALSE + __field0)) + __field0)) = x)) arg=$y - while [ $arg != $((_$((_FALSE + __field1)))) ] ; do + while [ $arg != $((_$((_FALSE + __field1)))) ]; do _push2 __ $arg $(((0 << 1) | 1)) arg=$((_$((_stack + __field0)))) : $((_$((_stack + __field0)) = _$((arg + __field0)))) @@ -756,14 +756,14 @@ _prim() { # no: $2 : $((__t1 = opnd = x = p = rest = new_pc = k = c2 = s2 = proc = jump = vari = nparams = nparams_vari = nargs = instr = i = 0)) _run() { set $@ $i $instr $nargs $nparams_vari $nparams $vari $jump $proc $s2 $c2 $k $new_pc $rest $p $x $opnd $__t1 - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do instr=$((_$((_pc + __field0)) >> 1)) if [ $instr = 5 ] ; then exit 0 elif [ $instr = 0 ] ; then jump=$((_$((_pc + __field2)) == ((0 << 1) | 1))) _get_opnd proc $((_$((_pc + __field1)))) - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do if [ $((_$((proc + __field0)) & 1)) != 0 ] ; then _pop __ _prim proc $((_$((proc + __field0)) >> 1)) @@ -793,7 +793,7 @@ _run() { if [ $vari != 0 ] ; then rest=$((_$((_FALSE + __field1)))) i=0 - while [ $i -lt $nargs ] ; do + while [ $i -lt $nargs ]; do _pop __t1 _alloc_rib __t1 $__t1 $rest $s2 rest=$__t1 @@ -805,7 +805,7 @@ _run() { s2=$__t1 fi i=0 - while [ $i -lt $nparams ] ; do + while [ $i -lt $nparams ]; do _pop __t1 _alloc_rib __t1 $__t1 $s2 $(((0 << 1) | 1)) s2=$__t1 diff --git a/examples/compiled/reverse.sh b/examples/compiled/reverse.sh index 1565b7b1..1714d841 100755 --- a/examples/compiled/reverse.sh +++ b/examples/compiled/reverse.sh @@ -6,7 +6,7 @@ LC_ALL=C _main() { let argc $2; let argv_ $3 let i i=1 - while [ $i -lt $argc ] ; do + while [ $i -lt $argc ]; do _put_pstr __ $((_$((argv_ + (argc - i))))) printf " " : $((i += 1)) diff --git a/examples/compiled/select-file.sh b/examples/compiled/select-file.sh index 04db17b9..9f51bd9c 100755 --- a/examples/compiled/select-file.sh +++ b/examples/compiled/select-file.sh @@ -150,7 +150,7 @@ _wc() { # $2 = file (char*), $3 = lines addr (int*), $4 = words addr (int*), $5 _print_array() { let arr $2 let i i=0 - while [ $((_$((arr + i)))) != 0 ] ; do + while [ $((_$((arr + i)))) != 0 ]; do printf "%d: " $i _put_pstr __ $((_$((arr + i)))) printf "\n" $i @@ -163,7 +163,7 @@ _print_array() { let arr $2 _array_len() { let arr $2 let i i=0 - while [ $((_$((arr + i)))) != 0 ] ; do + while [ $((_$((arr + i)))) != 0 ]; do : $((i += 1)) done : $(($1 = i)) @@ -174,7 +174,7 @@ _array_len() { let arr $2 _read_int() { let n; let c n=0 - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do _getchar c if [ $c -ge $__0__ ] && [ $c -le $__9__ ] ; then n=$((((10 * n) + c) - __0__)) @@ -196,7 +196,7 @@ _main() { _ls files _array_len len $files _print_array __ $files - while [ 1 != 0 ] ; do + while [ 1 != 0 ]; do printf "Select a file to print: " _read_int ix if [ 0 -le $ix ] && [ $ix -lt $len ] ; then diff --git a/examples/compiled/sha256sum.sh b/examples/compiled/sha256sum.sh index 9f4b9d55..087a9359 100755 --- a/examples/compiled/sha256sum.sh +++ b/examples/compiled/sha256sum.sh @@ -100,7 +100,7 @@ _sha256_init() { _sha256_add_block() { let bytes $2 let b0; let b1; let b2; let b3; let s0; let s1; let i; let ch; let t1; let ma; let t2 i=0 - while [ $i -lt 16 ] ; do + while [ $i -lt 16 ]; do b0=$((255 & _$((bytes + (i * 4))))) b1=$((255 & _$((bytes + (i * 4) + 1)))) b2=$((255 & _$((bytes + (i * 4) + 2)))) @@ -109,19 +109,19 @@ _sha256_add_block() { let bytes $2 : $((i += 1)) done i=16 - while [ $i -lt 64 ] ; do + while [ $i -lt 64 ]; do s0=$(((((_$((_w + (i - 15))) >> 7) & (2147483647 >> (7 - 1))) | ((_$((_w + (i - 15))) << (32 - 7)) & -1)) ^ (((_$((_w + (i - 15))) >> 18) & (2147483647 >> (18 - 1))) | ((_$((_w + (i - 15))) << (32 - 18)) & -1)) ^ ((_$((_w + (i - 15))) >> 3) & 536870911))) s1=$(((((_$((_w + (i - 2))) >> 17) & (2147483647 >> (17 - 1))) | ((_$((_w + (i - 2))) << (32 - 17)) & -1)) ^ (((_$((_w + (i - 2))) >> 19) & (2147483647 >> (19 - 1))) | ((_$((_w + (i - 2))) << (32 - 19)) & -1)) ^ ((_$((_w + (i - 2))) >> 10) & 4194303))) : $((_$((_w + i)) = (_$((_w + (i - 16))) + s0 + _$((_w + (i - 7))) + s1) & -1)) : $((i += 1)) done i=0 - while [ $i -lt 8 ] ; do + while [ $i -lt 8 ]; do : $((_$((_temp + i)) = _$((_hash + i)))) : $((i += 1)) done i=0 - while [ $i -lt 64 ] ; do + while [ $i -lt 64 ]; do s1=$(((((_$((_temp + 4)) >> 6) & (2147483647 >> (6 - 1))) | ((_$((_temp + 4)) << (32 - 6)) & -1)) ^ (((_$((_temp + 4)) >> 11) & (2147483647 >> (11 - 1))) | ((_$((_temp + 4)) << (32 - 11)) & -1)) ^ (((_$((_temp + 4)) >> 25) & (2147483647 >> (25 - 1))) | ((_$((_temp + 4)) << (32 - 25)) & -1)))) ch=$(((_$((_temp + 4)) & _$((_temp + 5))) ^ (~(_$((_temp + 4))) & _$((_temp + 6))))) t1=$(((_$((_temp + 7)) + s1 + ch + _$((_k + i)) + _$((_w + i))) & -1)) @@ -139,7 +139,7 @@ _sha256_add_block() { let bytes $2 : $((i += 1)) done i=0 - while [ $i -lt 8 ] ; do + while [ $i -lt 8 ]; do : $((_$((_hash + i)) = (_$((_hash + i)) + _$((_temp + i))) & -1)) : $((i += 1)) done @@ -164,7 +164,7 @@ _process_file() { let filename $2 _sha256_setup __ _sha256_init __ _open fd $filename 0 - while [ $n = 64 ] ; do + while [ $n = 64 ]; do _read n $fd $_buf 64 if [ $n -lt 0 ] ; then : $(($1 = 1)) @@ -175,20 +175,20 @@ _process_file() { let filename $2 if [ $n -lt 64 ] ; then : $((_$((_buf + n)) = 128)) i=$((n + 1)) - while [ $i -lt 64 ] ; do + while [ $i -lt 64 ]; do : $((_$((_buf + i)) = 0)) : $((i += 1)) done if [ $n -ge $((64 - 9)) ] ; then _sha256_add_block __ $_buf i=0 - while [ $i -lt $((64 - 8)) ] ; do + while [ $i -lt $((64 - 8)) ]; do : $((_$((_buf + i)) = 0)) : $((i += 1)) done fi i=1 - while [ $i -le 8 ] ; do + while [ $i -le 8 ]; do : $((_$((_buf + 64 - i)) = 255 & _nbits)) : $((_nbits >>= 8)) : $((i += 1)) @@ -198,7 +198,7 @@ _process_file() { let filename $2 done _close __ $fd i=0 - while [ $i -lt 8 ] ; do + while [ $i -lt 8 ]; do h=$((_$((_hash + i)))) _hex __ $((h >> 24)) _hex __ $((h >> 16)) @@ -208,7 +208,7 @@ _process_file() { let filename $2 done printf \\$(((__SPACE__)/64))$(((__SPACE__)/8%8))$(((__SPACE__)%8)) printf \\$(((__SPACE__)/64))$(((__SPACE__)/8%8))$(((__SPACE__)%8)) - while [ $((_$filename)) != 0 ] ; do + while [ $((_$filename)) != 0 ]; do printf \\$(((_$filename)/64))$(((_$filename)/8%8))$(((_$filename)%8)) : $((filename += 1)) done @@ -221,7 +221,7 @@ _process_file() { let filename $2 _main() { let argc $2; let myargv $3 let i; let __t1 i=1 - while [ $i -lt $argc ] ; do + while [ $i -lt $argc ]; do if _process_file __t1 $((_$((myargv + i)))); [ $__t1 != 0 ] ; then break fi diff --git a/examples/compiled/sum-array.sh b/examples/compiled/sum-array.sh index 85f97fc9..38af17b8 100755 --- a/examples/compiled/sum-array.sh +++ b/examples/compiled/sum-array.sh @@ -7,7 +7,7 @@ _sum_array() { let n $2; let size $3 let i; let sum i=0 sum=0 - while [ $i -lt $size ] ; do + while [ $i -lt $size ]; do : $((sum += _$((n + i)))) : $(((i += 1) - 1)) done @@ -21,12 +21,12 @@ _main() { _malloc n 10000 i=0 sum=0 - while [ $i -lt 10000 ] ; do + while [ $i -lt 10000 ]; do : $((_$((n + i)) = i)) : $(((i += 1) - 1)) done i=0 - while [ $i -lt 10000 ] ; do + while [ $i -lt 10000 ]; do : $((sum += _$((n + i)))) : $(((i += 1) - 1)) done diff --git a/examples/compiled/wc-stdin.sh b/examples/compiled/wc-stdin.sh index 5e2dfc75..aac8f720 100755 --- a/examples/compiled/wc-stdin.sh +++ b/examples/compiled/wc-stdin.sh @@ -16,7 +16,7 @@ _main() { chars=0 sep=0 last_sep=0 - while _getchar __t1; [ $((c = __t1)) != -1 ] ; do + while _getchar __t1; [ $((c = __t1)) != -1 ]; do : $((chars += 1)) if [ $c = $__NEWLINE__ ] ; then : $((lines += 1)) diff --git a/examples/compiled/wc.sh b/examples/compiled/wc.sh index d6106228..3f0b6270 100755 --- a/examples/compiled/wc.sh +++ b/examples/compiled/wc.sh @@ -28,10 +28,10 @@ _wc_fd() { let fd $2; let filename $3 sep=0 last_sep=0 n=1024 - while [ $n = 1024 ] ; do + while [ $n = 1024 ]; do _read n $fd $_buf 1024 i=0 - while [ $i -lt $n ] ; do + while [ $i -lt $n ]; do : $((chars += 1)) if [ $((_$((_buf + i)))) = $__NEWLINE__ ] ; then : $((lines += 1)) @@ -71,7 +71,7 @@ _main() { let argc $2; let argv_ $3 let i if [ $argc -ge 2 ] ; then i=1 - while [ $i -lt $argc ] ; do + while [ $i -lt $argc ]; do _wc_file __ $((_$((argv_ + i)))) : $((i += 1)) done diff --git a/examples/compiled/welcome.sh b/examples/compiled/welcome.sh index 0ffb86a8..5a7e93fd 100755 --- a/examples/compiled/welcome.sh +++ b/examples/compiled/welcome.sh @@ -8,7 +8,7 @@ _main() { _malloc name 100 i=0 printf "What is your name?\n" - while { _getchar __t1; [ $((_$((name + i)) = __t1)) != -1 ]; } && [ $((_$((name + i)))) != $__NEWLINE__ ] ; do + while { _getchar __t1; [ $((_$((name + i)) = __t1)) != -1 ]; } && [ $((_$((name + i)))) != $__NEWLINE__ ]; do : $((i += 1)) done : $((_$((name + i)) = __NUL__)) diff --git a/examples/compiled/winterpi.sh b/examples/compiled/winterpi.sh index 74521fb6..d1eec710 100755 --- a/examples/compiled/winterpi.sh +++ b/examples/compiled/winterpi.sh @@ -18,16 +18,16 @@ _main() { let i; let k; let b; let d; let c c=0 i=0 - while [ $i -lt 2800 ] ; do + while [ $i -lt 2800 ]; do : $((_$((_r + i)) = 2000)) i=$((i + 1)) done : $((_$((_r + i)) = 0)) k=2800 - while [ $k -gt 0 ] ; do + while [ $k -gt 0 ]; do d=0 i=$k - while [ $i -gt 0 ] ; do + while [ $i -gt 0 ]; do d=$((d * i)) d=$((d + (_$((_r + i)) * 10000))) b=$(((2 * i) - 1))