Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/* machine_code.wren */
|
||||
/* Machine_code.wren */
|
||||
|
||||
class C {
|
||||
// pass the machine code in string form to the host
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
/* gcc Machine_code.c -o Machine_code -lwren -lm */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
|
@ -24,13 +26,13 @@ unsigned char rmc_helper(const char *code, unsigned char a, unsigned char b, int
|
|||
|
||||
void C_runMachineCode(WrenVM* vm) {
|
||||
/* unpack arguments passed from Wren */
|
||||
int *len;
|
||||
const char *code = wrenGetSlotBytes(vm, 1, len);
|
||||
int len;
|
||||
const char *code = wrenGetSlotBytes(vm, 1, &len);
|
||||
unsigned char a = (unsigned char)wrenGetSlotDouble(vm, 2);
|
||||
unsigned char b = (unsigned char)wrenGetSlotDouble(vm, 3);
|
||||
|
||||
/* obtain result */
|
||||
unsigned char c = rmc_helper(code, a, b, *len);
|
||||
unsigned char c = rmc_helper(code, a, b, len);
|
||||
|
||||
/* return result to Wren */
|
||||
wrenSetSlotDouble(vm, 0, (double)c);
|
||||
|
|
@ -90,7 +92,7 @@ int main() {
|
|||
config.bindForeignMethodFn = &bindForeignMethod;
|
||||
WrenVM* vm = wrenNewVM(&config);
|
||||
const char* module = "main";
|
||||
const char* fileName = "machine_code.wren";
|
||||
const char* fileName = "Machine_code.wren";
|
||||
char *script = readFile(fileName);
|
||||
WrenInterpretResult result = wrenInterpret(vm, module, script);
|
||||
switch (result) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue