Convenience function to store a predefined string in the qc string area

This commit is contained in:
Wolfgang Bumiller 2012-05-05 00:14:10 +02:00 committed by Wolfgang (Blub) Bumiller
parent 8bfbe4d619
commit edcb976053
2 changed files with 13 additions and 2 deletions

10
code.c
View file

@ -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 };

View file

@ -535,6 +535,7 @@ VECTOR_PROT(char, code_chars );
*/
bool code_write (const char *filename);
void code_init ();
uint32_t code_genstring (const char *string);
/*===================================================================*/
/*========================= assembler.c =============================*/