kocotian.pl

My personal webpage sources
git clone git://git.kocotian.pl/kocotian.pl.git
Log | Files | Refs | README | LICENSE

commit 378dfd47f113ecc93a03a8dfe30a775bc70869c4
parent 2ebb52eaca9f6feae2788fb33050b37ec0c6fc37
Author: kocotian <kocotian@kocotian.pl>
Date:   Thu, 25 Mar 2021 14:16:29 +0100

Merge remote-tracking branch 'upstream/master'

Diffstat:
Mcompile.c | 17+++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/compile.c b/compile.c @@ -296,12 +296,6 @@ main(int argc, char *argv[]) /* Writing beginning of content() */ write(outputfd, "#include <assemble.h>\nvoid content(void) {", 42); - /* Declaring variables */ - for (viter = 0; viter < vss; ++viter) - dprintf(outputfd, "DECLVAR(%.*s, \"%.*s\"); ", - vs[viter].name.len, vs[viter].name.data, - vs[viter].value.len, vs[viter].value.data); - /* And after that, generating C code to output */ generateC(outputfd, input); @@ -313,9 +307,20 @@ main(int argc, char *argv[]) template(outputfd, getVariableByName("template")->value); STACKPOP(); + /* main() beginning */ write(outputfd, "\nint main(void) {\n\t", 19); + + /* Declaring variables */ + for (viter = 0; viter < vss; ++viter) + dprintf(outputfd, "DECLVAR(%.*s, \"%.*s\"); ", + vs[viter].name.len, vs[viter].name.data, + vs[viter].value.len, vs[viter].value.data); + + /* calling function */ caller = Striden($(template)); write(outputfd, caller.data, caller.len); + + /* main() ending */ write(outputfd, "();\n}\n", 6); /* Closing an output */