diff --git a/base/sources/miniclib/ctype.c b/base/sources/miniclib/ctype.c index a1f76083..05680dc3 100644 --- a/base/sources/miniclib/ctype.c +++ b/base/sources/miniclib/ctype.c @@ -8,3 +8,23 @@ int tolower(int ch) { int toupper(int ch) { return (ch >= 'a' && ch <= 'z') ? ch - 32 : ch; } + +int isspace(int ch) { + return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || ch == '\f' || ch == '\v'; +} + +int isxdigit(int ch) { + return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'); +} + +int isdigit(int ch) { + return ch >= '0' && ch <= '9'; +} + +int isalpha(int ch) { + return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); +} + +int isalnum(int ch) { + return isalpha(ch) || isdigit(ch); +} diff --git a/base/sources/miniclib/ctype.h b/base/sources/miniclib/ctype.h index 43ff4fc2..43e908e5 100644 --- a/base/sources/miniclib/ctype.h +++ b/base/sources/miniclib/ctype.h @@ -1,3 +1,9 @@ +#pragma once int tolower(int ch); int toupper(int ch); +int isspace(int ch); +int isxdigit(int ch); +int isdigit(int ch); +int isalpha(int ch); +int isalnum(int ch); diff --git a/base/sources/miniclib/stdlib.c b/base/sources/miniclib/stdlib.c index 2c193f05..594ad70f 100644 --- a/base/sources/miniclib/stdlib.c +++ b/base/sources/miniclib/stdlib.c @@ -2,6 +2,7 @@ #include "string.h" #include "stddef.h" #include "stdio.h" +#include "ctype.h" #define ALIGNMENT 8 #define ALIGN(size) (((size) + (ALIGNMENT - 1)) & ~(ALIGNMENT - 1)) @@ -117,14 +118,6 @@ void exit(int code) { exit(code); } -int isdigit(int c) { - return c >= '0' && c <= '9'; -} - -int isspace(int c) { - return c == ' ' || c == '\t' || c == '\n' || c == '\r'; -} - long int strtol(const char *str, char **endptr, int base) { while (isspace(*str)) { str++; diff --git a/base/tools/make.js b/base/tools/make.js index 8cf9b23c..c21a2077 100644 --- a/base/tools/make.js +++ b/base/tools/make.js @@ -2648,7 +2648,7 @@ class IronExporter { copy_blob(from, to, embed) { fs_ensuredir(path_join("build", "out", path_dirname(to))); let to_full = path_join("build", "out", to); - if (embed && !to.endsWith(".txt") && !to.endsWith(".md") && !to.endsWith(".json") && !to.endsWith(".c") && !to.endsWith(".html")) { + if (embed && !to.endsWith(".txt") && !to.endsWith(".md") && !to.endsWith(".json") && !to.endsWith(".c") && !to.endsWith(".html") && !to.endsWith(".js") && !to.endsWith(".ico")) { fs_ensuredir(path_join("build", "temp", path_dirname(to))); to_full = path_join("build", "temp", to); } @@ -2694,7 +2694,7 @@ function export_iron_project(project, options) { if (globalThis.flags.embed) { let embed_files = []; for (let asset of assets) { - if (asset.noembed || asset.from.endsWith(".txt") || asset.from.endsWith(".md") || asset.from.endsWith(".json") || asset.from.endsWith(".c") || asset.from.endsWith(".html")) { + if (asset.noembed || asset.from.endsWith(".txt") || asset.from.endsWith(".md") || asset.from.endsWith(".json") || asset.from.endsWith(".c") || asset.from.endsWith(".html") || asset.from.endsWith(".js") || asset.from.endsWith(".ico")) { continue; } embed_files.push(path_resolve("build", "temp", asset.files[0])); diff --git a/paint/project.js b/paint/project.js index d43cec4f..6bc24811 100644 --- a/paint/project.js +++ b/paint/project.js @@ -20,7 +20,6 @@ flags.export_data_list = platform == "android"; // .apk contents if (platform == "wasm") { flags.with_nfd = false; flags.with_compress = false; - flags.with_eval = false; flags.with_plugins = false; flags.with_raytrace = false; flags.export_data_list = true; diff --git a/paint/readme.md b/paint/readme.md index 28669a11..2aec2aa6 100644 --- a/paint/readme.md +++ b/paint/readme.md @@ -49,5 +49,5 @@ cd armorpaint/paint **WASM** ```bash -../base/make --target wasm --compile +../base/make --target wasm --compile --embed ``` diff --git a/paint/sources/base.c b/paint/sources/base.c index eddccb9d..d496eb03 100644 --- a/paint/sources/base.c +++ b/paint/sources/base.c @@ -32,7 +32,7 @@ void base_on_drop_files(char *drop_path) { void base_init_on_start_arm(void *_) { import_arm_run_project(project_filepath); // Auto-run script - if (project_raw->script_datas == NULL && project_raw->script_datas->length > 0) { + if (project_raw->script_datas != NULL && project_raw->script_datas->length > 0) { minic_ctx_t *ctx = minic_eval(project_raw->script_datas->buffer[0]); } }