blob: 25a1b6581c3ef52e0f68525cb9c9f1bab61ff8a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#include <iostream>
#ifdef _MSC_VER
#include "getopt.h"
#else
#include <unistd.h>
#endif
#include "Driver.hh"
#include "Log.hh"
#include "Version.hh"
int main(int argc, char* argv[]) {
int rv;
pcc::LogLevel level = pcc::PCC_WARNING;
while ((rv = getopt(argc, argv, "vVh")) != -1) {
switch (rv) {
case 'v':
level = pcc::PCC_DEBUG;
break;
case 'V':
pcc::ShowVersion();
case 'h':
pcc::ShowHelp();
default:
pcc::Log(pcc::PCC_ERROR, "Unknown option \"%c\".", rv);
pcc::ShowHelp();
}
}
if (optind >= argc) {
pcc::Log(pcc::PCC_ERROR, "No input file specified");
return 0;
}
for (int i = optind; i < argc; i++) {
pcc::Context context(argv[i]);
pcc::Driver driver(&context);
std::string filename(argv[i]);
driver.Parse(filename);
}
return 0;
}
|