diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2003-12-16 18:09:44 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2003-12-16 18:09:44 +0000 |
commit | aa46693dc5810998b2668c31a8649c31f0f2e49c (patch) | |
tree | e9548200a8d76ee9d3d1dbe0a776aa5b32d01f4c /byterun/str.c | |
parent | a90b6e9d1279612493dec0a50185bcdc8392807c (diff) |
depollution (PR#1914, PR#1956)
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@6023 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/str.c')
-rw-r--r-- | byterun/str.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/byterun/str.c b/byterun/str.c index e5588fdcf..347e5bcb9 100644 --- a/byterun/str.c +++ b/byterun/str.c @@ -25,7 +25,7 @@ #include <locale.h> #endif -CAMLexport mlsize_t string_length(value s) +CAMLexport mlsize_t caml_string_length(value s) { mlsize_t temp; temp = Bosize_val(s) - 1; @@ -33,7 +33,7 @@ CAMLexport mlsize_t string_length(value s) return temp - Byte (s, temp); } -CAMLprim value ml_string_length(value s) +CAMLprim value caml_ml_string_length(value s) { mlsize_t temp; temp = Bosize_val(s) - 1; @@ -41,29 +41,29 @@ CAMLprim value ml_string_length(value s) return Val_long(temp - Byte (s, temp)); } -CAMLprim value create_string(value len) +CAMLprim value caml_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); } -CAMLprim value string_get(value str, value index) +CAMLprim value caml_string_get(value str, value index) { long idx = Long_val(index); - if (idx < 0 || idx >= string_length(str)) array_bound_error(); + if (idx < 0 || idx >= caml_string_length(str)) array_bound_error(); return Val_int(Byte_u(str, idx)); } -CAMLprim value string_set(value str, value index, value newval) +CAMLprim value caml_string_set(value str, value index, value newval) { long idx = Long_val(index); - if (idx < 0 || idx >= string_length(str)) array_bound_error(); + if (idx < 0 || idx >= caml_string_length(str)) array_bound_error(); Byte_u(str, idx) = Int_val(newval); return Val_unit; } -CAMLprim value string_equal(value s1, value s2) +CAMLprim value caml_string_equal(value s1, value s2) { mlsize_t sz1 = Wosize_val(s1); mlsize_t sz2 = Wosize_val(s2); @@ -74,18 +74,18 @@ CAMLprim value string_equal(value s1, value s2) return Val_true; } -CAMLprim value string_notequal(value s1, value s2) +CAMLprim value caml_string_notequal(value s1, value s2) { - return Val_not(string_equal(s1, s2)); + return Val_not(caml_string_equal(s1, s2)); } -CAMLprim value string_compare(value s1, value s2) +CAMLprim value caml_string_compare(value s1, value s2) { mlsize_t len1, len2, len; int res; - len1 = string_length(s1); - len2 = string_length(s2); + len1 = caml_string_length(s1); + len2 = caml_string_length(s2); res = memcmp(String_val(s1), String_val(s2), len1 <= len2 ? len1 : len2); if (res < 0) return Val_int(-1); if (res > 0) return Val_int(1); @@ -94,39 +94,40 @@ CAMLprim value string_compare(value s1, value s2) return Val_int(0); } -CAMLprim value string_lessthan(value s1, value s2) +CAMLprim value caml_string_lessthan(value s1, value s2) { - return string_compare(s1, s2) < Val_int(0) ? Val_true : Val_false; + return caml_string_compare(s1, s2) < Val_int(0) ? Val_true : Val_false; } -CAMLprim value string_lessequal(value s1, value s2) +CAMLprim value caml_string_lessequal(value s1, value s2) { - return string_compare(s1, s2) <= Val_int(0) ? Val_true : Val_false; + return caml_string_compare(s1, s2) <= Val_int(0) ? Val_true : Val_false; } -CAMLprim value string_greaterthan(value s1, value s2) +CAMLprim value caml_string_greaterthan(value s1, value s2) { - return string_compare(s1, s2) > Val_int(0) ? Val_true : Val_false; + return caml_string_compare(s1, s2) > Val_int(0) ? Val_true : Val_false; } -CAMLprim value string_greaterequal(value s1, value s2) +CAMLprim value caml_string_greaterequal(value s1, value s2) { - return string_compare(s1, s2) >= Val_int(0) ? Val_true : Val_false; + return caml_string_compare(s1, s2) >= Val_int(0) ? Val_true : Val_false; } -CAMLprim value blit_string(value s1, value ofs1, value s2, value ofs2, value n) +CAMLprim value caml_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; } -CAMLprim value fill_string(value s, value offset, value len, value init) +CAMLprim value caml_fill_string(value s, value offset, value len, value init) { memset(&Byte(s, Long_val(offset)), Int_val(init), Long_val(len)); return Val_unit; } -CAMLprim value is_printable(value chr) +CAMLprim value caml_is_printable(value chr) { int c; @@ -141,7 +142,7 @@ CAMLprim value is_printable(value chr) return Val_bool(isprint(c)); } -CAMLprim value bitvect_test(value bv, value n) +CAMLprim value caml_bitvect_test(value bv, value n) { int pos = Int_val(n); return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7))); |