]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
commenting on the quirks of MUL_VF and MUL_FV in gmqcc.h's instruction list
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index 9d34199b7ad562191231010e46879d34337db8ed..68cc39375e7e894ffaef7b362b912986e62096e1 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
  * of my time.
  */
 #ifdef _MSC_VER
-#      pragma warning(disable : 4244 ) // conversion from 'int' to 'float', possible loss of data
-#      pragma warning(disable : 4018 ) // signed/unsigned mismatch
-#      pragma warning(disable : 4996 ) // This function or variable may be unsafe
-#      pragma warning(disable : 4700 ) // uninitialized local variable used
+#      pragma warning(disable : 4244 ) /* conversion from 'int' to 'float', possible loss of data */
+#      pragma warning(disable : 4018 ) /* signed/unsigned mismatch                                */
+#      pragma warning(disable : 4996 ) /* This function or variable may be unsafe                 */
+#      pragma warning(disable : 4700 ) /* uninitialized local variable used                       */
 #endif
 
 #define GMQCC_VERSION_MAJOR 0
@@ -410,8 +410,8 @@ enum {
     INSTR_DONE,
     INSTR_MUL_F,
     INSTR_MUL_V,
-    INSTR_MUL_FV,
-    INSTR_MUL_VF,
+    INSTR_MUL_FV, /* NOTE: the float operands must NOT be at the same locations: A != C */
+    INSTR_MUL_VF, /* and here: B != C */
     INSTR_DIV_F,
     INSTR_ADD_F,
     INSTR_ADD_V,
@@ -539,7 +539,7 @@ static const struct {
     { "ADD_F"     , 3, 5 },
     { "ADD_V"     , 3, 5 },
     { "SUB_F"     , 3, 5 },
-    { "DUB_V"     , 3, 5 },
+    { "SUB_V"     , 3, 5 },
     { "EQ_F"      , 0, 4 },
     { "EQ_V"      , 0, 4 },
     { "EQ_S"      , 0, 4 },
@@ -717,6 +717,7 @@ bool GMQCC_WARN Tself##_##mem##_resize(Tself *s, size_t c)       \
         if (!reall) { return false; }                            \
         memcpy(reall, s->mem, sizeof(Twhat) * s->mem##_count);   \
         s->mem##_alloc = c;                                      \
+        s->mem##_count = c;                                      \
         mem_d(s->mem);                                           \
         s->mem = reall;                                          \
         return true;                                             \
@@ -860,6 +861,8 @@ typedef struct qc_program_s {
     MEM_VECTOR_MAKE(qcint,                  entitydata);
     MEM_VECTOR_MAKE(bool,                   entitypool);
 
+    uint16_t crc16;
+
     size_t tempstring_start;
     size_t tempstring_at;
 
@@ -878,6 +881,8 @@ typedef struct qc_program_s {
     MEM_VECTOR_MAKE(qc_exec_stack, stack);
     size_t statement;
 
+    size_t xflags;
+
     int    argc; /* current arg count for debugging */
 } qc_program;
 
@@ -994,6 +999,8 @@ extern bool        opts_debug;
 extern bool        opts_memchk;
 extern bool        opts_dump;
 extern bool        opts_werror;
+extern bool        opts_forcecrc;
+extern uint16_t    opts_forced_crc;
 
 /*===================================================================*/
 #define OPTS_FLAG(i) (!! (opts_flags[(i)/32] & (1<< ((i)%32))))