[2016-07-18 21:41] Amirouche Boubekki
>
> On 2016-07-18 17:17, kact...@gnu.org wrote:
> > From: Dmitry Bogatov
> >
> > Document '' record type and 'define-foreign-type'
> > procedure.
>
> Can you compare this 'foreign-type' library with scheme-bytestructures
> [0]. How
> can both libraries help e
On 2016-07-18 17:17, kact...@gnu.org wrote:
From: Dmitry Bogatov
Document '' record type and 'define-foreign-type'
procedure.
Can you compare this 'foreign-type' library with scheme-bytestructures
[0]. How
can both libraries help each other? Work hand in hand?
[0] https://github.com/Tayla
Hi Dmitry! Thanks for working on it!
On Mon, 2016-07-18 at 18:17 +0300, kact...@gnu.org wrote:
> From: Dmitry Bogatov
>
> +(define-module (system foreign declarative)
> + #:export (make-foreign-type)
> + #:export (define-foreign-type))
> +(use-modules (srfi srfi-9))
You don't have to write #
> > +(define-module (system foreign declarative)
> > + #:export (make-foreign-type)
> > + #:export (define-foreign-type))
> > +(use-modules (srfi srfi-9))
> You don't have to write #:export several times, one just enough
> #:export (make-foreign-type define-foreign-type)
Thanks for review. I kn
From: Dmitry Bogatov
New foreign-types: `unsigned-int:` and
`unsigned-long:`.
---
module/system/foreign/declarative.scm | 30 --
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/module/system/foreign/declarative.scm
b/module/system/foreign/declarative.
From: Dmitry Bogatov
---
module/ice-9/xattr.scm | 40 +++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/module/ice-9/xattr.scm b/module/ice-9/xattr.scm
index 2c81e91..090b233 100644
--- a/module/ice-9/xattr.scm
+++ b/module/ice-9/xattr.scm
@@
From: Dmitry Bogatov
This module provides interface to extended filesystem attributes and
serves as example of (system foreign declarative) usage.
---
module/Makefile.am | 1 +
module/ice-9/xattr.scm | 76 ++
2 files changed, 77 insertions(+)
From: Dmitry Bogatov
* module/ice-9/xattr.scm (xattr-get): convert exception to #f
if errno was ENOATTR
---
module/ice-9/xattr.scm | 27 +++
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/module/ice-9/xattr.scm b/module/ice-9/xattr.scm
index 090b233.
From: Dmitry Bogatov
---
module/ice-9/xattr.scm | 43 ++-
1 file changed, 42 insertions(+), 1 deletion(-)
diff --git a/module/ice-9/xattr.scm b/module/ice-9/xattr.scm
index 5374901..6773126 100644
--- a/module/ice-9/xattr.scm
+++ b/module/ice-9/xattr.scm
From: Dmitry Bogatov
---
doc/ref/api-foreign.texi | 16
1 file changed, 16 insertions(+)
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index 605dbed..6b0e34c 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
@@ -1124,6 +1124,22 @@ Here are
From: Dmitry Bogatov
Document '' record type and 'define-foreign-type' procedure.
---
doc/ref/api-foreign.texi | 150 ++-
1 file changed, 147 insertions(+), 3 deletions(-)
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index c2c49ec.
From: Dmitry Bogatov
* module/system/foreign/declarative.scm: macro 'with-pointer'
simplifies work with input-output and input arguments to C
functions.
* test-suite/tests/foreign-declarative.test: test 'with-pointer'
macro by time(2) function. Value returned via pointer must
From: Dmitry Bogatov
* module/ice-9/xattr.scm: new internal macro
`define-libattr-functions', that generalize following properties
of functions in libattr:
- every function have form attr_ACTION or attr_ACTIONf, which
have same signatures, except first argument, which is e
Hello!
Below is set of patches, that (1-20) implement new module (system
foreign declarative), that simplifies writing bindings to foreign C
functions and provides documentation to it. This module is extracted
from abandoned guile-bash project.
Rest 5 patches (21-25) introduce module (ice-9 xattr
From: Dmitry Bogatov
---
doc/ref/api-foreign.texi | 48
1 file changed, 48 insertions(+)
diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi
index 6b0e34c..7114225 100644
--- a/doc/ref/api-foreign.texi
+++ b/doc/ref/api-foreign.texi
From: Dmitry Bogatov
* module/system/foreign/declarative.scm: new macro
`define-foreign-bitmask' that defines `foreign-type' for bitmask,
with proper encoding, decoding and validation.
---
module/system/foreign/declarative.scm | 46 +++
test-suite/tests/
From: Dmitry Bogatov
---
module/system/foreign/declarative.scm | 1 -
1 file changed, 1 deletion(-)
diff --git a/module/system/foreign/declarative.scm
b/module/system/foreign/declarative.scm
index 9930370..8ffc821 100644
--- a/module/system/foreign/declarative.scm
+++ b/module/system/foreign/d
From: Dmitry Bogatov
---
module/system/foreign/declarative.scm | 4
1 file changed, 4 insertions(+)
diff --git a/module/system/foreign/declarative.scm
b/module/system/foreign/declarative.scm
index 62d40b8..596cce0 100644
--- a/module/system/foreign/declarative.scm
+++ b/module/system/fore
From: Dmitry Bogatov
---
module/system/foreign/declarative.scm | 1 +
1 file changed, 1 insertion(+)
diff --git a/module/system/foreign/declarative.scm
b/module/system/foreign/declarative.scm
index 66d35a8..9930370 100644
--- a/module/system/foreign/declarative.scm
+++ b/module/system/foreign/
From: Dmitry Bogatov
---
module/system/foreign/declarative.scm | 27 ++-
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/module/system/foreign/declarative.scm
b/module/system/foreign/declarative.scm
index 5a5d688..fb949db 100644
--- a/module/system/foreign
From: Dmitry Bogatov
---
module/system/foreign/declarative.scm | 11 ++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/module/system/foreign/declarative.scm
b/module/system/foreign/declarative.scm
index b0c31a0..62d40b8 100644
--- a/module/system/foreign/declarative.scm
From: Dmitry Bogatov
The following code will cause error:
(define (foo x)
(define x (* 2 x))
(+ x 12))
(display (foo 12))
instead displaying 36, since in (* 2 x) form variable x is bound, but
have value *unspecified*. In this case `set!' must be used.
* module/system/foreign/decl
From: Dmitry Bogatov
* module/system/foreign/declarative.scm(define-foreign-function):
new keywords arguments:
- dynamic-library: dynamic library object where load symbol from
- symbol: explicitly specify underlying C symbol, if automatic
deriving from Scheme function name is n
From: Dmitry Bogatov
Introduce notion of foreign-type predicates. The following
changed was made:
* new field `ft-predicate-proc' in record.
* new argument to `make-foreign-type' function
* specify predicates for primitive types, which required
change of helper `mirror-primitive-type' mac
From: Dmitry Bogatov
* module/system/foreign/declarative.scm: import
(system foreign), where identifiers `int', 'long'
and so on are declared
* module/system/foreign/declarative.scm: with two helper
macros `mirror-primitive-type' and `mirror-primitive-types'
create for every
From: Dmitry Bogatov
With this renaming validation function is allowed to throw
excection by itself to more accurately describe violated
assumption.
By convention, predicates never throws.
---
module/system/foreign/declarative.scm | 20 ++--
1 file changed, 10 insertions(+), 10
From: Dmitry Bogatov
* module/system/foreign/declarative.scm: for reason I do not
understand, `mirror-primitive-typeS' macro mangled foreign
type object name, so instead `int:' it defined something like
`int:_some_uniq_string'. So it was replaced with manual calls
to `mirror-pri
From: Dmitry Bogatov
* module/system/foreign/declarative.scm: new macro
`define-foreign-function', that allows import from current binary
C function with primitive (no strings, no pointers) arguments,
that returns primitive type.
* module/system/foreign/declarative.scm: test that
From: Dmitry Bogatov
* module/system/foreign/declarative.scm: currently empty
module, that successfully compiles and gets installed
* module/Makefile.am: insert new module into list of
known Guile modules
---
module/Makefile.am| 6 ++
module/system/foreign/declar
From: Dmitry Bogatov
* module/system/foreign/declarative.scm: new structure ,
incapsulating information how convert objects from Scheme
representation to C, and via-verse.
* module/system/foreign/declarative.scm: create and export
new functions `make-foreign-type' and `define-foreign-
30 matches
Mail list logo