X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=main.c;h=ce3025ac10a0052740e03460cca7f3ff58eafe30;hb=daa1487aefbb31359c532a19e01819f0d00f6716;hp=bbc685a05fdb69bb2b8e7d31071e7d620468df58;hpb=219508e478ab0e9bf0b99799c71925a4a4d49ed7;p=xonotic%2Fgmqcc.git diff --git a/main.c b/main.c index bbc685a..ce3025a 100644 --- a/main.c +++ b/main.c @@ -21,9 +21,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ +#include +#include +#include +#include +#include + + #include "gmqcc.h" #include "lexer.h" -#include /* TODO: cleanup this whole file .. it's a fuckign mess */ @@ -41,9 +47,10 @@ static ppitem *ppems = NULL; #define TYPE_ASM 1 #define TYPE_SRC 2 + static const char *app_name; -static void version() { +static void version(void) { con_out("GMQCC %d.%d.%d Built %s %s\n" GMQCC_DEV_VERSION_STRING, GMQCC_VERSION_MAJOR, GMQCC_VERSION_MINOR, @@ -53,7 +60,7 @@ static void version() { ); } -static int usage() { +static int usage(void) { con_out("usage: %s [options] [files...]", app_name); con_out("options:\n" " -h, --help show this help message\n" @@ -67,6 +74,7 @@ static int usage() { con_out(" -std=standard select one of the following standards\n" " -std=qcc original QuakeC\n" " -std=fteqcc fteqcc QuakeC\n" + " -std=hcode hexgen2 QuakeC\n" " -std=gmqcc this compiler (default)\n"); con_out(" -f enable a flag\n" " -fno- disable a flag\n" @@ -172,6 +180,7 @@ static bool options_parse(int argc, char **argv) { OPTS_OPTION_U32(OPTION_STANDARD) = COMPILER_GMQCC; + OPTS_OPTION_BOOL(OPTION_STATISTICS) = true; } else if (!strcmp(argarg, "qcc")) { @@ -196,6 +205,12 @@ static bool options_parse(int argc, char **argv) { opts_set(opts.flags, ADJUST_VECTOR_FIELDS, false); OPTS_OPTION_U32(OPTION_STANDARD) = COMPILER_QCCX; + } else if (!strcmp(argarg, "hcode")) { + + opts_set(opts.flags, ADJUST_VECTOR_FIELDS, false); + opts_set(opts.flags, ASSIGN_FUNCTION_TYPES, true); + + OPTS_OPTION_U32(OPTION_STANDARD) = COMPILER_HCODE; } else { con_out("Unknown standard: %s\n", argarg); return false; @@ -794,6 +809,7 @@ cleanup: mem_d((void*)operators); lex_cleanup(); - util_meminfo(); + stat_info(); + return retval; }