Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jscoq-light
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Rousselin
jscoq-light
Commits
34f1290b
Commit
34f1290b
authored
2 years ago
by
Shachar Itzhaky
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix] `Marshal` stub went out of sync with jsoo.
Updated to reflect current implementation. Fixes #267.
parent
42917140
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
coq-js/js_stub/marshal64.js
+29
-28
29 additions, 28 deletions
coq-js/js_stub/marshal64.js
with
29 additions
and
28 deletions
coq-js/js_stub/marshal64.js
+
29
−
28
View file @
34f1290b
...
...
@@ -21,7 +21,7 @@
//Provides: caml_input_value_from_reader mutable
//Requires: caml_failwith
//Requires: caml_float_of_bytes, caml_
int64_of_byte
s
//Requires: caml_float_of_bytes, caml_
custom_op
s
/*** !!! This overrides the implementation from js_of_ocaml !!! ***/
...
...
@@ -123,7 +123,7 @@ function caml_input_value_from_reader(reader, ofs) {
var
len
=
reader
.
read8u
();
var
v
=
new
Array
(
len
+
1
);
v
[
0
]
=
254
;
var
t
=
new
Array
(
8
);
var
t
=
new
Array
(
8
);
;
if
(
intern_obj_table
)
intern_obj_table
[
obj_counter
++
]
=
v
;
for
(
var
i
=
1
;
i
<=
len
;
i
++
)
{
for
(
var
j
=
0
;
j
<
8
;
j
++
)
t
[
j
]
=
reader
.
read8u
();
...
...
@@ -156,36 +156,37 @@ function caml_input_value_from_reader(reader, ofs) {
caml_failwith
(
"
input_value: code pointer
"
);
break
;
case
0x12
:
//cst.CODE_CUSTOM:
case
0x18
:
//cst.CODE_CUSTOM_LEN:
case
0x19
:
//cst.CODE_CUSTOM_FIXED:
var
c
,
s
=
""
;
while
((
c
=
reader
.
read8u
())
!=
0
)
s
+=
String
.
fromCharCode
(
c
);
switch
(
s
)
{
case
"
_j
"
:
// Int64
var
t
=
new
Array
(
8
);;
for
(
var
j
=
0
;
j
<
8
;
j
++
)
t
[
j
]
=
reader
.
read8u
();
var
v
=
caml_int64_of_bytes
(
t
);
if
(
intern_obj_table
)
intern_obj_table
[
obj_counter
++
]
=
v
;
return
v
;
case
"
_i
"
:
// Int32
var
v
=
reader
.
read32s
();
if
(
intern_obj_table
)
intern_obj_table
[
obj_counter
++
]
=
v
;
return
v
;
case
"
_n
"
:
// Nativeint
switch
(
reader
.
read8u
())
{
case
1
:
var
v
=
reader
.
read32s
();
if
(
intern_obj_table
)
intern_obj_table
[
obj_counter
++
]
=
v
;
return
v
;
case
2
:
caml_failwith
(
"
input_value: native integer value too large
"
);
default
:
caml_failwith
(
"
input_value: ill-formed native integer
"
);
}
default
:
var
ops
=
caml_custom_ops
[
s
];
var
expected_size
;
if
(
!
ops
)
caml_failwith
(
"
input_value: unknown custom block identifier
"
);
switch
(
code
){
case
0x12
:
// cst.CODE_CUSTOM (deprecated)
break
;
case
0x19
:
// cst.CODE_CUSTOM_FIXED
if
(
!
ops
.
fixed_length
)
caml_failwith
(
"
input_value: expected a fixed-size custom block
"
);
expected_size
=
ops
.
fixed_length
;
break
;
case
0x18
:
// cst.CODE_CUSTOM_LEN
expected_size
=
reader
.
read32u
();
// Skip size64
reader
.
read32s
();
reader
.
read32s
();
break
;
}
var
old_pos
=
reader
.
i
;
var
size
=
[
0
];
var
v
=
ops
.
deserialize
(
reader
,
size
);
if
(
expected_size
!=
undefined
){
if
(
expected_size
!=
size
[
0
])
caml_failwith
(
"
input_value: incorrect length of serialized custom block
"
);
}
if
(
intern_obj_table
)
intern_obj_table
[
obj_counter
++
]
=
v
;
return
v
;
default
:
caml_failwith
(
"
input_value: ill-formed message
"
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment