From 68c88e19cebb3137481e0d1f7cdea1ea980cd308 Mon Sep 17 00:00:00 2001 From: David PIROTTE Date: Mon, 22 Sep 2014 01:53:46 -0300 Subject: [PATCH 1/2] g-wrap reference manual updated for texinfo 5.2 Note: it all started because I wanted to get acces to modern procedure and type/class indexes, as produced by texinfo 5.2. then I realized that, appart from having to solve raised bugs compiling with texinfo 5.2, it really could live with a serious lifting :). I did my best to improve the presentation and access to the great material the previous g-wrap manual already had, mainly by restructuring it: it is now almost identical, in structure, to the guile reference manual. It is not easy to describe all these modifications in a few words, but I can try :). The top level [g-wrap.texi] document now only specify the license extract dealing with the documentation itself. The detailed-menu has been completely removed. A Preface [non numbered] chapter has been added with 2 sections: 'Contributors to this manual' and 'The G-wrap License'. The previous 'Overview' introduction section text has been moved and is now the introduction text itself, preceeded by the first sentence of the README file: it really is much clearer this way, I think. 'Why Create a Wrapper Generator?' becomes the first Introduction chaper section. It is followed by 'Obtaining and Installing G-wrap' a section which is new, and ends with the 'A simple example' section. 'Usage' [chapter] has been renamed 'A more detailed example', with its text being what was precisly named 'A more detailed example' in the previous version of this manual. The following 2 sections are unchanged. 'The aggregated Type Qualifier' section has been added [the original text was there but unused somehow]. This chaper now ends with a new section which is 'Reporting bugs'. The 'API Reference' chapter is unchanged. Appendix 'A GNU Free Documentation License' added. 'Procedure and Method Index' now precceeds the 'Type and Class Index', as for the guile reference manual. * doc/aggregate.texi: * doc/effective-version.texi: * doc/fdl.texi: * doc/install.texi: * doc/preface.texi: * doc/report-bugs.texi: * doc/version.texi: added * doc/g-wrap.texi: modified as described above. --- doc/aggregate.texi | 96 ++++++++ doc/effective-version.texi | 1 + doc/fdl.texi | 505 +++++++++++++++++++++++++++++++++++++++++ doc/g-wrap.texi | 545 ++++++++++++++++++--------------------------- doc/install.texi | 41 ++++ doc/preface.texi | 63 ++++++ doc/report-bugs.texi | 61 +++++ doc/version.texi | 4 + 8 files changed, 991 insertions(+), 325 deletions(-) create mode 100644 doc/aggregate.texi create mode 100644 doc/effective-version.texi create mode 100644 doc/fdl.texi create mode 100644 doc/install.texi create mode 100644 doc/preface.texi create mode 100644 doc/report-bugs.texi create mode 100644 doc/version.texi diff --git a/doc/aggregate.texi b/doc/aggregate.texi new file mode 100644 index 0000000..6c3339f --- /dev/null +++ b/doc/aggregate.texi @@ -0,0 +1,96 @@ address@hidden -*-texinfo-*- address@hidden This is part of the G-Wrap Reference Manual. address@hidden Copyright (C) 2014 David Pirotte address@hidden See the file g-wrap.texi for copying conditions. + address@hidden The @code{aggregated} Type Qualifier address@hidden The @code{aggregated} Type Qualifier + address@hidden memory management address@hidden aggregated object address@hidden constructor +The @code{aggregated} type qualifier is mostly useful when wrapping C +functions (constructors) that return a new object which aggregates +objects passed as its input parameters. In order to illustrate the +need for this typespec, let's imagine the following C API: + address@hidden +/* Return a new stuff. */ +stuff_t *make_stuff (void); + +/* Return a stuff container that contains a pointer to CONTAINED. + Note that the container returned is _not_ responsible for + deallocating the resources attached to CONTAINED. */ +stuff_container_t *make_stuff_container (stuff_t *contained); address@hidden smallexample + +And now, imagine the following Scheme code that uses bindings of the +above functions: + address@hidden +(define c (make-stuff-container (make-stuff))) address@hidden smalllisp + +Suppose the two C types are wrapped as WCTs (@pxref{Wrapping a C +Pointer Type}). The call to @code{make-stuff} will create a new +Scheme object (a WCP, or a ``SMOB'' in Guile terms, @pxref{Defining +New Types (Smobs), SMOBs,, guile, The GNU Guile Reference Manual}) for +the underlying C object. However, as soon as address@hidden has returned, the Scheme code no longer +holds any SMOB representing the value that was returned by address@hidden Consequently, the SMOB returned by address@hidden may soon be garbage-collected by Guile, and its +underlying C object (originally returned by @code{make_stuff ()}) may +soon get freed as well. + +But, here is the problem: the C @code{stuff_container_t} object still +contains a pointer to that @code{stuff_t} object that has just been +deleted! The goal of the @code{aggregated} typespec is to solve +situations like this one. In the example above, the wrapped function +and the container type should be specified as follows: + address@hidden +(wrap-as-wct! ws + #:name ' + #:c-type-name "stuff_t *" + #:c-const-type-name "const stuff_t *" + #:allowed-options '(aggregated)) + +... + +(wrap-function! ws + #:name 'make-stuff-container + #:c-name "make_stuff_container" + #:returns ' + #:arguments '((( aggregated) stuff))) address@hidden lisp + +Literally, this means: ``the argument @var{stuff} of address@hidden is @emph{aggregated} by the object +returned by @code{make-stuff-container}; therefore, it may not be GC'd +unless the object returned by @code{make-stuff-container} is GC'd +too.'' + address@hidden finalization order +Additionally, G-Wrap, in this case, enforces the @emph{finalization +order} of WCPs: even if both the referrer (the address@hidden} object) and its dependency (the @var{stuff} +argument) become unreachable during the same GC phase, G-Wrap makes +sure that their @code{wcp-free-function}s (@pxref{Wrapping a C Pointer +Type}) are called in the right order, i.e., referrer first, dependency +second. + address@hidden reference counting +Note that some libraries, such as GTK+, solve this problem by relying +on reference counting: aggregating objects must increment the +reference counter of the objects they refer to. The @code{aggregated} +type qualifier facility can be seen as a solution for those C +libraries that do @emph{not} use reference counting but have memory +ownership semantics similar to the ones described above. An example +of such a library is Berkeley DB. + + address@hidden Local Variables: address@hidden TeX-master: "g-wrap.texi" address@hidden ispell-local-dictionary: "american" address@hidden End: diff --git a/doc/effective-version.texi b/doc/effective-version.texi new file mode 100644 index 0000000..d30a6f6 --- /dev/null +++ b/doc/effective-version.texi @@ -0,0 +1 @@ address@hidden EFFECTIVE-VERSION 1.9.0 diff --git a/doc/fdl.texi b/doc/fdl.texi new file mode 100644 index 0000000..7c26c34 --- /dev/null +++ b/doc/fdl.texi @@ -0,0 +1,505 @@ address@hidden The GNU Free Documentation License. address@hidden Version 1.3, 3 November 2008 + address@hidden This file is intended to be included within another document, address@hidden hence no sectioning command or @node. + address@hidden +Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. address@hidden://fsf.org/} + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. address@hidden display + address@hidden 0 address@hidden +PREAMBLE + +The purpose of this License is to make a manual, textbook, or other +functional and useful document @dfn{free} in the sense of freedom: to +assure everyone the effective freedom to copy and redistribute it, +with or without modifying it, either commercially or noncommercially. +Secondarily, this License preserves for the author and publisher a way +to get credit for their work, while not being considered responsible +for modifications made by others. + +This License is a kind of ``copyleft'', which means that derivative +works of the document must themselves be free in the same sense. It +complements the GNU General Public License, which is a copyleft +license designed for free software. + +We have designed this License in order to use it for manuals for free +software, because free software needs free documentation: a free +program should come with manuals providing the same freedoms that the +software does. But this License is not limited to software manuals; +it can be used for any textual work, regardless of subject matter or +whether it is published as a printed book. We recommend this License +principally for works whose purpose is instruction or reference. + address@hidden +APPLICABILITY AND DEFINITIONS + +This License applies to any manual or other work, in any medium, that +contains a notice placed by the copyright holder saying it can be +distributed under the terms of this License. Such a notice grants a +world-wide, royalty-free license, unlimited in duration, to use that +work under the conditions stated herein. The ``Document'', below, +refers to any such manual or work. Any member of the public is a +licensee, and is addressed as ``you''. You accept the license if you +copy, modify or distribute the work in a way requiring permission +under copyright law. + +A ``Modified Version'' of the Document means any work containing the +Document or a portion of it, either copied verbatim, or with +modifications and/or translated into another language. + +A ``Secondary Section'' is a named appendix or a front-matter section +of the Document that deals exclusively with the relationship of the +publishers or authors of the Document to the Document's overall +subject (or to related matters) and contains nothing that could fall +directly within that overall subject. (Thus, if the Document is in +part a textbook of mathematics, a Secondary Section may not explain +any mathematics.) The relationship could be a matter of historical +connection with the subject or with related matters, or of legal, +commercial, philosophical, ethical or political position regarding +them. + +The ``Invariant Sections'' are certain Secondary Sections whose titles +are designated, as being those of Invariant Sections, in the notice +that says that the Document is released under this License. If a +section does not fit the above definition of Secondary then it is not +allowed to be designated as Invariant. The Document may contain zero +Invariant Sections. If the Document does not identify any Invariant +Sections then there are none. + +The ``Cover Texts'' are certain short passages of text that are listed, +as Front-Cover Texts or Back-Cover Texts, in the notice that says that +the Document is released under this License. A Front-Cover Text may +be at most 5 words, and a Back-Cover Text may be at most 25 words. + +A ``Transparent'' copy of the Document means a machine-readable copy, +represented in a format whose specification is available to the +general public, that is suitable for revising the document +straightforwardly with generic text editors or (for images composed of +pixels) generic paint programs or (for drawings) some widely available +drawing editor, and that is suitable for input to text formatters or +for automatic translation to a variety of formats suitable for input +to text formatters. A copy made in an otherwise Transparent file +format whose markup, or absence of markup, has been arranged to thwart +or discourage subsequent modification by readers is not Transparent. +An image format is not Transparent if used for any substantial amount +of text. A copy that is not ``Transparent'' is called ``Opaque''. + +Examples of suitable formats for Transparent copies include plain address@hidden without markup, Texinfo input format, address@hidden input +format, @acronym{SGML} or @acronym{XML} using a publicly available address@hidden, and standard-conforming simple @acronym{HTML}, +PostScript or @acronym{PDF} designed for human modification. Examples +of transparent image formats include @acronym{PNG}, @acronym{XCF} and address@hidden Opaque formats include proprietary formats that can be +read and edited only by proprietary word processors, @acronym{SGML} or address@hidden for which the @acronym{DTD} and/or processing tools are +not generally available, and the machine-generated @acronym{HTML}, +PostScript or @acronym{PDF} produced by some word processors for +output purposes only. + +The ``Title Page'' means, for a printed book, the title page itself, +plus such following pages as are needed to hold, legibly, the material +this License requires to appear in the title page. For works in +formats which do not have any title page as such, ``Title Page'' means +the text near the most prominent appearance of the work's title, +preceding the beginning of the body of the text. + +The ``publisher'' means any person or entity that distributes copies +of the Document to the public. + +A section ``Entitled XYZ'' means a named subunit of the Document whose +title either is precisely XYZ or contains XYZ in parentheses following +text that translates XYZ in another language. (Here XYZ stands for a +specific section name mentioned below, such as ``Acknowledgements'', +``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title'' +of such a section when you modify the Document means that it remains a +section ``Entitled XYZ'' according to this definition. + +The Document may include Warranty Disclaimers next to the notice which +states that this License applies to the Document. These Warranty +Disclaimers are considered to be included by reference in this +License, but only as regards disclaiming warranties: any other +implication that these Warranty Disclaimers may have is void and has +no effect on the meaning of this License. + address@hidden +VERBATIM COPYING + +You may copy and distribute the Document in any medium, either +commercially or noncommercially, provided that this License, the +copyright notices, and the license notice saying this License applies +to the Document are reproduced in all copies, and that you add no other +conditions whatsoever to those of this License. You may not use +technical measures to obstruct or control the reading or further +copying of the copies you make or distribute. However, you may accept +compensation in exchange for copies. If you distribute a large enough +number of copies you must also follow the conditions in section 3. + +You may also lend copies, under the same conditions stated above, and +you may publicly display copies. + address@hidden +COPYING IN QUANTITY + +If you publish printed copies (or copies in media that commonly have +printed covers) of the Document, numbering more than 100, and the +Document's license notice requires Cover Texts, you must enclose the +copies in covers that carry, clearly and legibly, all these Cover +Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on +the back cover. Both covers must also clearly and legibly identify +you as the publisher of these copies. The front cover must present +the full title with all words of the title equally prominent and +visible. You may add other material on the covers in addition. +Copying with changes limited to the covers, as long as they preserve +the title of the Document and satisfy these conditions, can be treated +as verbatim copying in other respects. + +If the required texts for either cover are too voluminous to fit +legibly, you should put the first ones listed (as many as fit +reasonably) on the actual cover, and continue the rest onto adjacent +pages. + +If you publish or distribute Opaque copies of the Document numbering +more than 100, you must either include a machine-readable Transparent +copy along with each Opaque copy, or state in or with each Opaque copy +a computer-network location from which the general network-using +public has access to download using public-standard network protocols +a complete Transparent copy of the Document, free of added material. +If you use the latter option, you must take reasonably prudent steps, +when you begin distribution of Opaque copies in quantity, to ensure +that this Transparent copy will remain thus accessible at the stated +location until at least one year after the last time you distribute an +Opaque copy (directly or through your agents or retailers) of that +edition to the public. + +It is requested, but not required, that you contact the authors of the +Document well before redistributing any large number of copies, to give +them a chance to provide you with an updated version of the Document. + address@hidden +MODIFICATIONS + +You may copy and distribute a Modified Version of the Document under +the conditions of sections 2 and 3 above, provided that you release +the Modified Version under precisely this License, with the Modified +Version filling the role of the Document, thus licensing distribution +and modification of the Modified Version to whoever possesses a copy +of it. In addition, you must do these things in the Modified Version: + address@hidden A address@hidden +Use in the Title Page (and on the covers, if any) a title distinct +from that of the Document, and from those of previous versions +(which should, if there were any, be listed in the History section +of the Document). You may use the same title as a previous version +if the original publisher of that version gives permission. + address@hidden +List on the Title Page, as authors, one or more persons or entities +responsible for authorship of the modifications in the Modified +Version, together with at least five of the principal authors of the +Document (all of its principal authors, if it has fewer than five), +unless they release you from this requirement. + address@hidden +State on the Title page the name of the publisher of the +Modified Version, as the publisher. + address@hidden +Preserve all the copyright notices of the Document. + address@hidden +Add an appropriate copyright notice for your modifications +adjacent to the other copyright notices. + address@hidden +Include, immediately after the copyright notices, a license notice +giving the public permission to use the Modified Version under the +terms of this License, in the form shown in the Addendum below. + address@hidden +Preserve in that license notice the full lists of Invariant Sections +and required Cover Texts given in the Document's license notice. + address@hidden +Include an unaltered copy of this License. + address@hidden +Preserve the section Entitled ``History'', Preserve its Title, and add +to it an item stating at least the title, year, new authors, and +publisher of the Modified Version as given on the Title Page. If +there is no section Entitled ``History'' in the Document, create one +stating the title, year, authors, and publisher of the Document as +given on its Title Page, then add an item describing the Modified +Version as stated in the previous sentence. + address@hidden +Preserve the network location, if any, given in the Document for +public access to a Transparent copy of the Document, and likewise +the network locations given in the Document for previous versions +it was based on. These may be placed in the ``History'' section. +You may omit a network location for a work that was published at +least four years before the Document itself, or if the original +publisher of the version it refers to gives permission. + address@hidden +For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve +the Title of the section, and preserve in the section all the +substance and tone of each of the contributor acknowledgements and/or +dedications given therein. + address@hidden +Preserve all the Invariant Sections of the Document, +unaltered in their text and in their titles. Section numbers +or the equivalent are not considered part of the section titles. + address@hidden +Delete any section Entitled ``Endorsements''. Such a section +may not be included in the Modified Version. + address@hidden +Do not retitle any existing section to be Entitled ``Endorsements'' or +to conflict in title with any Invariant Section. + address@hidden +Preserve any Warranty Disclaimers. address@hidden enumerate + +If the Modified Version includes new front-matter sections or +appendices that qualify as Secondary Sections and contain no material +copied from the Document, you may at your option designate some or all +of these sections as invariant. To do this, add their titles to the +list of Invariant Sections in the Modified Version's license notice. +These titles must be distinct from any other section titles. + +You may add a section Entitled ``Endorsements'', provided it contains +nothing but endorsements of your Modified Version by various +parties---for example, statements of peer review or that the text has +been approved by an organization as the authoritative definition of a +standard. + +You may add a passage of up to five words as a Front-Cover Text, and a +passage of up to 25 words as a Back-Cover Text, to the end of the list +of Cover Texts in the Modified Version. Only one passage of +Front-Cover Text and one of Back-Cover Text may be added by (or +through arrangements made by) any one entity. If the Document already +includes a cover text for the same cover, previously added by you or +by arrangement made by the same entity you are acting on behalf of, +you may not add another; but you may replace the old one, on explicit +permission from the previous publisher that added the old one. + +The author(s) and publisher(s) of the Document do not by this License +give permission to use their names for publicity for or to assert or +imply endorsement of any Modified Version. + address@hidden +COMBINING DOCUMENTS + +You may combine the Document with other documents released under this +License, under the terms defined in section 4 above for modified +versions, provided that you include in the combination all of the +Invariant Sections of all of the original documents, unmodified, and +list them all as Invariant Sections of your combined work in its +license notice, and that you preserve all their Warranty Disclaimers. + +The combined work need only contain one copy of this License, and +multiple identical Invariant Sections may be replaced with a single +copy. If there are multiple Invariant Sections with the same name but +different contents, make the title of each such section unique by +adding at the end of it, in parentheses, the name of the original +author or publisher of that section if known, or else a unique number. +Make the same adjustment to the section titles in the list of +Invariant Sections in the license notice of the combined work. + +In the combination, you must combine any sections Entitled ``History'' +in the various original documents, forming one section Entitled +``History''; likewise combine any sections Entitled ``Acknowledgements'', +and any sections Entitled ``Dedications''. You must delete all +sections Entitled ``Endorsements.'' + address@hidden +COLLECTIONS OF DOCUMENTS + +You may make a collection consisting of the Document and other documents +released under this License, and replace the individual copies of this +License in the various documents with a single copy that is included in +the collection, provided that you follow the rules of this License for +verbatim copying of each of the documents in all other respects. + +You may extract a single document from such a collection, and distribute +it individually under this License, provided you insert a copy of this +License into the extracted document, and follow this License in all +other respects regarding verbatim copying of that document. + address@hidden +AGGREGATION WITH INDEPENDENT WORKS + +A compilation of the Document or its derivatives with other separate +and independent documents or works, in or on a volume of a storage or +distribution medium, is called an ``aggregate'' if the copyright +resulting from the compilation is not used to limit the legal rights +of the compilation's users beyond what the individual works permit. +When the Document is included in an aggregate, this License does not +apply to the other works in the aggregate which are not themselves +derivative works of the Document. + +If the Cover Text requirement of section 3 is applicable to these +copies of the Document, then if the Document is less than one half of +the entire aggregate, the Document's Cover Texts may be placed on +covers that bracket the Document within the aggregate, or the +electronic equivalent of covers if the Document is in electronic form. +Otherwise they must appear on printed covers that bracket the whole +aggregate. + address@hidden +TRANSLATION + +Translation is considered a kind of modification, so you may +distribute translations of the Document under the terms of section 4. +Replacing Invariant Sections with translations requires special +permission from their copyright holders, but you may include +translations of some or all Invariant Sections in addition to the +original versions of these Invariant Sections. You may include a +translation of this License, and all the license notices in the +Document, and any Warranty Disclaimers, provided that you also include +the original English version of this License and the original versions +of those notices and disclaimers. In case of a disagreement between +the translation and the original version of this License or a notice +or disclaimer, the original version will prevail. + +If a section in the Document is Entitled ``Acknowledgements'', +``Dedications'', or ``History'', the requirement (section 4) to Preserve +its Title (section 1) will typically require changing the actual +title. + address@hidden +TERMINATION + +You may not copy, modify, sublicense, or distribute the Document +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense, or distribute it is void, and +will automatically terminate your rights under this License. + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, receipt of a copy of some or all of the same material does +not give you any rights to use it. + address@hidden +FUTURE REVISIONS OF THIS LICENSE + +The Free Software Foundation may publish new, revised versions +of the GNU Free Documentation License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. See address@hidden://www.gnu.org/copyleft/}. + +Each version of the License is given a distinguishing version number. +If the Document specifies that a particular numbered version of this +License ``or any later version'' applies to it, you have the option of +following the terms and conditions either of that specified version or +of any later version that has been published (not as a draft) by the +Free Software Foundation. If the Document does not specify a version +number of this License, you may choose any version ever published (not +as a draft) by the Free Software Foundation. If the Document +specifies that a proxy can decide which future versions of this +License can be used, that proxy's public statement of acceptance of a +version permanently authorizes you to choose that version for the +Document. + address@hidden +RELICENSING + +``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any +World Wide Web server that publishes copyrightable works and also +provides prominent facilities for anybody to edit those works. A +public wiki that anybody can edit is an example of such a server. A +``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the +site means any set of copyrightable works thus published on the MMC +site. + +``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 +license published by Creative Commons Corporation, a not-for-profit +corporation with a principal place of business in San Francisco, +California, as well as future copyleft versions of that license +published by that same organization. + +``Incorporate'' means to publish or republish a Document, in whole or +in part, as part of another Document. + +An MMC is ``eligible for relicensing'' if it is licensed under this +License, and if all works that were first published under this License +somewhere other than this MMC, and subsequently incorporated in whole +or in part into the MMC, (1) had no cover texts or invariant sections, +and (2) were thus incorporated prior to November 1, 2008. + +The operator of an MMC Site may republish an MMC contained in the site +under CC-BY-SA on the same site at any time before August 1, 2009, +provided the MMC is eligible for relicensing. + address@hidden enumerate + address@hidden address@hidden ADDENDUM: How to use this License for your documents + +To use this License in a document you have written, include a copy of +the License in the document and put the following copyright and +license notices just after the title page: + address@hidden address@hidden + Copyright (C) @var{year} @var{your name}. + Permission is granted to copy, distribute and/or modify this document + under the terms of the GNU Free Documentation License, Version 1.3 + or any later version published by the Free Software Foundation; + with no Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. A copy of the license is included in the section entitled ``GNU + Free Documentation License''. address@hidden group address@hidden smallexample + +If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, +replace the address@hidden'' line with this: + address@hidden address@hidden + with the Invariant Sections being @var{list their titles}, with + the Front-Cover Texts being @var{list}, and with the Back-Cover Texts + being @var{list}. address@hidden group address@hidden smallexample + +If you have Invariant Sections without Cover Texts, or some other +combination of the three, merge those two alternatives to suit the +situation. + +If your document contains nontrivial examples of program code, we +recommend releasing these examples in parallel under your choice of +free software license, such as the GNU General Public License, +to permit their use in free software. + address@hidden Local Variables: address@hidden ispell-local-pdict: "ispell-dict" address@hidden End: diff --git a/doc/g-wrap.texi b/doc/g-wrap.texi index dc8d708..abc95f0 100644 --- a/doc/g-wrap.texi +++ b/doc/g-wrap.texi @@ -1,17 +1,41 @@ -\input texinfo @c -*-texinfo-*- +\input texinfo address@hidden -*-texinfo-*- @c %**start of header @setfilename g-wrap.info address@hidden G-Wrap address@hidden on address@hidden Choices for setchapternewpage are {on,off,odd}. address@hidden 0 address@hidden UTF-8 address@hidden G-Wrap Reference Manual address@hidden g-wrap address@hidden MANUAL-REVISION 1 @c %**end of header address@hidden version.texi address@hidden effective-version.texi + address@hidden +This manual documents G-Wrap version @value{VERSION}. + +Copyright @copyright{} 1996-1998 Christopher Lee, 2000-2001 Rob +Browning, 2004 Andreas Rottmann, 2005 Ludovic Courtès, 2006 +Christopher Lee, 2007 Ludovic Courtès, 2014 David Pirotte. + +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU Free Documentation License, Version 1.3 or +any later version published by the Free Software Foundation; with no +Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A +copy of the license is included in the section entitled ``GNU Free +Documentation License.'' address@hidden copying + + @dircategory Libraries @direntry -* G-Wrap: (g-wrap). Scheme wrapper for C libraries +* G-Wrap Reference: (g-wrap). Scheme wrapper for C libraries @end direntry address@hidden Choices for setchapternewpage are {on,off,odd}. address@hidden odd address@hidden @paragraphindent 0 + @iftex @finalout @c DL: lose the egregious vertical whitespace, esp. around examples @@ -20,149 +44,70 @@ @end iftex @titlepage address@hidden G-Wrap address@hidden 10 address@hidden The title is printed in a large font. address@hidden G-Wrap Reference Manual @subtitle A tool to wrap C APIs for Guile use. address@hidden Version 1.9.0 address@hidden June 2004 address@hidden Edition @value{EDITION}, revision @value{MANUAL-REVISION}, +for use with G-Wrap @value{VERSION} @author Christopher Lee @author Rob Browning @author Andreas Rottmann address@hidden Ludovic address@hidden address@hidden Ludovic Courtès address@hidden David Pirotte address@hidden The following two commands start the copyright page. @page @vskip 0pt plus 1filll -Copyright @copyright{} 1996, 1997, 1998, 2006 Christopher Lee -Copyright @copyright{} 2000-2001 Rob Browning -Copyright @copyright{} 2004 Andreas Rottmann -Copyright @copyright{} 2005, 2006, 2007 Ludovic address@hidden - -Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation -approved by the author. address@hidden @end titlepage address@hidden Top, Copying, (dir), (dir) address@hidden - -This is the info manual for G-Wrap, covering versions 1.9.*. - address@hidden ifinfo - address@hidden -* Copying:: -* Introduction:: -* Usage:: -* API Reference:: -* Concept Index:: -* Type and Class Index:: -* Procedure and Method Index:: - address@hidden - --- The Detailed Node Listing --- - -Introduction - -* Overview:: -* Why Create a Wrapper Generator?:: address@hidden @smallbook address@hidden address@hidden double -Usage address@hidden Where to find G-Wrap examples. address@hidden example-dir guile/examples -* A More Detailed Example:: -* Creating a Wrapper Module:: -* Defining New Wrapped Types:: address@hidden address@hidden Top, Introduction, (dir), (dir) address@hidden The G-Wrap Reference Manual -API Reference address@hidden address@hidden 1 address@hidden ifnottex -* Basic Concepts:: -* G-Wrap's High-level API:: -* G-Wrap's Code Generation API:: address@hidden -Basic Concepts +* Preface:: +* Introduction:: -* Wrapsets:: -* Wrapped Types:: -* Typespecs:: -* Wrapped Functions:: +* A More Detailed Example:: +* API Reference:: -G-Wrap's High-level Interface +Appendices -* Wrapping a C Function:: -* Wrapping a C Constant:: -* Wrapping an Enumerate Type:: -* Wrapping a C Pointer Type:: -* C Types Provided in the Standard Wrapset:: -* Wrapping Another Simple C Type:: +* GNU Free Documentation License:: The license of this manual. -G-Wrap's Code Generation Interface +Indices -* Overview of the Code Generation Methods:: -* The Top-Level Methods:: -* Wrapping and Unwrapping Values:: +* Concept Index:: +* Procedure and Method Index:: +* Type and Class Index:: address@hidden detailmenu @end menu address@hidden Chapter ================================================================== address@hidden Copying, Introduction, Top, Top address@hidden Copying - address@hidden Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 address@hidden Free Software Foundation, Inc. address@hidden 675 Mass Ave, Cambridge, MA 02139, USA - address@hidden -Permission to use, copy, modify, distribute, and sell this software and -its documentation for any purpose is hereby granted without fee, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation. - address@hidden NO WARRANTY address@hidden address@hidden -BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR -THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE -ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH -YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL -NECESSARY SERVICING, REPAIR OR CORRECTION. address@hidden preface.texi address@hidden -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR -DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL -DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM -(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF -THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR -OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - address@hidden Chapter ================================================================== address@hidden Introduction, Usage, Copying, Top address@hidden Introduction @chapter Introduction address@hidden -* Overview:: -* Why Create a Wrapper Generator?:: address@hidden menu - address@hidden Overview, Why Create a Wrapper Generator?, Introduction, Introduction address@hidden Overview +G-Wrap is a tool (and guile library) for generating function wrappers +for inter-language calls. It currently only supports generating Guile +wrappers for C functions. Other languages may be supported in the +future, possibly on both sides. Given a definition of the types and prototypes for a given C interface, G-Wrap will automatically generate the C code that provides access to @@ -180,6 +125,61 @@ programmatic one. You tell G-Wrap about your functions and types, and ask it to generate wrappers for you by calling the functions exported from the @code{(g-wrap)} module. +G-Wrap heavily uses address@hidden://www.gnu.org/software/guile/manual/html_node/GOOPS.html#GOOPS, +GOOPS} Guile's object orientation framework. This is what makes +G-Wrap highly customizable: each code generation methods may be +overloaded or redefined in order to meet the user's particular needs. + address@hidden +* Why Create a Wrapper Generator?:: +* Obtaining and Installing G-Wrap:: +* A Simple Example:: address@hidden menu + address@hidden Why Create a Wrapper Generator? address@hidden Why Create a Wrapper Generator? + +When accessing a given foreign API from a variety of target languages, +the description of the foreign API is a common bit of information that +will be needed by the infrastructure supporting each of the target +languages. Further, since the internal mechanisms by which a given +target language can access a foreign API are often in flux, it makes +sense to consider automatically generating the "glue code" that binds +the library API and the target language together. This means that +whenever the foreign function access mechanisms in a target language +change, only G-Wrap (or some similar tool) will need to be updated. +Then all of the relevant glue code can be trivially re-generated. This +is the job that G-Wrap was designed to handle. + +In truth, one of the primary goals of G-Wrap is also to acumulate as +many language independent definitions of various APIs as possible, so +that interfaces for other languages may be generated automatically, +whether by G-Wrap, or some other program. + +The original motivation for G-Wrap came from Aubrey Jaffer's suggestion +to Christopher Lee that using Scheme to parse a language neutral API +specification and generate glue code would be a good way to address this +problem for Scheme interpreters. G-Wrap may well evolve beyond that to +support other languages, but for now, it only handles access to C APIs +from Guile. + +In fact, the original implementation of G-Wrap was much more declarative +than programmatic. The API specification files were not executable +Scheme code, but rather declarative Scheme forms. In the long run, this +might be preferable, if G-Wrap decides to move in the direction of +language independence, or an alternate possibility is to design a +language neutral API spec file (as guile-gnome is trying to do) and then +just have a translator from that to native G-Wrap calls. + + address@hidden install.texi + + address@hidden A Simple Example address@hidden A Simple Example + + As a simple example, if you wanted to wrap a C API that contained only one function with a prototype like this @@ -211,7 +211,7 @@ a complete G-Wrap specification would look like this: (next-method) ;; Populate the wrapset. - (wrap-function! ws + (wrap-function! ws #:name 'frob #:returns 'int #:arguments '((int x) (double y)) @@ -329,62 +329,12 @@ modules to be able to safely exchange data among their wrapped functions when they share common wrapped types. As mentioned, G-Wrap itself is implemented as purely Scheme-code Guile -modules. This means that you you can wrap functions for multiple +modules. This means that you can wrap functions for multiple modules on the fly from any invocation of Guile. address@hidden Why Create a Wrapper Generator?, , Overview, Introduction address@hidden Why Create a Wrapper Generator? -When accessing a given foreign API from a variety of target languages, -the description of the foreign API is a common bit of information that -will be needed by the infrastructure supporting each of the target -languages. Further, since the internal mechanisms by which a given -target language can access a foreign API are often in flux, it makes -sense to consider automatically generating the "glue code" that binds -the library API and the target language together. This means that -whenever the foreign function access mechanisms in a target language -change, only G-Wrap (or some similar tool) will need to be updated. -Then all of the relevant glue code can be trivially re-generated. This -is the job that G-Wrap was designed to handle. - -In truth, one of the primary goals of G-Wrap is also to acumulate as -many language independent definitions of various APIs as possible, so -that interfaces for other languages may be generated automatically, -whether by G-Wrap, or some other program. - -The original motivation for G-Wrap came from Aubrey Jaffer's suggestion -to Christopher Lee that using Scheme to parse a language neutral API -specification and generate glue code would be a good way to address this -problem for Scheme interpreters. G-Wrap may well evolve beyond that to -support other languages, but for now, it only handles access to C APIs -from Guile. - -In fact, the original implementation of G-Wrap was much more declarative -than programmatic. The API specification files were not executable -Scheme code, but rather declarative Scheme forms. In the long run, this -might be preferable, if G-Wrap decides to move in the direction of -language independence, or an alternate possibility is to design a -language neutral API spec file (as gnome-guile is trying to do) and then -just have a translator from that to native G-Wrap calls. - -G-Wrap can be found at @url{http://www.nongnu.org/g-wrap/}. - address@hidden Chapter ================================================================== address@hidden Usage, API Reference, Introduction, Top address@hidden Usage - -This section is a guided tour through G-Wrap programmatic interface -that will get you started quickly by looking at practical examples. -For a more detailed view of the API, please see @xref{API Reference}. - address@hidden -* A More Detailed Example:: -* Creating a Wrapper Module:: -* Defining New Wrapped Types:: address@hidden menu - address@hidden A More Detailed Example, Creating a Wrapper Module, Usage, Usage address@hidden A More Detailed Example address@hidden A More Detailed Example address@hidden A More Detailed Example In this chapter we'll walk through the process of wrapping an increasingly complex C API. In the process, we'll try to hit all the @@ -414,7 +364,16 @@ functions and types. Conventionally, if you're creating a wrapper module named "foo", the wrapset specification file would be named foo-spec.scm, or placed in separate @file{ws/} subdirectory. address@hidden Creating a Wrapper Module, Defining New Wrapped Types, A More Detailed Example, Usage + address@hidden +* Creating a Wrapper Module:: +* Defining New Wrapped Types:: +* The @code{aggregated} Type Qualifier:: +* Reporting Bugs:: address@hidden menu + + address@hidden Creating a Wrapper Module @section Creating a Wrapset Inside the wrapset specification file, the first thing you have to do @@ -458,11 +417,11 @@ want to say something like this: (define-method (initialize (ws ) initargs) (next-method ws (append '(#:module (miscutils)) initargs)) - (wrap-function! + (wrap-function! ws #:name 'join_strings #:returns 'mchars - #:c-name "join_strings" + #:c-name "join_strings" #:arguments '((mchars a) (mchars b)) #:description "Return a string consisting of a followed by b.") @@ -470,7 +429,7 @@ want to say something like this: ws #:name 'seconds-since-dow #:returns 'double - #:c-name "seconds_since_dow" + #:c-name "seconds_since_dow" #:arguments '((uint day-of-week)) #:description "Given day-of-week (ranging 1-7), return elapsed time since then.")) @end example @@ -499,11 +458,11 @@ string that will also be owned by the caller. Given that, the correct way to wrap this function is: @example - (wrap-function! + (wrap-function! ws #:name 'join-strings #:returns '(mchars caller-owned) - #:c-name "join_strings" + #:c-name "join_strings" #:arguments '(((mchars caller-owned) a) ((mchars caller-owned) b)) #:description "Return a string consisting of a followed by b.") @end example @@ -522,7 +481,8 @@ these C functions normally. You could use it like this: guile> @end example address@hidden Defining New Wrapped Types, , Creating a Wrapper Module, Usage + address@hidden Defining New Wrapped Types @section Defining New Wrapped Types Though G-Wrap already provides a number of wrapped types in the @@ -532,13 +492,13 @@ define your own wrapped types. As an example, let's presume someone has added a fine-grained, wide ranging, time type to miscutils along with a function that uses that type like this: - + FIXME: Add an overview of how G-Wrap thinks about types -- i.e. using a template-like process with ccodegens inserting content in important places. @example - + typedef struct @{ long long seconds; long int nanoseconds; @@ -611,7 +571,7 @@ the Scheme side. (list "if (SCM_FALSEP(msu_scm_timespec64_p(" (scm-var value) ")))" `(gw:error ,error-var type ,(wrapped-var value)) - "else\n" + "else\n" " " (var value) " = msu_timespec64_to_c(" (scm-var value) ");\n")) @end lisp @@ -657,8 +617,11 @@ nothing overly fancy, you can get away with just @code{wrap-value-cg}, @code{unwrap-value-cg}. For C values that need deconstruction, there is also @code{destruct-value-cg}. address@hidden Chapter ================================================================== address@hidden API Reference, Concept Index, Usage, Top address@hidden aggregate.texi address@hidden report-bugs.texi + + address@hidden API Reference @chapter API Reference This section is trying to provide a reference for the most important @@ -677,9 +640,9 @@ In any case, reading the section @xref{Basic Concepts}, is highly recommended since it describes concepts used throughout G-Wrap. @menu -* Basic Concepts:: -* G-Wrap's High-level API:: -* G-Wrap's Code Generation API:: +* Basic Concepts:: +* G-Wrap's High-level API:: +* G-Wrap's Code Generation API:: @end menu @node Basic Concepts, G-Wrap's High-level API, API Reference, API Reference @@ -692,20 +655,21 @@ The Goops Reference Manual}) usually exported by the @code{(g-wrap)} module. @menu -* Wrapsets:: -* Wrapped Types:: -* Typespecs:: -* Wrapped Functions:: +* Wrapsets:: +* Wrapped Types:: +* Typespecs:: +* Wrapped Functions:: @end menu address@hidden Wrapsets, Wrapped Types, Basic Concepts, Basic Concepts + address@hidden Wrapsets @subsection Wrapsets @cindex wrapset @tindex A wrapset is roughly an object that holds a representation of all the C types, constants, and functions what one is willing to ``wrap''. -Wrapset specifications as seen in @xref{Overview}, are in fact a piece +Wrapset specifications as seen in @xref{A Simple Example}, are in fact a piece of Scheme code that creates a wrapset object, adds a number of C functions, types, etc. to be wrapped and then generates code for this wrapset. The code generation phase will be described in more details @@ -831,7 +795,8 @@ call @var{proc} (a procedure or generic function). The result is unspecified. @end deffn address@hidden Wrapped Types, Typespecs, Wrapsets, Basic Concepts + address@hidden Wrapped Types @subsection Wrapped Types @tindex @@ -928,15 +893,14 @@ unwraps, or destroys instances of the C type wrapped by @var{type} @end deffn - address@hidden Typespecs, Wrapped Functions, Wrapped Types, Basic Concepts address@hidden Typespecs @subsection Typespecs @tindex FIXME: Write it; see also @xref{Wrapping a C Function}. address@hidden Wrapped Functions, , Typespecs, Basic Concepts address@hidden Wrapped Functions @subsection Wrapped Functions @tindex @@ -948,7 +912,8 @@ FIXME: Write it; see also @xref{Wrapping a C Function}. FIXME: Describe @end deffn address@hidden G-Wrap's High-level API, G-Wrap's Code Generation API, Basic Concepts, API Reference + address@hidden G-Wrap's High-level API @section G-Wrap's High-level Interface G-Wrap's high-level API lives in the @code{(g-wrap)} module, and @@ -967,18 +932,19 @@ however, may be achieved using the lower-level code generation API (@pxref{G-Wrap's Code Generation API}). @menu -* Wrapping a C Function:: -* Wrapping a C Constant:: -* Wrapping an Enumerate Type:: -* Wrapping a C Pointer Type:: -* C Types Provided in the Standard Wrapset:: -* Wrapping Another Simple C Type:: +* Wrapping a C Function:: +* Wrapping a C Constant:: +* Wrapping an Enumerate Type:: +* Wrapping a C Pointer Type:: +* C Types Provided in the Standard Wrapset:: +* Wrapping Another Simple C Type:: @end menu address@hidden Wrapping a C Function, Wrapping a C Constant, G-Wrap's High-level API, G-Wrap's High-level API + address@hidden Wrapping a C Function @subsection Wrapping a C Function -As seen in @xref{Overview}, wrapping a C function using G-Wrap's +As seen in @xref{A Simple Example}, wrapping a C function using G-Wrap's high-level functions is relatively simple. Essentially, it boils down to a call to the @code{wrap-function!} GOOPS method. @@ -988,7 +954,7 @@ be wrapped by @var{wrapset}. The arguments in @var{args} must contain the following named parameters (@pxref{Optional Arguments, @code{(ice-9 optargs)},, guile, The GNU Guile Reference Manual}): address@hidden FIXME: This is (mostly) copied from the `Overview' section. address@hidden FIXME: This is (mostly) copied from the `A Simple Example' section. @table @code @item #:name the symbol which should be bound to the wrapped function in Scheme at @@ -1070,93 +1036,7 @@ Examples of valid usage patterns of @code{wrap-function!} are available in @xref{Creating a Wrapper Module}. address@hidden The @code{aggregated} Type Qualifier - address@hidden memory management address@hidden aggregated object address@hidden constructor -The @code{aggregated} type qualifier is mostly useful when wrapping C -functions (constructors) that return a new object which aggregates -objects passed as its input parameters. In order to illustrate the -need for this typespec, let's imagine the following C API: - address@hidden -/* Return a new stuff. */ -stuff_t *make_stuff (void); - -/* Return a stuff container that contains a pointer to CONTAINED. - Note that the container returned is _not_ responsible for - deallocating the resources attached to CONTAINED. */ -stuff_container_t *make_stuff_container (stuff_t *contained); address@hidden smallexample - -And now, imagine the following Scheme code that uses bindings of the -above functions: - address@hidden -(define c (make-stuff-container (make-stuff))) address@hidden smalllisp - -Suppose the two C types are wrapped as WCTs (@pxref{Wrapping a C -Pointer Type}). The call to @code{make-stuff} will create a new -Scheme object (a WCP, or a ``SMOB'' in Guile terms, @pxref{Defining -New Types (Smobs), SMOBs,, guile, The GNU Guile Reference Manual}) for -the underlying C object. However, as soon as address@hidden has returned, the Scheme code no longer -holds any SMOB representing the value that was returned by address@hidden Consequently, the SMOB returned by address@hidden may soon be garbage-collected by Guile, and its -underlying C object (originally returned by @code{make_stuff ()}) may -soon get freed as well. - -But, here is the problem: the C @code{stuff_container_t} object still -contains a pointer to that @code{stuff_t} object that has just been -deleted! The goal of the @code{aggregated} typespec is to solve -situations like this one. In the example above, the wrapped function -and the container type should be specified as follows: - address@hidden -(wrap-as-wct! ws - #:name ' - #:c-type-name "stuff_t *" - #:c-const-type-name "const stuff_t *" - #:allowed-options '(aggregated)) - -... - -(wrap-function! ws - #:name 'make-stuff-container - #:c-name "make_stuff_container" - #:returns ' - #:arguments '((( aggregated) stuff))) address@hidden lisp - -Literally, this means: ``the argument @var{stuff} of address@hidden is @emph{aggregated} by the object -returned by @code{make-stuff-container}; therefore, it may not be GC'd -unless the object returned by @code{make-stuff-container} is GC'd -too.'' - address@hidden finalization order -Additionally, G-Wrap, in this case, enforces the @emph{finalization -order} of WCPs: even if both the referrer (the address@hidden} object) and its dependency (the @var{stuff} -argument) become unreachable during the same GC phase, G-Wrap makes -sure that their @code{wcp-free-function}s (@pxref{Wrapping a C Pointer -Type}) are called in the right order, i.e., referrer first, dependency -second. - address@hidden reference counting -Note that some libraries, such as GTK+, solve this problem by relying -on reference counting: aggregating objects must increment the -reference counter of the objects they refer to. The @code{aggregated} -type qualifier facility can be seen as a solution for those C -libraries that do @emph{not} use reference counting but have memory -ownership semantics similar to the ones described above. An example -of such a library is Berkeley DB. - - address@hidden Wrapping a C Constant, Wrapping an Enumerate Type, Wrapping a C Function, G-Wrap's High-level API address@hidden Wrapping a C Constant @subsection Wrapping a C Constant @deffn method wrap-constant! (wrapset ) . args @@ -1180,7 +1060,8 @@ a string describing this constant. @end deffn address@hidden Wrapping an Enumerate Type, Wrapping a C Pointer Type, Wrapping a C Constant, G-Wrap's High-level API + address@hidden Wrapping an Enumerate Type @subsection Wrapping an Enumerate Type When wrapping a whole C enumerate type, G-Wrap proposes an interface @@ -1223,7 +1104,7 @@ This can be used as follows: @end deffn address@hidden Wrapping a C Pointer Type, C Types Provided in the Standard Wrapset, Wrapping an Enumerate Type, G-Wrap's High-level API address@hidden Wrapping a C Pointer Type @subsection Wrapping a C Pointer Type @cindex wrapped C type @@ -1315,10 +1196,10 @@ field does get marked. A string describing this wrapped C type. @end table - @end deffn address@hidden C Types Provided in the Standard Wrapset, Wrapping Another Simple C Type, Wrapping a C Pointer Type, G-Wrap's High-level API + address@hidden C Types Provided in the Standard Wrapset @subsection C Types Provided in the Standard Wrapset @cindex standard wrapset @@ -1399,7 +1280,7 @@ qualifiers to the string argument of the wrapped function, such as @code{caller-owned} (@pxref{Wrapping a C Function}). address@hidden Wrapping Another Simple C Type, , C Types Provided in the Standard Wrapset, G-Wrap's High-level API address@hidden Wrapping Another Simple C Type @subsection Wrapping Another Simple C Type If you want to wrap a simple C type which is does not fit in any of @@ -1474,7 +1355,7 @@ to do, then you may have a look at the details of G-Wrap's code generation interface, @xref{G-Wrap's Code Generation API}. address@hidden G-Wrap's Code Generation API, , G-Wrap's High-level API, API Reference address@hidden G-Wrap's Code Generation API @section G-Wrap's Code Generation Interface When creating Scheme bindings for a C programming interface with @@ -1484,23 +1365,25 @@ been added to it, G-Wrap is ready to proceed with the generation of C code implementing these wrappings. In the following sections, we will detail the @dfn{protocol} that is -used to perform code generation. G-Wrap heavily uses GOOPS, Guile's -object orientation framework, to this end (@pxref{Top, Guile's -Object-Oriented Programming System,, goops, The GOOPS Reference -Manual}). This is what makes G-Wrap highly customizable: each of -these code generation methods may be overloaded or redefined in order -to meet the user's particular needs. +used to perform code generation. + +As mentionned in the introduction, G-Wrap heavily uses @pxref{GOOPS,,, +guile, The GNU Guile Reference Manual}, Guile's object orientation +framework. This is what makes G-Wrap highly customizable: each code +generation methods may be overloaded or redefined in order to meet the +user's particular needs. Most of the classes and methods involved in generation of C code are defined in the @code{(g-wrap c-codegen)}. @menu -* Overview of the Code Generation Methods:: -* The Top-Level Methods:: -* Wrapping and Unwrapping Values:: +* Overview of the Code Generation Methods:: +* The Top-Level Methods:: +* Wrapping and Unwrapping Values:: @end menu address@hidden Overview of the Code Generation Methods, The Top-Level Methods, G-Wrap's Code Generation API, G-Wrap's Code Generation API + address@hidden Overview of the Code Generation Methods @subsection Overview of the Code Generation Methods @cindex code generation methods @@ -1553,7 +1436,7 @@ described above. @end deffn address@hidden The Top-Level Methods, Wrapping and Unwrapping Values, Overview of the Code Generation Methods, G-Wrap's Code Generation API address@hidden The Top-Level Methods @subsection The Top-Level Methods As we have just seen, wrapset objects (i.e. instances of a sub-class @@ -1615,7 +1498,8 @@ of it). FIXME: To be continued. address@hidden Wrapping and Unwrapping Values, , The Top-Level Methods, G-Wrap's Code Generation API + address@hidden Wrapping and Unwrapping Values @subsection Wrapping and Unwrapping Values For each specific wrapped type, a specific sequence of C code must be @@ -1704,24 +1588,35 @@ Since G-Wrap allows to construct function calls at run-time via libffi run-time call constructor. @end deffn address@hidden GNU Free Documentation License address@hidden GNU Free Documentation License + address@hidden fdl.texi address@hidden Chapter ================================================================== address@hidden Concept Index, Type and Class Index, API Reference, Top address@hidden Concept Index @unnumbered Concept Index +This index contains concepts, keywords and non-Schemey names for +several features, to make it easier to locate the desired sections. + @printindex cp address@hidden Type and Class Index, Procedure and Method Index, Concept Index, Top address@hidden Type and Class Index address@hidden tp - address@hidden Procedure and Method Index, , Type and Class Index, Top address@hidden Procedure and Method Index @unnumbered Procedure and Method Index +This is an alphabetical list of all the procedures and macros in +G-Wrap. + @printindex fn address@hidden + address@hidden Type and Class Index address@hidden Type and Class Index + address@hidden tp + + @bye @c Local Variables: diff --git a/doc/install.texi b/doc/install.texi new file mode 100644 index 0000000..d4cca5a --- /dev/null +++ b/doc/install.texi @@ -0,0 +1,41 @@ address@hidden -*-texinfo-*- address@hidden This is part of the G-Wrap Reference Manual. address@hidden Copyright (C) 2014 David Pirotte address@hidden See the file g-wrap.texi for copying conditions. + address@hidden Obtaining and Installing G-Wrap address@hidden Obtaining and Installing G-Wrap + +G-Wrap can be obtained from the main GNU archive site address@hidden://download.savannah.gnu.org/releases/g-wrap/} or any of its +mirrors. The file will be named address@hidden The +current version is @value{VERSION}, so the file you should grab is: + address@hidden://download.savannah.gnu.org/releases/g-wrap/address@hidden + +To unbundle G-Wrap use the instruction + address@hidden +zcat address@hidden | tar xvf - address@hidden example + address@hidden +which will create a directory called @address@hidden with +all the sources. You can look at the file @file{INSTALL} for detailed +instructions on how to build and install G-Wrap, but you should be able +to just do + address@hidden +cd address@hidden +./configure --prefix=... +make +make install address@hidden example + +This will install the G-Wrap files in @file{/share/guile/site/g-wrap}. + + address@hidden Local Variables: address@hidden TeX-master: "g-wrap.texi" address@hidden ispell-local-dictionary: "american" address@hidden End: diff --git a/doc/preface.texi b/doc/preface.texi new file mode 100644 index 0000000..435d458 --- /dev/null +++ b/doc/preface.texi @@ -0,0 +1,63 @@ address@hidden -*-texinfo-*- address@hidden This is part of the G-Wrap Reference Manual. address@hidden Copyright (C) 2014 David Pirotte address@hidden See the file g-wrap.texi for copying conditions. + address@hidden Preface address@hidden Preface + +This manual describes how to use G-Wrap. It relates particularly to +G-Wrap version @value{VERSION}. + address@hidden +* Contributors:: +* G-Wrap License:: address@hidden menu + address@hidden Contributors address@hidden Contributors to this Manual + +The contributors to the G-Wrap manual are: + address@hidden @bullet address@hidden Christopher Lee address@hidden Rob Browning address@hidden Andreas Rottmann address@hidden Ludovic Courtès address@hidden David Pirotte address@hidden itemize + +If you find any problems in this manual, please report a bug. See address@hidden Bugs}, for more information on how to report a bug. + address@hidden G-Wrap License address@hidden The G-Wrap License address@hidden copying address@hidden GPL address@hidden LGPL address@hidden license + +G-Wrap is Free Software. G-Wrap is copyrighted, not public domain, and +there are restrictions on its distribution or redistribution, but +these restrictions are designed to permit everything a cooperating +person would want to do. + address@hidden @bullet address@hidden +G-Wrap and supporting files are published under the terms of the GNU +Lesser General Public License version 2 or later. See the file address@hidden + address@hidden +The manual you're now reading is published under the terms of the GNU +Free Documentation License (@pxref{GNU Free Documentation License}). address@hidden itemize + +You must be aware there is no warranty whatsoever for G-Wrap. This is +described in full in the licenses. + + address@hidden Local Variables: address@hidden TeX-master: "g-wrap.texi" address@hidden ispell-local-dictionary: "american" address@hidden End: diff --git a/doc/report-bugs.texi b/doc/report-bugs.texi new file mode 100644 index 0000000..d521e70 --- /dev/null +++ b/doc/report-bugs.texi @@ -0,0 +1,61 @@ address@hidden -*-texinfo-*- address@hidden This is part of the G-Wrap Reference Manual. address@hidden Copyright (C) 2014 David Pirotte address@hidden See the file g-wrap.texi for copying conditions. + + address@hidden Reporting Bugs address@hidden Reporting Bugs + +Any problems with the installation should be reported to address@hidden@@gnu.org}. + +If you find a bug in G-Wrap, please report it to the Guile developers, +so they can fix it. When you write a bug report, please make sure to +include as much of the information described below in the report. If +you can't figure out some of the items, it is not a problem, but the +more information we get, the more likely we can diagnose and fix the +bug. + address@hidden @bullet + address@hidden +The version number of G-Wrap. This manual documents G-Wrap version address@hidden + address@hidden +The version number of Guile. You can get this information from invoking address@hidden --version} at your shell, or calling @code{(version)} from +within Guile. + address@hidden +A complete description of how to reproduce the bug. + +If you have a Scheme program that produces the bug, please include it +in the bug report. If your program is too big to include. please try +to reduce your code to a minimal test case. + address@hidden +A description of the incorrect behavior. For example, "The Guile +process gets a fatal signal," or, "The resulting output is as follows, +which I think is wrong." + +If the manifestation of the bug is a Guile error message, it is +important to report the precise text of the error message, and a +backtrace showing how the Scheme program arrived at the error. This +can be done using the @code{,backtrace} command in Guile's debugger. address@hidden itemize + +If your bug causes Guile to crash, additional information from a +low-level debugger such as GDB might be helpful. If you have built +Guile yourself, you can run Guile under GDB via the address@hidden/gdb-uninstalled-guile} script. Instead of invoking Guile as +usual, invoke the wrapper script, type @code{run} to start the +process, then @code{backtrace} when the crash comes. Include that +backtrace in your report. + + address@hidden Local Variables: address@hidden TeX-master: "g-wrap.texi" address@hidden ispell-local-dictionary: "american" address@hidden End: diff --git a/doc/version.texi b/doc/version.texi new file mode 100644 index 0000000..fe62118 --- /dev/null +++ b/doc/version.texi @@ -0,0 +1,4 @@ address@hidden UPDATED 11 July 2012 address@hidden UPDATED-MONTH July 2012 address@hidden EDITION 1.9.14 address@hidden VERSION 1.9.14 -- 2.1.0