From: Wolfgang Bumiller Date: Fri, 4 May 2012 22:14:10 +0000 (+0200) Subject: Convenience function to store a predefined string in the qc string area X-Git-Tag: 0.1-rc1~485^2~19 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=edcb97605394f5965261d00d6ba0b9d08c76d3aa;p=xonotic%2Fgmqcc.git Convenience function to store a predefined string in the qc string area --- diff --git a/code.c b/code.c index 81e8aa6..b3cc0b8 100644 --- a/code.c +++ b/code.c @@ -103,6 +103,16 @@ void code_init() { code_statements_add(empty_statement); } +uint32_t code_genstring(const char *str) +{ + uint32_t off = code_chars_elements; + while (*str) { + code_chars_add(*str); + ++str; + } + return off; +} + void code_test() { prog_section_def d1 = { TYPE_VOID, 28, 1 }; prog_section_def d2 = { TYPE_FUNCTION, 29, 8 }; diff --git a/gmqcc.h b/gmqcc.h index e09f175..7178c8f 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -533,8 +533,9 @@ VECTOR_PROT(char, code_chars ); * code_write -- writes out the compiled file * code_init -- prepares the code file */ -bool code_write (const char *filename); -void code_init (); +bool code_write (const char *filename); +void code_init (); +uint32_t code_genstring (const char *string); /*===================================================================*/ /*========================= assembler.c =============================*/