]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - code.c
Convenience function to store a predefined string in the qc string area
[xonotic/gmqcc.git] / code.c
diff --git a/code.c b/code.c
index 81e8aa62077e00cdd7c7e95c3cceac8ff13d965e..b3cc0b825bb03ec6369eb528102c817d3a4f37e2 100644 (file)
--- 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 };