widl: Convert variable lists to standard Wine lists.
This commit is contained in:
parent
58827d026b
commit
eed74e4e4a
@ -65,16 +65,13 @@ static void print_message_buffer_size(const func_t *func)
|
|||||||
|
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
{
|
||||||
const var_t *var = func->args;
|
const var_t *var;
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
unsigned int alignment;
|
unsigned int alignment;
|
||||||
|
|
||||||
total_size += get_required_buffer_size(var, &alignment, PASS_IN);
|
total_size += get_required_buffer_size(var, &alignment, PASS_IN);
|
||||||
total_size += alignment;
|
total_size += alignment;
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(client, " %u", total_size);
|
fprintf(client, " %u", total_size);
|
||||||
@ -82,14 +79,12 @@ static void print_message_buffer_size(const func_t *func)
|
|||||||
|
|
||||||
static void check_pointers(const func_t *func)
|
static void check_pointers(const func_t *func)
|
||||||
{
|
{
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
|
|
||||||
if (!func->args)
|
if (!func->args)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
if (is_var_ptr(var) && cant_be_null(var))
|
if (is_var_ptr(var) && cant_be_null(var))
|
||||||
{
|
{
|
||||||
@ -100,8 +95,6 @@ static void check_pointers(const func_t *func)
|
|||||||
indent--;
|
indent--;
|
||||||
print_client("}\n\n");
|
print_client("}\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +103,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
const func_t *func;
|
const func_t *func;
|
||||||
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
const char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
|
||||||
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
int method_count = 0;
|
int method_count = 0;
|
||||||
|
|
||||||
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
if (iface->funcs) LIST_FOR_EACH_ENTRY( func, iface->funcs, const func_t, entry )
|
||||||
@ -259,13 +252,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
/* update proc_offset */
|
/* update proc_offset */
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
{
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
*proc_offset += get_size_procformatstring_var(var);
|
*proc_offset += get_size_procformatstring_var(var);
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!is_void(def->type, NULL))
|
if (!is_void(def->type, NULL))
|
||||||
*proc_offset += get_size_procformatstring_var(def);
|
*proc_offset += get_size_procformatstring_var(def);
|
||||||
|
@ -164,23 +164,19 @@ static void write_field(FILE *h, var_t *v)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_fields(FILE *h, var_t *v)
|
static void write_fields(FILE *h, var_list_t *fields)
|
||||||
{
|
{
|
||||||
var_t *first = v;
|
var_t *v;
|
||||||
if (!v) return;
|
if (!fields) return;
|
||||||
while (NEXT_LINK(v)) v = NEXT_LINK(v);
|
LIST_FOR_EACH_ENTRY( v, fields, var_t, entry ) write_field(h, v);
|
||||||
while (v) {
|
|
||||||
write_field(h, v);
|
|
||||||
if (v == first) break;
|
|
||||||
v = PREV_LINK(v);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_enums(FILE *h, var_t *v)
|
static void write_enums(FILE *h, var_list_t *enums)
|
||||||
{
|
{
|
||||||
if (!v) return;
|
var_t *v;
|
||||||
while (NEXT_LINK(v)) v = NEXT_LINK(v);
|
if (!enums) return;
|
||||||
while (v) {
|
LIST_FOR_EACH_ENTRY( v, enums, var_t, entry )
|
||||||
|
{
|
||||||
if (get_name(v)) {
|
if (get_name(v)) {
|
||||||
indent(h, 0);
|
indent(h, 0);
|
||||||
write_name(h, v);
|
write_name(h, v);
|
||||||
@ -189,9 +185,7 @@ static void write_enums(FILE *h, var_t *v)
|
|||||||
write_expr(h, v->eval, 0);
|
write_expr(h, v->eval, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PREV_LINK(v))
|
if (list_next( enums, &v->entry )) fprintf(h, ",\n");
|
||||||
fprintf(h, ",\n");
|
|
||||||
v = PREV_LINK(v);
|
|
||||||
}
|
}
|
||||||
fprintf(h, "\n");
|
fprintf(h, "\n");
|
||||||
}
|
}
|
||||||
@ -292,9 +286,13 @@ static int user_type_registered(const char *name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_for_user_types(const var_t *v)
|
static void check_for_user_types(const var_list_t *list)
|
||||||
{
|
{
|
||||||
while (v) {
|
const var_t *v;
|
||||||
|
|
||||||
|
if (!list) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( v, list, const var_t, entry )
|
||||||
|
{
|
||||||
type_t *type;
|
type_t *type;
|
||||||
for (type = v->type; type; type = type->kind == TKIND_ALIAS ? type->orig : type->ref) {
|
for (type = v->type; type; type = type->kind == TKIND_ALIAS ? type->orig : type->ref) {
|
||||||
const char *name = type->name;
|
const char *name = type->name;
|
||||||
@ -312,14 +310,11 @@ static void check_for_user_types(const var_t *v)
|
|||||||
* using a wire marshaled type */
|
* using a wire marshaled type */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (type->fields)
|
else
|
||||||
{
|
{
|
||||||
const var_t *fields = type->fields;
|
check_for_user_types(type->fields);
|
||||||
while (NEXT_LINK(fields)) fields = NEXT_LINK(fields);
|
|
||||||
check_for_user_types(fields);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
v = PREV_LINK(v);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,22 +451,16 @@ const var_t* get_explicit_handle_var(const func_t* func)
|
|||||||
if (!func->args)
|
if (!func->args)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
if (var->type->type == RPC_FC_BIND_PRIMITIVE)
|
if (var->type->type == RPC_FC_BIND_PRIMITIVE)
|
||||||
return var;
|
return var;
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int has_out_arg_or_return(const func_t *func)
|
int has_out_arg_or_return(const func_t *func)
|
||||||
{
|
{
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
|
|
||||||
if (!is_void(func->def->type, NULL))
|
if (!is_void(func->def->type, NULL))
|
||||||
return 1;
|
return 1;
|
||||||
@ -479,15 +468,10 @@ int has_out_arg_or_return(const func_t *func)
|
|||||||
if (!func->args)
|
if (!func->args)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
if (is_attr(var->attrs, ATTR_OUT))
|
if (is_attr(var->attrs, ATTR_OUT))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -525,13 +509,11 @@ static void write_method_macro(const type_t *iface, const char *name)
|
|||||||
{
|
{
|
||||||
var_t *def = cur->def;
|
var_t *def = cur->def;
|
||||||
if (!is_callas(def->attrs)) {
|
if (!is_callas(def->attrs)) {
|
||||||
var_t *arg = cur->args;
|
const var_t *arg;
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
int c;
|
int c;
|
||||||
while (arg) {
|
|
||||||
arg = NEXT_LINK(arg);
|
if (cur->args) LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry ) argc++;
|
||||||
argc++;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(header, "#define %s_", name);
|
fprintf(header, "#define %s_", name);
|
||||||
write_name(header,def);
|
write_name(header,def);
|
||||||
@ -550,13 +532,11 @@ static void write_method_macro(const type_t *iface, const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent)
|
void write_args(FILE *h, const var_list_t *args, const char *name, int method, int do_indent)
|
||||||
{
|
{
|
||||||
|
const var_t *arg;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
if (arg) {
|
|
||||||
while (NEXT_LINK(arg))
|
|
||||||
arg = NEXT_LINK(arg);
|
|
||||||
}
|
|
||||||
if (do_indent)
|
if (do_indent)
|
||||||
{
|
{
|
||||||
indentation++;
|
indentation++;
|
||||||
@ -566,7 +546,7 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
|
|||||||
fprintf(h, "%s* This", name);
|
fprintf(h, "%s* This", name);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
while (arg) {
|
if (args) LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry ) {
|
||||||
if (count) {
|
if (count) {
|
||||||
if (do_indent)
|
if (do_indent)
|
||||||
{
|
{
|
||||||
@ -591,7 +571,6 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
|
|||||||
write_name(h, arg);
|
write_name(h, arg);
|
||||||
}
|
}
|
||||||
write_array(h, arg->array, 0);
|
write_array(h, arg->array, 0);
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
if (do_indent) indentation--;
|
if (do_indent) indentation--;
|
||||||
@ -664,7 +643,7 @@ static void write_method_proto(const type_t *iface)
|
|||||||
{
|
{
|
||||||
const var_t *def = cur->def;
|
const var_t *def = cur->def;
|
||||||
const var_t *cas = is_callas(def->attrs);
|
const var_t *cas = is_callas(def->attrs);
|
||||||
const var_t *args;
|
|
||||||
if (!is_local(def->attrs)) {
|
if (!is_local(def->attrs)) {
|
||||||
/* proxy prototype */
|
/* proxy prototype */
|
||||||
write_type(header, def->type, def, def->tname);
|
write_type(header, def->type, def, def->tname);
|
||||||
@ -681,13 +660,7 @@ static void write_method_proto(const type_t *iface)
|
|||||||
fprintf(header, " IRpcChannelBuffer* pRpcChannelBuffer,\n");
|
fprintf(header, " IRpcChannelBuffer* pRpcChannelBuffer,\n");
|
||||||
fprintf(header, " PRPC_MESSAGE pRpcMessage,\n");
|
fprintf(header, " PRPC_MESSAGE pRpcMessage,\n");
|
||||||
fprintf(header, " DWORD* pdwStubPhase);\n");
|
fprintf(header, " DWORD* pdwStubPhase);\n");
|
||||||
|
check_for_user_types(cur->args);
|
||||||
args = cur->args;
|
|
||||||
if (args) {
|
|
||||||
while (NEXT_LINK(args))
|
|
||||||
args = NEXT_LINK(args);
|
|
||||||
}
|
|
||||||
check_for_user_types(args);
|
|
||||||
}
|
}
|
||||||
if (cas) {
|
if (cas) {
|
||||||
const func_t *m;
|
const func_t *m;
|
||||||
|
@ -31,7 +31,7 @@ extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n);
|
|||||||
extern int is_object(const attr_list_t *list);
|
extern int is_object(const attr_list_t *list);
|
||||||
extern int is_local(const attr_list_t *list);
|
extern int is_local(const attr_list_t *list);
|
||||||
extern const var_t *is_callas(const attr_list_t *list);
|
extern const var_t *is_callas(const attr_list_t *list);
|
||||||
extern void write_args(FILE *h, var_t *arg, const char *name, int obj, int do_indent);
|
extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent);
|
||||||
extern void write_array(FILE *h, const expr_t *v, int field);
|
extern void write_array(FILE *h, const expr_t *v, int field);
|
||||||
extern void write_forward(type_t *iface);
|
extern void write_forward(type_t *iface);
|
||||||
extern void write_interface(type_t *iface);
|
extern void write_interface(type_t *iface);
|
||||||
|
@ -82,21 +82,22 @@ static type_t *type_ref(typeref_t *ref);
|
|||||||
static void set_type(var_t *v, typeref_t *ref, expr_t *arr);
|
static void set_type(var_t *v, typeref_t *ref, expr_t *arr);
|
||||||
static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface);
|
static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface);
|
||||||
static ifref_t *make_ifref(type_t *iface);
|
static ifref_t *make_ifref(type_t *iface);
|
||||||
|
static var_list_t *append_var(var_list_t *list, var_t *var);
|
||||||
static var_t *make_var(char *name);
|
static var_t *make_var(char *name);
|
||||||
static func_list_t *append_func(func_list_t *list, func_t *func);
|
static func_list_t *append_func(func_list_t *list, func_t *func);
|
||||||
static func_t *make_func(var_t *def, var_t *args);
|
static func_t *make_func(var_t *def, var_list_t *args);
|
||||||
static type_t *make_class(char *name);
|
static type_t *make_class(char *name);
|
||||||
static type_t *make_safearray(void);
|
static type_t *make_safearray(void);
|
||||||
static type_t *make_builtin(char *name);
|
static type_t *make_builtin(char *name);
|
||||||
static type_t *make_int(int sign);
|
static type_t *make_int(int sign);
|
||||||
|
|
||||||
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(type_t *type, var_t *names, attr_list_t *attrs);
|
static type_t *reg_typedefs(type_t *type, var_list_t *names, attr_list_t *attrs);
|
||||||
static type_t *find_type(const char *name, int t);
|
static type_t *find_type(const char *name, int t);
|
||||||
static type_t *find_type2(char *name, int t);
|
static type_t *find_type2(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_t *fields);
|
static int get_struct_type(var_list_t *fields);
|
||||||
|
|
||||||
static var_t *reg_const(var_t *var);
|
static var_t *reg_const(var_t *var);
|
||||||
static var_t *find_const(char *name, int f);
|
static var_t *find_const(char *name, int f);
|
||||||
@ -108,7 +109,7 @@ static void write_iid(type_t *iface);
|
|||||||
|
|
||||||
static int compute_method_indexes(type_t *iface);
|
static int compute_method_indexes(type_t *iface);
|
||||||
static char *gen_name(void);
|
static char *gen_name(void);
|
||||||
static void process_typedefs(var_t *names);
|
static void process_typedefs(var_list_t *names);
|
||||||
static void check_arg(var_t *arg);
|
static void check_arg(var_t *arg);
|
||||||
|
|
||||||
#define tsENUM 1
|
#define tsENUM 1
|
||||||
@ -123,6 +124,7 @@ static void check_arg(var_t *arg);
|
|||||||
type_t *type;
|
type_t *type;
|
||||||
typeref_t *tref;
|
typeref_t *tref;
|
||||||
var_t *var;
|
var_t *var;
|
||||||
|
var_list_t *var_list;
|
||||||
func_t *func;
|
func_t *func;
|
||||||
func_list_t *func_list;
|
func_list_t *func_list;
|
||||||
ifref_t *ifref;
|
ifref_t *ifref;
|
||||||
@ -227,10 +229,9 @@ static void check_arg(var_t *arg);
|
|||||||
%type <ifref> coclass_int
|
%type <ifref> coclass_int
|
||||||
%type <ifref_list> gbl_statements coclass_ints
|
%type <ifref_list> gbl_statements coclass_ints
|
||||||
%type <tref> type
|
%type <tref> type
|
||||||
%type <var> m_args no_args args arg
|
%type <var> arg field s_field case enum constdef externdef
|
||||||
%type <var> fields field s_field cases case enums enum_list enum constdef externdef
|
%type <var_list> m_args no_args args fields cases enums enum_list pident_list dispint_props
|
||||||
%type <var> m_ident t_ident ident p_ident pident pident_list
|
%type <var> m_ident t_ident ident p_ident pident
|
||||||
%type <var> dispint_props
|
|
||||||
%type <func> funcdef
|
%type <func> funcdef
|
||||||
%type <func_list> int_statements dispint_meths
|
%type <func_list> int_statements dispint_meths
|
||||||
%type <type> coclass coclasshdr coclassdef
|
%type <type> coclass coclasshdr coclassdef
|
||||||
@ -328,8 +329,8 @@ m_args: { $$ = NULL; }
|
|||||||
no_args: tVOID { $$ = NULL; }
|
no_args: tVOID { $$ = NULL; }
|
||||||
;
|
;
|
||||||
|
|
||||||
args: arg { check_arg($1); $$ = $1; }
|
args: arg { check_arg($1); $$ = append_var( NULL, $1 ); }
|
||||||
| args ',' arg { check_arg($3); LINK($3, $1); $$ = $3; }
|
| args ',' arg { check_arg($3); $$ = append_var( $1, $3); }
|
||||||
| no_args
|
| no_args
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -457,9 +458,7 @@ callconv:
|
|||||||
;
|
;
|
||||||
|
|
||||||
cases: { $$ = NULL; }
|
cases: { $$ = NULL; }
|
||||||
| cases case { if ($2) { LINK($2, $1); $$ = $2; }
|
| cases case { $$ = append_var( $1, $2 ); }
|
||||||
else { $$ = $1; }
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
case: tCASE expr ':' field { attr_t *a = make_attrp(ATTR_CASE, $2);
|
case: tCASE expr ':' field { attr_t *a = make_attrp(ATTR_CASE, $2);
|
||||||
@ -483,12 +482,16 @@ enums: { $$ = NULL; }
|
|||||||
| enum_list
|
| enum_list
|
||||||
;
|
;
|
||||||
|
|
||||||
enum_list: enum { if (!$$->eval)
|
enum_list: enum { if (!$1->eval)
|
||||||
$$->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */);
|
$1->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */);
|
||||||
|
$$ = append_var( NULL, $1 );
|
||||||
}
|
}
|
||||||
| enum_list ',' enum { LINK($3, $1); $$ = $3;
|
| enum_list ',' enum { if (!$3->eval)
|
||||||
if (!$$->eval)
|
{
|
||||||
$$->eval = make_exprl(EXPR_NUM, $1->eval->cval + 1);
|
var_t *last = LIST_ENTRY( list_tail($$), var_t, entry );
|
||||||
|
$3->eval = make_exprl(EXPR_NUM, last->eval->cval + 1);
|
||||||
|
}
|
||||||
|
$$ = append_var( $1, $3 );
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -566,9 +569,7 @@ externdef: tEXTERN tCONST type ident { $$ = $4;
|
|||||||
;
|
;
|
||||||
|
|
||||||
fields: { $$ = NULL; }
|
fields: { $$ = NULL; }
|
||||||
| fields field { if ($2) { LINK($2, $1); $$ = $2; }
|
| fields field { $$ = append_var( $1, $2 ); }
|
||||||
else { $$ = $1; }
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
field: s_field ';' { $$ = $1; }
|
field: s_field ';' { $$ = $1; }
|
||||||
@ -702,7 +703,7 @@ dispinterfacehdr: attributes dispinterface { attr_t *attrs;
|
|||||||
;
|
;
|
||||||
|
|
||||||
dispint_props: tPROPERTIES ':' { $$ = NULL; }
|
dispint_props: tPROPERTIES ':' { $$ = NULL; }
|
||||||
| dispint_props s_field ';' { LINK($2, $1); $$ = $2; }
|
| dispint_props s_field ';' { $$ = append_var( $1, $2 ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
dispint_meths: tMETHODS ':' { $$ = NULL; }
|
dispint_meths: tMETHODS ':' { $$ = NULL; }
|
||||||
@ -795,8 +796,8 @@ pident: ident
|
|||||||
;
|
;
|
||||||
|
|
||||||
pident_list:
|
pident_list:
|
||||||
pident
|
pident { $$ = append_var( NULL, $1 ); }
|
||||||
| pident_list ',' pident { LINK($3, $1); $$ = $3; }
|
| pident_list ',' pident { $$ = append_var( $1, $3 ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
pointer_type:
|
pointer_type:
|
||||||
@ -849,7 +850,8 @@ uniondef: tUNION t_ident '{' fields '}' { $$ = get_typev(RPC_FC_NON_ENCAPSULATE
|
|||||||
u->type->kind = TKIND_UNION;
|
u->type->kind = TKIND_UNION;
|
||||||
u->type->fields = $9;
|
u->type->fields = $9;
|
||||||
u->type->defined = TRUE;
|
u->type->defined = TRUE;
|
||||||
LINK(u, $5); $$->fields = u;
|
$$->fields = append_var( $$->fields, $5 );
|
||||||
|
$$->fields = append_var( $$->fields, u );
|
||||||
$$->defined = TRUE;
|
$$->defined = TRUE;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@ -1225,6 +1227,18 @@ static ifref_t *make_ifref(type_t *iface)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static var_list_t *append_var(var_list_t *list, var_t *var)
|
||||||
|
{
|
||||||
|
if (!var) return list;
|
||||||
|
if (!list)
|
||||||
|
{
|
||||||
|
list = xmalloc( sizeof(*list) );
|
||||||
|
list_init( list );
|
||||||
|
}
|
||||||
|
list_add_tail( list, &var->entry );
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
static var_t *make_var(char *name)
|
static var_t *make_var(char *name)
|
||||||
{
|
{
|
||||||
var_t *v = xmalloc(sizeof(var_t));
|
var_t *v = xmalloc(sizeof(var_t));
|
||||||
@ -1236,7 +1250,6 @@ static var_t *make_var(char *name)
|
|||||||
v->attrs = NULL;
|
v->attrs = NULL;
|
||||||
v->array = NULL;
|
v->array = NULL;
|
||||||
v->eval = NULL;
|
v->eval = NULL;
|
||||||
INIT_LINK(v);
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1252,7 +1265,7 @@ static func_list_t *append_func(func_list_t *list, func_t *func)
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static func_t *make_func(var_t *def, var_t *args)
|
static func_t *make_func(var_t *def, var_list_t *args)
|
||||||
{
|
{
|
||||||
func_t *f = xmalloc(sizeof(func_t));
|
func_t *f = xmalloc(sizeof(func_t));
|
||||||
f->def = def;
|
f->def = def;
|
||||||
@ -1319,9 +1332,10 @@ static type_t *reg_type(type_t *type, const char *name, int t)
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static type_t *reg_typedefs(type_t *type, var_t *names, attr_list_t *attrs)
|
static type_t *reg_typedefs(type_t *type, var_list_t *names, attr_list_t *attrs)
|
||||||
{
|
{
|
||||||
type_t *ptr = type;
|
type_t *ptr = type;
|
||||||
|
const var_t *name;
|
||||||
int ptrc = 0;
|
int ptrc = 0;
|
||||||
int is_str = is_attr(attrs, ATTR_STRING);
|
int is_str = is_attr(attrs, ATTR_STRING);
|
||||||
unsigned char ptr_type = get_attrv(attrs, ATTR_POINTERTYPE);
|
unsigned char ptr_type = get_attrv(attrs, ATTR_POINTERTYPE);
|
||||||
@ -1336,8 +1350,11 @@ static type_t *reg_typedefs(type_t *type, var_t *names, attr_list_t *attrs)
|
|||||||
|
|
||||||
c = t->type;
|
c = t->type;
|
||||||
if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR)
|
if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR)
|
||||||
|
{
|
||||||
|
name = LIST_ENTRY( list_head( names ), const var_t, entry );
|
||||||
yyerror("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays",
|
yyerror("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays",
|
||||||
names->name);
|
name->name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We must generate names for tagless enum, struct or union.
|
/* We must generate names for tagless enum, struct or union.
|
||||||
@ -1352,11 +1369,11 @@ static type_t *reg_typedefs(type_t *type, var_t *names, attr_list_t *attrs)
|
|||||||
type->name = gen_name();
|
type->name = gen_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (names) {
|
LIST_FOR_EACH_ENTRY( name, names, const var_t, entry )
|
||||||
var_t *next = NEXT_LINK(names);
|
{
|
||||||
if (names->name) {
|
if (name->name) {
|
||||||
type_t *cur = ptr;
|
type_t *cur = ptr;
|
||||||
int cptr = names->ptr_level;
|
int cptr = name->ptr_level;
|
||||||
if (cptr > ptrc) {
|
if (cptr > ptrc) {
|
||||||
while (cptr > ptrc) {
|
while (cptr > ptrc) {
|
||||||
cur = ptr = make_type(RPC_FC_RP, cur);
|
cur = ptr = make_type(RPC_FC_RP, cur);
|
||||||
@ -1368,7 +1385,7 @@ static type_t *reg_typedefs(type_t *type, var_t *names, attr_list_t *attrs)
|
|||||||
cptr++;
|
cptr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur = alias(cur, names->name);
|
cur = alias(cur, name->name);
|
||||||
cur->attrs = attrs;
|
cur->attrs = attrs;
|
||||||
if (ptr_type)
|
if (ptr_type)
|
||||||
{
|
{
|
||||||
@ -1384,7 +1401,6 @@ static type_t *reg_typedefs(type_t *type, var_t *names, attr_list_t *attrs)
|
|||||||
|
|
||||||
reg_type(cur, cur->name, 0);
|
reg_type(cur, cur->name, 0);
|
||||||
}
|
}
|
||||||
names = next;
|
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
@ -1446,13 +1462,14 @@ static type_t *get_typev(unsigned char type, var_t *name, int t)
|
|||||||
return get_type(type, sname, t);
|
return get_type(type, sname, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_struct_type(var_t *field)
|
static int get_struct_type(var_list_t *fields)
|
||||||
{
|
{
|
||||||
int has_pointer = 0;
|
int has_pointer = 0;
|
||||||
int has_conformance = 0;
|
int has_conformance = 0;
|
||||||
int has_variance = 0;
|
int has_variance = 0;
|
||||||
|
var_t *field;
|
||||||
|
|
||||||
for (; field; field = NEXT_LINK(field))
|
if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry )
|
||||||
{
|
{
|
||||||
type_t *t = field->type;
|
type_t *t = field->type;
|
||||||
|
|
||||||
@ -1474,7 +1491,7 @@ static int get_struct_type(var_t *field)
|
|||||||
if (field->array && !field->array->is_const)
|
if (field->array && !field->array->is_const)
|
||||||
{
|
{
|
||||||
has_conformance = 1;
|
has_conformance = 1;
|
||||||
if (PREV_LINK(field))
|
if (list_next( fields, &field->entry ))
|
||||||
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
||||||
field->name);
|
field->name);
|
||||||
}
|
}
|
||||||
@ -1518,7 +1535,7 @@ static int get_struct_type(var_t *field)
|
|||||||
break;
|
break;
|
||||||
case RPC_FC_CARRAY:
|
case RPC_FC_CARRAY:
|
||||||
has_conformance = 1;
|
has_conformance = 1;
|
||||||
if (PREV_LINK(field))
|
if (list_next( fields, &field->entry ))
|
||||||
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
||||||
field->name);
|
field->name);
|
||||||
break;
|
break;
|
||||||
@ -1535,7 +1552,7 @@ static int get_struct_type(var_t *field)
|
|||||||
|
|
||||||
case RPC_FC_CPSTRUCT:
|
case RPC_FC_CPSTRUCT:
|
||||||
has_conformance = 1;
|
has_conformance = 1;
|
||||||
if (PREV_LINK(field))
|
if (list_next( fields, &field->entry ))
|
||||||
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
||||||
field->name);
|
field->name);
|
||||||
has_pointer = 1;
|
has_pointer = 1;
|
||||||
@ -1543,7 +1560,7 @@ static int get_struct_type(var_t *field)
|
|||||||
|
|
||||||
case RPC_FC_CSTRUCT:
|
case RPC_FC_CSTRUCT:
|
||||||
has_conformance = 1;
|
has_conformance = 1;
|
||||||
if (PREV_LINK(field))
|
if (list_next( fields, &field->entry ))
|
||||||
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
yyerror("field '%s' deriving from a conformant array must be the last field in the structure",
|
||||||
field->name);
|
field->name);
|
||||||
break;
|
break;
|
||||||
@ -1689,21 +1706,21 @@ static char *gen_name(void)
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_typedefs(var_t *names)
|
static void process_typedefs(var_list_t *names)
|
||||||
{
|
{
|
||||||
END_OF_LIST(names);
|
var_t *name, *next;
|
||||||
while (names)
|
|
||||||
|
if (!names) return;
|
||||||
|
LIST_FOR_EACH_ENTRY_SAFE( name, next, names, var_t, entry )
|
||||||
{
|
{
|
||||||
var_t *next = PREV_LINK(names);
|
type_t *type = find_type(name->name, 0);
|
||||||
type_t *type = find_type(names->name, 0);
|
|
||||||
|
|
||||||
if (! parse_only && do_header)
|
if (! parse_only && do_header)
|
||||||
write_typedef(type);
|
write_typedef(type);
|
||||||
if (in_typelib && type->attrs)
|
if (in_typelib && type->attrs)
|
||||||
add_typelib_entry(type);
|
add_typelib_entry(type);
|
||||||
|
|
||||||
free(names);
|
free(name);
|
||||||
names = next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,26 +106,28 @@ static void init_proxy(ifref_list_t *ifaces)
|
|||||||
write_stubdescproto();
|
write_stubdescproto();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_output_vars( var_t *arg )
|
static void clear_output_vars( const var_list_t *args )
|
||||||
{
|
{
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
if (is_attr(arg->attrs, ATTR_OUT) && !is_attr(arg->attrs, ATTR_IN)) {
|
if (is_attr(arg->attrs, ATTR_OUT) && !is_attr(arg->attrs, ATTR_IN)) {
|
||||||
print_proxy( "if(%s)\n", arg->name );
|
print_proxy( "if(%s)\n", arg->name );
|
||||||
indent++;
|
indent++;
|
||||||
print_proxy( "MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name );
|
print_proxy( "MIDL_memset( %s, 0, sizeof( *%s ));\n", arg->name, arg->name );
|
||||||
indent--;
|
indent--;
|
||||||
}
|
}
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int is_var_ptr(var_t *v)
|
int is_var_ptr(const var_t *v)
|
||||||
{
|
{
|
||||||
return v->ptr_level || is_ptr(v->type);
|
return v->ptr_level || is_ptr(v->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cant_be_null(var_t *v)
|
int cant_be_null(const var_t *v)
|
||||||
{
|
{
|
||||||
/* Search backwards for the most recent pointer attribute. */
|
/* Search backwards for the most recent pointer attribute. */
|
||||||
const attr_list_t *attrs = v->attrs;
|
const attr_list_t *attrs = v->attrs;
|
||||||
@ -159,7 +161,7 @@ int cant_be_null(var_t *v)
|
|||||||
return 1; /* Default is RPC_FC_RP. */
|
return 1; /* Default is RPC_FC_RP. */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_user_derived(var_t *v)
|
static int is_user_derived(const var_t *v)
|
||||||
{
|
{
|
||||||
const attr_list_t *attrs = v->attrs;
|
const attr_list_t *attrs = v->attrs;
|
||||||
const type_t *type = v->type;
|
const type_t *type = v->type;
|
||||||
@ -187,21 +189,23 @@ static int is_user_derived(var_t *v)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void proxy_check_pointers( var_t *arg )
|
static void proxy_check_pointers( const var_list_t *args )
|
||||||
{
|
{
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
if (is_var_ptr(arg) && cant_be_null(arg)) {
|
if (is_var_ptr(arg) && cant_be_null(arg)) {
|
||||||
print_proxy( "if(!%s)\n", arg->name );
|
print_proxy( "if(!%s)\n", arg->name );
|
||||||
indent++;
|
indent++;
|
||||||
print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
|
print_proxy( "RpcRaiseException(RPC_X_NULL_REF_POINTER);\n");
|
||||||
indent--;
|
indent--;
|
||||||
}
|
}
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void marshall_size_arg( var_t *arg )
|
static void marshall_size_arg( const var_t *arg )
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
const type_t *type = arg->type;
|
const type_t *type = arg->type;
|
||||||
@ -289,22 +293,23 @@ static void marshall_size_arg( var_t *arg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void proxy_gen_marshall_size( var_t *arg )
|
static void proxy_gen_marshall_size( const var_list_t *args )
|
||||||
{
|
{
|
||||||
print_proxy( "_StubMsg.BufferLength = 0U;\n" );
|
const var_t *arg;
|
||||||
|
|
||||||
END_OF_LIST(arg);
|
print_proxy( "_StubMsg.BufferLength = 0U;\n" );
|
||||||
while (arg) {
|
if (!args) return;
|
||||||
if (is_attr(arg->attrs, ATTR_IN))
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
|
if (is_attr(arg->attrs, ATTR_IN))
|
||||||
{
|
{
|
||||||
marshall_size_arg( arg );
|
marshall_size_arg( arg );
|
||||||
fprintf(proxy, "\n");
|
fprintf(proxy, "\n");
|
||||||
}
|
}
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void marshall_copy_arg( var_t *arg )
|
static void marshall_copy_arg( const var_t *arg )
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
type_t *type = arg->type;
|
type_t *type = arg->type;
|
||||||
@ -390,34 +395,36 @@ static void marshall_copy_arg( var_t *arg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_marshall_copydata( var_t *arg )
|
static void gen_marshall_copydata( const var_list_t *args )
|
||||||
{
|
{
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
if (is_attr(arg->attrs, ATTR_IN))
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
|
if (is_attr(arg->attrs, ATTR_IN))
|
||||||
{
|
{
|
||||||
marshall_copy_arg( arg );
|
marshall_copy_arg( arg );
|
||||||
fprintf(proxy, "\n");
|
fprintf(proxy, "\n");
|
||||||
}
|
}
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_marshall( var_t *arg )
|
static void gen_marshall( const var_list_t *args )
|
||||||
{
|
{
|
||||||
/* generated code to determine the size of the buffer required */
|
/* generated code to determine the size of the buffer required */
|
||||||
proxy_gen_marshall_size( arg );
|
proxy_gen_marshall_size( args );
|
||||||
|
|
||||||
/* generated code to allocate the buffer */
|
/* generated code to allocate the buffer */
|
||||||
print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
|
print_proxy( "NdrProxyGetBuffer(This, &_StubMsg);\n" );
|
||||||
|
|
||||||
/* generated code to copy the args into the buffer */
|
/* generated code to copy the args into the buffer */
|
||||||
gen_marshall_copydata( arg );
|
gen_marshall_copydata( args );
|
||||||
|
|
||||||
print_proxy( "\n");
|
print_proxy( "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unmarshall_copy_arg( var_t *arg )
|
static void unmarshall_copy_arg( const var_t *arg )
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
type_t *type = arg->type;
|
type_t *type = arg->type;
|
||||||
@ -501,20 +508,22 @@ static void unmarshall_copy_arg( var_t *arg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gen_unmarshall( var_t *arg )
|
static void gen_unmarshall( var_list_t *args )
|
||||||
{
|
{
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
if (is_attr(arg->attrs, ATTR_OUT))
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
|
if (is_attr(arg->attrs, ATTR_OUT))
|
||||||
{
|
{
|
||||||
unmarshall_copy_arg( arg );
|
unmarshall_copy_arg( arg );
|
||||||
fprintf(proxy, "\n");
|
fprintf(proxy, "\n");
|
||||||
}
|
}
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_variable( var_t *arg )
|
static void free_variable( const var_t *arg )
|
||||||
{
|
{
|
||||||
var_t *constraint;
|
var_t *constraint;
|
||||||
int index = 0; /* FIXME */
|
int index = 0; /* FIXME */
|
||||||
@ -563,16 +572,18 @@ static void free_variable( var_t *arg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void proxy_free_variables( var_t *arg )
|
static void proxy_free_variables( var_list_t *args )
|
||||||
{
|
{
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
if (is_attr(arg->attrs, ATTR_OUT))
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
|
if (is_attr(arg->attrs, ATTR_OUT))
|
||||||
{
|
{
|
||||||
free_variable( arg );
|
free_variable( arg );
|
||||||
fprintf(proxy, "\n");
|
fprintf(proxy, "\n");
|
||||||
}
|
}
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,11 +681,14 @@ static void gen_proxy(type_t *iface, const func_t *cur, int idx)
|
|||||||
print_proxy( "\n");
|
print_proxy( "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stub_write_locals( var_t *arg )
|
static void stub_write_locals( var_list_t *args )
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
int outptr = is_attr(arg->attrs, ATTR_OUT)
|
int outptr = is_attr(arg->attrs, ATTR_OUT)
|
||||||
&& ! is_attr(arg->attrs, ATTR_IN);
|
&& ! is_attr(arg->attrs, ATTR_IN);
|
||||||
|
|
||||||
@ -692,15 +706,17 @@ static void stub_write_locals( var_t *arg )
|
|||||||
fprintf(proxy, " ");
|
fprintf(proxy, " ");
|
||||||
write_name(proxy, arg);
|
write_name(proxy, arg);
|
||||||
fprintf(proxy, ";\n");
|
fprintf(proxy, ";\n");
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stub_unmarshall( var_t *arg )
|
static void stub_unmarshall( const var_list_t *args )
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
|
{
|
||||||
if (is_attr(arg->attrs, ATTR_IN))
|
if (is_attr(arg->attrs, ATTR_IN))
|
||||||
{
|
{
|
||||||
unmarshall_copy_arg( arg );
|
unmarshall_copy_arg( arg );
|
||||||
@ -726,33 +742,32 @@ static void stub_unmarshall( var_t *arg )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stub_gen_marshall_size( var_t *arg )
|
static void stub_gen_marshall_size( const var_list_t *args )
|
||||||
{
|
{
|
||||||
|
const var_t *arg;
|
||||||
|
|
||||||
print_proxy( "_StubMsg.BufferLength = 0U;\n" );
|
print_proxy( "_StubMsg.BufferLength = 0U;\n" );
|
||||||
|
|
||||||
END_OF_LIST(arg);
|
if (!args) return;
|
||||||
while (arg) {
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
if (is_attr(arg->attrs, ATTR_OUT))
|
if (is_attr(arg->attrs, ATTR_OUT))
|
||||||
marshall_size_arg( arg );
|
marshall_size_arg( arg );
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stub_gen_marshall_copydata( var_t *arg )
|
static void stub_gen_marshall_copydata( const var_list_t *args )
|
||||||
{
|
{
|
||||||
END_OF_LIST(arg);
|
const var_t *arg;
|
||||||
while (arg) {
|
|
||||||
|
if (!args) return;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, args, const var_t, entry )
|
||||||
if (is_attr(arg->attrs, ATTR_OUT))
|
if (is_attr(arg->attrs, ATTR_OUT))
|
||||||
marshall_copy_arg( arg );
|
marshall_copy_arg( arg );
|
||||||
arg = PREV_LINK(arg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stub_genmarshall( var_t *args )
|
static void stub_genmarshall( const var_list_t *args )
|
||||||
{
|
{
|
||||||
/* FIXME: size buffer */
|
/* FIXME: size buffer */
|
||||||
stub_gen_marshall_size( args );
|
stub_gen_marshall_size( args );
|
||||||
@ -765,7 +780,7 @@ static void stub_genmarshall( var_t *args )
|
|||||||
static void gen_stub(type_t *iface, const func_t *cur, const char *cas)
|
static void gen_stub(type_t *iface, const func_t *cur, const char *cas)
|
||||||
{
|
{
|
||||||
var_t *def = cur->def;
|
var_t *def = cur->def;
|
||||||
var_t *arg;
|
const var_t *arg;
|
||||||
int has_ret = !is_void(def->type, def);
|
int has_ret = !is_void(def->type, def);
|
||||||
|
|
||||||
indent = 0;
|
indent = 0;
|
||||||
@ -816,14 +831,14 @@ static void gen_stub(type_t *iface, const func_t *cur, const char *cas)
|
|||||||
if (cas) fprintf(proxy, "%s_Stub", cas);
|
if (cas) fprintf(proxy, "%s_Stub", cas);
|
||||||
else write_name(proxy, def);
|
else write_name(proxy, def);
|
||||||
fprintf(proxy, "(_This");
|
fprintf(proxy, "(_This");
|
||||||
arg = cur->args;
|
|
||||||
if (arg) {
|
if (cur->args)
|
||||||
END_OF_LIST(arg);
|
{
|
||||||
while (arg) {
|
LIST_FOR_EACH_ENTRY( arg, cur->args, const var_t, entry )
|
||||||
fprintf(proxy, ", ");
|
{
|
||||||
write_name(proxy, arg);
|
fprintf(proxy, ", ");
|
||||||
arg = PREV_LINK(arg);
|
write_name(proxy, arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(proxy, ");\n");
|
fprintf(proxy, ");\n");
|
||||||
fprintf(proxy, "\n");
|
fprintf(proxy, "\n");
|
||||||
|
@ -68,15 +68,10 @@ static void write_parameters_init(const func_t *func)
|
|||||||
if (!func->args)
|
if (!func->args)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
if (var->type->type != RPC_FC_BIND_PRIMITIVE)
|
if (var->type->type != RPC_FC_BIND_PRIMITIVE)
|
||||||
print_server("%s = 0;\n", var->name);
|
print_server("%s = 0;\n", var->name);
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
fprintf(server, "\n");
|
fprintf(server, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,14 +80,12 @@ static void declare_args(const func_t *func)
|
|||||||
{
|
{
|
||||||
int in_attr, out_attr;
|
int in_attr, out_attr;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
|
|
||||||
if (!func->args)
|
if (!func->args)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
const expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS);
|
const expr_t *size_is = get_attrp(var->attrs, ATTR_SIZEIS);
|
||||||
int has_size = size_is && (size_is->type != EXPR_VOID);
|
int has_size = size_is && (size_is->type != EXPR_VOID);
|
||||||
@ -119,8 +112,6 @@ static void declare_args(const func_t *func)
|
|||||||
write_name(server, var);
|
write_name(server, var);
|
||||||
write_array(server, var->array, 0);
|
write_array(server, var->array, 0);
|
||||||
fprintf(server, ";\n");
|
fprintf(server, ";\n");
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,16 +120,14 @@ static void assign_out_args(const func_t *func)
|
|||||||
{
|
{
|
||||||
int in_attr, out_attr;
|
int in_attr, out_attr;
|
||||||
int i = 0, sep = 0;
|
int i = 0, sep = 0;
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
const expr_t *size_is;
|
const expr_t *size_is;
|
||||||
int has_size;
|
int has_size;
|
||||||
|
|
||||||
if (!func->args)
|
if (!func->args)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
int is_string = is_attr(var->attrs, ATTR_STRING);
|
int is_string = is_attr(var->attrs, ATTR_STRING);
|
||||||
size_is = get_attrp(var->attrs, ATTR_SIZEIS);
|
size_is = get_attrp(var->attrs, ATTR_SIZEIS);
|
||||||
@ -173,8 +162,6 @@ static void assign_out_args(const func_t *func)
|
|||||||
|
|
||||||
sep = 1;
|
sep = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sep)
|
if (sep)
|
||||||
@ -319,9 +306,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
|
|
||||||
fprintf(server, "(\n");
|
fprintf(server, "(\n");
|
||||||
indent++;
|
indent++;
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
if (first_arg)
|
if (first_arg)
|
||||||
first_arg = 0;
|
first_arg = 0;
|
||||||
@ -329,7 +314,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
fprintf(server, ",\n");
|
fprintf(server, ",\n");
|
||||||
print_server("");
|
print_server("");
|
||||||
write_name(server, var);
|
write_name(server, var);
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
}
|
||||||
fprintf(server, ");\n");
|
fprintf(server, ");\n");
|
||||||
indent--;
|
indent--;
|
||||||
@ -341,9 +325,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
|
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
{
|
||||||
const var_t *var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
{
|
||||||
if (is_attr(var->attrs, ATTR_OUT))
|
if (is_attr(var->attrs, ATTR_OUT))
|
||||||
{
|
{
|
||||||
@ -351,8 +333,6 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
buffer_size += get_required_buffer_size(var, &alignment, PASS_OUT);
|
buffer_size += get_required_buffer_size(var, &alignment, PASS_OUT);
|
||||||
buffer_size += alignment;
|
buffer_size += alignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,13 +397,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset, unsig
|
|||||||
/* update proc_offset */
|
/* update proc_offset */
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
{
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
*proc_offset += get_size_procformatstring_var(var);
|
*proc_offset += get_size_procformatstring_var(var);
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!is_void(def->type, NULL))
|
if (!is_void(def->type, NULL))
|
||||||
*proc_offset += get_size_procformatstring_var(def);
|
*proc_offset += get_size_procformatstring_var(def);
|
||||||
|
@ -60,7 +60,7 @@ struct expr_eval_routine
|
|||||||
};
|
};
|
||||||
|
|
||||||
static size_t type_memsize(const type_t *t, int ptr_level, const expr_t *array);
|
static size_t type_memsize(const type_t *t, int ptr_level, const expr_t *array);
|
||||||
static size_t fields_memsize(const var_t *v);
|
static size_t fields_memsize(const var_list_t *fields);
|
||||||
|
|
||||||
static int compare_expr(const expr_t *a, const expr_t *b)
|
static int compare_expr(const expr_t *a, const expr_t *b)
|
||||||
{
|
{
|
||||||
@ -263,7 +263,7 @@ void write_procformatstring(FILE *file, const ifref_list_t *ifaces, int for_obje
|
|||||||
{
|
{
|
||||||
const ifref_t *iface;
|
const ifref_t *iface;
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
unsigned int type_offset = 2;
|
unsigned int type_offset = 2;
|
||||||
|
|
||||||
print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
|
print_file(file, indent, "static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =\n");
|
||||||
@ -286,15 +286,8 @@ void write_procformatstring(FILE *file, const ifref_list_t *ifaces, int for_obje
|
|||||||
/* emit argument data */
|
/* emit argument data */
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
{
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
write_procformatstring_var(file, indent, var, FALSE, &type_offset);
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
write_procformatstring_var(file, indent, var, FALSE,
|
|
||||||
&type_offset);
|
|
||||||
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* emit return value data */
|
/* emit return value data */
|
||||||
@ -399,7 +392,8 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_
|
|||||||
{
|
{
|
||||||
const var_t *var;
|
const var_t *var;
|
||||||
|
|
||||||
for (offset = 0, var = structure->fields; var; var = NEXT_LINK(var))
|
offset = 0;
|
||||||
|
if (structure->fields) LIST_FOR_EACH_ENTRY( var, structure->fields, const var_t, entry )
|
||||||
{
|
{
|
||||||
offset -= type_memsize(var->type, var->ptr_level, var->array);
|
offset -= type_memsize(var->type, var->ptr_level, var->array);
|
||||||
if (!strcmp(var->name, subexpr->u.sval))
|
if (!strcmp(var->name, subexpr->u.sval))
|
||||||
@ -416,17 +410,18 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const var_t *var = func->args;
|
const var_t *var;
|
||||||
|
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
offset = 0;
|
||||||
/* FIXME: not all stack variables are sizeof(void *) */
|
if (func->args) LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
for (offset = 0; var; offset += sizeof(void *), var = PREV_LINK(var))
|
|
||||||
{
|
{
|
||||||
if (!strcmp(var->name, subexpr->u.sval))
|
if (!strcmp(var->name, subexpr->u.sval))
|
||||||
{
|
{
|
||||||
correlation_variable = var->type;
|
correlation_variable = var->type;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* FIXME: not all stack variables are sizeof(void *) */
|
||||||
|
offset += sizeof(void *);
|
||||||
}
|
}
|
||||||
if (!correlation_variable)
|
if (!correlation_variable)
|
||||||
error("write_conf_or_var_desc: couldn't find variable %s in function\n",
|
error("write_conf_or_var_desc: couldn't find variable %s in function\n",
|
||||||
@ -530,17 +525,15 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_
|
|||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t fields_memsize(const var_t *v)
|
static size_t fields_memsize(const var_list_t *fields)
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
const var_t *first = v;
|
const var_t *v;
|
||||||
if (!v) return 0;
|
|
||||||
while (NEXT_LINK(v)) v = NEXT_LINK(v);
|
if (!fields) return 0;
|
||||||
while (v) {
|
LIST_FOR_EACH_ENTRY( v, fields, const var_t, entry )
|
||||||
size += type_memsize(v->type, v->ptr_level, v->array);
|
size += type_memsize(v->type, v->ptr_level, v->array);
|
||||||
if (v == first) break;
|
|
||||||
v = PREV_LINK(v);
|
|
||||||
}
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -638,10 +631,8 @@ static int write_pointers(FILE *file, const attr_list_t *attrs,
|
|||||||
case RPC_FC_CPSTRUCT:
|
case RPC_FC_CPSTRUCT:
|
||||||
case RPC_FC_CSTRUCT:
|
case RPC_FC_CSTRUCT:
|
||||||
case RPC_FC_PSTRUCT:
|
case RPC_FC_PSTRUCT:
|
||||||
v = type->fields;
|
if (!type->fields) break;
|
||||||
if (!v) break;
|
LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
|
||||||
while (NEXT_LINK(v)) v = NEXT_LINK(v);
|
|
||||||
for (; v; v = PREV_LINK(v))
|
|
||||||
pointers_written += write_pointers(file, v->attrs, v->type,
|
pointers_written += write_pointers(file, v->attrs, v->type,
|
||||||
v->ptr_level, v->array,
|
v->ptr_level, v->array,
|
||||||
level + 1,
|
level + 1,
|
||||||
@ -691,10 +682,8 @@ static size_t write_pointer_description(FILE *file, const attr_list_t *attrs,
|
|||||||
case RPC_FC_CPSTRUCT:
|
case RPC_FC_CPSTRUCT:
|
||||||
case RPC_FC_CSTRUCT:
|
case RPC_FC_CSTRUCT:
|
||||||
case RPC_FC_PSTRUCT:
|
case RPC_FC_PSTRUCT:
|
||||||
v = type->fields;
|
if (!type->fields) break;
|
||||||
if (!v) break;
|
LIST_FOR_EACH_ENTRY( v, type->fields, const var_t, entry )
|
||||||
while (NEXT_LINK(v)) v = NEXT_LINK(v);
|
|
||||||
for (; v; v = PREV_LINK(v))
|
|
||||||
size += write_pointer_description(file, v->attrs, v->type,
|
size += write_pointer_description(file, v->attrs, v->type,
|
||||||
v->ptr_level, v->array,
|
v->ptr_level, v->array,
|
||||||
level + 1,
|
level + 1,
|
||||||
@ -1001,8 +990,8 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs,
|
|||||||
|
|
||||||
static const var_t *find_array_or_string_in_struct(const type_t *type)
|
static const var_t *find_array_or_string_in_struct(const type_t *type)
|
||||||
{
|
{
|
||||||
/* last field is the first in the fields linked list */
|
const var_t *last_field = LIST_ENTRY( list_tail(type->fields), const var_t, entry );
|
||||||
const var_t *last_field = type->fields;
|
|
||||||
if (is_array_type(last_field->attrs, last_field->ptr_level, last_field->array))
|
if (is_array_type(last_field->attrs, last_field->ptr_level, last_field->array))
|
||||||
return last_field;
|
return last_field;
|
||||||
|
|
||||||
@ -1016,11 +1005,9 @@ static const var_t *find_array_or_string_in_struct(const type_t *type)
|
|||||||
static size_t write_struct_members(FILE *file, const type_t *type)
|
static size_t write_struct_members(FILE *file, const type_t *type)
|
||||||
{
|
{
|
||||||
size_t typestring_size = 0;
|
size_t typestring_size = 0;
|
||||||
var_t *field;
|
const var_t *field;
|
||||||
|
|
||||||
field = type->fields;
|
if (type->fields) LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||||
while (NEXT_LINK(field)) field = NEXT_LINK(field);
|
|
||||||
for (; field; field = PREV_LINK(field))
|
|
||||||
{
|
{
|
||||||
unsigned char rtype = field->type->type;
|
unsigned char rtype = field->type->type;
|
||||||
|
|
||||||
@ -1458,7 +1445,7 @@ static size_t write_typeformatstring_var(FILE *file, int indent,
|
|||||||
void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, int for_objects)
|
void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, int for_objects)
|
||||||
{
|
{
|
||||||
int indent = 0;
|
int indent = 0;
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
unsigned int typeformat_offset;
|
unsigned int typeformat_offset;
|
||||||
const ifref_t *iface;
|
const ifref_t *iface;
|
||||||
|
|
||||||
@ -1483,16 +1470,9 @@ void write_typeformatstring(FILE *file, const ifref_list_t *ifaces, int for_obje
|
|||||||
{
|
{
|
||||||
current_func = func;
|
current_func = func;
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
var = func->args;
|
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
write_typeformatstring_var(file, indent, var,
|
write_typeformatstring_var(file, indent, var,
|
||||||
&typeformat_offset);
|
&typeformat_offset);
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1547,7 +1527,8 @@ static unsigned int get_required_buffer_size_type(
|
|||||||
{
|
{
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
const var_t *field;
|
const var_t *field;
|
||||||
for (field = type->fields; field; field = NEXT_LINK(field))
|
if (!type->fields) return 0;
|
||||||
|
LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||||
{
|
{
|
||||||
unsigned int alignment;
|
unsigned int alignment;
|
||||||
size += get_required_buffer_size_type(
|
size += get_required_buffer_size_type(
|
||||||
@ -1587,7 +1568,9 @@ unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment,
|
|||||||
{
|
{
|
||||||
const var_t *field;
|
const var_t *field;
|
||||||
unsigned int size = 36;
|
unsigned int size = 36;
|
||||||
for (field = type->fields; field; field = NEXT_LINK(field))
|
|
||||||
|
if (!type->fields) return size;
|
||||||
|
LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||||
{
|
{
|
||||||
unsigned int align;
|
unsigned int align;
|
||||||
size += get_required_buffer_size_type(
|
size += get_required_buffer_size_type(
|
||||||
@ -1615,7 +1598,9 @@ unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment,
|
|||||||
{
|
{
|
||||||
unsigned int size = 36;
|
unsigned int size = 36;
|
||||||
const var_t *field;
|
const var_t *field;
|
||||||
for (field = type->fields; field; field = NEXT_LINK(field))
|
|
||||||
|
if (!type->fields) return size;
|
||||||
|
LIST_FOR_EACH_ENTRY( field, type->fields, const var_t, entry )
|
||||||
{
|
{
|
||||||
unsigned int align;
|
unsigned int align;
|
||||||
size += get_required_buffer_size_type(
|
size += get_required_buffer_size_type(
|
||||||
@ -1772,14 +1757,12 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
|
|||||||
const expr_t *length_is;
|
const expr_t *length_is;
|
||||||
const expr_t *size_is;
|
const expr_t *size_is;
|
||||||
int in_attr, out_attr, has_length, has_size, pointer_type;
|
int in_attr, out_attr, has_length, has_size, pointer_type;
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
|
|
||||||
if (!func->args)
|
if (!func->args)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var = func->args;
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
for (; var; *type_offset += get_size_typeformatstring_var(var), var = PREV_LINK(var))
|
|
||||||
{
|
{
|
||||||
const type_t *type = var->type;
|
const type_t *type = var->type;
|
||||||
unsigned char rtype;
|
unsigned char rtype;
|
||||||
@ -1801,12 +1784,10 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
|
|||||||
switch (pass)
|
switch (pass)
|
||||||
{
|
{
|
||||||
case PASS_IN:
|
case PASS_IN:
|
||||||
if (!in_attr)
|
if (!in_attr) goto next;
|
||||||
continue;
|
|
||||||
break;
|
break;
|
||||||
case PASS_OUT:
|
case PASS_OUT:
|
||||||
if (!out_attr)
|
if (!out_attr) goto next;
|
||||||
continue;
|
|
||||||
break;
|
break;
|
||||||
case PASS_RETURN:
|
case PASS_RETURN:
|
||||||
break;
|
break;
|
||||||
@ -1943,6 +1924,8 @@ void write_remoting_arguments(FILE *file, int indent, const func_t *func,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(file, "\n");
|
fprintf(file, "\n");
|
||||||
|
next:
|
||||||
|
*type_offset += get_size_typeformatstring_var(var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1966,7 +1949,7 @@ size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects)
|
|||||||
const ifref_t *iface;
|
const ifref_t *iface;
|
||||||
size_t size = 1;
|
size_t size = 1;
|
||||||
const func_t *func;
|
const func_t *func;
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
|
|
||||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
||||||
{
|
{
|
||||||
@ -1979,15 +1962,8 @@ size_t get_size_procformatstring(const ifref_list_t *ifaces, int for_objects)
|
|||||||
{
|
{
|
||||||
/* argument list size */
|
/* argument list size */
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
var = func->args;
|
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
size += get_size_procformatstring_var(var);
|
size += get_size_procformatstring_var(var);
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var = func->def;
|
var = func->def;
|
||||||
/* return value size */
|
/* return value size */
|
||||||
@ -2006,7 +1982,7 @@ size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects)
|
|||||||
const ifref_t *iface;
|
const ifref_t *iface;
|
||||||
size_t size = 3;
|
size_t size = 3;
|
||||||
const func_t *func;
|
const func_t *func;
|
||||||
var_t *var;
|
const var_t *var;
|
||||||
|
|
||||||
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
if (ifaces) LIST_FOR_EACH_ENTRY( iface, ifaces, const ifref_t, entry )
|
||||||
{
|
{
|
||||||
@ -2019,15 +1995,8 @@ size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects)
|
|||||||
{
|
{
|
||||||
/* argument list size */
|
/* argument list size */
|
||||||
if (func->args)
|
if (func->args)
|
||||||
{
|
LIST_FOR_EACH_ENTRY( var, func->args, const var_t, entry )
|
||||||
var = func->args;
|
|
||||||
while (NEXT_LINK(var)) var = NEXT_LINK(var);
|
|
||||||
while (var)
|
|
||||||
{
|
|
||||||
size += get_size_typeformatstring_var(var);
|
size += get_size_typeformatstring_var(var);
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2035,7 +2004,7 @@ size_t get_size_typeformatstring(const ifref_list_t *ifaces, int for_objects)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
|
static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
|
||||||
const var_t *fields, const char *structvar)
|
const var_list_t *fields, const char *structvar)
|
||||||
{
|
{
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case EXPR_VOID:
|
case EXPR_VOID:
|
||||||
@ -2055,15 +2024,14 @@ static void write_struct_expr(FILE *h, const expr_t *e, int brackets,
|
|||||||
case EXPR_IDENTIFIER:
|
case EXPR_IDENTIFIER:
|
||||||
{
|
{
|
||||||
const var_t *field;
|
const var_t *field;
|
||||||
for (field = fields; field; field = NEXT_LINK(field))
|
LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
|
||||||
{
|
|
||||||
if (!strcmp(e->u.sval, field->name))
|
if (!strcmp(e->u.sval, field->name))
|
||||||
{
|
{
|
||||||
fprintf(h, "%s->%s", structvar, e->u.sval);
|
fprintf(h, "%s->%s", structvar, e->u.sval);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!field) error("no field found for identifier %s\n", e->u.sval);
|
if (&field->entry == fields) error("no field found for identifier %s\n", e->u.sval);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EXPR_NEG:
|
case EXPR_NEG:
|
||||||
|
@ -48,6 +48,7 @@ typedef struct _typelib_t typelib_t;
|
|||||||
|
|
||||||
typedef struct list attr_list_t;
|
typedef struct list attr_list_t;
|
||||||
typedef struct list func_list_t;
|
typedef struct list func_list_t;
|
||||||
|
typedef struct list var_list_t;
|
||||||
typedef struct list ifref_list_t;
|
typedef struct list ifref_list_t;
|
||||||
|
|
||||||
#define DECL_LINK(type) \
|
#define DECL_LINK(type) \
|
||||||
@ -210,7 +211,7 @@ struct _type_t {
|
|||||||
struct _type_t *ref;
|
struct _type_t *ref;
|
||||||
const attr_list_t *attrs;
|
const attr_list_t *attrs;
|
||||||
func_list_t *funcs; /* interfaces and modules */
|
func_list_t *funcs; /* interfaces and modules */
|
||||||
var_t *fields; /* interfaces, structures and enumerations */
|
var_list_t *fields; /* interfaces, structures and enumerations */
|
||||||
ifref_list_t *ifaces; /* coclasses */
|
ifref_list_t *ifaces; /* coclasses */
|
||||||
type_t *orig; /* dup'd types */
|
type_t *orig; /* dup'd types */
|
||||||
int ignore, is_const, sign;
|
int ignore, is_const, sign;
|
||||||
@ -231,18 +232,18 @@ struct _var_t {
|
|||||||
int ptr_level;
|
int ptr_level;
|
||||||
expr_t *array;
|
expr_t *array;
|
||||||
type_t *type;
|
type_t *type;
|
||||||
var_t *args; /* for function pointers */
|
var_list_t *args; /* for function pointers */
|
||||||
const char *tname;
|
const char *tname;
|
||||||
attr_list_t *attrs;
|
attr_list_t *attrs;
|
||||||
expr_t *eval;
|
expr_t *eval;
|
||||||
|
|
||||||
/* parser-internal */
|
/* parser-internal */
|
||||||
DECL_LINK(var_t);
|
struct list entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _func_t {
|
struct _func_t {
|
||||||
var_t *def;
|
var_t *def;
|
||||||
var_t *args;
|
var_list_t *args;
|
||||||
int ignore, idx;
|
int ignore, idx;
|
||||||
|
|
||||||
/* parser-internal */
|
/* parser-internal */
|
||||||
@ -301,7 +302,7 @@ type_t *duptype(type_t *t, int dupname);
|
|||||||
type_t *alias(type_t *t, const char *name);
|
type_t *alias(type_t *t, const char *name);
|
||||||
|
|
||||||
int is_ptr(const type_t *t);
|
int is_ptr(const type_t *t);
|
||||||
int is_var_ptr(var_t *v);
|
int is_var_ptr(const var_t *v);
|
||||||
int cant_be_null(var_t *v);
|
int cant_be_null(const var_t *v);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1250,7 +1250,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||||||
int i, id, next_idx;
|
int i, id, next_idx;
|
||||||
int decoded_size, extra_attr = 0;
|
int decoded_size, extra_attr = 0;
|
||||||
int num_params = 0, num_defaults = 0;
|
int num_params = 0, num_defaults = 0;
|
||||||
var_t *arg, *last_arg = NULL;
|
var_t *arg;
|
||||||
char *namedata;
|
char *namedata;
|
||||||
const attr_t *attr;
|
const attr_t *attr;
|
||||||
unsigned int funcflags = 0, callconv = 4 /* CC_STDCALL */;
|
unsigned int funcflags = 0, callconv = 4 /* CC_STDCALL */;
|
||||||
@ -1279,8 +1279,9 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(arg = func->args; arg; arg = NEXT_LINK(arg)) {
|
if (func->args)
|
||||||
last_arg = arg;
|
LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry )
|
||||||
|
{
|
||||||
num_params++;
|
num_params++;
|
||||||
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
|
if (arg->attrs) LIST_FOR_EACH_ENTRY( attr, arg->attrs, const attr_t, entry ) {
|
||||||
if(attr->type == ATTR_DEFAULTVALUE_EXPR || attr->type == ATTR_DEFAULTVALUE_STRING) {
|
if(attr->type == ATTR_DEFAULTVALUE_EXPR || attr->type == ATTR_DEFAULTVALUE_STRING) {
|
||||||
@ -1288,7 +1289,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chat("add_func_desc: num of params %d\n", num_params);
|
chat("add_func_desc: num of params %d\n", num_params);
|
||||||
|
|
||||||
@ -1433,7 +1434,11 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||||||
warning("unknown number of optional attrs\n");
|
warning("unknown number of optional attrs\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (arg = last_arg, i = 0; arg; arg = PREV_LINK(arg), i++) {
|
if (func->args)
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry )
|
||||||
|
{
|
||||||
const attr_t *attr;
|
const attr_t *attr;
|
||||||
int paramflags = 0;
|
int paramflags = 0;
|
||||||
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
|
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
|
||||||
@ -1491,6 +1496,8 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||||||
paramdata[1] = -1;
|
paramdata[1] = -1;
|
||||||
paramdata[2] = paramflags;
|
paramdata[2] = paramflags;
|
||||||
typedata[3] += decoded_size << 16;
|
typedata[3] += decoded_size << 16;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(typeinfo->funcs_allocated == 0) {
|
if(typeinfo->funcs_allocated == 0) {
|
||||||
@ -1541,10 +1548,16 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, const func_t *func, int
|
|||||||
|
|
||||||
if(invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */) {
|
if(invokekind != 0x4 /* INVOKE_PROPERTYPUT */ && invokekind != 0x8 /* INVOKE_PROPERTYPUTREF */) {
|
||||||
/* don't give the arg of a [propput*] func a name */
|
/* don't give the arg of a [propput*] func a name */
|
||||||
for (arg = last_arg, i = 0; arg; arg = PREV_LINK(arg), i++) {
|
if (func->args)
|
||||||
|
{
|
||||||
|
i = 0;
|
||||||
|
LIST_FOR_EACH_ENTRY( arg, func->args, var_t, entry )
|
||||||
|
{
|
||||||
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
|
int *paramdata = typedata + 6 + extra_attr + (num_defaults ? num_params : 0) + i * 3;
|
||||||
offset = ctl2_alloc_name(typeinfo->typelib, arg->name);
|
offset = ctl2_alloc_name(typeinfo->typelib, arg->name);
|
||||||
paramdata[1] = offset;
|
paramdata[1] = offset;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
@ -1919,14 +1932,9 @@ static void add_dispinterface_typeinfo(msft_typelib_t *typelib, type_t *dispinte
|
|||||||
if (dispinterface->funcs)
|
if (dispinterface->funcs)
|
||||||
LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry ) idx++;
|
LIST_FOR_EACH_ENTRY( func, dispinterface->funcs, const func_t, entry ) idx++;
|
||||||
|
|
||||||
if((var = dispinterface->fields)) {
|
if (dispinterface->fields)
|
||||||
while(NEXT_LINK(var)) var = NEXT_LINK(var);
|
LIST_FOR_EACH_ENTRY( var, dispinterface->fields, var_t, entry )
|
||||||
while(var) {
|
add_var_desc(msft_typeinfo, idx++, var);
|
||||||
add_var_desc(msft_typeinfo, idx, var);
|
|
||||||
idx++;
|
|
||||||
var = PREV_LINK(var);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dispinterface->funcs)
|
if (dispinterface->funcs)
|
||||||
{
|
{
|
||||||
@ -1998,7 +2006,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface)
|
|||||||
static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
|
static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
var_t *cur = structure->fields;
|
var_t *cur;
|
||||||
msft_typeinfo_t *msft_typeinfo;
|
msft_typeinfo_t *msft_typeinfo;
|
||||||
|
|
||||||
if (-1 < structure->typelib_idx)
|
if (-1 < structure->typelib_idx)
|
||||||
@ -2008,30 +2016,24 @@ static void add_structure_typeinfo(msft_typelib_t *typelib, type_t *structure)
|
|||||||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_RECORD, structure->name, structure->attrs);
|
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_RECORD, structure->name, structure->attrs);
|
||||||
msft_typeinfo->typeinfo->size = 0;
|
msft_typeinfo->typeinfo->size = 0;
|
||||||
|
|
||||||
while(NEXT_LINK(cur)) cur = NEXT_LINK(cur);
|
if (structure->fields)
|
||||||
while(cur) {
|
LIST_FOR_EACH_ENTRY( cur, structure->fields, var_t, entry )
|
||||||
add_var_desc(msft_typeinfo, idx, cur);
|
add_var_desc(msft_typeinfo, idx++, cur);
|
||||||
idx++;
|
|
||||||
cur = PREV_LINK(cur);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
|
static void add_enum_typeinfo(msft_typelib_t *typelib, type_t *enumeration)
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
var_t *cur = enumeration->fields;
|
var_t *cur;
|
||||||
msft_typeinfo_t *msft_typeinfo;
|
msft_typeinfo_t *msft_typeinfo;
|
||||||
|
|
||||||
enumeration->typelib_idx = typelib->typelib_header.nrtypeinfos;
|
enumeration->typelib_idx = typelib->typelib_header.nrtypeinfos;
|
||||||
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs);
|
msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs);
|
||||||
msft_typeinfo->typeinfo->size = 0;
|
msft_typeinfo->typeinfo->size = 0;
|
||||||
|
|
||||||
while(NEXT_LINK(cur)) cur = NEXT_LINK(cur);
|
if (enumeration->fields)
|
||||||
while(cur) {
|
LIST_FOR_EACH_ENTRY( cur, enumeration->fields, var_t, entry )
|
||||||
add_var_desc(msft_typeinfo, idx, cur);
|
add_var_desc(msft_typeinfo, idx++, cur);
|
||||||
idx++;
|
|
||||||
cur = PREV_LINK(cur);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
|
static void add_typedef_typeinfo(msft_typelib_t *typelib, type_t *tdef)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user