diff options
Diffstat (limited to 'byterun/str.c')
-rw-r--r-- | byterun/str.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/byterun/str.c b/byterun/str.c index 51ff4aa9f6..65467e5984 100644 --- a/byterun/str.c +++ b/byterun/str.c @@ -24,7 +24,7 @@ #include <locale.h> #endif -mlsize_t string_length(value s) +CAMLexport mlsize_t string_length(value s) { mlsize_t temp; temp = Bosize_val(s) - 1; @@ -32,7 +32,7 @@ mlsize_t string_length(value s) return temp - Byte (s, temp); } -value ml_string_length(value s) /* ML */ +CAMLprim value ml_string_length(value s) { mlsize_t temp; temp = Bosize_val(s) - 1; @@ -40,21 +40,21 @@ value ml_string_length(value s) /* ML */ return Val_long(temp - Byte (s, temp)); } -value create_string(value len) /* ML */ +CAMLprim value create_string(value len) { mlsize_t size = Long_val(len); if (size > Bsize_wsize (Max_wosize) - 1) invalid_argument("String.create"); return alloc_string(size); } -value string_get(value str, value index) /* ML */ +CAMLprim value string_get(value str, value index) { long idx = Long_val(index); if (idx < 0 || idx >= string_length(str)) invalid_argument("String.get"); return Val_int(Byte_u(str, idx)); } -value string_set(value str, value index, value newval) /* ML */ +CAMLprim value string_set(value str, value index, value newval) { long idx = Long_val(index); if (idx < 0 || idx >= string_length(str)) invalid_argument("String.set"); @@ -62,7 +62,7 @@ value string_set(value str, value index, value newval) /* ML */ return Val_unit; } -value string_equal(value s1, value s2) /* ML */ +CAMLprim value string_equal(value s1, value s2) { mlsize_t sz1 = Wosize_val(s1); mlsize_t sz2 = Wosize_val(s2); @@ -73,18 +73,18 @@ value string_equal(value s1, value s2) /* ML */ return Val_true; } -value string_notequal(value s1, value s2) /* ML */ +CAMLprim value string_notequal(value s1, value s2) { return Val_not(string_equal(s1, s2)); } -value blit_string(value s1, value ofs1, value s2, value ofs2, value n) /* ML */ +CAMLprim value blit_string(value s1, value ofs1, value s2, value ofs2, value n) { memmove(&Byte(s2, Long_val(ofs2)), &Byte(s1, Long_val(ofs1)), Int_val(n)); return Val_unit; } -value fill_string(value s, value offset, value len, value init) /* ML */ +CAMLprim value fill_string(value s, value offset, value len, value init) { register char * p; register mlsize_t n; @@ -97,7 +97,7 @@ value fill_string(value s, value offset, value len, value init) /* ML */ return Val_unit; } -value is_printable(value chr) /* ML */ +CAMLprim value is_printable(value chr) { int c; @@ -124,7 +124,7 @@ value is_printable(value chr) /* ML */ #endif } -value bitvect_test(value bv, value n) /* ML */ +CAMLprim value bitvect_test(value bv, value n) { int pos = Int_val(n); return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7))); |