tui lib has table drawing fn

This commit is contained in:
Tenari
2026-02-19 07:36:53 -06:00
parent d208d14520
commit 10e751e115
4 changed files with 154 additions and 122 deletions
+29
View File
@@ -189,6 +189,10 @@
# define assertBreak() (*(volatile int*)0 = 0)
#endif
#ifndef offsetof
#define offsetof(st, m) ((size_t)&(((st*)0)->m))
#endif
#if ENABLE_ASSERT
# define assert(c) stmnt( if (!(c)){ assertBreak(); } )
#else
@@ -319,6 +323,24 @@ typedef enum Utf8Character {
Utf8Character_Count,
} Utf8Character;
typedef enum FieldType {
FieldTypeU8,
FieldTypeU16,
FieldTypeU32,
FieldTypeFloat,
FieldTypeString,
FieldTypeEnum,
FieldType_Count,
} FieldType;
typedef struct FieldDescriptor {
str name;
FieldType type;
size_t offset;
int width; // column width for display
str* enum_vals;
} FieldDescriptor;
typedef struct Box {
u32 x;
u32 y;
@@ -326,6 +348,13 @@ typedef struct Box {
u32 width;
} Box;
typedef struct TableDrawInfo {
u32 x_offset;
u32 y_offset;
u32 rows;
u32 cols;
} TableDrawInfo;
typedef struct Dim2 {
u16 height;
u16 width;