4 * Copyright 2008 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
32 type_t
*type_new_function(var_list_t
*args
)
34 type_t
*t
= make_type(RPC_FC_FUNCTION
, NULL
);
35 t
->details
.function
= xmalloc(sizeof(*t
->details
.function
));
36 t
->details
.function
->args
= args
;
40 type_t
*type_new_pointer(type_t
*ref
, attr_list_t
*attrs
)
42 type_t
*t
= make_type(pointer_default
, ref
);
47 static int compute_method_indexes(type_t
*iface
)
53 idx
= compute_method_indexes(iface
->ref
);
60 LIST_FOR_EACH_ENTRY( f
, iface
->funcs
, func_t
, entry
)
61 if (! is_callas(f
->def
->attrs
))
67 void type_interface_define(type_t
*iface
, type_t
*inherit
, statement_list_t
*stmts
)
70 iface
->details
.iface
= xmalloc(sizeof(*iface
->details
.iface
));
71 iface
->funcs
= gen_function_list(stmts
);
72 iface
->details
.iface
->disp_props
= NULL
;
73 iface
->details
.iface
->disp_methods
= NULL
;
75 iface
->defined
= TRUE
;
76 check_functions(iface
);
77 compute_method_indexes(iface
);
80 void type_dispinterface_define(type_t
*iface
, var_list_t
*props
, func_list_t
*methods
)
82 iface
->ref
= find_type("IDispatch", 0);
83 if (!iface
->ref
) error_loc("IDispatch is undefined\n");
84 iface
->details
.iface
= xmalloc(sizeof(*iface
->details
.iface
));
86 iface
->details
.iface
->disp_props
= props
;
87 iface
->details
.iface
->disp_methods
= methods
;
89 iface
->defined
= TRUE
;
90 check_functions(iface
);
91 compute_method_indexes(iface
);
94 void type_dispinterface_define_from_iface(type_t
*dispiface
, type_t
*iface
)
96 type_dispinterface_define(dispiface
, iface
->details
.iface
->disp_props
,
97 iface
->details
.iface
->disp_methods
);