diff options
Diffstat (limited to 'src')
86 files changed, 120 insertions, 72 deletions
@@ -1,5 +1,6 @@ // Some basic operations defined on AST nodes, mainly converting to // strings for debugging. + #include <stdarg.h> #include "ast.h" @@ -1,7 +1,7 @@ -#pragma once - // Logic defining ASTs (abstract syntax trees) to represent code +#pragma once + #include <err.h> #include <stdbool.h> #include <stdint.h> diff --git a/src/compile/assertions.h b/src/compile/assertions.h index b5f604d2..bfa1de48 100644 --- a/src/compile/assertions.h +++ b/src/compile/assertions.h @@ -1,4 +1,5 @@ // This file defines how to compile assertions + #pragma once #include "../ast.h" diff --git a/src/compile/assignments.h b/src/compile/assignments.h index 94de05e3..de2aef26 100644 --- a/src/compile/assignments.h +++ b/src/compile/assignments.h @@ -1,4 +1,5 @@ // This file defines how to compile assignments + #pragma once #include "../ast.h" diff --git a/src/compile/binops.h b/src/compile/binops.h index c19df06a..50dd398a 100644 --- a/src/compile/binops.h +++ b/src/compile/binops.h @@ -1,4 +1,5 @@ // This file defines how to compile binary operations + #pragma once #include "../ast.h" diff --git a/src/compile/blocks.h b/src/compile/blocks.h index 59d85b6c..257a4a95 100644 --- a/src/compile/blocks.h +++ b/src/compile/blocks.h @@ -1,4 +1,5 @@ // This file defines how to compile blocks + #pragma once #include "../ast.h" diff --git a/src/compile/cli.h b/src/compile/cli.h index fa8f0915..13c3dee5 100644 --- a/src/compile/cli.h +++ b/src/compile/cli.h @@ -1,4 +1,5 @@ // This file defines how to compile CLI argument parsing + #pragma once #include "../environment.h" diff --git a/src/compile/comparisons.h b/src/compile/comparisons.h index 105387d5..421bcd4a 100644 --- a/src/compile/comparisons.h +++ b/src/compile/comparisons.h @@ -1,4 +1,5 @@ // This file defines how to compile comparisons + #pragma once #include "../ast.h" diff --git a/src/compile/compilation.h b/src/compile/compilation.h index a167d324..c034295f 100644 --- a/src/compile/compilation.h +++ b/src/compile/compilation.h @@ -1,4 +1,5 @@ // Common header files for compilation + #pragma once #include "assertions.h" // IWYU pragma: export @@ -6,8 +7,8 @@ #include "binops.h" // IWYU pragma: export #include "blocks.h" // IWYU pragma: export #include "cli.h" // IWYU pragma: export -#include "compilation.h" // IWYU pragma: export #include "comparisons.h" // IWYU pragma: export +#include "compilation.h" // IWYU pragma: export #include "conditionals.h" // IWYU pragma: export #include "declarations.h" // IWYU pragma: export #include "doctests.h" // IWYU pragma: export diff --git a/src/compile/conditionals.h b/src/compile/conditionals.h index ccb3dada..d8d1bb5f 100644 --- a/src/compile/conditionals.h +++ b/src/compile/conditionals.h @@ -1,4 +1,5 @@ // This file defines how to compile 'if' conditionals + #pragma once #include "../ast.h" diff --git a/src/compile/declarations.c b/src/compile/declarations.c index e7d9ad2c..3f2164af 100644 --- a/src/compile/declarations.c +++ b/src/compile/declarations.c @@ -1,4 +1,5 @@ // This file defines how to compile variable declarations + #include "../ast.h" #include "../environment.h" #include "../stdlib/datatypes.h" diff --git a/src/compile/declarations.h b/src/compile/declarations.h index 72272d6b..30022f6f 100644 --- a/src/compile/declarations.h +++ b/src/compile/declarations.h @@ -1,4 +1,5 @@ // This file defines how to compile variable declarations + #pragma once #include "../ast.h" diff --git a/src/compile/doctests.h b/src/compile/doctests.h index 92cbe9fa..06603e1a 100644 --- a/src/compile/doctests.h +++ b/src/compile/doctests.h @@ -1,4 +1,5 @@ // This file defines how to compile doctests + #pragma once #include "../ast.h" diff --git a/src/compile/enums.h b/src/compile/enums.h index 2d4dd791..888fc294 100644 --- a/src/compile/enums.h +++ b/src/compile/enums.h @@ -1,4 +1,5 @@ // This file defines how to compile enums + #pragma once #include "../ast.h" diff --git a/src/compile/expressions.h b/src/compile/expressions.h index 86bc110f..28afdfb1 100644 --- a/src/compile/expressions.h +++ b/src/compile/expressions.h @@ -1,4 +1,5 @@ // This file defines logic for compiling expressions + #pragma once #include "../ast.h" diff --git a/src/compile/fieldaccess.h b/src/compile/fieldaccess.h index 849df080..bd3b5840 100644 --- a/src/compile/fieldaccess.h +++ b/src/compile/fieldaccess.h @@ -1,4 +1,5 @@ // This file defines how to compile field accessing like `foo.x` + #pragma once #include "../ast.h" diff --git a/src/compile/files.h b/src/compile/files.h index 94047638..3defc3ee 100644 --- a/src/compile/files.h +++ b/src/compile/files.h @@ -1,4 +1,5 @@ // This file defines how to compile files + #pragma once #include "../ast.h" diff --git a/src/compile/functions.h b/src/compile/functions.h index d269a10b..15c69ea4 100644 --- a/src/compile/functions.h +++ b/src/compile/functions.h @@ -1,4 +1,5 @@ // This file defines how to compile functions + #pragma once #include "../ast.h" diff --git a/src/compile/headers.h b/src/compile/headers.h index edfd4086..0df2fe27 100644 --- a/src/compile/headers.h +++ b/src/compile/headers.h @@ -1,4 +1,5 @@ // This file defines how to compile header files + #pragma once #include "../ast.h" diff --git a/src/compile/indexing.h b/src/compile/indexing.h index 59b5a3ad..bf30f98a 100644 --- a/src/compile/indexing.h +++ b/src/compile/indexing.h @@ -1,4 +1,5 @@ // This file defines how to compile indexing like `list[i]` or `ptr[]` + #pragma once #include "../ast.h" diff --git a/src/compile/integers.h b/src/compile/integers.h index 667c5221..18dc792f 100644 --- a/src/compile/integers.h +++ b/src/compile/integers.h @@ -1,4 +1,5 @@ // This file defines how to compile integers + #pragma once #include "../ast.h" diff --git a/src/compile/lists.h b/src/compile/lists.h index e9b72b12..9cbf10d7 100644 --- a/src/compile/lists.h +++ b/src/compile/lists.h @@ -1,4 +1,5 @@ // This file defines how to compile lists + #pragma once #include "../ast.h" diff --git a/src/compile/loops.h b/src/compile/loops.h index 762c72f0..a21b4254 100644 --- a/src/compile/loops.h +++ b/src/compile/loops.h @@ -1,4 +1,5 @@ // This file defines how to compile loops + #pragma once #include "../ast.h" diff --git a/src/compile/optionals.h b/src/compile/optionals.h index ddacba63..d30aaefb 100644 --- a/src/compile/optionals.h +++ b/src/compile/optionals.h @@ -1,4 +1,5 @@ // This file defines how to compile optionals and null + #pragma once #include "../ast.h" diff --git a/src/compile/pointers.h b/src/compile/pointers.h index 8a4c921a..2e11d892 100644 --- a/src/compile/pointers.h +++ b/src/compile/pointers.h @@ -1,4 +1,5 @@ // This file defines how to compile pointers and allocated memory + #pragma once #include <stdbool.h> diff --git a/src/compile/promotions.h b/src/compile/promotions.h index 49e649eb..ea6a6742 100644 --- a/src/compile/promotions.h +++ b/src/compile/promotions.h @@ -1,4 +1,5 @@ // This file defines how to do type promotions during compilation + #pragma once #include "../ast.h" diff --git a/src/compile/reductions.h b/src/compile/reductions.h index 5c76c74f..823612af 100644 --- a/src/compile/reductions.h +++ b/src/compile/reductions.h @@ -1,4 +1,5 @@ // This file defines how to compile reductions like `(+: nums)` + #pragma once #include "../ast.h" diff --git a/src/compile/sets.h b/src/compile/sets.h index 7f34c482..1582e3cd 100644 --- a/src/compile/sets.h +++ b/src/compile/sets.h @@ -1,4 +1,5 @@ // This file defines how to compile sets + #pragma once #include "../ast.h" diff --git a/src/compile/statements.h b/src/compile/statements.h index 4284a61c..061d9125 100644 --- a/src/compile/statements.h +++ b/src/compile/statements.h @@ -1,4 +1,5 @@ // This file defines how to compile statements + #pragma once #include "../ast.h" diff --git a/src/compile/structs.h b/src/compile/structs.h index 94c6f94a..90901554 100644 --- a/src/compile/structs.h +++ b/src/compile/structs.h @@ -1,4 +1,5 @@ // This file defines how to compile structs + #pragma once #include "../ast.h" diff --git a/src/compile/tables.h b/src/compile/tables.h index 7e29a926..49ae15f3 100644 --- a/src/compile/tables.h +++ b/src/compile/tables.h @@ -1,4 +1,5 @@ // This file defines how to compile tables + #pragma once #include "../ast.h" diff --git a/src/compile/text.c b/src/compile/text.c index f8576f63..0e0b41f8 100644 --- a/src/compile/text.c +++ b/src/compile/text.c @@ -1,4 +1,5 @@ // This file defines how to compile text + #include <ctype.h> #include "../ast.h" diff --git a/src/compile/text.h b/src/compile/text.h index fcabc8b4..c160c7a9 100644 --- a/src/compile/text.h +++ b/src/compile/text.h @@ -1,4 +1,5 @@ // This file defines how to compile text + #pragma once #include "../ast.h" diff --git a/src/compile/types.c b/src/compile/types.c index ce339645..aa06e2fd 100644 --- a/src/compile/types.c +++ b/src/compile/types.c @@ -1,4 +1,5 @@ // This file defines how to compile types and type info values + #include "../types.h" #include "../ast.h" #include "../environment.h" diff --git a/src/compile/types.h b/src/compile/types.h index 35394f5d..f4549891 100644 --- a/src/compile/types.h +++ b/src/compile/types.h @@ -1,4 +1,5 @@ // This file defines how to compile types and type info values + #pragma once #include "../stdlib/datatypes.h" diff --git a/src/compile/whens.h b/src/compile/whens.h index 473124d5..9541a280 100644 --- a/src/compile/whens.h +++ b/src/compile/whens.h @@ -1,4 +1,5 @@ // This file defines how to compile 'when' statements/expressions + #pragma once #include "../ast.h" diff --git a/src/environment.c b/src/environment.c index 4a6407a6..5efedfbe 100644 --- a/src/environment.c +++ b/src/environment.c @@ -1,5 +1,6 @@ // Logic for the environmental context information during compilation // (variable bindings, code sections, etc.) + #include <stdlib.h> #include <sys/stat.h> diff --git a/src/environment.h b/src/environment.h index 293b10a8..1ef9c1f9 100644 --- a/src/environment.h +++ b/src/environment.h @@ -1,10 +1,10 @@ -#pragma once - // Compilation environments +#pragma once + #include "stdlib/datatypes.h" -#include "stdlib/print.h" -#include "stdlib/stdlib.h" +#include "stdlib/print.h" // IWYU pragma: export +#include "stdlib/stdlib.h" // IWYU pragma: export #include "types.h" typedef struct { diff --git a/src/modules.c b/src/modules.c index a62e7846..40b3daf3 100644 --- a/src/modules.c +++ b/src/modules.c @@ -1,4 +1,5 @@ // This file defines some code for getting info about modules and installing them. + #include <err.h> #include <stdlib.h> #include <string.h> diff --git a/src/modules.h b/src/modules.h index 91e17043..1c3b2d8e 100644 --- a/src/modules.h +++ b/src/modules.h @@ -1,3 +1,5 @@ +// Logic for getting information about and installing modules + #pragma once #include <stdbool.h> diff --git a/src/naming.h b/src/naming.h index 8b4da8b2..072e40b9 100644 --- a/src/naming.h +++ b/src/naming.h @@ -1,7 +1,7 @@ -#pragma once - // Compilation environments +#pragma once + #include "environment.h" #include "stdlib/datatypes.h" diff --git a/src/parse/numbers.c b/src/parse/numbers.c index c12a68b2..4e746525 100644 --- a/src/parse/numbers.c +++ b/src/parse/numbers.c @@ -10,7 +10,6 @@ #include <uniname.h> #include "../ast.h" -#include "../stdlib/util.h" #include "context.h" #include "errors.h" #include "utils.h" diff --git a/src/parse/utils.c b/src/parse/utils.c index a047e73d..6314b849 100644 --- a/src/parse/utils.c +++ b/src/parse/utils.c @@ -8,7 +8,6 @@ #include "../stdlib/util.h" #include "errors.h" -#include "expressions.h" #include "utils.h" static const char *keywords[] = { diff --git a/src/stdlib/c_strings.c b/src/stdlib/c_strings.c index e28e8c20..2946ce58 100644 --- a/src/stdlib/c_strings.c +++ b/src/stdlib/c_strings.c @@ -1,4 +1,5 @@ // Type info and methods for CString datatype (char*) + #include <err.h> #include <gc.h> #include <stdbool.h> diff --git a/src/stdlib/c_strings.h b/src/stdlib/c_strings.h index d009c8bd..f85fa0d6 100644 --- a/src/stdlib/c_strings.h +++ b/src/stdlib/c_strings.h @@ -1,7 +1,7 @@ -#pragma once - // Type info and methods for CString datatype, which represents C's `char*` +#pragma once + #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/datatypes.h b/src/stdlib/datatypes.h index 81ad8db2..373cbc47 100644 --- a/src/stdlib/datatypes.h +++ b/src/stdlib/datatypes.h @@ -1,7 +1,7 @@ -#pragma once - // Common datastructures (lists, tables, closures) +#pragma once + #include <gmp.h> #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/files.c b/src/stdlib/files.c index b8f493e3..7fd4c2c7 100644 --- a/src/stdlib/files.c +++ b/src/stdlib/files.c @@ -1,6 +1,4 @@ -// -// files.c - Implementation of some file loading functionality. -// +// Implementation of some file loading functionality. #include <ctype.h> #include <err.h> diff --git a/src/stdlib/files.h b/src/stdlib/files.h index ebece6f0..1840e907 100644 --- a/src/stdlib/files.h +++ b/src/stdlib/files.h @@ -1,6 +1,5 @@ -// -// files.h - Definitions of an API for loading files. -// +// Definitions of an API for loading files. + #pragma once #include <stdbool.h> diff --git a/src/stdlib/fpconv.c b/src/stdlib/fpconv.c index 8b994cfa..0781295d 100644 --- a/src/stdlib/fpconv.c +++ b/src/stdlib/fpconv.c @@ -1,5 +1,6 @@ // This file defines a function to convert floating point numbers to strings. // For license, see: fpconv_license.txt + #include <stdbool.h> #include <string.h> diff --git a/src/stdlib/functiontype.h b/src/stdlib/functiontype.h index ab0600be..35778aca 100644 --- a/src/stdlib/functiontype.h +++ b/src/stdlib/functiontype.h @@ -1,3 +1,5 @@ +// Logic for handling function type values + #pragma once #include <stdbool.h> @@ -6,8 +8,6 @@ #include "types.h" #include "util.h" -// Logic for handling function type values - void register_function(void *fn, Text_t filename, int64_t line_num, Text_t name); OptionalText_t get_function_name(void *fn); OptionalText_t get_function_filename(void *fn); diff --git a/src/stdlib/integers.c b/src/stdlib/integers.c index 082ca211..7dda77bd 100644 --- a/src/stdlib/integers.c +++ b/src/stdlib/integers.c @@ -1,4 +1,5 @@ // Integer type infos and methods + #include <stdio.h> // Must be before gmp.h #include <ctype.h> diff --git a/src/stdlib/integers.h b/src/stdlib/integers.h index accc0166..40c40754 100644 --- a/src/stdlib/integers.h +++ b/src/stdlib/integers.h @@ -1,7 +1,7 @@ -#pragma once - // Integer type infos and methods +#pragma once + #include <gmp.h> #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/lists.h b/src/stdlib/lists.h index 33279566..1ba46222 100644 --- a/src/stdlib/lists.h +++ b/src/stdlib/lists.h @@ -1,7 +1,7 @@ -#pragma once - // Functions that operate on lists +#pragma once + #include <stdbool.h> #include "datatypes.h" diff --git a/src/stdlib/mapmacro.h b/src/stdlib/mapmacro.h index 68834f8f..7b0e3c4e 100644 --- a/src/stdlib/mapmacro.h +++ b/src/stdlib/mapmacro.h @@ -1,9 +1,9 @@ -#pragma once - // This file defines a MAP_LIST(fn, ...) function that applies a function to // every one of the varargs. // For example: baz(MAP_LIST(foo, 1, "x")) -> baz(foo(1), foo("x")) +#pragma once + #define EVAL0(...) __VA_ARGS__ #define EVAL1(...) EVAL0(EVAL0(EVAL0(__VA_ARGS__))) #define EVAL2(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__))) diff --git a/src/stdlib/memory.c b/src/stdlib/memory.c index 65d0fbc6..2ae47c36 100644 --- a/src/stdlib/memory.c +++ b/src/stdlib/memory.c @@ -1,4 +1,5 @@ // Type info and methods for "Memory" opaque type + #include <err.h> #include <gc.h> #include <stdbool.h> diff --git a/src/stdlib/memory.h b/src/stdlib/memory.h index 56be103e..230a48c3 100644 --- a/src/stdlib/memory.h +++ b/src/stdlib/memory.h @@ -1,7 +1,7 @@ -#pragma once - // Type info and methods for "Memory" opaque type +#pragma once + #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/metamethods.h b/src/stdlib/metamethods.h index 18598920..05d91c5c 100644 --- a/src/stdlib/metamethods.h +++ b/src/stdlib/metamethods.h @@ -1,6 +1,7 @@ -#pragma once // Metamethods are methods that all types share: +#pragma once + #include <stdint.h> #include "datatypes.h" diff --git a/src/stdlib/nums.h b/src/stdlib/nums.h index b73b0dc5..db051ed2 100644 --- a/src/stdlib/nums.h +++ b/src/stdlib/nums.h @@ -1,7 +1,7 @@ -#pragma once - // Type infos and methods for Nums (floating point) +#pragma once + #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/optionals.h b/src/stdlib/optionals.h index 1a50007f..145fda60 100644 --- a/src/stdlib/optionals.h +++ b/src/stdlib/optionals.h @@ -1,7 +1,7 @@ -#pragma once - // Optional types +#pragma once + #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c index 860034cb..3de329a9 100644 --- a/src/stdlib/paths.c +++ b/src/stdlib/paths.c @@ -1,4 +1,5 @@ // A lang for filesystem paths + #include <dirent.h> #include <errno.h> #include <fcntl.h> diff --git a/src/stdlib/paths.h b/src/stdlib/paths.h index 62deaf75..ce6de1c8 100644 --- a/src/stdlib/paths.h +++ b/src/stdlib/paths.h @@ -1,7 +1,7 @@ -#pragma once - // A lang for filesystem paths +#pragma once + #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/pointers.c b/src/stdlib/pointers.c index 13e1b2ed..b5e6400f 100644 --- a/src/stdlib/pointers.c +++ b/src/stdlib/pointers.c @@ -1,4 +1,5 @@ // Type infos and methods for Pointer types + #include <err.h> #include <gc.h> #include <stdbool.h> diff --git a/src/stdlib/pointers.h b/src/stdlib/pointers.h index 0c62e18c..a5986468 100644 --- a/src/stdlib/pointers.h +++ b/src/stdlib/pointers.h @@ -1,7 +1,7 @@ -#pragma once - // Type infos and methods for Pointer types +#pragma once + #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/print.c b/src/stdlib/print.c index 5f96c2a5..ef570f94 100644 --- a/src/stdlib/print.c +++ b/src/stdlib/print.c @@ -1,4 +1,5 @@ // This file defines some of the helper functions used for printing values + #include <ctype.h> #include <stdio.h> #include <string.h> diff --git a/src/stdlib/print.h b/src/stdlib/print.h index eba1c9d9..7106d561 100644 --- a/src/stdlib/print.h +++ b/src/stdlib/print.h @@ -1,5 +1,3 @@ -#pragma once - // This file defines some functions to make it easy to do formatted text // without using printf style specifiers: // @@ -7,7 +5,8 @@ // fprint(file, ...) - print text to file // print_err(...) - print an error message and exit with EXIT_FAILURE // String(...) - return an allocated string -// + +#pragma once #include <assert.h> #include <gc.h> diff --git a/src/stdlib/random.h b/src/stdlib/random.h index 1a6e89a5..5bd4cc18 100644 --- a/src/stdlib/random.h +++ b/src/stdlib/random.h @@ -1,3 +1,5 @@ +// This file defines some wrapper logic around different systems' random functions + #include <assert.h> #include <stdint.h> diff --git a/src/stdlib/simpleparse.h b/src/stdlib/simpleparse.h index 6435807f..da9dca50 100644 --- a/src/stdlib/simpleparse.h +++ b/src/stdlib/simpleparse.h @@ -1,5 +1,3 @@ -#pragma once - // This file defines some functions to make it easy to parse simply formatted // strings **correctly** without memory bugs. // @@ -16,6 +14,8 @@ // if ((err=strparse("one, two", &item1, ",", PARSE_WHITESPACE, &item2))) // errx(1, "Failed to parse items at: ", err); +#pragma once + #include <stdbool.h> #include <stdint.h> #include <stdio.h> diff --git a/src/stdlib/siphash-internals.h b/src/stdlib/siphash-internals.h index 3ad1d789..181609c9 100644 --- a/src/stdlib/siphash-internals.h +++ b/src/stdlib/siphash-internals.h @@ -1,9 +1,9 @@ -#pragma once - // This file holds the internals for the SipHash implementation. For a few // cases, we want to include this for incrementally computing hashes. // Otherwise, it suffices to just use the siphash24() function from siphash.h +#pragma once + #include <stddef.h> #include <stdint.h> #include <string.h> diff --git a/src/stdlib/siphash.c b/src/stdlib/siphash.c index bcf61b34..f00c3b7c 100644 --- a/src/stdlib/siphash.c +++ b/src/stdlib/siphash.c @@ -1,3 +1,5 @@ +// This file has an implementation of the SipHash hashing function. + #include <stddef.h> #include <stdint.h> #include <string.h> diff --git a/src/stdlib/siphash.h b/src/stdlib/siphash.h index 98f1a6a1..d5b50711 100644 --- a/src/stdlib/siphash.h +++ b/src/stdlib/siphash.h @@ -1,7 +1,7 @@ -#pragma once - // An implementation of the SipHash algorithm. +#pragma once + #include <stddef.h> #include <stdint.h> diff --git a/src/stdlib/stacktrace.c b/src/stdlib/stacktrace.c index 2a54125c..266dc4ef 100644 --- a/src/stdlib/stacktrace.c +++ b/src/stdlib/stacktrace.c @@ -1,3 +1,5 @@ +// This file defines some code to print stack traces. + #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif diff --git a/src/stdlib/stacktrace.h b/src/stdlib/stacktrace.h index 36e81bea..5871db19 100644 --- a/src/stdlib/stacktrace.h +++ b/src/stdlib/stacktrace.h @@ -1,4 +1,7 @@ +// This file defines some code to print stack traces. + #pragma once + #include <stdio.h> __attribute__((noinline)) void print_stacktrace(FILE *out, int offset); diff --git a/src/stdlib/stdlib.c b/src/stdlib/stdlib.c index 17b5c72c..9238a4cf 100644 --- a/src/stdlib/stdlib.c +++ b/src/stdlib/stdlib.c @@ -14,6 +14,7 @@ #include <sys/param.h> #include <time.h> +#include "../config.h" #include "bools.h" #include "files.h" #include "integers.h" diff --git a/src/stdlib/stdlib.h b/src/stdlib/stdlib.h index d68e6ddb..bbf8a43a 100644 --- a/src/stdlib/stdlib.h +++ b/src/stdlib/stdlib.h @@ -1,7 +1,7 @@ -#pragma once - // Built-in functions +#pragma once + #include <signal.h> #include <stdbool.h> #include <stdint.h> @@ -9,7 +9,7 @@ #include "datatypes.h" #include "print.h" -#include "stacktrace.h" +#include "stacktrace.h" // IWYU pragma: export #include "types.h" extern bool USE_COLOR; diff --git a/src/stdlib/tables.c b/src/stdlib/tables.c index fabdad4f..974e3542 100644 --- a/src/stdlib/tables.c +++ b/src/stdlib/tables.c @@ -1,8 +1,3 @@ -// table.c - C Hash table implementation -// Copyright 2024 Bruce Hill -// Provided under the MIT license with the Commons Clause -// See included LICENSE for details. - // Hash table (aka Dictionary) Implementation // Hash keys and values are stored *by value* // The hash insertion/lookup implementation is based on Lua's tables, diff --git a/src/stdlib/tables.h b/src/stdlib/tables.h index 4d719ed5..208bf6b2 100644 --- a/src/stdlib/tables.h +++ b/src/stdlib/tables.h @@ -1,7 +1,7 @@ -#pragma once - // Hash table datastructure with methods and type information +#pragma once + #include <stdbool.h> #include <stdint.h> #include <string.h> diff --git a/src/stdlib/text.h b/src/stdlib/text.h index f31ee05c..5fa95675 100644 --- a/src/stdlib/text.h +++ b/src/stdlib/text.h @@ -1,8 +1,8 @@ -#pragma once - // Type info and methods for Text datatype, which uses a struct inspired by // Raku's string representation and libunistr +#pragma once + #include <stdbool.h> #include <stdint.h> diff --git a/src/stdlib/tomo.h b/src/stdlib/tomo.h index 6d70a089..ff16bee1 100644 --- a/src/stdlib/tomo.h +++ b/src/stdlib/tomo.h @@ -1,8 +1,8 @@ -#pragma once - // All of the different builtin modules can be included by including this one // import +#pragma once + #include <math.h> // IWYU pragma: export #include <stdbool.h> // IWYU pragma: export #include <stdint.h> // IWYU pragma: export diff --git a/src/stdlib/types.c b/src/stdlib/types.c index e52fd39b..14a8f87c 100644 --- a/src/stdlib/types.c +++ b/src/stdlib/types.c @@ -1,4 +1,5 @@ // Type information and methods for TypeInfos (i.e. runtime representations of types) + #include <err.h> #include <gc.h> #include <sys/param.h> diff --git a/src/stdlib/types.h b/src/stdlib/types.h index c8e8038d..2e358c6c 100644 --- a/src/stdlib/types.h +++ b/src/stdlib/types.h @@ -1,7 +1,7 @@ -#pragma once - // Type information and methods for TypeInfos (i.e. runtime representations of types) +#pragma once + #include <stdbool.h> #include <stdint.h> #include <stdio.h> diff --git a/src/stdlib/util.h b/src/stdlib/util.h index 1530bd9e..db667ccf 100644 --- a/src/stdlib/util.h +++ b/src/stdlib/util.h @@ -1,7 +1,7 @@ -#pragma once - // Built-in utility functions +#pragma once + #include <assert.h> #include <err.h> #include <gc.h> @@ -1,4 +1,5 @@ // The main program that runs compilation + #include <ctype.h> #include <errno.h> #include <gc.h> diff --git a/src/typecheck.h b/src/typecheck.h index 1790f227..8fc30333 100644 --- a/src/typecheck.h +++ b/src/typecheck.h @@ -8,7 +8,6 @@ #include "ast.h" #include "environment.h" -#include "stdlib/datatypes.h" #include "types.h" type_t *parse_type_ast(env_t *env, type_ast_t *ast); diff --git a/src/types.c b/src/types.c index 86336f5a..a4dcc5e5 100644 --- a/src/types.c +++ b/src/types.c @@ -1,4 +1,5 @@ // Logic for handling type_t types + #include <limits.h> #include <math.h> #include <signal.h> diff --git a/src/types.h b/src/types.h index dcb1a442..ed5628e8 100644 --- a/src/types.h +++ b/src/types.h @@ -1,7 +1,7 @@ -#pragma once - // Logic for defining and working with types +#pragma once + #include <stdlib.h> #include "ast.h" diff --git a/src/unistr-fixed.h b/src/unistr-fixed.h index 6e05ba4d..601fb29d 100644 --- a/src/unistr-fixed.h +++ b/src/unistr-fixed.h @@ -1,8 +1,8 @@ -#pragma once - // This is a workaround fix for an issue on some systems that don't have `__GLIBC__` defined // and run into problems with <unistr.h> +#pragma once + #ifndef __GLIBC__ #define __GLIBC__ 2 #include <unistr.h> // IWYU pragma: export |
