File tree Expand file tree Collapse file tree 4 files changed +15
-10
lines changed Expand file tree Collapse file tree 4 files changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,7 @@ include/Ark/Constants.hpp
30
30
31
31
# WASM
32
32
/public /node_modules
33
- /public /* .wasm.wasm
34
- /public /* .wasm.js
33
+ /public /ArkEmscripten. *
35
34
/public /package.json
36
35
/public /package-lock.json
37
36
Original file line number Diff line number Diff line change 60
60
- ` APPEND_IN_PLACE_SYM ` and ` APPEND_IN_PLACE_SYM_INDEX ` super instructions
61
61
- ` PUSH_RETURN_ADDRESS ` instruction now replaces the VM auto push of IP/PP
62
62
- remove the stack swapping by pushing arguments in the reverse order by which they are loaded
63
+ - wasm export: we can now run ArkScript code on the web!
63
64
64
65
### Changed
65
66
- instructions are on 4 bytes: 1 byte for the instruction, 1 byte of padding, 2 bytes for an immediate argument
Original file line number Diff line number Diff line change 13
13
</ div >
14
14
15
15
< script >
16
- let output = "" ;
17
16
log = console . log ;
17
+ var can_capture = false ;
18
+
18
19
window . console . log = ( message ) => {
19
- output = message ;
20
+ log ( message ) ;
21
+ if ( can_capture )
22
+ document . getElementById ( "output" ) . value += message + "\n" ;
20
23
} ;
21
24
22
25
var Module = {
23
26
onRuntimeInitialized : function ( ) {
24
27
document . getElementById ( "run" ) . addEventListener ( "click" , ( ) => {
28
+ document . getElementById ( "output" ) . value = "" ;
25
29
const code = document . getElementById ( "code" ) . value ;
26
- console . log ( code ) ;
27
30
28
31
try {
32
+ can_capture = true ;
29
33
Module . run ( code ) ;
30
- document . getElementById ( "output" ) . innerText = output ;
31
34
} catch ( e ) {
32
- document . getElementById ( "output" ) . innerText = e ;
35
+ document . getElementById ( "output" ) . value = e ;
33
36
}
37
+
38
+ can_capture = false ;
34
39
} ) ;
35
40
}
36
41
} ;
Original file line number Diff line number Diff line change @@ -209,9 +209,9 @@ int main(int argc, char** argv)
209
209
" sizeof(Ark::Value) = {}B\n "
210
210
" sizeof(Value_t) = {}B\n "
211
211
" sizeof(ValueType) = {}B\n "
212
- " sizeof(ProcType) = {}B\n "
213
- " sizeof(Ark::Closure) = {}B\n "
214
- " sizeof(Ark::UserType) = {}B\n "
212
+ " sizeof(Ark::Procedure) = {}B\n "
213
+ " sizeof(Ark::Closure) = {}B\n "
214
+ " sizeof(Ark::UserType) = {}B\n "
215
215
" \n Virtual Machine\n "
216
216
" sizeof(Ark::VM) = {}B\n "
217
217
" sizeof(Ark::State) = {}B\n "
You can’t perform that action at this time.
0 commit comments