Source tree reorganization: - Move StarForth v3 engine to v3/ (src/, include/, Makefile) - Move kernel to kernel/ (src/, include/, linker/, Makefile) - Create v4/ skeleton for F18-ISA golden model (DECOMPOSITION.md, JUSTIFICATION.md) - Move FABRIC-0..4.md to docs/fabric/ - Move ONTOLOGY.md and ROADMAP.md to docs/ Board infrastructure: - Add boards/ser5/, boards/raspi/, boards/milkv/, boards/zynq7020/ - Each board has board.mk (ISA, CPU flags, boot recipe) and README.md - Root Makefile becomes thin dispatcher: boot_image, all, clean, docs take TARGET - make boot_image TARGET=SER5|RASPI|MILKV builds one GPT/MBR image per board - ZYNQ7020 target exists but stops with clear error (ARMv7 port not built yet) - scripts/mkdiskimage.sh builds disk images for all boards Docs pipeline: - docs/book/ with LaTeX master (main.tex) and Makefile - pandoc converts Markdown to LaTeX at build time - Two Lua filters: table-widths.lua (wide tables wrap), code-breaks.lua (inline code breaks) - make docs builds single PDF (754 pages, 0 missing characters) - make docs TARGET=<board> adds board appendix - build/docs/<book|board>/meta.tex stamps git commit into PDF Bug fixes: - 42 include paths that only worked by accident now use correct relative paths - clang-18 hardcode replaced with configurable CC variable (fixed aarch64 build) - Pi 5: kernel_2712.img linked at 0x80000, .bss zeroed, memory reserved - Doxyfile, .clang-tidy, README.md, Kconfig paths updated Verified: - Hosted v3 build passes 1012 tests, 0 failures - SER5 image boots in QEMU (OVMF), POST passes, K exact (65536 = Q48_ONE) - Milk-V image boots in QEMU (OpenSBI + U-Boot + bootefi), POST passes - make clean TARGET=<board> removes only that board and its ISA objects - make all builds all boards, hosted v3, and docs in one run Co-authored-by: Junie <junie@jetbrains.com>
155 lines
7.3 KiB
C
155 lines
7.3 KiB
C
/*
|
||
StarForth — Steady-State Virtual Machine Runtime
|
||
|
||
Copyright (c) 2023–2025 Robert A. James
|
||
All rights reserved.
|
||
|
||
This file is part of the StarForth project.
|
||
|
||
Licensed under the StarForth License, Version 1.0 (the "License");
|
||
you may not use this file except in compliance with the License.
|
||
|
||
You may obtain a copy of the License at:
|
||
https://github.com/star.4th@proton.me/StarForth/LICENSE.txt
|
||
|
||
This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
express or implied, including but not limited to the warranties of
|
||
merchantability, fitness for a particular purpose, and noninfringement.
|
||
|
||
See the License for the specific language governing permissions and
|
||
limitations under the License.
|
||
|
||
StarForth — Steady-State Virtual Machine Runtime
|
||
Copyright (c) 2023–2025 Robert A. James
|
||
All rights reserved.
|
||
|
||
This file is part of the StarForth project.
|
||
|
||
Licensed under the StarForth License, Version 1.0 (the "License");
|
||
you may not use this file except in compliance with the License.
|
||
|
||
You may obtain a copy of the License at:
|
||
https://github.com/star.4th@proton.me/StarForth/LICENSE.txt
|
||
|
||
This software is provided "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
express or implied, including but not limited to the warranties of
|
||
merchantability, fitness for a particular purpose, and noninfringement.
|
||
|
||
See the License for the specific language governing permissions and
|
||
limitations under the License.
|
||
|
||
*/
|
||
|
||
#include "../include/word_registry.h"
|
||
#include "../include/log.h"
|
||
#include <string.h>
|
||
|
||
/* Include all FORTH-79 word module headers + extensions */
|
||
#include "word_source/include/acl_words.h"
|
||
#include "word_source/include/stack_words.h"
|
||
#include "word_source/include/return_stack_words.h"
|
||
#include "word_source/include/memory_words.h"
|
||
#include "word_source/include/dictionary_words.h"
|
||
#include "word_source/include/arithmetic_words.h"
|
||
#include "word_source/include/double_words.h"
|
||
#include "word_source/include/mixed_arithmetic_words.h"
|
||
#include "word_source/include/logical_words.h"
|
||
#include "word_source/include/io_words.h"
|
||
#include "word_source/include/format_words.h"
|
||
#include "word_source/include/string_words.h"
|
||
#include "word_source/include/control_words.h"
|
||
#include "word_source/include/defining_words.h"
|
||
#include "word_source/include/dictionary_manipulation_words.h"
|
||
#include "word_source/include/vocabulary_words.h"
|
||
#include "word_source/include/block_words.h"
|
||
#include "word_source/include/editor_words.h"
|
||
#include "word_source/include/system_words.h"
|
||
#include "word_source/include/starforth_words.h"
|
||
#include "word_source/include/physics_benchmark_words.h"
|
||
#include "word_source/include/physics_pipelining_diagnostic_words.h"
|
||
#include "word_source/include/physics_freeze_words.h"
|
||
#include "word_source/include/dictionary_heat_diagnostic_words.h"
|
||
#include "word_source/include/log_words.h"
|
||
#include "word_source/include/q48_words.h"
|
||
#include "word_source/include/inference_words.h"
|
||
#include "word_source/include/defer_words.h"
|
||
#include "word_source/include/framebuffer_words.h"
|
||
#include "word_source/include/keyboard_words.h"
|
||
#include "word_source/include/ttf_words.h"
|
||
#include "word_source/include/scroll_words.h"
|
||
#ifdef __STARKERNEL__
|
||
#include "starkernel/doe_log.h"
|
||
#include "starkernel/repl.h"
|
||
#endif
|
||
|
||
/**
|
||
* @brief Registers a single FORTH word in the virtual machine
|
||
* @param vm Pointer to the virtual machine instance
|
||
* @param name Name of the FORTH word to register
|
||
* @param func Function pointer to the word's implementation
|
||
*/
|
||
void register_word(VM *vm, const char *name, word_func_t func) {
|
||
DictEntry *entry = vm_create_word(vm, name, strlen(name), func);
|
||
if (entry) {
|
||
log_message(LOG_DEBUG, "Registered word: %s", name);
|
||
} else {
|
||
log_message(LOG_ERROR, "Failed to register word: %s", name);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* @brief Registers all standard FORTH-79 words in the virtual machine
|
||
* @param vm Pointer to the virtual machine instance
|
||
* @details Registers all 18 FORTH-79 word modules in dependency order,
|
||
* starting with fundamental stack operations and building up to
|
||
* more complex functionality like control flow and editing.
|
||
*/
|
||
void register_forth79_words(VM *vm) {
|
||
log_message(LOG_INFO, "Registering FORTH-79 Standard word set...");
|
||
|
||
/* Register all 18 FORTH-79 word modules IN DEPENDENCY ORDER */
|
||
register_stack_words(vm); /* Module 1: Stack Operations - FOUNDATION */
|
||
register_return_stack_words(vm); /* Module 2: Return Stack Operations */
|
||
register_memory_words(vm); /* Module 3: Memory Operations */
|
||
register_arithmetic_words(vm); /* Module 4: Arithmetic Operations */
|
||
register_logical_words(vm); /* Module 5: Logical & Comparison */
|
||
register_mixed_arithmetic_words(vm); /* Module 6: Mixed Arithmetic - needs arithmetic + stack */
|
||
register_double_words(vm); /* Module 7: Double Number Arithmetic */
|
||
register_format_words(vm); /* Module 8: Formatting & Conversion */
|
||
register_string_words(vm); /* Module 9: String & Text Processing */
|
||
register_io_words(vm); /* Module 10: I/O & Terminal */
|
||
register_block_words(vm); /* Module 11: Block & Mass Storage */
|
||
register_dictionary_words(vm); /* Module 12: Dictionary & Compilation */
|
||
register_dictionary_manipulation_words(vm); /* Module 13: Dictionary Manipulation */
|
||
register_vocabulary_words(vm); /* Module 14: Vocabulary System */
|
||
register_system_words(vm); /* Module 15: System & Environment */
|
||
register_editor_words(vm); /* Module 16: Line Editor */
|
||
register_defining_words(vm); /* Module 17: Defining Words */
|
||
register_control_words(vm); /* Module 18: Control Flow */
|
||
register_starforth_words(vm); /* Module 19: StarForth Implementation Extensions */
|
||
register_acl_words(vm); /* Module 20: Word-Level ACL System */
|
||
register_physics_benchmark_words(vm); /* Module 21: Physics Benchmark Words */
|
||
register_physics_pipelining_diagnostic_words(vm); /* Module 21: Pipelining Diagnostics */
|
||
register_physics_freeze_words(vm); /* Module 22: Phase 2 Freeze/Decay Control Words */
|
||
register_dictionary_heat_diagnostic_words(vm); /* Module 23: Dictionary Heat Optimization */
|
||
register_log_words(vm); /* Module 24: Log Level Control */
|
||
register_q48_words(vm); /* Module 25: Q48.16 Fixed-Point Math */
|
||
register_inference_words(vm); /* Module 26: SSM Inference + Jacquard */
|
||
register_defer_words(vm); /* Module 27: DEFER / IS late binding */
|
||
/* Module 28 (PLOT/FB-WIDTH/FB-HEIGHT, framebuffer_words.c) deliberately
|
||
* NOT registered here -- FABRIC-3.6.md task 1.8 (item 33): every VM got
|
||
* these unconditionally before this change (confirmed live, task 0.8 --
|
||
* Hermes and Artemis could both call FB-WIDTH despite never loading
|
||
* fabric.4th). Hestia is now the sole owner; see the name-gated call in
|
||
* capsule_birth_baby() (capsule_birth.c), the only place a VM's name is
|
||
* known at the point its dictionary is built. */
|
||
register_keyboard_words(vm); /* Module 29: Console fabric -- raw keyboard scancode diagnostic */
|
||
register_ttf_words(vm); /* Module 30: TrueType text entry point */
|
||
register_scroll_words(vm); /* Module 31: REPL scrollback (FABRIC-0.md 4.4q) */
|
||
#ifdef __STARKERNEL__
|
||
register_doe_log_words(vm); /* Module 32: DoE instrumentation runtime toggle (HB-ON/HB-OFF) */
|
||
sk_repl_register_words(vm); /* Module 33: BLK-ATTACH-ACK, Artemis's storage-attach reply target */
|
||
#endif
|
||
|
||
log_message(LOG_INFO, "FORTH-79 Standard word set registration complete");
|
||
} |