aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2008-07-08 10:36:43 -0700
committerRob Pike <r@golang.org>2008-07-08 10:36:43 -0700
commit6db99de6069162a3e2b41de3e202e58ce329988d (patch)
treea59b0cc97bb7ce5575c8b137b4586a95556fdd0c /src/runtime
parent5352306f1066e68985bf6f299ba0bafaee14a3fd (diff)
downloadgo-6db99de6069162a3e2b41de3e202e58ce329988d.tar.xz
add bytestorune and stringtorune to sys.
SVN=126321
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/rune.c19
-rw-r--r--src/runtime/runtime.h6
2 files changed, 25 insertions, 0 deletions
diff --git a/src/runtime/rune.c b/src/runtime/rune.c
index 2c717d7a95..3e1fb14d63 100644
--- a/src/runtime/rune.c
+++ b/src/runtime/rune.c
@@ -222,3 +222,22 @@ runetochar(byte *str, int32 rune) /* note: in original, arg2 was pointer */
str[3] = Tx | (c & Maskx);
return 4;
}
+
+/*
+ * Wrappers for calling from go
+ */
+void
+sys·bytestorune(byte *str, int32 off, int32 length, int32 outrune, int32 outcount)
+{
+ outcount = charntorune(&outrune, str + off, length);
+ FLUSH(&outrune);
+ FLUSH(&outcount);
+}
+
+void
+sys·stringtorune(string str, int32 off, int32 length, int32 outrune, int32 outcount)
+{
+ outcount = charntorune(&outrune, str->str + off, length);
+ FLUSH(&outrune);
+ FLUSH(&outcount);
+}
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index dc8f88bb7a..14e8f177be 100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -142,4 +142,10 @@ void sys·intstring(int64, string);
void sys·ifaces2i(Sigi*, Sigs*, Map*, void*);
void sys·ifacei2i(Sigi*, Map*, void*);
void sys·ifacei2s(Sigs*, Map*, void*);
+
+/*
+ * User go-called
+ */
void sys·readfile(string, string, bool);
+void sys·bytestorune(byte*, int32, int32, int32, int32);
+void sys·stringtorune(string, int32, int32, int32, int32);