Fixed ecode emscripten build.

Minor improvements in JavaScript syntax definition.
This commit is contained in:
Martín Lucas Golini
2022-05-30 18:55:01 -03:00
parent f9123e259d
commit 76fee55a19
3 changed files with 91 additions and 1 deletions

View File

@@ -483,6 +483,7 @@ function build_link_configuration( package_name, use_ee_icon )
linkoptions { "-O3 -s TOTAL_MEMORY=67108864" }
linkoptions { "-s USE_SDL=2" }
buildoptions { "-O3 -s USE_SDL=2 -s PRECISE_F32=1 -s ENVIRONMENT=worker,web" }
defines { "NO_POSIX_SPAWN" }
if _OPTIONS["with-emscripten-pthreads"] then
buildoptions { "-s USE_PTHREADS=1" }

View File

@@ -230,6 +230,12 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() {
{ { "-?%d+[%d%.eE]*" }, "number" },
{ { "-?%.?%d+" }, "number" },
{ { "[%+%-=/%*%^%%<>!~|&]" }, "operator" },
{ { "([%w_][%w_]+)%.([%w_][%w%d_]*)%s*(=)%s*(function)" },
{ "normal", "keyword2", "function", "operator", "keyword" } },
{ { "([%w_][%w_]+)%.([%w_][%w%d_]*)%s*(=)%s*(async%s*function)" },
{ "normal", "keyword2", "function", "operator", "keyword" } },
{ { "([%w_][%w_]+)%.([%w_][%w%d_]*)%s*(=)%s*%b()%s*(=>)" },
{ "normal", "keyword2", "function", "operator", "operator" } },
{ { "[%a_][%w_]*%s*%f[(]" }, "function" },
{ { "[%a_][%w_]*" }, "symbol" },
},
@@ -251,7 +257,7 @@ SyntaxDefinitionManager::SyntaxDefinitionManager() {
{ "implements", "keyword" }, { "Array", "keyword2" }, { "any", "keyword" },
{ "from", "keyword" }, { "public", "keyword" }, { "private", "keyword" },
{ "declare", "keyword" }, { "namespace", "keyword" }, { "protected", "keyword" },
{ "enum", "keyword" } },
{ "enum", "keyword" }, { "function", "keyword" } },
"//" } );
// JSON

View File

@@ -767,6 +767,10 @@ int subprocess_create_ex(const char *const commandLine[], int options,
}
}
#if !defined(NO_POSIX_SPAWN)
if (environment) {
#ifdef __clang__
#pragma clang diagnostic push
@@ -884,7 +888,86 @@ int subprocess_create_ex(const char *const commandLine[], int options,
out_process->alive = 1;
posix_spawn_file_actions_destroy(&actions);
return 0;
#else
child = fork();
if (-1 == child) {
return -1;
}
if (0 == child) {
// Close the stdin write end
close(stdinfd[1]);
// Map the read end to stdin
dup2(stdinfd[0], STDIN_FILENO);
// Close the stdout read end
close(stdoutfd[0]);
// Map the write end to stdout
dup2(stdoutfd[1], STDOUT_FILENO);
if (subprocess_option_combined_stdout_stderr ==
(options & subprocess_option_combined_stdout_stderr)) {
dup2(STDOUT_FILENO, STDERR_FILENO);
} else {
// Close the stderr read end
close(stderrfd[0]);
// Map the write end to stdout
dup2(stderrfd[1], STDERR_FILENO);
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
#pragma clang diagnostic ignored "-Wold-style-cast"
#endif
if (environment) {
_Exit(execve(commandLine[0], (char *const *)commandLine,
(char *const *)environment));
} else if (subprocess_option_inherit_environment !=
(options & subprocess_option_inherit_environment)) {
_Exit(execve(commandLine[0], (char *const *)commandLine,
empty_environment));
} else {
_Exit(execvp(commandLine[0], (char *const *)commandLine));
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} else {
// Close the stdin read end
close(stdinfd[0]);
// Store the stdin write end
out_process->stdin_file = fdopen(stdinfd[1], "wb");
// Close the stdout write end
close(stdoutfd[1]);
// Store the stdout read end
out_process->stdout_file = fdopen(stdoutfd[0], "rb");
if (subprocess_option_combined_stdout_stderr ==
(options & subprocess_option_combined_stdout_stderr)) {
out_process->stderr_file = out_process->stdout_file;
} else {
// Close the stderr write end
close(stderrfd[1]);
// Store the stderr read end
out_process->stderr_file = fdopen(stderrfd[0], "rb");
}
// Store the child's pid
out_process->child = child;
out_process->alive = 1;
return 0;
}
#endif
#endif
}