]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
code_strings_add replaced with proper multiplie element insertion vector support...
authorDale Weiler <killfieldengine@gmail.com>
Wed, 25 Apr 2012 20:49:04 +0000 (16:49 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Wed, 25 Apr 2012 20:49:04 +0000 (16:49 -0400)
asm.c
code.c
gmqcc.h

diff --git a/asm.c b/asm.c
index 0d09ddbe8ef366f1c7c4b9cb290b6fd7b6cbdc77..2fd10046034b939d05f0d938b8ab78ee56205b4d 100644 (file)
--- a/asm.c
+++ b/asm.c
@@ -140,7 +140,7 @@ void asm_parse(FILE *fp) {
                 .nargs      =  0,
                 .argsize    = {0}
             });
-            code_strings_add(skip);
+            code_chars_put(skip, strlen(skip));
         };
 
         #if 0
diff --git a/code.c b/code.c
index 392508832792f25855734249ed03db5280d4f68a..80d6c3b33fb41616d188f35b1bf2eda990e57d45 100644 (file)
--- a/code.c
+++ b/code.c
@@ -83,15 +83,6 @@ VECTOR_MAKE(prog_section_function,  code_functions );
 VECTOR_MAKE(int,                    code_globals   );
 VECTOR_MAKE(char,                   code_chars     );
 
-int code_strings_add(const char *src) {
-    size_t size = strlen(src);
-    size_t iter = 0;
-    while (iter < size)
-        code_chars_add(src[iter++]);
-    code_chars_add('\0');
-    return code_chars_elements;
-}
-
 void code_init() {
     /* omit creation of null code */
     if (opts_omit_nullcode)
@@ -113,13 +104,13 @@ void code_init() {
 }
 
 void code_test() {    
-    code_strings_add("m_init");
-    code_strings_add("print");
-    code_strings_add("hello world\n");
-    code_strings_add("m_keydown");
-    code_strings_add("m_draw");
-    code_strings_add("m_toggle");
-    code_strings_add("m_shutdown");
+    code_chars_put("m_init",        0x6);
+    code_chars_put("print",         0x5);
+    code_chars_put("hello world\n", 0xC);
+    code_chars_put("m_keydown",     0x9);
+    code_chars_put("m_draw",        0x6);
+    code_chars_put("m_toggle",      0x8);
+    code_chars_put("m_shutdown",    0xA);
     
     code_globals_add(1);  /* m_init */
     code_globals_add(2);  /* print  */
diff --git a/gmqcc.h b/gmqcc.h
index 429d71a32bb53329c0554582cde384f205ea5070..24d34cda71217f9f3027598ea9f994340ba92529 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -400,7 +400,12 @@ int         code_fields_add    (prog_section_field);
 int         code_functions_add (prog_section_function);
 int         code_globals_add   (int);
 int         code_chars_add     (char);
-int         code_strings_add   (const char *); /* function wrapping code_chars_add */
+int         code_statements_put(prog_section_statement*, size_t);
+int         code_defs_put      (prog_section_def*,       size_t);
+int         code_fields_put    (prog_section_field*,     size_t);
+int         code_functions_put (prog_section_function*,  size_t);
+int         code_globals_put   (int*,                    size_t);
+int         code_chars_put     (char*,                   size_t);
 extern long code_statements_elements;
 extern long code_chars_elements;
 extern long code_globals_elements;