|
1 /* |
|
2 * Copyright (c) 2002-2004 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 * Defines the entry point for the console application |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 // disable "identifier was truncated to '255' characters in the browser information" warning |
|
21 #pragma warning (disable:4786) |
|
22 |
|
23 // disable "decorated name length exceeded, name was truncated" warning |
|
24 #pragma warning (disable:4503) |
|
25 |
|
26 |
|
27 #include <string> |
|
28 #include <vector> |
|
29 #include <algorithm> |
|
30 #include <iostream> |
|
31 #include "extract.h" |
|
32 #include "LayoutCompilerErr.h" |
|
33 #include "Lay2Cdl.h" |
|
34 #include "Cdl2Lag.h" |
|
35 #include "LayCdl2Inst.h" |
|
36 #include "LayCdlCheck.h" |
|
37 #include "LayoutPack.h" |
|
38 #include "LayCdl2InstO.h" |
|
39 #include "MakeLayConvTest.h" |
|
40 #include "LayScale.h" |
|
41 #include "AdaptationLayerTemplate.h" |
|
42 #include "Lay2LayPerf.h" |
|
43 |
|
44 #ifdef RD_XML_PARSER_TOOLCHAIN |
|
45 #include "MLCompData2Cdl.h" |
|
46 #include "MLCompCdl2InstO.h" |
|
47 #include "MLCompData2LayPerf.h" |
|
48 #include "MLEqCompData2DHuiML.h" |
|
49 #endif |
|
50 |
|
51 using namespace std; |
|
52 |
|
53 // In debug builds, we want the debugger to catch exceptions. In release mode we want |
|
54 // to report exceptions to the command line user. |
|
55 // The EXCEPTION_HANDLING macro flag controls this behavior in main() |
|
56 #ifndef _DEBUG |
|
57 #define EXCEPTION_HANDLING |
|
58 #endif |
|
59 |
|
60 class MainArgsErr : public LayoutCompilerErr |
|
61 { |
|
62 void Show(ostream& aStream) const; |
|
63 }; |
|
64 |
|
65 void MainArgsErr::Show(ostream& stream) const |
|
66 { |
|
67 stream << endl; |
|
68 stream << "AknLayoutCompiler @scriptfile" << endl; |
|
69 stream << "AknLayoutCompiler [<options>] <mode> [args]" << endl; |
|
70 stream << " <options> are:" << endl; |
|
71 stream << " -p<output path> has no effect in this version of AknLayoutCompiler." << endl; |
|
72 stream << " <mode> modes are listed below" << endl; |
|
73 stream << " [args] depends on <mode> as listed below" << endl; |
|
74 LayoutExtract::ShowHelp(stream); |
|
75 LayoutToCdl::ShowHelp(stream); |
|
76 CdlToLag::ShowHelp(stream); |
|
77 LayoutAndCdlToCdlInstance::ShowHelp(stream); |
|
78 LayCdlCheck::ShowHelp(stream); |
|
79 LayoutPackage::ShowHelp(stream); |
|
80 LayoutCdlInstanceOpt::ShowHelp(stream); |
|
81 MakeLayoutConvTest::ShowHelp(stream); |
|
82 LayoutScale::ShowHelp(stream); |
|
83 AdaptationLayerTemplate::ShowHelp(stream); |
|
84 LayoutToLayPerf::ShowHelp(stream); |
|
85 #ifdef RD_XML_PARSER_TOOLCHAIN |
|
86 MLCompDataToCdl::ShowHelp(stream); |
|
87 MLCompDataCdlInstanceOpt::ShowHelp(stream); |
|
88 MLEqCompDataToDHuiML::ShowHelp(stream); |
|
89 #endif |
|
90 } |
|
91 |
|
92 int DoMain(int argc, char* argv[]) |
|
93 { |
|
94 CdlTkUtil::SetCommandLine(argc, argv); |
|
95 |
|
96 vector<string> args; |
|
97 copy(argv, argv+argc, back_inserter(args)); |
|
98 |
|
99 if (args.size() < 2) |
|
100 { |
|
101 throw MainArgsErr(); |
|
102 } |
|
103 |
|
104 if (args[1].size() >= 2 && args[1].substr(0,2) == "-p") |
|
105 { |
|
106 CdlTkUtil::SetOutputPath(args[1].substr(2)); |
|
107 args.erase(args.begin()+1); |
|
108 } |
|
109 |
|
110 string& modeName = CdlTkUtil::ToLower(args[1]); |
|
111 |
|
112 if (modeName == "extract") |
|
113 { |
|
114 LayoutExtract extract; |
|
115 return extract.Extract(args); |
|
116 } |
|
117 else if (modeName == "lay2cdl") |
|
118 { |
|
119 return LayoutToCdl::Process(args); |
|
120 } |
|
121 else if (modeName == "cdl2lag") |
|
122 { |
|
123 return CdlToLag::Process(args); |
|
124 } |
|
125 else if (modeName == "laycdl2inst") |
|
126 { |
|
127 return LayoutAndCdlToCdlInstance::Process(args); |
|
128 } |
|
129 else if (modeName == "laycdlcheck") |
|
130 { |
|
131 return LayCdlCheck::Process(args); |
|
132 } |
|
133 else if (modeName == "laypkg") |
|
134 { |
|
135 return LayoutPackage::Process(args); |
|
136 } |
|
137 else if (modeName == "laycdl2insto") |
|
138 { |
|
139 return LayoutCdlInstanceOpt::Process(args); |
|
140 } |
|
141 else if (modeName == "makelayconvtest") |
|
142 { |
|
143 return MakeLayoutConvTest::Process(args); |
|
144 } |
|
145 else if (modeName == "layscale") |
|
146 { |
|
147 return LayoutScale::Process(args); |
|
148 } |
|
149 else if (modeName == "adaptationlayertemplate") |
|
150 { |
|
151 return AdaptationLayerTemplate::Process(args); |
|
152 } |
|
153 else if (modeName == "lay2layperf") |
|
154 { |
|
155 return LayoutToLayPerf::Process(args); |
|
156 } |
|
157 #ifdef RD_XML_PARSER_TOOLCHAIN |
|
158 else if (modeName == "mlcompdata2cdl") |
|
159 { |
|
160 return MLCompDataToCdl::Process(args); |
|
161 } |
|
162 else if (modeName == "mlcompcdl2insto") |
|
163 { |
|
164 return MLCompDataCdlInstanceOpt::Process(args); |
|
165 } |
|
166 else if (modeName == "mlcompdata2layperf") |
|
167 { |
|
168 return MLCompDataToLayPerf::Process(args); |
|
169 } |
|
170 else if (modeName == "mleqcompdata2dhuiml") |
|
171 { |
|
172 return MLEqCompDataToDHuiML::Process(args); |
|
173 } |
|
174 #endif |
|
175 else |
|
176 { |
|
177 throw MainArgsErr(); |
|
178 } |
|
179 |
|
180 return 1; |
|
181 } |
|
182 |
|
183 int main(int argc, char* argv[]) |
|
184 { |
|
185 #ifdef EXCEPTION_HANDLING |
|
186 try |
|
187 { |
|
188 #endif |
|
189 return DoMain(argc, argv); |
|
190 #ifdef EXCEPTION_HANDLING |
|
191 } |
|
192 catch (const CdlCompilerToolkitErr& aErr) |
|
193 { |
|
194 aErr.Show(cerr); |
|
195 } |
|
196 |
|
197 return 1; |
|
198 #endif |
|
199 } |
|
200 |
|
201 // End of File |