On Mon, Jun 15, 2015 at 12:19:58PM -0700, Ivan Raikov wrote:
> I am not sure SWIG ever worked in Chicken 4, and furthermore I am not
> sure SWIG itself is that well maintained.
> At this point Chicken provides a number of good tools for FFI, so
> there really is no point in trying to support SWIG.

There seems to be concensus on removing SWIG, so I've made a patch to
remove support in CHICKEN 5.  Find it attached.

If I understand correctly, there is no need to deprecate it first
because nobody is using it (and CHICKEN 5 breaks backwards compat
anyway), and there are no bootstrapping issues because CHICKEN itself
never generated calls to the SWIG C functions in the first place.

Cheers,
Peter
From e180a658b2628cd6afd7b3ae88dab8106db4035b Mon Sep 17 00:00:00 2001
From: Peter Bex <pe...@more-magic.net>
Date: Sun, 9 Aug 2015 13:53:06 +0200
Subject: [PATCH] Remove support for SWIG.

The upstream documentation still references various CHICKEN 2.x or even
1.x features, there are no tests for SWIG and nobody seems to be using
it.  It is just dead-weight, bitrotted code to us which adds a
maintenance burden so it's better to officially drop support.
---
 NEWS                |  1 +
 chicken.h           | 11 +++--------
 library.scm         | 23 ++++++++++-------------
 manual/C interface  |  6 ------
 manual/Unit lolevel |  6 +-----
 runtime.c           | 24 +++---------------------
 6 files changed, 18 insertions(+), 53 deletions(-)

diff --git a/NEWS b/NEWS
index f12101e..077498a 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@
     These are now available as eggs.
   - Added the `executable-pathname` procedure for retrieving a path to
     the currently-running executable.
+  - Removed all support for SWIG.
 
 - Module system
   - The compiler has been modularised, for improved namespacing.  This
diff --git a/chicken.h b/chicken.h
index ecd4203..a27080e 100644
--- a/chicken.h
+++ b/chicken.h
@@ -464,7 +464,7 @@ static inline int isinf_ld (long double x)
 # define C_POINTER_TYPE           (0x0900000000000000L | C_SPECIALBLOCK_BIT)
 # define C_LOCATIVE_TYPE          (0x0a00000000000000L | C_SPECIALBLOCK_BIT)
 # define C_TAGGED_POINTER_TYPE    (0x0b00000000000000L | C_SPECIALBLOCK_BIT)
-# define C_SWIG_POINTER_TYPE      (0x0c00000000000000L | C_SPECIALBLOCK_BIT)
+/*       unused                   (0x0c00000000000000L ...) */
 # define C_LAMBDA_INFO_TYPE       (0x0d00000000000000L | C_BYTEBLOCK_BIT)
 /*       unused                   (0x0e00000000000000L ...) */
 # define C_BUCKET_TYPE            (0x0f00000000000000L)
@@ -494,7 +494,7 @@ static inline int isinf_ld (long double x)
 # define C_POINTER_TYPE           (0x09000000 | C_SPECIALBLOCK_BIT)
 # define C_LOCATIVE_TYPE          (0x0a000000 | C_SPECIALBLOCK_BIT)
 # define C_TAGGED_POINTER_TYPE    (0x0b000000 | C_SPECIALBLOCK_BIT)
-# define C_SWIG_POINTER_TYPE      (0x0c000000 | C_SPECIALBLOCK_BIT)
+/*       unused                   (0x0c000000 ...) */
 # define C_LAMBDA_INFO_TYPE       (0x0d000000 | C_BYTEBLOCK_BIT)
 /*       unused                   (0x0e000000 ...) */
 # define C_BUCKET_TYPE            (0x0f000000)
@@ -514,7 +514,6 @@ static inline int isinf_ld (long double x)
 #endif
 #define C_SIZEOF_POINTER          2
 #define C_SIZEOF_TAGGED_POINTER   3
-#define C_SIZEOF_SWIG_POINTER     3
 #define C_SIZEOF_VECTOR(n)        ((n) + 1)
 #define C_SIZEOF_BUCKET           3
 #define C_SIZEOF_LOCATIVE         5
@@ -534,7 +533,6 @@ static inline int isinf_ld (long double x)
 #define C_POINTER_TAG             (C_POINTER_TYPE | (C_SIZEOF_POINTER - 1))
 #define C_LOCATIVE_TAG            (C_LOCATIVE_TYPE | (C_SIZEOF_LOCATIVE - 1))
 #define C_TAGGED_POINTER_TAG      (C_TAGGED_POINTER_TYPE | (C_SIZEOF_TAGGED_POINTER - 1))
-#define C_SWIG_POINTER_TAG        (C_SWIG_POINTER_TYPE | (C_wordstobytes(C_SIZEOF_SWIG_POINTER - 1)))
 #define C_SYMBOL_TAG              (C_SYMBOL_TYPE | (C_SIZEOF_SYMBOL - 1))
 #define C_FLONUM_TAG              (C_FLONUM_TYPE | sizeof(double))
 #define C_STRUCTURE3_TAG          (C_STRUCTURE_TYPE | 3)
@@ -1251,9 +1249,8 @@ DECL_C_PROC_p0 (128,  1,0,0,0,0,0,0,0)
 #define C_nfixnump(x)             C_mk_nbool((x) & C_FIXNUM_BIT)
 #define C_pointerp(x)             C_mk_bool(C_block_header(x) == C_POINTER_TAG)
 #define C_taggedpointerp(x)       C_mk_bool(C_block_header(x) == C_TAGGED_POINTER_TAG)
-#define C_swigpointerp(x)         C_mk_bool(C_block_header(x) == C_SWIG_POINTER_TAG)
 #define C_lambdainfop(x)          C_mk_bool(C_header_bits(x) == C_LAMBDA_INFO_TYPE)
-#define C_anypointerp(x)          C_mk_bool(C_block_header(x) == C_POINTER_TAG || C_block_header(x) == C_TAGGED_POINTER_TAG || C_block_header(x) == C_SWIG_POINTER_TAG)
+#define C_anypointerp(x)          C_mk_bool(C_block_header(x) == C_POINTER_TAG || C_block_header(x) == C_TAGGED_POINTER_TAG)
 #define C_specialp(x)             C_mk_bool(C_header_bits(x) & C_SPECIALBLOCK_BIT)
 #define C_byteblockp(x)           C_mk_bool(C_header_bits(x) & C_BYTEBLOCK_BIT)
 #define C_anyp(x)                 C_SCHEME_TRUE
@@ -1885,7 +1882,6 @@ C_fctexport C_word C_fcall C_mpointer(C_word **ptr, void *mp) C_regparm;
 C_fctexport C_word C_fcall C_mpointer_or_false(C_word **ptr, void *mp) C_regparm;
 C_fctexport C_word C_fcall C_taggedmpointer(C_word **ptr, C_word tag, void *mp) C_regparm;
 C_fctexport C_word C_fcall C_taggedmpointer_or_false(C_word **ptr, C_word tag, void *mp) C_regparm;
-C_fctexport C_word C_fcall C_swigmpointer(C_word **ptr, void *mp, void *sdata) C_regparm;
 C_fctexport C_word C_vector(C_word **ptr, int n, ...);
 C_fctexport C_word C_structure(C_word **ptr, int n, ...);
 C_fctexport C_word C_fcall C_mutate_slot(C_word *slot, C_word val) C_regparm;
@@ -3234,7 +3230,6 @@ C_inline C_word C_i_safe_pointerp(C_word x)
 
   switch(C_block_header(x)) {
   case C_POINTER_TAG:
-  case C_SWIG_POINTER_TAG:
   case C_TAGGED_POINTER_TAG:
     return C_SCHEME_TRUE;
   }
diff --git a/library.scm b/library.scm
index 191d2cb..4c61c9d 100644
--- a/library.scm
+++ b/library.scm
@@ -4381,19 +4381,16 @@ EOF
 (define ##sys#pointer->string
   (let ((string-append string-append))
     (lambda (x)
-      (cond ((##core#inline "C_taggedpointerp" x)
-	     (string-append 
-	      "#<tagged pointer "
-	      (##sys#print-to-string 
-	       (let ((tag (##sys#slot x 1)))
-		 (list (if (pair? tag) (car tag) tag) ) ) )
-	      " "
-	      (##sys#number->string (##sys#pointer->address x) 16)
-	      ">") )
-	    ((##core#inline "C_swigpointerp" x)
-	     (string-append "#<SWIG pointer 0x" (##sys#number->string (##sys#pointer->address x) 16) ">") )
-	    (else
-	     (string-append "#<pointer 0x" (##sys#number->string (##sys#pointer->address x) 16) ">") ) ) ) ) )
+      (if (##core#inline "C_taggedpointerp" x)
+	  (string-append
+	   "#<tagged pointer "
+	   (##sys#print-to-string
+	    (let ((tag (##sys#slot x 1)))
+	      (list (if (pair? tag) (car tag) tag) ) ) )
+	   " "
+	   (##sys#number->string (##sys#pointer->address x) 16)
+	   ">")
+	  (string-append "#<pointer 0x" (##sys#number->string (##sys#pointer->address x) 16) ">") ) ) ) )
 
 
 ;;; Platform configuration inquiry:
diff --git a/manual/C interface b/manual/C interface
index 8a0c44a..5924ccd 100644
--- a/manual/C interface	
+++ b/manual/C interface	
@@ -261,12 +261,6 @@ Is {{x}} a C pointer object?  Only accepts non-immediate objects.
 
 Is {{x}} a tagged pointer object?  Only accepts non-immediate objects.
 
-===== C_swigpointerp
-
- [C macro] C_word C_swigpointerp(C_word x)
-
-Is {{x}} a SWIG pointer object?  Only accepts non-immediate objects.
-
 ===== C_anypointerp
 
  [C macro] C_word C_anypointerp(C_word x)
diff --git a/manual/Unit lolevel b/manual/Unit lolevel
index 49b672f..9c8b3a9 100644
--- a/manual/Unit lolevel	
+++ b/manual/Unit lolevel	
@@ -15,14 +15,10 @@ This unit uses the {{srfi-4}} and {{extras}} units.
 
 The abstract class of ''pointer'' is divided into 2 categories: 
 
-; ''pointer object'' : is a foreign pointer object, a [[#Tagged pointers|tagged foreign pointer object]], or a SWIG-pointer.
+; ''pointer object'' : is a regular or [[#Tagged pointers|tagged]] foreign pointer object.
 
 ; ''pointer-like object'' : is a closure, port, [[#Locatives|locative]], or a pointer object.
 
-SWIG-pointers are currently an issue due to "bitrot" in the SWIG CHICKEN
-translator. While they are considered a pointer object unexpected results are
-possible.
-
 Note that Locatives, while technically pointers, are not considered a ''pointer
 object'', but a ''pointer-like object''. The distinction is artificial.
 
diff --git a/runtime.c b/runtime.c
index d69e08a..923d030 100644
--- a/runtime.c
+++ b/runtime.c
@@ -2817,20 +2817,6 @@ C_regparm C_word C_fcall C_taggedmpointer_or_false(C_word **ptr, C_word tag, voi
 }
 
 
-C_regparm C_word C_fcall C_swigmpointer(C_word **ptr, void *mp, void *sdata)
-{
-  C_word 
-    *p = *ptr,
-    *p0 = p;
-
-  *(p++) = C_SWIG_POINTER_TAG;
-  *((void **)p) = mp;
-  *((void **)p + 1) = sdata;
-  *ptr = p + 2;
-  return (C_word)p0;
-}
-
-
 C_word C_vector(C_word **ptr, int n, ...)
 {
   va_list v;
@@ -6944,20 +6930,17 @@ C_regparm C_word C_fcall C_i_foreign_symbol_argumentp(C_word x)
 
 C_regparm C_word C_fcall C_i_foreign_pointer_argumentp(C_word x)
 {
-  if(C_immediatep(x) || 
-     (C_header_bits(x) != C_SWIG_POINTER_TYPE &&
-      (C_header_bits(x) & C_SPECIALBLOCK_BIT) == 0) )
+  if(C_immediatep(x) || (C_header_bits(x) & C_SPECIALBLOCK_BIT) == 0)
     barf(C_BAD_ARGUMENT_TYPE_NO_POINTER_ERROR, NULL, x);
 
   return x;
 }
 
 
+/* TODO: Is this used? */
 C_regparm C_word C_fcall C_i_foreign_scheme_or_c_pointer_argumentp(C_word x)
 {
-  if(C_immediatep(x) || 
-     (C_header_bits(x) != C_SWIG_POINTER_TYPE &&
-      (C_header_bits(x) & C_SPECIALBLOCK_BIT) == 0) )
+  if(C_immediatep(x) || (C_header_bits(x) & C_SPECIALBLOCK_BIT) == 0)
     barf(C_BAD_ARGUMENT_TYPE_NO_POINTER_ERROR, NULL, x);
 
   return x;
@@ -12903,7 +12886,6 @@ dump_heap_state_2(void *dummy)
       case C_POINTER_TYPE: C_fprintf(C_stderr,        C_text("pointer        ")); break;
       case C_LOCATIVE_TYPE: C_fprintf(C_stderr,       C_text("locative       ")); break;
       case C_TAGGED_POINTER_TYPE: C_fprintf(C_stderr, C_text("tagged pointer ")); break;
-      case C_SWIG_POINTER_TYPE: C_fprintf(C_stderr,   C_text("swig pointer   ")); break;
       case C_LAMBDA_INFO_TYPE: C_fprintf(C_stderr,    C_text("lambda info    ")); break;
       case C_BUCKET_TYPE: C_fprintf(C_stderr,         C_text("bucket         ")); break;
       case C_VECTOR_TYPE: C_fprintf(C_stderr,         C_text("vector         ")); break;
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Chicken-hackers mailing list
Chicken-hackers@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to