Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 3455215e7f
Fetching contributors…

Cannot retrieve contributors at this time

62 lines (55 sloc) 2.31 kb
--- pervasives.ml.orig 2010-08-09 17:18:05.000000000 -0700
+++ pervasives.ml 2010-12-18 20:27:49.000000000 -0800
@@ -1,3 +1,26 @@
+(*
+ * This file is part of ocamljs, OCaml to Javascript compiler
+ * Copyright (C) 2007-9 Skydeck, Inc
+ * Copyright (C) 2010 Jake Donham
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA
+ *)
+
+open Ocamljs.Inline
+
(***********************************************************************)
(* *)
(* Objective Caml *)
@@ -71,8 +94,8 @@
external (lsr) : int -> int -> int = "%lsrint"
external (asr) : int -> int -> int = "%asrint"
-let min_int = 1 lsl (if 1 lsl 31 = 0 then 30 else 62)
-let max_int = min_int - 1
+let min_int = 2 lsl (if 2 lsl 31 = 0 then 30 else 62)
+let max_int = min_int lxor (-1)
(* Floating-point operations *)
@@ -137,11 +160,15 @@
= "caml_blit_string" "noalloc"
let (^) s1 s2 =
- let l1 = string_length s1 and l2 = string_length s2 in
- let s = string_create (l1 + l2) in
- string_blit s1 0 s 0 l1;
- string_blit s2 0 s l1 l2;
- s
+ (* camlp4 doesn't like (or) above, so we do this manually *)
+ inline_exp
+ (Jslib_ast.Jbinop (_loc, Jslib_ast.Jadd,
+ Jslib_ast.Jcall (_loc,
+ Jslib_ast.Jfieldref (_loc, inline_antiexp s1, "toString"),
+ Jslib_ast.Jexp_nil _loc),
+ Jslib_ast.Jcall (_loc,
+ Jslib_ast.Jfieldref (_loc, inline_antiexp s2, "toString"),
+ Jslib_ast.Jexp_nil _loc)))
(* Character operations -- more in module Char *)
Jump to Line
Something went wrong with that request. Please try again.