diff string.rhope @ 52:079200bc3e75

String literals almost working. Print moved out of C runtime.
author Mike Pavone <pavone@retrodev.com>
date Wed, 28 Apr 2010 01:23:30 -0400
parents 7d6a6906b648
children 048046186d22
line wrap: on
line diff
--- a/string.rhope	Thu Apr 22 02:18:26 2010 -0400
+++ b/string.rhope	Wed Apr 28 01:23:30 2010 -0400
@@ -19,6 +19,13 @@
 	Length(Int32,Naked)
 }
 
+Print@Base String[string:out]
+{	
+	//TODO: Sanitize string (remove terminal escapes and replace invalid UTF)
+	write[1i32, [string]Buffer >>, Int64[[[string]Buffer >>]Length >>]]
+	{ out <- write[1i32, [Array[1]]Append[10u8], 1i64] }
+}
+
 UTF8 Expect[num,arr,index,count,consumed:out]
 {
 	byte <- [arr]Index[index]
@@ -113,22 +120,5 @@
 	out <- [[Build[Base String()]]Buffer <<[in]]Length <<[Count UTF8[in, 0, 0]]
 }
 
-Main[]
-{
-	text <- [[[[[[[[[[[[[Array[1]
-		]Append[36u8]
-		]Append[194u8]
-		]Append[162u8]
-		]Append[236u8]
-		]Append[130u8]
-		]Append[172u8]
-		]Append[240u8]
-		]Append[164u8]
-		]Append[173u8]
-		]Append[162u8]
-		]Append[194u8]
-		]Append[36u8]
-		]Append[162u8]
-	Print[Count UTF8[text, 0, 0]]
-}
 
+