GNU bug report logs - #27579
[patch] add intptr uintptr to (system foreign)

Previous Next

Package: guile;

Reported by: Matt Wette <matt.wette <at> gmail.com>

Date: Tue, 4 Jul 2017 23:39:02 UTC

Severity: normal

Tags: patch

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27579 in the body.
You can then email your comments to 27579 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#27579; Package guile. (Tue, 04 Jul 2017 23:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matt Wette <matt.wette <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Tue, 04 Jul 2017 23:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: [patch] add intptr uintptr to (system foreign)
Date: Tue, 4 Jul 2017 16:38:37 -0700
I submit this patch for adding intptr and uintptr to (system foreign).
This is with reference to guile-2.2.2 and changes libguile/foreign.c and module/system/foreign.scm.
After application, I was albe to get guile-2.2.2 to complete “make” and “make check”. 
No specific tests for this patch have been performed.

Rationale: I am working on a FFI helper which uses scheme-bytestructure (see GitHub.com) and that package includes these types.

Matt

--- libguile/foreign.c-orig	2017-07-04 15:57:55.000000000 -0700
+++ libguile/foreign.c	2017-07-04 16:02:45.000000000 -0700
@@ -56,6 +56,8 @@
 SCM_SYMBOL (sym_size_t, "size_t");
 SCM_SYMBOL (sym_ssize_t, "ssize_t");
 SCM_SYMBOL (sym_ptrdiff_t, "ptrdiff_t");
+SCM_SYMBOL (sym_intptr_t, "intptr_t");
+SCM_SYMBOL (sym_uintptr_t, "uintptr_t");
 
 /* that's for pointers, you know. */
 SCM_SYMBOL (sym_asterisk, "*");
@@ -1248,6 +1250,26 @@
 #endif
 	      );
 
+  scm_define (sym_intptr_t,
+#if SCM_SIZEOF_INTPTR_T == 8
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_INT64)
+#elif SCM_SIZEOF_INTPTR_T == 4
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_INT32)
+#else
+# error unsupported sizeof (scm_t_intptr)
+#endif
+	      );
+
+  scm_define (sym_uintptr_t,
+#if SCM_SIZEOF_UINTPTR_T == 8
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_UINT64)
+#elif SCM_SIZEOF_UINTPTR_T == 4
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_UINT32)
+#else
+# error unsupported sizeof (scm_t_uintptr)
+#endif
+	      );
+
   null_pointer = scm_cell (scm_tc7_pointer, 0);
   scm_define (sym_null, null_pointer);
 }
--- module/system/foreign.scm-orig	2017-07-04 16:06:15.000000000 -0700
+++ module/system/foreign.scm	2017-07-04 16:06:51.000000000 -0700
@@ -30,6 +30,7 @@
             uint16 int16
             uint32 int32
             uint64 int64
+            intptr uintptr
 
             sizeof alignof
 





Information forwarded to bug-guile <at> gnu.org:
bug#27579; Package guile. (Tue, 04 Jul 2017 23:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 27579 <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: 27579 <at> debbugs.gnu.org
Subject: Intptr and uintptr
Date: Tue, 4 Jul 2017 16:43:39 -0700
I sent this patch prematurely.  The symbol intptr is not visible at the interpreter prompt via (use-modules (system foreign)). — Matt



Information forwarded to bug-guile <at> gnu.org:
bug#27579; Package guile. (Tue, 04 Jul 2017 23:49:01 GMT) Full text and rfc822 format available.

Message #11 received at 27579 <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: 27579 <at> debbugs.gnu.org
Subject: intptr_t and uintptr_t
Date: Tue, 4 Jul 2017 16:48:20 -0700
I found the issue.   I called the symbol intptr_t in foreign.c and intptr in foreign.scm

Now both use intptr_t and uintptr_t, with patch below.

Matt

--- libguile/foreign.c-orig	2017-07-04 15:57:55.000000000 -0700
+++ libguile/foreign.c	2017-07-04 16:02:45.000000000 -0700
@@ -56,6 +56,8 @@
 SCM_SYMBOL (sym_size_t, "size_t");
 SCM_SYMBOL (sym_ssize_t, "ssize_t");
 SCM_SYMBOL (sym_ptrdiff_t, "ptrdiff_t");
+SCM_SYMBOL (sym_intptr_t, "intptr_t");
+SCM_SYMBOL (sym_uintptr_t, "uintptr_t");
 
 /* that's for pointers, you know. */
 SCM_SYMBOL (sym_asterisk, "*");
@@ -1248,6 +1250,26 @@
 #endif
 	      );
 
+  scm_define (sym_intptr_t,
+#if SCM_SIZEOF_INTPTR_T == 8
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_INT64)
+#elif SCM_SIZEOF_INTPTR_T == 4
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_INT32)
+#else
+# error unsupported sizeof (scm_t_intptr)
+#endif
+	      );
+
+  scm_define (sym_uintptr_t,
+#if SCM_SIZEOF_UINTPTR_T == 8
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_UINT64)
+#elif SCM_SIZEOF_UINTPTR_T == 4
+	      scm_from_uint8 (SCM_FOREIGN_TYPE_UINT32)
+#else
+# error unsupported sizeof (scm_t_uintptr)
+#endif
+	      );
+
   null_pointer = scm_cell (scm_tc7_pointer, 0);
   scm_define (sym_null, null_pointer);
 }
--- module/system/foreign.scm-orig	2017-07-04 16:06:15.000000000 -0700
+++ module/system/foreign.scm	2017-07-04 16:44:27.000000000 -0700
@@ -30,6 +30,7 @@
             uint16 int16
             uint32 int32
             uint64 int64
+            intptr_t uintptr_t
 
             sizeof alignof
 





Information forwarded to bug-guile <at> gnu.org:
bug#27579; Package guile. (Fri, 04 Aug 2017 22:52:02 GMT) Full text and rfc822 format available.

Message #14 received at 27579 <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: 27579 <at> debbugs.gnu.org
Subject: System foreign
Date: Fri, 4 Aug 2017 15:51:21 -0700
While we are at it, I need long-long-int and unsigned-long-long-int.  This is for my FFI helper, to auto-code FFI code.
(Then my chore is to deal with varargs.)





Information forwarded to bug-guile <at> gnu.org:
bug#27579; Package guile. (Sat, 18 Nov 2017 16:39:02 GMT) Full text and rfc822 format available.

Message #17 received at 27579 <at> debbugs.gnu.org (full text, mbox):

From: Matt Wette <matt.wette <at> gmail.com>
To: 27579 <at> debbugs.gnu.org
Subject: wchar_t needed also
Date: Sat, 18 Nov 2017 08:38:14 -0800
We will also need wchar_t.   And what about char16_t and char32_t ?





Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Wed, 22 Nov 2017 15:36:01 GMT) Full text and rfc822 format available.

Notification sent to Matt Wette <matt.wette <at> gmail.com>:
bug acknowledged by developer. (Wed, 22 Nov 2017 15:36:02 GMT) Full text and rfc822 format available.

Message #22 received at 27579-done <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Matt Wette <matt.wette <at> gmail.com>
Cc: 27579-done <at> debbugs.gnu.org
Subject: Re: bug#27579: intptr_t and uintptr_t
Date: Wed, 22 Nov 2017 16:35:25 +0100
Hi Matt,

Matt Wette <matt.wette <at> gmail.com> skribis:

> I found the issue.   I called the symbol intptr_t in foreign.c and intptr in foreign.scm
>
> Now both use intptr_t and uintptr_t, with patch below.

I updated api-foreign.texi accordingly, added a commit log, and
committed to the ‘stable-2.2’ branch.

Thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 21 Dec 2017 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 120 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.