From 3c86660d4a56547830d9cfcae3ab94a721004492 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 23 Jan 2022 14:17:25 +0900 Subject: [PATCH] [gamecode] Rename MAX_PARMS to PR_MAXPARAMS --- include/QF/progs.h | 6 +++--- include/QF/progs/pr_comp.h | 4 ++-- libs/gamecode/pr_debug.c | 2 +- libs/gamecode/pr_exec.c | 6 +++--- libs/gamecode/pr_resolve.c | 2 +- libs/gamecode/pr_v6p_opcode.c | 2 +- libs/ruamoko/rua_obj.c | 2 +- qw/source/sv_pr_cmds.c | 2 +- tools/qfcc/source/expr.c | 8 ++++---- tools/qfcc/source/function.c | 4 ++-- tools/qfcc/source/method.c | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/QF/progs.h b/include/QF/progs.h index 3da8bca00..bf96afca0 100644 --- a/include/QF/progs.h +++ b/include/QF/progs.h @@ -1205,7 +1205,7 @@ typedef struct { pr_int_t locals; pr_uint_t profile; pr_int_t numparms; - dparmsize_t parm_size[MAX_PARMS]; + dparmsize_t parm_size[PR_MAX_PARAMS]; dfunction_t *descriptor; builtin_proc func; } bfunction_t; @@ -1896,8 +1896,8 @@ struct progs_s { /// \name parameter block ///@{ pr_type_t *pr_return; - pr_type_t *pr_params[MAX_PARMS]; - pr_type_t *pr_real_params[MAX_PARMS]; + pr_type_t *pr_params[PR_MAX_PARAMS]; + pr_type_t *pr_real_params[PR_MAX_PARAMS]; int pr_param_size; ///< covers both params and return int pr_param_alignment; ///< covers both params and return pr_type_t pr_return_buffer[32];///< for discarded return values diff --git a/include/QF/progs/pr_comp.h b/include/QF/progs/pr_comp.h index 22d7e0dc8..98de7cae0 100644 --- a/include/QF/progs/pr_comp.h +++ b/include/QF/progs/pr_comp.h @@ -506,7 +506,7 @@ typedef struct dparmsize_s { #define DEF_SAVEGLOBAL (1<<15) -#define MAX_PARMS 8 +#define PR_MAX_PARAMS 8 typedef struct dfunction_s { pr_int_t first_statement; // negative numbers are builtins @@ -519,7 +519,7 @@ typedef struct dfunction_s { pr_string_t file; // source file defined in pr_int_t numparms; // -ve is varargs (1s comp of real count) - dparmsize_t parm_size[MAX_PARMS]; + dparmsize_t parm_size[PR_MAX_PARAMS]; } dfunction_t; typedef union pr_type_u { diff --git a/libs/gamecode/pr_debug.c b/libs/gamecode/pr_debug.c index 0a3d00e8b..a30aa8c66 100644 --- a/libs/gamecode/pr_debug.c +++ b/libs/gamecode/pr_debug.c @@ -1612,7 +1612,7 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents) opchar = fmt[3]; parm_ind = fmt[2] - '0'; fmt++; // P has one extra item - if (parm_ind >= MAX_PARMS) + if (parm_ind >= PR_MAX_PARAMS) goto err; } diff --git a/libs/gamecode/pr_exec.c b/libs/gamecode/pr_exec.c index a7389f54a..0d8424857 100644 --- a/libs/gamecode/pr_exec.c +++ b/libs/gamecode/pr_exec.c @@ -219,7 +219,7 @@ static void PR_EnterFunction (progs_t *pr, bfunction_t *f) { pr_int_t i; - pr_type_t *dstParams[MAX_PARMS]; + pr_type_t *dstParams[PR_MAX_PARAMS]; pr_ptr_t paramofs = 0; if (pr->pr_trace && !pr->debug_handler) { @@ -263,7 +263,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f) } dparmsize_t parmsize = { pr->pr_param_size, pr->pr_param_alignment }; paramofs = align_offset (paramofs, parmsize ); - if (i < MAX_PARMS) { + if (i < PR_MAX_PARAMS) { dstParams[i] = pr->pr_globals + paramofs; } for (; i < pr->pr_argc; i++) { @@ -303,7 +303,7 @@ PR_EnterFunction (progs_t *pr, bfunction_t *f) copy_args = pr->pr_argc - i; argc->int_var = copy_args; argv->int_var = dstParams[i] - pr->pr_globals; - if (i < MAX_PARMS) { + if (i < PR_MAX_PARAMS) { memcpy (dstParams[i], pr->pr_params[i], (copy_args * pr->pr_param_size) * sizeof (pr_type_t)); } diff --git a/libs/gamecode/pr_resolve.c b/libs/gamecode/pr_resolve.c index 299f8d2ae..992aff74e 100644 --- a/libs/gamecode/pr_resolve.c +++ b/libs/gamecode/pr_resolve.c @@ -129,7 +129,7 @@ PR_ResolveGlobals (progs_t *pr) if (!(def = PR_FindGlobal (pr, sym = ".return"))) goto error; pr->pr_return = &pr->pr_globals[def->ofs]; - for (i = 0; i < MAX_PARMS; i++) { + for (i = 0; i < PR_MAX_PARAMS; i++) { param_n[sizeof (param_str) - 2] = i + '0'; if (!(def = PR_FindGlobal (pr, sym = param_n))) goto error; diff --git a/libs/gamecode/pr_v6p_opcode.c b/libs/gamecode/pr_v6p_opcode.c index 2e9514a93..94da01a4c 100644 --- a/libs/gamecode/pr_v6p_opcode.c +++ b/libs/gamecode/pr_v6p_opcode.c @@ -1508,7 +1508,7 @@ is_vector_parameter_store (progs_t *pr, dstatement_t *st, return 0; if (operand != st->a) return 0; - for (i = 0; i < MAX_PARMS; i++) + for (i = 0; i < PR_MAX_PARAMS; i++) if (st->b == pr->pr_params[i] - pr->pr_globals) return 1; return 0; diff --git a/libs/ruamoko/rua_obj.c b/libs/ruamoko/rua_obj.c index 092562d50..10a5e165d 100644 --- a/libs/ruamoko/rua_obj.c +++ b/libs/ruamoko/rua_obj.c @@ -1412,7 +1412,7 @@ rua_obj_msg_sendv (progs_t *pr) int count = args->count; pr_type_t *params = G_GPOINTER (pr, args->list); - if (count < 2 || count > MAX_PARMS) { + if (count < 2 || count > PR_MAX_PARAMS) { PR_RunError (pr, "bad args count in obj_msg_sendv: %d", count); } if (pr_boundscheck->int_val) { diff --git a/qw/source/sv_pr_cmds.c b/qw/source/sv_pr_cmds.c index 1431729ee..d6ecf086b 100644 --- a/qw/source/sv_pr_cmds.c +++ b/qw/source/sv_pr_cmds.c @@ -1115,7 +1115,7 @@ PF_WriteBytes (progs_t *pr) { int i, p; int count = pr->pr_argc - 1; - byte buf[MAX_PARMS]; + byte buf[PR_MAX_PARAMS]; for (i = 0; i < count; i++) { p = P_FLOAT (pr, i + 1); diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 9395d699c..c0b291789 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -2029,8 +2029,8 @@ build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params) int arg_count = 0, parm_count = 0; int i; expr_t *args = 0, **a = &args; - type_t *arg_types[MAX_PARMS]; - expr_t *arg_exprs[MAX_PARMS][2]; + type_t *arg_types[PR_MAX_PARAMS]; + expr_t *arg_exprs[PR_MAX_PARAMS][2]; int arg_expr_count = 0; expr_t *assign; expr_t *call; @@ -2042,8 +2042,8 @@ build_function_call (expr_t *fexpr, const type_t *ftype, expr_t *params) arg_count++; } - if (arg_count > MAX_PARMS) { - return error (fexpr, "more than %d parameters", MAX_PARMS); + if (arg_count > PR_MAX_PARAMS) { + return error (fexpr, "more than %d parameters", PR_MAX_PARAMS); } if (ftype->t.func.num_params < -1) { if (-arg_count > ftype->t.func.num_params + 1) { diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index a4d785d6d..ac148bf74 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -536,7 +536,7 @@ build_scope (symbol_t *fsym, symtab_t *parent) } if (args) { - while (i < MAX_PARMS) { + while (i < PR_MAX_PARAMS) { param = new_symbol_type (va (0, ".par%d", i), &type_param); initialize_def (param, 0, parameters->space, sc_param); i++; @@ -636,7 +636,7 @@ static void build_function (symbol_t *fsym) { const type_t *func_type = fsym->s.func->type; - if (func_type->t.func.num_params > MAX_PARMS) { + if (func_type->t.func.num_params > PR_MAX_PARAMS) { error (0, "too many params"); } } diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index b4cae8e08..f36a1fd20 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -710,8 +710,8 @@ method_check_params (method_t *method, expr_t *args) for (count = 0, a = args; a; a = a->next) count++; - if (count > MAX_PARMS) - return error (args, "more than %d parameters", MAX_PARMS); + if (count > PR_MAX_PARAMS) + return error (args, "more than %d parameters", PR_MAX_PARAMS); if (mtype->t.func.num_params >= 0) param_count = mtype->t.func.num_params;