Gustavo
Tue, 10 Aug 2010 10:10:32 -0700
Hello, again, I found one inconsistency in uffi's documentation. Uffi's doc says that dereferencing types :char and :unsigned-char return characters where actually it returns integers (at least here). Cffi's uffi-compat follows the doc and that also breaks elephant. Sending a new patch that "fix" that and also has a change necessary to def-function accept directions.
Please let me know whether my patches will get into cffi or if there is something I should change in them. Now off to find more errors... Gustavo. Em 6 de agosto de 2010 11:19, Gustavo <gugamil...@gmail.com> escreveu: > Hello, > > Sorry, my definition of "tomorrow" and "day duration" is a little distorted > :3 > > My previous patch was kind of messy, so I decided to restart everything > from the concept. Instead of the argument directions to be handled by the > macro expansion and (complicated) auxiliary functions, it is now handled > (mainly) by translate-objects and expand-to-foreign-dyn. > > Also, tests for varargs functions are a bit hackish because I don't know > how to create a C function with variadic argument. I don't know if it will > work on all systems. Anyway, the tests are there, just test them and see if > they work ;) > > Gustavo. > > Em 14 de julho de 2010 23:01, Gustavo <gugamil...@gmail.com> escreveu: > >> Hello, again, >> >> I've added support for :in, :out, :in-out and :copy direction arguments >> except for defcfun with &rest args. The patch is attached, it includes some >> tests. Anyone may feel free to add more tests if it is convenient. >> >> >> For defcfun with &rest arguments, I still need to test so I didn't include >> it in my patch. I'll do that tomorrow. >> >> Changing subject, I noted that, *without* my changes, there are 4 >> unexpected failures with cffi in my system (and 2 expected). >> >> The tests FUNCALL.VARARGS.DOUBLE, DEFCFUN.VARARGS.FLOAT, >> DEFCFUN.VARARGS.DOUBLE fail because of localization issues. Here in Brazil, >> we write "3,14" instead of "3.14" and sprintf takes that into account. Not a >> big problem, though, just notifying. >> >> The test DEFCFUN.BFF.2 fails, I suspect it is because of the precision of >> doubles. The function returns the first, the second is expected. >> >> 7758614624042983568 >> 7758614658402721936 >> >> The expected failures are STRING.ENCODING.UTF-16.BASIC and >> STRING.ENCODINGS.ALL.BASIC. >> >> SBCL 1.0.40, 32-bit Ubuntu. >> >> Now, except for those tests that were already failing, my changes didn't >> fail even a single one of them :) >> >> Gustavo. >> > >
Tue Aug 10 13:36:16 BRT 2010 Gustavo Henrique Milare <gugamil...@gmail.com>
* Fix uffi's def-function and convertion from characters
New patches:
[Fix uffi's def-function and convertion from characters
Gustavo Henrique Milare <gugamil...@gmail.com>**20100810163616
Ignore-this: 198bf641d54007f0d1c215e19a7ebb5a
] {
hunk ./uffi-compat/uffi-compat.lisp 114
(:cstring :pointer)
(:pointer-void :pointer)
(:pointer-self :pointer)
- (:char '(uffi-char :char))
- (:unsigned-char '(uffi-char :unsigned-char))
+ ;; Uffi's documentation says dereferencing :char and :unsigned-char
+ ;; returns characters while it actually returns integers
+ (:char :char)
+ (:unsigned-char :unsigned-char)
(:byte :char)
(:unsigned-byte :unsigned-char)
(t
hunk ./uffi-compat/uffi-compat.lisp 408
"Define a foreign function."
(declare (ignore module))
`(cffi:defcfun ,name ,(convert-uffi-type returning)
- ,@(loop for (name type) in args
- collect `(,name ,(convert-uffi-type type)))))
+ ,@(loop for (name type . rest) in args
+ collect `(,name ,(convert-uffi-type type) ,@rest))))
;;; Taken from UFFI's src/libraries.lisp
}
Context:
[cffi-ecl: always push no-long-long
Luis Oliveira <lolive...@common-lisp.net>**20100428225604
Ignore-this: 784c1c4b1567455e551ceeee0381cee8
LONG-LONG is not supported by ECL's interpreter yet.
]
[cffi-tests: don't use FOREIGN-FREE for malloc()ed memory
Luis Oliveira <lolive...@common-lisp.net>**20100428225337
Ignore-this: 5c02fbd1880a2f69a7bb59f8bb22f66b
Patch courtesy of Juan Jose Garcia-Ripoll.
]
[New pointer-related tests
Luis Oliveira <lolive...@common-lisp.net>**20100428224243
Ignore-this: 6a2f040e2212317b46441a48851d48ac
Testing error situations for some pointer operations.
]
[cffi-ecl: simplify shareable vector implementation
Luis Oliveira <lolive...@common-lisp.net>**20100425231232
Ignore-this: 75b0d4bba44f7313d3a629184ee93d42
Patch courtesy of Juan Jose Garcia-Ripoll.
]
[cffi-ecl: inline %mem-set and %mem-ref
Luis Oliveira <lolive...@common-lisp.net>**20100425230219
Ignore-this: 121b7b707e867051fc5ef8b45a306234
Patch courtesy of Juan Jose Garcia-Ripoll.
]
[cffi-ecl: use C-INLINE when producing compiled code
Luis Oliveira <lolive...@common-lisp.net>**20100425225004
Ignore-this: 30c083fea4568be7c20f4f819d5a8ffa
Using the ECL extension EXT:WITH-BACKEND, CFFI can produce code that
works differently when using the interpreter than when using the
lisp2C compiler. This leads to more efficient code. This change is
backwards compatible.
Patch courtesy of Juan Jose Garcia-Ripoll.
]
[cffi-ecl: reexport NULL-POINTER-P from SI
Luis Oliveira <lolive...@common-lisp.net>**20100425223914
Ignore-this: 7dd39ad27e6827545c1b16fc071fa4b5
Patch courtesy of Juan Jose Garcia-Ripoll.
]
[cffi-ecl: use ECL's :long-long feature
Luis Oliveira <lolive...@common-lisp.net>**20100425223748
Ignore-this: a58e16e0ef93b05576d05852f47fda6f
Patch courtesy of Juan Jose Garcia-Ripoll.
]
[Allegro: fix WITH-FOREIGN-POINTER
Luis Oliveira <lolive...@common-lisp.net>**20100425122443
Ignore-this: 275a83ec9e6b161c046644ef2e4b79a5
- Fixes previous patch.
- New test: WITH-FOREIGN-POINTER.CONSTANT-SIZE.
]
[Allow the use of constants in WITH-FOREIGN-OBJECT for Allegro.
Jianshi Huang <hu...@msi.co.jp>**20100421091956
Ignore-this: 612e375c10cae6e070b94baddf231e0d
]
[Remove unused C macro SIGNED_ from common.h
Stelian Ionescu <sione...@cddr.org>**20100219173353
Ignore-this: 127d3fac79151d22b23ce435cab3558
]
[cffi-manual: navigation improvements.
Luis Oliveira <lolive...@common-lisp.net>**20100106232110
Ignore-this: 5944e0d6072d1357b41a42d2658708d4
- Add WITH-FOREIGN-OBJECTS and WITH-FOREIGN-STRINGS to the
dictionary menus. (This unfortunately seems to require
specifying the @node declarations in full.)
- Make the table of contents more manageable by turning
@unnumberedsecs into @headings.
- Fix docstring in DEFSTRUCT example.
]
[cffi-lispworks: add IGNORE declaration to CREATE-FOREIGN-FUNCALLABLE
Luis Oliveira <lolive...@common-lisp.net>**20100101174635
Ignore-this: a6fbc492c01a1b45339b0fde226f6cb7
]
[cffi-lispworks: make null-pointer-p check its argument's type
Luis Oliveira <lolive...@common-lisp.net>**20100101174529
Ignore-this: 5aa0ba3afae82dd729f849c03582ac6c
]
[Documentation: add note about RT, update description of no-long-long.
Luis Oliveira <lolive...@common-lisp.net>**20100101173443
Ignore-this: 97430803980a0492290dafbd29cb062f
]
[Preliminary support for ABCL.
Luis Oliveira <lolive...@common-lisp.net>**20100101172600
Ignore-this: 1b9e5eb2ba0718bff2756f1897ad08b3
]
[Update email address.
Stelian Ionescu <sione...@cddr.org>**20091211164938
Ignore-this: c8aab03fe8a070fc83fb39ab3fa3ad42
]
[Remove spurious PRINT call.
Stelian Ionescu <sione...@cddr.org>**20091211164909
Ignore-this: ea138b4aff965ed7547956a93c98bfac
]
[cffi-manual: the :STRING type does not support ub8 arrays anymore
Luis Oliveira <lolive...@common-lisp.net>**20091124232002
Ignore-this: 509d08ce9acceacbe694a678552746bc
]
[libtest: support 64-bit on OSX Leopard
Luis Oliveira <lolive...@common-lisp.net>**20091124231741
Ignore-this: d7997fa0aca44a1f0351bdde32ea91f8
]
[cffi-tests: show Lispworks the full path to libm.dylib
Luis Oliveira <lolive...@common-lisp.net>**20091124231442
Ignore-this: ccf9bfdc692e726f7760b1dd0ecfb985
]
[cffi-lispworks: turns out Lispworks does support llong on 32-bit platforms
Luis Oliveira <lolive...@common-lisp.net>**20091124231321
Ignore-this: 8e131fb8e20f9d1448dd740d336ec1b4
]
[Deprecate groveler clause FLAG in favour of CC-FLAGS.
Stelian Ionescu <sione...@cddr.org>**20090823121108
Ignore-this: e1537717a9e7356b208d5cd14b34ba50
]
[cffi-allegro: define long long types on 64-bit platforms
Luis Oliveira <lolive...@common-lisp.net>**20090821210052
Patch courtesy of John Fremlin.
]
[cffi-tests: fix pointer-to-integer casts in libtest.c
Luis Oliveira <lolive...@common-lisp.net>**20090821205447]
[cffi-tests: don't use stdcall #ifndef WIN32
Luis Oliveira <lolive...@common-lisp.net>**20090821205144]
[Also canonicalize search paths in library specs.
Stelian Ionescu <sione...@cddr.org>**20090809005356
Ignore-this: 86a039c7ebbc757c9934fe99368ae0bb
]
[Update manual.
Stelian Ionescu <sione...@cddr.org>**20090808222834
Ignore-this: 15e832e5220a6ca70722730d81edf283
DEFCFUN & co. now take only :CONVENTION.
]
[Whitespace.
Stelian Ionescu <sione...@cddr.org>**20090808221547
Ignore-this: 18d99969b97b190176e88d9eb24a94ce
]
[Declare DEFCALLBACK, DEFCFUN and DEFINE-FOREIGN-LIBRARY's keyword args :CCONV and :CALLING-CONVENTION obsolete, use :CONVENTION instead.
Stelian Ionescu <sione...@cddr.org>**20090808221055
Ignore-this: 9e90dfde20f4a4dfd764c5250d8b2ea6
]
[Fix docstring of LIST-FOREIGN-LIBRARIES.
Stelian Ionescu <sione...@cddr.org>**20090807164116
Ignore-this: 5c65a2d7608718e9bc0560e780855bf1
]
[Fix reloading a library in LOAD-FOREIGN-LIBRARY.
Stelian Ionescu <sione...@cddr.org>**20090807162733
Ignore-this: 267edf226a87d24d0441bf85515cc437
]
[Use type :wrapper for wrapper libraries generated by the groveler.
Stelian Ionescu <sione...@common-lisp.net>**20090804204132
Ignore-this: d61f9a69cfb323905d8abbb40bf84be9
]
[Use type :test for the test libraries.
Stelian Ionescu <sione...@common-lisp.net>**20090720154312
Ignore-this: 6dad3c93d47cd22e27c73c6ba7f2e8d1
]
[Add the ability to specify a foreign library's type and search path.
Stelian Ionescu <sione...@common-lisp.net>**20090720154028
Ignore-this: 7de87b54da57c74f9a7c994d6255df84
Also export:
- FOREIGN-LIBRARY
- FOREIGN-LIBRARY-PATHNAME
- FOREIGN-LIBRARY-TYPE
- FOREIGN-LIBRARY-LOADED-P
- LIST-FOREIGN-LIBRARIES
]
[Cosmetic changes (cconv -> calling-convention).
Stelian Ionescu <sione...@cddr.org>**20090720153925
Ignore-this: 38bc21d362c69fbf2dc10d268615b4fb
]
[Groveler fixes for ECL.
Stelian Ionescu <sione...@cddr.org>**20090804193738
Ignore-this: b834b25942f10bf4a42fdc3e9d0a2a0e
]
[ECL: support more vector types in CFFI-SYS:WITH-POINTER-TO-VECTOR-DATA
Luis Oliveira <lolive...@common-lisp.net>**20090725231330
Patch courtesy of Andy Hefner.
]
[cffi-openmcl: prepend _ to external names on #+darwin, not just #+darwinppc
Luis Oliveira <lolive...@common-lisp.net>**20090710180832]
[grovel: don't use cffi-features.
Luis Oliveira <lolive...@common-lisp.net>**20090702201557]
[clisp: small fix to %FOREIGN-ALLOC
Luis Oliveira <lolive...@common-lisp.net>**20090701185918
- Deal with (%foreign-alloc 0) gracefully by turning it into a one byte
allocation. This is similar to what glibc's malloc() does, IIUC.
- Regression test: FOREIGN-ALLOC.6.
Reported by Tobias Rautenkranz.
]
[Don't trim #\VT.
Stelian Ionescu <sione...@common-lisp.net>**20090625164315
Ignore-this: d8d498764120b505ef429533a31e7ad4
]
[Groveler: trim-whitespace not strip-whitespace.
Stelian Ionescu <sione...@common-lisp.net>**20090622215252
Ignore-this: 4cf64b68c733985620a54547172f0acc
]
[Groveler: fix typo.
Stelian Ionescu <sione...@common-lisp.net>**20090622213353
Ignore-this: 6611cf5e23cf79f39487005c3cd54cea
]
[Groveler: small refactoring, create *EXE-EXTENSION*
Stelian Ionescu <sione...@common-lisp.net>**20090622212626
Ignore-this: e05a49eac29b50b75d739d7a8a4d5376
]
[Groveler: move boilerplate C code to common.h
Stelian Ionescu <sione...@common-lisp.net>**20090622211857
Ignore-this: eb1d4dfe79eda50736030b8a58245fa
]
[Groveller: fix usage of *CC-FLAGS*.
Stelian Ionescu <sione...@common-lisp.net>**20090622205142
Ignore-this: 8ec1dee6e977bb621978a140d00d4df6
]
[Include <string.h> with the groveler boilerplate code.
Stelian Ionescu <sione...@common-lisp.net>**20090622201324
Ignore-this: a61b2c378174118bda30f34881fd0d16
]
[Move the DEFPACKAGE and INVOKE out of grovel.lisp
Stelian Ionescu <sione...@common-lisp.net>**20090622200317
Ignore-this: 684f7b807e38f1562c83987999f5f2f6
]
[Style change.
Stelian Ionescu <sione...@common-lisp.net>**20090622194557
Ignore-this: d5fec823114054a26e5d3f868a51e61d
]
[Groveler: use WITH-STANDARD-IO-SYNTAX when processing grovel files.
Stelian Ionescu <sione...@common-lisp.net>**20090622190429
Ignore-this: b2de6817830cfa76780382f6f58b04ee
]
[Groveler: implement %INVOKE for ABCL.
Stelian Ionescu <sione...@common-lisp.net>**20090622190326
Ignore-this: 1131c355c7fbef55c972c5444bed2bf7
]
[TAG 0.10.5
Luis Oliveira <lolive...@common-lisp.net>**20090616162007
Ignore-this: f21c050e8ca02edcf2e2bac58555deb9
]
Patch bundle hash:
747b10d4ee2f91b832a91f1c2dbb8e5c5ea88552
_______________________________________________ cffi-devel mailing list cffi-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel