From ebe7f44385c4be54afd2993d54ce6352f612f9fa Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Tue, 4 Aug 2026 22:51:29 -0400 Subject: add string literals via the data segment --- dseg.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 dseg.h (limited to 'dseg.h') diff --git a/dseg.h b/dseg.h new file mode 100644 index 0000000..4decf2f --- /dev/null +++ b/dseg.h @@ -0,0 +1,28 @@ +#ifndef DSEG_H +#define DSEG_H + +#include "ccc.h" +#include + +struct dseg_entry { + enum { + ENT_STRING, + } type; + union { + const char* string; + } key; + char* symbol; +}; + +struct dseg { + struct dseg_entry** entries; + integral_t sz; + integral_t cap; +}; + +void dseg_init(struct dseg* dseg); +void dseg_destroy(struct dseg* dseg); +const char* dseg_put(struct dseg* dseg, struct dseg_entry entry); +void emit_dseg(FILE* outfile, const struct dseg* dseg); + +#endif -- cgit v1.2.3