]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.cpp
Use C++ naming for structures
[xonotic/gmqcc.git] / parser.cpp
index 7296611e160af8980b9dc3a61328c770e1019b3d..23882143e91ea9625cbf5f211e63d4c86e406c55 100644 (file)
@@ -147,15 +147,14 @@ static ast_value* parser_find_typedef(parser_t *parser, const char *name, size_t
     return NULL;
 }
 
-typedef struct
-{
+struct sy_elem {
     size_t etype; /* 0 = expression, others are operators */
-    bool            isparen;
-    size_t          off;
+    bool isparen;
+    size_t off;
     ast_expression *out;
-    ast_block      *block; /* for commas and function calls */
+    ast_block *block; /* for commas and function calls */
     lex_ctx_t ctx;
-} sy_elem;
+};
 
 enum {
     PAREN_EXPR,
@@ -164,13 +163,13 @@ enum {
     PAREN_TERNARY1,
     PAREN_TERNARY2
 };
-typedef struct
-{
+
+struct shunt {
     sy_elem        *out;
     sy_elem        *ops;
     size_t         *argc;
     unsigned int   *paren;
-} shunt;
+};
 
 static sy_elem syexp(lex_ctx_t ctx, ast_expression *v) {
     sy_elem e;
@@ -594,8 +593,8 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
                 if (!mod) return false; /* can return null for missing floor */
 
                 call = ast_call_new(parser_ctx(parser), mod);
-                vec_push(call->params, exprs[0]);
-                vec_push(call->params, exprs[1]);
+                call->params.push_back(exprs[0]);
+                call->params.push_back(exprs[1]);
 
                 out = (ast_expression*)call;
             }
@@ -661,8 +660,8 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
             if (!(out = fold_op(parser->fold, op, exprs))) {
                 ast_expression *shift = intrin_func(parser->intrin, (op->id == opid2('<','<')) ? "__builtin_lshift" : "__builtin_rshift");
                 ast_call       *call  = ast_call_new(parser_ctx(parser), shift);
-                vec_push(call->params, exprs[0]);
-                vec_push(call->params, exprs[1]);
+                call->params.push_back(exprs[0]);
+                call->params.push_back(exprs[1]);
                 out = (ast_expression*)call;
             }
             break;
@@ -679,8 +678,8 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
             if(!(out = fold_op(parser->fold, op, exprs))) {
                 ast_expression *shift = intrin_func(parser->intrin, (op->id == opid3('<','<','=')) ? "__builtin_lshift" : "__builtin_rshift");
                 ast_call       *call  = ast_call_new(parser_ctx(parser), shift);
-                vec_push(call->params, exprs[0]);
-                vec_push(call->params, exprs[1]);
+                call->params.push_back(exprs[0]);
+                call->params.push_back(exprs[1]);
                 out = (ast_expression*)ast_store_new(
                     parser_ctx(parser),
                     INSTR_STORE_F,
@@ -757,8 +756,8 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
 
             if (!(out = fold_op(parser->fold, op, exprs))) {
                 ast_call *gencall = ast_call_new(parser_ctx(parser), intrin_func(parser->intrin, "pow"));
-                vec_push(gencall->params, exprs[0]);
-                vec_push(gencall->params, exprs[1]);
+                gencall->params.push_back(exprs[0]);
+                gencall->params.push_back(exprs[1]);
                 out = (ast_expression*)gencall;
             }
             break;
@@ -1265,7 +1264,7 @@ static bool parser_close_call(parser_t *parser, shunt *sy)
     }
 
     for (i = 0; i < paramcount; ++i)
-        vec_push(call->params, sy->out[fid+1 + i].out);
+        call->params.push_back(sy->out[fid+1 + i].out);
     vec_shrinkby(sy->out, paramcount);
     (void)!ast_call_check_types(call, parser->function->vtype->expression.varparam);
     if (parser->max_param_count < paramcount)
@@ -2724,10 +2723,10 @@ static bool parse_break_continue(parser_t *parser, ast_block *block, ast_express
 /* returns true when it was a variable qualifier, false otherwise!
  * on error, cvq is set to CV_WRONG
  */
-typedef struct {
+struct attribute_t {
     const char *name;
     size_t      flag;
-} attribute_t;
+};
 
 static bool parse_qualifiers(parser_t *parser, bool with_local, int *cvq, bool *noref, bool *is_static, uint32_t *_flags, char **message)
 {