Replaced all [const] String_or_char * to const_String_or_char_ptr, by the following command:

sed -i "s/\(const \)\?String_or_char \*/const_String_or_char_ptr /g" CParse/* Include/* Modules/* Preprocessor/* Swig/*

This is a preparation for moving to new DOH, since for strong typed objects we need the const_String_or_char_ptr class to implicit convert to and from String * or const char *.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11080 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Haoyu Bai 2009-01-24 13:15:51 +00:00
commit 6d2aef67d9
39 changed files with 230 additions and 226 deletions

View file

@ -34,7 +34,7 @@ extern "C" {
extern void scanner_ignore_typedef(void);
extern void scanner_last_id(int);
extern void scanner_clear_rename(void);
extern void scanner_set_location(String_or_char *file, int line);
extern void scanner_set_location(const_String_or_char_ptr file, int line);
extern void scanner_set_main_input_file(String *file);
extern String *scanner_get_main_input_file();
extern void Swig_cparse_follow_locators(int);

View file

@ -442,7 +442,7 @@ int yylook(void) {
static int check_typedef = 0;
void scanner_set_location(String_or_char *file, int line) {
void scanner_set_location(const_String_or_char_ptr file, int line) {
Scanner_set_location(scan,file,line-1);
}

View file

@ -66,7 +66,7 @@ static void yyerror (const char *e) {
(void)e;
}
static Node *new_node(const String_or_char *tag) {
static Node *new_node(const_String_or_char_ptr tag) {
Node *n = NewHash();
set_nodeType(n,tag);
Setfile(n,cparse_file);
@ -1425,7 +1425,7 @@ static void default_arguments(Node *n) {
* Used by the parser to mark subtypes with extra information.
* ----------------------------------------------------------------------------- */
static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) {
static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) {
while (n) {
Setattr(n, attrname, value);
tag_nodes(firstChild(n), attrname, value);

View file

@ -144,6 +144,9 @@ typedef void DOH;
#define DOHString_or_char DOH
#define DOHObj_or_char DOH
typedef const DOHString_or_char * const_String_or_char_ptr;
typedef const DOHString_or_char * DOHconst_String_or_char_ptr;
#define DOH_BEGIN -1
#define DOH_END -2
#define DOH_CUR -3

View file

@ -625,7 +625,7 @@ void note_implicit_template_instantiation(SwigType *t) {
add_defined_foreign_type(0, 0, t, t, implicit_ns ? implicit_ns : current_namespace);
}
String *get_ffi_type(SwigType *ty, const String_or_char *name) {
String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
/* lookup defined foreign type.
if it exists, it will return a form suitable for placing
into lisp code to generate the def-foreign-type name */
@ -1962,7 +1962,7 @@ int any_varargs(ParmList *pl) {
return 0;
}
String *get_lisp_type(SwigType *ty, const String_or_char *name) {
String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0);
if (typemap) {
String *typespec = Getattr(typemap, "code");

View file

@ -101,12 +101,12 @@ protected:
int isPointer(SwigType *t);
void dispatchFunction(Node *n);
String *chickenNameMapping(String *, String_or_char *);
String *chickenNameMapping(String *, const_String_or_char_ptr );
String *chickenPrimitiveName(String *);
String *runtimeCode();
String *defaultExternalRuntimeFilename();
String *buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname);
String *buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname);
};
/* -----------------------------------------------------------------------
@ -1234,7 +1234,7 @@ int CHICKEN::importDirective(Node *n) {
return Language::importDirective(n);
}
String *CHICKEN::buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname) {
String *CHICKEN::buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname) {
String *method_signature = NewString("");
String *func_args = NewString("");
String *func_call = NewString("");
@ -1508,7 +1508,7 @@ int CHICKEN::validIdentifier(String *s) {
* If class_name = "" that means the mapping is for a function or
* variable not attached to any class.
* ------------------------------------------------------------ */
String *CHICKEN::chickenNameMapping(String *name, String_or_char *class_name) {
String *CHICKEN::chickenNameMapping(String *name, const_String_or_char_ptr class_name) {
String *n = NewString("");
if (Strcmp(class_name, "") == 0) {

View file

@ -85,7 +85,7 @@ class CSHARP:public Language {
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));

View file

@ -84,7 +84,7 @@ String *Swig_director_declaration(Node *n) {
}
String *Swig_method_call(String_or_char *name, ParmList *parms) {
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) {
String *func;
int i = 0;
int comma = 0;
@ -128,7 +128,7 @@ String *Swig_method_call(String_or_char *name, ParmList *parms) {
*
*/
String *Swig_method_decl(SwigType *returntype, SwigType *decl, const String_or_char *id, List *args, int strip, int values) {
String *Swig_method_decl(SwigType *returntype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values) {
String *result;
List *elements;
String *element = 0, *nextelement;

View file

@ -1654,7 +1654,7 @@ public:
* If class_name = "" that means the mapping is for a function or
* variable not attached to any class.
* ------------------------------------------------------------ */
String *goopsNameMapping(String *name, String_or_char *class_name) {
String *goopsNameMapping(String *name, const_String_or_char_ptr class_name) {
String *n = NewString("");
if (Strcmp(class_name, "") == 0) {

View file

@ -82,7 +82,7 @@ class JAVA:public Language {
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));

View file

@ -285,7 +285,7 @@ static void set_outdir(const String *c_wrapper_file_dir) {
}
/* This function sets the name of the configuration file */
void SWIG_config_file(const String_or_char *filename) {
void SWIG_config_file(const_String_or_char_ptr filename) {
lang_config = NewString(filename);
}

View file

@ -316,7 +316,7 @@ static bool print_typecheck(String *f, int j, Parm *pj) {
* ReplaceFormat()
* ----------------------------------------------------------------------------- */
static String *ReplaceFormat(const String_or_char *fmt, int j) {
static String *ReplaceFormat(const_String_or_char_ptr fmt, int j) {
String *lfmt = NewString(fmt);
char buf[50];
sprintf(buf, "%d", j);
@ -352,7 +352,7 @@ static String *ReplaceFormat(const String_or_char *fmt, int j) {
/*
Cast dispatch mechanism.
*/
String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *maxargs) {
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
int i, j;
*maxargs = 1;
@ -536,7 +536,7 @@ String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *max
/*
Fast dispatch mechanism, provided by Salvador Fandi~no Garc'ia (#930586).
*/
String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *maxargs) {
String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
int i, j;
*maxargs = 1;
@ -695,7 +695,7 @@ String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *max
return f;
}
String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *maxargs) {
String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
if (fast_dispatch_mode || GetFlag(n, "feature:fastdispatch")) {
return Swig_overload_dispatch_fast(n, fmt, maxargs);

View file

@ -1934,7 +1934,7 @@ public:
return NewStringEmpty();
}
String *PhpTypeFromTypemap(char *op, Node *n, String_or_char *lname) {
String *PhpTypeFromTypemap(char *op, Node *n, const_String_or_char_ptr lname) {
String *tms = Swig_typemap_lookup(op, n, lname, 0);
if (!tms)
return 0;

View file

@ -224,7 +224,7 @@ public:
* name (i.e. "enum_test").
* ------------------------------------------------------------ */
String *strip(const DOHString_or_char *name) {
String *strip(const DOHconst_String_or_char_ptr name) {
String *s = Copy(name);
if (Strncmp(name, PrefixPlusUnderscore, Len(PrefixPlusUnderscore)) != 0) {
return s;
@ -237,7 +237,7 @@ public:
* add_method()
* ------------------------------------------------------------ */
void add_method(const DOHString_or_char *name, const DOHString_or_char *function, const DOHString_or_char *description) {
void add_method(const DOHconst_String_or_char_ptr name, const DOHconst_String_or_char_ptr function, const DOHconst_String_or_char_ptr description) {
String *rename = NULL;
switch (current) {
case NO_CPP:

View file

@ -78,7 +78,7 @@ public:
Delete(temp);
}
void set_name(const String_or_char *cn, const String_or_char *rn, const String_or_char *valn) {
void set_name(const_String_or_char_ptr cn, const_String_or_char_ptr rn, const_String_or_char_ptr valn) {
/* Original C/C++ class (or struct) name */
Clear(cname);
Append(cname, cn);
@ -104,7 +104,7 @@ public:
Printv(prefix, (rn ? rn : cn), "_", NIL);
}
char *strip(const String_or_char *s) {
char *strip(const_String_or_char_ptr s) {
Clear(temp);
Append(temp, s);
if (Strncmp(s, prefix, Len(prefix)) == 0) {
@ -1228,7 +1228,7 @@ public:
/**
* Process the comma-separated list of aliases (if any).
*/
void defineAliases(Node *n, const String_or_char *iname) {
void defineAliases(Node *n, const_String_or_char_ptr iname) {
String *aliasv = Getattr(n, "feature:alias");
if (aliasv) {
List *aliases = Split(aliasv, ',', INT_MAX);
@ -1262,7 +1262,7 @@ public:
* as another instance of the same class.
* --------------------------------------------------------------------- */
void create_command(Node *n, const String_or_char *iname) {
void create_command(Node *n, const_String_or_char_ptr iname) {
String *alloc_func = Swig_name_wrapper(iname);
String *wname = Swig_name_wrapper(iname);
@ -2566,7 +2566,7 @@ public:
/* First wrap the allocate method */
current = CONSTRUCTOR_ALLOCATE;
Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate");
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate");
Language::constructorHandler(n);
@ -2601,7 +2601,7 @@ public:
Delete(docs);
current = CONSTRUCTOR_INITIALIZE;
Swig_name_register((String_or_char *) "construct", (String_or_char *) "new_%c");
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "new_%c");
Language::constructorHandler(n);
/* Restore original parameter list */
@ -2609,7 +2609,7 @@ public:
Swig_restore(n);
/* Done */
Swig_name_unregister((String_or_char *) "construct");
Swig_name_unregister((const_String_or_char_ptr ) "construct");
current = NO_CPP;
klass->constructor_defined = 1;
return SWIG_OK;
@ -2623,7 +2623,7 @@ public:
/* First wrap the allocate method */
current = CONSTRUCTOR_ALLOCATE;
Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate");
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate");
return Language::copyconstructorHandler(n);
}

View file

@ -313,7 +313,7 @@ int SWIG_main(int, char **, Language *);
void emit_parameter_variables(ParmList *l, Wrapper *f);
void emit_return_variable(Node *n, SwigType *rt, Wrapper *f);
void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */
void SWIG_config_file(const String_or_char *);
void SWIG_config_file(const_String_or_char_ptr );
const String *SWIG_output_directory();
void SWIG_config_cppext(const char *ext);
@ -329,17 +329,17 @@ void emit_mark_varargs(ParmList *l);
String *emit_action(Node *n);
int emit_action_code(Node *n, String *wrappercode, String *action);
void Swig_overload_check(Node *n);
String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *);
String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *);
String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *);
String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *);
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *);
String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *);
SwigType *cplus_value_type(SwigType *t);
/* directors.cxx start */
String *Swig_csuperclass_call(String *base, String *method, ParmList *l);
String *Swig_class_declaration(Node *n, String *name);
String *Swig_class_name(Node *n);
String *Swig_method_call(String_or_char *name, ParmList *parms);
String *Swig_method_decl(SwigType *rtype, SwigType *decl, const String_or_char *id, List *args, int strip, int values);
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms);
String *Swig_method_decl(SwigType *rtype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values);
String *Swig_director_declaration(Node *n);
void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f);
/* directors.cxx end */

View file

@ -131,7 +131,7 @@ static void add_defined_foreign_type(String *type) {
}
static String *get_ffi_type(SwigType *ty, const String_or_char *name) {
static String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0);
if (typemap) {
String *typespec = Getattr(typemap, "code");
@ -167,7 +167,7 @@ static String *get_ffi_type(SwigType *ty, const String_or_char *name) {
return 0;
}
static String *get_lisp_type(SwigType *ty, const String_or_char *name) {
static String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0);
if (typemap) {
String *typespec = Getattr(typemap, "code");

View file

@ -74,7 +74,7 @@ static void copy_location(const DOH *s1, DOH *s2) {
Setline(s2, Getline((DOH *) s1));
}
static String *cpp_include(String_or_char *fn, int sysfile) {
static String *cpp_include(const_String_or_char_ptr fn, int sysfile) {
String *s = sysfile ? Swig_include_sys(fn) : Swig_include(fn);
if (s && single_include) {
String *file = Getfile(s);
@ -261,8 +261,9 @@ void Preprocessor_error_as_warning(int a) {
* ----------------------------------------------------------------------------- */
String_or_char *Macro_vararg_name(String_or_char *str, String_or_char *line) {
String_or_char *argname, *varargname;
const_String_or_char_ptr Macro_vararg_name(const_String_or_char_ptr str, const_String_or_char_ptr line) {
String *argname;
String *varargname;
char *s, *dots;
argname = Copy(str);
@ -288,13 +289,13 @@ String_or_char *Macro_vararg_name(String_or_char *str, String_or_char *line) {
return varargname;
}
Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
Hash *Preprocessor_define(const_String_or_char_ptr _str, int swigmacro) {
String *macroname = 0, *argstr = 0, *macrovalue = 0, *file = 0, *s = 0;
Hash *macro = 0, *symbols = 0, *m1;
List *arglist = 0;
int c, line;
int varargs = 0;
String_or_char *str = (String_or_char *) _str;
const_String_or_char_ptr str = (const_String_or_char_ptr ) _str;
assert(cpp);
assert(str);
@ -532,7 +533,7 @@ macro_error:
*
* Undefines a macro.
* ----------------------------------------------------------------------------- */
void Preprocessor_undef(const String_or_char *str) {
void Preprocessor_undef(const_String_or_char_ptr str) {
Hash *symbols;
assert(cpp);
symbols = Getattr(cpp, kpp_symbols);

View file

@ -19,8 +19,8 @@ extern "C" {
#endif
extern int Preprocessor_expr(String *s, int *error);
extern char *Preprocessor_expr_error(void);
extern Hash *Preprocessor_define(const String_or_char *str, int swigmacro);
extern void Preprocessor_undef(const String_or_char *name);
extern Hash *Preprocessor_define(const_String_or_char_ptr str, int swigmacro);
extern void Preprocessor_undef(const_String_or_char_ptr name);
extern void Preprocessor_init(void);
extern void Preprocessor_delete(void);
extern String *Preprocessor_parse(String *s);

View file

@ -45,7 +45,7 @@ String *Swig_cparm_name(Parm *p, int i) {
* and user defined types to pointers.
* ----------------------------------------------------------------------------- */
static String *Swig_clocal(SwigType *t, const String_or_char *name, const String_or_char *value) {
static String *Swig_clocal(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr value) {
String *decl;
decl = NewStringEmpty();
@ -147,7 +147,7 @@ String *Swig_wrapped_member_var_type(SwigType *t, int varcref) {
}
static String *Swig_wrapped_var_deref(SwigType *t, String_or_char *name, int varcref) {
static String *Swig_wrapped_var_deref(SwigType *t, const_String_or_char_ptr name, int varcref) {
if (SwigType_isclass(t)) {
if (varcref) {
if (cparse_cplusplus) {
@ -163,7 +163,7 @@ static String *Swig_wrapped_var_deref(SwigType *t, String_or_char *name, int var
}
}
static String *Swig_wrapped_var_assign(SwigType *t, const String_or_char *name, int varcref) {
static String *Swig_wrapped_var_assign(SwigType *t, const_String_or_char_ptr name, int varcref) {
if (SwigType_isclass(t)) {
if (varcref) {
return NewStringf("%s", name);
@ -251,7 +251,7 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
* function call.
* ----------------------------------------------------------------------------- */
String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl) {
String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr decl) {
String *fcall;
fcall = NewStringEmpty();
@ -309,7 +309,7 @@ String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_ch
*
* ----------------------------------------------------------------------------- */
String *Swig_cfunction_call(String_or_char *name, ParmList *parms) {
String *Swig_cfunction_call(const_String_or_char_ptr name, ParmList *parms) {
String *func;
int i = 0;
int comma = 0;
@ -376,7 +376,7 @@ String *Swig_cfunction_call(String_or_char *name, ParmList *parms) {
* set to "(*this)->" or some similar sequence.
* ----------------------------------------------------------------------------- */
static String *Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self, String *explicit_qualifier, SwigType *director_type) {
static String *Swig_cmethod_call(const_String_or_char_ptr name, ParmList *parms, const_String_or_char_ptr self, String *explicit_qualifier, SwigType *director_type) {
String *func, *nname;
int i = 0;
Parm *p = parms;
@ -468,7 +468,7 @@ static String *Swig_cmethod_call(String_or_char *name, ParmList *parms, String_o
* calloc(1,sizeof(name));
* ----------------------------------------------------------------------------- */
String *Swig_cconstructor_call(String_or_char *name) {
String *Swig_cconstructor_call(const_String_or_char_ptr name) {
DOH *func;
func = NewStringEmpty();
@ -487,7 +487,7 @@ String *Swig_cconstructor_call(String_or_char *name) {
*
* ----------------------------------------------------------------------------- */
String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int skip_self) {
String *Swig_cppconstructor_base_call(const_String_or_char_ptr name, ParmList *parms, int skip_self) {
String *func;
String *nname;
int i = 0;
@ -532,15 +532,15 @@ String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int
return func;
}
String *Swig_cppconstructor_call(String_or_char *name, ParmList *parms) {
String *Swig_cppconstructor_call(const_String_or_char_ptr name, ParmList *parms) {
return Swig_cppconstructor_base_call(name, parms, 0);
}
String *Swig_cppconstructor_nodirector_call(String_or_char *name, ParmList *parms) {
String *Swig_cppconstructor_nodirector_call(const_String_or_char_ptr name, ParmList *parms) {
return Swig_cppconstructor_base_call(name, parms, 1);
}
String *Swig_cppconstructor_director_call(String_or_char *name, ParmList *parms) {
String *Swig_cppconstructor_director_call(const_String_or_char_ptr name, ParmList *parms) {
return Swig_cppconstructor_base_call(name, parms, 0);
}
@ -683,7 +683,7 @@ String *Swig_cppdestructor_call(Node *n) {
*
* ----------------------------------------------------------------------------- */
String *Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self, int varcref) {
String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, const_String_or_char_ptr self, int varcref) {
String *func;
String *pname0 = Swig_cparm_name(0, 0);
String *pname1 = Swig_cparm_name(0, 1);
@ -718,7 +718,7 @@ String *Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_cha
*
* ----------------------------------------------------------------------------- */
String *Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self, int varcref) {
String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, const_String_or_char_ptr self, int varcref) {
String *func;
String *call;
String *pname0 = Swig_cparm_name(0, 0);

Some files were not shown because too many files have changed in this diff Show more