aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib.rip59
-rw-r--r--stdlibtest.rip21
2 files changed, 80 insertions, 0 deletions
diff --git a/stdlib.rip b/stdlib.rip
new file mode 100644
index 0000000..8ab0448
--- /dev/null
+++ b/stdlib.rip
@@ -0,0 +1,59 @@
+0I[prints string; destructive]
+F<strprint>[
+ <strrev>
+ 97aDm
+ SDW[
+ D3RD3rM o D3rq
+ D]
+ PP
+]
+
+0I[takes string char; returns string+char]
+F<strpush>[
+ S97aDmma
+]
+
+0I[reverses string in place]
+F<strrev>[
+ 0S
+ DW[
+ D 97aDm D 3r M 3r q 3r S 97aDm m a S
+ D]
+ P
+]
+
+0I[concatenates two strings]
+F<strcat>[
+ <strrev> 97aDm S
+ DW[
+ S D 3r S D 3R M 4R 97aDmma 3r S D 3r q
+ D]
+ PP
+]
+
+0I[takes list of characters and a length, builds a string]
+F<mkstr>[
+ 0S
+ DW[
+ D3aR 3R 97aDm m a S d
+ D]
+ 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
+]
diff --git a/stdlibtest.rip b/stdlibtest.rip
new file mode 100644
index 0000000..c0926cd
--- /dev/null
+++ b/stdlibtest.rip
@@ -0,0 +1,21 @@
+#<stdlib.rip>
+0 0I[empty string]
+'a <strpush>
+'b <strpush>
+' <strpush>
+'4 <strpush>
+'2 <strpush>
+9i <strpush>
+
+0
+'a <strpush>
+'b <strpush>
+'c <strpush>
+'d <strpush>
+'e <strpush>
+'f <strpush>
+9i <strpush>
+<strcat>
+<strprint>
+
+'a 'b 'c 'd 'x 'y 'z 9i 8 <mkstr> <strprint>