mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-23 19:01:06 +00:00
Get QC cfunctions and defs working.
This commit is contained in:
parent
ade2e92ea4
commit
30701980bc
2 changed files with 27 additions and 1 deletions
|
@ -78,6 +78,7 @@ new_defspace (void)
|
|||
defspace_t *space;
|
||||
|
||||
ALLOC (1024, defspace_t, spaces, space);
|
||||
space->def_tail = &space->defs;
|
||||
space->grow = grow_space;
|
||||
return space;
|
||||
}
|
||||
|
|
|
@ -284,15 +284,36 @@ simple_def
|
|||
cfunction
|
||||
: cfunction_def ';'
|
||||
| cfunction_def '=' '#' fexpr ';'
|
||||
| cfunction_def opt_state_expr statement_block
|
||||
{
|
||||
build_builtin_function ($1, $4);
|
||||
}
|
||||
| cfunction_def
|
||||
{
|
||||
$<symtab>$ = current_symtab;
|
||||
current_func = begin_function ($1, 0, current_symtab);
|
||||
current_symtab = current_func->symtab;
|
||||
}
|
||||
opt_state_expr statement_block
|
||||
{
|
||||
build_code_function ($1, $3, $4);
|
||||
current_symtab = $<symtab>2;
|
||||
}
|
||||
;
|
||||
|
||||
cfunction_def
|
||||
: OVERLOAD non_func_type identifier function_decl
|
||||
{
|
||||
$$ = $3;
|
||||
$$->params = current_params = $4;
|
||||
$$->type = parse_params ($2, $4);
|
||||
$$ = function_symbol ($$, 1, 1);
|
||||
}
|
||||
| non_func_type identifier function_decl
|
||||
{
|
||||
$$ = $2;
|
||||
$$->params = current_params = $3;
|
||||
$$->type = parse_params ($1, $3);
|
||||
$$ = function_symbol ($$, 0, 1);
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -487,6 +508,10 @@ def_list
|
|||
def_item
|
||||
: def_name opt_initializer
|
||||
{
|
||||
$1 = check_redefined ($1);
|
||||
$1->type = $<type>0;
|
||||
$1->visibility = current_visibility;
|
||||
symtab_addsymbol (current_symtab, $1);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue