ExpandCollapsePrev Next Index

+ 19.1 How to Browse library code

The best way to learn Felix and its library .. is to browse the library code. Read the code, try to figure what it is doing, and try to use it.

Have good look at all the files and get some idea what is in the library.

Usually, files include other files they need, and modules will often open modules they need.

However with the standard library, for simplicity and brevity, a special file {lib/std/__init__.flx} is used to load all the other files, and, most of the modules define are opened already.

Without this code would look a bit like C++: {#include} everything, and if it bothered to be modular {using namespace} on each space. This is generally the right way because it makes coupling explicit.

For the standard library we encourage you instead to click:

/share/lib/std/__init__.flx
  NO FILE /share/lib/std/__init__.flx FOUND IN list()

and for the Posix subsystem

/share/lib/std/posix/__init__.flx
  NO FILE /share/lib/std/posix/__init__.flx FOUND IN list()

+ 19.1.1 The Felix webserver

The web server you're using right now is written in Felix and is part of the Felix package. It should be installed in {/usr/local/bin} right now. If you simply type webserver it will run in the console foreground and provide web services on port 1234.

The default Felix root is the {/usr/local/lib/felix/felix-version} where {felix-version} is the version of Felix the webserver was built with.

The webserver can browse Felix documentation files of form {*.html}, Felix code {*.flx} and {*.flxh}, Felix flx_pkgconfig configuration database files {*.fpc} and C and C++ files {*.h}, {*.hpp}, {*.c}, {*.cpp}, {*.cxx}, all with colourisation and hyperlinking of inclusions .. so it's good for browsing C and C++ code too.

Of course it also browses {*.txt}, {*.html}, {*.htm}, {*.jpg}, {*.png} and few other file kinds too, but these are processed in the usual way.

To escape from extreme confusion in the W3C standard regarding filename formation, Felix uses a {$} in the URL to separate the hostname from the filename. For example

http://locahost:1234/$/usr/include/stddef.h

refers to file {/usr/include/stddef.h}. This is an absolute pathname. Felix webserver can browse your whole machine, it isn't restricted to the default root.

If you leave out the {$} separator, the webserver makes a search of some paths (currently builtin: a bug to be fixed!) dependent on the extension.

So you can use the webserver, especially with bookmarks, to easily browse and code you're writing in C, C++ or Felix, with an easy way to examine dependencies (one click .. could it be easier?).

Of course, your IDE or favourite text editor can probably do all this too, but it is hard for the Felix system to provide documentation in a format suitable for all these systems, so it comes with its own webserver!