3 Commits

Author SHA1 Message Date
Eremey Valetov
eaa1166d8c Fix QA findings: FRE GC safety, WAIT mask=0, ENVIRON leak, sentinel collision
- FRE(): remove strpool_gc() call during expression evaluation — temporaries
  on the C stack would become dangling pointers after compaction
- WAIT: reject mask=0 (would infinite-loop since AND 0 is always 0)
- ENVIRON: use setenv()+free() instead of putenv() to avoid memory leak
  and dangling pointer if pool is compacted
- portio: add bounds check to com1_inp() (com1_out already had one)
- kernel: use CHR$(1) sentinel prefix to avoid collision with user output
- kernel: fix INPUT prompt rfind() edge case when no newline in buffer
- eval.c: enlarge DATE$ format buffer to silence -Wformat-truncation
2026-03-29 06:15:16 -04:00
Eremey Valetov
ba655fedbb Add inline Sixel graphics, INPUT stdin support, Pygments lexer to kernel
Sixel graphics: pure-Python decoder extracts ESC P...ESC \ sequences from
the output stream, renders RGBA pixels, and encodes as PNG for inline
display in the notebook. No external dependencies (no PIL, no Ghostscript).

INPUT support: when gwbasic prints "? " (INPUT prompt), the kernel uses
the Jupyter stdin protocol (raw_input) to request input from the user and
feeds the response back to the subprocess.

Pygments lexer (basic_lexer.py): GW-BASIC syntax highlighting with line
numbers, keywords, builtins, string/number literals, and comments.
Registered as a Pygments entry point and referenced in kernel language_info.

Test suite expanded from 10 to 14 tests (Sixel decode, PNG encode, inline
graphics integration, lexer tokenization).
2026-03-29 06:03:50 -04:00
Eremey Valetov
3e8aaa298b Implement Jupyter kernel for GW-BASIC 2026
Persistent subprocess model: gwbasic reads BASIC from stdin and writes
output to stdout in piped mode (no banner, no prompts, unbuffered).
Sentinel protocol (PRINT "<<<GWDONE>>>") delimits output per cell.

Features: state persistence across cells, error detection and reporting,
tab completion for GW-BASIC keywords, %reset/%timeout/%new magic
commands, Ctrl+C forwarding, automatic process restart.

Includes setup.py for pip install, kernel.json spec, install script,
and 10-test smoke suite (all passing).
2026-03-29 05:51:37 -04:00