sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Header PDRREADR.CPP
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "PDRREADR.H"
|
sl@0
|
21 |
|
sl@0
|
22 |
const int NumResources=34;
|
sl@0
|
23 |
|
sl@0
|
24 |
String IdentResource[NumResources] =
|
sl@0
|
25 |
{
|
sl@0
|
26 |
"Reset",
|
sl@0
|
27 |
"SetPageSize",
|
sl@0
|
28 |
"PreAmble",
|
sl@0
|
29 |
"PostAmble",
|
sl@0
|
30 |
"SetTextColor", // !!
|
sl@0
|
31 |
"BoldOn",
|
sl@0
|
32 |
"BoldOff",
|
sl@0
|
33 |
"ItalicOn",
|
sl@0
|
34 |
"ItalicOff",
|
sl@0
|
35 |
"UnderlineOn",
|
sl@0
|
36 |
"UnderlineOff",
|
sl@0
|
37 |
"StrikethroughOn",
|
sl@0
|
38 |
"StrikethroughOff",
|
sl@0
|
39 |
"NewPage",
|
sl@0
|
40 |
"Portrait",
|
sl@0
|
41 |
"Landscape",
|
sl@0
|
42 |
"SetXPos",
|
sl@0
|
43 |
"SetYPos",
|
sl@0
|
44 |
"IncrementXPos",
|
sl@0
|
45 |
"IncrementYPos",
|
sl@0
|
46 |
"CarriageReturn",
|
sl@0
|
47 |
"SetGraphicsColor", // !!
|
sl@0
|
48 |
"BitmapStart",
|
sl@0
|
49 |
"BitmapEnd",
|
sl@0
|
50 |
"ScanLine",
|
sl@0
|
51 |
"EndScanLine", // !!
|
sl@0
|
52 |
"Resource1",
|
sl@0
|
53 |
"Resource2",
|
sl@0
|
54 |
"Resource3",
|
sl@0
|
55 |
"Resource4",
|
sl@0
|
56 |
"Resource5",
|
sl@0
|
57 |
"Resource6",
|
sl@0
|
58 |
"Resource7",
|
sl@0
|
59 |
"Resource8"
|
sl@0
|
60 |
};
|
sl@0
|
61 |
|
sl@0
|
62 |
const int NumDisplayModeValues = 11;
|
sl@0
|
63 |
|
sl@0
|
64 |
String IdentDisplayModeValue[NumDisplayModeValues] =
|
sl@0
|
65 |
{
|
sl@0
|
66 |
"None",
|
sl@0
|
67 |
"Gray2",
|
sl@0
|
68 |
"Gray4",
|
sl@0
|
69 |
"Gray16",
|
sl@0
|
70 |
"Gray256",
|
sl@0
|
71 |
"Color16",
|
sl@0
|
72 |
"Color256",
|
sl@0
|
73 |
"Color64K",
|
sl@0
|
74 |
"Color16M",
|
sl@0
|
75 |
"Rgb",
|
sl@0
|
76 |
"Color4K"
|
sl@0
|
77 |
};
|
sl@0
|
78 |
|
sl@0
|
79 |
EXPORT_C PdrReader::PdrReader()
|
sl@0
|
80 |
: Reader(),
|
sl@0
|
81 |
iPdrModelStore(),
|
sl@0
|
82 |
iPdrStoreFile(NULL),
|
sl@0
|
83 |
iResources(NULL),
|
sl@0
|
84 |
iTranslates(NULL),
|
sl@0
|
85 |
iCodeSection(NULL),
|
sl@0
|
86 |
iFontInfo(NULL),
|
sl@0
|
87 |
iIndex(Normal),
|
sl@0
|
88 |
iFontHeight(NULL),
|
sl@0
|
89 |
iTypefaceFonts(NULL),
|
sl@0
|
90 |
iModel(NULL)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
EXPORT_C boolean PdrReader::Read(const String& aFilename)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
boolean state = Open(aFilename);
|
sl@0
|
97 |
|
sl@0
|
98 |
while (!_EOF() && state)
|
sl@0
|
99 |
{
|
sl@0
|
100 |
if (IdentComp(IdentResources))
|
sl@0
|
101 |
state = ReadResources();
|
sl@0
|
102 |
else if (IdentComp(IdentTranslates))
|
sl@0
|
103 |
state = ReadTranslates();
|
sl@0
|
104 |
else if (IdentComp(IdentFontInfo))
|
sl@0
|
105 |
state = ReadFontInfo();
|
sl@0
|
106 |
else if (IdentComp(IdentTypefaceFonts))
|
sl@0
|
107 |
state = ReadTypefaceFonts();
|
sl@0
|
108 |
// else if (IdentComp(IdentExtraInfo))
|
sl@0
|
109 |
// state = ReadExtraInfo();
|
sl@0
|
110 |
else if (IdentComp(IdentModel))
|
sl@0
|
111 |
state = ReadModel();
|
sl@0
|
112 |
else if (IdentComp(IdentPdrStoreFile))
|
sl@0
|
113 |
state = ReadPdrStoreFile();
|
sl@0
|
114 |
else
|
sl@0
|
115 |
{
|
sl@0
|
116 |
Error("Resource identifier expected");
|
sl@0
|
117 |
state = efalse;
|
sl@0
|
118 |
}
|
sl@0
|
119 |
if (state)
|
sl@0
|
120 |
state = NewLine();
|
sl@0
|
121 |
}
|
sl@0
|
122 |
return state;
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
EXPORT_C PdrReader::~PdrReader()
|
sl@0
|
126 |
{
|
sl@0
|
127 |
}
|
sl@0
|
128 |
|
sl@0
|
129 |
boolean PdrReader::ReadResources()
|
sl@0
|
130 |
{
|
sl@0
|
131 |
boolean state = etrue;
|
sl@0
|
132 |
iResources = PdrResources::New();
|
sl@0
|
133 |
state = IdentCopy(iResources->iLabel);
|
sl@0
|
134 |
if (state)
|
sl@0
|
135 |
state = NewLine();
|
sl@0
|
136 |
while (!IdentComp(IdentEndResources) && !_EOF() && state)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
int i; // DEF102183: Graphics tools fail to build using MS VC8.
|
sl@0
|
139 |
for (i = 0; (i < NumResources) && !IdentComp(IdentResource[i]); i++)
|
sl@0
|
140 |
{ // Tries to match resources identifier
|
sl@0
|
141 |
}
|
sl@0
|
142 |
if (i < NumResources)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
PdrResource *resource = PdrResource::New();
|
sl@0
|
145 |
state = Command(resource->iString);
|
sl@0
|
146 |
resource->iId = i;
|
sl@0
|
147 |
if (state)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
iResources->AddResource(resource);
|
sl@0
|
150 |
state = NewLine();
|
sl@0
|
151 |
}
|
sl@0
|
152 |
else
|
sl@0
|
153 |
resource->Delete();
|
sl@0
|
154 |
}
|
sl@0
|
155 |
else
|
sl@0
|
156 |
{
|
sl@0
|
157 |
state = efalse;
|
sl@0
|
158 |
Error("Resources identifier expected");
|
sl@0
|
159 |
}
|
sl@0
|
160 |
}
|
sl@0
|
161 |
if (state)
|
sl@0
|
162 |
{
|
sl@0
|
163 |
iPdrModelStore.AddResources(iResources);
|
sl@0
|
164 |
cout << "Resources read\n";
|
sl@0
|
165 |
}
|
sl@0
|
166 |
else
|
sl@0
|
167 |
iResources->Delete();
|
sl@0
|
168 |
return state;
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
boolean PdrReader::ReadTranslates()
|
sl@0
|
172 |
{
|
sl@0
|
173 |
int num;
|
sl@0
|
174 |
boolean state = etrue;
|
sl@0
|
175 |
iTranslates = PdrTranslates::New();
|
sl@0
|
176 |
state = IdentCopy(iTranslates->iLabel);
|
sl@0
|
177 |
if (state)
|
sl@0
|
178 |
state = NewLine();
|
sl@0
|
179 |
while (!IdentComp(IdentEndTranslates) && !_EOF() && state)
|
sl@0
|
180 |
{
|
sl@0
|
181 |
if (iLex->iType == ELexNumber)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
PdrTranslation *translation = PdrTranslation::New();
|
sl@0
|
184 |
Number(num);
|
sl@0
|
185 |
translation->iFrom = uint16(num);
|
sl@0
|
186 |
char ch;
|
sl@0
|
187 |
state = Operator(ch);
|
sl@0
|
188 |
if (state)
|
sl@0
|
189 |
{
|
sl@0
|
190 |
state = (ch == ':');
|
sl@0
|
191 |
if (state)
|
sl@0
|
192 |
{
|
sl@0
|
193 |
if (iLex->iType == ELexNumber)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
state = Number(num);
|
sl@0
|
196 |
translation->iTo += char(num);
|
sl@0
|
197 |
}
|
sl@0
|
198 |
else
|
sl@0
|
199 |
{
|
sl@0
|
200 |
state = Command(translation->iTo);
|
sl@0
|
201 |
}
|
sl@0
|
202 |
if (state)
|
sl@0
|
203 |
state = NewLine();
|
sl@0
|
204 |
}
|
sl@0
|
205 |
else
|
sl@0
|
206 |
{
|
sl@0
|
207 |
Error("Operator ':' expected");
|
sl@0
|
208 |
}
|
sl@0
|
209 |
}
|
sl@0
|
210 |
if (state)
|
sl@0
|
211 |
iTranslates->AddTranslation(translation);
|
sl@0
|
212 |
else
|
sl@0
|
213 |
translation->Delete();
|
sl@0
|
214 |
}
|
sl@0
|
215 |
}
|
sl@0
|
216 |
if (state)
|
sl@0
|
217 |
{
|
sl@0
|
218 |
iPdrModelStore.AddTranslates(iTranslates);
|
sl@0
|
219 |
cout << "Translates read\n";
|
sl@0
|
220 |
}
|
sl@0
|
221 |
else
|
sl@0
|
222 |
iTranslates->Delete();
|
sl@0
|
223 |
return state;
|
sl@0
|
224 |
}
|
sl@0
|
225 |
|
sl@0
|
226 |
boolean PdrReader::ReadCodeSection(int aCode)
|
sl@0
|
227 |
{
|
sl@0
|
228 |
boolean state = etrue;
|
sl@0
|
229 |
int code;
|
sl@0
|
230 |
int num;
|
sl@0
|
231 |
iCodeSection = WidthsCodeSection::New();
|
sl@0
|
232 |
char ch = 0;
|
sl@0
|
233 |
state = Number(num);
|
sl@0
|
234 |
if ((num<aCode) && state)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
Error("CodeSection out of sequence");
|
sl@0
|
237 |
state = efalse;
|
sl@0
|
238 |
}
|
sl@0
|
239 |
if (state)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
iCodeSection->iStart = uint16(num);
|
sl@0
|
242 |
state = Operator(ch);
|
sl@0
|
243 |
if (state)
|
sl@0
|
244 |
state = (ch == ':');
|
sl@0
|
245 |
if (state)
|
sl@0
|
246 |
{
|
sl@0
|
247 |
state = Number(num);
|
sl@0
|
248 |
iCodeSection->iEnd = uint16(num);
|
sl@0
|
249 |
state = NewLine();
|
sl@0
|
250 |
}
|
sl@0
|
251 |
else
|
sl@0
|
252 |
{
|
sl@0
|
253 |
state = efalse;
|
sl@0
|
254 |
Error("Operator ':' expected");
|
sl@0
|
255 |
}
|
sl@0
|
256 |
}
|
sl@0
|
257 |
else
|
sl@0
|
258 |
state = efalse;
|
sl@0
|
259 |
while (!IdentComp(IdentEndCodeSection) && !_EOF() && state)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
if (iLex->iType != ELexNL)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
state = Number(code);
|
sl@0
|
264 |
if ((code != iCodeSection->iStart + iCodeSection->NumWidths()) && state)
|
sl@0
|
265 |
{
|
sl@0
|
266 |
state = efalse;
|
sl@0
|
267 |
Error("Width out of sequence");
|
sl@0
|
268 |
}
|
sl@0
|
269 |
if (state)
|
sl@0
|
270 |
state = Operator(ch);
|
sl@0
|
271 |
if (state)
|
sl@0
|
272 |
state = (ch == ':');
|
sl@0
|
273 |
if (state)
|
sl@0
|
274 |
{
|
sl@0
|
275 |
Width *width = Width::New();
|
sl@0
|
276 |
if (Number(num))
|
sl@0
|
277 |
{
|
sl@0
|
278 |
width->iWidthInPixels = (uint16) num;
|
sl@0
|
279 |
iCodeSection->AddWidth(width);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
else
|
sl@0
|
282 |
{
|
sl@0
|
283 |
state = efalse;
|
sl@0
|
284 |
width->Delete();
|
sl@0
|
285 |
}
|
sl@0
|
286 |
}
|
sl@0
|
287 |
}
|
sl@0
|
288 |
else
|
sl@0
|
289 |
state = NewLine();
|
sl@0
|
290 |
}
|
sl@0
|
291 |
if (state)
|
sl@0
|
292 |
{
|
sl@0
|
293 |
num = ((iCodeSection->iEnd + 1) - iCodeSection->iStart);
|
sl@0
|
294 |
if ((num != iCodeSection->NumWidths()) && (iCodeSection->NumWidths() != 1))
|
sl@0
|
295 |
{
|
sl@0
|
296 |
Error("Wrong number of widths in codesection");
|
sl@0
|
297 |
state = efalse;
|
sl@0
|
298 |
}
|
sl@0
|
299 |
}
|
sl@0
|
300 |
if (state)
|
sl@0
|
301 |
{
|
sl@0
|
302 |
iFontInfo->AddCodeSection(iCodeSection);
|
sl@0
|
303 |
// cout << "Codesection read\n";
|
sl@0
|
304 |
}
|
sl@0
|
305 |
else
|
sl@0
|
306 |
iCodeSection->Delete();
|
sl@0
|
307 |
return state;
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
boolean PdrReader::ReadFontInfo()
|
sl@0
|
311 |
{
|
sl@0
|
312 |
boolean state = etrue;
|
sl@0
|
313 |
iFontInfo = FontInfo::New();
|
sl@0
|
314 |
int num;
|
sl@0
|
315 |
state = IdentCopy(iFontInfo->iLabel);
|
sl@0
|
316 |
if (state)
|
sl@0
|
317 |
state = NewLine();
|
sl@0
|
318 |
while (!IdentComp(IdentEndFontInfo) && !_EOF() && state)
|
sl@0
|
319 |
{
|
sl@0
|
320 |
if (iLex->iType == ELexIdent)
|
sl@0
|
321 |
{
|
sl@0
|
322 |
if (IdentComp(IdentCodeSection))
|
sl@0
|
323 |
{
|
sl@0
|
324 |
int code = 0,size = iFontInfo->NumCodeSections();
|
sl@0
|
325 |
if (size)
|
sl@0
|
326 |
code = iFontInfo->CodeSectionList(size - 1)->iEnd + 1;
|
sl@0
|
327 |
state = ReadCodeSection(code);
|
sl@0
|
328 |
}
|
sl@0
|
329 |
else if (IdentComp(IdentAscent))
|
sl@0
|
330 |
{
|
sl@0
|
331 |
if (Number(num))
|
sl@0
|
332 |
iFontInfo->iAscentInPixels = uint16(num);
|
sl@0
|
333 |
else
|
sl@0
|
334 |
state = efalse;
|
sl@0
|
335 |
}
|
sl@0
|
336 |
else if (IdentComp(IdentMaxNormalCharWidth))
|
sl@0
|
337 |
{
|
sl@0
|
338 |
state = Number(num);
|
sl@0
|
339 |
if (state)
|
sl@0
|
340 |
iFontInfo->iMaxNormalCharWidthInPixels = uint16(num);
|
sl@0
|
341 |
}
|
sl@0
|
342 |
else
|
sl@0
|
343 |
{
|
sl@0
|
344 |
Error("Unrecognised fontinfo identifier");
|
sl@0
|
345 |
state = efalse;
|
sl@0
|
346 |
}
|
sl@0
|
347 |
}
|
sl@0
|
348 |
else
|
sl@0
|
349 |
{
|
sl@0
|
350 |
Error("Fontinfo identifier expected");
|
sl@0
|
351 |
state = efalse;
|
sl@0
|
352 |
}
|
sl@0
|
353 |
if (state)
|
sl@0
|
354 |
state = NewLine();
|
sl@0
|
355 |
}
|
sl@0
|
356 |
if (state)
|
sl@0
|
357 |
{
|
sl@0
|
358 |
iFontInfo->iMaxCharWidthInPixels = 0;
|
sl@0
|
359 |
for (int i = 0; i < iFontInfo->NumCodeSections(); i++)
|
sl@0
|
360 |
{
|
sl@0
|
361 |
WidthsCodeSection* codesection = iFontInfo->CodeSectionList(i);
|
sl@0
|
362 |
for (int j = 0; j < codesection->NumWidths(); j++)
|
sl@0
|
363 |
{
|
sl@0
|
364 |
int width = codesection->WidthList(j)->iWidthInPixels;
|
sl@0
|
365 |
if (width > iFontInfo->iMaxCharWidthInPixels)
|
sl@0
|
366 |
iFontInfo->iMaxCharWidthInPixels = (uint16) width;
|
sl@0
|
367 |
}
|
sl@0
|
368 |
}
|
sl@0
|
369 |
}
|
sl@0
|
370 |
if (state)
|
sl@0
|
371 |
{
|
sl@0
|
372 |
iPdrModelStore.AddFontInfo(iFontInfo);
|
sl@0
|
373 |
cout << "Fontinfo read\n";
|
sl@0
|
374 |
}
|
sl@0
|
375 |
else
|
sl@0
|
376 |
iFontInfo->Delete();
|
sl@0
|
377 |
return state;
|
sl@0
|
378 |
}
|
sl@0
|
379 |
|
sl@0
|
380 |
boolean PdrReader::ReadStyle()
|
sl@0
|
381 |
{
|
sl@0
|
382 |
boolean state = etrue;
|
sl@0
|
383 |
Record *fontinfo;
|
sl@0
|
384 |
PdrStyle *style;
|
sl@0
|
385 |
String label;
|
sl@0
|
386 |
if (!iTypefaceFonts->iIsScalable)
|
sl@0
|
387 |
style = &iFontHeight->iStyle[iIndex];
|
sl@0
|
388 |
else
|
sl@0
|
389 |
style = &iTypefaceFonts->iScalableFontHeight.iStyle[iIndex];
|
sl@0
|
390 |
style->iIsAvailable = etrue;
|
sl@0
|
391 |
state = IdentCopy(label);
|
sl@0
|
392 |
if (state)
|
sl@0
|
393 |
{
|
sl@0
|
394 |
fontinfo = iPdrModelStore.FindFontInfo(label);
|
sl@0
|
395 |
if (fontinfo)
|
sl@0
|
396 |
style->iFontInfo = fontinfo;
|
sl@0
|
397 |
else
|
sl@0
|
398 |
{
|
sl@0
|
399 |
Error("Fontinfo not found");
|
sl@0
|
400 |
state = efalse;
|
sl@0
|
401 |
}
|
sl@0
|
402 |
}
|
sl@0
|
403 |
return state;
|
sl@0
|
404 |
}
|
sl@0
|
405 |
|
sl@0
|
406 |
boolean PdrReader::ReadFontHeight()
|
sl@0
|
407 |
{
|
sl@0
|
408 |
boolean state = etrue;
|
sl@0
|
409 |
int num;
|
sl@0
|
410 |
if (iTypefaceFonts->iIsScalable == etrue)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
state = efalse;
|
sl@0
|
413 |
Error("Scalablefontheight already defined");
|
sl@0
|
414 |
}
|
sl@0
|
415 |
else
|
sl@0
|
416 |
iFontHeight = PdrFontHeight::New();
|
sl@0
|
417 |
if (state)
|
sl@0
|
418 |
state = NewLine();
|
sl@0
|
419 |
|
sl@0
|
420 |
while (!IdentComp(IdentEndFontHeight) && !_EOF() && state)
|
sl@0
|
421 |
{
|
sl@0
|
422 |
if (iLex->iType == ELexIdent)
|
sl@0
|
423 |
{
|
sl@0
|
424 |
if (IdentComp(IdentHeight))
|
sl@0
|
425 |
{
|
sl@0
|
426 |
if (Number(num))
|
sl@0
|
427 |
iFontHeight->iHeightInTwips = num;
|
sl@0
|
428 |
else
|
sl@0
|
429 |
state = efalse;
|
sl@0
|
430 |
}
|
sl@0
|
431 |
else if (IdentComp(IdentWidthScale))
|
sl@0
|
432 |
{
|
sl@0
|
433 |
if (Number(num))
|
sl@0
|
434 |
iFontHeight->iWidthScale = num;
|
sl@0
|
435 |
else
|
sl@0
|
436 |
state = efalse;
|
sl@0
|
437 |
}
|
sl@0
|
438 |
else if (IdentComp(IdentNormal))
|
sl@0
|
439 |
{
|
sl@0
|
440 |
iIndex = Normal;
|
sl@0
|
441 |
state = ReadStyle();
|
sl@0
|
442 |
}
|
sl@0
|
443 |
else if (IdentComp(IdentBold))
|
sl@0
|
444 |
{
|
sl@0
|
445 |
iIndex = Bold;
|
sl@0
|
446 |
state = ReadStyle();
|
sl@0
|
447 |
}
|
sl@0
|
448 |
else if (IdentComp(IdentItalic))
|
sl@0
|
449 |
{
|
sl@0
|
450 |
iIndex = Italic;
|
sl@0
|
451 |
state = ReadStyle();
|
sl@0
|
452 |
}
|
sl@0
|
453 |
else if (IdentComp(IdentBoldItalic))
|
sl@0
|
454 |
{
|
sl@0
|
455 |
iIndex = BoldItalic;
|
sl@0
|
456 |
state = ReadStyle();
|
sl@0
|
457 |
}
|
sl@0
|
458 |
else if (IdentComp(IdentCommand))
|
sl@0
|
459 |
{
|
sl@0
|
460 |
state = Command(iFontHeight->iCommandString);
|
sl@0
|
461 |
}
|
sl@0
|
462 |
else
|
sl@0
|
463 |
{
|
sl@0
|
464 |
Error("Unrecognised fontheight identifier");
|
sl@0
|
465 |
state = efalse;
|
sl@0
|
466 |
}
|
sl@0
|
467 |
}
|
sl@0
|
468 |
else
|
sl@0
|
469 |
{
|
sl@0
|
470 |
Error("Fontheight identifier expected");
|
sl@0
|
471 |
state = efalse;
|
sl@0
|
472 |
}
|
sl@0
|
473 |
if (state)
|
sl@0
|
474 |
state = NewLine();
|
sl@0
|
475 |
}
|
sl@0
|
476 |
if (state)
|
sl@0
|
477 |
{
|
sl@0
|
478 |
iTypefaceFonts->AddFontHeight(iFontHeight);
|
sl@0
|
479 |
cout << "Fontheight read\n";
|
sl@0
|
480 |
}
|
sl@0
|
481 |
else
|
sl@0
|
482 |
iFontHeight->Delete();
|
sl@0
|
483 |
return state;
|
sl@0
|
484 |
}
|
sl@0
|
485 |
|
sl@0
|
486 |
boolean PdrReader::ReadScalableFontHeight()
|
sl@0
|
487 |
{
|
sl@0
|
488 |
boolean state = etrue;
|
sl@0
|
489 |
int num;
|
sl@0
|
490 |
if (iTypefaceFonts->NumFontHeights())
|
sl@0
|
491 |
{
|
sl@0
|
492 |
state = efalse;
|
sl@0
|
493 |
Error("Non-scalable fontheights already defined");
|
sl@0
|
494 |
}
|
sl@0
|
495 |
else if (iTypefaceFonts->iIsScalable == etrue)
|
sl@0
|
496 |
{
|
sl@0
|
497 |
state = efalse;
|
sl@0
|
498 |
Error("Scalablefontheight already defined");
|
sl@0
|
499 |
}
|
sl@0
|
500 |
iTypefaceFonts->iIsScalable=etrue;
|
sl@0
|
501 |
if (state)
|
sl@0
|
502 |
state = NewLine();
|
sl@0
|
503 |
|
sl@0
|
504 |
while (!IdentComp(IdentEndScalableFontHeight) && !_EOF() && state)
|
sl@0
|
505 |
{
|
sl@0
|
506 |
if (iLex->iType == ELexIdent)
|
sl@0
|
507 |
{
|
sl@0
|
508 |
if (IdentComp(IdentHeightMin))
|
sl@0
|
509 |
{
|
sl@0
|
510 |
if (Number(num))
|
sl@0
|
511 |
iTypefaceFonts->iScalableFontHeight.iHeightMinInTwips = num;
|
sl@0
|
512 |
else
|
sl@0
|
513 |
state = efalse;
|
sl@0
|
514 |
}
|
sl@0
|
515 |
else if (IdentComp(IdentHeightMax))
|
sl@0
|
516 |
{
|
sl@0
|
517 |
if (Number(num))
|
sl@0
|
518 |
iTypefaceFonts->iScalableFontHeight.iHeightMaxInTwips = num;
|
sl@0
|
519 |
else
|
sl@0
|
520 |
state = efalse;
|
sl@0
|
521 |
}
|
sl@0
|
522 |
else if (IdentComp(IdentHeightDelta))
|
sl@0
|
523 |
{
|
sl@0
|
524 |
if (Number(num))
|
sl@0
|
525 |
iTypefaceFonts->iScalableFontHeight.iHeightDeltaInTwips = num;
|
sl@0
|
526 |
else
|
sl@0
|
527 |
state = efalse;
|
sl@0
|
528 |
}
|
sl@0
|
529 |
else if (IdentComp(IdentNormal))
|
sl@0
|
530 |
{
|
sl@0
|
531 |
iIndex = Normal;
|
sl@0
|
532 |
state = ReadStyle();
|
sl@0
|
533 |
}
|
sl@0
|
534 |
else if (IdentComp(IdentBold))
|
sl@0
|
535 |
{
|
sl@0
|
536 |
iIndex = Bold;
|
sl@0
|
537 |
state = ReadStyle();
|
sl@0
|
538 |
}
|
sl@0
|
539 |
else if (IdentComp(IdentItalic))
|
sl@0
|
540 |
{
|
sl@0
|
541 |
iIndex = Italic;
|
sl@0
|
542 |
state = ReadStyle();
|
sl@0
|
543 |
}
|
sl@0
|
544 |
else if (IdentComp(IdentBoldItalic))
|
sl@0
|
545 |
{
|
sl@0
|
546 |
iIndex = BoldItalic;
|
sl@0
|
547 |
state = ReadStyle();
|
sl@0
|
548 |
}
|
sl@0
|
549 |
else if (IdentComp(IdentCommand))
|
sl@0
|
550 |
{
|
sl@0
|
551 |
state = Command(iTypefaceFonts->iScalableFontHeight.iCommandString);
|
sl@0
|
552 |
}
|
sl@0
|
553 |
else
|
sl@0
|
554 |
{
|
sl@0
|
555 |
Error("Unrecognised scalablefontheight identifier");
|
sl@0
|
556 |
state = efalse;
|
sl@0
|
557 |
}
|
sl@0
|
558 |
}
|
sl@0
|
559 |
else
|
sl@0
|
560 |
{
|
sl@0
|
561 |
Error("Scalablefontheight identifier expected");
|
sl@0
|
562 |
state = efalse;
|
sl@0
|
563 |
}
|
sl@0
|
564 |
if (state)
|
sl@0
|
565 |
state = NewLine();
|
sl@0
|
566 |
}
|
sl@0
|
567 |
if (state)
|
sl@0
|
568 |
{
|
sl@0
|
569 |
cout << "Scalablefontheight read\n";
|
sl@0
|
570 |
}
|
sl@0
|
571 |
else
|
sl@0
|
572 |
{
|
sl@0
|
573 |
if (!iTypefaceFonts->iIsScalable)
|
sl@0
|
574 |
iFontHeight->Delete();
|
sl@0
|
575 |
}
|
sl@0
|
576 |
return state;
|
sl@0
|
577 |
}
|
sl@0
|
578 |
|
sl@0
|
579 |
boolean PdrReader::ReadTypefaceFonts()
|
sl@0
|
580 |
{
|
sl@0
|
581 |
boolean state = etrue;
|
sl@0
|
582 |
Record* translates;
|
sl@0
|
583 |
String label;
|
sl@0
|
584 |
iTypefaceFonts = TypefaceFonts::New();
|
sl@0
|
585 |
state = IdentCopy(iTypefaceFonts->iLabel);
|
sl@0
|
586 |
if (state)
|
sl@0
|
587 |
state = NewLine();
|
sl@0
|
588 |
while (!IdentComp(IdentEndTypefaceFonts) && !_EOF() && state)
|
sl@0
|
589 |
{
|
sl@0
|
590 |
if (iLex->iType == ELexIdent)
|
sl@0
|
591 |
{
|
sl@0
|
592 |
if (IdentComp(IdentTypefaceName))
|
sl@0
|
593 |
{
|
sl@0
|
594 |
if (StringCopy(iTypefaceFonts->iTypeface.iName))
|
sl@0
|
595 |
while (iLex->iType != ELexNL)
|
sl@0
|
596 |
{ if (IdentComp(IdentProportional))
|
sl@0
|
597 |
iTypefaceFonts->iTypeface.iFlags = boolean(iTypefaceFonts->iTypeface.iFlags | Proportional);
|
sl@0
|
598 |
else if (IdentComp(IdentSerif))
|
sl@0
|
599 |
iTypefaceFonts->iTypeface.iFlags = boolean(iTypefaceFonts->iTypeface.iFlags | Serif);
|
sl@0
|
600 |
else if (IdentComp(IdentSymbol))
|
sl@0
|
601 |
iTypefaceFonts->iTypeface.iFlags = boolean(iTypefaceFonts->iTypeface.iFlags | Symbol);
|
sl@0
|
602 |
else
|
sl@0
|
603 |
{
|
sl@0
|
604 |
Error("Typefacefonts identifier or newline expected");
|
sl@0
|
605 |
state = efalse;
|
sl@0
|
606 |
}
|
sl@0
|
607 |
}
|
sl@0
|
608 |
else
|
sl@0
|
609 |
state = efalse;
|
sl@0
|
610 |
}
|
sl@0
|
611 |
else if (IdentComp(IdentTypefaceTranslates))
|
sl@0
|
612 |
{
|
sl@0
|
613 |
state = IdentCopy(label);
|
sl@0
|
614 |
if (state)
|
sl@0
|
615 |
{
|
sl@0
|
616 |
translates = iPdrModelStore.FindTranslates(label);
|
sl@0
|
617 |
if (translates)
|
sl@0
|
618 |
iTypefaceFonts->iTranslates = translates;
|
sl@0
|
619 |
else
|
sl@0
|
620 |
{
|
sl@0
|
621 |
Error("Translates not found");
|
sl@0
|
622 |
state = efalse;
|
sl@0
|
623 |
}
|
sl@0
|
624 |
}
|
sl@0
|
625 |
}
|
sl@0
|
626 |
else if (IdentComp(IdentFontHeight))
|
sl@0
|
627 |
{
|
sl@0
|
628 |
state = ReadFontHeight();
|
sl@0
|
629 |
}
|
sl@0
|
630 |
else if (IdentComp(IdentScalableFontHeight))
|
sl@0
|
631 |
{
|
sl@0
|
632 |
state = ReadScalableFontHeight();
|
sl@0
|
633 |
}
|
sl@0
|
634 |
else
|
sl@0
|
635 |
{
|
sl@0
|
636 |
Error("Unrecognised typefacefonts identifier");
|
sl@0
|
637 |
state = efalse;
|
sl@0
|
638 |
}
|
sl@0
|
639 |
}
|
sl@0
|
640 |
else
|
sl@0
|
641 |
{
|
sl@0
|
642 |
Error("Typefacefonts identifier expected");
|
sl@0
|
643 |
state = efalse;
|
sl@0
|
644 |
}
|
sl@0
|
645 |
if (state)
|
sl@0
|
646 |
state = NewLine();
|
sl@0
|
647 |
}
|
sl@0
|
648 |
if (state)
|
sl@0
|
649 |
{
|
sl@0
|
650 |
iPdrModelStore.AddTypefaceFonts(iTypefaceFonts);
|
sl@0
|
651 |
cout << "Typefacefonts read\n";
|
sl@0
|
652 |
}
|
sl@0
|
653 |
else
|
sl@0
|
654 |
iTypefaceFonts->Delete();
|
sl@0
|
655 |
return state;
|
sl@0
|
656 |
}
|
sl@0
|
657 |
|
sl@0
|
658 |
boolean PdrReader::ReadModel()
|
sl@0
|
659 |
{
|
sl@0
|
660 |
boolean state = etrue;
|
sl@0
|
661 |
int num;
|
sl@0
|
662 |
iModel = PrinterModelHeader::New();
|
sl@0
|
663 |
Record* resources;
|
sl@0
|
664 |
// Record* extrainfo;
|
sl@0
|
665 |
String label;
|
sl@0
|
666 |
state = IdentCopy(iModel->iLabel);
|
sl@0
|
667 |
if (state)
|
sl@0
|
668 |
state = NewLine();
|
sl@0
|
669 |
while (!IdentComp(IdentEndModel) && !_EOF() && state)
|
sl@0
|
670 |
{
|
sl@0
|
671 |
if (iLex->iType == ELexIdent)
|
sl@0
|
672 |
{
|
sl@0
|
673 |
if (IdentComp(IdentModelName))
|
sl@0
|
674 |
{
|
sl@0
|
675 |
if (StringCopy(iModel->iEntry.iName))
|
sl@0
|
676 |
while (iLex->iType != ELexNL)
|
sl@0
|
677 |
{
|
sl@0
|
678 |
if (IdentComp(IdentRequiresPrinterPort))
|
sl@0
|
679 |
iModel->iEntry.iRequiresPrinterPort = etrue;
|
sl@0
|
680 |
else
|
sl@0
|
681 |
{
|
sl@0
|
682 |
Error("Model identifier or newline expected");
|
sl@0
|
683 |
state = efalse;
|
sl@0
|
684 |
}
|
sl@0
|
685 |
}
|
sl@0
|
686 |
else
|
sl@0
|
687 |
state = efalse;
|
sl@0
|
688 |
}
|
sl@0
|
689 |
else if (IdentComp(IdentModelUid))
|
sl@0
|
690 |
state = Number(iModel->iEntry.iUid);
|
sl@0
|
691 |
else if (IdentComp(IdentModelFlags))
|
sl@0
|
692 |
{
|
sl@0
|
693 |
state = Number(num);
|
sl@0
|
694 |
iModel->iInfo.iFlags = num;
|
sl@0
|
695 |
}
|
sl@0
|
696 |
else if (IdentComp(IdentModelResources))
|
sl@0
|
697 |
{
|
sl@0
|
698 |
state = IdentCopy(label);
|
sl@0
|
699 |
if (state)
|
sl@0
|
700 |
{
|
sl@0
|
701 |
resources = iPdrModelStore.FindResources(label);
|
sl@0
|
702 |
if (resources)
|
sl@0
|
703 |
iModel->iInfo.iResources = resources;
|
sl@0
|
704 |
else
|
sl@0
|
705 |
{
|
sl@0
|
706 |
Error("Resources not found");
|
sl@0
|
707 |
state = efalse;
|
sl@0
|
708 |
}
|
sl@0
|
709 |
}
|
sl@0
|
710 |
}
|
sl@0
|
711 |
/* else if (IdentComp(IdentSpareRecord))
|
sl@0
|
712 |
{
|
sl@0
|
713 |
state = IdentCopy(label);
|
sl@0
|
714 |
if (state)
|
sl@0
|
715 |
{
|
sl@0
|
716 |
extrainfo = iPdrModelStore.FindExtraInfo(label);
|
sl@0
|
717 |
if (extrainfo)
|
sl@0
|
718 |
iModel->iInfo.iSpareRecord = extrainfo;
|
sl@0
|
719 |
else
|
sl@0
|
720 |
{
|
sl@0
|
721 |
Error("Spare record not found");
|
sl@0
|
722 |
state = efalse;
|
sl@0
|
723 |
}
|
sl@0
|
724 |
}
|
sl@0
|
725 |
}
|
sl@0
|
726 |
*/
|
sl@0
|
727 |
else if (IdentComp(IdentKPixelWidth))
|
sl@0
|
728 |
{
|
sl@0
|
729 |
if (Number(num))
|
sl@0
|
730 |
iModel->iInfo.iKPixelWidthInTwips = num;
|
sl@0
|
731 |
else
|
sl@0
|
732 |
state = efalse;
|
sl@0
|
733 |
}
|
sl@0
|
734 |
else if (IdentComp(IdentKPixelHeight))
|
sl@0
|
735 |
{
|
sl@0
|
736 |
if (Number(num))
|
sl@0
|
737 |
iModel->iInfo.iKPixelHeightInTwips = num;
|
sl@0
|
738 |
else
|
sl@0
|
739 |
state = efalse;
|
sl@0
|
740 |
}
|
sl@0
|
741 |
else if (IdentComp(IdentPortraitOffset))
|
sl@0
|
742 |
{
|
sl@0
|
743 |
if (Number(num))
|
sl@0
|
744 |
{
|
sl@0
|
745 |
iModel->iInfo.iPortraitOffsetInPixels.iX = num;
|
sl@0
|
746 |
if (Number(num))
|
sl@0
|
747 |
iModel->iInfo.iPortraitOffsetInPixels.iY = num;
|
sl@0
|
748 |
else
|
sl@0
|
749 |
state = efalse;
|
sl@0
|
750 |
}
|
sl@0
|
751 |
else
|
sl@0
|
752 |
state = efalse;
|
sl@0
|
753 |
}
|
sl@0
|
754 |
else if (IdentComp(IdentLandscapeOffset))
|
sl@0
|
755 |
{
|
sl@0
|
756 |
if (Number(num))
|
sl@0
|
757 |
{
|
sl@0
|
758 |
iModel->iInfo.iLandscapeOffsetInPixels.iX = num;
|
sl@0
|
759 |
if (Number(num))
|
sl@0
|
760 |
iModel->iInfo.iLandscapeOffsetInPixels.iY = num;
|
sl@0
|
761 |
else
|
sl@0
|
762 |
state = efalse;
|
sl@0
|
763 |
}
|
sl@0
|
764 |
else
|
sl@0
|
765 |
state = efalse;
|
sl@0
|
766 |
}
|
sl@0
|
767 |
else if (IdentComp(IdentMinMarginLeft))
|
sl@0
|
768 |
{
|
sl@0
|
769 |
if (Number(num))
|
sl@0
|
770 |
iModel->iInfo.iMinMarginsInPixels.iLeft = num;
|
sl@0
|
771 |
else
|
sl@0
|
772 |
state = efalse;
|
sl@0
|
773 |
}
|
sl@0
|
774 |
else if (IdentComp(IdentMinMarginRight))
|
sl@0
|
775 |
{
|
sl@0
|
776 |
if (Number(num))
|
sl@0
|
777 |
iModel->iInfo.iMinMarginsInPixels.iRight = num;
|
sl@0
|
778 |
else
|
sl@0
|
779 |
state = efalse;
|
sl@0
|
780 |
}
|
sl@0
|
781 |
else if (IdentComp(IdentMinMarginTop))
|
sl@0
|
782 |
{
|
sl@0
|
783 |
if (Number(num))
|
sl@0
|
784 |
iModel->iInfo.iMinMarginsInPixels.iTop = num;
|
sl@0
|
785 |
else
|
sl@0
|
786 |
state = efalse;
|
sl@0
|
787 |
}
|
sl@0
|
788 |
else if (IdentComp(IdentMinMarginBottom))
|
sl@0
|
789 |
{
|
sl@0
|
790 |
if (Number(num))
|
sl@0
|
791 |
iModel->iInfo.iMinMarginsInPixels.iBottom = num;
|
sl@0
|
792 |
else
|
sl@0
|
793 |
state = efalse;
|
sl@0
|
794 |
}
|
sl@0
|
795 |
else if (IdentComp(IdentDisplayMode))
|
sl@0
|
796 |
{
|
sl@0
|
797 |
int i; // DEF102183: Graphics tools fail to build using MS VC8.
|
sl@0
|
798 |
for (i = 0; (i < NumDisplayModeValues) && !IdentComp(IdentDisplayModeValue[i]); i++)
|
sl@0
|
799 |
{ // Tries to match display mode identifier
|
sl@0
|
800 |
}
|
sl@0
|
801 |
if (i < NumDisplayModeValues)
|
sl@0
|
802 |
{
|
sl@0
|
803 |
iModel->iInfo.iDisplayMode = i;
|
sl@0
|
804 |
}
|
sl@0
|
805 |
else
|
sl@0
|
806 |
{
|
sl@0
|
807 |
state = efalse;
|
sl@0
|
808 |
Error("Display mode identifier expected");
|
sl@0
|
809 |
}
|
sl@0
|
810 |
}
|
sl@0
|
811 |
else if (IdentComp(IdentTypefaceFontss))
|
sl@0
|
812 |
{
|
sl@0
|
813 |
state = NewLine();
|
sl@0
|
814 |
while (!IdentComp(IdentEndTypefaceFontss) && !_EOF() && state)
|
sl@0
|
815 |
{
|
sl@0
|
816 |
TypefaceFontsEntry* typefacefontsentry = NULL;
|
sl@0
|
817 |
if (iLex->iType == ELexIdent)
|
sl@0
|
818 |
{
|
sl@0
|
819 |
state = IdentCopy(label);
|
sl@0
|
820 |
Record* typefacefonts = iPdrModelStore.FindTypefaceFonts(label);
|
sl@0
|
821 |
if (typefacefonts)
|
sl@0
|
822 |
{
|
sl@0
|
823 |
typefacefontsentry = TypefaceFontsEntry::New(typefacefonts);
|
sl@0
|
824 |
state = etrue;
|
sl@0
|
825 |
}
|
sl@0
|
826 |
else
|
sl@0
|
827 |
{
|
sl@0
|
828 |
Error("Typefacefonts not found");
|
sl@0
|
829 |
state = efalse;
|
sl@0
|
830 |
}
|
sl@0
|
831 |
}
|
sl@0
|
832 |
if (state)
|
sl@0
|
833 |
{
|
sl@0
|
834 |
while ((iLex->iType != ELexNL) && !_EOF() && state)
|
sl@0
|
835 |
{
|
sl@0
|
836 |
if (IdentComp(IdentNotInPortrait))
|
sl@0
|
837 |
{
|
sl@0
|
838 |
typefacefontsentry->iNotInPortrait = etrue;
|
sl@0
|
839 |
}
|
sl@0
|
840 |
else if (IdentComp(IdentNotInLandscape))
|
sl@0
|
841 |
{
|
sl@0
|
842 |
typefacefontsentry->iNotInLandscape = etrue;
|
sl@0
|
843 |
}
|
sl@0
|
844 |
else
|
sl@0
|
845 |
{
|
sl@0
|
846 |
Error("Typefacefontsentry identifier or newline expected");
|
sl@0
|
847 |
state = efalse;
|
sl@0
|
848 |
}
|
sl@0
|
849 |
}
|
sl@0
|
850 |
if (state)
|
sl@0
|
851 |
iModel->iInfo.AddTypefaceFontsEntry(typefacefontsentry);
|
sl@0
|
852 |
else
|
sl@0
|
853 |
typefacefontsentry->Delete();
|
sl@0
|
854 |
}
|
sl@0
|
855 |
if (state)
|
sl@0
|
856 |
state = NewLine();
|
sl@0
|
857 |
}
|
sl@0
|
858 |
}
|
sl@0
|
859 |
else
|
sl@0
|
860 |
{
|
sl@0
|
861 |
Error("unrecognised model identifier");
|
sl@0
|
862 |
state = efalse;
|
sl@0
|
863 |
}
|
sl@0
|
864 |
}
|
sl@0
|
865 |
else
|
sl@0
|
866 |
{
|
sl@0
|
867 |
Error("Model identifier expected");
|
sl@0
|
868 |
state = efalse;
|
sl@0
|
869 |
}
|
sl@0
|
870 |
if (state)
|
sl@0
|
871 |
state = NewLine();
|
sl@0
|
872 |
}
|
sl@0
|
873 |
if (state)
|
sl@0
|
874 |
{
|
sl@0
|
875 |
iPdrModelStore.AddModel(iModel);
|
sl@0
|
876 |
cout << "Model read\n";
|
sl@0
|
877 |
}
|
sl@0
|
878 |
else
|
sl@0
|
879 |
iModel->Delete();
|
sl@0
|
880 |
return state;
|
sl@0
|
881 |
}
|
sl@0
|
882 |
|
sl@0
|
883 |
boolean PdrReader::ReadPdrStoreFile()
|
sl@0
|
884 |
{
|
sl@0
|
885 |
boolean state = etrue;
|
sl@0
|
886 |
if (iPdrStoreFile)
|
sl@0
|
887 |
{
|
sl@0
|
888 |
state = efalse;
|
sl@0
|
889 |
Error("Pdrstorefile already read");
|
sl@0
|
890 |
}
|
sl@0
|
891 |
else
|
sl@0
|
892 |
{
|
sl@0
|
893 |
iPdrStoreFile = PdrStoreFile::New();
|
sl@0
|
894 |
String label;
|
sl@0
|
895 |
Record* model;
|
sl@0
|
896 |
state = NewLine();
|
sl@0
|
897 |
while (!IdentComp(IdentEndPdrStoreFile) && !_EOF() && state)
|
sl@0
|
898 |
{
|
sl@0
|
899 |
if (IdentComp(IdentPDLName))
|
sl@0
|
900 |
{
|
sl@0
|
901 |
state = StringCopy(iPdrStoreFile->iPDLName);
|
sl@0
|
902 |
}
|
sl@0
|
903 |
else if (IdentComp(IdentPDLUid))
|
sl@0
|
904 |
{
|
sl@0
|
905 |
state = Number(iPdrStoreFile->iPDLUid);
|
sl@0
|
906 |
}
|
sl@0
|
907 |
else if (IdentComp(IdentModels))
|
sl@0
|
908 |
{
|
sl@0
|
909 |
state = NewLine();
|
sl@0
|
910 |
while (!IdentComp(IdentEndModels) && !_EOF() && state)
|
sl@0
|
911 |
{
|
sl@0
|
912 |
state = IdentCopy(label);
|
sl@0
|
913 |
if (state)
|
sl@0
|
914 |
{
|
sl@0
|
915 |
model = iPdrModelStore.FindModel(label);
|
sl@0
|
916 |
if (model)
|
sl@0
|
917 |
{
|
sl@0
|
918 |
iPdrStoreFile->AddModel((PrinterModelHeader*)model);
|
sl@0
|
919 |
}
|
sl@0
|
920 |
else
|
sl@0
|
921 |
{
|
sl@0
|
922 |
Error("model not found");
|
sl@0
|
923 |
state = efalse;
|
sl@0
|
924 |
}
|
sl@0
|
925 |
}
|
sl@0
|
926 |
if (state)
|
sl@0
|
927 |
state = NewLine();
|
sl@0
|
928 |
}
|
sl@0
|
929 |
}
|
sl@0
|
930 |
else
|
sl@0
|
931 |
{
|
sl@0
|
932 |
Error("Pdrstorefile identifier expected");
|
sl@0
|
933 |
state = efalse;
|
sl@0
|
934 |
}
|
sl@0
|
935 |
if (state)
|
sl@0
|
936 |
state = NewLine();
|
sl@0
|
937 |
}
|
sl@0
|
938 |
if (state)
|
sl@0
|
939 |
{
|
sl@0
|
940 |
iPdrModelStore.AddPdrStoreFile(iPdrStoreFile);
|
sl@0
|
941 |
cout << "Pdrstorefile read\n";
|
sl@0
|
942 |
}
|
sl@0
|
943 |
else
|
sl@0
|
944 |
iPdrStoreFile->Delete();
|
sl@0
|
945 |
}
|
sl@0
|
946 |
return state;
|
sl@0
|
947 |
}
|
sl@0
|
948 |
|
sl@0
|
949 |
EXPORT_C boolean PdrReader::Store(const String& aFilename)
|
sl@0
|
950 |
{
|
sl@0
|
951 |
boolean state = etrue;
|
sl@0
|
952 |
if (!iPdrStoreFile)
|
sl@0
|
953 |
{
|
sl@0
|
954 |
state = efalse;
|
sl@0
|
955 |
Error("No pdrstore file record");
|
sl@0
|
956 |
}
|
sl@0
|
957 |
else
|
sl@0
|
958 |
state = iPdrModelStore.Store(aFilename);
|
sl@0
|
959 |
return state;
|
sl@0
|
960 |
}
|
sl@0
|
961 |
|
sl@0
|
962 |
boolean PdrReader::Command(String& aCommand)
|
sl@0
|
963 |
{
|
sl@0
|
964 |
boolean state = etrue;
|
sl@0
|
965 |
String string;
|
sl@0
|
966 |
state = StringCopy(string);
|
sl@0
|
967 |
int length = string.Length();
|
sl@0
|
968 |
for (int i = 0; i < length; i++)
|
sl@0
|
969 |
{
|
sl@0
|
970 |
char ch = string[i];
|
sl@0
|
971 |
if (ch == '<') // Read control character
|
sl@0
|
972 |
{
|
sl@0
|
973 |
ch = 0;
|
sl@0
|
974 |
for (i = i + 1; (i < length) && (string[i] != '>'); i++)
|
sl@0
|
975 |
ch = char((ch * 10) + (string[i] - '0'));
|
sl@0
|
976 |
}
|
sl@0
|
977 |
aCommand += ch;
|
sl@0
|
978 |
}
|
sl@0
|
979 |
return state;
|
sl@0
|
980 |
}
|
sl@0
|
981 |
/*
|
sl@0
|
982 |
boolean PdrReader::ReadExtraInfo()
|
sl@0
|
983 |
{
|
sl@0
|
984 |
boolean state = etrue;
|
sl@0
|
985 |
String label;
|
sl@0
|
986 |
PdrExtraInfo* extrainfo = new PdrExtraInfo();
|
sl@0
|
987 |
state = IdentCopy(extrainfo->iLabel);
|
sl@0
|
988 |
if (state)
|
sl@0
|
989 |
state = NewLine();
|
sl@0
|
990 |
while (!IdentComp(IdentEndExtraInfo) && !_EOF() && state)
|
sl@0
|
991 |
{
|
sl@0
|
992 |
String* string = new String;
|
sl@0
|
993 |
state = Command(*string);
|
sl@0
|
994 |
if (state)
|
sl@0
|
995 |
extrainfo->iInfo.Add(string);
|
sl@0
|
996 |
else
|
sl@0
|
997 |
delete string;
|
sl@0
|
998 |
state = NewLine();
|
sl@0
|
999 |
}
|
sl@0
|
1000 |
if (state)
|
sl@0
|
1001 |
{
|
sl@0
|
1002 |
iPdrModelStore.AddExtraInfo(extrainfo);
|
sl@0
|
1003 |
cout << "Extra info read\n";
|
sl@0
|
1004 |
}
|
sl@0
|
1005 |
else
|
sl@0
|
1006 |
delete extrainfo;
|
sl@0
|
1007 |
return state;
|
sl@0
|
1008 |
}
|
sl@0
|
1009 |
*/
|