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
9c2016cc
Commit
9c2016cc
authored
9 years ago
by
Martin Bodin
Committed by
Thomas Wood
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Updating navig.html.
parent
83d46720
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
navig.html
+23
-19
23 additions, 19 deletions
navig.html
with
23 additions
and
19 deletions
navig.html
+
23
−
19
View file @
9c2016cc
...
@@ -127,11 +127,14 @@ Reach condition:
...
@@ -127,11 +127,14 @@ Reach condition:
var
timeoutID
=
window
.
setTimeout
(
function
()
{
$
(
"
#reach_output
"
).
html
(
""
);
},
1000
);
var
timeoutID
=
window
.
setTimeout
(
function
()
{
$
(
"
#reach_output
"
).
html
(
""
);
},
1000
);
});
});
// Assumes tracer_files to be a string containing the source code
// Assumes tracer_files to be an array of objects with two field:
// - file, containing the name of the file,
// - contents, a string containing its source code
// Assumes tracer_items to be an array with items, e.g.:
// Assumes tracer_items to be an array with items, e.g.:
// { type: 'enter_call', file: 'foo.ml', start_line: 4, start_col: 0, end_line: 5, end_col: 10 },
// { type: 'enter', file: 'foo.ml', start_line: 4, start_col: 0, end_line: 5, end_col: 10 },
// { type: 'exit_call', file: 'foo.ml', start_line: 4, start_col: 0, end_line: 5, end_col: 10 },
// { type: 'exit', file: 'foo.ml', start_line: 4, start_col: 0, end_line: 5, end_col: 10 },
// { type: 'other_event', file: 'foo.ml', start_line: 4, start_col: 0, end_line: 5, end_col: 10 },
function
tracer_valid_pos
(
i
)
{
function
tracer_valid_pos
(
i
)
{
return
(
i
>=
0
&&
i
<
tracer_length
);
return
(
i
>=
0
&&
i
<
tracer_length
);
...
@@ -142,20 +145,19 @@ Reach condition:
...
@@ -142,20 +145,19 @@ Reach condition:
var
i
=
tracer_pos
;
var
i
=
tracer_pos
;
i
+=
dir
;
i
+=
dir
;
if
(
!
tracer_valid_pos
(
i
))
if
(
!
tracer_valid_pos
(
i
))
return
;
// not found
return
;
// not found
, we don’t update the tracer position.
tracer_pos
=
i
;
tracer_pos
=
i
;
}
}
// dir is -1 or +1,
// dir is -1 or +1,
// target is 0 for (next/prev)
// target (= target depth) is 0 for (next/prev) or -1 (finish)
// or -1 (finish)
function
shared_next
(
dir
,
target
)
{
function
shared_next
(
dir
,
target
)
{
var
i
=
tracer_pos
;
var
i
=
tracer_pos
;
var
depth
=
0
;
var
depth
=
0
;
var
ty
=
tracer_items
[
i
].
type
;
var
ty
=
tracer_items
[
i
].
type
;
if
(
dir
==
+
1
&&
ty
==
'
exit
_call
'
)
{
if
(
dir
==
=
+
1
&&
ty
==
=
'
exit
'
)
{
depth
=
1
;
depth
=
1
;
}
else
if
(
dir
==
-
1
&&
ty
==
'
enter
_call
'
)
{
}
else
if
(
dir
==
=
-
1
&&
ty
==
=
'
enter
'
)
{
depth
=
-
1
;
depth
=
-
1
;
}
}
while
(
true
)
{
while
(
true
)
{
...
@@ -163,14 +165,14 @@ Reach condition:
...
@@ -163,14 +165,14 @@ Reach condition:
tracer_pos
=
i
-
dir
;
// just before out of range
tracer_pos
=
i
-
dir
;
// just before out of range
return
;
// not found
return
;
// not found
}
}
if
(
i
!=
tracer_pos
&&
depth
==
target
)
{
if
(
i
!=
=
tracer_pos
&&
depth
==
=
target
)
{
tracer_pos
=
i
;
tracer_pos
=
i
;
return
;
return
;
}
}
var
ty
=
tracer_items
[
i
].
type
;
var
ty
=
tracer_items
[
i
].
type
;
if
(
ty
==
'
enter
_call
'
)
{
if
(
ty
==
=
'
enter
'
)
{
depth
++
;
depth
++
;
}
else
if
(
ty
==
'
exit
_call
'
)
{
}
else
if
(
ty
==
=
'
exit
'
)
{
depth
--
;
depth
--
;
}
}
i
+=
dir
;
i
+=
dir
;
...
@@ -187,15 +189,16 @@ Reach condition:
...
@@ -187,15 +189,16 @@ Reach condition:
var
curfile
=
''
;
var
curfile
=
''
;
var
docs
=
{};
var
docs
=
{};
for
(
file
in
tracer_files
)
{
for
(
var
i
=
0
;
i
<
tracer_files
.
length
;
i
++
)
{
var
txt
=
tracer_files
[
file
];
var
file
=
tracer_files
[
i
].
file
;
var
txt
=
tracer_files
[
i
].
contents
;
docs
[
file
]
=
CodeMirror
.
Doc
(
txt
,
'
js
'
);
docs
[
file
]
=
CodeMirror
.
Doc
(
txt
,
'
js
'
);
}
}
var
editor
=
null
;
var
editor
=
null
;
function
viewFile
(
file
)
{
function
viewFile
(
file
)
{
if
(
curfile
!=
file
)
{
if
(
curfile
!=
=
file
)
{
curfile
=
file
;
curfile
=
file
;
editor
.
swapDoc
(
docs
[
curfile
]);
editor
.
swapDoc
(
docs
[
curfile
]);
editor
.
focus
();
editor
.
focus
();
...
@@ -205,7 +208,8 @@ Reach condition:
...
@@ -205,7 +208,8 @@ Reach condition:
function
updateFileList
()
{
function
updateFileList
()
{
var
s
=
''
;
var
s
=
''
;
for
(
file
in
tracer_files
)
{
for
(
var
i
=
0
;
i
<
tracer_files
.
length
;
i
++
)
{
var
file
=
tracer_files
[
i
].
file
;
s
+=
"
<span class=
\"
file_item
"
+
((
curfile
==
file
)
?
'
_current
'
:
''
)
+
"
\"
onclick=
\"
viewFile('
"
+
file
+
"
')
\"
>
"
+
file
+
"
</span>
"
;
s
+=
"
<span class=
\"
file_item
"
+
((
curfile
==
file
)
?
'
_current
'
:
''
)
+
"
\"
onclick=
\"
viewFile('
"
+
file
+
"
')
\"
>
"
+
file
+
"
</span>
"
;
}
}
$
(
'
#file_list
'
).
html
(
s
);
$
(
'
#file_list
'
).
html
(
s
);
...
@@ -219,7 +223,7 @@ Reach condition:
...
@@ -219,7 +223,7 @@ Reach condition:
console
.
log
(
"
pos:
"
+
tracer_pos
);
console
.
log
(
"
pos:
"
+
tracer_pos
);
var
ty
=
tracer_items
[
tracer_pos
].
type
;
var
ty
=
tracer_items
[
tracer_pos
].
type
;
var
color
=
(
ty
==
'
enter
_call
'
)
?
'
#F3F781
'
:
'
#CCCCCC
'
;
var
color
=
(
ty
==
=
'
enter
'
)
?
'
#F3F781
'
:
'
#CCCCCC
'
;
//console.log("color " + color);
//console.log("color " + color);
$
(
'
.CodeMirror-selected
'
).
css
({
background
:
color
});
$
(
'
.CodeMirror-selected
'
).
css
({
background
:
color
});
$
(
'
.CodeMirror-focused .CodeMirror-selected
'
).
css
({
background
:
color
});
$
(
'
.CodeMirror-focused .CodeMirror-selected
'
).
css
({
background
:
color
});
...
@@ -250,10 +254,10 @@ Reach condition:
...
@@ -250,10 +254,10 @@ Reach condition:
var
txt
=
editor
.
getLine
(
line
);
var
txt
=
editor
.
getLine
(
line
);
var
prefix
=
"
#sec-
"
;
var
prefix
=
"
#sec-
"
;
var
pos_start
=
txt
.
indexOf
(
prefix
);
var
pos_start
=
txt
.
indexOf
(
prefix
);
if
(
pos_start
==
-
1
)
if
(
pos_start
==
=
-
1
)
return
;
return
;
var
pos_end
=
txt
.
indexOf
(
"
*
"
,
pos_start
);
var
pos_end
=
txt
.
indexOf
(
"
*
"
,
pos_start
);
if
(
pos_end
==
-
1
)
if
(
pos_end
==
=
-
1
)
return
;
return
;
var
sec
=
txt
.
substring
(
pos_start
,
pos_end
);
var
sec
=
txt
.
substring
(
pos_start
,
pos_end
);
var
url
=
"
http://www.ecma-international.org/ecma-262/5.1/
"
+
sec
;
var
url
=
"
http://www.ecma-international.org/ecma-262/5.1/
"
+
sec
;
...
...
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