diff options
| author | Kai Gunger <kgunger12@gmail.com> | 2026-06-29 23:53:13 -0400 |
|---|---|---|
| committer | Kai Gunger <kgunger12@gmail.com> | 2026-06-29 23:53:13 -0400 |
| commit | a3fc7c905b780244a8984698116f10ad3fe6f6ed (patch) | |
| tree | bfb4c76cb7742154dac63e9c32d4036496d00d28 /tnslc/compile/compbuf.tnsl | |
| parent | a79a6d8f9be059b2bf2c1fc6548592546322f53d (diff) | |
[tnslc] some random fixes, still need to fix parser
Diffstat (limited to 'tnslc/compile/compbuf.tnsl')
| -rw-r--r-- | tnslc/compile/compbuf.tnsl | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/tnslc/compile/compbuf.tnsl b/tnslc/compile/compbuf.tnsl index d4bc640..94f4e9b 100644 --- a/tnslc/compile/compbuf.tnsl +++ b/tnslc/compile/compbuf.tnsl @@ -1,45 +1,55 @@ struct CompBuf { - utils.Vector - sec_head, - sec_data, - sec_code + utils.Vector + sec_head, + sec_data, + sec_code } /; method CompBuf - /; init - self.sec_head.init(1) - self.sec_data.init(1) - self.sec_code.init(1) - ;/ + /; init + self.sec_head.init(1) + self.sec_data.init(1) + self.sec_code.init(1) + ;/ - /; add_h(~uint8 text) - self.sec_head.push_cstr(text) - ;/ + /; add_h(~uint8 text) + self.sec_head.push_cstr(text) + ;/ - /; add_d(~uint8 text) - self.sec_data.push_cstr(text) - ;/ - - /; add_c(~uint8 text) - self.sec_code.push_cstr(text) - ;/ + /; add_d(~uint8 text) + self.sec_data.push_cstr(text) + ;/ - /; write_to(~utils.File fout) - fout`.write_cstr("BITS 64\n\0") - fout`.write_cstr(self.sec_head.as_cstr()) + /; add_c(~uint8 text) + self.sec_code.push_cstr(text) + ;/ - fout`.write_cstr("\nsection .data\n\n\0") - fout`.write_cstr(self.sec_data.as_cstr()) + /; write_to(~utils.File fout) + fout`.write_cstr("BITS 64\n\0") + fout`.write_cstr(self.sec_head.as_cstr()) - fout`.write_cstr("\nsection .text\n\n\0") - fout`.write_cstr(self.sec_code.as_cstr()) - ;/ + fout`.write_cstr("\nsection .data\n\n\0") + fout`.write_cstr(self.sec_data.as_cstr()) - /; end - self.sec_head.end() - self.sec_data.end() - self.sec_code.end() - ;/ + fout`.write_cstr("\nsection .text\n\n\0") + fout`.write_cstr(self.sec_code.as_cstr()) + ;/ + + /; end + self.sec_head.end() + self.sec_data.end() + self.sec_code.end() + ;/ + + /; append (~CompBuf to_append) + ~uint8 tmp + tmp = to_append`.sec_head.as_cstr() + self.add_h(tmp) + tmp = to_append`.sec_data.as_cstr() + self.add_d(tmp) + tmp = to_append`.sec_code.as_cstr() + self.add_c(tmp) + ;/ ;/ |