Forth#2947
Conversation
|
(made with the help of Claude code) |
pforth cell_t = uintptr_t, so the pre-compiled dictionary is cell-size-dependent (64-bit on x86-64, 32-bit on WASM). Loading a 64-bit dictionary in a 32-bit runtime corrupts all addresses and freezes the HTML player. - cmake/pfdicdat_32.h: new 32-bit dictionary (generated with gcc -m32) - cmake/forth.cmake: select pfdicdat_32.h when CMAKE_SIZEOF_VOID_P == 4
|
Note: OP had the courtesy to open a discussion (#2938) regarding the project's AI contribution policy before vibe-coding this payload. Resolving the policy matter should probably be considered a prerequisite to reviewing this PR. |
MineRobber9000
left a comment
I don't know enough about pforth to critique the actual implementation of the API, but there are definitely some spots in here that I am concerned about.
| message(STATUS "Forth: copying bundled ${_PFORTH_DICDAT_BUNDLED} to ${PFORTH_DICDAT}") | ||
| configure_file(${_PFORTH_DICDAT_BUNDLED} ${PFORTH_DICDAT} COPYONLY) | ||
| else() | ||
| message(STATUS "Forth: pfdicdat.h not found — bootstrapping pforth to generate it...") |
If we can use pforth to bootstrap the pfdicdat.h generation, why are we bundling a version of this data anyways? What happens if pforth updates in a way that adds more stuff to the dictionary, and now our bundled data is out of date?
| \ license: MIT License | ||
| \ script: forth | ||
| \ | ||
| \ -- TIC-80 Forth API -------------------------------------------------- |
| ; | ||
|
|
||
| \ -- Demo 2 : sprite + arrow keys ------------------------------------- | ||
| : demo02 |
This is the only one you actually need to have. The others are all just clutter that a user would have to delete before starting their own game.
|
|
||
| : BOOT | ||
| 96 px ! 24 py ! | ||
| S" Forth BOOT" 12 TRACE |
Remove this, no other language does this. (EDIT: to clarify, since GH shows a seemingly random collection of lines and not the one you explicitly select in the interface, this is referring to tracing "Forth BOOT" in the BOOT callback.)
| @@ -0,0 +1,129 @@ | |||
| // MIT License | |||
This should also go in forth.c. In general, all languages should be one C file apiece; the only exception are the Lua languages (Lua, MoonScript, Yue, and Fennel), since they all share the same plumbing underneath and only differ in how they're initialized.
adding Forth langages to TIC-80 (using pforth)