widl: Add some const attributes.

oldstable
Robert Shearman 2005-12-26 13:11:33 +01:00 committed by Alexandre Julliard
parent 73dff5c465
commit 7f2419ceed
5 changed files with 40 additions and 40 deletions

View File

@ -46,7 +46,7 @@ static void indent(FILE *h, int delta)
if (delta > 0) indentation += delta;
}
int is_attr(attr_t *a, enum attr_type t)
int is_attr(const attr_t *a, enum attr_type t)
{
while (a) {
if (a->type == t) return 1;
@ -55,7 +55,7 @@ int is_attr(attr_t *a, enum attr_type t)
return 0;
}
void *get_attrp(attr_t *a, enum attr_type t)
void *get_attrp(const attr_t *a, enum attr_type t)
{
while (a) {
if (a->type == t) return a->u.pval;
@ -64,7 +64,7 @@ void *get_attrp(attr_t *a, enum attr_type t)
return NULL;
}
unsigned long get_attrv(attr_t *a, enum attr_type t)
unsigned long get_attrv(const attr_t *a, enum attr_type t)
{
while (a) {
if (a->type == t) return a->u.ival;
@ -73,7 +73,7 @@ unsigned long get_attrv(attr_t *a, enum attr_type t)
return 0;
}
int is_void(type_t *t, var_t *v)
int is_void(const type_t *t, const var_t *v)
{
if (v && v->ptr_level) return 0;
if (!t->type && !t->ref) return 1;
@ -90,7 +90,7 @@ static void write_guid(const char *guid_prefix, const char *name, UUID *uuid)
uuid->Data4[6], uuid->Data4[7]);
}
static void write_pident(FILE *h, var_t *v)
static void write_pident(FILE *h, const var_t *v)
{
int c;
for (c=0; c<v->ptr_level; c++) {
@ -99,7 +99,7 @@ static void write_pident(FILE *h, var_t *v)
if (v->name) fprintf(h, "%s", v->name);
}
void write_name(FILE *h, var_t *v)
void write_name(FILE *h, const var_t *v)
{
if (is_attr( v->attrs, ATTR_PROPGET ))
fprintf(h, "get_" );
@ -110,12 +110,12 @@ void write_name(FILE *h, var_t *v)
fprintf(h, "%s", v->name);
}
char* get_name(var_t *v)
const char* get_name(const var_t *v)
{
return v->name;
}
static void write_array(FILE *h, expr_t *v, int field)
static void write_array(FILE *h, const expr_t *v, int field)
{
if (!v) return;
while (NEXT_LINK(v)) v = NEXT_LINK(v);
@ -199,7 +199,7 @@ static void write_enums(FILE *h, var_t *v)
fprintf(h, "\n");
}
void write_type(FILE *h, type_t *t, var_t *v, const char *n)
void write_type(FILE *h, type_t *t, const var_t *v, const char *n)
{
int c;
@ -381,10 +381,10 @@ void write_user_types(void)
}
}
void write_typedef(type_t *type, var_t *names)
void write_typedef(type_t *type, const var_t *names)
{
char *tname = names->tname;
var_t *lname;
const var_t *lname;
while (NEXT_LINK(names)) names = NEXT_LINK(names);
lname = names;
fprintf(header, "typedef ");
@ -477,14 +477,14 @@ void write_expr(FILE *h, expr_t *e)
do_write_expr(h, e, 0);
}
void write_constdef(var_t *v)
void write_constdef(const var_t *v)
{
fprintf(header, "#define %s (", get_name(v));
write_expr(header, v->eval);
fprintf(header, ")\n\n");
}
void write_externdef(var_t *v)
void write_externdef(const var_t *v)
{
fprintf(header, "extern const ");
write_type(header, v->type, NULL, v->tname);
@ -545,7 +545,7 @@ var_t *is_callas(attr_t *a)
return get_attrp(a, ATTR_CALLAS);
}
static int write_method_macro(type_t *iface, char *name)
static int write_method_macro(const type_t *iface, const char *name)
{
int idx;
func_t *cur = iface->funcs;
@ -636,7 +636,7 @@ void write_args(FILE *h, var_t *arg, const char *name, int method, int do_indent
if (do_indent) indentation--;
}
static void write_cpp_method_def(type_t *iface)
static void write_cpp_method_def(const type_t *iface)
{
func_t *cur = iface->funcs;
@ -659,7 +659,7 @@ static void write_cpp_method_def(type_t *iface)
}
}
static void do_write_c_method_def(type_t *iface, char *name)
static void do_write_c_method_def(const type_t *iface, char *name)
{
func_t *cur = iface->funcs;
@ -685,17 +685,17 @@ static void do_write_c_method_def(type_t *iface, char *name)
}
}
static void write_c_method_def(type_t *iface)
static void write_c_method_def(const type_t *iface)
{
do_write_c_method_def(iface, iface->name);
}
static void write_c_disp_method_def(type_t *iface)
static void write_c_disp_method_def(const type_t *iface)
{
do_write_c_method_def(iface->ref, iface->name);
}
static void write_method_proto(type_t *iface)
static void write_method_proto(const type_t *iface)
{
func_t *cur = iface->funcs;
@ -759,7 +759,7 @@ static void write_method_proto(type_t *iface)
}
}
static void write_function_proto(type_t *iface)
static void write_function_proto(const type_t *iface)
{
char *implicit_handle = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);
int explicit_handle = is_attr(iface->attrs, ATTR_EXPLICIT_HANDLE);
@ -816,13 +816,13 @@ void write_forward(type_t *iface)
}
}
static void write_iface_guid(type_t *iface)
static void write_iface_guid(const type_t *iface)
{
UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
write_guid("IID", iface->name, uuid);
}
static void write_dispiface_guid(type_t *iface)
static void write_dispiface_guid(const type_t *iface)
{
UUID *uuid = get_attrp(iface->attrs, ATTR_UUID);
write_guid("DIID", iface->name, uuid);
@ -895,7 +895,7 @@ static void write_com_interface(type_t *iface)
fprintf(header,"\n#endif /* __%s_INTERFACE_DEFINED__ */\n\n", iface->name);
}
static void write_rpc_interface(type_t *iface)
static void write_rpc_interface(const type_t *iface)
{
unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION);
char *var = get_attrp(iface->attrs, ATTR_IMPLICIT_HANDLE);

View File

@ -21,13 +21,13 @@
#ifndef __WIDL_HEADER_H
#define __WIDL_HEADER_H
extern int is_attr(attr_t *a, enum attr_type t);
extern void *get_attrp(attr_t *a, enum attr_type t);
extern unsigned long get_attrv(attr_t *a, enum attr_type t);
extern int is_void(type_t *t, var_t *v);
extern void write_name(FILE *h, var_t *v);
extern char* get_name(var_t *v);
extern void write_type(FILE *h, type_t *t, var_t *v, const char *n);
extern int is_attr(const attr_t *a, enum attr_type t);
extern void *get_attrp(const attr_t *a, enum attr_type t);
extern unsigned long get_attrv(const attr_t *a, enum attr_type t);
extern int is_void(const type_t *t, const var_t *v);
extern void write_name(FILE *h, const var_t *v);
extern const char* get_name(const var_t *v);
extern void write_type(FILE *h, type_t *t, const var_t *v, const char *n);
extern int is_object(attr_t *a);
extern int is_local(attr_t *a);
extern var_t *is_callas(attr_t *a);
@ -36,10 +36,10 @@ extern void write_forward(type_t *iface);
extern void write_interface(type_t *iface);
extern void write_dispinterface(type_t *iface);
extern void write_coclass(class_t *iface);
extern void write_typedef(type_t *type, var_t *names);
extern void write_typedef(type_t *type, const var_t *names);
extern void write_expr(FILE *h, expr_t *e);
extern void write_constdef(var_t *v);
extern void write_externdef(var_t *v);
extern void write_constdef(const var_t *v);
extern void write_externdef(const var_t *v);
extern void write_library(const char *name, attr_t *attr);
extern void write_user_types(void);
extern var_t* get_explicit_handle_var(func_t* func);

View File

@ -84,7 +84,7 @@ static var_t *make_var(char *name);
static func_t *make_func(var_t *def, var_t *args);
static class_t *make_class(char *name);
static type_t *reg_type(type_t *type, char *name, int t);
static type_t *reg_type(type_t *type, const char *name, int t);
static type_t *reg_types(type_t *type, var_t *names, int t);
static type_t *find_type(const char *name, int t);
static type_t *find_type2(char *name, int t);
@ -1102,7 +1102,7 @@ static int hash_ident(const char *name)
/***** type repository *****/
struct rtype {
char *name;
const char *name;
type_t *type;
int t;
struct rtype *next;
@ -1110,7 +1110,7 @@ struct rtype {
struct rtype *type_hash[HASHMAX];
static type_t *reg_type(type_t *type, char *name, int t)
static type_t *reg_type(type_t *type, const char *name, int t)
{
struct rtype *nt;
int hash;

View File

@ -206,7 +206,7 @@ static void proxy_check_pointers( var_t *arg )
static void marshall_size_arg( var_t *arg )
{
int index = 0;
type_t *type = get_base_type(arg);
const type_t *type = get_base_type(arg);
expr_t *expr;
expr = get_attrp( arg->attrs, ATTR_SIZEIS );
@ -728,7 +728,7 @@ static void stub_genmarshall( var_t *args )
stub_gen_marshall_copydata( args );
}
static void gen_stub(type_t *iface, func_t *cur, char *cas)
static void gen_stub(type_t *iface, func_t *cur, const char *cas)
{
var_t *def = cur->def;
var_t *arg;
@ -892,7 +892,7 @@ static void write_proxy(type_t *iface)
var_t *def = cur->def;
if (!is_local(def->attrs)) {
var_t *cas = is_callas(def->attrs);
char *cname = cas ? cas->name : NULL;
const char *cname = cas ? cas->name : NULL;
int idx = cur->idx;
if (cname) {
func_t *m = iface->funcs;

View File

@ -1627,7 +1627,7 @@ static HRESULT add_impl_type(msft_typeinfo_t *typeinfo, type_t *ref)
}
static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_kind kind,
char *name, attr_t *attr, int idx)
const char *name, attr_t *attr, int idx)
{
msft_typeinfo_t *msft_typeinfo;
int nameoffset;