COMPILER_QCC, /* circa QuakeC */
COMPILER_FTEQCC, /* fteqcc QuakeC */
COMPILER_QCCX, /* qccx QuakeC */
+ COMPILER_HCODE, /* hcode QuakeC */
COMPILER_GMQCC /* this QuakeC */
} opts_std_t;
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<flag> enable a flag\n"
" -fno-<flag> disable a flag\n"
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;
}
}
- if (parser->tok != '{' || var->expression.vtype != TYPE_FUNCTION) {
- if (parser->tok != '=') {
- parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
- break;
- }
+ if ((OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_HCODE)
+ ? parser->tok != ':'
+ : true
+ ){
+ if (parser->tok != '{' || var->expression.vtype != TYPE_FUNCTION) {
+ if (parser->tok != '=') {
+ parseerror(parser, "missing semicolon or initializer, got: `%s`", parser_tokval(parser));
+ break;
+ }
- if (!parser_next(parser)) {
- parseerror(parser, "error parsing initializer");
- break;
+ if (!parser_next(parser)) {
+ parseerror(parser, "error parsing initializer");
+ break;
+ }
+ }
+ else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
+ parseerror(parser, "expected '=' before function body in this standard");
}
- }
- else if (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_QCC) {
- parseerror(parser, "expected '=' before function body in this standard");
}
- if (parser->tok == '#') {
+ if (parser->tok == '#' ||
+ (OPTS_OPTION_U32(OPTION_STANDARD) == COMPILER_HCODE && parser->tok == ':'))
+ {
ast_function *func = NULL;
ast_value *number = NULL;
float fractional;