Add `pointer?'.

* libguile/foreign.c (scm_pointer_p): New function.
* libguile/foreign.h (scm_pointer_p): New declaration.
* module/system/foreign.scm: Export `pointer?'.

* test-suite/tests/foreign.test ("null pointer")["pointer?"]: New
  test.
  ("make-pointer")["pointer?"]: New test.

* doc/ref/api-foreign.texi (Foreign Variables): Document `pointer?'.
This commit is contained in:
Ludovic Courtès 2011-01-30 22:47:35 +01:00
commit 6e0975603e
5 changed files with 22 additions and 0 deletions

View file

@ -30,6 +30,9 @@
(with-test-prefix "null pointer"
(pass-if "pointer?"
(pointer? %null-pointer))
(pass-if "zero"
(= 0 (pointer-address %null-pointer)))
@ -46,6 +49,9 @@
(with-test-prefix "make-pointer"
(pass-if "pointer?"
(pointer? (make-pointer 123)))
(pass-if "address preserved"
(= 123 (pointer-address (make-pointer 123))))