On 07/09/2008, at 10:50 PM, [EMAIL PROTECTED] wrote:

> Revision: 2223
>          http://felix.svn.sourceforge.net/felix/?rev=2223&view=rev
> Author:   skaller
> Date:     2008-09-07 12:50:54 +0000 (Sun, 07 Sep 2008)
>
> Log Message:
> -----------
> Add support to wrap Felix libraries into CPython modules(module table)
>

This is the first step in an experiment to see if we can use Felix to
generate Python callable functions. The idea is that

a) Felix can generate extremely fast code (faster than C!)
b) Felix is already a shared library generator
c) It is much easier to write Felix code than C code
   so extending Python with Felix will be much easier than
   writing the equivalent code in C
d) With some compiler support a lot of the housekeeping
   can be done automatically, for example in this step merely
   detecting one of more entries like:

   export fun myPyfunction of (PyInt) as "MyFun";

will cause the compiler to automatically generate
a Python module table and initialisation function
with the correct entry point.

e) With Felix superior C wrapping and resource management
technology interfacing Python with C will be easier than interfacing
Python with C ... :)

The Python header file "Python.h" will be included with the usual
resource management technique, i.e.

        .. require package "Python" ..

which then puts "Python" in the *.resh file and thence requires
a user written Python.fpc file to locate the header file. This will be
triggered by using any Python types defined in the Python.flx file
which will define some Python type and C function wrappers.

At present then, the onus is on the user to create the Python.fpc file
and put it on flx_pkgconfig path.. I will have to "fix" the problem that
the standard place "config" is clobbered on rebuilds.

The user also has to ensure they write valid Python functions.

Perhaps this can be relaxed later by generating wrappers if
a function using say "int" argument is seen, then convert the
value to PyInt automagically.

Note that CALLING Python should also be possible, provided
it is built as a shared library .. this used not to be the case
(it was built as a stand-alone executable). Alternatively,
static link against Python static link library (libraries).

With some further work, it should also be possible to use Python
to start Felix threads, i.e. the Felix event loop (in a thread).

So .. why do this? Well, Felix might get more use doing what it was
originally designed to be -- a  library generator -- than as a
program generator. A new programming language .. nah.
A tool to generate Python modules may appeal more :)


--
john skaller
[EMAIL PROTECTED]





-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to