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:

  #line 29 "/home/travis/build/felix-lang/felix/src/packages/libstruct.fdoc"
  // ISO C++99 standard header tags
  include "std/c/__init__";
  // core type classes
  include "std/algebra/__init__";
  // base scalar types
  include "std/scalar/__init__";
  // utility
  include "std/debug";
  // control
  include "std/control/__init__";
  include "std/pthread/__init__";
  include "std/program/__init__";
  //memory management
  include "std/gc";
  // I/O
  include "std/io/__init__";
  include "std/time";
  // codecs
  include "std/codec/__init__";
  // base data types
  include "std/datatype/__init__";
  include "std/strings/__init__";
  // database REMOVED
  //include "std/db/__init__";
  // Version
  include "std/version";
  // Platform support (implementation exposure)
  include "std/osx/__init__";
  include "std/posix/__init__";
  include "std/win32/__init__";
  // Felix (implementation exposure)
  include "std/felix/__init__";

and for the Posix subsystem

  #line 131 "/home/travis/build/felix-lang/felix/src/packages/libstruct.fdoc"
  struct Posix {};
  include "std/posix/posix_headers";
  include "std/posix/errno";
  include "std/posix/signal";
  include "std/posix/time";
  include "std/posix/filestat";
  include "std/posix/directory";
  include "std/posix/filesystem";
  include "std/posix/process";
  include "std/posix/shell";
  include "std/posix/faio_posix";
  include "std/posix/mmap";

+ 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 {*.fdoc}, 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


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!