]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
A few of the main IR operation implementations
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index 6e7bb8b1e3a1d3f3ae7815bd1ea0a1efe6aa1b30..7b08209a76bbf259f50b8db18d58a55cfec868be 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -89,24 +89,26 @@ struct lex_file {
  * It's important that this table never exceed 32 keywords, the ascii
  * table starts at 33 (and we don't want conflicts)
  */
-#define TOKEN_DO       0
-#define TOKEN_ELSE     1
-#define TOKEN_IF       2
-#define TOKEN_WHILE    3
-#define TOKEN_BREAK    4
-#define TOKEN_CONTINUE 5
-#define TOKEN_RETURN   6
-#define TOKEN_GOTO     7
-#define TOKEN_FOR      8   // extension
-#define TOKEN_TYPEDEF  9   // extension
+enum {
+    TOKEN_DO       ,
+    TOKEN_ELSE     ,
+    TOKEN_IF       ,
+    TOKEN_WHILE    ,
+    TOKEN_BREAK    ,
+    TOKEN_CONTINUE ,
+    TOKEN_RETURN   ,
+    TOKEN_GOTO     ,
+    TOKEN_FOR      ,   // extension
+    TOKEN_TYPEDEF  ,   // extension
 
-// ensure the token types are out of the
-// bounds of anyothers that may conflict.
-#define TOKEN_FLOAT    110
-#define TOKEN_VECTOR   111
-#define TOKEN_STRING   112
-#define TOKEN_ENTITY   113
-#define TOKEN_VOID     114
+    // ensure the token types are out of the
+    // bounds of anyothers that may conflict.
+    TOKEN_FLOAT    = 110,
+    TOKEN_VECTOR        ,
+    TOKEN_STRING        ,
+    TOKEN_ENTITY        ,
+    TOKEN_VOID
+};
 
 /*
  * Lexer state constants, these are numbers for where exactly in
@@ -114,10 +116,12 @@ struct lex_file {
  * error occurs.  These numbers must be > where the ascii-table ends
  * and > the last type token which is TOKEN_VOID
  */
-#define LEX_COMMENT    1128 
-#define LEX_CHRLIT     1129
-#define LEX_STRLIT     1130
-#define LEX_IDENT      1131
+enum {
+    LEX_COMMENT = 1128, 
+    LEX_CHRLIT        ,
+    LEX_STRLIT        ,
+    LEX_IDENT
+};
 
 int              lex_token  (struct lex_file *);
 void             lex_reset  (struct lex_file *);
@@ -167,6 +171,8 @@ void  util_debug     (const char *, const char *, ...);
 int   util_getline   (char **, size_t *, FILE *);
 void  util_endianswap(void *, int, int);
 
+uint32_t util_crc32(const char *, int, register const short); 
+
 #ifdef NOTRACK
 #    define mem_a(x) malloc(x)
 #    define mem_d(x) free  (x)
@@ -202,14 +208,16 @@ void  util_endianswap(void *, int, int);
 //===================================================================
 //=========================== code.c ================================
 //===================================================================
-#define TYPE_VOID     0
-#define TYPE_STRING   1
-#define TYPE_FLOAT    2
-#define TYPE_VECTOR   3
-#define TYPE_ENTITY   4
-#define TYPE_FIELD    5
-#define TYPE_FUNCTION 6
-#define TYPE_POINTER  7
+enum {
+    TYPE_VOID     ,
+    TYPE_STRING   ,
+    TYPE_FLOAT    ,
+    TYPE_VECTOR   ,
+    TYPE_ENTITY   ,
+    TYPE_FIELD    ,
+    TYPE_FUNCTION ,
+    TYPE_POINTER
+};
 
 /*
  * Each paramater incerements by 3 since vector types hold
@@ -357,7 +365,14 @@ enum {
     INSTR_AND,
     INSTR_OR,
     INSTR_BITAND,
-    INSTR_BITOR
+    INSTR_BITOR,
+
+    /* Virtual instructions used by the IR
+     * Keep at the end!
+     */
+    VINSTR_PHI,
+    VINSTR_JUMP,
+    VINSTR_COND,
 };
 
 /*
@@ -474,6 +489,14 @@ void asm_parse(FILE *);
 //======================================================================
 //============================= main.c =================================
 //======================================================================
+enum {
+    COMPILER_QCC,     /* circa  QuakeC */
+    COMPILER_FTEQCC,  /* fteqcc QuakeC */
+    COMPILER_QCCX,    /* qccx   QuakeC */
+    COMPILER_GMQCC    /* this   QuakeC */
+};
 extern int opts_debug;
 extern int opts_memchk;
+extern int opts_darkplaces_stringtablebug;
+extern int opts_omit_nullcode;
 #endif