summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2010-04-01 18:33:27 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2010-04-01 18:33:27 +0000
commitb6c4ea90b64c9968b53000a2276824b476872a23 (patch)
treea8ebf74a5bd012095974f22f2fea70694a537ff6 /Source
parent2a1a4309677e4574810e158335fdc868f2bc2db6 (diff)
downloadswig-b6c4ea90b64c9968b53000a2276824b476872a23.tar.gz
remove old default SWIGTYPE reduction code
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11960 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Source')
-rw-r--r--Source/Swig/stype.c218
-rw-r--r--Source/Swig/swig.h2
2 files changed, 1 insertions, 219 deletions
diff --git a/Source/Swig/stype.c b/Source/Swig/stype.c
index 079fa07fe..7594a6ad6 100644
--- a/Source/Swig/stype.c
+++ b/Source/Swig/stype.c
@@ -275,224 +275,6 @@ int SwigType_issimple(SwigType *t) {
}
/* -----------------------------------------------------------------------------
- * SwigType_default()
- *
- * Create the default string for this datatype. This takes a type and strips it
- * down to its most primitive form--resolving all typedefs and removing operators.
- *
- * Rules:
- * Pointers: p.SWIGTYPE
- * References: r.SWIGTYPE
- * Arrays: a().SWIGTYPE
- * Types: SWIGTYPE
- * MemberPointer: m(CLASS).SWIGTYPE
- * Enums: enum SWIGTYPE
- *
- * Note: if this function is applied to a primitive type, it returns NULL. This
- * allows recursive application for special types like arrays.
- * ----------------------------------------------------------------------------- */
-
-#ifdef SWIG_DEFAULT_CACHE
-static Hash *default_cache = 0;
-#endif
-
-#define SWIG_NEW_TYPE_DEFAULT
-/* The new default type resolution method:
-
-1.- It preserves the original mixed types, then it goes 'backward'
- first deleting the qualifier, then the inner types
-
- typedef A *Aptr;
- const Aptr&;
- r.q(const).Aptr -> r.q(const).p.SWIGTYPE
- r.q(const).p.SWIGTYPE -> r.p.SWIGTYPE
- r.p.SWIGTYPE -> r.SWIGTYPE
- r.SWIGTYPE -> SWIGTYPE
-
-
- enum Hello {};
- const Hello& hi;
- r.q(const).Hello -> r.q(const).enum SWIGTYPE
- r.q(const).enum SWIGTYPE -> r.enum SWIGTYPE
- r.enum SWIGTYPE -> r.SWIGTYPE
- r.SWIGTYPE -> SWIGTYPE
-
- int a[2][4];
- a(2).a(4).int -> a(ANY).a(ANY).SWIGTYPE
- a(ANY).a(ANY).SWIGTYPE -> a(ANY).a().SWIGTYPE
- a(ANY).a().SWIGTYPE -> a(ANY).p.SWIGTYPE
- a(ANY).p.SWIGTYPE -> a(ANY).SWIGTYPE
- a(ANY).SWIGTYPE -> a().SWIGTYPE
- a().SWIGTYPE -> p.SWIGTYPE
- p.SWIGTYPE -> SWIGTYPE
-*/
-
-static
-void SwigType_add_default(String *def, SwigType *nr) {
- if (Strcmp(nr, "SWIGTYPE") == 0) {
- Append(def, "SWIGTYPE");
- } else {
- String *q = SwigType_isqualifier(nr) ? SwigType_pop(nr) : 0;
- if (q && strstr(Char(nr), "SWIGTYPE")) {
- Append(def, nr);
- } else {
- String *nd = SwigType_default(nr);
- if (nd) {
- String *bdef = nd;
- if (q) {
- bdef = NewStringf("%s%s", q, nd);
- if ((Strcmp(nr, bdef) == 0)) {
- Delete(bdef);
- bdef = nd;
- } else {
- Delete(nd);
- }
- }
- Append(def, bdef);
- Delete(bdef);
- } else {
- Append(def, nr);
- }
- }
- Delete(q);
- }
-}
-
-
-SwigType *SwigType_default(SwigType *t) {
- String *r1, *def;
- String *r = 0;
- char *cr;
-
-#ifdef SWIG_DEFAULT_CACHE
- if (!default_cache)
- default_cache = NewHash();
-
- r = Getattr(default_cache, t);
- if (r) {
- return Copy(r);
- }
-#endif
-
- if (SwigType_isvarargs(t)) {
- return 0;
- }
-
- r = t;
- while ((r1 = SwigType_typedef_resolve(r))) {
- if (r != t)
- Delete(r);
- r = r1;
- }
- if (SwigType_isqualifier(r)) {
- String *q;
- if (r == t)
- r = Copy(t);
- q = SwigType_pop(r);
- if (strstr(Char(r), "SWIGTYPE")) {
- Delete(q);
- def = r;
- return def;
- }
- Delete(q);
- }
- cr = Char(r);
- if (strcmp(cr, "p.SWIGTYPE") == 0) {
- def = NewString("SWIGTYPE");
- } else if (SwigType_ispointer(r)) {
-#ifdef SWIG_NEW_TYPE_DEFAULT
- SwigType *nr = Copy(r);
- SwigType_del_pointer(nr);
- def = SwigType_isfunction(nr) ? NewStringEmpty() : NewString("p.");
- SwigType_add_default(def, nr);
- Delete(nr);
-#else
- def = NewString("p.SWIGTYPE");
-#endif
- } else if (strcmp(cr, "r.SWIGTYPE") == 0) {
- def = NewString("SWIGTYPE");
- } else if (SwigType_isreference(r)) {
-#ifdef SWIG_NEW_TYPE_DEFAULT
- SwigType *nr = Copy(r);
- SwigType_del_reference(nr);
- def = NewString("r.");
- SwigType_add_default(def, nr);
- Delete(nr);
-#else
- def = NewString("r.SWIGTYPE");
-#endif
- } else if (SwigType_isarray(r)) {
- if (strcmp(cr, "a().SWIGTYPE") == 0) {
- def = NewString("p.SWIGTYPE");
- } else if (strcmp(cr, "a(ANY).SWIGTYPE") == 0) {
- def = NewString("a().SWIGTYPE");
- } else {
- int i, empty = 0;
- int ndim = SwigType_array_ndim(r);
- SwigType *nr = Copy(r);
- for (i = 0; i < ndim; i++) {
- String *dim = SwigType_array_getdim(r, i);
- if (!Len(dim)) {
- char *c = Char(nr);
- empty = strstr(c, "a(ANY).") != c;
- }
- Delete(dim);
- }
- if (empty) {
- def = NewString("a().");
- } else {
- def = NewString("a(ANY).");
- }
-#ifdef SWIG_NEW_TYPE_DEFAULT
- SwigType_del_array(nr);
- SwigType_add_default(def, nr);
-#else
- Append(def, "SWIGTYPE");
-#endif
- Delete(nr);
- }
- } else if (SwigType_ismemberpointer(r)) {
- if (strcmp(cr, "m(CLASS).SWIGTYPE") == 0) {
- def = NewString("p.SWIGTYPE");
- } else {
- def = NewString("m(CLASS).SWIGTYPE");
- }
- } else if (SwigType_isenum(r)) {
- if (strcmp(cr, "enum SWIGTYPE") == 0) {
- def = NewString("SWIGTYPE");
- } else {
- def = NewString("enum SWIGTYPE");
- }
- } else if (SwigType_isfunction(r)) {
- if (strcmp(cr, "f(ANY).SWIGTYPE") == 0) {
- def = NewString("p.SWIGTYPE");
- } else {
- def = NewString("p.f(ANY).SWIGTYPE");
- }
- } else {
- def = NewString("SWIGTYPE");
- }
- if (r != t)
- Delete(r);
- if (Equal(def, t)) {
- Delete(def);
- def = 0;
- }
-#ifdef SWIG_DEFAULT_CACHE
- /* The cache produces strange results, see enum_template.i case */
- if (def) {
- String *cdef = Copy(def);
- Setattr(default_cache, t, cdef);
- Delete(cdef);
- }
-#endif
-
- /* Printf(stderr,"type : def %s : %s\n", t, def); */
-
- return def;
-}
-
-/* -----------------------------------------------------------------------------
* SwigType_default_create()
*
* Create the default type for this datatype. This takes a type and strips it
diff --git a/Source/Swig/swig.h b/Source/Swig/swig.h
index 6228b2f43..cf94acfa8 100644
--- a/Source/Swig/swig.h
+++ b/Source/Swig/swig.h
@@ -37,7 +37,7 @@ extern "C" {
/* Global macros */
#define NSPACE_SEPARATOR "." /* Namespace separator for the nspace feature - this should be changed to a target language configurable variable */
-#define NSPACE_TODO 0 /* temporary TODO hack */
+#define NSPACE_TODO 0 /* Languages that still need to implement and test the nspace feature use this */
/* Short names for common data types */