Builds again for posix.
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
CFLAGS=-O2 -Wall -Werror -I./
|
CFLAGS=-O2 -Wall -Werror -I./ -I./out
|
||||||
LIBS=-ldl
|
LIBS=-ldl
|
||||||
|
|
||||||
TARGETS = out/web/terminal.html \
|
TARGETS = out/web/terminal.html \
|
||||||
@ -11,7 +11,10 @@ all: $(TARGETS)
|
|||||||
out/gen:
|
out/gen:
|
||||||
mkdir -p out/gen
|
mkdir -p out/gen
|
||||||
|
|
||||||
out/gen/dump_web_opcodes: web/dump_web_opcodes.c opcodes.h | out/gen
|
out/gen/boot.h: common/source_to_string.js common/boot.fs | out/gen
|
||||||
|
$^ boot >$@
|
||||||
|
|
||||||
|
out/gen/dump_web_opcodes: web/dump_web_opcodes.c common/opcodes.h | out/gen
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
out/gen/web_cases.js: out/gen/dump_web_opcodes | out/gen
|
out/gen/web_cases.js: out/gen/dump_web_opcodes | out/gen
|
||||||
@ -26,24 +29,29 @@ out/web:
|
|||||||
out/web/terminal.html: web/terminal.html | out/web
|
out/web/terminal.html: web/terminal.html | out/web
|
||||||
cp $< $@
|
cp $< $@
|
||||||
|
|
||||||
out/web/ueforth.js: web/fuse_web.js web/web.template.js boot.fs \
|
out/web/ueforth.js: \
|
||||||
out/gen/web_dict.js out/gen/web_cases.js | out/web
|
web/fuse_web.js \
|
||||||
|
web/web.template.js \
|
||||||
|
out/gen/boot.h \
|
||||||
|
out/gen/web_dict.js \
|
||||||
|
out/gen/web_cases.js | out/web
|
||||||
$^ >$@
|
$^ >$@
|
||||||
|
|
||||||
out/posix:
|
out/posix:
|
||||||
mkdir -p out/posix
|
mkdir -p out/posix
|
||||||
|
|
||||||
out/posix/ueforth: posix/posix.c opcodes.h | out/posix
|
out/posix/ueforth: posix/posix_main.c common/opcodes.h | out/posix
|
||||||
$(CC) $(CFLAGS) $< -o $@ $(LIBS)
|
$(CC) $(CFLAGS) $< -o $@ $(LIBS)
|
||||||
|
|
||||||
out/arduino:
|
out/arduino:
|
||||||
mkdir -p out/arduino
|
mkdir -p out/arduino
|
||||||
|
|
||||||
out/arduino/ueforth.ino: arduino/fuse_ino.js \
|
out/arduino/ueforth.ino: \
|
||||||
|
arduino/fuse_ino.js \
|
||||||
arduino/arduino.template.ino \
|
arduino/arduino.template.ino \
|
||||||
opcodes.h \
|
common/opcodes.h \
|
||||||
core.h \
|
common/core.h \
|
||||||
boot.fs | out/arduino
|
out/gen/boot.h | out/arduino
|
||||||
$^ >$@
|
$^ >$@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
{{opcodes}}
|
{{opcodes}}
|
||||||
{{core}}
|
{{core}}
|
||||||
const char boot[] =
|
{{boot}}
|
||||||
{{boot}};
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
ueforth(boot, sizeof(boot));
|
ueforth(boot, sizeof(boot));
|
||||||
|
|||||||
@ -1,27 +1,14 @@
|
|||||||
#! /usr/bin/env nodejs
|
#! /usr/bin/env nodejs
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
|
||||||
var code = fs.readFileSync(process.argv[2]).toString();
|
var code = fs.readFileSync(process.argv[2]).toString();
|
||||||
var opcodes = fs.readFileSync(process.argv[3]).toString();
|
var opcodes = fs.readFileSync(process.argv[3]).toString();
|
||||||
var core = fs.readFileSync(process.argv[4]).toString();
|
var core = fs.readFileSync(process.argv[4]).toString();
|
||||||
var boot = fs.readFileSync(process.argv[5]).toString();
|
var boot = fs.readFileSync(process.argv[5]).toString();
|
||||||
|
|
||||||
function ReplaceAll(haystack, needle, replacement) {
|
|
||||||
for (;;) {
|
|
||||||
var old = haystack;
|
|
||||||
haystack = haystack.replace(needle, replacement);
|
|
||||||
if (old === haystack) {
|
|
||||||
return haystack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boot = boot.replace(/["]/g, '\\"');
|
|
||||||
boot = '" ' + boot.split('\n').join(' "\n" ') + ' "';
|
|
||||||
boot = boot.replace(/["] ["]/g, '');
|
|
||||||
boot = boot.replace(/["] [(] ([^)]*)[)] ["]/g, '// $1');
|
|
||||||
code = code.replace('{{boot}}', boot);
|
|
||||||
code = code.replace('{{opcodes}}', opcodes);
|
code = code.replace('{{opcodes}}', opcodes);
|
||||||
|
code = code.replace('{{boot}}', boot);
|
||||||
code = code.replace('{{core}}', core);
|
code = code.replace('{{core}}', core);
|
||||||
|
|
||||||
console.log(code);
|
process.stdout.write(code);
|
||||||
|
|||||||
15
ueforth/common/source_to_string.js
Executable file
15
ueforth/common/source_to_string.js
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#! /usr/bin/env nodejs
|
||||||
|
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
|
var source = fs.readFileSync(process.argv[2]).toString();
|
||||||
|
var name = process.argv[3];
|
||||||
|
|
||||||
|
source = source.replace(/["]/g, '\\"');
|
||||||
|
source = '" ' + source.split('\n').join(' "\n" ') + ' "';
|
||||||
|
source = source.replace(/["] ["]/g, '');
|
||||||
|
source = source.replace(/["] [(] ([^)]*)[)] ["]/g, '// $1');
|
||||||
|
|
||||||
|
source = 'const char ' + name + '[] =\n' + source + ';\n';
|
||||||
|
|
||||||
|
process.stdout.write(source);
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "opcodes.h"
|
#include "common/opcodes.h"
|
||||||
|
|
||||||
#define HEAP_SIZE (10 * 1024 * 1024)
|
#define HEAP_SIZE (10 * 1024 * 1024)
|
||||||
#define STACK_SIZE (16 * 1024)
|
#define STACK_SIZE (16 * 1024)
|
||||||
@ -19,8 +19,10 @@
|
|||||||
X("KEY", OP_KEY, DUP; tos = fgetc(stdin)) \
|
X("KEY", OP_KEY, DUP; tos = fgetc(stdin)) \
|
||||||
X("SYSEXIT", OP_SYSEXIT, DUP; exit(tos)) \
|
X("SYSEXIT", OP_SYSEXIT, DUP; exit(tos)) \
|
||||||
|
|
||||||
#include "core.h"
|
#include "common/core.h"
|
||||||
|
|
||||||
|
#include "gen/boot.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
ueforth(0, 0);
|
ueforth(boot, sizeof(boot));
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "opcodes.h"
|
#include "common/opcodes.h"
|
||||||
|
|
||||||
#define PLATFORM_OPCODE_LIST \
|
#define PLATFORM_OPCODE_LIST \
|
||||||
X("CALL", OP_CALL, sp = jscall(sp, tos); DROP) \
|
X("CALL", OP_CALL, sp = jscall(sp, tos); DROP) \
|
||||||
|
|||||||
Reference in New Issue
Block a user