more warning fixes, cosmetics, and uniformity changes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7006 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-02-26 08:47:17 +00:00
commit e38ce2b2c3
5 changed files with 106 additions and 89 deletions

View file

@ -41,22 +41,24 @@ typedef SCM (*swig_guile_proc)();
(char *) FUNC_NAME, (char *) msg, \ (char *) FUNC_NAME, (char *) msg, \
SCM_EOL, SCM_BOOL_F); else SCM_EOL, SCM_BOOL_F); else
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) #ifndef SWIGEXPORT
# if defined(_MSC_VER) || defined(__GNUC__) # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if defined(STATIC_LINKED) # if defined(_MSC_VER) || defined(__GNUC__)
# define SWIGEXPORT(a) a # if defined(STATIC_LINKED)
# else # define SWIGEXPORT(a) a
# define SWIGEXPORT(a) __declspec(dllexport) a # else
# endif # define SWIGEXPORT(a) __declspec(dllexport) a
# else # endif
# if defined(__BORLANDC__) # else
# define SWIGEXPORT(a) a _export # if defined(__BORLANDC__)
# else # define SWIGEXPORT(a) a _export
# define SWIGEXPORT(a) a # else
# endif # define SWIGEXPORT(a) a
# endif # endif
#else # endif
# define SWIGEXPORT(a) a # else
# define SWIGEXPORT(a) a
# endif
#endif #endif
/* SCM_CHAR and SCM_CHARP were introduced in Guile 1.4; the following is for /* SCM_CHAR and SCM_CHARP were introduced in Guile 1.4; the following is for

View file

@ -121,27 +121,28 @@ SWIGINTERN PyTypeObject varlinktype = {
/* Create a variable linking object for use later */ /* Create a variable linking object for use later */
SWIGINTERN PyObject * SWIGINTERN PyObject *
SWIG_Python_newvarlink(void) { SWIG_Python_newvarlink(void) {
swig_varlinkobject *result = 0; swig_varlinkobject *result = PyMem_NEW(swig_varlinkobject,1);
result = PyMem_NEW(swig_varlinkobject,1); if (result) {
varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */ varlinktype.ob_type = &PyType_Type; /* Patch varlinktype into a PyType */
result->ob_type = &varlinktype; result->ob_type = &varlinktype;
result->vars = 0; result->vars = 0;
result->ob_refcnt = 0; result->ob_refcnt = 0;
Py_XINCREF((PyObject *) result); Py_INCREF((PyObject *) result);
}
return ((PyObject*) result); return ((PyObject*) result);
} }
SWIGINTERN void SWIGINTERN void
SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) { SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
swig_varlinkobject *v; swig_varlinkobject *v = (swig_varlinkobject *) p;
swig_globalvar *gv; swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
v= (swig_varlinkobject *) p; if (gv) {
gv = (swig_globalvar *) malloc(sizeof(swig_globalvar)); gv->name = (char *) malloc(strlen(name)+1);
gv->name = (char *) malloc(strlen(name)+1); strcpy(gv->name,name);
strcpy(gv->name,name); gv->get_attr = get_attr;
gv->get_attr = get_attr; gv->set_attr = set_attr;
gv->set_attr = set_attr; gv->next = v->vars;
gv->next = v->vars; }
v->vars = gv; v->vars = gv;
} }

View file

@ -201,7 +201,7 @@ PySwigObject_GetType() {
(ternaryfunc)0, /*tp_call*/ (ternaryfunc)0, /*tp_call*/
(reprfunc)PySwigObject_str, /*tp_str*/ (reprfunc)PySwigObject_str, /*tp_str*/
/* Space for future expansion */ /* Space for future expansion */
0L,0L,0L,0L, 0,0,0,0,
PySwigObject_Type__doc__, /* Documentation string */ PySwigObject_Type__doc__, /* Documentation string */
#if PY_VERSION_HEX >= 0x02000000 #if PY_VERSION_HEX >= 0x02000000
0, /* tp_traverse */ 0, /* tp_traverse */
@ -354,7 +354,7 @@ PySwigPacked_GetType() {
(ternaryfunc)0, /*tp_call*/ (ternaryfunc)0, /*tp_call*/
(reprfunc)PySwigPacked_str, /*tp_str*/ (reprfunc)PySwigPacked_str, /*tp_str*/
/* Space for future expansion */ /* Space for future expansion */
0L,0L,0L,0L, 0,0,0,0,
PySwigPacked_Type__doc__, /* Documentation string */ PySwigPacked_Type__doc__, /* Documentation string */
#if PY_VERSION_HEX >= 0x02000000 #if PY_VERSION_HEX >= 0x02000000
0, /* tp_traverse */ 0, /* tp_traverse */
@ -605,7 +605,7 @@ type_error:
char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc); char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
c = doc ? strstr(doc, "swig_ptr: ") : 0; c = doc ? strstr(doc, "swig_ptr: ") : 0;
if (c) { if (c) {
c = SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name); c = ty ? SWIG_UnpackVoidPtr(c + 10, &vptr, ty->name) : 0;
if (!c) goto type_error; if (!c) goto type_error;
goto type_check; goto type_check;
} }
@ -748,7 +748,7 @@ SWIG_Python_GetModule() {
return (swig_module_info *) type_pointer; return (swig_module_info *) type_pointer;
} }
SWIGINTERN void SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info *swig_module) { SWIG_Python_SetModule(swig_module_info *swig_module) {
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */ static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
@ -758,8 +758,7 @@ SWIG_Python_SetModule(swig_module_info *swig_module) {
if (pointer && module) { if (pointer && module) {
PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer); PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
} }
} }
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -473,37 +473,57 @@ static int NAME(TYPE x) {
#endif #endif
%} %}
/*
/* Common labels and attributes for the internal SWIG methods */ Common labels and attributes
*/
%insert("runtime") %{ %insert("runtime") %{
/* inline attribute */ /* inline attribute */
#ifndef SWIGINLINE #ifndef SWIGINLINE
#if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline # define SWIGINLINE inline
#else # else
# define SWIGINLINE # define SWIGINLINE
#endif # endif
#endif #endif
/* attritbute passed for some compilers to avoid unused method warnings */ /* attritbute passed for some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED #ifndef SWIGUNUSED
#ifdef __GNUC__ # if defined(__GNUC__) || defined(__ICC)
#define SWIGUNUSED __attribute__ ((unused)) # define SWIGUNUSED __attribute__ ((unused))
#else # else
#define SWIGUNUSED # define SWIGUNUSED
#endif # endif
#endif #endif
/* internal SWIG method */ /* internal SWIG method */
#ifndef SWIGINTERN #ifndef SWIGINTERN
#define SWIGINTERN static SWIGUNUSED # define SWIGINTERN static SWIGUNUSED
#endif #endif
/* internal inline SWIG method */ /* internal inline SWIG method */
#ifndef SWIGINTERNINLINE #ifndef SWIGINTERNINLINE
#define SWIGINTERNINLINE SWIGINTERN SWIGINLINE # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif #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
%} %}

View file

@ -12,30 +12,34 @@
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE #ifdef SWIG_TYPE_TABLE
#define SWIG_QUOTE_STRING(x) #x # define SWIG_QUOTE_STRING(x) #x
#define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x) # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
#define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE) # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else #else
#define SWIG_TYPE_TABLE_NAME # define SWIG_TYPE_TABLE_NAME
#endif #endif
#include <string.h> /*
We need to define the compiler attributes here again since swigrun.swg
can be exported using -runtime.
*/
/* inline attribute */
#ifndef SWIGINLINE #ifndef SWIGINLINE
#if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__)) # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline # define SWIGINLINE inline
#else # else
# define SWIGINLINE # define SWIGINLINE
#endif # endif
#endif #endif
/* attritbute passed for some compilers to avoid unused method warnings */ /* attritbute passed for some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED #ifndef SWIGUNUSED
#ifdef __GNUC__ # ifdef __GNUC__
#define SWIGUNUSED __attribute__ ((unused)) # define SWIGUNUSED __attribute__ ((unused))
#else # else
#define SWIGUNUSED # define SWIGUNUSED
#endif # endif
#endif #endif
/* /*
@ -48,23 +52,14 @@
*/ */
#ifndef SWIGRUNTIME #ifndef SWIGRUNTIME
#define SWIGRUNTIME static SWIGUNUSED # define SWIGRUNTIME static SWIGUNUSED
#endif #endif
#ifndef SWIGRUNTIMEINLINE #ifndef SWIGRUNTIMEINLINE
#define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if !defined(STATIC_LINKED)
# define SWIGEXPORT(a) __declspec(dllexport) a
# else
# define SWIGEXPORT(a) a
# endif
#else
# define SWIGEXPORT(a) a
#endif #endif
#include <string.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -116,7 +111,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1,
for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) { for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
while ((*f1 == ' ') && (f1 != l1)) ++f1; while ((*f1 == ' ') && (f1 != l1)) ++f1;
while ((*f2 == ' ') && (f2 != l2)) ++f2; while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return *f1 - *f2; if (*f1 != *f2) return (int)(*f1 - *f2);
} }
return (l1 - f1) - (l2 - f2); return (l1 - f1) - (l2 - f2);
} }
@ -134,7 +129,7 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
for (nb = ne; *ne; ++ne) { for (nb = ne; *ne; ++ne) {
if (*ne == '|') break; if (*ne == '|') break;
} }
equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0; equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne; if (*ne) ++ne;
} }
return equiv; return equiv;
@ -153,7 +148,7 @@ SWIG_TypeCompare(const char *nb, const char *tb) {
for (nb = ne; *ne; ++ne) { for (nb = ne; *ne; ++ne) {
if (*ne == '|') break; if (*ne == '|') break;
} }
equiv = SWIG_TypeNameComp(nb, ne, tb, te) == 0; equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
if (*ne) ++ne; if (*ne) ++ne;
} }
return equiv; return equiv;
@ -183,8 +178,8 @@ SWIG_TypeCompare(const char *nb, const char *tb) {
} \ } \
iter = iter->next; \ iter = iter->next; \
} \ } \
return 0; \ } while(0); \
} while(0) return 0
/* /*
Check the typename Check the typename
@ -368,9 +363,9 @@ SWIG_PackData(char *c, void *ptr, size_t sz) {
SWIGRUNTIME const char * SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) { SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
register unsigned char *u = (unsigned char *) ptr; register unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz; register const unsigned char *eu = u + sz;
for (; u != eu; ++u) { for (; u != eu; ++u) {
register int d = *(c++); register char d = *(c++);
register unsigned char uu = 0; register unsigned char uu = 0;
if ((d >= '0') && (d <= '9')) if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4); uu = ((d - '0') << 4);