aboutsummaryrefslogtreecommitdiff
path: root/stdlib.rip
diff options
context:
space:
mode:
authortomsmeding <hallo@tomsmeding.nl>2015-12-18 22:17:16 +0100
committertomsmeding <hallo@tomsmeding.nl>2015-12-18 22:17:16 +0100
commit534cd47f7488d7081d68c641b28a7c30c93643b9 (patch)
tree2975be410a08a33d8d37400808321c2b1ce146b8 /stdlib.rip
parent478f02ff10d152054abacb15750246083c560133 (diff)
strcmp stdlib function
Diffstat (limited to 'stdlib.rip')
-rw-r--r--stdlib.rip21
1 files changed, 21 insertions, 0 deletions
diff --git a/stdlib.rip b/stdlib.rip
index 432a9cf..56bacc6 100644
--- a/stdlib.rip
+++ b/stdlib.rip
@@ -40,6 +40,21 @@ F<mkstr>[
P
]
+0I[compares two strings; 0 = equal, >0, <0 = second string is greater, less than first; destructive]
+F<strcmp>[
+ 0 3r
+ <dup2>mW[
+ D28pM 3R D28pM S 4r S s
+ DI[
+ 4rPPP00
+ 0 0I[to counter the P after the if]
+ ]
+ P
+ 28pqS28pqS
+ <dup2>m]
+ PP
+]
+
0I[initialises variable store at beginning of stack (no args) (CALL ONLY ONCE)]
F<varinit>[
@@ -152,3 +167,9 @@ F<strsend>[
<strrev>
DW[D28pM3RSwS28pqD]P
]
+
+
+0I[A B -> A B A B]
+F<dup2>[
+ SD3RD3r
+]