* bug#27579: [patch] add intptr uintptr to (system foreign)
@ 2017-07-04 23:38 Matt Wette
2017-07-04 23:43 ` bug#27579: Intptr and uintptr Matt Wette
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Matt Wette @ 2017-07-04 23:38 UTC (permalink / raw)
To: 27579
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27579: Intptr and uintptr
2017-07-04 23:38 bug#27579: [patch] add intptr uintptr to (system foreign) Matt Wette
@ 2017-07-04 23:43 ` Matt Wette
2017-07-04 23:48 ` bug#27579: intptr_t and uintptr_t Matt Wette
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Matt Wette @ 2017-07-04 23:43 UTC (permalink / raw)
To: 27579
I sent this patch prematurely. The symbol intptr is not visible at the interpreter prompt via (use-modules (system foreign)). — Matt
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27579: intptr_t and uintptr_t
2017-07-04 23:38 bug#27579: [patch] add intptr uintptr to (system foreign) Matt Wette
2017-07-04 23:43 ` bug#27579: Intptr and uintptr Matt Wette
@ 2017-07-04 23:48 ` Matt Wette
2017-11-22 15:35 ` Ludovic Courtès
2017-08-04 22:51 ` bug#27579: System foreign Matt Wette
2017-11-18 16:38 ` bug#27579: wchar_t needed also Matt Wette
3 siblings, 1 reply; 6+ messages in thread
From: Matt Wette @ 2017-07-04 23:48 UTC (permalink / raw)
To: 27579
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27579: System foreign
2017-07-04 23:38 bug#27579: [patch] add intptr uintptr to (system foreign) Matt Wette
2017-07-04 23:43 ` bug#27579: Intptr and uintptr Matt Wette
2017-07-04 23:48 ` bug#27579: intptr_t and uintptr_t Matt Wette
@ 2017-08-04 22:51 ` Matt Wette
2017-11-18 16:38 ` bug#27579: wchar_t needed also Matt Wette
3 siblings, 0 replies; 6+ messages in thread
From: Matt Wette @ 2017-08-04 22:51 UTC (permalink / raw)
To: 27579
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.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27579: wchar_t needed also
2017-07-04 23:38 bug#27579: [patch] add intptr uintptr to (system foreign) Matt Wette
` (2 preceding siblings ...)
2017-08-04 22:51 ` bug#27579: System foreign Matt Wette
@ 2017-11-18 16:38 ` Matt Wette
3 siblings, 0 replies; 6+ messages in thread
From: Matt Wette @ 2017-11-18 16:38 UTC (permalink / raw)
To: 27579
We will also need wchar_t. And what about char16_t and char32_t ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#27579: intptr_t and uintptr_t
2017-07-04 23:48 ` bug#27579: intptr_t and uintptr_t Matt Wette
@ 2017-11-22 15:35 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2017-11-22 15:35 UTC (permalink / raw)
To: Matt Wette; +Cc: 27579-done
Hi Matt,
Matt Wette <matt.wette@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’.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-22 15:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-04 23:38 bug#27579: [patch] add intptr uintptr to (system foreign) Matt Wette
2017-07-04 23:43 ` bug#27579: Intptr and uintptr Matt Wette
2017-07-04 23:48 ` bug#27579: intptr_t and uintptr_t Matt Wette
2017-11-22 15:35 ` Ludovic Courtès
2017-08-04 22:51 ` bug#27579: System foreign Matt Wette
2017-11-18 16:38 ` bug#27579: wchar_t needed also Matt Wette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).