]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - code.c
Merging master and adopting its main.c
[xonotic/gmqcc.git] / code.c
diff --git a/code.c b/code.c
index caeab883b8ada2edb099e2113b9f4cc2ff02357a..0cb373b96bc07a9eea6c232209bc4e4e0d9dad41 100644 (file)
--- a/code.c
+++ b/code.c
  */
 #include "gmqcc.h"
 
-typedef struct {
-    uint32_t offset;      /* Offset in file of where data begins  */
-    uint32_t length;      /* Length of section (how many of)      */
-} prog_section;
-
-typedef struct {
-    uint32_t     version;      /* Program version (6)     */
-    uint16_t     crc16;        /* What is this?           */
-    uint16_t     skip;         /* see propsal.txt         */
-
-    prog_section statements;   /* prog_section_statement  */
-    prog_section defs;         /* prog_section_def        */
-    prog_section fields;       /* prog_section_field      */
-    prog_section functions;    /* prog_section_function   */
-    prog_section strings;      /* What is this?           */
-    prog_section globals;      /* What is this?           */
-    uint32_t     entfield;     /* Number of entity fields */
-} prog_header;
-
 /*
  * The macros below expand to a typesafe vector implementation, which
  * can be viewed in gmqcc.h
@@ -88,7 +69,7 @@ void code_init() {
     int                    i               = 0;
 
     /* omit creation of null code */
-    if (opts_omit_nullcode)
+    if (OPTS_FLAG(OMIT_NULL_BYTES))
         return;
 
     /*
@@ -177,7 +158,7 @@ bool code_write(const char *filename) {
     size_t       it           = 2;
 
     /* see proposal.txt */
-    if (opts_omit_nullcode) {}
+    if (OPTS_FLAG(OMIT_NULL_BYTES)) {}
     code_header.statements.offset = sizeof(prog_header);
     code_header.statements.length = code_statements_elements;
     code_header.defs.offset       = code_header.statements.offset + (sizeof(prog_section_statement) * code_statements_elements);
@@ -194,7 +175,7 @@ bool code_write(const char *filename) {
     code_header.crc16             = 0; /* TODO: */
     code_header.entfield          = 0; /* TODO: */
 
-    if (opts_darkplaces_stringtablebug) {
+    if (OPTS_FLAG(DARKPLACES_STRING_TABLE_BUG)) {
         util_debug("GEN", "Patching stringtable for -fdarkplaces-stringtablebug\n");
 
         /* >= + P */