| 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.bas
Go to the documentation of this file.
1 ' coding: UTF-8
2 ' This is
3 CONST PROG_NAME = "fb-doc" '*< the name of the programm
4 CONST PROG_VERS = "0.2" '*< the program version
5
6 /'* \file fb-doc.bas
7 \brief The main source file to compile
8
9 This main file includes all the submodules. Compile it by
10 fbc (the FreeBASIC compiler) to create your fb-doc binary.
11
12 '/
13
14
15 /'* \mainpage fb-doc
16
17 fb-doc is a tool for generating documentation from and for FreeBasic
18 source code. Rather than creating the documentation output directly,
19 fb-doc is designed to close the gap between FreeBasic (= FB) and C
20 syntax to allow for using any C / C++ documentation tool-chain. Also
21 it supports the creation of documentational comments in the source
22 and it can get extended via external plugins.
23
24 Find more information in the Tutorial
25
26 - \subpage intro
27 - \subpage installation
28 - \subpage usage
29 - \subpage examples
30 - \subpage pagetables
31 - \subpage externfiles
32 - \subpage extend
33 - \subpage todo
34
35 or at the world wide web:
36
37 - en: \ProjPage
38 - de: http://www.freebasic-portal.de/downloads/ressourcencompiler/fb-doc-229.html
39
40
41 \section licence fb-doc licence (GPLv3):
42
43 Copyright &copy; 2012-2013 by \Email
44
45 This program is free software; you can redistribute it and/or modify
46 it under the terms of the GNU General Public License as published by
47 the Free Software Foundation; either version 2 of the License, or (at
48 your option) any later version.
49
50 This program is distributed in the hope that it will be useful, but
51 WITHOUT ANY WARRANTY; without even the implied warranty of
52 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
53 General Public License for more details.
54
55 You should have received a copy of the GNU General Public License
56 along with this program; if not, write to the Free Software
57 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-
58 1301, USA. For further details please refer to:
59 http://www.gnu.org/licenses/gpl-3.0.html
60
61
62 \section ackno Acknowledgements
63
64 Thanks go to:
65
66 - Dimitri van Heesch (author of Doxygen)
67 - Chris Lyttle, Dan Mueth, Stefan Kost (authors of gtk-doc)
68 - the FreeBasic developers (a great modern programming language with fun-factor)
69 - AGS for testing and bug reporting
70
71 '/
72
73 #INCLUDE ONCE "fb-doc.bi"
74
75 #INCLUDE ONCE "fb-doc_parser.bas"
76 #INCLUDE ONCE "fb-doc_emitters.bas"
77 #INCLUDE ONCE "fb-doc_options.bas"
78
79 ' *** main ***
80
81 OPT = NEW Options()
82
83 WITH *.OPT
84 SELECT CASE AS CONST .RunMode ' execute
85 CASE .HELP_MESSAGE : ERROUT(MSG_HELP)
86 CASE .VERSION_MESSAGE : ERROUT(MSG_VERSION)
87 CASE .GEANYFILTER
88 .Pars->Ocha = FREEFILE
89 OPEN CONS FOR OUTPUT AS #.Pars->Ocha
90 .Pars->StdIn()
91 CLOSE #.Pars->Ocha
92 CASE ELSE
93 IF .RunMode = .SCAN_LIST THEN
94 .Pars->Ocha = FREEFILE
95 IF OPEN(CALLEES_FILE FOR OUTPUT AS #.Pars->Ocha) THEN _
96 ERROUT(" --> Couldn't write " & CALLEES_FILE & ".") : EXIT SELECT
97 .AllCallees = 1
98 ELSEIF .AllCallees >= 0 THEN ' load CALLEES_FILE, if any
99 VAR fnr = FREEFILE '*< File number to read \em fb-doc.lfn
100 IF 0 = OPEN(CALLEES_FILE FOR INPUT AS #fnr) THEN
101 ERROUT("loading " & CALLEES_FILE & " for file " & .InFile)
102 .Callees = STRING(LOF(fnr), 0)
103 GET #fnr, , .Callees
104 CLOSE #fnr
105 .AllCallees = 1
106 END IF
107 END IF
108
109 VAR a = 0, _ '*< Start character of next file name / pattern
110 i = a, _ '*< Counter for characters
111 l = LEN(.InFile) - 1, _ '*< Length of input queue (number of characters)
112 inpat = 0 '*< Flag, set when name is a pattern
113 DO
114 SELECT CASE AS CONST .InFile[i]
115 CASE 0 : EXIT DO
116 CASE ASC("*"), ASC("?") : inpat = 1
117 CASE ASC(";")
118 .InPattern = MID(.InFile, a + 1, i - a)
119 IF inpat THEN IF .InRecursiv < 0 THEN .InRecursiv *= -1
120 .Pattern()
121 inpat = 0
122 a = i + 1
123 END SELECT : i += 1
124 LOOP
125
126 IF .RunMode = .SCAN_LIST THEN
127 MSG_LINE(CALLEES_FILE)
128 CLOSE #.Pars->Ocha
129 ERROUT(" --> written")
130 END IF
131 END SELECT
132 END WITH
133
134 DELETE OPT
135 FOR i AS INTEGER = 0 TO UBOUND(Emitters)
136 DELETE Emitters(i)
137 NEXT
138