fb-doc  0.4.0
FreeBASIC documentation tool
empty.bas File Reference

Example code for an empty external emitter. More...

Include dependency graph for empty.bas:

Go to the source code of this file.

Functions

SUB_CDECL empty_declare (BYVAL_AS_Parser_PTR P)
 Emitter called when the Parser is at a variable declaration. More...
 
SUB_CDECL empty_function (BYVAL_AS_Parser_PTR P)
 Emitter called when the Parser is on top of a function body. More...
 
SUB_CDECL empty_enum (BYVAL_AS_Parser_PTR P)
 Emitter called when the Parser is at the start of a ENUM block. More...
 
SUB_CDECL empty_union (BYVAL_AS_Parser_PTR P)
 Emitter called when the Parser is at the start of a UNION block. More...
 
SUB_CDECL empty_class (BYVAL_AS_Parser_PTR P)
 Emitter called when the Parser is at the start of a TYPE block. More...
 
SUB_CDECL empty_define (BYVAL_AS_Parser_PTR P)
 Emitter called when the Parser is at an #DEFINE line or at the start of a #MACRO More...
 
SUB_CDECL empty_include (BYVAL_AS_Parser_PTR P)
 Emitter called when the Parser is at an #INCLUDE line. More...
 
SUB_CDECL empty_init (BYVAL_AS_Parser_PTR P)
 Emitter called before the input gets parsed. More...
 
SUB_CDECL empty_error (BYVAL_AS_Parser_PTR P)
 Emitter called for an error. More...
 
SUB_CDECL empty_empty (BYVAL_AS_Parser_PTR P)
 Emitter called for an empty block in mode --geany-mode (-g). More...
 
SUB_CDECL empty_exit (BYVAL_AS_Parser_PTR P)
 Emitter called after the input got parsed. More...
 
SUB_CDECL empty_CTOR (BYVAL_AS_Options_PTR O)
 Emitter called before the parser gets created and the input gets parsed. More...
 
SUB_CDECL empty_DTOR (BYVAL_AS_Options_PTR O)
 Emitter called after the input got parsed and the parser got deleted. More...
 
SUB_CDECL EmitterInit (BYVAL_AS_EmitterIF_PTR Emi, BYREF_AS_STRING Par)
 Initialize the EmitterIF and evaluate parameters. More...
 

Detailed Description

Example code for an empty external emitter.

This file contains example source code for an external emitter. It isn't used in the fb-doc source tree. See External Emitters for details.

This emitter generates a list of the function names called via the emitter interface. So when you input some FB source to fb-doc and use this emitter, the output is a list of the fb-doc functions called by the parser for this input.

Before you can use this emitter, you have to compile it first, using the command

fbc -dylib empty.bas

The result is a binary called

  • libempty.so (LINUX)
  • libempty.dll (windows)

There's no way to compile or use an external emitter on DOS since DOS doesn't support dynamic linked libraries.

To use this emitter in fb-doc set its name (without the suffix .bas) as parameter to option -e. Ie. the emitter output for the context of this file can get written to a text file by

./fb-doc --emitter "empty" empty.bas > test.txt

(LINUX example) and this will generate the following output in file test.txt:

EMPTY_CTOR
EMPTY_INIT
EMPTY_INCLUDE: 77 "../bas/fb-doc_parser.bi"
EMPTY_FUNCTION: 89 empty_declare
EMPTY_FUNCTION: 104 empty_function
EMPTY_FUNCTION: 116 empty_enum
EMPTY_FUNCTION: 128 empty_union
EMPTY_FUNCTION: 140 empty_class
EMPTY_FUNCTION: 152 empty_define
EMPTY_FUNCTION: 168 empty_include
EMPTY_FUNCTION: 180 empty_init
EMPTY_FUNCTION: 192 empty_error
EMPTY_FUNCTION: 204 empty_empty
EMPTY_FUNCTION: 216 empty_exit
EMPTY_FUNCTION: 228 empty_CTOR
EMPTY_FUNCTION: 240 empty_DTOR
EMPTY_FUNCTION: 287 EmitterInit
EMPTY_EXIT
EMPTY_DTOR
  • The constructor (EMPTY_CTOR) is called once at the start after loading the plugin.
  • The EMPTY_INIT function is called at the start of each file (#INCLUDE).
  • The middle part contains EMPTY_FUNCTION calls here (, since the source contains only SUBs and FUNCTIONs).
  • The EMPTY_EXIT function is called at the end of each file (#INCLUDE).
  • The destructor (EMPTY_DTOR) is called once after finishing all input.

Test the plugin with other input files, check also option -t to follow a source tree.

Note
fb-doc checks for internal names first, so don't name your customized emitter similar to an internal emitter name.
Since
0.2.0

Definition in file empty.bas.

Function Documentation

SUB_CDECL empty_declare ( BYVAL_AS_Parser_PTR  P)

Emitter called when the Parser is at a variable declaration.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 86 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_function ( BYVAL_AS_Parser_PTR  P)

Emitter called when the Parser is on top of a function body.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 98 of file empty.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB_CDECL empty_enum ( BYVAL_AS_Parser_PTR  P)

Emitter called when the Parser is at the start of a ENUM block.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 113 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_union ( BYVAL_AS_Parser_PTR  P)

Emitter called when the Parser is at the start of a UNION block.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 125 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_class ( BYVAL_AS_Parser_PTR  P)

Emitter called when the Parser is at the start of a TYPE block.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 137 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_define ( BYVAL_AS_Parser_PTR  P)

Emitter called when the Parser is at an #DEFINE line or at the start of a #MACRO

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 149 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_include ( BYVAL_AS_Parser_PTR  P)

Emitter called when the Parser is at an #INCLUDE line.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 161 of file empty.bas.

Here is the call graph for this function:

Here is the caller graph for this function:

SUB_CDECL empty_init ( BYVAL_AS_Parser_PTR  P)

Emitter called before the input gets parsed.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 177 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_error ( BYVAL_AS_Parser_PTR  P)

Emitter called for an error.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 189 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_empty ( BYVAL_AS_Parser_PTR  P)

Emitter called for an empty block in mode --geany-mode (-g).

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 201 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_exit ( BYVAL_AS_Parser_PTR  P)

Emitter called after the input got parsed.

Parameters
PThe parser calling this emitter

FIXME

Since
0.2.0

Definition at line 213 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_CTOR ( BYVAL_AS_Options_PTR  O)

Emitter called before the parser gets created and the input gets parsed.

Parameters
OThe Options UDT calling this constructor

FIXME

Since
0.2.0

Definition at line 225 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL empty_DTOR ( BYVAL_AS_Options_PTR  O)

Emitter called after the input got parsed and the parser got deleted.

Parameters
OThe Options UDT calling this destructor

FIXME

Since
0.2.0

Definition at line 237 of file empty.bas.

Here is the caller graph for this function:

SUB_CDECL EmitterInit ( BYVAL_AS_EmitterIF_PTR  Emi,
BYREF_AS_STRING  Par 
)

Initialize the EmitterIF and evaluate parameters.

Parameters
EmiThe newly created EmitterIF to fill with our callbacks
ParAdditional command line parameters, not parsed by fb-doc

When the user requires to load this plugin by option --emitter (-e), this SUB gets called to initialize the EmitterIF. Here, all default pointers (= NULL) get replaced by custom functions. Those functions just report all the fb-doc function calls, in order to make the parsing process transparent.

The second parameter Par is a list of all command line parameters which are unknown to fb-doc. Those options get collected in a string, separated by tabulators (`!"\n"), and starting by a tabulator. This SUB extracts and evaluates its parameters from the string. When the string isn't empty at the end of this SUB, the calling fb-doc program stops execution by an unknown options error.

Since
0.4.0

Definition at line 261 of file empty.bas.

Here is the call graph for this function:

Here is the caller graph for this function: