]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.h
More cleanup
[xonotic/gmqcc.git] / ast.h
diff --git a/ast.h b/ast.h
index 7cc7a6c89b13975549307d2a269c3fde4bb4ec85..964e16eabd9968be216e07498b06f4c95fbaa34f 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -1,26 +1,3 @@
-/*
- * Copyright (C) 2012, 2013, 2014
- *     Wolfgang Bumiller
- *     Dale Weiler
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy of
- * this software and associated documentation files (the "Software"), to deal in
- * the Software without restriction, including without limitation the rights to
- * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- * of the Software, and to permit persons to whom the Software is furnished to do
- * so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
 #ifndef GMQCC_AST_HDR
 #define GMQCC_AST_HDR
 #include "ir.h"
@@ -54,6 +31,7 @@ typedef struct ast_switch_s      ast_switch;
 typedef struct ast_label_s       ast_label;
 typedef struct ast_goto_s        ast_goto;
 typedef struct ast_argpipe_s     ast_argpipe;
+typedef struct ast_state_s       ast_state;
 
 enum {
     AST_FLAG_VARIADIC       = 1 << 0,
@@ -111,7 +89,8 @@ enum {
     TYPE_ast_switch,      /* 18 */
     TYPE_ast_label,       /* 19 */
     TYPE_ast_goto,        /* 20 */
-    TYPE_ast_argpipe      /* 21 */
+    TYPE_ast_argpipe,     /* 21 */
+    TYPE_ast_state        /* 22 */
 };
 
 #define ast_istype(x, t) ( ((ast_node*)x)->nodetype == (TYPE_##t) )
@@ -214,6 +193,7 @@ struct ast_value_s
     bool isfield; /* this declares a field */
     bool isimm;   /* an immediate, not just const */
     bool hasvalue;
+    bool inexact; /* inexact coming from folded expression */
     basic_value_t constval;
     /* for TYPE_ARRAY we have an optional vector
      * of constants when an initializer list
@@ -579,6 +559,19 @@ struct ast_goto_s
 ast_goto* ast_goto_new(lex_ctx_t ctx, const char *name);
 void ast_goto_set_label(ast_goto*, ast_label*);
 
+/* STATE node
+ *
+ * For frame/think state updates: void foo() [framenum, nextthink] {}
+ */
+struct ast_state_s
+{
+    ast_expression  expression;
+    ast_expression *framenum;
+    ast_expression *nextthink;
+};
+ast_state* ast_state_new(lex_ctx_t ctx, ast_expression *frame, ast_expression *think);
+void ast_state_delete(ast_state*);
+
 /* CALL node
  *
  * Contains an ast_expression as target, rather than an ast_function/value.
@@ -650,15 +643,6 @@ struct ast_function_s
     ir_block    **breakblocks;
     ir_block    **continueblocks;
 
-#if 0
-    /* In order for early-out logic not to go over
-     * excessive jumps, we remember their target
-     * blocks...
-     */
-    ir_block    *iftrue;
-    ir_block    *iffalse;
-#endif
-
     size_t       labelcount;
     /* in order for thread safety - for the optional
      * channel abesed multithreading... keeping a buffer