encode-ffi-field - syntax checking for field properties
This patch represents a single changeset, developed previously under a local development branch. It's submitted here, from a patch branch under the thinkum-contrib mirror at GitHub
The patch was tested, previously, in October of 2019, under a Debian 10 amd64 installation. I've now tested the ffigen5 build under FreeBSD 12.1. With regards to tooling: Subsequent of a review of the latest port update for CCL, I'd like to create a ccl-devel port under FreeBSD ports and test out ffigen5 under the latter. I believe that a port could serve as a nice context for containing the list of header files to process, for CCL itself and for such as GTK. Pursuant of any tractable success in this, will try to publish the ports patch under a new FreeBSD ports mirror and mention to the CCL mailing list.
I've tested this patch out, only under interactive I/O on the Debian 10 host.
Original changelog message (spell-checked here, syntax updated for Markdown processing) lib/db-io.lisp: Provide some syntax checking in encode-ffi-field
Under some build configurations, after processing OS header files in some host environments, ffigen5 may produce field information having non-positive offset and/or width properties, in some specific fields.
This changeset provides a rudimentary parse-time syntax check for such
data, implemented here in encode-ffi-field. On encountering a negative
offset or width for a field, the type check will signal a continuable
error of type simple-type-definition-error. The continuation form
would throw to the symbol, ignore-type, with no values.
Furthermore, if encountering a zero width for a field, tentatively the
updated encode-ffi-field would produce a warning condition of type
simple-type-definition-warning
This also updates the following functions, to gracefully handle the
catch symbol ignore-type, such that may be thrown from the updated
encode-ffi-field
- save-ffi-objc-message
- db-write-byte-list
- save-ffi-function
- save-ffi-typedef
- save-ffi-struct
- save-ffi-union
- save-ffi-transparent-union
- db-define-var
- save-ffi-objc-class
The following condition classes are added, each in a tentative
definition, such as to be used in this simple type checking for ffigen
data, in encode-ffi-field
- simple-type-definition-error
- simple-type-definition-warning
This patch was originally developed circa October, 2019
The patch has been tested, to a limited extent, under a Debian 10 amd64 installation.
(cherry picked from commit 333a1f8591167a16e56d262b59d26c8ca852a613)