2002-05-08 21:24:24 +00:00
|
|
|
/*
|
2002-10-22 14:53:18 +00:00
|
|
|
method.h
|
2002-05-08 21:24:24 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
QC method support code
|
2002-05-08 21:24:24 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
Copyright (C) 2002 Bill Currie <bill@taniwha.org>
|
2002-05-08 21:24:24 +00:00
|
|
|
|
2002-10-22 14:53:18 +00:00
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2002/05/08
|
2002-05-08 21:24:24 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __method_h
|
|
|
|
#define __method_h
|
|
|
|
|
|
|
|
#include "function.h"
|
|
|
|
|
|
|
|
typedef struct method_s {
|
|
|
|
struct method_s *next;
|
|
|
|
int instance;
|
|
|
|
param_t *selector;
|
|
|
|
param_t *params;
|
2002-06-04 18:44:03 +00:00
|
|
|
struct type_s *type;
|
|
|
|
struct def_s *def;
|
2002-06-21 20:46:56 +00:00
|
|
|
struct function_s *func;
|
2002-05-16 20:20:23 +00:00
|
|
|
char *name;
|
|
|
|
char *types;
|
2002-05-08 21:24:24 +00:00
|
|
|
} method_t;
|
|
|
|
|
2003-08-23 06:15:19 +00:00
|
|
|
typedef struct selector_s {
|
|
|
|
const char *name;
|
|
|
|
const char *types;
|
|
|
|
int index;
|
|
|
|
} selector_t;
|
|
|
|
|
2002-05-10 00:00:23 +00:00
|
|
|
typedef struct methodlist_s {
|
2002-05-08 21:24:24 +00:00
|
|
|
method_t *head;
|
|
|
|
method_t **tail;
|
2012-12-04 03:48:52 +00:00
|
|
|
int count; ///< used only for emitting
|
2011-01-24 06:41:43 +00:00
|
|
|
int instance; ///< used only for emitting
|
2002-05-08 21:24:24 +00:00
|
|
|
} methodlist_t;
|
|
|
|
|
2002-05-08 23:12:49 +00:00
|
|
|
typedef struct keywordarg_s {
|
2012-12-04 03:48:52 +00:00
|
|
|
// the first two fields match the first two fields of param_t in
|
2002-05-09 20:12:28 +00:00
|
|
|
// functionl.h
|
2002-05-08 23:12:49 +00:00
|
|
|
struct keywordarg_s *next;
|
|
|
|
const char *selector;
|
|
|
|
expr_t *expr;
|
|
|
|
} keywordarg_t;
|
|
|
|
|
2002-05-08 21:24:24 +00:00
|
|
|
struct class_s;
|
2002-05-08 23:12:49 +00:00
|
|
|
struct expr_s;
|
2002-05-09 20:12:28 +00:00
|
|
|
struct dstring_s;
|
2002-05-08 21:24:24 +00:00
|
|
|
|
2002-06-04 18:44:03 +00:00
|
|
|
method_t *new_method (struct type_s *ret_type, param_t *selector,
|
|
|
|
param_t *opt_parms);
|
2010-12-31 09:26:42 +00:00
|
|
|
const char *method_name (method_t *method);
|
2003-08-01 05:08:15 +00:00
|
|
|
method_t *copy_method (method_t *method);
|
2002-05-08 21:24:24 +00:00
|
|
|
void add_method (methodlist_t *methodlist, method_t *method);
|
2011-02-04 10:50:24 +00:00
|
|
|
struct symbol_s *method_symbol (struct class_type_s *class_type,
|
|
|
|
method_t *method);
|
2004-11-02 23:54:00 +00:00
|
|
|
void method_set_param_names (method_t *dst, method_t *src);
|
2002-05-08 21:24:24 +00:00
|
|
|
|
2002-05-10 00:00:23 +00:00
|
|
|
methodlist_t *new_methodlist (void);
|
|
|
|
void copy_methods (methodlist_t *dst, methodlist_t *src);
|
2002-05-15 23:24:19 +00:00
|
|
|
int method_compare (method_t *m1, method_t *m2);
|
2002-05-10 00:00:23 +00:00
|
|
|
|
2002-05-08 23:12:49 +00:00
|
|
|
keywordarg_t *new_keywordarg (const char *selector, struct expr_s *expr);
|
2002-08-20 02:09:34 +00:00
|
|
|
keywordarg_t *copy_keywordargs (const keywordarg_t *kwargs);
|
2002-05-08 23:12:49 +00:00
|
|
|
|
2004-02-04 04:49:46 +00:00
|
|
|
struct expr_s *send_message (int super);
|
2002-05-08 23:12:49 +00:00
|
|
|
|
2003-07-29 17:38:29 +00:00
|
|
|
method_t *find_method (const char *sel_name);
|
|
|
|
|
2002-05-09 20:12:28 +00:00
|
|
|
void selector_name (struct dstring_s *sel_id, keywordarg_t *selector);
|
2004-11-10 05:37:00 +00:00
|
|
|
void method_types (struct dstring_s *sel_types, method_t *method);
|
|
|
|
int selector_index (const char *sel_id);
|
2003-08-23 06:15:19 +00:00
|
|
|
selector_t *get_selector (struct expr_s *sel);
|
|
|
|
struct def_s *emit_selectors(void);
|
2002-05-09 20:12:28 +00:00
|
|
|
|
2002-07-13 06:09:03 +00:00
|
|
|
struct def_s *emit_methods (methodlist_t *methods, const char *name,
|
|
|
|
int instance);
|
2004-11-10 05:37:00 +00:00
|
|
|
struct def_s *emit_method_descriptions (methodlist_t *_methods,
|
|
|
|
const char *name, int instance);
|
2002-05-15 23:24:19 +00:00
|
|
|
|
2002-06-28 16:00:01 +00:00
|
|
|
void clear_selectors (void);
|
|
|
|
|
2003-08-22 05:26:47 +00:00
|
|
|
struct expr_s *method_check_params (method_t *method, struct expr_s *args);
|
|
|
|
|
2002-05-08 21:24:24 +00:00
|
|
|
#endif//__method_h
|