diff options
Diffstat (limited to 'stdlib.rip')
-rw-r--r-- | stdlib.rip | 120 |
1 files changed, 104 insertions, 16 deletions
@@ -40,20 +40,108 @@ F<mkstr>[ P ] -0I[ - a b 256 - a b 256 256 - a 256 b 256 - a 256 256 b - a 256 256 b b - a 256 b b 256 - a 256 b b%ff - 256 b b%ff a - 256 b newa - newa 256 b - newa b 256 - newa b 256 256 - newa 256 b 256 - newa 256 newb - newa newb 256 + +0I[initialises variable store at beginning of stack (no args) (CALL ONLY ONCE)] +F<varinit>[ + 0lr 0lr 0lr 0I[guard] +] + +0I[INTERNAL FUNCTION + hauls variable by name in argument to top of stack; pushes 0 0 if non-existent] +F<varhaulup>[ + 00 0I[guard] + lRlR + SD3rW[ + 0I['s't'a'r't' 'w'h'i'l'e 9i 93a<mkstr><strprint>] + SD3r + 6R 0I[get target varname up] + D5r + EDI[P + 0I['e'q'u'a'l'! 9i 7<mkstr><strprint>] + D3r + 4RD5rW[ + 4r4rlrlr + 4RD5r] + 3RP3RP + 0 0I[to stop while loop] + 1 0I[to prevent taking of the else branch] + ] + nI[ + 0I['u'n'e'q'u'a'l'! 9i 9<mkstr><strprint>] + lRlR 0I[get next one] + SD3r 0I[get name up; if zero, then while loop should stop: end of var list] + ] + ] + 0I['d'o'n'e' 'w'i't'h' 'w'h'i'l'e 9i 79a<mkstr><strprint>] + SD3rnI[ + 0I['i's' 'z'e'r'o 9i 8<mkstr><strprint>] + lrlr3RP + SD3rW[ + lrlr + SD3r] + ] + 0I['d'o'n'e' 'w'i't'h' 'v'a'r'h'a'u'l'u'p 9i 99aii<mkstr><strprint>] +] + +0I[pushes whether specified variable exists in store] +F<varexists>[ + <varhaulup> + Pnn +] + +0I[deletes variable given by argument from store] +F<vardel>[ + 00 0I[guard] + lRlR + SD3rW[ + 0I['s't'a'r't' 'w'h'i'l'e 9i 93a<mkstr><strprint>] + SD3r + 6R 0I[get target varname up] + D5r + EDI[P + 0I['e'q'u'a'l'! 9i 7<mkstr><strprint>] + PPP + SD3rW[ + lrlr + SD3r] + PP + 1 0I[did find the thing] + 0 0I[to stop while loop] + 1 0I[to prevent taking of the else branch] + ] + nI[ + 0I['u'n'e'q'u'a'l'! 9i 9<mkstr><strprint>] + lRlR 0I[get next one] + SD3r 0I[get name up; if zero, then while loop should stop: end of var list] + ] + ] + 0I['d'o'n'e' 'w'i't'h' 'w'h'i'l'e 9i 79a<mkstr><strprint>] + nI[ + 0I['i's' 'z'e'r'o 9i 8<mkstr><strprint>] + 0lrlr3RP + SD3rW[ + lrlr + SD3r] + PP + ] + 0I['d'o'n'e' 'w'i't'h' 'v'a'r'd'e'l 9i 89a<mkstr><strprint>] +] + +0I[takes variable name (string) and value to store] +F<varstore>[ + 0I['s't'o'r'i'n'g' 8<mkstr><strprint> + O + ' 'i'n' 4<mkstr><strprint> + <strprint> + 9io + ] + + SD<vardel> + Slrlr +] + +0I[takes variable name (string) and pushes its value] +F<varget>[ + <varhaulup> + SP ] |