[Toss-devel-svn] SF.net SVN: toss:[1665] trunk/Toss
Status: Beta
Brought to you by:
lukaszkaiser
|
From: <luk...@us...> - 2012-02-05 15:33:22
|
Revision: 1665
http://toss.svn.sourceforge.net/toss/?rev=1665&view=rev
Author: lukstafi
Date: 2012-02-05 15:33:16 +0000 (Sun, 05 Feb 2012)
Log Message:
-----------
Better handling of missing functions (the fix to probable js_of_ocaml bug).
Modified Paths:
--------------
trunk/Toss/Makefile
trunk/Toss/WebClient/JsHandler.js
trunk/Toss/WebClient/Local.js
Added Paths:
-----------
trunk/Toss/WebClient/MissingFunctions.js
Modified: trunk/Toss/Makefile
===================================================================
--- trunk/Toss/Makefile 2012-02-05 11:15:29 UTC (rev 1664)
+++ trunk/Toss/Makefile 2012-02-05 15:33:16 UTC (rev 1665)
@@ -5,7 +5,7 @@
WebClient/JsHandler.js: Server/JsHandler.byte
js_of_ocaml _build/$<
- cp _build/Server/JsHandler.js WebClient/JsHandler.js
+ cat WebClient/MissingFunctions.js _build/Server/JsHandler.js > WebClient/JsHandler.js
%.js: %.byte
js_of_ocaml _build/$<
Modified: trunk/Toss/WebClient/JsHandler.js
===================================================================
--- trunk/Toss/WebClient/JsHandler.js 2012-02-05 11:15:29 UTC (rev 1664)
+++ trunk/Toss/WebClient/JsHandler.js 2012-02-05 15:33:16 UTC (rev 1665)
@@ -1,3 +1,57 @@
+// A bug in js_of_ocaml: it sometimes omits the functions below, which
+// belong to its runtmie.
+
+// Applies to code below this line:
+// Js_of_ocaml runtime support
+// http://www.ocsigen.org/js_of_ocaml/
+// Copyright (C) 2010 Jérôme Vouillon
+// Laboratoire PPS - CNRS Université Paris Diderot
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, with linking exception;
+// either version 2.1 of the License, or (at your option) any later version.
+//
+// This program 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+// Provides: caml_int64_bits_of_float const
+function caml_int64_bits_of_float (x) {
+ if (!isFinite(x)) {
+ if (isNaN(x)) return [255, 1, 0, 0xfff0];
+ return (x > 0)?[255,0,0,0x7ff0]:[255,0,0,0xfff0];
+ }
+ var sign = (x>=0)?0:0x8000;
+ if (sign) x = -x;
+ var exp = Math.floor(Math.LOG2E*Math.log(x)) + 1023;
+ if (exp <= 0) {
+ exp = 0;
+ x /= Math.pow(2,-1026);
+ } else {
+ x /= Math.pow(2,exp-1027);
+ if (x < 16) { x *= 2; exp -=1; }
+ if (exp == 0) { x /= 2; }
+ }
+ var k = Math.pow(2,24);
+ var r3 = x|0;
+ x = (x - r3) * k;
+ var r2 = x|0;
+ x = (x - r2) * k;
+ var r1 = x|0;
+ r3 = (r3 &0xf) | sign | exp << 4;
+ return [255, r1, r2, r3];
+}
+//Provides: caml_int64_to_bytes
+function caml_int64_to_bytes(x) {
+ return [x[3] >> 8, x[3] & 0xff, x[2] >> 16, (x[2] >> 8) & 0xff, x[2] & 0xff,
+ x[1] >> 16, (x[1] >> 8) & 0xff, x[1] & 0xff];
+}
// This program was compiled from OCaml by js_of_ocaml 1.0
function caml_raise_with_arg (tag, arg) { throw [0, tag, arg]; }
function caml_raise_with_string (tag, msg) {
Modified: trunk/Toss/WebClient/Local.js
===================================================================
--- trunk/Toss/WebClient/Local.js 2012-02-05 11:15:29 UTC (rev 1664)
+++ trunk/Toss/WebClient/Local.js 2012-02-05 15:33:16 UTC (rev 1665)
@@ -28,61 +28,6 @@
return (res_arr);
}
-// A bug in js_of_ocaml: it sometimes omits the functions below, which
-// belong to its runtmie.
-
-// Applies to code below this line:
-// Js_of_ocaml runtime support
-// http://www.ocsigen.org/js_of_ocaml/
-// Copyright (C) 2010 Jérôme Vouillon
-// Laboratoire PPS - CNRS Université Paris Diderot
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published by
-// the Free Software Foundation, with linking exception;
-// either version 2.1 of the License, or (at your option) any later version.
-//
-// This program 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 Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-// Provides: caml_int64_bits_of_float const
-function caml_int64_bits_of_float (x) {
- if (!isFinite(x)) {
- if (isNaN(x)) return [255, 1, 0, 0xfff0];
- return (x > 0)?[255,0,0,0x7ff0]:[255,0,0,0xfff0];
- }
- var sign = (x>=0)?0:0x8000;
- if (sign) x = -x;
- var exp = Math.floor(Math.LOG2E*Math.log(x)) + 1023;
- if (exp <= 0) {
- exp = 0;
- x /= Math.pow(2,-1026);
- } else {
- x /= Math.pow(2,exp-1027);
- if (x < 16) { x *= 2; exp -=1; }
- if (exp == 0) { x /= 2; }
- }
- var k = Math.pow(2,24);
- var r3 = x|0;
- x = (x - r3) * k;
- var r2 = x|0;
- x = (x - r2) * k;
- var r1 = x|0;
- r3 = (r3 &0xf) | sign | exp << 4;
- return [255, r1, r2, r3];
-}
-//Provides: caml_int64_to_bytes
-function caml_int64_to_bytes(x) {
- return [x[3] >> 8, x[3] & 0xff, x[2] >> 16, (x[2] >> 8) & 0xff, x[2] & 0xff,
- x[1] >> 16, (x[1] >> 8) & 0xff, x[1] & 0xff];
-}
-
// ********************************************************************
// Web-Worker thread
Added: trunk/Toss/WebClient/MissingFunctions.js
===================================================================
--- trunk/Toss/WebClient/MissingFunctions.js (rev 0)
+++ trunk/Toss/WebClient/MissingFunctions.js 2012-02-05 15:33:16 UTC (rev 1665)
@@ -0,0 +1,54 @@
+// A bug in js_of_ocaml: it sometimes omits the functions below, which
+// belong to its runtmie.
+
+// Applies to code below this line:
+// Js_of_ocaml runtime support
+// http://www.ocsigen.org/js_of_ocaml/
+// Copyright (C) 2010 Jérôme Vouillon
+// Laboratoire PPS - CNRS Université Paris Diderot
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, with linking exception;
+// either version 2.1 of the License, or (at your option) any later version.
+//
+// This program 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 Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+// Provides: caml_int64_bits_of_float const
+function caml_int64_bits_of_float (x) {
+ if (!isFinite(x)) {
+ if (isNaN(x)) return [255, 1, 0, 0xfff0];
+ return (x > 0)?[255,0,0,0x7ff0]:[255,0,0,0xfff0];
+ }
+ var sign = (x>=0)?0:0x8000;
+ if (sign) x = -x;
+ var exp = Math.floor(Math.LOG2E*Math.log(x)) + 1023;
+ if (exp <= 0) {
+ exp = 0;
+ x /= Math.pow(2,-1026);
+ } else {
+ x /= Math.pow(2,exp-1027);
+ if (x < 16) { x *= 2; exp -=1; }
+ if (exp == 0) { x /= 2; }
+ }
+ var k = Math.pow(2,24);
+ var r3 = x|0;
+ x = (x - r3) * k;
+ var r2 = x|0;
+ x = (x - r2) * k;
+ var r1 = x|0;
+ r3 = (r3 &0xf) | sign | exp << 4;
+ return [255, r1, r2, r3];
+}
+//Provides: caml_int64_to_bytes
+function caml_int64_to_bytes(x) {
+ return [x[3] >> 8, x[3] & 0xff, x[2] >> 16, (x[2] >> 8) & 0xff, x[2] & 0xff,
+ x[1] >> 16, (x[1] >> 8) & 0xff, x[1] & 0xff];
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|