following Bill's labels patch, we add swiglabels.swg
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7015 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
78607ebbf5
commit
b5875c21bb
5 changed files with 165 additions and 184 deletions
82
Lib/swig.swg
82
Lib/swig.swg
|
|
@ -444,86 +444,6 @@ static int NAME(TYPE x) {
|
||||||
%}
|
%}
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
%insert("runtime") "swiglabels.swg"
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
*
|
|
||||||
* This section contains generic SWIG macros for runtime compiler support.
|
|
||||||
*
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
SWIG_TEMPLATE_DISAMBIGUATOR is needed when wrapping template calls
|
|
||||||
(cwrap.c:Swig_cfunction_call/Swig_cmethod_call), as in
|
|
||||||
|
|
||||||
result = nspace::template function<int >(arg1);
|
|
||||||
result = arg1->template method<int >(arg2);
|
|
||||||
|
|
||||||
SWIG_TEMPLATE_DISAMBIGUATOR is compiler dependent (common.swg),
|
|
||||||
- SUN Studio requires 'template',
|
|
||||||
- gcc-3.4 forbids the use of 'template'.
|
|
||||||
- gcc-3.2.3 produces internal errors if you use 'template'
|
|
||||||
*/
|
|
||||||
%insert("runtime") %{
|
|
||||||
#ifndef SWIG_TEMPLATE_DISAMBIGUATOR
|
|
||||||
# if defined(__SUNPRO_CC)
|
|
||||||
# define SWIG_TEMPLATE_DISAMBIGUATOR template
|
|
||||||
# else
|
|
||||||
# define SWIG_TEMPLATE_DISAMBIGUATOR
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
|
|
||||||
/*
|
|
||||||
Common labels and attributes
|
|
||||||
*/
|
|
||||||
%insert("runtime") %{
|
|
||||||
/* inline attribute */
|
|
||||||
#ifndef SWIGINLINE
|
|
||||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
|
||||||
# define SWIGINLINE inline
|
|
||||||
# else
|
|
||||||
# define SWIGINLINE
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* attritbute passed for some compilers to avoid 'unused' warnings */
|
|
||||||
#ifndef SWIGUNUSED
|
|
||||||
# if defined(__GNUC__) || defined(__ICC)
|
|
||||||
# define SWIGUNUSED __attribute__ ((unused))
|
|
||||||
# else
|
|
||||||
# define SWIGUNUSED
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* internal SWIG method */
|
|
||||||
#ifndef SWIGINTERN
|
|
||||||
# define SWIGINTERN static SWIGUNUSED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* internal inline SWIG method */
|
|
||||||
#ifndef SWIGINTERNINLINE
|
|
||||||
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* how we export a method such that it can go in to a shared or dll library */
|
|
||||||
#ifndef SWIGEXPORT
|
|
||||||
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
|
||||||
# if defined(_MSC_VER) || defined(__GNUC__)
|
|
||||||
# if defined(STATIC_LINKED)
|
|
||||||
# define SWIGEXPORT(a) a
|
|
||||||
# else
|
|
||||||
# define SWIGEXPORT(a) __declspec(dllexport) a
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# if defined(__BORLANDC__)
|
|
||||||
# define SWIGEXPORT(a) a _export
|
|
||||||
# else
|
|
||||||
# define SWIGEXPORT(a) a
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# define SWIGEXPORT(a) a
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
%}
|
|
||||||
|
|
||||||
|
|
|
||||||
75
Lib/swiglabels.swg
Normal file
75
Lib/swiglabels.swg
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
/***********************************************************************
|
||||||
|
*
|
||||||
|
* This section contains generic SWIG labels for method/variable
|
||||||
|
* declarations/attributes, and other compiler dependent labels.
|
||||||
|
*
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
SWIGTEMPLATEDISAMBIGUATOR is needed when wrapping template calls
|
||||||
|
(cwrap.c:Swig_cfunction_call/Swig_cmethod_call), as in
|
||||||
|
|
||||||
|
result = nspace::template function<int >(arg1);
|
||||||
|
result = arg1->template method<int >(arg2);
|
||||||
|
|
||||||
|
SWIGTEMPLATEDISAMBIGUATOR is compiler dependent (common.swg),
|
||||||
|
- SUN Studio requires 'template',
|
||||||
|
- gcc-3.4 forbids the use of 'template'.
|
||||||
|
- gcc-3.2.3 produces internal errors if you use 'template'
|
||||||
|
*/
|
||||||
|
#ifndef SWIGTEMPLATEDISAMBIGUATOR
|
||||||
|
# if defined(__SUNPRO_CC)
|
||||||
|
# define SWIGTEMPLATEDISAMBIGUATOR template
|
||||||
|
# else
|
||||||
|
# define SWIGTEMPLATEDISAMBIGUATOR
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* inline attribute */
|
||||||
|
#ifndef SWIGINLINE
|
||||||
|
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
||||||
|
# define SWIGINLINE inline
|
||||||
|
# else
|
||||||
|
# define SWIGINLINE
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* attritbute passed for some compilers to avoid 'unused' warnings */
|
||||||
|
#ifndef SWIGUNUSED
|
||||||
|
# if defined(__GNUC__) || defined(__ICC)
|
||||||
|
# define SWIGUNUSED __attribute__ ((unused))
|
||||||
|
# else
|
||||||
|
# define SWIGUNUSED
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* internal SWIG method */
|
||||||
|
#ifndef SWIGINTERN
|
||||||
|
# define SWIGINTERN static SWIGUNUSED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* internal inline SWIG method */
|
||||||
|
#ifndef SWIGINTERNINLINE
|
||||||
|
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* how we export a method such that it can go in to a shared or dll library */
|
||||||
|
#ifndef SWIGEXPORT
|
||||||
|
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||||
|
# if defined(_MSC_VER) || defined(__GNUC__)
|
||||||
|
# if defined(STATIC_LINKED)
|
||||||
|
# define SWIGEXPORT(a) a
|
||||||
|
# else
|
||||||
|
# define SWIGEXPORT(a) __declspec(dllexport) a
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# if defined(__BORLANDC__)
|
||||||
|
# define SWIGEXPORT(a) a _export
|
||||||
|
# else
|
||||||
|
# define SWIGEXPORT(a) a
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define SWIGEXPORT(a) a
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
175
Lib/swigrun.swg
175
Lib/swigrun.swg
|
|
@ -19,29 +19,6 @@
|
||||||
# define SWIG_TYPE_TABLE_NAME
|
# define SWIG_TYPE_TABLE_NAME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
We need to define the compiler attributes here again since swigrun.swg
|
|
||||||
can be exported using -runtime.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* inline attribute */
|
|
||||||
#ifndef SWIGINLINE
|
|
||||||
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
|
|
||||||
# define SWIGINLINE inline
|
|
||||||
# else
|
|
||||||
# define SWIGINLINE
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* attritbute passed for some compilers to avoid 'unused' warnings */
|
|
||||||
#ifndef SWIGUNUSED
|
|
||||||
# ifdef __GNUC__
|
|
||||||
# define SWIGUNUSED __attribute__ ((unused))
|
|
||||||
# else
|
|
||||||
# define SWIGUNUSED
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
|
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
|
||||||
creating a static or dynamic library from the swig runtime code.
|
creating a static or dynamic library from the swig runtime code.
|
||||||
|
|
@ -52,7 +29,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SWIGRUNTIME
|
#ifndef SWIGRUNTIME
|
||||||
# define SWIGRUNTIME static SWIGUNUSED
|
# define SWIGRUNTIME SWIGINTERN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SWIGRUNTIMEINLINE
|
#ifndef SWIGRUNTIMEINLINE
|
||||||
|
|
@ -90,7 +67,7 @@ typedef struct swig_cast_info {
|
||||||
* all of these structures and stores them in a circularly linked list.*/
|
* all of these structures and stores them in a circularly linked list.*/
|
||||||
typedef struct swig_module_info {
|
typedef struct swig_module_info {
|
||||||
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
|
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
|
||||||
int size; /* Number of types in this module */
|
size_t size; /* Number of types in this module */
|
||||||
struct swig_module_info *next; /* Pointer to next element in circularly linked list */
|
struct swig_module_info *next; /* Pointer to next element in circularly linked list */
|
||||||
swig_type_info **type_initial; /* Array of initially generated type structures */
|
swig_type_info **type_initial; /* Array of initially generated type structures */
|
||||||
swig_cast_info **cast_initial; /* Array of initially generated casting structures */
|
swig_cast_info **cast_initial; /* Array of initially generated casting structures */
|
||||||
|
|
@ -156,28 +133,25 @@ SWIG_TypeCompare(const char *nb, const char *tb) {
|
||||||
|
|
||||||
|
|
||||||
/* think of this as a c++ template<> or a scheme macro */
|
/* think of this as a c++ template<> or a scheme macro */
|
||||||
#define SWIG_TypeCheck_Template(comparison, ty) \
|
#define SWIG_TypeCheck_Template(comparison, ty) \
|
||||||
if (ty) { \
|
if (ty) { \
|
||||||
swig_cast_info *iter; \
|
swig_cast_info *iter = ty->cast; \
|
||||||
iter = ty->cast; \
|
while (iter) { \
|
||||||
while (iter) { \
|
if (comparison) { \
|
||||||
if (comparison) { \
|
if (iter == ty->cast) return iter; \
|
||||||
if (iter == ty->cast) return iter; \
|
/* Move iter to the top of the linked list */ \
|
||||||
\
|
iter->prev->next = iter->next; \
|
||||||
/* Move iter to the top of the linked list */ \
|
if (iter->next) \
|
||||||
iter->prev->next = iter->next; \
|
iter->next->prev = iter->prev; \
|
||||||
if (iter->next) \
|
iter->next = ty->cast; \
|
||||||
iter->next->prev = iter->prev; \
|
iter->prev = 0; \
|
||||||
iter->next = ty->cast; \
|
if (ty->cast) ty->cast->prev = iter; \
|
||||||
iter->prev = 0; \
|
ty->cast = iter; \
|
||||||
if (ty->cast) ty->cast->prev = iter; \
|
return iter; \
|
||||||
ty->cast = iter; \
|
} \
|
||||||
\
|
iter = iter->next; \
|
||||||
return iter; \
|
} \
|
||||||
} \
|
} \
|
||||||
iter = iter->next; \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -250,17 +224,16 @@ SWIG_TypePrettyName(const swig_type_info *type) {
|
||||||
*/
|
*/
|
||||||
SWIGRUNTIME void
|
SWIGRUNTIME void
|
||||||
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
||||||
swig_cast_info *cast;
|
if (!ti->clientdata) {
|
||||||
|
swig_cast_info *cast = ti->cast;
|
||||||
if (ti->clientdata) return;
|
/* if (ti->clientdata == clientdata) return; */
|
||||||
/* if (ti->clientdata == clientdata) return; */
|
ti->clientdata = clientdata;
|
||||||
ti->clientdata = clientdata;
|
|
||||||
|
while (cast) {
|
||||||
cast = ti->cast;
|
if (!cast->converter)
|
||||||
while (cast) {
|
SWIG_TypeClientData(cast->type, clientdata);
|
||||||
if (!cast->converter)
|
cast = cast->next;
|
||||||
SWIG_TypeClientData(cast->type, clientdata);
|
}
|
||||||
cast = cast->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -276,29 +249,35 @@ SWIGRUNTIME swig_type_info *
|
||||||
SWIG_MangledTypeQueryModule(swig_module_info *start,
|
SWIG_MangledTypeQueryModule(swig_module_info *start,
|
||||||
swig_module_info *end,
|
swig_module_info *end,
|
||||||
const char *name) {
|
const char *name) {
|
||||||
swig_module_info *iter;
|
swig_module_info *iter = start;
|
||||||
int l, r, i, compare;
|
|
||||||
|
|
||||||
iter = start;
|
|
||||||
do {
|
do {
|
||||||
l = 0;
|
if (iter->size) {
|
||||||
r = iter->size - 1;
|
register size_t l = 0;
|
||||||
while (l <= r) {
|
register size_t r = iter->size - 1;
|
||||||
i = (l + r) / 2;
|
do {
|
||||||
|
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
|
||||||
if (!(iter->types[i]->name)) break; /* should never happen */
|
register size_t i = (l + r) >> 1;
|
||||||
|
const char *iname = iter->types[i]->name;
|
||||||
compare = strcmp(name, iter->types[i]->name);
|
if (iname) {
|
||||||
if (compare == 0)
|
register int compare = strcmp(name, iname);
|
||||||
return iter->types[i];
|
if (compare == 0) {
|
||||||
else if (compare < 0)
|
return iter->types[i];
|
||||||
r = i - 1;
|
} else if (compare < 0) {
|
||||||
else if (compare > 0)
|
if (i) {
|
||||||
l = i + 1;
|
r = i - 1;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (compare > 0) {
|
||||||
|
l = i + 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
break; /* should never happen */
|
||||||
|
}
|
||||||
|
} while (l <= r);
|
||||||
}
|
}
|
||||||
iter = iter->next;
|
iter = iter->next;
|
||||||
} while (iter != end);
|
} while (iter != end);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -315,24 +294,23 @@ SWIGRUNTIME swig_type_info *
|
||||||
SWIG_TypeQueryModule(swig_module_info *start,
|
SWIG_TypeQueryModule(swig_module_info *start,
|
||||||
swig_module_info *end,
|
swig_module_info *end,
|
||||||
const char *name) {
|
const char *name) {
|
||||||
swig_module_info *iter;
|
|
||||||
swig_type_info *ret;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* STEP 1: Search the name field using binary search */
|
/* STEP 1: Search the name field using binary search */
|
||||||
ret = SWIG_MangledTypeQueryModule(start, end, name);
|
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
|
||||||
if (ret) return ret;
|
if (ret) {
|
||||||
|
return ret;
|
||||||
/* STEP 2: If the type hasn't been found, do a complete search
|
} else {
|
||||||
of the str field (the human readable name) */
|
/* STEP 2: If the type hasn't been found, do a complete search
|
||||||
iter = start;
|
of the str field (the human readable name) */
|
||||||
do {
|
swig_module_info *iter = start;
|
||||||
for (i = 0; i < iter->size; ++i) {
|
do {
|
||||||
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
|
register size_t i = 0;
|
||||||
return iter->types[i];
|
for (; i < iter->size; ++i) {
|
||||||
}
|
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
|
||||||
iter = iter->next;
|
return iter->types[i];
|
||||||
} while (iter != end);
|
}
|
||||||
|
iter = iter->next;
|
||||||
|
} while (iter != end);
|
||||||
|
}
|
||||||
|
|
||||||
/* neither found a match */
|
/* neither found a match */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -344,12 +322,11 @@ SWIG_TypeQueryModule(swig_module_info *start,
|
||||||
*/
|
*/
|
||||||
SWIGRUNTIME char *
|
SWIGRUNTIME char *
|
||||||
SWIG_PackData(char *c, void *ptr, size_t sz) {
|
SWIG_PackData(char *c, void *ptr, size_t sz) {
|
||||||
static char hex[17] = "0123456789abcdef";
|
static const char hex[17] = "0123456789abcdef";
|
||||||
unsigned char *u = (unsigned char *) ptr;
|
register const unsigned char *u = (unsigned char *) ptr;
|
||||||
const unsigned char *eu = u + sz;
|
register const unsigned char *eu = u + sz;
|
||||||
register unsigned char uu;
|
|
||||||
for (; u != eu; ++u) {
|
for (; u != eu; ++u) {
|
||||||
uu = *u;
|
register unsigned char uu = *u;
|
||||||
*(c++) = hex[(uu & 0xf0) >> 4];
|
*(c++) = hex[(uu & 0xf0) >> 4];
|
||||||
*(c++) = hex[uu & 0xf];
|
*(c++) = hex[uu & 0xf];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,15 @@ static void SWIG_dump_runtime() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Swig_banner(runtime);
|
Swig_banner(runtime);
|
||||||
|
|
||||||
|
s = Swig_include_sys("swiglabels.swg");
|
||||||
|
if (!s) {
|
||||||
|
Printf(stderr, "*** Unable to open 'swiglabels.swg'\n");
|
||||||
|
Close(runtime);
|
||||||
|
SWIG_exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
Printf(runtime, "%s", s);
|
||||||
|
Delete(s);
|
||||||
|
|
||||||
s = Swig_include_sys("swigrun.swg");
|
s = Swig_include_sys("swigrun.swg");
|
||||||
if (!s) {
|
if (!s) {
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
||||||
nname = SwigType_namestr(name);
|
nname = SwigType_namestr(name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SWIG_TEMPLATE_DISAMBIGUATOR is compiler dependent (common.swg),
|
SWIGTEMPLATEDISAMBIGUATOR is compiler dependent (swiglabels.swg),
|
||||||
- SUN Studio 9 requires 'template',
|
- SUN Studio 9 requires 'template',
|
||||||
- gcc-3.4 forbids the use of 'template'.
|
- gcc-3.4 forbids the use of 'template'.
|
||||||
the rest seems not caring very much,
|
the rest seems not caring very much,
|
||||||
|
|
@ -290,7 +290,7 @@ Swig_cfunction_call(String_or_char *name, ParmList *parms) {
|
||||||
if (!prefix || Len(prefix) == 0) {
|
if (!prefix || Len(prefix) == 0) {
|
||||||
Printf(func,"%s(", last);
|
Printf(func,"%s(", last);
|
||||||
} else {
|
} else {
|
||||||
Printf(func,"%s::SWIG_TEMPLATE_DISAMBIGUATOR %s(", prefix, last);
|
Printf(func,"%s::SWIGTEMPLATEDISAMBIGUATOR %s(", prefix, last);
|
||||||
}
|
}
|
||||||
Delete(prefix);
|
Delete(prefix);
|
||||||
Delete(last);
|
Delete(last);
|
||||||
|
|
@ -360,13 +360,13 @@ Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SWIG_TEMPLATE_DESIMBUAGATOR is compiler dependent (common.swg),
|
SWIGTEMPLATEDESIMBUAGATOR is compiler dependent (swiglabels.swg),
|
||||||
- SUN Studio 9 requires 'template',
|
- SUN Studio 9 requires 'template',
|
||||||
- gcc-3.4 forbids the use of 'template'.
|
- gcc-3.4 forbids the use of 'template'.
|
||||||
the rest seems not caring very much,
|
the rest seems not caring very much,
|
||||||
*/
|
*/
|
||||||
if (SwigType_istemplate(name)) {
|
if (SwigType_istemplate(name)) {
|
||||||
Printf(func,"SWIG_TEMPLATE_DISAMBIGUATOR %s(", nname);
|
Printf(func,"SWIGTEMPLATEDISAMBIGUATOR %s(", nname);
|
||||||
} else {
|
} else {
|
||||||
Printf(func,"%s(", nname);
|
Printf(func,"%s(", nname);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue