"progress report" of percent completion on certain long-running
processes (namely extraction, DEF reads, and GDS/CIF writes) was
allowing Tcl/Tk events to be processed so that the display would
be repainted and the console window updated to show the progress
instead of hanging. But that was allowing any key macros or
commands to be entered and executed, potentially corrupting the
database while the process was running. I have used
Tk_RestrictEvents() to prevent key and button events from being
processed until afterward. This preserves the display updates
(which do not alter the database) while preventing commands from
being run during one of these long-running processes. Also:
Previously, whenever a long-running process printed the status,
it would not update at the end, leaving output like "52% complete"
being the last output, leaving the impression that the process
never finished. Changed the code so that if any partial progress
is printed, then it will always finish up with the output "100%
complete" so that it is clear to the user that everything went
according to plan.
Glue between the null display driver and the rest of Magic so that
running with -d null does not require any process-level resources
(signals, timers, stdin, an X display, or a Tcl interpreter).
* utils/signals.c — gate setitimer, fcntl-based file watches, kill
and the legacy sigsetmask/sigaction setup behind #ifdef
__EMSCRIPTEN__. Every signals path becomes a no-op in WASM.
Also fixes DBWriteBackup() being called with one argument when
its real prototype takes three.
* windows/windDisp.c — WindUpdate() returns immediately when
GrDisplayStatus == DISPLAY_SUSPEND. This is the runtime
counterpart to the null driver's DISPLAY_SUSPEND state.
* extflat/EFargs.c — EFArgs() with a missing input name no longer
jumps to "usage:" in headless WASM (which would call MainExit and
kill the process); it sets *err_result and returns NULL so the
caller can decide what to do. Native MAGIC_WRAPPER and native
non-MAGIC_WRAPPER builds keep their original behavior.
* dbwind/DBWcommands.c — registers exttosim / ext2sim / exttospice /
ext2spice in non-MAGIC_WRAPPER builds. Without this, WASM users
could not invoke these commands at all (they were previously
inside an #ifdef MAGIC_WRAPPER block). The C implementations
(CmdExtToSim / CmdExtToSpice) are linked unconditionally outside
modular builds.
* textio/txCommands.c, textio/textio.h — TxDispatchString(), a new
library-style command entry point that parses a single string,
dispatches it through WindSendCommand and returns a status code.
This is what magic_wasm_run_command() calls from JavaScript.
This seems like it has 2 use cases.
Internal console management around reprinting command prompt, but many
modes of operation delegate the prompt processing to tkcon or readline.
Process termination to restore the termios.
However, this has not been implemented as it has been observed that
the use of itimer() has a restriction of one timer per process, which
interferes with the three or more uses of the timer within magic. The
timer method will have to be changed to use the POSIX timer_create()
routine, before this will work properly.