aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--stdlib.rip21
-rw-r--r--stdlibtest.rip49
2 files changed, 50 insertions, 20 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
+]
diff --git a/stdlibtest.rip b/stdlibtest.rip
index 8ca17a1..858b210 100644
--- a/stdlibtest.rip
+++ b/stdlibtest.rip
@@ -1,20 +1,22 @@
#<stdlib.rip>
<varinit>
-'a 'b 'c 'd 'x 'y 'z 7 <mkstr> 9i <strpush> <strprint>
+0I[ 0I[variable test]
+ 'a 'b 'c 'd 'x 'y 'z 7 <mkstr> 9i <strpush> <strprint>
-'h'o'i 3<mkstr> 67m <varstore> 0I[42]
-'d'o'e'i 4<mkstr> 93a9iDmm75mda <varstore> 0I[1234]
+ 'h'o'i 3<mkstr> 67m <varstore> 0I[42]
+ 'd'o'e'i 4<mkstr> 93a9iDmm75mda <varstore> 0I[1234]
-'d'o'e'i 4<mkstr> <varget> O 9io 0I[1234]
-'h'o'i 3<mkstr> <varget> O 9io 0I[42]
+ 'd'o'e'i 4<mkstr> <varget> O 9io 0I[1234]
+ 'h'o'i 3<mkstr> <varget> O 9io 0I[42]
-'h'o'i 3<mkstr> <vardel>
-'d'o'e'i 4<mkstr> <vardel>
+ 'h'o'i 3<mkstr> <vardel>
+ 'd'o'e'i 4<mkstr> <vardel>
+]
-0I[
+0I[ 0I[cat to socket]
27pd 238mp m i 0I[127.0.0.1]
39iDDmmm 0I[3000]
C
@@ -25,15 +27,22 @@
c
]
-'C'o'n'n'e'c't'i'n'g' 't'o' '1'7'8'.'6'2'.'2'3'9'.'7'9':'8'0'.'.'. 9i 6Dmdd<mkstr><strprint>
-0I[178.62.239.79]
-
-98a9im8a 88mdd<strpush> 83m9imd<strpush> 89imd<strpush> 89im C
-'G'E'T' '/' 'H'T'T'P'/'1'.'1'
-'H'o's't':' 't'o'm's'm'e'd'i'n'g'.'c'o'm'
-'
-6Dmi<mkstr><strsend>
-tDiW[
- o
-tDi]
-Pc
+0I[ 0I[get website]
+ 'C'o'n'n'e'c't'i'n'g' 't'o' '1'7'8'.'6'2'.'2'3'9'.'7'9':'8'0'.'.'. 9i 6Dmdd<mkstr><strprint>
+ 0I[178.62.239.79]
+
+ 98a9im8a 88mdd<strpush> 83m9imd<strpush> 89imd<strpush> 89im C
+ 'G'E'T' '/' 'H'T'T'P'/'1'.'1'
+ 'H'o's't':' 't'o'm's'm'e'd'i'n'g'.'c'o'm'
+ '
+ 6Dmi<mkstr><strsend>
+ tDiW[
+ o
+ tDi]
+ Pc
+]
+
+
+'a'b'c'd 4<mkstr>D<strprint> ' o'-o' o
+'a'b'c'e 4<mkstr>D<strprint> ' o'=o' o
+<strcmp> O 9io PPP