From 48dd1f9411a3cf015c67cda85f0451613445ace5 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Thu, 16 Feb 2023 22:00:47 +1100 Subject: [PATCH] Testing the C API docs --- c-api/toy_common_h.md | 36 ++++++++++++++++++++++++++++++++++++ index.md | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 c-api/toy_common_h.md diff --git a/c-api/toy_common_h.md b/c-api/toy_common_h.md new file mode 100644 index 0000000..90ed72c --- /dev/null +++ b/c-api/toy_common_h.md @@ -0,0 +1,36 @@ +# toy_common.h + +This file is generally included in most header files within Toy, as it is where the `TOY_API` macro is defined. It also has some utilities intended for use only by the repl; as such, they won't be documented here. + +## Defined Macros + +### TOY_API + +This definition of this macro is platform-dependant, and used to enable cross-platform compilation of shared and static libraries. + +### TOY_VERSION_MAJOR + +The current major version of Toy. This value is embedded into the bytecode, and the interpreter will refuse to run bytecode with a major version that does not match it's own version. + +This value MUST fit into an unsigned char. + +### TOY_VERSION_MINOR + +The current minor version of Toy. This value is embedded into the bytecode, and the interpreter will refuse to run bytecode with a minor version that is greater than its own minor version. + +This value MUST fit into an unsigned char. + +### TOY_VERSION_PATCH + +The current patch version of Toy. This value is embedded into the bytecode. + +This value MUST fit into an unsigned char. + +### TOY_VERSION_BUILD + +The current build version of Toy. This value is embedded into the bytecode. + +This value is a string, which contains build information such as compilation date and time of the interpreter. When in verbose mode, the compiler will display a warning if the build version of the bytecode does not match the build version of the interpreter. + +This macro may also be used to store information about forks of the Toy codebase. + diff --git a/index.md b/index.md index f0147d1..46a74e3 100644 --- a/index.md +++ b/index.md @@ -61,7 +61,7 @@ print tally(); //3 # Full C API * [toy_ast_node.h] -* [toy_common.h] +* [toy_common.h](c-api/toy_common_h.md) * [toy_compiler.h] * [toy_interpreter.h] * [toy_lexer.h]