| fb-doc 0.2 documentation tool for FreeBasic

- Main Page
- Tutorial
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
fb-doc_emit_callees.bas
Go to the documentation of this file.
1 /'* \file fb-doc_emit_callees.bas
2 \brief Emitter for the file \em fb-doc.lfn.
3
4 This file contains emitter functions for the \ref EmitterIF to
5 generate the file \em fb-doc.lfn for the Doxygen Back-end. It's the
6 default emitter in \em --list mode.
7
8 The emitters writes the names of all functions (SUB / FUNCTION /
9 PROPERTY) to the output stream, one in a line, separated by a new
10 line character "CHR(10)".
11
12 '/
13
14 CONST CALLEE_TR = !"\n" '*< Separator for entries in file \em fb-doc.lfn.
15
16 /'* \brief Emitter to generate a declaration line
17 \param P the parser calling this emitter
18
19 This emitter gets called when the parser is in a declaration (VAR /
20 DIM / CONST / COMMON / EXTERN / STATIC). It generates a line for
21 each variable name and sends it (them) to the output stream.
22
23 '/
24 SUB callees_decl_ CDECL(BYVAL P AS Parser PTR)
25 WITH *P
26 SELECT CASE AS CONST *.StaTok
27 CASE .TOK_SUB, .TOK_FUNC, .TOK_PROP, .TOK_OPER ' , .TOK_CTOR, .TOK_DTOR
28 CASE ELSE : EXIT SUB
29 END SELECT : IF 0 = .NamTok ORELSE 0 = .FunTok THEN EXIT SUB
30
31 cNam(P)
32 Code(CALLEE_TR)
33 END WITH
34 END SUB
35
36
37 /'* \brief Emitter to start parsing of blocks
38 \param P the parser calling this emitter
39
40 This emitter gets called when the parser finds a block (TYPE / UNION
41 / ENUM). It starts the scanning process in the block.
42
43 '/
44 SUB callees_class_ CDECL(BYVAL P AS Parser PTR)
45 WITH *P
46 IF OPT->AllCallees THEN .parseBlockTyUn(@callees_decl_)
47 END WITH
48 END SUB
49
50
51 /'* \brief Emitter to generate a line for a function name
52 \param P the parser calling this emitter
53
54 This emitter gets called when the parser finds a function (SUB /
55 FUNCTION / PROPERTY). It generates a line with the name of the
56 function and sends it to the output stream.
57
58 '/
59 SUB callees_func_ CDECL(BYVAL P AS Parser PTR) ' !!! ToDo member functions
60 WITH *P
61 cNam(P)
62 Code(CALLEE_TR)
63 END WITH
64 END SUB
65
66
67 /'* \brief Emitter to import a source file
68 \param P the parser calling this emitter
69
70 This emitter gets called when the parser finds an \#INCLUDE
71 statement and option \em --recursiv is given. It checks if the file
72 has been done allready. If not, it creates a new #Parser and starts
73 the scanning process.
74
75 '/
76 SUB callees_include CDECL(BYVAL P AS Parser PTR)
77 WITH *P
78 IF 0 = OPT->InTree THEN EXIT SUB
79 VAR n = .SubStr(.NamTok) : n = MID(n, 2, LEN(n) - 2)
80
81 STATIC AS STRING done
82 VAR f = !"\n" & CURDIR & SLASH & n & !"\n"
83 IF .DivTok THEN IF INSTR(done, f) THEN EXIT SUB
84 done &= f
85
86 VAR fnr = FREEFILE : IF OPEN(n FOR INPUT AS #fnr) THEN EXIT SUB ELSE CLOSE #fnr
87 VAR oldpath = CURDIR
88 VAR c = INSTRREV(n, SLASH) : IF c THEN CHDIR(LEFT(n, c - 1))
89 VAR pars = NEW Parser(OPT->EmitIF)
90
91 PRINT : MSG_LINE(n)
92 pars->Ocha = .Ocha
93 pars->File_(MID(n, c + 1))
94
95 DELETE pars : IF c THEN CHDIR(oldpath)
96 END WITH
97 END SUB
98
99
100 WITH_NEW_EMITTER("Callees")
101 .Clas_ = @callees_class_
102 .Unio_ = @callees_class_
103 .Func_ = @callees_func_
104 .Decl_ = @callees_decl_
105 .Incl_ = @callees_include
106 END WITH
107