Some fundamental definitions.
- §1. Build identity
- §2. Starting and stopping Foundation
- §2.1. Simple allocations
- §2.3. Debugging log
- §2.5. Writers and loggers
- §3. Setting up the memory manager
§1. Build identity. This notation tangles out to the current build number as specified in the contents section of this web.
define PROGRAM_NAME "intest" define INTEST_BUILD "intest [[Version Number]]"
§2. Starting and stopping Foundation. Like all the other Inform tools, this one is built on top of a module of standard library routines called Foundation. When Intest starts and ends, the following are called:
void Basics::start(int argc, char **argv) { Foundation::start(argc, argv); ArchModule::start(); Declare new memory allocation reasons2.2; Declare new debugging log aspects2.4; Declare new writers and loggers2.5; } void Basics::end(void) { Foundation::end(); }
§2.1. Simple allocations. Not all of our memory will be claimed in the form of structures: now and then we need to use the equivalent of traditional malloc and calloc routines.
enum TURN_STORAGE_MREASON enum COMMAND_HISTORY_MREASON
§2.2. Declare new memory allocation reasons2.2 =
Memory::reason_name(TURN_STORAGE_MREASON, "skein turn storage"); Memory::reason_name(COMMAND_HISTORY_MREASON, "command history storage");
- This code is used in §2.
enum VARIABLES_DA enum INSTRUCTIONS_DA enum DIFFER_DA enum HASHER_DA enum TESTER_DA
§2.4. Declare new debugging log aspects2.4 =
Log::declare_aspect(VARIABLES_DA, U"variables", FALSE, FALSE); Log::declare_aspect(INSTRUCTIONS_DA, U"instructions", FALSE, FALSE); Log::declare_aspect(DIFFER_DA, U"differ", FALSE, FALSE); Log::declare_aspect(HASHER_DA, U"hasher", FALSE, FALSE); Log::declare_aspect(TESTER_DA, U"tester", FALSE, FALSE);
- This code is used in §2.
§2.5. Writers and loggers. This enables the %k and $L format notations in WRITE and LOG respectively.
Declare new writers and loggers2.5 =
Writers::register_writer('k', &Skeins::write_node_label); Writers::register_logger('L', &Delia::log_line);
- This code is used in §2.
§3. Setting up the memory manager. We need to itemise the structures we'll want to allocate:
enum action_item_CLASS enum test_case_CLASS enum test_source_CLASS enum skein_CLASS enum edit_CLASS enum diff_results_CLASS enum test_CLASS enum historic_moment_CLASS enum recipe_CLASS enum recipe_line_CLASS enum recipe_token_CLASS
DECLARE_CLASS(action_item) DECLARE_CLASS(test_case) DECLARE_CLASS(test_source) DECLARE_CLASS(skein) DECLARE_CLASS(edit) DECLARE_CLASS(diff_results) DECLARE_CLASS(test) DECLARE_CLASS(historic_moment) DECLARE_CLASS(recipe) DECLARE_CLASS(recipe_line) DECLARE_CLASS(recipe_token)