Magic's graphics layer routes every drawing primitive through
function pointers (GrXxxPtr / grXxxPtr) that are bound to a driver
at startup. The original null driver assigned a single 0-arg
nullDoNothing() to every pointer, which works in native builds
because of K&R loose prototype rules but fails in WASM where
call_indirect requires an exact type match between caller and
callee.
This commit:
* Adds typed no-op stubs nullDoNothingI/II/IIII/IIIIIII for
void-returning callbacks of various arities.
* Adds nullReturnFalseI/II/III for bool-returning callbacks and
nullReturnZeroI for int-returning callbacks.
* Casts each pointer assignment in nullSetDisplay() to the K&R
pointer type the public header still uses, while the underlying
function carries the correct WASM signature.
* Fills in window-management and backing-store pointers that the
original null driver left at NULL — many of these are called
unconditionally by WindUpdate paths, and need at least a no-op
to avoid traps.
* Guards the stdin watch in nullSetDisplay() with #ifndef
__EMSCRIPTEN__: WASM has no real stdin file descriptor and
TxAdd1InputDevice() / SigWatchFile() are POSIX-specific.
Native builds are unaffected: the K&R-loose prototype machinery
still accepts the previous and the new code identically.
This driver is a modification of the Stanford X10 driver. The modifications
were done by Walter Scott and Eric Lunow at Lawrence Livermore National Labs.