<commit_before>GiDispa = function() {

//### Should split WriteWord into a WriteRefWord and WriteArrayWord,
//### with different handling of -1. Etc.

/* The VM interface object. GiDispa needs this to load and store reference
   arguments, from and to VM memory. */
var VM = null;

/* Set the VM interface object. This is called by the Glk library, before
   the VM starts running. 
*/
function set_vm(vm_api) {
    VM = vm_api;
}

/* A table of the Glk classes, and their index numbers. This is derived from
   gi_dispa.c, although it's too simple to bother auto-generating.
*/
var class_defs = {
    0: 'window',
    1: 'stream',
    2: 'fileref',
    3: 'schannel',
};

/* FuncSpec is a data representation of a Glk function's prototype.
   The table of FuncSpecs is generated, ultimately, from the Glk
   prototype description strings in gi_dispa.c.
*/
function FuncSpec(id, name, proto) {
    this.id = id;
    this.name = name;
    this.proto = proto;
}

/* A bunch of data classes, used by FuncSpec. */

function Prototype(args, retarg) {
    this.args = args;
    this.retarg = retarg;
}
function ArgString() { 
    this.macro = 'Byte';
    this.refsize = 1;
}
function ArgUnicode() { 
    this.macro = 'Word';
    this.refsize = 4;
}
function ArgChar(signed) {
    this.signed = signed;
    this.macro = 'Byte';
    this.refsize = 1;
    this.literal = (signed ? 'arg_char_signed' : 'arg_char_unsigned');
}
function ArgInt(signed) {
    this.signed = signed;
    this.macro = 'Word';
    this.refsize = 4;
    this.literal = (signed ? 'arg_int_signed' : 'arg_int_unsigned');
}
function ArgClass(name) {
    this.name = name;
    this.macro = 'Word';
    this.refsize = 4;
}
function ArgStruct(form) {
    this.form = form;
}
function ArgRef(arg, passin, passout, nonnull) {
    this.arg = arg;
    this.passin = passin;
    this.passout = passout;
    this.nonnull = nonnull;
}
function ArgArray(arg, retained, passin, passout, nonnull) {
    this.arg = arg;
    this.retained = retained;
    this.passin = passin;
    this.passout = passout;
    this.nonnull = nonnull;
}

/* Some literal ArgInt and ArgChar objects, used when registering
   retained arrays. */
var arg_int_unsigned = new ArgInt(false);
var arg_int_signed = new ArgInt(true);
var arg_char_unsigned = new ArgChar(false); /* also used for "native" */
var arg_char_signed = new ArgChar(true);

// The following table is auto-generated by parse_dispatch.py.
var proto_map = {
// 1 exit 0:
1 : new FuncSpec(1, "exit", new Prototype([], null)),
// 3 tick 0:
3 : new FuncSpec(3, "tick", new Prototype([], null)),
// 4 gestalt 3IuIu:Iu
4 : new FuncSpec(4, "gestalt", new Prototype([new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 5 gestalt_ext 4IuIu&#Iu:Iu
5 : new FuncSpec(5, "gestalt_ext", new Prototype([new ArgInt(false), new ArgInt(false), new ArgArray(new ArgInt(false), false, true, true, false)], new ArgRef(new ArgInt(false), false, true, true))),
// 32 window_iterate 3Qa<Iu:Qa
32 : new FuncSpec(32, "window_iterate", new Prototype([new ArgClass("window"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("window"), false, true, true))),
// 33 window_get_rock 2Qa:Iu
33 : new FuncSpec(33, "window_get_rock", new Prototype([new ArgClass("window")], new ArgRef(new ArgInt(false), false, true, true))),
// 34 window_get_root 1:Qa
34 : new FuncSpec(34, "window_get_root", new Prototype([], new ArgRef(new ArgClass("window"), false, true, true))),
// 35 window_open 6QaIuIuIuIu:Qa
35 : new FuncSpec(35, "window_open", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("window"), false, true, true))),
// 36 window_close 2Qa<[2IuIu]:
36 : new FuncSpec(36, "window_close", new Prototype([new ArgClass("window"), new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgInt(false)], null)), false, true, false)], null)),
// 37 window_get_size 3Qa<Iu<Iu:
37 : new FuncSpec(37, "window_get_size", new Prototype([new ArgClass("window"), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgInt(false), false, true, false)], null)),
// 38 window_set_arrangement 4QaIuIuQa:
38 : new FuncSpec(38, "window_set_arrangement", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false), new ArgClass("window")], null)),
// 39 window_get_arrangement 4Qa<Iu<Iu<Qa:
39 : new FuncSpec(39, "window_get_arrangement", new Prototype([new ArgClass("window"), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgClass("window"), false, true, false)], null)),
// 40 window_get_type 2Qa:Iu
40 : new FuncSpec(40, "window_get_type", new Prototype([new ArgClass("window")], new ArgRef(new ArgInt(false), false, true, true))),
// 41 window_get_parent 2Qa:Qa
41 : new FuncSpec(41, "window_get_parent", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("window"), false, true, true))),
// 42 window_clear 1Qa:
42 : new FuncSpec(42, "window_clear", new Prototype([new ArgClass("window")], null)),
// 43 window_move_cursor 3QaIuIu:
43 : new FuncSpec(43, "window_move_cursor", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)),
// 44 window_get_stream 2Qa:Qb
44 : new FuncSpec(44, "window_get_stream", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("stream"), false, true, true))),
// 45 window_set_echo_stream 2QaQb:
45 : new FuncSpec(45, "window_set_echo_stream", new Prototype([new ArgClass("window"), new ArgClass("stream")], null)),
// 46 window_get_echo_stream 2Qa:Qb
46 : new FuncSpec(46, "window_get_echo_stream", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("stream"), false, true, true))),
// 47 set_window 1Qa:
47 : new FuncSpec(47, "set_window", new Prototype([new ArgClass("window")], null)),
// 48 window_get_sibling 2Qa:Qa
48 : new FuncSpec(48, "window_get_sibling", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("window"), false, true, true))),
// 64 stream_iterate 3Qb<Iu:Qb
64 : new FuncSpec(64, "stream_iterate", new Prototype([new ArgClass("stream"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 65 stream_get_rock 2Qb:Iu
65 : new FuncSpec(65, "stream_get_rock", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(false), false, true, true))),
// 66 stream_open_file 4QcIuIu:Qb
66 : new FuncSpec(66, "stream_open_file", new Prototype([new ArgClass("fileref"), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 67 stream_open_memory 4&+#!CnIuIu:Qb
67 : new FuncSpec(67, "stream_open_memory", new Prototype([new ArgArray(new ArgChar(null), true, true, true, true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 68 stream_close 2Qb<[2IuIu]:
68 : new FuncSpec(68, "stream_close", new Prototype([new ArgClass("stream"), new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgInt(false)], null)), false, true, false)], null)),
// 69 stream_set_position 3QbIsIu:
69 : new FuncSpec(69, "stream_set_position", new Prototype([new ArgClass("stream"), new ArgInt(true), new ArgInt(false)], null)),
// 70 stream_get_position 2Qb:Iu
70 : new FuncSpec(70, "stream_get_position", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(false), false, true, true))),
// 71 stream_set_current 1Qb:
71 : new FuncSpec(71, "stream_set_current", new Prototype([new ArgClass("stream")], null)),
// 72 stream_get_current 1:Qb
72 : new FuncSpec(72, "stream_get_current", new Prototype([], new ArgRef(new ArgClass("stream"), false, true, true))),
// 96 fileref_create_temp 3IuIu:Qc
96 : new FuncSpec(96, "fileref_create_temp", new Prototype([new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 97 fileref_create_by_name 4IuSIu:Qc
97 : new FuncSpec(97, "fileref_create_by_name", new Prototype([new ArgInt(false), new ArgString(), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 98 fileref_create_by_prompt 4IuIuIu:Qc
98 : new FuncSpec(98, "fileref_create_by_prompt", new Prototype([new ArgInt(false), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 99 fileref_destroy 1Qc:
99 : new FuncSpec(99, "fileref_destroy", new Prototype([new ArgClass("fileref")], null)),
// 100 fileref_iterate 3Qc<Iu:Qc
100 : new FuncSpec(100, "fileref_iterate", new Prototype([new ArgClass("fileref"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 101 fileref_get_rock 2Qc:Iu
101 : new FuncSpec(101, "fileref_get_rock", new Prototype([new ArgClass("fileref")], new ArgRef(new ArgInt(false), false, true, true))),
// 102 fileref_delete_file 1Qc:
102 : new FuncSpec(102, "fileref_delete_file", new Prototype([new ArgClass("fileref")], null)),
// 103 fileref_does_file_exist 2Qc:Iu
103 : new FuncSpec(103, "fileref_does_file_exist", new Prototype([new ArgClass("fileref")], new ArgRef(new ArgInt(false), false, true, true))),
// 104 fileref_create_from_fileref 4IuQcIu:Qc
104 : new FuncSpec(104, "fileref_create_from_fileref", new Prototype([new ArgInt(false), new ArgClass("fileref"), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 128 put_char 1Cu:
128 : new FuncSpec(128, "put_char", new Prototype([new ArgChar(false)], null)),
// 129 put_char_stream 2QbCu:
129 : new FuncSpec(129, "put_char_stream", new Prototype([new ArgClass("stream"), new ArgChar(false)], null)),
// 130 put_string 1S:
130 : new FuncSpec(130, "put_string", new Prototype([new ArgString()], null)),
// 131 put_string_stream 2QbS:
131 : new FuncSpec(131, "put_string_stream", new Prototype([new ArgClass("stream"), new ArgString()], null)),
// 132 put_buffer 1>+#Cn:
132 : new FuncSpec(132, "put_buffer", new Prototype([new ArgArray(new ArgChar(null), false, true, false, true)], null)),
// 133 put_buffer_stream 2Qb>+#Cn:
133 : new FuncSpec(133, "put_buffer_stream", new Prototype([new ArgClass("stream"), new ArgArray(new ArgChar(null), false, true, false, true)], null)),
// 134 set_style 1Iu:
134 : new FuncSpec(134, "set_style", new Prototype([new ArgInt(false)], null)),
// 135 set_style_stream 2QbIu:
135 : new FuncSpec(135, "set_style_stream", new Prototype([new ArgClass("stream"), new ArgInt(false)], null)),
// 144 get_char_stream 2Qb:Is
144 : new FuncSpec(144, "get_char_stream", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(true), false, true, true))),
// 145 get_line_stream 3Qb<+#Cn:Iu
145 : new FuncSpec(145, "get_line_stream", new Prototype([new ArgClass("stream"), new ArgArray(new ArgChar(null), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 146 get_buffer_stream 3Qb<+#Cn:Iu
146 : new FuncSpec(146, "get_buffer_stream", new Prototype([new ArgClass("stream"), new ArgArray(new ArgChar(null), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 160 char_to_lower 2Cu:Cu
160 : new FuncSpec(160, "char_to_lower", new Prototype([new ArgChar(false)], new ArgRef(new ArgChar(false), false, true, true))),
// 161 char_to_upper 2Cu:Cu
161 : new FuncSpec(161, "char_to_upper", new Prototype([new ArgChar(false)], new ArgRef(new ArgChar(false), false, true, true))),
// 176 stylehint_set 4IuIuIuIs:
176 : new FuncSpec(176, "stylehint_set", new Prototype([new ArgInt(false), new ArgInt(false), new ArgInt(false), new ArgInt(true)], null)),
// 177 stylehint_clear 3IuIuIu:
177 : new FuncSpec(177, "stylehint_clear", new Prototype([new ArgInt(false), new ArgInt(false), new ArgInt(false)], null)),
// 178 style_distinguish 4QaIuIu:Iu
178 : new FuncSpec(178, "style_distinguish", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 179 style_measure 5QaIuIu<Iu:Iu
179 : new FuncSpec(179, "style_measure", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgInt(false), false, true, true))),
// 192 select 1<+[4IuQaIuIu]:
192 : new FuncSpec(192, "select", new Prototype([new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)), false, true, true)], null)),
// 193 select_poll 1<+[4IuQaIuIu]:
193 : new FuncSpec(193, "select_poll", new Prototype([new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)), false, true, true)], null)),
// 208 request_line_event 3Qa&+#!CnIu:
208 : new FuncSpec(208, "request_line_event", new Prototype([new ArgClass("window"), new ArgArray(new ArgChar(null), true, true, true, true), new ArgInt(false)], null)),
// 209 cancel_line_event 2Qa<[4IuQaIuIu]:
209 : new FuncSpec(209, "cancel_line_event", new Prototype([new ArgClass("window"), new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)), false, true, false)], null)),
// 210 request_char_event 1Qa:
210 : new FuncSpec(210, "request_char_event", new Prototype([new ArgClass("window")], null)),
// 211 cancel_char_event 1Qa:
211 : new FuncSpec(211, "cancel_char_event", new Prototype([new ArgClass("window")], null)),
// 212 request_mouse_event 1Qa:
212 : new FuncSpec(212, "request_mouse_event", new Prototype([new ArgClass("window")], null)),
// 213 cancel_mouse_event 1Qa:
213 : new FuncSpec(213, "cancel_mouse_event", new Prototype([new ArgClass("window")], null)),
// 214 request_timer_events 1Iu:
214 : new FuncSpec(214, "request_timer_events", new Prototype([new ArgInt(false)], null)),
// 224 image_get_info 4Iu<Iu<Iu:Iu
224 : new FuncSpec(224, "image_get_info", new Prototype([new ArgInt(false), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgInt(false), false, true, true))),
// 225 image_draw 5QaIuIsIs:Iu
225 : new FuncSpec(225, "image_draw", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(true), new ArgInt(true)], new ArgRef(new ArgInt(false), false, true, true))),
// 226 image_draw_scaled 7QaIuIsIsIuIu:Iu
226 : new FuncSpec(226, "image_draw_scaled", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(true), new ArgInt(true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 232 window_flow_break 1Qa:
232 : new FuncSpec(232, "window_flow_break", new Prototype([new ArgClass("window")], null)),
// 233 window_erase_rect 5QaIsIsIuIu:
233 : new FuncSpec(233, "window_erase_rect", new Prototype([new ArgClass("window"), new ArgInt(true), new ArgInt(true), new ArgInt(false), new ArgInt(false)], null)),
// 234 window_fill_rect 6QaIuIsIsIuIu:
234 : new FuncSpec(234, "window_fill_rect", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(true), new ArgInt(true), new ArgInt(false), new ArgInt(false)], null)),
// 235 window_set_background_color 2QaIu:
235 : new FuncSpec(235, "window_set_background_color", new Prototype([new ArgClass("window"), new ArgInt(false)], null)),
// 240 schannel_iterate 3Qd<Iu:Qd
240 : new FuncSpec(240, "schannel_iterate", new Prototype([new ArgClass("schannel"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("schannel"), false, true, true))),
// 241 schannel_get_rock 2Qd:Iu
241 : new FuncSpec(241, "schannel_get_rock", new Prototype([new ArgClass("schannel")], new ArgRef(new ArgInt(false), false, true, true))),
// 242 schannel_create 2Iu:Qd
242 : new FuncSpec(242, "schannel_create", new Prototype([new ArgInt(false)], new ArgRef(new ArgClass("schannel"), false, true, true))),
// 243 schannel_destroy 1Qd:
243 : new FuncSpec(243, "schannel_destroy", new Prototype([new ArgClass("schannel")], null)),
// 248 schannel_play 3QdIu:Iu
248 : new FuncSpec(248, "schannel_play", new Prototype([new ArgClass("schannel"), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 249 schannel_play_ext 5QdIuIuIu:Iu
249 : new FuncSpec(249, "schannel_play_ext", new Prototype([new ArgClass("schannel"), new ArgInt(false), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 250 schannel_stop 1Qd:
250 : new FuncSpec(250, "schannel_stop", new Prototype([new ArgClass("schannel")], null)),
// 251 schannel_set_volume 2QdIu:
251 : new FuncSpec(251, "schannel_set_volume", new Prototype([new ArgClass("schannel"), new ArgInt(false)], null)),
// 252 sound_load_hint 2IuIu:
252 : new FuncSpec(252, "sound_load_hint", new Prototype([new ArgInt(false), new ArgInt(false)], null)),
// 256 set_hyperlink 1Iu:
256 : new FuncSpec(256, "set_hyperlink", new Prototype([new ArgInt(false)], null)),
// 257 set_hyperlink_stream 2QbIu:
257 : new FuncSpec(257, "set_hyperlink_stream", new Prototype([new ArgClass("stream"), new ArgInt(false)], null)),
// 258 request_hyperlink_event 1Qa:
258 : new FuncSpec(258, "request_hyperlink_event", new Prototype([new ArgClass("window")], null)),
// 259 cancel_hyperlink_event 1Qa:
259 : new FuncSpec(259, "cancel_hyperlink_event", new Prototype([new ArgClass("window")], null)),
// 288 buffer_to_lower_case_uni 3&+#IuIu:Iu
288 : new FuncSpec(288, "buffer_to_lower_case_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, true, true), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 289 buffer_to_upper_case_uni 3&+#IuIu:Iu
289 : new FuncSpec(289, "buffer_to_upper_case_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, true, true), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 290 buffer_to_title_case_uni 4&+#IuIuIu:Iu
290 : new FuncSpec(290, "buffer_to_title_case_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, true, true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 296 put_char_uni 1Iu:
296 : new FuncSpec(296, "put_char_uni", new Prototype([new ArgInt(false)], null)),
// 297 put_string_uni 1U:
297 : new FuncSpec(297, "put_string_uni", new Prototype([new ArgUnicode()], null)),
// 298 put_buffer_uni 1>+#Iu:
298 : new FuncSpec(298, "put_buffer_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, false, true)], null)),
// 299 put_char_stream_uni 2QbIu:
299 : new FuncSpec(299, "put_char_stream_uni", new Prototype([new ArgClass("stream"), new ArgInt(false)], null)),
// 300 put_string_stream_uni 2QbU:
300 : new FuncSpec(300, "put_string_stream_uni", new Prototype([new ArgClass("stream"), new ArgUnicode()], null)),
// 301 put_buffer_stream_uni 2Qb>+#Iu:
301 : new FuncSpec(301, "put_buffer_stream_uni", new Prototype([new ArgClass("stream"), new ArgArray(new ArgInt(false), false, true, false, true)], null)),
// 304 get_char_stream_uni 2Qb:Is
304 : new FuncSpec(304, "get_char_stream_uni", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(true), false, true, true))),
// 305 get_buffer_stream_uni 3Qb<+#Iu:Iu
305 : new FuncSpec(305, "get_buffer_stream_uni", new Prototype([new ArgClass("stream"), new ArgArray(new ArgInt(false), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 306 get_line_stream_uni 3Qb<+#Iu:Iu
306 : new FuncSpec(306, "get_line_stream_uni", new Prototype([new ArgClass("stream"), new ArgArray(new ArgInt(false), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 312 stream_open_file_uni 4QcIuIu:Qb
312 : new FuncSpec(312, "stream_open_file_uni", new Prototype([new ArgClass("fileref"), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 313 stream_open_memory_uni 4&+#!IuIuIu:Qb
313 : new FuncSpec(313, "stream_open_memory_uni", new Prototype([new ArgArray(new ArgInt(false), true, true, true, true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 320 request_char_event_uni 1Qa:
320 : new FuncSpec(320, "request_char_event_uni", new Prototype([new ArgClass("window")], null)),
// 321 request_line_event_uni 3Qa&+#!IuIu:
321 : new FuncSpec(321, "request_line_event_uni", new Prototype([new ArgClass("window"), new ArgArray(new ArgInt(false), true, true, true, true), new ArgInt(false)], null)),
};
// End of auto-generated table.



/* Log the message in the browser's error log, if it has one. (This shows
   up in Safari, in Opera, and in Firefox if you have Firebug installed.)
*/
function qlog(msg) {
    if (window.console && console.log)
        console.log(msg);
    else if (window.opera && opera.postError)
        opera.postError(msg);
}
<commit_msg>Better comments in gi_dispa.js. (Glk call numbers are now listed in both decimal and hex.)<commit_after>GiDispa = function() {

//### Should split WriteWord into a WriteRefWord and WriteArrayWord,
//### with different handling of -1. Etc.

/* The VM interface object. GiDispa needs this to load and store reference
   arguments, from and to VM memory. */
var VM = null;

/* Set the VM interface object. This is called by the Glk library, before
   the VM starts running. 
*/
function set_vm(vm_api) {
    VM = vm_api;
}

/* A table of the Glk classes, and their index numbers. This is derived from
   gi_dispa.c, although it's too simple to bother auto-generating.
*/
var class_defs = {
    0: 'window',
    1: 'stream',
    2: 'fileref',
    3: 'schannel',
};

/* FuncSpec is a data representation of a Glk function's prototype.
   The table of FuncSpecs is generated, ultimately, from the Glk
   prototype description strings in gi_dispa.c.
*/
function FuncSpec(id, name, proto) {
    this.id = id;
    this.name = name;
    this.proto = proto;
}

/* A bunch of data classes, used by FuncSpec. */

function Prototype(args, retarg) {
    this.args = args;
    this.retarg = retarg;
}
function ArgString() { 
    this.macro = 'Byte';
    this.refsize = 1;
}
function ArgUnicode() { 
    this.macro = 'Word';
    this.refsize = 4;
}
function ArgChar(signed) {
    this.signed = signed;
    this.macro = 'Byte';
    this.refsize = 1;
    this.literal = (signed ? 'arg_char_signed' : 'arg_char_unsigned');
}
function ArgInt(signed) {
    this.signed = signed;
    this.macro = 'Word';
    this.refsize = 4;
    this.literal = (signed ? 'arg_int_signed' : 'arg_int_unsigned');
}
function ArgClass(name) {
    this.name = name;
    this.macro = 'Word';
    this.refsize = 4;
}
function ArgStruct(form) {
    this.form = form;
}
function ArgRef(arg, passin, passout, nonnull) {
    this.arg = arg;
    this.passin = passin;
    this.passout = passout;
    this.nonnull = nonnull;
}
function ArgArray(arg, retained, passin, passout, nonnull) {
    this.arg = arg;
    this.retained = retained;
    this.passin = passin;
    this.passout = passout;
    this.nonnull = nonnull;
}

/* Some literal ArgInt and ArgChar objects, used when registering
   retained arrays. */
var arg_int_unsigned = new ArgInt(false);
var arg_int_signed = new ArgInt(true);
var arg_char_unsigned = new ArgChar(false); /* also used for "native" */
var arg_char_signed = new ArgChar(true);

// The following table is auto-generated by parse_dispatch.py.
var proto_map = {
// 1 (0x001): exit - 0:
1 : new FuncSpec(1, "exit", new Prototype([], null)),
// 3 (0x003): tick - 0:
3 : new FuncSpec(3, "tick", new Prototype([], null)),
// 4 (0x004): gestalt - 3IuIu:Iu
4 : new FuncSpec(4, "gestalt", new Prototype([new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 5 (0x005): gestalt_ext - 4IuIu&#Iu:Iu
5 : new FuncSpec(5, "gestalt_ext", new Prototype([new ArgInt(false), new ArgInt(false), new ArgArray(new ArgInt(false), false, true, true, false)], new ArgRef(new ArgInt(false), false, true, true))),
// 32 (0x020): window_iterate - 3Qa<Iu:Qa
32 : new FuncSpec(32, "window_iterate", new Prototype([new ArgClass("window"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("window"), false, true, true))),
// 33 (0x021): window_get_rock - 2Qa:Iu
33 : new FuncSpec(33, "window_get_rock", new Prototype([new ArgClass("window")], new ArgRef(new ArgInt(false), false, true, true))),
// 34 (0x022): window_get_root - 1:Qa
34 : new FuncSpec(34, "window_get_root", new Prototype([], new ArgRef(new ArgClass("window"), false, true, true))),
// 35 (0x023): window_open - 6QaIuIuIuIu:Qa
35 : new FuncSpec(35, "window_open", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("window"), false, true, true))),
// 36 (0x024): window_close - 2Qa<[2IuIu]:
36 : new FuncSpec(36, "window_close", new Prototype([new ArgClass("window"), new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgInt(false)], null)), false, true, false)], null)),
// 37 (0x025): window_get_size - 3Qa<Iu<Iu:
37 : new FuncSpec(37, "window_get_size", new Prototype([new ArgClass("window"), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgInt(false), false, true, false)], null)),
// 38 (0x026): window_set_arrangement - 4QaIuIuQa:
38 : new FuncSpec(38, "window_set_arrangement", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false), new ArgClass("window")], null)),
// 39 (0x027): window_get_arrangement - 4Qa<Iu<Iu<Qa:
39 : new FuncSpec(39, "window_get_arrangement", new Prototype([new ArgClass("window"), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgClass("window"), false, true, false)], null)),
// 40 (0x028): window_get_type - 2Qa:Iu
40 : new FuncSpec(40, "window_get_type", new Prototype([new ArgClass("window")], new ArgRef(new ArgInt(false), false, true, true))),
// 41 (0x029): window_get_parent - 2Qa:Qa
41 : new FuncSpec(41, "window_get_parent", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("window"), false, true, true))),
// 42 (0x02A): window_clear - 1Qa:
42 : new FuncSpec(42, "window_clear", new Prototype([new ArgClass("window")], null)),
// 43 (0x02B): window_move_cursor - 3QaIuIu:
43 : new FuncSpec(43, "window_move_cursor", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)),
// 44 (0x02C): window_get_stream - 2Qa:Qb
44 : new FuncSpec(44, "window_get_stream", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("stream"), false, true, true))),
// 45 (0x02D): window_set_echo_stream - 2QaQb:
45 : new FuncSpec(45, "window_set_echo_stream", new Prototype([new ArgClass("window"), new ArgClass("stream")], null)),
// 46 (0x02E): window_get_echo_stream - 2Qa:Qb
46 : new FuncSpec(46, "window_get_echo_stream", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("stream"), false, true, true))),
// 47 (0x02F): set_window - 1Qa:
47 : new FuncSpec(47, "set_window", new Prototype([new ArgClass("window")], null)),
// 48 (0x030): window_get_sibling - 2Qa:Qa
48 : new FuncSpec(48, "window_get_sibling", new Prototype([new ArgClass("window")], new ArgRef(new ArgClass("window"), false, true, true))),
// 64 (0x040): stream_iterate - 3Qb<Iu:Qb
64 : new FuncSpec(64, "stream_iterate", new Prototype([new ArgClass("stream"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 65 (0x041): stream_get_rock - 2Qb:Iu
65 : new FuncSpec(65, "stream_get_rock", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(false), false, true, true))),
// 66 (0x042): stream_open_file - 4QcIuIu:Qb
66 : new FuncSpec(66, "stream_open_file", new Prototype([new ArgClass("fileref"), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 67 (0x043): stream_open_memory - 4&+#!CnIuIu:Qb
67 : new FuncSpec(67, "stream_open_memory", new Prototype([new ArgArray(new ArgChar(null), true, true, true, true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 68 (0x044): stream_close - 2Qb<[2IuIu]:
68 : new FuncSpec(68, "stream_close", new Prototype([new ArgClass("stream"), new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgInt(false)], null)), false, true, false)], null)),
// 69 (0x045): stream_set_position - 3QbIsIu:
69 : new FuncSpec(69, "stream_set_position", new Prototype([new ArgClass("stream"), new ArgInt(true), new ArgInt(false)], null)),
// 70 (0x046): stream_get_position - 2Qb:Iu
70 : new FuncSpec(70, "stream_get_position", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(false), false, true, true))),
// 71 (0x047): stream_set_current - 1Qb:
71 : new FuncSpec(71, "stream_set_current", new Prototype([new ArgClass("stream")], null)),
// 72 (0x048): stream_get_current - 1:Qb
72 : new FuncSpec(72, "stream_get_current", new Prototype([], new ArgRef(new ArgClass("stream"), false, true, true))),
// 96 (0x060): fileref_create_temp - 3IuIu:Qc
96 : new FuncSpec(96, "fileref_create_temp", new Prototype([new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 97 (0x061): fileref_create_by_name - 4IuSIu:Qc
97 : new FuncSpec(97, "fileref_create_by_name", new Prototype([new ArgInt(false), new ArgString(), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 98 (0x062): fileref_create_by_prompt - 4IuIuIu:Qc
98 : new FuncSpec(98, "fileref_create_by_prompt", new Prototype([new ArgInt(false), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 99 (0x063): fileref_destroy - 1Qc:
99 : new FuncSpec(99, "fileref_destroy", new Prototype([new ArgClass("fileref")], null)),
// 100 (0x064): fileref_iterate - 3Qc<Iu:Qc
100 : new FuncSpec(100, "fileref_iterate", new Prototype([new ArgClass("fileref"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 101 (0x065): fileref_get_rock - 2Qc:Iu
101 : new FuncSpec(101, "fileref_get_rock", new Prototype([new ArgClass("fileref")], new ArgRef(new ArgInt(false), false, true, true))),
// 102 (0x066): fileref_delete_file - 1Qc:
102 : new FuncSpec(102, "fileref_delete_file", new Prototype([new ArgClass("fileref")], null)),
// 103 (0x067): fileref_does_file_exist - 2Qc:Iu
103 : new FuncSpec(103, "fileref_does_file_exist", new Prototype([new ArgClass("fileref")], new ArgRef(new ArgInt(false), false, true, true))),
// 104 (0x068): fileref_create_from_fileref - 4IuQcIu:Qc
104 : new FuncSpec(104, "fileref_create_from_fileref", new Prototype([new ArgInt(false), new ArgClass("fileref"), new ArgInt(false)], new ArgRef(new ArgClass("fileref"), false, true, true))),
// 128 (0x080): put_char - 1Cu:
128 : new FuncSpec(128, "put_char", new Prototype([new ArgChar(false)], null)),
// 129 (0x081): put_char_stream - 2QbCu:
129 : new FuncSpec(129, "put_char_stream", new Prototype([new ArgClass("stream"), new ArgChar(false)], null)),
// 130 (0x082): put_string - 1S:
130 : new FuncSpec(130, "put_string", new Prototype([new ArgString()], null)),
// 131 (0x083): put_string_stream - 2QbS:
131 : new FuncSpec(131, "put_string_stream", new Prototype([new ArgClass("stream"), new ArgString()], null)),
// 132 (0x084): put_buffer - 1>+#Cn:
132 : new FuncSpec(132, "put_buffer", new Prototype([new ArgArray(new ArgChar(null), false, true, false, true)], null)),
// 133 (0x085): put_buffer_stream - 2Qb>+#Cn:
133 : new FuncSpec(133, "put_buffer_stream", new Prototype([new ArgClass("stream"), new ArgArray(new ArgChar(null), false, true, false, true)], null)),
// 134 (0x086): set_style - 1Iu:
134 : new FuncSpec(134, "set_style", new Prototype([new ArgInt(false)], null)),
// 135 (0x087): set_style_stream - 2QbIu:
135 : new FuncSpec(135, "set_style_stream", new Prototype([new ArgClass("stream"), new ArgInt(false)], null)),
// 144 (0x090): get_char_stream - 2Qb:Is
144 : new FuncSpec(144, "get_char_stream", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(true), false, true, true))),
// 145 (0x091): get_line_stream - 3Qb<+#Cn:Iu
145 : new FuncSpec(145, "get_line_stream", new Prototype([new ArgClass("stream"), new ArgArray(new ArgChar(null), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 146 (0x092): get_buffer_stream - 3Qb<+#Cn:Iu
146 : new FuncSpec(146, "get_buffer_stream", new Prototype([new ArgClass("stream"), new ArgArray(new ArgChar(null), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 160 (0x0A0): char_to_lower - 2Cu:Cu
160 : new FuncSpec(160, "char_to_lower", new Prototype([new ArgChar(false)], new ArgRef(new ArgChar(false), false, true, true))),
// 161 (0x0A1): char_to_upper - 2Cu:Cu
161 : new FuncSpec(161, "char_to_upper", new Prototype([new ArgChar(false)], new ArgRef(new ArgChar(false), false, true, true))),
// 176 (0x0B0): stylehint_set - 4IuIuIuIs:
176 : new FuncSpec(176, "stylehint_set", new Prototype([new ArgInt(false), new ArgInt(false), new ArgInt(false), new ArgInt(true)], null)),
// 177 (0x0B1): stylehint_clear - 3IuIuIu:
177 : new FuncSpec(177, "stylehint_clear", new Prototype([new ArgInt(false), new ArgInt(false), new ArgInt(false)], null)),
// 178 (0x0B2): style_distinguish - 4QaIuIu:Iu
178 : new FuncSpec(178, "style_distinguish", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 179 (0x0B3): style_measure - 5QaIuIu<Iu:Iu
179 : new FuncSpec(179, "style_measure", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(false), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgInt(false), false, true, true))),
// 192 (0x0C0): select - 1<+[4IuQaIuIu]:
192 : new FuncSpec(192, "select", new Prototype([new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)), false, true, true)], null)),
// 193 (0x0C1): select_poll - 1<+[4IuQaIuIu]:
193 : new FuncSpec(193, "select_poll", new Prototype([new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)), false, true, true)], null)),
// 208 (0x0D0): request_line_event - 3Qa&+#!CnIu:
208 : new FuncSpec(208, "request_line_event", new Prototype([new ArgClass("window"), new ArgArray(new ArgChar(null), true, true, true, true), new ArgInt(false)], null)),
// 209 (0x0D1): cancel_line_event - 2Qa<[4IuQaIuIu]:
209 : new FuncSpec(209, "cancel_line_event", new Prototype([new ArgClass("window"), new ArgRef(new ArgStruct(new Prototype([new ArgInt(false), new ArgClass("window"), new ArgInt(false), new ArgInt(false)], null)), false, true, false)], null)),
// 210 (0x0D2): request_char_event - 1Qa:
210 : new FuncSpec(210, "request_char_event", new Prototype([new ArgClass("window")], null)),
// 211 (0x0D3): cancel_char_event - 1Qa:
211 : new FuncSpec(211, "cancel_char_event", new Prototype([new ArgClass("window")], null)),
// 212 (0x0D4): request_mouse_event - 1Qa:
212 : new FuncSpec(212, "request_mouse_event", new Prototype([new ArgClass("window")], null)),
// 213 (0x0D5): cancel_mouse_event - 1Qa:
213 : new FuncSpec(213, "cancel_mouse_event", new Prototype([new ArgClass("window")], null)),
// 214 (0x0D6): request_timer_events - 1Iu:
214 : new FuncSpec(214, "request_timer_events", new Prototype([new ArgInt(false)], null)),
// 224 (0x0E0): image_get_info - 4Iu<Iu<Iu:Iu
224 : new FuncSpec(224, "image_get_info", new Prototype([new ArgInt(false), new ArgRef(new ArgInt(false), false, true, false), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgInt(false), false, true, true))),
// 225 (0x0E1): image_draw - 5QaIuIsIs:Iu
225 : new FuncSpec(225, "image_draw", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(true), new ArgInt(true)], new ArgRef(new ArgInt(false), false, true, true))),
// 226 (0x0E2): image_draw_scaled - 7QaIuIsIsIuIu:Iu
226 : new FuncSpec(226, "image_draw_scaled", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(true), new ArgInt(true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 232 (0x0E8): window_flow_break - 1Qa:
232 : new FuncSpec(232, "window_flow_break", new Prototype([new ArgClass("window")], null)),
// 233 (0x0E9): window_erase_rect - 5QaIsIsIuIu:
233 : new FuncSpec(233, "window_erase_rect", new Prototype([new ArgClass("window"), new ArgInt(true), new ArgInt(true), new ArgInt(false), new ArgInt(false)], null)),
// 234 (0x0EA): window_fill_rect - 6QaIuIsIsIuIu:
234 : new FuncSpec(234, "window_fill_rect", new Prototype([new ArgClass("window"), new ArgInt(false), new ArgInt(true), new ArgInt(true), new ArgInt(false), new ArgInt(false)], null)),
// 235 (0x0EB): window_set_background_color - 2QaIu:
235 : new FuncSpec(235, "window_set_background_color", new Prototype([new ArgClass("window"), new ArgInt(false)], null)),
// 240 (0x0F0): schannel_iterate - 3Qd<Iu:Qd
240 : new FuncSpec(240, "schannel_iterate", new Prototype([new ArgClass("schannel"), new ArgRef(new ArgInt(false), false, true, false)], new ArgRef(new ArgClass("schannel"), false, true, true))),
// 241 (0x0F1): schannel_get_rock - 2Qd:Iu
241 : new FuncSpec(241, "schannel_get_rock", new Prototype([new ArgClass("schannel")], new ArgRef(new ArgInt(false), false, true, true))),
// 242 (0x0F2): schannel_create - 2Iu:Qd
242 : new FuncSpec(242, "schannel_create", new Prototype([new ArgInt(false)], new ArgRef(new ArgClass("schannel"), false, true, true))),
// 243 (0x0F3): schannel_destroy - 1Qd:
243 : new FuncSpec(243, "schannel_destroy", new Prototype([new ArgClass("schannel")], null)),
// 248 (0x0F8): schannel_play - 3QdIu:Iu
248 : new FuncSpec(248, "schannel_play", new Prototype([new ArgClass("schannel"), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 249 (0x0F9): schannel_play_ext - 5QdIuIuIu:Iu
249 : new FuncSpec(249, "schannel_play_ext", new Prototype([new ArgClass("schannel"), new ArgInt(false), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 250 (0x0FA): schannel_stop - 1Qd:
250 : new FuncSpec(250, "schannel_stop", new Prototype([new ArgClass("schannel")], null)),
// 251 (0x0FB): schannel_set_volume - 2QdIu:
251 : new FuncSpec(251, "schannel_set_volume", new Prototype([new ArgClass("schannel"), new ArgInt(false)], null)),
// 252 (0x0FC): sound_load_hint - 2IuIu:
252 : new FuncSpec(252, "sound_load_hint", new Prototype([new ArgInt(false), new ArgInt(false)], null)),
// 256 (0x100): set_hyperlink - 1Iu:
256 : new FuncSpec(256, "set_hyperlink", new Prototype([new ArgInt(false)], null)),
// 257 (0x101): set_hyperlink_stream - 2QbIu:
257 : new FuncSpec(257, "set_hyperlink_stream", new Prototype([new ArgClass("stream"), new ArgInt(false)], null)),
// 258 (0x102): request_hyperlink_event - 1Qa:
258 : new FuncSpec(258, "request_hyperlink_event", new Prototype([new ArgClass("window")], null)),
// 259 (0x103): cancel_hyperlink_event - 1Qa:
259 : new FuncSpec(259, "cancel_hyperlink_event", new Prototype([new ArgClass("window")], null)),
// 288 (0x120): buffer_to_lower_case_uni - 3&+#IuIu:Iu
288 : new FuncSpec(288, "buffer_to_lower_case_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, true, true), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 289 (0x121): buffer_to_upper_case_uni - 3&+#IuIu:Iu
289 : new FuncSpec(289, "buffer_to_upper_case_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, true, true), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 290 (0x122): buffer_to_title_case_uni - 4&+#IuIuIu:Iu
290 : new FuncSpec(290, "buffer_to_title_case_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, true, true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgInt(false), false, true, true))),
// 296 (0x128): put_char_uni - 1Iu:
296 : new FuncSpec(296, "put_char_uni", new Prototype([new ArgInt(false)], null)),
// 297 (0x129): put_string_uni - 1U:
297 : new FuncSpec(297, "put_string_uni", new Prototype([new ArgUnicode()], null)),
// 298 (0x12A): put_buffer_uni - 1>+#Iu:
298 : new FuncSpec(298, "put_buffer_uni", new Prototype([new ArgArray(new ArgInt(false), false, true, false, true)], null)),
// 299 (0x12B): put_char_stream_uni - 2QbIu:
299 : new FuncSpec(299, "put_char_stream_uni", new Prototype([new ArgClass("stream"), new ArgInt(false)], null)),
// 300 (0x12C): put_string_stream_uni - 2QbU:
300 : new FuncSpec(300, "put_string_stream_uni", new Prototype([new ArgClass("stream"), new ArgUnicode()], null)),
// 301 (0x12D): put_buffer_stream_uni - 2Qb>+#Iu:
301 : new FuncSpec(301, "put_buffer_stream_uni", new Prototype([new ArgClass("stream"), new ArgArray(new ArgInt(false), false, true, false, true)], null)),
// 304 (0x130): get_char_stream_uni - 2Qb:Is
304 : new FuncSpec(304, "get_char_stream_uni", new Prototype([new ArgClass("stream")], new ArgRef(new ArgInt(true), false, true, true))),
// 305 (0x131): get_buffer_stream_uni - 3Qb<+#Iu:Iu
305 : new FuncSpec(305, "get_buffer_stream_uni", new Prototype([new ArgClass("stream"), new ArgArray(new ArgInt(false), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 306 (0x132): get_line_stream_uni - 3Qb<+#Iu:Iu
306 : new FuncSpec(306, "get_line_stream_uni", new Prototype([new ArgClass("stream"), new ArgArray(new ArgInt(false), false, false, true, true)], new ArgRef(new ArgInt(false), false, true, true))),
// 312 (0x138): stream_open_file_uni - 4QcIuIu:Qb
312 : new FuncSpec(312, "stream_open_file_uni", new Prototype([new ArgClass("fileref"), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 313 (0x139): stream_open_memory_uni - 4&+#!IuIuIu:Qb
313 : new FuncSpec(313, "stream_open_memory_uni", new Prototype([new ArgArray(new ArgInt(false), true, true, true, true), new ArgInt(false), new ArgInt(false)], new ArgRef(new ArgClass("stream"), false, true, true))),
// 320 (0x140): request_char_event_uni - 1Qa:
320 : new FuncSpec(320, "request_char_event_uni", new Prototype([new ArgClass("window")], null)),
// 321 (0x141): request_line_event_uni - 3Qa&+#!IuIu:
321 : new FuncSpec(321, "request_line_event_uni", new Prototype([new ArgClass("window"), new ArgArray(new ArgInt(false), true, true, true, true), new ArgInt(false)], null)),
};
// End of auto-generated table.



/* Log the message in the browser's error log, if it has one. (This shows
   up in Safari, in Opera, and in Firefox if you have Firebug installed.)
*/
function qlog(msg) {
    if (window.console && console.log)
        console.log(msg);
    else if (window.opera && opera.postError)
        opera.postError(msg);
}

{'fraction_non_alphanumeric': 0.16295414214999532, 'fraction_numerical': 0.05090127953675166, 'mean_word_length': 6.226084022270963, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7165307', 'n_tokens_mistral': 16976, 'n_tokens_neox': 15154, 'n_words': 4159}