diff options
author | tomsmeding <hallo@tomsmeding.nl> | 2015-10-04 21:01:12 +0200 |
---|---|---|
committer | tomsmeding <hallo@tomsmeding.nl> | 2015-10-04 21:01:12 +0200 |
commit | 7ceeb20b0aebe0eac8aeb9140f491973756c32bd (patch) | |
tree | f0c8cd3566f8239e6b8021a24e40d69ba45c4f93 /ex | |
parent | 82958a1498b3e2b3c4498120b97ca3133f660b50 (diff) |
Numbers and strings to rip code, on stdout and in memory!
Diffstat (limited to 'ex')
-rw-r--r-- | ex/numfmt.rip | 72 | ||||
-rw-r--r-- | ex/str2rip.rip | 70 |
2 files changed, 142 insertions, 0 deletions
diff --git a/ex/numfmt.rip b/ex/numfmt.rip new file mode 100644 index 0000000..903c183 --- /dev/null +++ b/ex/numfmt.rip @@ -0,0 +1,72 @@ +F<printstr>[D0GW[SodD0G]P] + +0I[ + F<numfmt>[ + 0I[[value]] + D9i9aGI[ 0I[{if value>19}] + D9iqD3r9ims 0I[[quotient modulus]] + S 0I[[modulus quotient]] + <numfmt> 0I[[modulus "quotient" <quostrlen>]] + 455mm5aD4aS87mi 0I[[modulus "quotient" <quostrlen> 'm' 'i' '9']] + 4R 3a D 0I[[modulus "quotient" 'm' 'i' '9' <quostrlen+3> <quostrlen+3>]] + 5R S 0I[[modulus "quotient" 'i' '9' <quostrlen+3> 'm' <quostrlen+3>]] + i 0I[[modulus "quotient" 'i' '9' <quostrlen+3> 'm' <quostrlen+4>]] + r 0I[[modulus 'm' "quotient" 'i' '9' <quostrlen+3>] + [modulus 'm' "quotient" 'i' '9' <strlen>]] + DiiR 0I[['m' "quotient" 'i' '9' <strlen> modulus]] + D1GI[ 0I[{if modulus>1}] + <numfmt> 0I[['m' "quotient" 'i' '9' <strlen> "modulus" <modstrlen>]] + DiiR 0I[['m' "quotient" 'i' '9' "modulus" <modstrlen> <strlen>]] + a 0I[['m' "quotient" 'i' '9' "modulus" <strlen>]] + 99im7a S i 0I[['m' "quotient" 'i' '9' "modulus" 'a' <strlen+1>]] + D3r i 0I[['m' "quotient" 'i' '9' "modulus" <strlen+1> 'a' <strlen+2>]] + r 0I[['a' 'm' "quotient" 'i' '9' "modulus" <strlen+1>] + ['a' 'm' "quotient" 'i' '9' "modulus" <strlen>]] + 0d 0I[['a' 'm' "quotient" 'i' '9' "modulus" <strlen> -1]] + ] + D0GI[ 0I[{if modulus>0, so =1}] + P 9iDm5a S i 0I[['m' "quotient" 'i' '9' 'i' <strlen+1>]] + Di 0I[['m' "quotient" 'i' '9' 'i' <strlen+1> <strlen+2>]] + 3RS 0I[['m' "quotient" 'i' '9' <strlen+1> 'i' <strlen+2>]] + r 0I[['i' 'm' "quotient" 'i' '9' <strlen+1>] + ['i' 'm' "quotient" 'i' '9' <strlen>]] + 0d 0I[['i' 'm' "quotient" 'i' '9' <strlen> -1]] + ] + P0d 0I[["..." <strlen> -1]] + ] + D9GI[ 0I[{if value>9, so 10..19}] + 455mm5a87mi 2 0I[[value 'i' '9' 2]] + 4R 0I[['i' '9' 2 value]] + D92aGI[ 0I[{if value>11, so 12..19}] + SP 0I[['i' '9' value]] + 9is 0I[['i' '9' value-10]] + 68ma 0I[['i' '9' 'value-10']] + 99im7a 0I[['i' '9' 'value-10' 'a']] + 4r 4 0I[['a' 'i' '9' 'value-10' 4]] + 0d 0I[['a' 'i' '9' 'value-10' 4 -1]] + ] + D9iGI[ 0I[{if value>10, so =11}] + PP 0I[['i' '9']] + SD3R 0I[['i' 'i' '9']] + 3 0d 0I[['i' 'i' '9' 3 -1]] + ] + P0d 0I[["..." <strlen> -1]] + ] + D0dGI[ 0I[{if value>-1, so 0..9}] + 86ma 1 0I[['value' 1]] + 0d 0I[['value' 1 -1]] + ] + P + ] +] + + +F<numfmt>[D9i9aGI[D9iqD3r9imsS<numfmt>455mm5aD4aS87mi4R3aD5RSirDiiRD1GI[<numfmt>DiiRa99im7aSiD3rir0d]D0GI[P9iDm5aSiDi3RSr0d]P0d]D9GI[455mm5a87mi24RD92aGI[SP9is68ma99im7a4r40d]D9iGI[PPSD3R30d]P0d]D0dGI[86ma10d]P] + + +0 +1W[ + DO 84mo D<numfmt><printstr>9io + i +D9iDm2mL] +P diff --git a/ex/str2rip.rip b/ex/str2rip.rip new file mode 100644 index 0000000..1b5b369 --- /dev/null +++ b/ex/str2rip.rip @@ -0,0 +1,70 @@ +0I[ + F<reprnum>[ + 0I[[value]] + D9i9aGI[ 0I[{if value>19}] + D9iqD3r9ims 0I[[quotient modulus]] + S 0I[[modulus quotient]] + <reprnum> 0I[[modulus] -> "quotient"] + + 455mm5aD4aS87mi 0I[[modulus 'm' 'i' '9']] + ooo 0I[[modulus] -> "9im"] + D1GI[ 0I[{if modulus>1}] + <reprnum> 0I[[] -> "modulus"] + 99im7ao 0I[[] -> 'a'] + 0d 0I[[-1]] + ] + D0GI[ 0I[{if modulus>0, so =1}] + 9iDm5ao 0I[[modulus] -> 'i'] + ] + P0d 0I[[-1]] + ] + D9GI[ 0I[{if value>9, so 10..19}] + 455mm5a87mi 0I[[value 'i' '9']] + oo 0I[[value] -> "9i"] + D92aGI[ 0I[{if value>11, so 12..19}] + 9isD<reprnum> 0I[[value] -> repr(value-10)] + 99im7ao 0I[[value] -> 'a'] + ] + D9iGI[ 0I[{if value>10, so =11}] + 9iDm5ao 0I[[value] -> 'i'] + ] + P0d 0I[[-1]] + ] + D0dGI[ 0I[{if value>-1, so 0..9}] + 86mao 0I[[] -> value] + 0d 0I[[-1]] + ] + P + ] +] + + +F<reprnum>[D9i9aGI[D9iqD3r9imsS<reprnum>455mm5aD4aS87mioooD1GI[<reprnum>99im7ao0d]D0GI[9iDm5ao]P0d]D9GI[455mm5a87miooD92aGI[9isD<reprnum>99im7ao]D9iGI[9iDm5ao]P0d]D0dGI[86mao0d]P] + + + +0 + +86mo + +gD0dEnW[ + + SD3rs + + D0GI[ + D<reprnum> + 99im7ao + a + 1 + ] + D0LI[ + 0Ss + D<reprnum> + 278mm3ao + s + 1 + ] + P + 88m4ao + 278mmdo +gD0dEn] |