Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
iTasks-SDK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
73
Issues
73
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
iTasks-SDK
Commits
13171859
Verified
Commit
13171859
authored
Jun 18, 2019
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move generic wasm-supporting JS from here to abc-interpreter
parent
e463865a
Pipeline
#26083
passed with stage
in 5 minutes and 13 seconds
Changes
6
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
728 deletions
+132
-728
Examples/Applications/Incidone/WebPublic/index.html
Examples/Applications/Incidone/WebPublic/index.html
+1
-1
Libraries/iTasks/UI/JavaScript.dcl
Libraries/iTasks/UI/JavaScript.dcl
+2
-2
Libraries/iTasks/UI/WebPublic/index.html
Libraries/iTasks/UI/WebPublic/index.html
+1
-1
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
+0
-722
Libraries/iTasks/UI/WebPublic/js/itasks-abc-interpreter.js
Libraries/iTasks/UI/WebPublic/js/itasks-abc-interpreter.js
+126
-0
Libraries/iTasks/UI/WebPublic/js/itasks-core.js
Libraries/iTasks/UI/WebPublic/js/itasks-core.js
+2
-2
No files found.
Examples/Applications/Incidone/WebPublic/index.html
View file @
13171859
...
...
@@ -9,8 +9,8 @@
<link
rel=
"stylesheet"
href=
"/Incidone.css"
type=
"text/css"
>
<!-- ABC interpreter -->
<script
type=
"text/javascript"
src=
"/js/abc-instructions.js"
></script>
<script
type=
"text/javascript"
src=
"/js/abc-interpreter.js"
></script>
<script
type=
"text/javascript"
src=
"/js/itasks-abc-interpreter.js"
></script>
<!-- iTasks framework -->
<script
type=
"text/javascript"
src=
"/js/itasks-core.js"
></script>
...
...
Libraries/iTasks/UI/JavaScript.dcl
View file @
13171859
...
...
@@ -12,7 +12,7 @@ definition module iTasks.UI.JavaScript
* with JavaScript (where indicated in documentation below).
*
* The JavaScript interfacing with this module can be found in itasks-core.js
* and abc-interpreter.js.
* and
itasks-
abc-interpreter.js.
*/
import
StdGeneric
...
...
@@ -51,7 +51,7 @@ jsGetCleanReference :: !JSVal !*JSWorld -> *(!Maybe b, !*JSWorld)
/**
* Remove a Clean value from the JavaScript heap. The value must have been
* shared using `jsMakeCleanReference` or `jsWrapFun`.
For example:
* shared using `jsMakeCleanReference` or `jsWrapFun`.
*/
jsFreeCleanReference
::
!
JSVal
!*
JSWorld
->
*
JSWorld
...
...
Libraries/iTasks/UI/WebPublic/index.html
View file @
13171859
...
...
@@ -8,8 +8,8 @@
<link
rel=
"stylesheet"
href=
"/css/itasks-modules.css"
type=
"text/css"
>
<!-- ABC interpreter -->
<script
type=
"text/javascript"
src=
"/js/abc-instructions.js"
></script>
<script
type=
"text/javascript"
src=
"/js/abc-interpreter.js"
></script>
<script
type=
"text/javascript"
src=
"/js/itasks-abc-interpreter.js"
></script>
<!-- iTasks framework -->
<script
type=
"text/javascript"
src=
"/js/itasks-core.js"
></script>
...
...
Libraries/iTasks/UI/WebPublic/js/abc-interpreter.js
deleted
100644 → 0
View file @
e463865a
This diff is collapsed.
Click to expand it.
Libraries/iTasks/UI/WebPublic/js/itasks-abc-interpreter.js
0 → 100644
View file @
13171859
"
use strict
"
;
var
ABC
=
null
;
const
ABC_loading_promise
=
ABCInterpreter
.
instantiate
({
bytecode_path
:
'
/js/app.pbc
'
,
heap_size
:
8
<<
20
,
stack_size
:
512
<<
10
,
util_imports
:
{
has_host_reference
:
function
(
index
)
{
if
(
index
>=
ABC
.
shared_clean_values
.
length
)
return
0
;
if
(
ABC
.
shared_clean_values
[
index
]
==
null
)
return
-
1
;
return
ABC
.
shared_clean_values
[
index
].
ref
;
},
update_host_reference
:
function
(
index
,
new_location
)
{
ABC
.
shared_clean_values
[
index
].
ref
=
new_location
;
},
},
interpreter_imports
:
{
handle_illegal_instr
:
function
(
pc
,
instr
,
asp
,
bsp
,
csp
,
hp
,
hp_free
)
{
if
(
ABCInterpreter
.
instructions
[
instr
]
==
'
instruction
'
)
{
const
arg
=
ABC
.
memory_array
[(
pc
+
8
)
/
4
];
switch
(
arg
)
{
case
0
:
/* evaluation finished */
return
0
;
case
1
:
/* iTasks.UI.JS.Interface: set_js */
var
v
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
],
true
);
var
x
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
-
2
],
true
);
if
(
ABC_DEBUG
)
console
.
log
(
v
,
'
.=
'
,
x
);
try
{
var
ref
=
eval
(
v
+
'
.shared_clean_value_index
'
);
if
(
typeof
ref
!=
'
undefined
'
)
{
if
(
ABC_DEBUG
)
console
.
log
(
'
removing old reference to Clean
'
,
ref
);
ABC
.
clear_shared_clean_value
(
ref
);
}
}
catch
(
e
)
{}
Function
(
v
+
'
=
'
+
x
)();
break
;
case
2
:
/* iTasks.UI.JS.Interface: eval_js */
var
string
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
],
true
);
if
(
ABC_DEBUG
)
console
.
log
(
'
eval
'
,
string
);
Function
(
string
)();
break
;
case
3
:
/* iTasks.UI.JS.Interface: eval_js_with_return_value */
var
string
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
],
true
);
if
(
ABC_DEBUG
)
console
.
log
(
'
eval
'
,
string
);
var
result
=
eval
(
'
(
'
+
string
+
'
)
'
);
// the parentheses are needed for {}, for instance
var
copied
=
ABC
.
copy_js_to_clean
(
result
,
asp
);
ABC
.
interpreter
.
instance
.
exports
.
set_hp
(
copied
.
hp
);
ABC
.
interpreter
.
instance
.
exports
.
set_hp_free
(
copied
.
hp_free
);
break
;
case
4
:
/* iTasks.UI.JS.Interface: share */
var
attach_to
=
ABC
.
memory_array
[
bsp
/
4
];
var
index
=
ABC
.
share_clean_value
(
ABC
.
memory_array
[
asp
/
4
],
ABC
.
js
[
attach_to
]);
ABC
.
memory_array
[
bsp
/
4
]
=
index
;
break
;
case
5
:
/* iTasks.UI.JS.Interface: fetch */
var
index
=
ABC
.
memory_array
[
bsp
/
4
];
ABC
.
memory_array
[
asp
/
4
]
=
ABC
.
shared_clean_values
[
index
].
ref
;
break
;
case
6
:
/* iTasks.UI.JS.Interface: deserialize */
var
hp_ptr
=
ABC
.
memory_array
[
asp
/
4
];
ABC
.
memory_array
[
asp
/
4
]
=
ABC
.
deserialize_from_unique_string
(
hp_ptr
);
break
;
case
7
:
/* iTasks.UI.JS.Interface: initialize_client in wrapInitUIFunction */
var
array
=
ABC
.
memory_array
[
asp
/
4
]
+
24
;
ABC
.
addresses
.
JSInt
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
]
/
4
];
ABC
.
addresses
.
JSBool
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
2
]
/
4
];
ABC
.
addresses
.
JSString
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
4
]
/
4
];
ABC
.
addresses
.
JSReal
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
6
]
/
4
];
ABC
.
addresses
.
JSNull
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
8
]
/
4
];
ABC
.
addresses
.
JSUndefined
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
10
]
/
4
];
ABC
.
addresses
.
JSArray
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
12
]
/
4
];
ABC
.
addresses
.
JSRef
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
14
]
/
4
];
ABC
.
addresses
.
JSCleanRef
=
ABC
.
memory_array
[
ABC
.
memory_array
[
array
/
4
+
16
]
/
4
];
ABC
.
util
.
instance
.
exports
.
set_js_ref_constructor
(
ABC
.
addresses
.
JSRef
);
ABC
.
initialized
=
true
;
break
;
case
10
:
/* iTasks.UI.JS.Interface: add CSS */
var
url
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
],
false
);
var
css
=
document
.
createElement
(
'
link
'
);
css
.
rel
=
'
stylesheet
'
;
css
.
type
=
'
text/css
'
;
css
.
async
=
true
;
css
.
href
=
url
;
document
.
head
.
appendChild
(
css
);
break
;
case
11
:
/* iTasks.UI.JS.Interface: add JS */
var
url
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
],
false
);
var
callback
=
ABC
.
get_clean_string
(
ABC
.
memory_array
[
asp
/
4
-
2
],
true
);
var
js
=
document
.
createElement
(
'
script
'
);
js
.
type
=
'
text/javascript
'
;
js
.
async
=
false
;
if
(
callback
.
length
>
0
)
js
.
onload
=
Function
(
callback
+
'
();
'
);
document
.
head
.
appendChild
(
js
);
js
.
src
=
url
;
break
;
default
:
throw
new
ABCError
(
'
unknown instruction
'
,
arg
);
}
return
pc
+
16
;
}
return
0
;
},
illegal_instr
:
function
(
addr
,
instr
)
{
ABC
.
empty_log_buffer
();
if
(
ABCInterpreter
.
instructions
[
instr
]
==
'
instruction
'
)
/* `instruction 0` ends the interpretation, so this is no error */
return
;
throw
new
ABCError
(
'
illegal instruction
'
,
instr
);
},
},
}).
then
(
function
(
instance
){
ABC
=
instance
;
ABC
.
initialized
=
false
;
});
Libraries/iTasks/UI/WebPublic/js/itasks-core.js
View file @
13171859
...
...
@@ -43,10 +43,10 @@ itasks.Component = {
initUI
:
function
()
{
var
me
=
this
;
if
(
me
.
attributes
.
initUI
!=
null
&&
me
.
attributes
.
initUI
!=
''
)
{
return
ABC
.
loading_promise
.
then
(
function
(){
return
ABC
_
loading_promise
.
then
(
function
(){
var
initUI
=
ABC
.
deserialize
(
me
.
attributes
.
initUI
);
var
ref
=
ABC
.
share_clean_value
(
initUI
,
me
);
ABC
.
interpret
(
SharedCleanValue
(
ref
),
[
me
,
ABC
.
initialized
?
0
:
1
]);
ABC
.
interpret
(
new
SharedCleanValue
(
ref
),
[
me
,
ABC
.
initialized
?
0
:
1
]);
ABC
.
clear_shared_clean_value
(
ref
);
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment