mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-22 11:41:38 +00:00
more work on the code generation and make generally usable again by disabling
the new stuff
This commit is contained in:
parent
f9baacd440
commit
373ea8132a
3 changed files with 37 additions and 20 deletions
|
@ -33,5 +33,5 @@ YFLAGS = -d
|
||||||
|
|
||||||
bin_PROGRAMS= qfcc
|
bin_PROGRAMS= qfcc
|
||||||
|
|
||||||
qfcc_SOURCES= cmdlib.c pr_comp.c pr_def.c pr_imm.c pr_lex.c pr_opcode.c qfcc.c qc-parse.y qc-lex.l
|
qfcc_SOURCES= cmdlib.c pr_comp.c pr_def.c pr_imm.c pr_lex.c pr_opcode.c qfcc.c #qc-parse.y qc-lex.l
|
||||||
qfcc_LDADD= -lQFutil
|
qfcc_LDADD= -lQFutil
|
||||||
|
|
|
@ -32,16 +32,26 @@ type_t *PR_FindType (type_t *new);
|
||||||
%left '*' '/' '&' '|'
|
%left '*' '/' '&' '|'
|
||||||
%left '!' '.' '('
|
%left '!' '.' '('
|
||||||
|
|
||||||
%token NAME INT_VAL FLOAT_VAL STRING_VAL VECTOR_VAL QUATERNION_VAL
|
%token <string_val> NAME STRING_VAL
|
||||||
|
%token <int_val> INT_VAL
|
||||||
|
%token <float_val> FLOAT_VAL
|
||||||
|
%token <vector_val> VECTOR_VAL
|
||||||
|
%token <quaternion_val> QUATERNION_VAL
|
||||||
|
|
||||||
%token LOCAL RETURN WHILE DO IF ELSE FOR ELIPSIS
|
%token LOCAL RETURN WHILE DO IF ELSE FOR ELIPSIS
|
||||||
%token <type> TYPE
|
%token <type> TYPE
|
||||||
|
|
||||||
%type <type> type
|
%type <type> type
|
||||||
%type <def> param param_list def_item def def_list
|
%type <def> param param_list def_item def_list expr arg_list
|
||||||
|
|
||||||
%expect 1
|
%expect 1
|
||||||
|
|
||||||
|
%{
|
||||||
|
|
||||||
|
type_t *current_type;
|
||||||
|
|
||||||
|
%}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
defs
|
defs
|
||||||
|
@ -50,13 +60,7 @@ defs
|
||||||
;
|
;
|
||||||
|
|
||||||
def
|
def
|
||||||
: type def_list
|
: type {current_type = $1;} def_list {}
|
||||||
{
|
|
||||||
def_t *def;
|
|
||||||
for (def = $2; def; def = def->next)
|
|
||||||
def->type = $1;
|
|
||||||
$$ = $2;
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -81,7 +85,11 @@ def_list
|
||||||
;
|
;
|
||||||
|
|
||||||
def_item
|
def_item
|
||||||
: NAME opt_initializer {}
|
: NAME
|
||||||
|
{
|
||||||
|
$$ = PR_GetDef (current_type, $1, pr_scope, pr_scope ? &pr_scope->num_locals : &numpr_globals);
|
||||||
|
}
|
||||||
|
opt_initializer
|
||||||
| '(' param_list ')' NAME opt_initializer {}
|
| '(' param_list ')' NAME opt_initializer {}
|
||||||
| '(' ')' NAME opt_initializer {}
|
| '(' ')' NAME opt_initializer {}
|
||||||
| '(' ELIPSIS ')' NAME opt_initializer {}
|
| '(' ELIPSIS ')' NAME opt_initializer {}
|
||||||
|
@ -157,8 +165,11 @@ expr
|
||||||
| '-' expr
|
| '-' expr
|
||||||
| '!' expr
|
| '!' expr
|
||||||
| NAME
|
| NAME
|
||||||
| const
|
{
|
||||||
| '(' expr ')'
|
$$ = PR_GetDef (NULL, $1, pr_scope, false);
|
||||||
|
}
|
||||||
|
| const {}
|
||||||
|
| '(' expr ')' { $$ = $2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
arg_list
|
arg_list
|
||||||
|
@ -167,11 +178,11 @@ arg_list
|
||||||
;
|
;
|
||||||
|
|
||||||
const
|
const
|
||||||
: FLOAT_VAL
|
: FLOAT_VAL {}
|
||||||
| STRING_VAL
|
| STRING_VAL {}
|
||||||
| VECTOR_VAL
|
| VECTOR_VAL {}
|
||||||
| QUATERNION_VAL
|
| QUATERNION_VAL {}
|
||||||
| INT_VAL
|
| INT_VAL {}
|
||||||
;
|
;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -904,6 +904,7 @@ Options: \n\
|
||||||
|
|
||||||
// compile all the files
|
// compile all the files
|
||||||
while ((src = COM_Parse (src))) {
|
while ((src = COM_Parse (src))) {
|
||||||
|
#if 0
|
||||||
extern FILE *yyin;
|
extern FILE *yyin;
|
||||||
int yyparse(void);
|
int yyparse(void);
|
||||||
extern int lineno;
|
extern int lineno;
|
||||||
|
@ -913,9 +914,7 @@ Options: \n\
|
||||||
|
|
||||||
sprintf (filename, "%s/%s", sourcedir, com_token);
|
sprintf (filename, "%s/%s", sourcedir, com_token);
|
||||||
printf ("compiling %s\n", filename);
|
printf ("compiling %s\n", filename);
|
||||||
LoadFile (filename, (void *) &src2);
|
|
||||||
|
|
||||||
//if (!PR_CompileFile (src2, filename))
|
|
||||||
yyin = fopen (filename, "rt");
|
yyin = fopen (filename, "rt");
|
||||||
lineno = 1;
|
lineno = 1;
|
||||||
clear_frame_macros ();
|
clear_frame_macros ();
|
||||||
|
@ -924,6 +923,13 @@ Options: \n\
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fclose (yyin);
|
fclose (yyin);
|
||||||
|
#else
|
||||||
|
sprintf (filename, "%s/%s", sourcedir, com_token);
|
||||||
|
printf ("compiling %s\n", filename);
|
||||||
|
LoadFile (filename, (void *) &src2);
|
||||||
|
if (!PR_CompileFile (src2, filename))
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PR_FinishCompilation ())
|
if (!PR_FinishCompilation ())
|
||||||
|
|
Loading…
Reference in a new issue