Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsexplain
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
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
Verified Software
jsexplain
Commits
f0ab3550
Commit
f0ab3550
authored
9 years ago
by
charguer
Committed by
Thomas Wood
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ctx
parent
74590aa5
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
interp.js
+0
-2
0 additions, 2 deletions
interp.js
navig.html
+14
-4
14 additions, 4 deletions
navig.html
navig.js
+50
-3
50 additions, 3 deletions
navig.js
with
64 additions
and
9 deletions
interp.js
+
0
−
2
View file @
f0ab3550
...
@@ -482,8 +482,6 @@ function jsvalue_of_value(jsheap, v) {
...
@@ -482,8 +482,6 @@ function jsvalue_of_value(jsheap, v) {
return
jsheap
[
v
.
loc
];
return
jsheap
[
v
.
loc
];
case
"
val_abs
"
:
case
"
val_abs
"
:
return
"
<closure>
"
;
return
"
<closure>
"
;
// case "val_constr":
// case "val_record":
default
:
default
:
stuck
(
"
unrecognized value
"
);
stuck
(
"
unrecognized value
"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
navig.html
+
14
−
4
View file @
f0ab3550
...
@@ -19,6 +19,10 @@
...
@@ -19,6 +19,10 @@
border-bottom
:
1px
solid
black
;
border-bottom
:
1px
solid
black
;
}
}
.heap_link
{
color
:
black
;
}
#file_list
{
#file_list
{
height
:
1em
;
height
:
1em
;
margin-top
:
8px
;
margin-top
:
8px
;
...
@@ -90,11 +94,17 @@ Reach condition:
...
@@ -90,11 +94,17 @@ Reach condition:
<div
id=
'file_list'
></div>
<div
id=
'file_list'
></div>
<div
class=
'source_div'
>
<div
class=
'source_div'
>
<table
id=
'main_table'
>
<table
id=
'main_table'
><tr>
<tr>
<td>
<td><textarea
id=
'interpreter_code'
class=
'source'
rows=
'20'
cols=
'60'
></textarea></td>
<textarea
id=
'interpreter_code'
class=
'source'
rows=
'20'
cols=
'60'
></textarea>
<td
width=
'600'
><div
id=
'infos'
>
infos here
</div>
</td>
<td
width=
'600'
>
<div
id=
'disp_infos'
style=
"height:1em"
>
infos here
</div>
<div
id=
'disp_context'
>
ctx here
</div>
</td>
</td>
</tr></table>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
navig.js
+
50
−
3
View file @
f0ab3550
...
@@ -3,7 +3,7 @@ tracer_items = datalog;
...
@@ -3,7 +3,7 @@ tracer_items = datalog;
var
h
=
null
var
h
=
null
var
tracer_length
=
tracer_items
.
length
;
var
tracer_length
=
tracer_items
.
length
;
var
tracer_pos
=
0
;
var
tracer_pos
=
29
;
$
(
"
#navigation_total
"
).
html
(
tracer_length
);
$
(
"
#navigation_total
"
).
html
(
tracer_length
);
...
@@ -129,6 +129,52 @@ function updateFileList() {
...
@@ -129,6 +129,52 @@ function updateFileList() {
$
(
'
#file_list
'
).
html
(
s
);
$
(
'
#file_list
'
).
html
(
s
);
}
}
function
text_of_cst
(
c
)
{
switch
(
c
.
tag
)
{
case
"
cst_bool
"
:
return
c
.
bool
+
""
;
case
"
cst_number
"
:
return
c
.
number
+
""
;
default
:
return
"
unrecognized cst
"
;
}
}
var
next_fresh_id
=
0
;
function
fresh_id
()
{
return
"
fresh_id_
"
+
(
next_fresh_id
++
);
}
var
handlers
=
[];
function
text_of_value
(
heap
,
v
,
target
)
{
switch
(
v
.
tag
)
{
case
"
val_cst
"
:
return
text_of_cst
(
v
.
cst
);
case
"
val_loc
"
:
handlers
[
target
]
=
function
()
{
};
return
"
<span class='heap_link'><a onclick=
\"
handlers['
"
+
target
+
"
']()
\"
><Location>(
"
+
v
.
loc
+
"
)</a></span>
"
;
case
"
val_abs
"
:
return
"
<Closure>
"
;
default
:
return
"
<pre style='margin:0; padding: 0; margin-left:1em'>
"
+
JSON
.
stringify
(
v
,
null
,
2
)
+
"
</pre>
"
;
}
}
function
updateContext
(
heap
,
env
)
{
// env here is the ctx
$
(
"
#disp_context
"
).
html
(
""
);
// TODO: une fonction de conversion de env vers array
while
(
env
.
tag
===
"
env_cons
"
)
{
var
target
=
fresh_id
();
$
(
"
#disp_context
"
).
append
(
"
<div id='
"
+
target
+
"
'></div>
"
);
$
(
"
#
"
+
target
).
html
(
env
.
name
+
"
:
"
+
text_of_value
(
heap
,
env
.
val
,
target
));
env
=
env
.
env
;
}
}
function
updateSelection
()
{
function
updateSelection
()
{
var
item
=
tracer_items
[
tracer_pos
];
var
item
=
tracer_items
[
tracer_pos
];
h
=
jsheap_of_heap
(
item
.
heap
);
// export for client
h
=
jsheap_of_heap
(
item
.
heap
);
// export for client
...
@@ -140,9 +186,10 @@ function updateSelection() {
...
@@ -140,9 +186,10 @@ function updateSelection() {
$
(
'
.CodeMirror-focused .CodeMirror-selected
'
).
css
({
background
:
color
});
$
(
'
.CodeMirror-focused .CodeMirror-selected
'
).
css
({
background
:
color
});
if
(
item
.
line
===
undefined
)
if
(
item
.
line
===
undefined
)
alert
(
"
missing line in log event
"
);
alert
(
"
missing line in log event
"
);
$
(
"
#infos
"
).
html
(
"
type =
"
+
item
.
type
);
$
(
"
#disp_infos
"
).
html
(
"
type =
"
+
item
.
type
);
updateContext
(
item
.
heap
,
item
.
ctx
);
$
(
"
#navigation_step
"
).
val
(
tracer_pos
);
$
(
"
#navigation_step
"
).
val
(
tracer_pos
);
console
.
log
(
item
);
//
console.log(item);
var
anchor
=
{
line
:
item
.
start_line
-
1
,
ch
:
item
.
start_col
};
var
anchor
=
{
line
:
item
.
start_line
-
1
,
ch
:
item
.
start_col
};
var
head
=
{
line
:
item
.
end_line
-
1
,
ch
:
item
.
end_col
};
var
head
=
{
line
:
item
.
end_line
-
1
,
ch
:
item
.
end_col
};
editor
.
setSelection
(
anchor
,
head
);
editor
.
setSelection
(
anchor
,
head
);
...
...
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