liberty-eiffel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Liberty-eiffel] wrappers_generator


From: Germán Arias
Subject: Re: [Liberty-eiffel] wrappers_generator
Date: Fri, 25 Mar 2016 11:46:36 -0600

Thanks, I will try it and let you know if I have problems.

Germán


El jue, 24-03-2016 a las 16:38 +0100, Paolo Redaelli escribió:
> Sorry for the late answer, I've been put offline by some repairs on my
> land line.
> 
> 
> Il 23/03/2016 03:40, Germán Arias ha scritto:
> 
> > Hi,
> > 
> > Where is and how to use the wrappers_generator tool? I'm using the deb
> > packages, but I don't found the tool. Any advice? Thanks
> It was included in the sources but it wasn't built for adler release. 
> 
> Today I would suggest to rebuild the compiler and work from the Git
> repository.
> 
> 
> You may get the sources from https://github.com/LibertyEiffel/Liberty
> and build it with install.sh script which today also build
> wrappers_generator. In fact the version shipped in adler is quite
> outdated but I should say bugged.
> 
> 
> To produce low-level wrappers wrappers_generator digests the XML
> description of C/C++ code made by gccxml and its successor castxml.
> gccxml is available in Debian stable while castxml is available in
> Debian testing. Both are also available for Ubuntu, Redhat et cetera. 
> 
> 
> I once wrote - too far ago to remember without feeling ashamed - a
> little guide on how to wrap libraries; you may read it at
> http://wiki.liberty-eiffel.org/index.php/Wrapping_C_libraries
> 
> 
> I'm updating it because I wrote it before starting writing
> wrappers_generator and it is mostly a draft.
> 
> 
> Given an XML file and a list of C files (headers or sources) to wrap
> wrappers_generator:
>      1. for each source file create a deferred class containing all
>         the wrappable functions found in that file; functions in foo.h
>         are wrapped into FOO_EXTERNALS 
>      2. for each struct creates a deferred class containing queries
>         and setters feature to manipulate all members which have an
>         Eiffel wrapper type; 
>      3. the same is made for unions
>      4. creates a deferred Eiffel class named like the xml file
>         containing wrappers for all typedefs, so when you have to
>         refer to C "long" which is notorious for change size on
>         various platform you can use "like long" in Eiffel 
>      5. each enumeration is wrapped into expanded classes with proper
>         queries and setters. That way they are as efficient as plain
>         integers values but they can't assume arbitrary values; enum
>         foobar is wrapped into FOOBAR_ENUM
>      6. when the values of an enumeration are actually flags, i.e.
>         they all are diffent powers of 2, it's wrapped as a "flag"
>         enumeration with commands to set and unset each flag of the
>         enum.
>      7. C++ classes, namespaces and all its fineries are currently
>         ignored
>      8. it doesn't handle #define macros since they are "preprocessed
>         away" and doesn't show into the xml files made by
>         castxml/gccxml
>      9. variadic functions can't be wrapped in Eiffel
>     10. it transform CamelCase into CAMEL_CASE for classes, camel_case
>         for features (queries, commands and so on)
>     11. if it doesn't exist it creates a directory plugin/c that will
>         contain all the C code that will be compiled by liberty eiffel
>         when using the library
> 
> It does not try to give high-level, directly usable wrappers but it
> writes fairly verbose low-level wrappers that hopefully will save you
> quite a lot of typing. See how big are the text of generated wrappers
> for those libraries:
> 
> 
>       * readline: 538kb
>       * posix: 2,1Mb
>       * sqlite: 522kb
>       * glib: 2,4Mb
>       * gtk3: 3,3Mb
>       * and so on
> 
> I'm planning a specific tool to handle libraries which uses
> gobject-introspection since their typelib files provides much more
> information allowing to directly produce high-level wrappers. This
> will give us support for Gtk3, Glib, Cairo and many many other
> libraries in a much faster way that manually wrapping each one. It
> will be named leggow, acronym for Liberty Eiffel Generator of GObject
> Wrappers and it currently lies in the leggow branch in my repository
> https://github.com/tybor/Liberty
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]