File: toplevel.js

package info (click to toggle)
js-of-ocaml 4.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,372 kB
  • sloc: ml: 70,468; javascript: 8,238; ansic: 319; makefile: 217; lisp: 23; sh: 6; perl: 4
file content (84 lines) | stat: -rw-r--r-- 3,042 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Js_of_ocaml toplevel runtime support
// http://www.ocsigen.org/js_of_ocaml/
// Copyright (C) 2011 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_terminfo_setup
function caml_terminfo_setup () { return 1; } // Bad_term
//Provides: caml_terminfo_backup
function caml_terminfo_backup () { return 0; }
//Provides: caml_terminfo_standout
function caml_terminfo_standout () { return 0; }
//Provides: caml_terminfo_resume
function caml_terminfo_resume () { return 0; }
//Provides: caml_terminfo_rows
function caml_terminfo_rows () { return 0; }
//Provides: caml_invoke_traced_function
//Requires: caml_invalid_argument
function caml_invoke_traced_function() {
  caml_invalid_argument("Meta.invoke_traced_function");
}
//Provides: caml_get_current_environment
//Requires: caml_failwith
function caml_get_current_environment() {
  caml_failwith("caml_get_current_environment not Implemented");
}
//////////////////////////////////////////////////////////////////////

//Provides: caml_get_section_table
//Requires: caml_global_data, caml_failwith
function caml_get_section_table () {
  if(!caml_global_data.toc)
    caml_failwith("Program not compiled with --toplevel");
  return caml_global_data.toc;
}


//Provides: caml_reify_bytecode
//Requires: caml_failwith
//Version: < 4.08
function caml_reify_bytecode (code, _sz) {
  if(globalThis.toplevelCompile)
    return globalThis.toplevelCompile([0,code]);
  else caml_failwith("Toplevel not initialized (toplevelCompile)")
}

//Provides: caml_reify_bytecode
//Requires: caml_failwith
//Version: >= 4.08
function caml_reify_bytecode (code, _sz,_) {
  if(globalThis.toplevelCompile)
    return [0, 0, globalThis.toplevelCompile(code)];
  else caml_failwith("Toplevel not initialized (toplevelCompile)")
}

//Provides: caml_static_release_bytecode
function caml_static_release_bytecode () { return 0; }

//Provides: caml_static_alloc
//Requires: caml_create_bytes
function caml_static_alloc (len) { return caml_create_bytes (len); }

//Provides: caml_static_free
function caml_static_free () { return 0; }

//Provides: caml_realloc_global
//Requires: caml_global_data
function caml_realloc_global (len) {
  if (len + 1 > caml_global_data.length) caml_global_data.length = len + 1;
  return 0;
}