The tools/webserver has been split into dynamically loaded
libraries. You have to compile each of

        py2html
        ocaml2html
        fpc2html
        flx2html
        fdoc2html

separately as DLLs (i.e. not static!). You need to say something like:

        LD_LIBRARY_PATH=src/tools flx src/tools/webserver

to run it at present. The webserver uses a configuration file:

~/felix>less ~/.felix/webserver.config 
C_PATH += /usr/include/c++/4.2.1
C_PATH += /usr/include/c++/4.2.1/x86_64-apple-darwin10
C_PATH += /usr/include/c++/4.4.3
C_PATH += /usr/include/c++/4.4.3/x86_64-linux-gnu
C_PATH += /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include

extension flx -> flx2html::xlat_felix
extension flxh -> flx2html::xlat_felix

extension c     -> cpp2html::xlat_cpp
extension cpp   -> cpp2html::xlat_cpp
extension cxx   -> cpp2html::xlat_cpp
extension h     -> cpp2html::xlat_cpp
extension hpp   -> cpp2html::xlat_cpp

extension fdoc  -> fdoc2html::xlat_fdoc
extension fpc  ->  fpc2html::xlat_fpc
extension ml    -> ocaml2html::xlat_ocaml
extension mli   -> ocaml2html::xlat_ocaml

extension py    -> py2html::xlat_py     ~/.felix/webserver.config

If this can't be found a default is used (namely, the file above :)
You can also specify FDOC_PATH, FLX_PATH, INSTALL_ROOT,
PORT, FLX_PKGCONFIG_PATH and FLX_WEBSERVER_PLUGIN_PATH,
or anything else you want. Some defaults are also used and stuff gets in
from the command line too (for exact details feel free to be confused
by the current code in src/tools/webserver.flx).

This file is NOT created automatically at the moment.
The FLX_WEBSERVER_PLUGIN_PATH variable is not used (yet).

You can add ANYTHING to this file, in particular any data needed for
any plugins you want to add.

At present the webserver does NOT use the file extension to plugin
mapping (it uses the old hard coded mapping). However the 
colouring and highlighting is done by plugins.
Each plugin has a setup function accepting a configuration string.

Some of the plugins call others (eg fdoc2html can call flx2html and
flx2html can call cpp2html).

The dynamic loading technology is a bit complicated. This is because
Felix DOES NOT USE STATIC DATA. Instead you have to create
an *instance* of a library, which is a pair consisting of the library
and a pointer to the libraries global data object (called thread_frame).

To call exported "fun"ctions you have to also pass the thread
frame to the function. Each "instance" of the library has a separate
thread frame, so the webserver's "flx2html" library instance and the
one used by fdoc2html are distinct.

i expect to do more work on the compiler and libraries to make it
a bit easier to use plugins. Plugins are *always* shared libraries.
It isn't possible to statically link them (at the moment).

Do NOT be confused between plugins = run time loaded shared libraries
with symbols identified by strings (not type safe!), and load time dynamic
linkage.
 
At present Felix cannot make load time dynamic link libraries
except ones consisting entirely of C functions (export cfun ..).
The reason is that such libraries cannot have a thread frame,
the system linker just links symbols without regard to sharing
the global data (it shares, maybe, static memory, but Felix
doesn't use that except where the OS forces it (eg signal handlers)
or where I got slack (cin, cout, stdin, stdout etc).

In theory, Felix can unload libraries. Don't even think about it!
It actually will do this (like it or not) if you run the collector
at program termination.

one of the main reasons for making plugins is so that Mike webserver
and the Wiki can also use the same plugins, and of course, to allow
improvements and additions. We're NOT there yet, but the linking
technology is working it seems.

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to