aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtins/bool.c2
-rw-r--r--builtins/bool.h2
-rw-r--r--builtins/integers.c2
-rw-r--r--builtins/integers.h4
-rw-r--r--builtins/memory.c2
-rw-r--r--builtins/memory.h2
-rw-r--r--builtins/nums.c4
-rw-r--r--builtins/nums.h4
-rw-r--r--builtins/string.c2
-rw-r--r--builtins/string.h2
-rw-r--r--builtins/table.c16
-rw-r--r--builtins/table.h2
-rw-r--r--builtins/types.c8
-rw-r--r--builtins/types.h6
14 files changed, 31 insertions, 27 deletions
diff --git a/builtins/bool.c b/builtins/bool.c
index fb807857..31e28d82 100644
--- a/builtins/bool.c
+++ b/builtins/bool.c
@@ -25,7 +25,7 @@ public CORD Bool__as_str(const bool *b, bool colorize, const TypeInfo *type)
return *b ? "yes" : "no";
}
-public Bool_namespace_t Bool_type = {
+public Bool_namespace_t Bool = {
.type={
.size=sizeof(bool),
.align=__alignof__(bool),
diff --git a/builtins/bool.h b/builtins/bool.h
index 703c6bc0..2e13c3c5 100644
--- a/builtins/bool.h
+++ b/builtins/bool.h
@@ -11,6 +11,6 @@ typedef struct {
TypeInfo type;
} Bool_namespace_t;
-extern Bool_namespace_t Bool_type;
+extern Bool_namespace_t Bool;
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/integers.c b/builtins/integers.c
index 3784a047..2b8e715c 100644
--- a/builtins/integers.c
+++ b/builtins/integers.c
@@ -46,7 +46,7 @@
uint32_t r = arc4random_uniform((uint32_t)range); \
return min + (c_type)r; \
} \
- public KindOfInt##_namespace_t KindOfInt##_type = { \
+ public KindOfInt##_namespace_t KindOfInt = { \
.type={ \
.size=sizeof(c_type), \
.align=__alignof__(c_type), \
diff --git a/builtins/integers.h b/builtins/integers.h
index 944d3f3d..2843951e 100644
--- a/builtins/integers.h
+++ b/builtins/integers.h
@@ -21,7 +21,7 @@
CORD (*octal)(c_type i, int64_t digits, bool prefix); \
c_type (*random)(int64_t min, int64_t max); \
} type_name##_namespace_t; \
- extern type_name##_namespace_t type_name##_type;
+ extern type_name##_namespace_t type_name;
DEFINE_INT_TYPE(int64_t, Int64);
DEFINE_INT_TYPE(int32_t, Int32);
@@ -36,6 +36,6 @@ DEFINE_INT_TYPE(int8_t, Int8);
#define Int__octal Int64__octal
#define Int__random Int64__random
#define Int_namespace_t Int64_namespace_t
-#define Int_type Int64_type
+#define Int Int64
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/memory.c b/builtins/memory.c
index 14640d8a..bfc0b5ca 100644
--- a/builtins/memory.c
+++ b/builtins/memory.c
@@ -21,7 +21,7 @@ public CORD Memory__as_str(const void *p, bool colorize, const TypeInfo *type) {
return cord;
}
-public TypeInfo Memory_type = {
+public TypeInfo Memory = {
.size=0,
.align=0,
.tag=CustomInfo,
diff --git a/builtins/memory.h b/builtins/memory.h
index 91f86b04..0860905a 100644
--- a/builtins/memory.h
+++ b/builtins/memory.h
@@ -5,7 +5,7 @@
#include "types.h"
-extern TypeInfo Memory_type;
+extern TypeInfo Memory;
CORD Memory__as_str(const void *p, bool colorize, const TypeInfo *type);
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/nums.c b/builtins/nums.c
index ebd67fec..557e98c0 100644
--- a/builtins/nums.c
+++ b/builtins/nums.c
@@ -50,7 +50,7 @@ public bool Num64__isinf(double n) { return isinf(n); }
public bool Num64__finite(double n) { return finite(n); }
public bool Num64__isnan(double n) { return isnan(n); }
-public Num64_namespace_t Num64_type = {
+public Num64_namespace_t Num64 = {
.type=(TypeInfo){
.size=sizeof(double),
.align=__alignof__(double),
@@ -120,7 +120,7 @@ public bool Num32__isinf(float n) { return isinf(n); }
public bool Num32__finite(float n) { return finite(n); }
public bool Num32__isnan(float n) { return isnan(n); }
-public Num32_namespace_t Num32_type = {
+public Num32_namespace_t Num32 = {
.type=(TypeInfo){
.size=sizeof(float),
.align=__alignof__(float),
diff --git a/builtins/nums.h b/builtins/nums.h
index c7956f46..2b8387b9 100644
--- a/builtins/nums.h
+++ b/builtins/nums.h
@@ -39,7 +39,7 @@ typedef struct {
CORD (*format)(double f, int64_t precision);
CORD (*scientific)(double f, int64_t precision);
} Num64_namespace_t;
-extern Num64_namespace_t Num64_type;
+extern Num64_namespace_t Num64;
CORD Num32__as_str(float *f, bool colorize, const TypeInfo *type);
int32_t Num32__compare(const float *x, const float *y, const TypeInfo *type);
@@ -76,6 +76,6 @@ typedef struct {
CORD (*format)(float f, int64_t precision);
CORD (*scientific)(float f, int64_t precision);
} Num32_namespace_t;
-extern Num32_namespace_t Num32_type;
+extern Num32_namespace_t Num32;
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0
diff --git a/builtins/string.c b/builtins/string.c
index 7e20b34d..cd6e2548 100644
--- a/builtins/string.c
+++ b/builtins/string.c
@@ -254,7 +254,7 @@ public CORD Str__join(CORD glue, Str_Array_t pieces)
return ret;
}
-public Str_namespace_t Str_type = {
+public Str_namespace_t Str = {
.type={
.size=sizeof(CORD),
.align=__alignof__(CORD),
diff --git a/builtins/string.h b/builtins/string.h
index e625d7e2..51862520 100644
--- a/builtins/string.h
+++ b/builtins/string.h
@@ -42,7 +42,7 @@ typedef struct {
int (*hash)(CORD *s, TypeInfo *type);
CORD (*cord)(CORD *s, bool colorize, TypeInfo *type);
} Str_namespace_t;
-extern Str_namespace_t Str_type;
+extern Str_namespace_t Str;
CORD Str__quoted(CORD str, bool colorize);
int Str__compare(CORD *x, CORD *y);
diff --git a/builtins/table.c b/builtins/table.c
index e79f893b..94af0499 100644
--- a/builtins/table.c
+++ b/builtins/table.c
@@ -41,7 +41,7 @@
#define GET_ENTRY(t, i) ((t)->entries.data + (t)->entries.stride*(i))
#define ENTRIES_TYPE(type) (&(TypeInfo){.size=sizeof(array_t), .align=__alignof__(array_t), .tag=ArrayInfo, .ArrayInfo.item=(&(TypeInfo){.size=entry_size(type), .align=entry_align(type), .tag=OpaqueInfo})})
-TypeInfo MemoryPointer_typeinfo = {
+TypeInfo MemoryPointer = {
.size=sizeof(void*),
.align=__alignof__(void*),
.tag=PointerInfo,
@@ -51,11 +51,11 @@ TypeInfo MemoryPointer_typeinfo = {
},
};
-TypeInfo StrToVoidStarTable_type = {
+TypeInfo StrToVoidStarTable = {
.size=sizeof(table_t),
.align=__alignof__(table_t),
.tag=TableInfo,
- .TableInfo={.key=&Str_type.type, .value=&MemoryPointer_typeinfo},
+ .TableInfo={.key=&Str.type, .value=&MemoryPointer},
};
static inline size_t entry_size(const TypeInfo *info)
@@ -547,29 +547,29 @@ public table_t Table_from_entries(array_t entries, const TypeInfo *type)
void *Table_str_get(const table_t *t, const char *key)
{
- void **ret = Table_get(t, &key, &StrToVoidStarTable_type);
+ void **ret = Table_get(t, &key, &StrToVoidStarTable);
return ret ? *ret : NULL;
}
void *Table_str_get_raw(const table_t *t, const char *key)
{
- void **ret = Table_get_raw(t, &key, &StrToVoidStarTable_type);
+ void **ret = Table_get_raw(t, &key, &StrToVoidStarTable);
return ret ? *ret : NULL;
}
void *Table_str_reserve(table_t *t, const char *key, const void *value)
{
- return Table_reserve(t, &key, &value, &StrToVoidStarTable_type);
+ return Table_reserve(t, &key, &value, &StrToVoidStarTable);
}
void Table_str_set(table_t *t, const char *key, const void *value)
{
- Table_set(t, &key, &value, &StrToVoidStarTable_type);
+ Table_set(t, &key, &value, &StrToVoidStarTable);
}
void Table_str_remove(table_t *t, const char *key)
{
- return Table_remove(t, &key, &StrToVoidStarTable_type);
+ return Table_remove(t, &key, &StrToVoidStarTable);
}
void *Table_str_entry(const table_t *t, int64_t n)
diff --git a/builtins/table.h b/builtins/table.h
index 48e81a9c..14893253 100644
--- a/builtins/table.h
+++ b/builtins/table.h
@@ -30,6 +30,6 @@ void Table_str_remove(table_t *t, const char *key);
#define Table_length(t) ((t)->entries.length)
-extern TypeInfo StrToVoidStarTable_type;
+extern TypeInfo StrToVoidStarTable;
// vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1
diff --git a/builtins/types.c b/builtins/types.c
index fc0963d2..c7e29cf8 100644
--- a/builtins/types.c
+++ b/builtins/types.c
@@ -23,9 +23,7 @@ public CORD Type__as_str(const void *typeinfo, bool colorize, const TypeInfo *ty
return c;
}
-public struct {
- TypeInfo type;
-} TypeInfo_type = {
+public TypeInfo_namespace_t TypeInfo_namespace = {
.type={
.size=sizeof(TypeInfo),
.align=__alignof__(TypeInfo),
@@ -36,10 +34,10 @@ public struct {
public struct {
TypeInfo type;
-} Void_type = {.type={.size=0, .align=0}};
+} Void = {.type={.size=0, .align=0}};
public struct {
TypeInfo type;
-} Abort_type = {.type={.size=0, .align=0}};
+} Abort = {.type={.size=0, .align=0}};
public CORD Func__as_str(const void *fn, bool colorize, const TypeInfo *type)
{
diff --git a/builtins/types.h b/builtins/types.h
index 0430fbe5..7f656b18 100644
--- a/builtins/types.h
+++ b/builtins/types.h
@@ -44,6 +44,12 @@ typedef struct TypeInfo {
};
} TypeInfo;
+typedef struct {
+ TypeInfo type;
+} TypeInfo_namespace_t;
+
+extern TypeInfo_namespace_t TypeInfo_namespace;
+
CORD Type__as_str(const void *typeinfo, bool colorize, const TypeInfo *type);
CORD Func__as_str(const void *fn, bool colorize, const TypeInfo *type);