diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-04-20 14:58:32 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-04-20 14:58:32 -0400 |
| commit | 2dd9392ef91b953ad5741fa8a955cfd7694a2e05 (patch) | |
| tree | 4c058d3c38fd1ac8528317a29c923e405ab57887 /builtins | |
| parent | ff3e1c13284ba25841e35eccf435a15f8d17b1b9 (diff) | |
Fix USE_COLOR
Diffstat (limited to 'builtins')
| -rw-r--r-- | builtins/array.h | 4 | ||||
| -rw-r--r-- | builtins/functions.c | 2 | ||||
| -rw-r--r-- | builtins/table.h | 7 | ||||
| -rw-r--r-- | builtins/tomo.h | 2 | ||||
| -rw-r--r-- | builtins/util.c | 2 | ||||
| -rw-r--r-- | builtins/util.h | 3 |
6 files changed, 9 insertions, 11 deletions
diff --git a/builtins/array.h b/builtins/array.h index 5ee115ae..a2e76f18 100644 --- a/builtins/array.h +++ b/builtins/array.h @@ -5,12 +5,10 @@ #include <stdbool.h> #include <gc/cord.h> -#include "util.h" #include "datatypes.h" #include "functions.h" #include "types.h" - -extern bool USE_COLOR; +#include "util.h" // Convert negative indices to back-indexed without branching: index0 = index + (index < 0)*(len+1)) - 1 #define Array_get(item_type, arr_expr, index_expr, filename, start, end) *({ \ diff --git a/builtins/functions.c b/builtins/functions.c index a1ebc6a8..2b4d45d4 100644 --- a/builtins/functions.c +++ b/builtins/functions.c @@ -21,8 +21,6 @@ #include "types.h" #include "util.h" -extern bool USE_COLOR; - public const char *TOMO_HASH_VECTOR = "tomo hash vector ---------------------------------------------"; public void fail(CORD fmt, ...) diff --git a/builtins/table.h b/builtins/table.h index f51a8b31..5de87dc8 100644 --- a/builtins/table.h +++ b/builtins/table.h @@ -6,11 +6,10 @@ #include <stdbool.h> #include <string.h> -#include "types.h" -#include "datatypes.h" #include "array.h" - -extern bool USE_COLOR; +#include "datatypes.h" +#include "types.h" +#include "util.h" #define Table(key_t, val_t, key_info, value_info, fb, def, N, ...) ({ \ struct { key_t k; val_t v; } ents[N] = {__VA_ARGS__}; \ diff --git a/builtins/tomo.h b/builtins/tomo.h index bc8523df..f0455ad1 100644 --- a/builtins/tomo.h +++ b/builtins/tomo.h @@ -29,6 +29,4 @@ #include "text.h" #include "types.h" -extern bool USE_COLOR; - // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 diff --git a/builtins/util.c b/builtins/util.c index 095d605b..f7fa9f92 100644 --- a/builtins/util.c +++ b/builtins/util.c @@ -9,6 +9,8 @@ #include "util.h" +public bool USE_COLOR; + public char *heap_strn(const char *str, size_t len) { if (!str) return NULL; diff --git a/builtins/util.h b/builtins/util.h index 79925a51..a091c40e 100644 --- a/builtins/util.h +++ b/builtins/util.h @@ -6,6 +6,7 @@ #include <gc.h> #include <gc/cord.h> #include <stdio.h> +#include <stdbool.h> #include <string.h> #include <err.h> @@ -24,6 +25,8 @@ #define public __attribute__ ((visibility ("default"))) #endif +extern bool USE_COLOR; + char *heap_strn(const char *str, size_t len); char *heap_str(const char *str); char *heap_strf(const char *fmt, ...); |
