blob: 8c8ba11da647b1ebea34424a04685957da10d6d7 [file] [log] [blame]
Robert Shearman35d327b2005-12-08 12:52:13 +01001/*
2 * Format String Generator for IDL Compiler
3 *
Eric Kohl15509382006-03-23 10:33:08 +01004 * Copyright 2005-2006 Eric Kohl
Robert Shearman35d327b2005-12-08 12:52:13 +01005 * Copyright 2005 Robert Shearman
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
Jonathan Ernst360a3f92006-05-18 14:49:52 +020019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Robert Shearman35d327b2005-12-08 12:52:13 +010020 */
21
Dan Hipschmane36981e2007-06-14 18:29:33 -070022#include <stdarg.h>
Robert Shearman35d327b2005-12-08 12:52:13 +010023
Robert Shearman7e5cf942005-12-26 13:14:28 +010024enum pass
25{
26 PASS_IN,
27 PASS_OUT,
28 PASS_RETURN
29};
30
Robert Shearman55df46a2006-02-07 12:32:24 +010031enum remoting_phase
32{
33 PHASE_BUFFERSIZE,
34 PHASE_MARSHAL,
35 PHASE_UNMARSHAL,
36 PHASE_FREE
37};
38
Rob Shearman2c6e6112009-02-23 13:48:46 +000039enum typegen_detect_flags
40{
41 TDT_ALL_TYPES = 1 << 0,
42 TDT_IGNORE_STRINGS = 1 << 1,
43};
44
45enum typegen_type
46{
47 TGT_INVALID,
48 TGT_USER_TYPE,
49 TGT_CTXT_HANDLE,
50 TGT_CTXT_HANDLE_POINTER,
51 TGT_STRING,
52 TGT_POINTER,
53 TGT_ARRAY,
54 TGT_IFACE_POINTER,
55 TGT_BASIC,
56 TGT_ENUM,
57 TGT_STRUCT,
58 TGT_UNION,
59};
60
Dan Hipschmanf173add2007-10-15 18:06:33 -070061typedef int (*type_pred_t)(const type_t *);
62
Rob Shearmandf0e38c2008-04-24 19:06:28 +010063void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred);
64void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred);
65void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred_t pred);
Alexandre Julliardbf011b02008-09-15 16:46:01 +020066void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, enum remoting_phase phase,
67 enum pass pass, const var_t *var, const char *varname);
Rob Shearman901a42b2009-01-05 23:33:27 +000068void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix,
Alexandre Julliardbf011b02008-09-15 16:46:01 +020069 enum pass pass, enum remoting_phase phase);
Alexandre Julliardef6971d2009-02-06 14:30:38 +010070unsigned int get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs);
71unsigned int get_size_procformatstring_func(const var_t *func);
72unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred);
73unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred);
Rob Shearman901a42b2009-01-05 23:33:27 +000074void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char *local_var_prefix );
75void declare_stub_args( FILE *file, int indent, const var_t *func );
Robert Shearmanb59c9952006-01-27 12:53:32 +010076int write_expr_eval_routines(FILE *file, const char *iface);
77void write_expr_eval_routine_list(FILE *file, const char *iface);
Dan Hipschmanc0982b42007-06-13 16:13:04 -070078void write_user_quad_list(FILE *file);
Alexandre Julliard94ee8e82007-02-07 17:55:09 +010079void write_endpoints( FILE *f, const char *prefix, const str_list_t *list );
Alexandre Julliard3bdaba22008-09-15 14:05:26 +020080void write_exceptions( FILE *file );
Alexandre Julliardef6971d2009-02-06 14:30:38 +010081unsigned int type_memsize(const type_t *t, unsigned int *align);
Dan Hipschmanc0982b42007-06-13 16:13:04 -070082int decl_indirect(const type_t *t);
Rob Shearman901a42b2009-01-05 23:33:27 +000083void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix);
Dan Hipschmane36981e2007-06-14 18:29:33 -070084void print(FILE *file, int indent, const char *format, va_list ap);
Dan Hipschman5e84eb92007-09-13 18:04:32 -070085int get_padding(const var_list_t *fields);
Dan Hipschman132f06c2007-09-18 15:29:59 -070086int is_user_type(const type_t *t);
Dan Hipschmanb0bc8e52007-11-02 15:25:26 -070087expr_t *get_size_is_expr(const type_t *t, const char *name);
Rob Shearman901a42b2009-01-05 23:33:27 +000088int is_full_pointer_function(const var_t *func);
89void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server);
90void write_full_pointer_free(FILE *file, int indent, const var_t *func);
Rob Shearman728a7382009-03-07 23:24:00 +000091unsigned char get_basic_fc(const type_t *type);
Rob Shearman23673ca2009-03-07 23:23:44 +000092unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_param);
Rob Shearmanaf080072009-02-23 13:48:34 +000093unsigned char get_struct_fc(const type_t *type);
Rob Shearman2c6e6112009-02-23 13:48:46 +000094enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags);