From 534cd47f7488d7081d68c641b28a7c30c93643b9 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 18 Dec 2015 22:17:16 +0100 Subject: strcmp stdlib function --- stdlib.rip | 21 +++++++++++++++++++++ stdlibtest.rip | 49 +++++++++++++++++++++++++++++-------------------- 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[ P ] +0I[compares two strings; 0 = equal, >0, <0 = second string is greater, less than first; destructive] +F[ + 0 3r + mW[ + D28pM 3R D28pM S 4r S s + DI[ + 4rPPP00 + 0 0I[to counter the P after the if] + ] + P + 28pqS28pqS + m] + PP +] + 0I[initialises variable store at beginning of stack (no args) (CALL ONLY ONCE)] F[ @@ -152,3 +167,9 @@ F[ DW[D28pM3RSwS28pqD]P ] + + +0I[A B -> A B A B] +F[ + SD3RD3r +] diff --git a/stdlibtest.rip b/stdlibtest.rip index 8ca17a1..858b210 100644 --- a/stdlibtest.rip +++ b/stdlibtest.rip @@ -1,20 +1,22 @@ # -'a 'b 'c 'd 'x 'y 'z 7 9i +0I[ 0I[variable test] + 'a 'b 'c 'd 'x 'y 'z 7 9i -'h'o'i 3 67m 0I[42] -'d'o'e'i 4 93a9iDmm75mda 0I[1234] + 'h'o'i 3 67m 0I[42] + 'd'o'e'i 4 93a9iDmm75mda 0I[1234] -'d'o'e'i 4 O 9io 0I[1234] -'h'o'i 3 O 9io 0I[42] + 'd'o'e'i 4 O 9io 0I[1234] + 'h'o'i 3 O 9io 0I[42] -'h'o'i 3 -'d'o'e'i 4 + 'h'o'i 3 + 'd'o'e'i 4 +] -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 -0I[178.62.239.79] - -98a9im8a 88mdd 83m9imd 89imd 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 -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 + 0I[178.62.239.79] + + 98a9im8a 88mdd 83m9imd 89imd 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 + tDiW[ + o + tDi] + Pc +] + + +'a'b'c'd 4D ' o'-o' o +'a'b'c'e 4D ' o'=o' o + O 9io PPP -- cgit v1.2.3-70-g09d2