diff options
| author | Carson Fleming <cflems@cflems.net> | 2026-08-04 22:51:29 -0400 |
|---|---|---|
| committer | Carson Fleming <cflems@cflems.net> | 2026-08-04 22:51:29 -0400 |
| commit | ebe7f44385c4be54afd2993d54ce6352f612f9fa (patch) | |
| tree | 008ee208ada0d7eb468ba6e74753872fc56d7d33 /dseg.h | |
| parent | b1ff7e8bf24b40cf64127a6194d45661db3a4baf (diff) | |
| download | ccc-ebe7f44385c4be54afd2993d54ce6352f612f9fa.tar.gz | |
add string literals via the data segment
Diffstat (limited to 'dseg.h')
| -rw-r--r-- | dseg.h | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +#ifndef DSEG_H +#define DSEG_H + +#include "ccc.h" +#include <stdio.h> + +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 |
