Switching to nicer c+11 strings.

This commit is contained in:
Brad Nelson
2022-01-14 18:54:13 -08:00
parent 0875f20828
commit 363455c2c9
5 changed files with 12 additions and 11 deletions

View File

@ -26,7 +26,7 @@ WINDOWS = $(OUT)/windows
ESP32 = $(OUT)/esp32
DEPLOY = $(OUT)/deploy
CFLAGS_COMMON = -O2 -I ./ -I $(OUT)
CFLAGS_COMMON = -std=c++11 -O2 -I ./ -I $(OUT)
CFLAGS_MINIMIZE = \
-s \
@ -185,7 +185,7 @@ $(GEN)/esp32_boot.h: common/source_to_string.js $(ESP32_BOOT) | $(GEN)
$< boot $(VERSION) $(REVISION) $(ESP32_BOOT) >$@
$(GEN)/dump_web_opcodes: web/dump_web_opcodes.c common/opcodes.h | $(GEN)
$(CC) $(CFLAGS) $< -o $@
$(CXX) $(CFLAGS) $< -o $@
$(GEN)/web_cases.js: $(GEN)/dump_web_opcodes | $(GEN)
$< cases >$@
@ -253,7 +253,7 @@ $(POSIX)/ueforth: \
common/interp.h \
common/core.h \
$(GEN)/posix_boot.h | $(POSIX)
$(CC) $(CFLAGS) $< -o $@ $(LIBS)
$(CXX) $(CFLAGS) $< -o $@ $(LIBS)
strip $(STRIP_ARGS) $@
# ---- WINDOWS ----

View File

@ -15,7 +15,13 @@
#ifndef CALLTYPE
# define CALLTYPE
#endif
#ifdef __cplusplus
typedef cell_t (CALLTYPE *call_t)(...);
#else
typedef cell_t (CALLTYPE *call_t)();
#endif
#define ct0 ((call_t) n0)
#define CALLING_OPCODE_LIST \

View File

@ -56,7 +56,7 @@ static cell_t convert(const char *pos, cell_t n, cell_t base, cell_t *ret) {
d -= 7;
if (d < 10) { return 0; }
}
if (d >= base) { return 0; }
if (d >= (uintptr_t) base) { return 0; }
*ret = *ret * base + d;
++pos;
}

View File

@ -40,12 +40,7 @@ for (var i = 5; i < process.argv.length; i++) {
source = source.replace('{{VERSION}}', version);
source = source.replace('{{REVISION}}', revision);
source = source.replace(/\\/g, '\\\\');
source = source.replace(/["]/g, '\\"');
source = '"' + source.split('\n').join('\\n"\n"') + '\\n"';
source = source.replace(/["] ["]/g, '');
source = source.replace(/["] [(] ([^)]*)[)] ["]/g, '// $1');
source = 'const char ' + name + '[] =\n' + source + ';\n';
source = 'const char ' + name + '[] = R"""(\n' + source + ')""";\n';
process.stdout.write(source);

View File

@ -24,7 +24,7 @@
#define STACK_CELLS (8 * 1024)
#define PLATFORM_OPCODE_LIST \
Y(DLSYM, tos = (cell_t) dlsym(a1, a0); --sp) \
Y(DLSYM, tos = (cell_t) dlsym(a1, c0); --sp) \
FLOATING_POINT_LIST \
CALLING_OPCODE_LIST \