Tomo Standard Library
This directory contains all of the standard library functionality that is built into each Tomo program. It has all the logic for core datastructures as well as some common functionality.
Each datatype comes as a pair of headers: datatypes/<type>.h gives its memory
layout and nothing else, while <type>.h beside it declares the functions that
operate on it. The layout headers declare no functions, which is what keeps them
clear of the cycle between the datatypes and the TypeInfo_t that describes
them. datatypes.h is an umbrella over all of the layouts, and
tomo.h is an umbrella over everything.
Core Functions
- Tomo headers all in one place: tomo.h
- Tomo standard library functions: stdlib.h, stdlib.c
- Metamethods: metamethods.h, metamethods.c
- Siphash: siphash.h, siphash.c, siphash-internals.h
- Utilities (header-only): util.h
Core Data Types
- All layouts in one place: datatypes.h
- Bool: datatypes/bool.h, bool.h, bool.c
- Byte: datatypes/byte.h, byte.h, byte.c
- C String: c_string.h, c_string.c
- Closure: datatypes/closure.h, functiontype.h, functiontype.c
- Float: datatypes/float.h, floats.h over float64.h and float32.h, from the floatX.h/floatX.c.h templates
- Int: datatypes/int.h, integers.h over bigint.h and int64.h/int32.h/int16.h/int8.h, from the intX.h/intX.c.h templates
- List: datatypes/list.h, list.h, list.c
- Num: datatypes/num.h, num.h, num.c, over the exact-real core in number.h/number.c (see number-design.md)
- Path: datatypes/path.h, path.h, path.c
- Present: datatypes/present.h
- Result: datatypes/result.h, result.h, result.c
- Table: datatypes/table.h, table.h, table.c
- Text: datatypes/text.h, text.h, text.c
- Type Infos (for representing types as values): datatypes/typeinfo.h, typeinfo.h, typeinfo.c
- Memory: memory.h, memory.c
Shared Behavior
These cover a whole class of types rather than one type, which is why they stay plural:
- Enums: enums.h, enums.c
- Optionals: optionals.h, optionals.c
- Pointers: pointers.h, pointers.c
- Structs: structs.h, structs.c
Other
- Command line parsing: cli.h, cli.c
- Debugger support: debugger.h, debugger.c
- Failure and error reporting: fail.h, fail.c, report.h, report.c
- Files (used internally only): files.h, files.c
- Formatted printing: print.h, print.c
- Float formatting: fpconv.h, fpconv.c, powers.h
- Profiling for
--instrumentbuilds: profiling.h, profiling.c - Randomness: random.h
- Simple parsing helpers: simpleparse.h, simpleparse.c
- Stack traces: stacktrace.h, stacktrace.c
- Test harness for
tomo test: test_harness.h, test_harness.c - Macro helpers: mapmacro.h