aboutsummaryrefslogtreecommitdiff
path: root/builtins
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-05 14:57:31 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-05 14:57:31 -0400
commit391c1b6bde0d5fd6f306f9613109e18ec487afe7 (patch)
tree8d3f097b90e36230e09e7b06089a7298cba6e982 /builtins
parentabe45a3c25fc8b7ba53635fd517653976d94b107 (diff)
Rename table_t -> Table_t
Diffstat (limited to 'builtins')
-rw-r--r--builtins/array.c6
-rw-r--r--builtins/array.h2
-rw-r--r--builtins/datatypes.h2
-rw-r--r--builtins/table.c82
-rw-r--r--builtins/table.h62
-rw-r--r--builtins/text.c6
-rw-r--r--builtins/text.h2
-rw-r--r--builtins/types.h4
8 files changed, 83 insertions, 83 deletions
diff --git a/builtins/array.c b/builtins/array.c
index 6b191bc8..32aeab23 100644
--- a/builtins/array.c
+++ b/builtins/array.c
@@ -278,10 +278,10 @@ public void *Array$random(Array_t arr)
return arr.data + arr.stride*index;
}
-public table_t Array$counts(Array_t arr, const TypeInfo *type)
+public Table_t Array$counts(Array_t arr, const TypeInfo *type)
{
- table_t counts = {};
- const TypeInfo count_type = {.size=sizeof(table_t), .align=__alignof__(table_t),
+ Table_t counts = {};
+ const TypeInfo count_type = {.size=sizeof(Table_t), .align=__alignof__(Table_t),
.tag=TableInfo, .TableInfo.key=type->ArrayInfo.item, .TableInfo.value=&$Int};
for (int64_t i = 0; i < arr.length; i++) {
void *key = arr.data + i*arr.stride;
diff --git a/builtins/array.h b/builtins/array.h
index ce2fb563..98e949c8 100644
--- a/builtins/array.h
+++ b/builtins/array.h
@@ -77,7 +77,7 @@ Array_t Array$shuffled(Array_t arr, int64_t padded_item_size);
void *Array$random(Array_t arr);
#define Array$random_value(arr, t) ({ Array_t _arr = arr; if (_arr.length == 0) fail("Cannot get a random value from an empty array!"); *(t*)Array$random(_arr); })
Array_t Array$sample(Array_t arr, Int_t n, Array_t weights, int64_t padded_item_size);
-table_t Array$counts(Array_t arr, const TypeInfo *type);
+Table_t Array$counts(Array_t arr, const TypeInfo *type);
void Array$clear(Array_t *array);
void Array$compact(Array_t *arr, int64_t padded_item_size);
bool Array$has(Array_t array, void *item, const TypeInfo *type);
diff --git a/builtins/datatypes.h b/builtins/datatypes.h
index fa8a52fc..f8852c33 100644
--- a/builtins/datatypes.h
+++ b/builtins/datatypes.h
@@ -54,7 +54,7 @@ typedef struct table_s {
Array_t entries;
bucket_info_t *bucket_info;
struct table_s *fallback;
-} table_t;
+} Table_t;
typedef struct {
void *fn, *userdata;
diff --git a/builtins/table.c b/builtins/table.c
index 75b4027d..b0b95af7 100644
--- a/builtins/table.c
+++ b/builtins/table.c
@@ -53,8 +53,8 @@ static const TypeInfo MemoryPointer = {
};
const TypeInfo CStrToVoidStarTable = {
- .size=sizeof(table_t),
- .align=__alignof__(table_t),
+ .size=sizeof(Table_t),
+ .align=__alignof__(Table_t),
.tag=TableInfo,
.TableInfo={.key=&$CString, .value=&MemoryPointer},
};
@@ -83,7 +83,7 @@ static inline size_t value_offset(const TypeInfo *info)
return offset;
}
-static inline void hshow(const table_t *t)
+static inline void hshow(const Table_t *t)
{
hdebug("{");
for (uint32_t i = 0; t->bucket_info && i < t->bucket_info->count; i++) {
@@ -96,7 +96,7 @@ static inline void hshow(const table_t *t)
hdebug("}\n");
}
-static void maybe_copy_on_write(table_t *t, const TypeInfo *type)
+static void maybe_copy_on_write(Table_t *t, const TypeInfo *type)
{
if (t->entries.data_refcount != 0)
Array$compact(&t->entries, entry_size(type));
@@ -109,7 +109,7 @@ static void maybe_copy_on_write(table_t *t, const TypeInfo *type)
}
// Return address of value or NULL
-public void *Table$get_raw(table_t t, const void *key, const TypeInfo *type)
+public void *Table$get_raw(Table_t t, const void *key, const TypeInfo *type)
{
assert(type->tag == TableInfo);
if (!key || !t.bucket_info) return NULL;
@@ -131,17 +131,17 @@ public void *Table$get_raw(table_t t, const void *key, const TypeInfo *type)
return NULL;
}
-public void *Table$get(table_t t, const void *key, const TypeInfo *type)
+public void *Table$get(Table_t t, const void *key, const TypeInfo *type)
{
assert(type->tag == TableInfo);
- for (const table_t *iter = &t; iter; iter = iter->fallback) {
+ for (const Table_t *iter = &t; iter; iter = iter->fallback) {
void *ret = Table$get_raw(*iter, key, type);
if (ret) return ret;
}
return NULL;
}
-static void Table$set_bucket(table_t *t, const void *entry, int32_t index, const TypeInfo *type)
+static void Table$set_bucket(Table_t *t, const void *entry, int32_t index, const TypeInfo *type)
{
assert(t->bucket_info);
hshow(t);
@@ -195,7 +195,7 @@ static void Table$set_bucket(table_t *t, const void *entry, int32_t index, const
hshow(t);
}
-static void hashmap_resize_buckets(table_t *t, uint32_t new_capacity, const TypeInfo *type)
+static void hashmap_resize_buckets(Table_t *t, uint32_t new_capacity, const TypeInfo *type)
{
if (__builtin_expect(new_capacity > TABLE_MAX_BUCKETS, 0))
fail("Table has exceeded the maximum table size (2^31) and cannot grow further!");
@@ -217,7 +217,7 @@ static void hashmap_resize_buckets(table_t *t, uint32_t new_capacity, const Type
}
// Return address of value
-public void *Table$reserve(table_t *t, const void *key, const void *value, const TypeInfo *type)
+public void *Table$reserve(Table_t *t, const void *key, const void *value, const TypeInfo *type)
{
assert(type->tag == TableInfo);
if (!t || !key) return NULL;
@@ -253,7 +253,7 @@ public void *Table$reserve(table_t *t, const void *key, const void *value, const
}
if (!value && value_size > 0) {
- for (table_t *iter = t->fallback; iter; iter = iter->fallback) {
+ for (Table_t *iter = t->fallback; iter; iter = iter->fallback) {
value = Table$get_raw(*iter, key, type);
if (value) break;
}
@@ -276,13 +276,13 @@ public void *Table$reserve(table_t *t, const void *key, const void *value, const
return entry + value_offset(type);
}
-public void Table$set(table_t *t, const void *key, const void *value, const TypeInfo *type)
+public void Table$set(Table_t *t, const void *key, const void *value, const TypeInfo *type)
{
assert(type->tag == TableInfo);
(void)Table$reserve(t, key, value, type);
}
-public void Table$remove(table_t *t, const void *key, const TypeInfo *type)
+public void Table$remove(Table_t *t, const void *key, const TypeInfo *type)
{
assert(type->tag == TableInfo);
if (!t || Table$length(*t) == 0) return;
@@ -374,26 +374,26 @@ public void Table$remove(table_t *t, const void *key, const TypeInfo *type)
hshow(t);
}
-public void *Table$entry(table_t t, int64_t n)
+public void *Table$entry(Table_t t, int64_t n)
{
if (n < 1 || n > Table$length(t))
return NULL;
return GET_ENTRY(t, n-1);
}
-public void Table$clear(table_t *t)
+public void Table$clear(Table_t *t)
{
- memset(t, 0, sizeof(table_t));
+ memset(t, 0, sizeof(Table_t));
}
-public table_t Table$sorted(table_t t, const TypeInfo *type)
+public Table_t Table$sorted(Table_t t, const TypeInfo *type)
{
closure_t cmp = (closure_t){.fn=generic_compare, .userdata=(void*)type->TableInfo.key};
Array_t entries = Array$sorted(t.entries, cmp, entry_size(type));
return Table$from_entries(entries, type);
}
-public bool Table$equal(const table_t *x, const table_t *y, const TypeInfo *type)
+public bool Table$equal(const Table_t *x, const Table_t *y, const TypeInfo *type)
{
if (x == y) return true;
@@ -407,7 +407,7 @@ public bool Table$equal(const table_t *x, const table_t *y, const TypeInfo *type
return (Table$compare(x, y, type) == 0);
}
-public int32_t Table$compare(const table_t *x, const table_t *y, const TypeInfo *type)
+public int32_t Table$compare(const Table_t *x, const Table_t *y, const TypeInfo *type)
{
if (x == y) return 0;
@@ -438,7 +438,7 @@ public int32_t Table$compare(const table_t *x, const table_t *y, const TypeInfo
return 0;
}
-public uint32_t Table$hash(const table_t *t, const TypeInfo *type)
+public uint32_t Table$hash(const Table_t *t, const TypeInfo *type)
{
assert(type->tag == TableInfo);
// Table hashes are computed as:
@@ -455,7 +455,7 @@ public uint32_t Table$hash(const table_t *t, const TypeInfo *type)
return hash;
}
-public Text_t Table$as_text(const table_t *t, bool colorize, const TypeInfo *type)
+public Text_t Table$as_text(const Table_t *t, bool colorize, const TypeInfo *type)
{
assert(type->tag == TableInfo);
auto table = type->TableInfo;
@@ -494,13 +494,13 @@ public Text_t Table$as_text(const table_t *t, bool colorize, const TypeInfo *typ
return text;
}
-public table_t Table$from_entries(Array_t entries, const TypeInfo *type)
+public Table_t Table$from_entries(Array_t entries, const TypeInfo *type)
{
assert(type->tag == TableInfo);
if (entries.length == 0)
- return (table_t){};
+ return (Table_t){};
- table_t t = {};
+ Table_t t = {};
int64_t length = entries.length + entries.length / 4;
int64_t alloc_size = sizeof(bucket_info_t) + sizeof(bucket_t[length]);
t.bucket_info = GC_MALLOC_ATOMIC(alloc_size);
@@ -517,10 +517,10 @@ public table_t Table$from_entries(Array_t entries, const TypeInfo *type)
}
// Overlap is "set intersection" in formal terms
-public table_t Table$overlap(table_t a, table_t b, const TypeInfo *type)
+public Table_t Table$overlap(Table_t a, Table_t b, const TypeInfo *type)
{
// Return a table such that t[k]==a[k] for all k such that a:has(k), b:has(k), and a[k]==b[k]
- table_t result = {};
+ Table_t result = {};
const size_t offset = value_offset(type);
for (int64_t i = 0; i < Table$length(a); i++) {
void *key = GET_ENTRY(a, i);
@@ -531,7 +531,7 @@ public table_t Table$overlap(table_t a, table_t b, const TypeInfo *type)
}
if (a.fallback) {
- result.fallback = new(table_t);
+ result.fallback = new(Table_t);
*result.fallback = Table$overlap(*a.fallback, b, type);
}
@@ -539,10 +539,10 @@ public table_t Table$overlap(table_t a, table_t b, const TypeInfo *type)
}
// With is "set union" in formal terms
-public table_t Table$with(table_t a, table_t b, const TypeInfo *type)
+public Table_t Table$with(Table_t a, Table_t b, const TypeInfo *type)
{
// return a table such that t[k]==b[k] for all k such that b:has(k), and t[k]==a[k] for all k such that a:has(k) and not b:has(k)
- table_t result = {};
+ Table_t result = {};
const size_t offset = value_offset(type);
for (int64_t i = 0; i < Table$length(a); i++) {
void *key = GET_ENTRY(a, i);
@@ -554,7 +554,7 @@ public table_t Table$with(table_t a, table_t b, const TypeInfo *type)
}
if (a.fallback && b.fallback) {
- result.fallback = new(table_t);
+ result.fallback = new(Table_t);
*result.fallback = Table$with(*a.fallback, *b.fallback, type);
} else {
result.fallback = a.fallback ? a.fallback : b.fallback;
@@ -564,10 +564,10 @@ public table_t Table$with(table_t a, table_t b, const TypeInfo *type)
}
// Without is "set difference" in formal terms
-public table_t Table$without(table_t a, table_t b, const TypeInfo *type)
+public Table_t Table$without(Table_t a, Table_t b, const TypeInfo *type)
{
// Return a table such that t[k]==a[k] for all k such that not b:has(k) or b[k] != a[k]
- table_t result = {};
+ Table_t result = {};
const size_t offset = value_offset(type);
for (int64_t i = 0; i < Table$length(a); i++) {
void *key = GET_ENTRY(a, i);
@@ -578,14 +578,14 @@ public table_t Table$without(table_t a, table_t b, const TypeInfo *type)
}
if (a.fallback) {
- result.fallback = new(table_t);
+ result.fallback = new(Table_t);
*result.fallback = Table$without(*a.fallback, b, type);
}
return result;
}
-public bool Table$is_subset_of(table_t a, table_t b, bool strict, const TypeInfo *type)
+public bool Table$is_subset_of(Table_t a, Table_t b, bool strict, const TypeInfo *type)
{
if (a.entries.length > b.entries.length || (strict && a.entries.length == b.entries.length))
return false;
@@ -597,39 +597,39 @@ public bool Table$is_subset_of(table_t a, table_t b, bool strict, const TypeInfo
return true;
}
-public bool Table$is_superset_of(table_t a, table_t b, bool strict, const TypeInfo *type)
+public bool Table$is_superset_of(Table_t a, Table_t b, bool strict, const TypeInfo *type)
{
return Table$is_subset_of(b, a, strict, type);
}
-public void *Table$str_get(table_t t, const char *key)
+public void *Table$str_get(Table_t t, const char *key)
{
void **ret = Table$get(t, &key, &CStrToVoidStarTable);
return ret ? *ret : NULL;
}
-public void *Table$str_get_raw(table_t t, const char *key)
+public void *Table$str_get_raw(Table_t t, const char *key)
{
void **ret = Table$get_raw(t, &key, &CStrToVoidStarTable);
return ret ? *ret : NULL;
}
-public void *Table$str_reserve(table_t *t, const char *key, const void *value)
+public void *Table$str_reserve(Table_t *t, const char *key, const void *value)
{
return Table$reserve(t, &key, &value, &CStrToVoidStarTable);
}
-public void Table$str_set(table_t *t, const char *key, const void *value)
+public void Table$str_set(Table_t *t, const char *key, const void *value)
{
Table$set(t, &key, &value, &CStrToVoidStarTable);
}
-public void Table$str_remove(table_t *t, const char *key)
+public void Table$str_remove(Table_t *t, const char *key)
{
return Table$remove(t, &key, &CStrToVoidStarTable);
}
-public void *Table$str_entry(table_t t, int64_t n)
+public void *Table$str_entry(Table_t t, int64_t n)
{
return Table$entry(t, n);
}
diff --git a/builtins/table.h b/builtins/table.h
index def2c7b3..d7afb56f 100644
--- a/builtins/table.h
+++ b/builtins/table.h
@@ -13,7 +13,7 @@
#define Table(key_t, val_t, key_info, value_info, fb, N, ...) ({ \
struct { key_t k; val_t v; } ents[N] = {__VA_ARGS__}; \
- table_t table = Table$from_entries((Array_t){ \
+ Table_t table = Table$from_entries((Array_t){ \
.data=memcpy(GC_MALLOC(sizeof(ents)), ents, sizeof(ents)), \
.length=sizeof(ents)/sizeof(ents[0]), \
.stride=(void*)&ents[1] - (void*)&ents[0], \
@@ -22,66 +22,66 @@
table; })
#define Set(item_t, item_info, N, ...) ({ \
item_t ents[N] = {__VA_ARGS__}; \
- table_t set = Table$from_entries((Array_t){ \
+ Table_t set = Table$from_entries((Array_t){ \
.data=memcpy(GC_MALLOC(sizeof(ents)), ents, sizeof(ents)), \
.length=sizeof(ents)/sizeof(ents[0]), \
.stride=(void*)&ents[1] - (void*)&ents[0], \
}, $SetInfo(item_info)); \
set; })
-table_t Table$from_entries(Array_t entries, const TypeInfo *type);
-void *Table$get(table_t t, const void *key, const TypeInfo *type);
+Table_t Table$from_entries(Array_t entries, const TypeInfo *type);
+void *Table$get(Table_t t, const void *key, const TypeInfo *type);
#define Table$get_value_or_fail(table_expr, key_t, val_t, key_expr, info_expr, start, end) ({ \
- const table_t t = table_expr; key_t k = key_expr; const TypeInfo* info = info_expr; \
+ const Table_t t = table_expr; key_t k = key_expr; const TypeInfo* info = info_expr; \
val_t *v = Table$get(t, &k, info); \
if (__builtin_expect(v == NULL, 0)) \
fail_source(__SOURCE_FILE__, start, end, "The key %r is not in this table\n", generic_as_text(&k, no, info->TableInfo.key)); \
*v; })
#define Table$get_value_or_default(table_expr, key_t, val_t, key_expr, default_val, info_expr) ({ \
- const table_t t = table_expr; const key_t k = key_expr; \
+ const Table_t t = table_expr; const key_t k = key_expr; \
val_t *v = Table$get(t, &k, info_expr); \
v ? *v : default_val; })
#define Table$has_value(table_expr, key_expr, info_expr) ({ \
- const table_t t = table_expr; __typeof(key_expr) k = key_expr; \
+ const Table_t t = table_expr; __typeof(key_expr) k = key_expr; \
(Table$get(t, &k, info_expr) != NULL); })
-void *Table$get_raw(table_t t, const void *key, const TypeInfo *type);
-void *Table$entry(table_t t, int64_t n);
-void *Table$reserve(table_t *t, const void *key, const void *value, const TypeInfo *type);
-void Table$set(table_t *t, const void *key, const void *value, const TypeInfo *type);
+void *Table$get_raw(Table_t t, const void *key, const TypeInfo *type);
+void *Table$entry(Table_t t, int64_t n);
+void *Table$reserve(Table_t *t, const void *key, const void *value, const TypeInfo *type);
+void Table$set(Table_t *t, const void *key, const void *value, const TypeInfo *type);
#define Table$set_value(t, key_expr, value_expr, type) ({ __typeof(key_expr) k = key_expr; __typeof(value_expr) v = value_expr; \
Table$set(t, &k, &v, type); })
#define Table$reserve_value(t, key_expr, type) ({ __typeof(key_expr) k = key_expr; Table$reserve(t, &k, NULL, type); })
#define Table$bump(t_expr, key_expr, amount_expr, type) ({ __typeof(key_expr) key = key_expr; \
- table_t *t = t_expr; \
+ Table_t *t = t_expr; \
__typeof(amount_expr) *val = Table$get_raw(*t, &key, type); \
if (val) *val += amount_expr; \
else { __typeof(amount_expr) init = amount_expr; Table$set(t, &key, &init, type); } (void)0; })
-void Table$remove(table_t *t, const void *key, const TypeInfo *type);
+void Table$remove(Table_t *t, const void *key, const TypeInfo *type);
#define Table$remove_value(t, key_expr, type) ({ __typeof(key_expr) k = key_expr; Table$remove(t, &k, type); })
-table_t Table$overlap(table_t a, table_t b, const TypeInfo *type);
-table_t Table$with(table_t a, table_t b, const TypeInfo *type);
-table_t Table$without(table_t a, table_t b, const TypeInfo *type);
-bool Table$is_subset_of(table_t a, table_t b, bool strict, const TypeInfo *type);
-bool Table$is_superset_of(table_t a, table_t b, bool strict, const TypeInfo *type);
+Table_t Table$overlap(Table_t a, Table_t b, const TypeInfo *type);
+Table_t Table$with(Table_t a, Table_t b, const TypeInfo *type);
+Table_t Table$without(Table_t a, Table_t b, const TypeInfo *type);
+bool Table$is_subset_of(Table_t a, Table_t b, bool strict, const TypeInfo *type);
+bool Table$is_superset_of(Table_t a, Table_t b, bool strict, const TypeInfo *type);
-void Table$clear(table_t *t);
-table_t Table$sorted(table_t t, const TypeInfo *type);
-void Table$mark_copy_on_write(table_t *t);
+void Table$clear(Table_t *t);
+Table_t Table$sorted(Table_t t, const TypeInfo *type);
+void Table$mark_copy_on_write(Table_t *t);
#define TABLE_INCREF(t) ({ ARRAY_INCREF((t).entries); if ((t).bucket_info) (t).bucket_info->data_refcount += ((t).bucket_info->data_refcount < TABLE_MAX_DATA_REFCOUNT); })
#define TABLE_COPY(t) ({ TABLE_INCREF(t); t; })
-int32_t Table$compare(const table_t *x, const table_t *y, const TypeInfo *type);
-bool Table$equal(const table_t *x, const table_t *y, const TypeInfo *type);
-uint32_t Table$hash(const table_t *t, const TypeInfo *type);
-Text_t Table$as_text(const table_t *t, bool colorize, const TypeInfo *type);
+int32_t Table$compare(const Table_t *x, const Table_t *y, const TypeInfo *type);
+bool Table$equal(const Table_t *x, const Table_t *y, const TypeInfo *type);
+uint32_t Table$hash(const Table_t *t, const TypeInfo *type);
+Text_t Table$as_text(const Table_t *t, bool colorize, const TypeInfo *type);
-void *Table$str_entry(table_t t, int64_t n);
-void *Table$str_get(table_t t, const char *key);
-void *Table$str_get_raw(table_t t, const char *key);
-void Table$str_set(table_t *t, const char *key, const void *value);
-void *Table$str_reserve(table_t *t, const char *key, const void *value);
-void Table$str_remove(table_t *t, const char *key);
+void *Table$str_entry(Table_t t, int64_t n);
+void *Table$str_get(Table_t t, const char *key);
+void *Table$str_get_raw(Table_t t, const char *key);
+void Table$str_set(Table_t *t, const char *key, const void *value);
+void *Table$str_reserve(Table_t *t, const char *key, const void *value);
+void Table$str_remove(Table_t *t, const char *key);
#define Table$length(t) ((t).entries.length)
diff --git a/builtins/text.c b/builtins/text.c
index 577fbdc9..4bca6516 100644
--- a/builtins/text.c
+++ b/builtins/text.c
@@ -89,7 +89,7 @@ typedef struct {
#define MAX_BACKREFS 100
// Synthetic grapheme clusters (clusters of more than one codepoint):
-static table_t grapheme_ids_by_codepoints = {}; // uint32_t* length-prefixed codepoints -> int32_t ID
+static Table_t grapheme_ids_by_codepoints = {}; // uint32_t* length-prefixed codepoints -> int32_t ID
// This will hold a dynamically growing array of synthetic graphemes:
static synthetic_grapheme_t *synthetic_graphemes = NULL;
@@ -125,7 +125,7 @@ static const TypeInfo GraphemeClusterInfo = {
};
static const TypeInfo GraphemeIDLookupTableInfo = {
- .size=sizeof(table_t), .align=__alignof__(table_t),
+ .size=sizeof(Table_t), .align=__alignof__(Table_t),
.tag=TableInfo, .TableInfo={.key=&GraphemeClusterInfo, .value=&$Int32},
};
@@ -1942,7 +1942,7 @@ public Text_t Text$map(Text_t text, Pattern_t pattern, closure_t fn)
return ret;
}
-public Text_t Text$replace_all(Text_t text, table_t replacements, Text_t backref_pat, bool recursive)
+public Text_t Text$replace_all(Text_t text, Table_t replacements, Text_t backref_pat, bool recursive)
{
if (replacements.entries.length == 0) return text;
diff --git a/builtins/text.h b/builtins/text.h
index af34c03a..a8ca85fc 100644
--- a/builtins/text.h
+++ b/builtins/text.h
@@ -34,7 +34,7 @@ Text_t Text$title(Text_t text);
Text_t Text$as_text(const void *text, bool colorize, const TypeInfo *info);
Text_t Text$quoted(Text_t str, bool colorize);
Text_t Text$replace(Text_t str, Pattern_t pat, Text_t replacement, Pattern_t backref_pat, bool recursive);
-Text_t Text$replace_all(Text_t text, table_t replacements, Pattern_t backref_pat, bool recursive);
+Text_t Text$replace_all(Text_t text, Table_t replacements, Pattern_t backref_pat, bool recursive);
Array_t Text$split(Text_t text, Pattern_t pattern);
Int_t Text$find(Text_t text, Pattern_t pattern, Int_t i, int64_t *match_length);
Array_t Text$find_all(Text_t text, Pattern_t pattern);
diff --git a/builtins/types.h b/builtins/types.h
index 61c2891d..24640f89 100644
--- a/builtins/types.h
+++ b/builtins/types.h
@@ -57,11 +57,11 @@ typedef struct TypeInfo {
.tag=PointerInfo, .PointerInfo={.sigil=sigil_expr, .pointed=pointed_info, .is_optional=opt}})
#define $ArrayInfo(item_info) &((TypeInfo){.size=sizeof(Array_t), .align=__alignof__(Array_t), \
.tag=ArrayInfo, .ArrayInfo.item=item_info})
-#define $SetInfo(item_info) &((TypeInfo){.size=sizeof(table_t), .align=__alignof__(table_t), \
+#define $SetInfo(item_info) &((TypeInfo){.size=sizeof(Table_t), .align=__alignof__(Table_t), \
.tag=TableInfo, .TableInfo.key=item_info, .TableInfo.value=&$Void})
#define $ChannelInfo(item_info) &((TypeInfo){.size=sizeof(channel_t), .align=__alignof__(channel_t), \
.tag=ChannelInfo, .ChannelInfo.item=item_info})
-#define $TableInfo(key_expr, value_expr) &((TypeInfo){.size=sizeof(table_t), .align=__alignof__(table_t), \
+#define $TableInfo(key_expr, value_expr) &((TypeInfo){.size=sizeof(Table_t), .align=__alignof__(Table_t), \
.tag=TableInfo, .TableInfo.key=key_expr, .TableInfo.value=value_expr})
#define $FunctionInfo(typestr) &((TypeInfo){.size=sizeof(void*), .align=__alignof__(void*), \
.tag=FunctionInfo, .FunctionInfo.type_str=typestr})