diff --git a/CHANGES.current b/CHANGES.current index 27194fba2..b67306f23 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.11 (in progress) ============================ +2016-09-18 bcaine + [Guile] Patch #744 Added support for Guile's native pointer functionality + 2016-12-01: wsfulton [Python] Issue https://github.com/swig/swig/issues/769 Add optional moduleimport attribute to %module so that the diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 0bde863be..11a90c4c3 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -908,13 +908,14 @@
  • Smobs
  • Garbage Collection -
  • Exception Handling -
  • Procedure documentation -
  • Procedures with setters -
  • GOOPS Proxy Classes +
  • Native Guile pointers +
  • Exception Handling +
  • Procedure documentation +
  • Procedures with setters +
  • GOOPS Proxy Classes diff --git a/Doc/Manual/Guile.html b/Doc/Manual/Guile.html index f30e139e5..6acdd2dc3 100644 --- a/Doc/Manual/Guile.html +++ b/Doc/Manual/Guile.html @@ -30,13 +30,14 @@
  • Smobs
  • Garbage Collection -
  • Exception Handling -
  • Procedure documentation -
  • Procedures with setters -
  • GOOPS Proxy Classes +
  • Native Guile pointers +
  • Exception Handling +
  • Procedure documentation +
  • Procedures with setters +
  • GOOPS Proxy Classes @@ -453,7 +454,14 @@ is exactly like described in 24.8 Exception Handling +

    24.8 Native Guile pointers

    + + +

    +In addition to SWIG smob pointers, Guile's native pointer type are accepted as arguments to wrapped SWIG functions. This can be useful for passing pointers to bytevector data to wrapped functions. +

    + +

    24.9 Exception Handling

    @@ -479,7 +487,7 @@ mapping: The default when not specified here is to use "swig-error". See Lib/exception.i for details. -

    24.9 Procedure documentation

    +

    24.10 Procedure documentation

    If invoked with the command-line option -procdoc @@ -514,7 +522,7 @@ like this: typemap argument doc. See Lib/guile/typemaps.i for details. -

    24.10 Procedures with setters

    +

    24.11 Procedures with setters

    For global variables, SWIG creates a single wrapper procedure @@ -542,7 +550,7 @@ struct members, the procedures (struct-member-get pointer) and (struct-member-set pointer value) are not generated. -

    24.11 GOOPS Proxy Classes

    +

    24.12 GOOPS Proxy Classes

    SWIG can also generate classes and generic functions for use with @@ -688,7 +696,7 @@ Notice that <Foo> is used before it is defined. The fix is to just put th %import "foo.h" before the %inline block.

    -

    24.11.1 Naming Issues

    +

    24.12.1 Naming Issues

    As you can see in the example above, there are potential naming conflicts. The default exported @@ -725,7 +733,7 @@ guile-modules. For example,

    (use-modules ((Test) #:renamer (symbol-prefix-proc 'goops:))) -

    24.11.2 Linking

    +

    24.12.2 Linking

    The guile-modules generated above all need to be linked together. GOOPS support requires diff --git a/Examples/test-suite/guile/argout_runme.scm b/Examples/test-suite/guile/argout_runme.scm new file mode 100644 index 000000000..8bbb96cc9 --- /dev/null +++ b/Examples/test-suite/guile/argout_runme.scm @@ -0,0 +1,16 @@ +;; tests support for native guile pointers +;; https://www.gnu.org/software/guile/manual/html_node/Void-Pointers-and-Byte-Access.html +(dynamic-call "scm_init_argout_module" (dynamic-link "./libargout")) + +(use-modules (srfi srfi-4) (system foreign)) + +(define initial-value 42) +(define some-s32-data (s32vector initial-value)) + +(if (not (= (incp (bytevector->pointer some-s32-data)) initial-value)) + (error "Didn't read s32 data" initial-value some-s32-data)) + +(if (not (= (s32vector-ref some-s32-data 0) (+ initial-value 1))) + (error "Failed to increment s32 data" some-s32-data)) + +(exit 0) diff --git a/Lib/guile/guile_scm_run.swg b/Lib/guile/guile_scm_run.swg index 94cf4d101..52407afa3 100644 --- a/Lib/guile/guile_scm_run.swg +++ b/Lib/guile/guile_scm_run.swg @@ -176,6 +176,9 @@ SWIG_Guile_ConvertPtr(SCM s, void **result, swig_type_info *type, int flags) if (SCM_NULLP(smob)) { *result = NULL; return SWIG_OK; + } else if (SCM_POINTER_P(s)) { + *result = SCM_POINTER_VALUE(s); + return SWIG_OK; } else if (SCM_SMOB_PREDICATE(swig_tag, smob) || SCM_SMOB_PREDICATE(swig_collectable_tag, smob)) { /* we do not accept smobs representing destroyed pointers */ from = (swig_type_info *) SCM_CELL_WORD_2(smob);