pr_obj.c:

call obj_find_message with super instead of class when doing a super
	lookup
client_menu.[ch]:
	use the InputLine object instead of directly using the api
InputLine.r:
	builint functions are = #0, not = 0 :P
function.[ch]:
	provide copy_params
method.[ch]
	provide copy_keywordargs
expr.c:
	call inc_users for the parm temp if it's a bind expression
	revers a copy of the selector when building the selector name so the
	selector doesn't get mangled
qc-parse.y:
	catch erronous func = const inintializers (should be func = #const)
This commit is contained in:
Bill Currie 2002-08-20 02:09:34 +00:00
parent e8a834d6a4
commit b99a72e876
10 changed files with 51 additions and 14 deletions

View file

@ -218,7 +218,7 @@ obj_msg_lookup_super (progs_t *pr, pr_id_t *receiver, pr_sel_t *op)
if (!super)
PR_RunError (pr, "%s has no super class",
PR_GetString (pr, class->name));
return obj_find_message (pr, class, op);
return obj_find_message (pr, super, op);
}
static void

View file

@ -3,6 +3,6 @@
#include "InputLine.h"
@extern inputline_t input_active;
@extern InputLine input_active;
#endif

View file

@ -304,9 +304,9 @@ string lanConfig_portname;
string lanConfig_joinname;
#define NUM_LANCONFIG_CMDS 3
integer [NUM_LANCONFIG_CMDS] lanConfig_cursor_table = { 72, 92, 124 };
inputline_t lanConfig_port_il;
inputline_t lanConfig_join_il;
inputline_t input_active;
InputLine lanConfig_port_il;
InputLine lanConfig_join_il;
InputLine input_active;
integer () join_draw =
{
@ -331,14 +331,14 @@ integer () lanconfig_draw =
Draw_String (basex + 9 * 8, 52, "127.0.0.1");
Draw_String (basex, lanConfig_cursor_table[0], "Port");
text_box (basex + 8 * 8, lanConfig_cursor_table[0] - 8, 6, 1);
InputLine_Draw (lanConfig_port_il, basex + 8 * 8, lanConfig_cursor_table[0], lanConfig_cursor == 0 && input_active);
[lanConfig_port_il draw:lanConfig_cursor == 0 && input_active];
Draw_String (basex + 9 * 8, lanConfig_cursor_table[0], lanConfig_portname);
if (JoiningGame) {
Draw_String (basex, lanConfig_cursor_table[1], "Search for local games...");
Draw_String (basex, 108, "Join game at:");
text_box (basex + 8, lanConfig_cursor_table[2] - 8, 22, 1);
InputLine_Draw (lanConfig_join_il, basex + 8, lanConfig_cursor_table[2], lanConfig_cursor == 2 && input_active);
[lanConfig_join_il draw:lanConfig_cursor == 2 && input_active];
Draw_String (basex + 16, lanConfig_cursor_table[2], lanConfig_joinname);
} else {
text_box (basex, lanConfig_cursor_table[1] - 8, 2, 1);
@ -354,7 +354,7 @@ integer () lanconfig_draw =
integer (integer key, integer unicode, integer down) lanconfig_keyevent =
{
if (input_active)
InputLine_Process (input_active, key >= 256 ? key : unicode);
[input_active processInput:(key >= 256 ? key : unicode)];
switch (key) {
case QFK_DOWN:
case QFM_WHEEL_DOWN:
@ -476,10 +476,10 @@ void () main_menu =
void () menu_init =
{
lanConfig_port_il = InputLine_Create (4, 8, ' ');
InputLine_SetWidth (lanConfig_port_il, 10);
lanConfig_join_il = InputLine_Create (4, 24, ' ');
InputLine_SetWidth (lanConfig_join_il, 26);
id (lanConfig_port_il) = [[InputLine alloc] initWithBounds:[[Rect alloc] initWithComponents:126 :lanConfig_cursor_table[0] :4 :8] promptCharacter:' '];
[lanConfig_port_il setWidth:10];
id (lanConfig_join_il) = [[InputLine alloc] initWithBounds:[[Rect alloc] initWithComponents:70 :lanConfig_cursor_table[2] :4 :24] promptCharacter:' '];
[lanConfig_join_il setWidth:26];
switch (gametype ()) {
case "netquake":
do_single_player = 1;

View file

@ -1,7 +1,7 @@
#include "InputLine.h"
inputline_t (integer lines, integer size, integer prompt) InputLine_Create = #0;
void (inputline_t il, void [] data) InputLine_SetUserData = 0;
void (inputline_t il, void [] data) InputLine_SetUserData = #0;
void (inputline_t il, integer width) InputLine_SetWidth = #0;
void (inputline_t il) InputLine_Destroy = #0;
void (inputline_t il) InputLine_Clear = #0;

View file

@ -65,6 +65,7 @@ param_t *new_param (const char *selector, struct type_s *type,
const char *name);
param_t *_reverse_params (param_t *params, param_t *next);
param_t *reverse_params (param_t *params);
param_t *copy_params (param_t *params);
struct type_s *parse_params (struct type_s *type, param_t *params);
void build_scope (function_t *f, struct def_s *func, param_t *params);
function_t *new_function (const char *name);

View file

@ -73,6 +73,7 @@ void copy_methods (methodlist_t *dst, methodlist_t *src);
int method_compare (method_t *m1, method_t *m2);
keywordarg_t *new_keywordarg (const char *selector, struct expr_s *expr);
keywordarg_t *copy_keywordargs (const keywordarg_t *kwargs);
struct expr_s *send_message (int super);

View file

@ -1688,6 +1688,9 @@ function_expr (expr_t *e1, expr_t *e2)
}
for (i = 0; i < arg_expr_count - 1; i++) {
append_expr (call, assign_expr (arg_exprs[i][1], arg_exprs[i][0]));
e = arg_exprs[i][1];
if (e->type == ex_expr && e->e.expr.op == 'b')
inc_users (e);
}
if (arg_expr_count) {
e = new_bind_expr (arg_exprs[arg_expr_count - 1][0],
@ -2108,6 +2111,8 @@ selector_expr (keywordarg_t *selector)
dstring_t *sel_id = dstring_newstr ();
dstring_t *sel_types = dstring_newstr ();
expr_t *sel;
selector = copy_keywordargs (selector);
selector = (keywordarg_t *) reverse_params ((param_t *) selector);
selector_name (sel_id, selector);
selector_types (sel_types, selector);

View file

@ -91,6 +91,19 @@ reverse_params (param_t *params)
return _reverse_params (params, 0);
}
param_t *
copy_params (param_t *params)
{
param_t *n_parms = 0, **p = &n_parms;
while (params) {
*p = new_param (params->selector, params->type, params->name);
params = params->next;
p = &(*p)->next;
}
return n_parms;
}
type_t *
parse_params (type_t *type, param_t *parms)
{

View file

@ -167,6 +167,19 @@ new_keywordarg (const char *selector, struct expr_s *expr)
return k;
}
keywordarg_t *
copy_keywordargs (const keywordarg_t *kwargs)
{
keywordarg_t *n_kwargs = 0, **kw = &n_kwargs;
while (kwargs) {
*kw = new_keywordarg (kwargs->selector, kwargs->expr);
kwargs = kwargs->next;
kw = &(*kw)->next;
}
return n_kwargs;
}
expr_t *
send_message (int super)
{

View file

@ -393,7 +393,11 @@ var_initializer
def_initialized (current_def);
} else {
if ($2->type >= ex_string) {
current_def = ReuseConstant ($2, current_def);
if (current_def->type->type == ev_func) {
PARSE_ERROR;
} else {
current_def = ReuseConstant ($2, current_def);
}
} else {
error ($2, "non-constant expression used for initializer");
}