Examples

Introduction

A number of modules are accompanied by small examples. These examples focus mainly on the module itself. The examples on this page use several modules and are more 'real life' examples.

fsdocgen

The fsdocgen tool generates the documentation for the FFL library. Its syntax is:

fsdocgen.fs  OUTPUT DIRECTORY   EXAMPLE DIRECTORY   SOURCE FILES

For example (using gforth, in the ffl directory):

gforth ../examples/fsdocgen.fs ../html/ ../examples/ str.fs

The output directory is the directory in which the html files are written. The example directory is the directory with the optional example source files. The tool appends '_expl.fs' to the source filename (without the extension) for finding the example file. The source file is the file for which documentation should be generated.

In the source file the tool looks for ( .. ) comments. The \ comments are ignored. In the first ( .. ) comment the module name and a short module description, separated by ' = ', are expected. In the following ( .. ) comments the long description of the module is read. This is ended by a empty line in the source file. For example:

( str = Short module description )
( This is the multiline long description )
( of the str module.                     )

In the remainder of the file the ( .. ) comment at the beginning of a line is interpreted as a local header in the generated documentation. If the word- 'private' is present in the header, no documentation is generated until the next- header without a 'private' word. For example:

( This is a public header, which will be part of the documentation )

( This is a private header, which will not be part of the documentation )

If the ( .. ) comment is at the end of a line, it is used to document the leading word. In this comment the ' = ' is used to separate the stack description and the word description. For example:

: dup ( n -- n n = Duplicate the top of the stack )

The fsdocgen tool uses the following modules:

fsdocgen requires FFL version 0.8.0 and command line arguments in the forth engine.

trk2rte

The purpose of the [https://github.com/irdvo/ffl/blob/master/examples/trk2rte.fs trk2rte] example is to accept multiple GPX files with track information, optional optimize these tracks to reduce the number of points in the track and then export all tracks as waypoints and routes in one GPX file or in a OZI waypoint and OZI route file.

For reducing the number of points the trk2rte example uses the angle method: if the bearing of the next segment in comparison with the bearing of the current segment is smaller than the threshold, the intermediate track point is removed.

The trk2rte example uses the following modules:

trk2rte requires FFL version 0.8.0.