]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Indentation
authorDale Weiler <killfieldengine@gmail.com>
Thu, 19 Apr 2012 22:03:30 +0000 (18:03 -0400)
committerDale Weiler <killfieldengine@gmail.com>
Thu, 19 Apr 2012 22:03:30 +0000 (18:03 -0400)
assembler.c
code.c
util.c

index c3cde36d4c1ed889a9797a02306083028e3977ed..e64fb9c697c74d15915e0695519e4f7ca5a3bf04 100644 (file)
@@ -156,10 +156,10 @@ typedef struct {
 VECTOR_MAKE(globals, assembly_constants);
 
 void asm_clear() {
-       size_t i = 0;
-       for (; i < assembly_constants_elements; i++)
-               mem_d(assembly_constants_data[i].name);
-       mem_d(assembly_constants_data);
+    size_t i = 0;
+    for (; i < assembly_constants_elements; i++)
+        mem_d(assembly_constants_data[i].name);
+    mem_d(assembly_constants_data);
 }
 
 void asm_parse(FILE *fp) {
@@ -210,7 +210,7 @@ void asm_parse(FILE *fp) {
         
         /* FLOAT    */
         DECLTYPE(asm_keys[0], {
-                       //util_debug("ASM", "Constant FLOAT\n");
+            //util_debug("ASM", "Constant FLOAT\n");
             code_defs_add((prog_section_def){
                 .type   = TYPE_FLOAT,
                 .offset = offset_globals, /* global table */
@@ -222,7 +222,7 @@ void asm_parse(FILE *fp) {
         });
         /* VECTOR */
         DECLTYPE(asm_keys[1], {
-                       //util_debug("ASM", "Constant VECTOR\n");
+            //util_debug("ASM", "Constant VECTOR\n");
             code_defs_add((prog_section_def){
                 .type   = TYPE_FLOAT,
                 .offset = offset_globals, /* global table */
@@ -239,7 +239,7 @@ void asm_parse(FILE *fp) {
         /* FIELD    */ DECLTYPE(asm_keys[3], {util_debug("ASM", "Constant FIELD\n");});
         /* STRING   */
         DECLTYPE(asm_keys[4], {
-                       //util_debug("ASM", "Constant STRING\n");
+            //util_debug("ASM", "Constant STRING\n");
             code_defs_add((prog_section_def){
                 .type   = TYPE_STRING,    
                 .offset = offset_globals, /* offset to offset in string table (for data)*/
@@ -249,7 +249,7 @@ void asm_parse(FILE *fp) {
         });
         /* FUNCTION */
         DECLTYPE(asm_keys[5], {
-                       //util_debug("ASM", "Constant FUNCTION\n");
+            //util_debug("ASM", "Constant FUNCTION\n");
             /* TODO: parse */
             if (state != ASM_NULL) {
                 printf("%li: Error unfinished function block, expected DONE or RETURN\n", line);
diff --git a/code.c b/code.c
index ea4833f978bbf727f17b8696a243d975e6453334..4abd99b160a5cf09debca1e43a60a2b0e9189c08 100644 (file)
--- a/code.c
+++ b/code.c
@@ -81,12 +81,12 @@ 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;
+    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() {
@@ -179,24 +179,24 @@ void code_write() {
     util_debug("GEN", "functions:\n");
     size_t i = 0;
     for (; i < code_functions_elements; i++) {
-       util_debug("GEN", "    {.entry =% 5d, .firstlocal =% 5d, .locals =% 5d, .profile =% 5d, .name =% 5d, .file =% 5d, .nargs =% 5d, .argsize =%0X }\n",
-               code_functions_data[i].entry,
-               code_functions_data[i].firstlocal,
-               code_functions_data[i].locals,
-               code_functions_data[i].profile,
-               code_functions_data[i].name,
-               code_functions_data[i].file,
-               code_functions_data[i].nargs,
-               *((int32_t*)&code_functions_data[i].argsize)
-       );
+        util_debug("GEN", "    {.entry =% 5d, .firstlocal =% 5d, .locals =% 5d, .profile =% 5d, .name =% 5d, .file =% 5d, .nargs =% 5d, .argsize =%0X }\n",
+            code_functions_data[i].entry,
+            code_functions_data[i].firstlocal,
+            code_functions_data[i].locals,
+            code_functions_data[i].profile,
+            code_functions_data[i].name,
+            code_functions_data[i].file,
+            code_functions_data[i].nargs,
+            *((int32_t*)&code_functions_data[i].argsize)
+        );
     }
-               
-       mem_d(code_statements_data);
-       mem_d(code_defs_data);
-       mem_d(code_fields_data);
-       mem_d(code_functions_data);
-       mem_d(code_globals_data);
-       mem_d(code_chars_data);
+    
+    mem_d(code_statements_data);
+    mem_d(code_defs_data);
+    mem_d(code_fields_data);
+    mem_d(code_functions_data);
+    mem_d(code_globals_data);
+    mem_d(code_chars_data);
     
     fclose(fp);
 }
diff --git a/util.c b/util.c
index 85056979a201673a0959217881adfe9afe33251b..d46172096b2ab9cfaf6a84688a4670b4040310a4 100644 (file)
--- a/util.c
+++ b/util.c
@@ -150,24 +150,23 @@ void util_debug(const char *area, const char *ms, ...) {
  * certian-sized types like short or int.
  */
 void util_endianswap(void *m, int s, int l) {
-       size_t w = 0;
-       size_t i = 0;
-       
-       /* ignore if we're already LE */
+    size_t w = 0;
+    size_t i = 0;
+
+    /* ignore if we're already LE */
     if(*((char *)&s))
-               return;
-    
+        return;
+
     for(; w < l; w++) {
-               for(;  i < s << 1; i++) {
-                       unsigned char *p = (unsigned char *)m+w*s;
-                       unsigned char  t = p[i];
-                       p[i]             = p[s-i-1];
-                       p[s-i-1]         = t;
-               }
-       }
+        for(;  i < s << 1; i++) {
+            unsigned char *p = (unsigned char *)m+w*s;
+            unsigned char  t = p[i];
+            p[i]             = p[s-i-1];
+            p[s-i-1]         = t;
+        }
+    }
 }
 
-
 /*
  * Implements libc getline for systems that don't have it, which is 
  * assmed all.  This works the same as getline().
@@ -198,7 +197,7 @@ int util_getline(char **lineptr, size_t *n, FILE *stream) {
             chr = *n + *lineptr - pos;
             strcpy(tmp,*lineptr);
             if (!(*lineptr = tmp)) {
-                               mem_d (tmp);
+                mem_d (tmp);
                 return -1;
             } 
             pos = *n - chr + *lineptr;