Sync to wine-1.1.1 (Patch 7 of 10):

- Rob Shearman <robertshearman@gmail.com> Fri, 4 Jul 2008
widl: Rename find_type_helper, find_type and find_type2 to find_type, find_type_error and find_type_error2 respectively.

svn path=/trunk/; revision=37813
This commit is contained in:
Eric Kohl 2008-12-02 20:45:09 +00:00
parent 48068dfdd4
commit 9fcfc6eb1e
2 changed files with 42 additions and 42 deletions

View file

@ -501,7 +501,8 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type);
static type_t *reg_type(type_t *type, const char *name, int t); static type_t *reg_type(type_t *type, const char *name, int t);
static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
static type_t *find_type2(char *name, int t); static type_t *find_type_or_error(const char *name, int t);
static type_t *find_type_or_error2(char *name, int t);
static type_t *get_type(unsigned char type, char *name, int t); static type_t *get_type(unsigned char type, char *name, int t);
static type_t *get_typev(unsigned char type, var_t *name, int t); static type_t *get_typev(unsigned char type, var_t *name, int t);
static int get_struct_type(var_list_t *fields); static int get_struct_type(var_list_t *fields);
@ -529,7 +530,6 @@ static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type); const char *get_attr_display_name(enum attr_type type);
static void add_explicit_handle_if_necessary(func_t *func); static void add_explicit_handle_if_necessary(func_t *func);
static type_t *find_type_helper(const char *name, int t);
static void check_def(const type_t *t); static void check_def(const type_t *t);
static statement_t *make_statement(enum statement_type type); static statement_t *make_statement(enum statement_type type);
@ -3818,7 +3818,7 @@ yyreduce:
case 253: case 253:
#line 923 "parser.y" #line 923 "parser.y"
{ (yyval.type) = find_type2((yyvsp[0].str), 0); ;} { (yyval.type) = find_type_or_error2((yyvsp[0].str), 0); ;}
break; break;
case 254: case 254:
@ -3864,7 +3864,7 @@ yyreduce:
case 258: case 258:
#line 959 "parser.y" #line 959 "parser.y"
{ (yyval.type) = (yyvsp[-7].ifinfo).interface; { (yyval.type) = (yyvsp[-7].ifinfo).interface;
(yyval.type)->ref = find_type2((yyvsp[-5].str), 0); (yyval.type)->ref = find_type_or_error2((yyvsp[-5].str), 0);
if (!(yyval.type)->ref) error_loc("base class '%s' not found in import\n", (yyvsp[-5].str)); if (!(yyval.type)->ref) error_loc("base class '%s' not found in import\n", (yyvsp[-5].str));
(yyval.type)->funcs = (yyvsp[-2].func_list); (yyval.type)->funcs = (yyvsp[-2].func_list);
compute_method_indexes((yyval.type)); compute_method_indexes((yyval.type));
@ -4065,12 +4065,12 @@ yyreduce:
case 295: case 295:
#line 1072 "parser.y" #line 1072 "parser.y"
{ (yyval.type) = duptype(find_type("void", 0), 1); ;} { (yyval.type) = duptype(find_type_or_error("void", 0), 1); ;}
break; break;
case 296: case 296:
#line 1073 "parser.y" #line 1073 "parser.y"
{ (yyval.type) = find_type((yyvsp[0].str), 0); ;} { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); ;}
break; break;
case 297: case 297:
@ -4085,7 +4085,7 @@ yyreduce:
case 299: case 299:
#line 1076 "parser.y" #line 1076 "parser.y"
{ (yyval.type) = find_type2((yyvsp[0].str), tsENUM); ;} { (yyval.type) = find_type_or_error2((yyvsp[0].str), tsENUM); ;}
break; break;
case 300: case 300:
@ -4105,7 +4105,7 @@ yyreduce:
case 303: case 303:
#line 1080 "parser.y" #line 1080 "parser.y"
{ (yyval.type) = find_type2((yyvsp[0].str), tsUNION); ;} { (yyval.type) = find_type_or_error2((yyvsp[0].str), tsUNION); ;}
break; break;
case 304: case 304:
@ -4443,14 +4443,14 @@ static void decl_builtin(const char *name, unsigned char type)
static type_t *make_builtin(char *name) static type_t *make_builtin(char *name)
{ {
/* NAME is strdup'd in the lexer */ /* NAME is strdup'd in the lexer */
type_t *t = duptype(find_type(name, 0), 0); type_t *t = duptype(find_type_or_error(name, 0), 0);
t->name = name; t->name = name;
return t; return t;
} }
static type_t *make_int(int sign) static type_t *make_int(int sign)
{ {
type_t *t = duptype(find_type("int", 0), 1); type_t *t = duptype(find_type_or_error("int", 0), 1);
t->sign = sign; t->sign = sign;
if (sign < 0) if (sign < 0)
@ -5076,7 +5076,7 @@ static type_t *make_class(char *name)
static type_t *make_safearray(type_t *type) static type_t *make_safearray(type_t *type)
{ {
type_t *sa = duptype(find_type("SAFEARRAY", 0), 1); type_t *sa = duptype(find_type_or_error("SAFEARRAY", 0), 1);
sa->ref = type; sa->ref = type;
return make_type(pointer_default, sa); return make_type(pointer_default, sa);
} }
@ -5210,7 +5210,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
if (name->name) { if (name->name) {
type_t *cur; type_t *cur;
cur = find_type_helper(name->name, 0); cur = find_type(name->name, 0);
if (cur) if (cur)
error_loc("%s: redefinition error; original definition was at %s:%d\n", error_loc("%s: redefinition error; original definition was at %s:%d\n",
cur->name, cur->loc_info.input_name, cur->name, cur->loc_info.input_name,
@ -5230,7 +5230,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
return type; return type;
} }
static type_t *find_type_helper(const char *name, int t) type_t *find_type(const char *name, int t)
{ {
struct rtype *cur = type_hash[hash_ident(name)]; struct rtype *cur = type_hash[hash_ident(name)];
while (cur && (cur->t != t || strcmp(cur->name, name))) while (cur && (cur->t != t || strcmp(cur->name, name)))
@ -5238,9 +5238,9 @@ static type_t *find_type_helper(const char *name, int t)
return cur ? cur->type : NULL; return cur ? cur->type : NULL;
} }
type_t *find_type(const char *name, int t) static type_t *find_type_or_error(const char *name, int t)
{ {
type_t *type = find_type_helper(name, t); type_t *type = find_type(name, t);
if (!type) { if (!type) {
error_loc("type '%s' not found\n", name); error_loc("type '%s' not found\n", name);
return NULL; return NULL;
@ -5248,23 +5248,23 @@ type_t *find_type(const char *name, int t)
return type; return type;
} }
static type_t *find_type2(char *name, int t) static type_t *find_type_or_error2(char *name, int t)
{ {
type_t *tp = find_type(name, t); type_t *tp = find_type_or_error(name, t);
free(name); free(name);
return tp; return tp;
} }
int is_type(const char *name) int is_type(const char *name)
{ {
return find_type_helper(name, 0) != NULL; return find_type(name, 0) != NULL;
} }
static type_t *get_type(unsigned char type, char *name, int t) static type_t *get_type(unsigned char type, char *name, int t)
{ {
type_t *tp; type_t *tp;
if (name) { if (name) {
tp = find_type_helper(name, t); tp = find_type(name, t);
if (tp) { if (tp) {
free(name); free(name);
return tp; return tp;
@ -6020,7 +6020,7 @@ static void add_explicit_handle_if_necessary(func_t *func)
* function */ * function */
var_t *idl_handle = make_var(xstrdup("IDL_handle")); var_t *idl_handle = make_var(xstrdup("IDL_handle"));
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN)); idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
idl_handle->type = find_type("handle_t", 0); idl_handle->type = find_type_or_error("handle_t", 0);
if (!func->def->type->fields_or_args) if (!func->def->type->fields_or_args)
{ {
func->def->type->fields_or_args = xmalloc( sizeof(*func->def->type->fields_or_args) ); func->def->type->fields_or_args = xmalloc( sizeof(*func->def->type->fields_or_args) );
@ -6175,7 +6175,7 @@ static statement_t *process_typedefs(declarator_list_t *decls)
LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry ) LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
{ {
var_t *var = decl->var; var_t *var = decl->var;
type_t *type = find_type(var->name, 0); type_t *type = find_type_or_error(var->name, 0);
*type_list = xmalloc(sizeof(type_list_t)); *type_list = xmalloc(sizeof(type_list_t));
(*type_list)->type = type; (*type_list)->type = type;
(*type_list)->next = NULL; (*type_list)->next = NULL;

View file

@ -128,7 +128,8 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type);
static type_t *reg_type(type_t *type, const char *name, int t); static type_t *reg_type(type_t *type, const char *name, int t);
static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
static type_t *find_type2(char *name, int t); static type_t *find_type_or_error(const char *name, int t);
static type_t *find_type_or_error2(char *name, int t);
static type_t *get_type(unsigned char type, char *name, int t); static type_t *get_type(unsigned char type, char *name, int t);
static type_t *get_typev(unsigned char type, var_t *name, int t); static type_t *get_typev(unsigned char type, var_t *name, int t);
static int get_struct_type(var_list_t *fields); static int get_struct_type(var_list_t *fields);
@ -156,7 +157,6 @@ static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type); const char *get_attr_display_name(enum attr_type type);
static void add_explicit_handle_if_necessary(func_t *func); static void add_explicit_handle_if_necessary(func_t *func);
static type_t *find_type_helper(const char *name, int t);
static void check_def(const type_t *t); static void check_def(const type_t *t);
static statement_t *make_statement(enum statement_type type); static statement_t *make_statement(enum statement_type type);
@ -920,7 +920,7 @@ dispinterfacedef: dispinterfacehdr '{'
; ;
inherit: { $$ = NULL; } inherit: { $$ = NULL; }
| ':' aKNOWNTYPE { $$ = find_type2($2, 0); } | ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); }
; ;
interface: tINTERFACE aIDENTIFIER { $$ = get_type(RPC_FC_IP, $2, 0); $$->kind = TKIND_INTERFACE; } interface: tINTERFACE aIDENTIFIER { $$ = get_type(RPC_FC_IP, $2, 0); $$->kind = TKIND_INTERFACE; }
@ -957,7 +957,7 @@ interfacedef: interfacehdr inherit
| interfacehdr ':' aIDENTIFIER | interfacehdr ':' aIDENTIFIER
'{' import int_statements '}' '{' import int_statements '}'
semicolon_opt { $$ = $1.interface; semicolon_opt { $$ = $1.interface;
$$->ref = find_type2($3, 0); $$->ref = find_type_or_error2($3, 0);
if (!$$->ref) error_loc("base class '%s' not found in import\n", $3); if (!$$->ref) error_loc("base class '%s' not found in import\n", $3);
$$->funcs = $6; $$->funcs = $6;
compute_method_indexes($$); compute_method_indexes($$);
@ -1069,15 +1069,15 @@ structdef: tSTRUCT t_ident '{' fields '}' { $$ = get_typev(RPC_FC_STRUCT, $2, ts
} }
; ;
type: tVOID { $$ = duptype(find_type("void", 0), 1); } type: tVOID { $$ = duptype(find_type_or_error("void", 0), 1); }
| aKNOWNTYPE { $$ = find_type($1, 0); } | aKNOWNTYPE { $$ = find_type_or_error($1, 0); }
| base_type { $$ = $1; } | base_type { $$ = $1; }
| enumdef { $$ = $1; } | enumdef { $$ = $1; }
| tENUM aIDENTIFIER { $$ = find_type2($2, tsENUM); } | tENUM aIDENTIFIER { $$ = find_type_or_error2($2, tsENUM); }
| structdef { $$ = $1; } | structdef { $$ = $1; }
| tSTRUCT aIDENTIFIER { $$ = get_type(RPC_FC_STRUCT, $2, tsSTRUCT); } | tSTRUCT aIDENTIFIER { $$ = get_type(RPC_FC_STRUCT, $2, tsSTRUCT); }
| uniondef { $$ = $1; } | uniondef { $$ = $1; }
| tUNION aIDENTIFIER { $$ = find_type2($2, tsUNION); } | tUNION aIDENTIFIER { $$ = find_type_or_error2($2, tsUNION); }
| tSAFEARRAY '(' type ')' { $$ = make_safearray($3); } | tSAFEARRAY '(' type ')' { $$ = make_safearray($3); }
; ;
@ -1128,14 +1128,14 @@ static void decl_builtin(const char *name, unsigned char type)
static type_t *make_builtin(char *name) static type_t *make_builtin(char *name)
{ {
/* NAME is strdup'd in the lexer */ /* NAME is strdup'd in the lexer */
type_t *t = duptype(find_type(name, 0), 0); type_t *t = duptype(find_type_or_error(name, 0), 0);
t->name = name; t->name = name;
return t; return t;
} }
static type_t *make_int(int sign) static type_t *make_int(int sign)
{ {
type_t *t = duptype(find_type("int", 0), 1); type_t *t = duptype(find_type_or_error("int", 0), 1);
t->sign = sign; t->sign = sign;
if (sign < 0) if (sign < 0)
@ -1761,7 +1761,7 @@ static type_t *make_class(char *name)
static type_t *make_safearray(type_t *type) static type_t *make_safearray(type_t *type)
{ {
type_t *sa = duptype(find_type("SAFEARRAY", 0), 1); type_t *sa = duptype(find_type_or_error("SAFEARRAY", 0), 1);
sa->ref = type; sa->ref = type;
return make_type(pointer_default, sa); return make_type(pointer_default, sa);
} }
@ -1895,7 +1895,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
if (name->name) { if (name->name) {
type_t *cur; type_t *cur;
cur = find_type_helper(name->name, 0); cur = find_type(name->name, 0);
if (cur) if (cur)
error_loc("%s: redefinition error; original definition was at %s:%d\n", error_loc("%s: redefinition error; original definition was at %s:%d\n",
cur->name, cur->loc_info.input_name, cur->name, cur->loc_info.input_name,
@ -1915,7 +1915,7 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
return type; return type;
} }
static type_t *find_type_helper(const char *name, int t) type_t *find_type(const char *name, int t)
{ {
struct rtype *cur = type_hash[hash_ident(name)]; struct rtype *cur = type_hash[hash_ident(name)];
while (cur && (cur->t != t || strcmp(cur->name, name))) while (cur && (cur->t != t || strcmp(cur->name, name)))
@ -1923,9 +1923,9 @@ static type_t *find_type_helper(const char *name, int t)
return cur ? cur->type : NULL; return cur ? cur->type : NULL;
} }
type_t *find_type(const char *name, int t) static type_t *find_type_or_error(const char *name, int t)
{ {
type_t *type = find_type_helper(name, t); type_t *type = find_type(name, t);
if (!type) { if (!type) {
error_loc("type '%s' not found\n", name); error_loc("type '%s' not found\n", name);
return NULL; return NULL;
@ -1933,23 +1933,23 @@ type_t *find_type(const char *name, int t)
return type; return type;
} }
static type_t *find_type2(char *name, int t) static type_t *find_type_or_error2(char *name, int t)
{ {
type_t *tp = find_type(name, t); type_t *tp = find_type_or_error(name, t);
free(name); free(name);
return tp; return tp;
} }
int is_type(const char *name) int is_type(const char *name)
{ {
return find_type_helper(name, 0) != NULL; return find_type(name, 0) != NULL;
} }
static type_t *get_type(unsigned char type, char *name, int t) static type_t *get_type(unsigned char type, char *name, int t)
{ {
type_t *tp; type_t *tp;
if (name) { if (name) {
tp = find_type_helper(name, t); tp = find_type(name, t);
if (tp) { if (tp) {
free(name); free(name);
return tp; return tp;
@ -2705,7 +2705,7 @@ static void add_explicit_handle_if_necessary(func_t *func)
* function */ * function */
var_t *idl_handle = make_var(xstrdup("IDL_handle")); var_t *idl_handle = make_var(xstrdup("IDL_handle"));
idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN)); idl_handle->attrs = append_attr(NULL, make_attr(ATTR_IN));
idl_handle->type = find_type("handle_t", 0); idl_handle->type = find_type_or_error("handle_t", 0);
if (!func->def->type->fields_or_args) if (!func->def->type->fields_or_args)
{ {
func->def->type->fields_or_args = xmalloc( sizeof(*func->def->type->fields_or_args) ); func->def->type->fields_or_args = xmalloc( sizeof(*func->def->type->fields_or_args) );
@ -2860,7 +2860,7 @@ static statement_t *process_typedefs(declarator_list_t *decls)
LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry ) LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
{ {
var_t *var = decl->var; var_t *var = decl->var;
type_t *type = find_type(var->name, 0); type_t *type = find_type_or_error(var->name, 0);
*type_list = xmalloc(sizeof(type_list_t)); *type_list = xmalloc(sizeof(type_list_t));
(*type_list)->type = type; (*type_list)->type = type;
(*type_list)->next = NULL; (*type_list)->next = NULL;