|
1 /* |
|
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "CmdGlobals.h" |
|
20 #ifdef __WIN__ |
|
21 #pragma warning(disable:4786) |
|
22 #endif |
|
23 #include <xercesc/util/PlatformUtils.hpp> |
|
24 #include <iostream> |
|
25 #include "CommandLine.h" |
|
26 #include "HAException.h" |
|
27 #include "Analyser.h" |
|
28 |
|
29 using namespace std; |
|
30 |
|
31 int main(int argc, char *argv[]) |
|
32 { |
|
33 try |
|
34 { |
|
35 // Perform per-process Xerces XML parser initialization |
|
36 XMLPlatformUtils::Initialize(); |
|
37 } |
|
38 catch (const XMLException& toCatch) |
|
39 { |
|
40 char* message = XMLString::transcode(toCatch.getMessage()); |
|
41 cout << "Error during initialization! :\n" |
|
42 << message << "\n"; |
|
43 XMLString::release(&message); |
|
44 return -1; |
|
45 } |
|
46 |
|
47 int ret=0; |
|
48 try |
|
49 { |
|
50 auto_ptr<Analyser> anal(new Analyser(argv, argc)); |
|
51 ret = anal->analyse(); |
|
52 } catch (HAException e) |
|
53 { |
|
54 cout << e.errorMessage(); |
|
55 XMLPlatformUtils::Terminate(); |
|
56 return -1; |
|
57 } catch (...) |
|
58 { |
|
59 cout << "Program terminated unexpectedly." << endl; |
|
60 XMLPlatformUtils::Terminate(); |
|
61 return -1; |
|
62 } |
|
63 |
|
64 // Perform per-process Xerces XML parser termination |
|
65 XMLPlatformUtils::Terminate(); |
|
66 |
|
67 return ret; |
|
68 } |