Code for EmitterIF and auxiliary functions. More...
Go to the source code of this file.
Functions | |
SUB_CDECL | emit_comments (BYVAL_AS_Parser_PTR P, BYVAL_AS_INTEGER Stop_) |
Handler to export comments. More... | |
SUB_CDECL | cppNam (BYVAL_AS_Parser_PTR P) |
Export the name (including double colons for member functions) More... | |
SUB_CDECL | cNam (BYVAL_AS_Parser_PTR P) |
Export the name (including dots for member functions) More... | |
SUB_CDECL | CreateIni (BYVAL_AS_Parser_PTR P) |
Export the initializer(s) for a variable. More... | |
SUB_CDECL | cArrDim (BYVAL_AS_Parser_PTR P) |
The dimension of a variable. More... | |
SUB_CDECL | cppCreateTypNam (BYVAL_AS_Parser_PTR P) |
Create pseude C declaration. More... | |
SUB_CDECL | cCreateTypNam (BYVAL_AS_Parser_PTR P) |
Create C declaration. More... | |
SUB_CDECL | cppEntryListParameter (BYVAL_AS_Parser_PTR P) |
Handler for a parameter declaration in CPP style. More... | |
SUB_CDECL | cEntryListParameter (BYVAL_AS_Parser_PTR P) |
Handler for a parameter declaration in C-style. More... | |
SUB_CDECL | cppCreateFunction (BYVAL_AS_Parser_PTR P) |
Create a function declaration. More... | |
SUB_CDECL | cCreateFunction (BYVAL_AS_Parser_PTR P) |
Create a function declaration. More... | |
SUB_CDECL | emit_error (BYVAL_AS_Parser_PTR P) |
Emitter for an error message. More... | |
SUB_CDECL | emit_source (BYVAL_AS_Parser_PTR P, BYVAL_AS_INTEGER E) |
Handler to exporting FreeBASIC source code. More... | |
SUB_CDECL | geany_init (BYVAL_AS_Parser_PTR P) |
Handler to initialize the source code export. More... | |
SUB_CDECL | geany_exit (BYVAL_AS_Parser_PTR P) |
Handler to finalize the export of source code. More... | |
Code for EmitterIF and auxiliary functions.
This file contains the main source for EmitterIF, used by all emitters. The Parser calls the matching function in the active EmitterIF, after scanning a relevant construct. The emitter function extracts the necessary information from the parser data, formats it as desired and sends it to the output stream.
The file also includes some helper functions to extract code and comments from the original source. And it contains the standard emitter to translate to pseudo C intermediate format, either in C or CPP style (the later is default, used for the Doxygen documentation back-end).
This format includes minimal C source code and all the documentation comments (multi line comment blocks or line end). In order to get the links working, which connects the documentation context and the source code listings, the emitter places all C constructs in the same line number as in the FB code. Also inside the lines, the emitter tries to place all constructs similar as in the FB source (but a comment inside a statement will be placed at the end of the corresponding C statement).
Definition in file fbdoc_emitters.bas.
SUB_CDECL emit_comments | ( | BYVAL_AS_Parser_PTR | P, |
BYVAL_AS_INTEGER | Stop_ | ||
) |
Handler to export comments.
P | the parser calling this handler |
Stop_ | the end position in the input buffer |
Export the comments between the last position SrcBgn
(= source begin) and the Stop_
position. After processing, the Stop_
position gets the new SrcBgn
.
Definition at line 39 of file fbdoc_emitters.bas.
SUB_CDECL cppNam | ( | BYVAL_AS_Parser_PTR | P | ) |
Export the name (including double colons for member functions)
P | the parser calling this emitter |
This property reads the name of a construct from the input buffer and emits all words, concatenated by double colons.
Definition at line 88 of file fbdoc_emitters.bas.
SUB_CDECL cNam | ( | BYVAL_AS_Parser_PTR | P | ) |
Export the name (including dots for member functions)
P | the parser calling this emitter |
This sub reads the name of a construct from the input buffer and emits all words as in the original source.
Definition at line 113 of file fbdoc_emitters.bas.
SUB_CDECL CreateIni | ( | BYVAL_AS_Parser_PTR | P | ) |
Export the initializer(s) for a variable.
P | the parser calling this emitter |
This sub reads the initializer from the input buffer and emits it unchanged. This may be a bunch of text in case of an array initializer.
Definition at line 135 of file fbdoc_emitters.bas.
SUB_CDECL cArrDim | ( | BYVAL_AS_Parser_PTR | P | ) |
The dimension of a variable.
P | the parser calling this emitter |
This property reads the dimension of a construct from the input buffer.
Definition at line 187 of file fbdoc_emitters.bas.
SUB_CDECL cppCreateTypNam | ( | BYVAL_AS_Parser_PTR | P | ) |
Create pseude C declaration.
P | the parser calling this emitter |
Create a declaration for the construct at the current parser position using FB style. All FB keywords gets mangled to a single word to get a FreeBASIC look-and-feel in the documentation. Ie. we emit
The C lexer of the back-end (gtk-doc or Doxygen) interprets this single word as a C type declaration (or macro) and can handle FB source code that way.
Exeptions handled in this SUB:
Definition at line 237 of file fbdoc_emitters.bas.
SUB_CDECL cCreateTypNam | ( | BYVAL_AS_Parser_PTR | P | ) |
Create C declaration.
P | the parser calling this emitter |
Create a C declaration for the construct at the current parser position. All FB keywords gets translated to their C expressions. Ie. we emit
The C source code is very useful when you use a library compiled with FreeBASIC in a other language like C or C++. fb-doc can auto-generate the header files (just check initializers and array dimensioning manually).
Exeptions handled in this SUB:
Definition at line 287 of file fbdoc_emitters.bas.
SUB_CDECL cppEntryListParameter | ( | BYVAL_AS_Parser_PTR | P | ) |
Handler for a parameter declaration in CPP style.
P | the parser calling this handler |
Generate a declaration for a parameter list. The declaration may be empty (), may have no name (prototype declaration) or may by an ellipsis ( ... ). Initializers get emitted "as-is".
We emit a space in front and a comma behind the parameter. When done the first space gets replaced by a '(' and the last comma gets replaced by a ')'.
Definition at line 341 of file fbdoc_emitters.bas.
SUB_CDECL cEntryListParameter | ( | BYVAL_AS_Parser_PTR | P | ) |
Handler for a parameter declaration in C-style.
P | the parser calling this handler |
Generate a declaration for a parameter list. The declaration may be empty (), may have no name (prototype declaration) or may by an ellipsis ( ... ). Initializers get emitted "as-is", this means you have to check if they contain FB keywords (and translate manually, if so).
We emit a space in front and a comma behind the parameter. When done the first space gets replaced by a '(' and the last comma gets replaced by a ')'.
Definition at line 377 of file fbdoc_emitters.bas.
SUB_CDECL cppCreateFunction | ( | BYVAL_AS_Parser_PTR | P | ) |
Create a function declaration.
P | the parser calling this handler |
Generate a declaration for a function (SUB, FUNCTION, DESTRUCTOR, CONSTRUCTOR, PROPERTY). We emit a type, a name and a parameter list.
Exceptions:
Definition at line 408 of file fbdoc_emitters.bas.
SUB_CDECL cCreateFunction | ( | BYVAL_AS_Parser_PTR | P | ) |
Create a function declaration.
P | the parser calling this handler |
Generate a declaration for a function (SUB, FUNCTION, DESTRUCTOR, CONSTRUCTOR, PROPERTY). We emit a type, a name and the parameter list.
Exceptions:
Definition at line 449 of file fbdoc_emitters.bas.
SUB_CDECL emit_error | ( | BYVAL_AS_Parser_PTR | P | ) |
Emitter for an error message.
P | the parser calling this handler |
Generate an error output. When the parser detects an error it calls this function. Depending on the run-mode we do or do not emit an information. In mode --geany-mode (-g) the error message gets shown in the status line (or in the debug window).
Definition at line 484 of file fbdoc_emitters.bas.
SUB_CDECL emit_source | ( | BYVAL_AS_Parser_PTR | P, |
BYVAL_AS_INTEGER | E | ||
) |
Handler to exporting FreeBASIC source code.
P | the parser calling this handler |
E | the end position in the input buffer |
Extract original source code from the input buffer Parser::Buf. The code starts at the last position and gets extracted up to the line end before the given position. This line end gets stored as the new 'last position'.
Definition at line 506 of file fbdoc_emitters.bas.
SUB_CDECL geany_init | ( | BYVAL_AS_Parser_PTR | P | ) |
Handler to initialize the source code export.
P | the parser calling this handler |
This emitter gets called before the parser starts its parsing process. It initializes the FB source code emission.
Definition at line 523 of file fbdoc_emitters.bas.
SUB_CDECL geany_exit | ( | BYVAL_AS_Parser_PTR | P | ) |
Handler to finalize the export of source code.
P | the parser calling this handler |
This emitter gets called after the parser ends its parsing process. It sends the rest of the FB source code to the output stream.
Definition at line 535 of file fbdoc_emitters.bas.