coan
6.0.1
A C/C++ Configuration Analyzer
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
main.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
* Copyright (C) 2004, 2006 Symbian Software Ltd. *
3
* All rights reserved. *
4
* Copyright (C) 2007-2013 Mike Kinghan, imk@burroingroingjoing.com *
5
* All rights reserved. *
6
* *
7
* Contributed originally by Mike Kinghan, imk@burroingroingjoing.com *
8
* *
9
* Redistribution and use in source and binary forms, with or without *
10
* modification, are permitted provided that the following conditions *
11
* are met: *
12
* *
13
* Redistributions of source code must retain the above copyright *
14
* notice, this list of conditions and the following disclaimer. *
15
* *
16
* Redistributions in binary form must reproduce the above copyright *
17
* notice, this list of conditions and the following disclaimer in the *
18
* documentation and/or other materials provided with the distribution. *
19
* *
20
* Neither the name of Symbian Software Ltd. nor the names of its *
21
* contributors may be used to endorse or promote products derived from *
22
* this software without specific prior written permission. *
23
* *
24
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
25
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
26
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
27
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
28
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
29
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
30
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS *
31
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED *
32
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,*
33
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF *
34
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
35
* DAMAGE. *
36
* *
37
**************************************************************************/
38
39
#include "
options.h
"
40
#include "
io.h
"
41
#include "
help.h
"
42
#include "
dataset.h
"
43
#include "
diagnostic.h
"
44
#include <iostream>
45
46
using namespace
std;
47
52
static
void
process
();
54
56
int
main
(
int
argc,
char
*argv[])
57
{
58
try
{
59
atexit(
diagnostic_base::epilogue
);
60
options::parse_executable
(argv);
61
options::parse
(argc,argv);
62
options::finish
();
63
process
();
64
// bug...
65
abend_confused
() <<
"Bailing out in confusion"
<<
emit
();
66
}
catch
(
unsigned
ex) {
67
if
(ex ==
error_usage::code
()) {
68
cerr <<
usage
();
69
}
70
exit(
diagnostic_base::exitcode
());
71
}
72
return
0;
73
}
74
75
static
void
76
process
()
77
{
78
if
(
dataset::files
() == 0) {
79
dataset::add
(
io::_stdin_name_
);
80
}
81
dataset::traverse
();
82
exit(
diagnostic_base::exitcode
());
83
}
84
85
/* EOF*/
io::_stdin_name_
static char const *const _stdin_name_
Nominal filename for the standard input stream.
Definition:
io.h:55
dataset::add
static void add(std::string const &path)
Add files to the dataset.
Definition:
dataset.cpp:144
options::parse
static void parse(int argc, char *argv[])
Parse the commandline.
Definition:
options.cpp:705
diagnostic< severity::error, Id >::code
static unsigned code()
Get the reason-code of this diagnostic's type.
Definition:
diagnostic.h:415
io.h
diagnostic_base::exitcode
static int exitcode()
Convert the internal exit status to an exit code for exit().
Definition:
diagnostic.cpp:156
options::finish
static void finish()
Analyse the class global state after parsing the commandline.
Definition:
options.cpp:731
usage
string usage()
Get program usage summary in a string.
Definition:
help.cpp:56
diagnostic_base::epilogue
static void epilogue()
Write summary diagnostics on cerr at exit.
Definition:
diagnostic.cpp:101
emit
The tag class is inserted in a diagnostic_base to tell it to emit itself.
Definition:
diagnostic.h:77
dataset::files
static unsigned files()
Get the number of files in the dataset.
Definition:
dataset.h:135
help.h
options::parse_executable
static void parse_executable(char **argv)
Parse the full and short names of the executable.
Definition:
options.cpp:694
options.h
diagnostic.h
main
int main(int argc, char *argv[])
coan main entry point
Definition:
main.cpp:56
process
static void process()
Execute a coan process.
Definition:
main.cpp:76
dataset.h
dataset::traverse
static void traverse()
Traverse the dataset processing the selected files.
Definition:
dataset.h:130
abend_confused
abend_msg< 4 > abend_confused
Report an internal logic abend.
Definition:
diagnostic.h:792
src
main.cpp
Generated on Tue Sep 16 2014 08:56:19 for coan by
1.8.6