|
@@ -1832,34 +1832,6 @@ module StdSocket = struct
|
|
end
|
|
end
|
|
|
|
|
|
module StdStd = struct
|
|
module StdStd = struct
|
|
- let parse_float s =
|
|
|
|
- let rec loop sp i =
|
|
|
|
- if i = String.length s then (if sp = 0 then s else String.sub s sp (i - sp)) else
|
|
|
|
- match String.unsafe_get s i with
|
|
|
|
- | ' ' when sp = i -> loop (sp + 1) (i + 1)
|
|
|
|
- | '0'..'9' | '-' | '+' | 'e' | 'E' | '.' -> loop sp (i + 1)
|
|
|
|
- | _ -> String.sub s sp (i - sp)
|
|
|
|
- in
|
|
|
|
- float_of_string (loop 0 0)
|
|
|
|
-
|
|
|
|
- let parse_int s =
|
|
|
|
- let rec loop_hex i =
|
|
|
|
- if i = String.length s then s else
|
|
|
|
- match String.unsafe_get s i with
|
|
|
|
- | '0'..'9' | 'a'..'f' | 'A'..'F' -> loop_hex (i + 1)
|
|
|
|
- | _ -> String.sub s 0 i
|
|
|
|
- in
|
|
|
|
- let rec loop sp i =
|
|
|
|
- if i = String.length s then (if sp = 0 then s else String.sub s sp (i - sp)) else
|
|
|
|
- match String.unsafe_get s i with
|
|
|
|
- | '0'..'9' -> loop sp (i + 1)
|
|
|
|
- | ' ' when sp = i -> loop (sp + 1) (i + 1)
|
|
|
|
- | '-' when i = 0 -> loop sp (i + 1)
|
|
|
|
- | ('x' | 'X') when i = 1 && String.get s 0 = '0' -> loop_hex (i + 1)
|
|
|
|
- | _ -> String.sub s sp (i - sp)
|
|
|
|
- in
|
|
|
|
- Int32.of_string (loop 0 0)
|
|
|
|
-
|
|
|
|
let is' = vfun2 (fun v t -> match t with
|
|
let is' = vfun2 (fun v t -> match t with
|
|
| VNull -> vfalse
|
|
| VNull -> vfalse
|
|
| VPrototype proto -> vbool (is v proto.ppath)
|
|
| VPrototype proto -> vbool (is v proto.ppath)
|
|
@@ -1881,11 +1853,11 @@ module StdStd = struct
|
|
)
|
|
)
|
|
|
|
|
|
let parseInt = vfun1 (fun v ->
|
|
let parseInt = vfun1 (fun v ->
|
|
- try vint32 (parse_int (decode_string v)) with _ -> vnull
|
|
|
|
|
|
+ try vint32 (Common.parse_int (decode_string v)) with _ -> vnull
|
|
)
|
|
)
|
|
|
|
|
|
let parseFloat = vfun1 (fun v ->
|
|
let parseFloat = vfun1 (fun v ->
|
|
- try vfloat (parse_float (decode_string v)) with _ -> vnull
|
|
|
|
|
|
+ try vfloat (Common.parse_float (decode_string v)) with _ -> vnull
|
|
)
|
|
)
|
|
|
|
|
|
let random = vfun1 (fun v ->
|
|
let random = vfun1 (fun v ->
|