Fakiir

A tool to generate code for remote process comunication and object exposure

by Denis "jaromil" Rojo
liblo by Steve Harris
xmlrpc++ by Chris Morley

Fakiir generates code to expose C++ classes over the network, using protocols like OSC(udp) and XMLRPC(tcp) to insure a fast or steady comunication channel to receive calls.

This program reads C++ headers and generates the code necessary to expose public functions: fakiir-code.cpp You can compile your program together with the generated code, add 4 lines to your code and then link it to the libfakiir.

Fakiir can help a programmer to write the repetitive and error prone code needed to expose a public API with its methods and properties, generating code for object introspection and access to public functions via XML RPC (TCP) and Open Sound Control (UDP) protocols.

Anyway, at the time being, Fakiir is not yet emploied seriously :D and is an ongoing development... see the ChangeLog.

Future plans include the ability to expose an API in javascript language.

Releases are made available on ftp://ftp.dyne.org/fakiir/releases

To get the code using subversion:

 svn checkout svn://dyne.org/fakiir

Or visit the menu of this web page to browse the code online.

Internals

Fakiir is being written in C++ employing STL with SGI extensions. The gramatic parser is written in Flex and tokens are analyzed using C.

This software is in its early development phase; currently the following limitations are respected:

  • parsed headers must be well formed

i.e. methods must not be implemented inside the header

  • argument types supported are only int, float and char* strings
  • inheritance is supported only up to one level:

only parents, no grand-parents, so that a child can't also be a parent

Access methods are currently implemented for XML-RPC and OSC protocols, linking the liblo-0.18 and xmlrpc++-0.7 libraries.

Test it

just type 'make' and fakiir will be done:

  • a commandline tool to parse your code and generate the fakiir-code.cpp
  • a library (both shared and static format) which should be linked by your application

go inside the test/ directory and type '../fakiir ./testclass.h' and then 'make', this will compile the test-fakiir program which you can run.

the test program accepts call to its functions via readline, OSC and XMLRP on the 7770 port, all at the same time.

Work in progress

Development of Fakiir was just started in february 2005 during a trip thru India.

This code is still not yet employed in a real environment by its author, but it will be very soon. If you are interested you are very welcome to join development, it might take less effort than writing by hand the code Fakiir is going to generate when it's ready ;)

Thanks to Supreet aka Djinn for his advices on string handling and for revamping in me the interest in STL, which i'll be exploring further while developing this software.

References

Links to other projects dealing with code generation:

  • RpcGen is an almost prehistorical tool to generate rpc code from a language similar to C, with the help of the C pre-processor. It is found even in most ancient UNIX systems.
  • Flex the Fast Lexical Analyser Generator is a tool for generating programs that perform pattern-matching on text. There are many applications for Flex, including writing compilers in conjunction with GNU Bison. Flex is a free implementation of the well known Lex program. It is also used by Fakiir in its C++ lexical analyser.
  • SWIG the Simplified Wrapper and Interface Generator is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages. SWIG is used with different types of languages including common scripting languages such as Perl, Python, Tcl/Tk and Ruby.
  • CodeWorker a parsing tool and source code generator is a scriptable tool for code generation which can be trained to recognize and generate arbitrary code. It supports scriptability, extended-BNF notation or tokens for parsing and various methods for generation.
  • SLIRP the S-Lang Interface Package is a C code generator, aimed at simplifying the process of creating modules for the S-Lang scripting language. Using it can dramatically reduce the time and effort required to make C, C++, and FORTRAN code callable directly from the S-Lang interpreter.
  • Pluto sql2cpp C++ classes for mysql creates a C++ library that makes it very easy to work with a relational database.
  • Fistgen code generation tool for stackable filesystems
  • ArchgenXml Plone component code generator from UML
  • GenGen A parameterized-text-generator generator based on a template

Copyleft (C) 2000 - 2004 dyne.org productions and respective authors
Verbatim copying and distribution of this entire page is permitted in any medium, provided this notice is preserved.