1
-------------------------------------------------------------------------------
3
-- This file is part of AdaBrowse.
5
-- <STRONG>Copyright (c) 2002 by Thomas Wolf.</STRONG>
7
-- AdaBrowse is free software; you can redistribute it and/or modify it
8
-- under the terms of the GNU General Public License as published by the
9
-- Free Software Foundation; either version 2, or (at your option) any
10
-- later version. AdaBrowse is distributed in the hope that it will be
11
-- useful, but <EM>without any warranty</EM>; without even the implied
12
-- warranty of <EM>merchantability or fitness for a particular purpose.</EM>
13
-- See the GNU General Public License for more details. You should have
14
-- received a copy of the GNU General Public License with this distribution,
15
-- see file "<A HREF="GPL.txt">GPL.txt</A>". If not, write to the Free
16
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21
-- Author:</STRONG><DD>
23
-- <ADDRESS><A HREF="mailto:twolf@acm.org">twolf@acm.org</A></ADDRESS></DL>
26
-- Purpose:</STRONG><DD>
27
-- File output routines, writing to a file or stdout, as needed.</DL>
32
-- 19-MAR-2002 TW First release.
33
-- 18-JUN-2002 TW Added 'Debug'.
34
-- 22-NOV-2002 TW Added description of "-private" option.
36
-------------------------------------------------------------------------------
46
pragma Elaborate_All (AD.Version);
48
package body AD.Messages is
50
Level : Verbosity := All_Messages;
70
if Level < All_Messages then return; end if;
71
Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error,
72
"adabrowse: Info: " & Msg);
79
if Level < Errors_And_Warnings then return; end if;
80
Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error,
81
"adabrowse: Warning: " & Msg);
88
Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error,
89
"adabrowse: Error: " & Msg);
96
if Level < Including_Debug then return; end if;
97
Ada.Text_IO.Put_Line (Ada.Text_IO.Current_Error,
98
"adabrowse: DBG: " & Msg);
101
LF : constant Character := ASCII.LF;
103
Help : constant String :=
108
" adabrowse (-h | -help | --help | -?)" & LF &
109
" adabrowse {-v | -version | --version | -f file_name | -g |" & LF &
110
" -c file_name | -s URL | -o file_name | -a | -all | --all |"
112
" (-i | -is | -p | -t) [filename] | (-I | -T) directory"
114
" (-G (html [xml] | xml [html]) | -l | " &
115
"-[-]private |" & LF &
116
" -P file_name | -w(0|1|2|e|w|i|a)}"
121
" AdaBrowse " & AD.Version.Get_Version & LF &
123
" AdaBrowse generates HTML documentation from Ada 95 specifications."
125
" It can also produce XML 1.0 output instead of or in addition to HTML"
130
" The following options are available in AdaBrowse:" & LF &
135
" --help Writes this help text." & LF &
138
" --all Generate HTML not only for the unit given"
140
" in the -f option, but also for all application units"
142
" on which it depends semantically (""with""es and"
144
" parent units)." & LF &
145
" -c filename Defines a config file for the HTML " &
147
" Multiple -c options may be given; the files are" & LF &
148
" processed in the given order and may overwrite" & LF &
149
" earlier config settings." & LF &
150
" -f filename Gives the filename (*.ads) of the spec to process."
152
" The file name may contain a path; if it starts with"
154
" '@', AdaBrowse reads unit specs from the given file."
156
" If it is '-', AdaBrowse reads the unit specs from"
158
" stdin. Only one -f option may be given."
160
" -g Generate cross-references to the standard"
162
" library, too." & LF &
163
" -G {format} Specify the output format(s). Recognized"
165
" output format names are ""html"" and ""xml"" (as"
167
" separate arguments). If no -G option is given, the"
169
" default output format is html."
171
" -i [filename] Generate a unit index if unit specs are"
173
" read from a file and the output does *not* go to"
176
" -is [filename] As -i, but generates a structured unit " &
178
" -l Use only the line number in HTML cross-" &
180
" -o filename Define the output file name. If not set,"
182
" the output goes to a file with the name of the input"
184
" and suffix "".html"". If the filename is '-', output"
186
" is written to stdout. If the filename is a directory,"
188
" all generated HTML files will be put there. Only one"
190
" -o option may be given." & LF &
191
" -p [filename] As -i, but generates an index of all " &
192
"subprograms." & LF &
193
" -P filename Process the GNAT project file 'file_name'. Only one"
195
" -P option may be given." & LF &
197
" --private Also process the private part of packages and task "
199
" and protected declarations." & LF &
200
" -q ""Quiet"" mode: do not issue warning " &
201
"or info messages." & LF &
202
" Synonym for ""-w0""." & LF &
203
" -s URL Defines the URL to the style sheet the"
205
" generated HTML file shall use. This URL should be"
207
" relative to the final place where you will put the"
209
" HTML files! Note that a -s option can be overwritten"
211
" by a later -c option, if the configuration file " &
213
" the key ""Style_Sheet""." & LF &
214
" -t [filename] As -i, but generates a global index of all"
219
" --version Print version information of AdaBrowse to"
222
" -wi Set the warning level. 'i' can be one of:"
224
" '0', or 'e' : print only error messages."
226
" '1', or 'w' : print warnings and errors."
228
" '2', or 'a', or 'i' : print all messages." & LF &
229
" 'D' : print even debug information."
231
" -x If set, AdaBrowse never overwrites existing"
233
" HTML Files. (May be useful in conjunction with the -a"
236
" -I directory Define source pathes. Same semantics as"
239
" -T directory Define pathes for ASIS to search for tree"
241
" files (*.adt). Multiple -T options may be given."
243
"One of -f or -P must be given on the command line; if there is a -P but"
245
"no -f, AdaBrowse processes all source files from the given project.";
250
Start : Natural := Help'First;
253
while Start <= Help'Last loop
254
I := Util.Strings.Index (Help (Start .. Help'Last), ASCII.LF);
255
if I = 0 then I := Help'Last + 1; end if;
257
(Ada.Text_IO.Current_Error, Help (Start .. I - 1));