]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
Adding strcat builtin to qcvm
[xonotic/gmqcc.git] / parser.c
index 8f3638d6ea5d35920e494cc48dc5c34fab762f8c..bfa6d6a284d7e7cbcc7b713a4183637e7d54b22f 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -113,34 +113,34 @@ static ast_expression* parse_expression(parser_t *parser, bool stopatcomma);
 
 static void parseerror(parser_t *parser, const char *fmt, ...)
 {
-  va_list ap;
+    va_list ap;
 
-  parser->errors++;
+    parser->errors++;
 
-  va_start(ap, fmt);
+    va_start(ap, fmt);
     con_vprintmsg(LVL_ERROR, parser->lex->tok.ctx.file, parser->lex->tok.ctx.line, "parse error", fmt, ap);
-  va_end(ap);
+    va_end(ap);
 }
 
 /* returns true if it counts as an error */
 static bool GMQCC_WARN parsewarning(parser_t *parser, int warntype, const char *fmt, ...)
 {
     bool    r;
-  va_list ap;
-  va_start(ap, fmt);
-  r = vcompile_warning(parser->lex->tok.ctx, warntype, fmt, ap);
-  va_end(ap);
-  return r;
+    va_list ap;
+    va_start(ap, fmt);
+    r = vcompile_warning(parser->lex->tok.ctx, warntype, fmt, ap);
+    va_end(ap);
+    return r;
 }
 
 static bool GMQCC_WARN genwarning(lex_ctx ctx, int warntype, const char *fmt, ...)
 {
     bool    r;
-  va_list ap;
-  va_start(ap, fmt);
-  r = vcompile_warning(ctx, warntype, fmt, ap);
-  va_end(ap);
-  return r;
+    va_list ap;
+    va_start(ap, fmt);
+    r = vcompile_warning(ctx, warntype, fmt, ap);
+    va_end(ap);
+    return r;
 }
 
 /**********************************************************************
@@ -4600,56 +4600,56 @@ static void generate_checksum(parser_t *parser)
     size_t     i;
     ast_value *value;
 
-  crc = progdefs_crc_both(crc, "\n/* file generated by qcc, do not modify */\n\ntypedef struct\n{");
-  crc = progdefs_crc_sum(crc, "\tint\tpad[28];\n");
-  /*
-  progdefs_crc_file("\tint\tpad;\n");
-  progdefs_crc_file("\tint\tofs_return[3];\n");
-  progdefs_crc_file("\tint\tofs_parm0[3];\n");
-  progdefs_crc_file("\tint\tofs_parm1[3];\n");
-  progdefs_crc_file("\tint\tofs_parm2[3];\n");
-  progdefs_crc_file("\tint\tofs_parm3[3];\n");
-  progdefs_crc_file("\tint\tofs_parm4[3];\n");
-  progdefs_crc_file("\tint\tofs_parm5[3];\n");
-  progdefs_crc_file("\tint\tofs_parm6[3];\n");
-  progdefs_crc_file("\tint\tofs_parm7[3];\n");
-  */
-  for (i = 0; i < parser->crc_globals; ++i) {
-      if (!ast_istype(parser->globals[i], ast_value))
-          continue;
-      value = (ast_value*)(parser->globals[i]);
-      switch (value->expression.vtype) {
-          case TYPE_FLOAT:    crc = progdefs_crc_both(crc, "\tfloat\t"); break;
-          case TYPE_VECTOR:   crc = progdefs_crc_both(crc, "\tvec3_t\t"); break;
-          case TYPE_STRING:   crc = progdefs_crc_both(crc, "\tstring_t\t"); break;
-          case TYPE_FUNCTION: crc = progdefs_crc_both(crc, "\tfunc_t\t"); break;
-          default:
-              crc = progdefs_crc_both(crc, "\tint\t");
-              break;
-      }
-      crc = progdefs_crc_both(crc, value->name);
-      crc = progdefs_crc_both(crc, ";\n");
-  }
-  crc = progdefs_crc_both(crc, "} globalvars_t;\n\ntypedef struct\n{\n");
-  for (i = 0; i < parser->crc_fields; ++i) {
-      if (!ast_istype(parser->fields[i], ast_value))
-          continue;
-      value = (ast_value*)(parser->fields[i]);
-      switch (value->expression.next->expression.vtype) {
-          case TYPE_FLOAT:    crc = progdefs_crc_both(crc, "\tfloat\t"); break;
-          case TYPE_VECTOR:   crc = progdefs_crc_both(crc, "\tvec3_t\t"); break;
-          case TYPE_STRING:   crc = progdefs_crc_both(crc, "\tstring_t\t"); break;
-          case TYPE_FUNCTION: crc = progdefs_crc_both(crc, "\tfunc_t\t"); break;
-          default:
-              crc = progdefs_crc_both(crc, "\tint\t");
-              break;
-      }
-      crc = progdefs_crc_both(crc, value->name);
-      crc = progdefs_crc_both(crc, ";\n");
-  }
-  crc = progdefs_crc_both(crc, "} entvars_t;\n\n");
-
-  code_crc = crc;
+    crc = progdefs_crc_both(crc, "\n/* file generated by qcc, do not modify */\n\ntypedef struct\n{");
+    crc = progdefs_crc_sum(crc, "\tint\tpad[28];\n");
+    /*
+    progdefs_crc_file("\tint\tpad;\n");
+    progdefs_crc_file("\tint\tofs_return[3];\n");
+    progdefs_crc_file("\tint\tofs_parm0[3];\n");
+    progdefs_crc_file("\tint\tofs_parm1[3];\n");
+    progdefs_crc_file("\tint\tofs_parm2[3];\n");
+    progdefs_crc_file("\tint\tofs_parm3[3];\n");
+    progdefs_crc_file("\tint\tofs_parm4[3];\n");
+    progdefs_crc_file("\tint\tofs_parm5[3];\n");
+    progdefs_crc_file("\tint\tofs_parm6[3];\n");
+    progdefs_crc_file("\tint\tofs_parm7[3];\n");
+    */
+    for (i = 0; i < parser->crc_globals; ++i) {
+        if (!ast_istype(parser->globals[i], ast_value))
+            continue;
+        value = (ast_value*)(parser->globals[i]);
+        switch (value->expression.vtype) {
+            case TYPE_FLOAT:    crc = progdefs_crc_both(crc, "\tfloat\t"); break;
+            case TYPE_VECTOR:   crc = progdefs_crc_both(crc, "\tvec3_t\t"); break;
+            case TYPE_STRING:   crc = progdefs_crc_both(crc, "\tstring_t\t"); break;
+            case TYPE_FUNCTION: crc = progdefs_crc_both(crc, "\tfunc_t\t"); break;
+            default:
+                crc = progdefs_crc_both(crc, "\tint\t");
+                break;
+        }
+        crc = progdefs_crc_both(crc, value->name);
+        crc = progdefs_crc_both(crc, ";\n");
+    }
+    crc = progdefs_crc_both(crc, "} globalvars_t;\n\ntypedef struct\n{\n");
+    for (i = 0; i < parser->crc_fields; ++i) {
+        if (!ast_istype(parser->fields[i], ast_value))
+            continue;
+        value = (ast_value*)(parser->fields[i]);
+        switch (value->expression.next->expression.vtype) {
+            case TYPE_FLOAT:    crc = progdefs_crc_both(crc, "\tfloat\t"); break;
+            case TYPE_VECTOR:   crc = progdefs_crc_both(crc, "\tvec3_t\t"); break;
+            case TYPE_STRING:   crc = progdefs_crc_both(crc, "\tstring_t\t"); break;
+            case TYPE_FUNCTION: crc = progdefs_crc_both(crc, "\tfunc_t\t"); break;
+            default:
+                crc = progdefs_crc_both(crc, "\tint\t");
+                break;
+        }
+        crc = progdefs_crc_both(crc, value->name);
+        crc = progdefs_crc_both(crc, ";\n");
+    }
+    crc = progdefs_crc_both(crc, "} entvars_t;\n\n");
+
+    code_crc = crc;
 }
 
 static parser_t *parser;