]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/AutoGen/UniClassObject.py
1eb65c1e9a4bd6bf9db105c2ad9411ab19cac233
[mirror_edk2.git] / BaseTools / Source / Python / AutoGen / UniClassObject.py
1 # Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
2 # This program and the accompanying materials
3 # are licensed and made available under the terms and conditions of the BSD License
4 # which accompanies this distribution. The full text of the license may be found at
5 # http://opensource.org/licenses/bsd-license.php
6 #
7 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
8 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
9
10 #
11 #This file is used to collect all defined strings in multiple uni files
12 #
13
14 ##
15 # Import Modules
16 #
17 import os, codecs, re
18 import distutils.util
19 import Common.EdkLogger as EdkLogger
20 from Common.BuildToolError import *
21 from Common.String import GetLineNo
22 from Common.Misc import PathClass
23
24 ##
25 # Static definitions
26 #
27 UNICODE_WIDE_CHAR = u'\\wide'
28 UNICODE_NARROW_CHAR = u'\\narrow'
29 UNICODE_NON_BREAKING_CHAR = u'\\nbr'
30 UNICODE_UNICODE_CR = '\r'
31 UNICODE_UNICODE_LF = '\n'
32
33 NARROW_CHAR = u'\uFFF0'
34 WIDE_CHAR = u'\uFFF1'
35 NON_BREAKING_CHAR = u'\uFFF2'
36 CR = u'\u000D'
37 LF = u'\u000A'
38 NULL = u'\u0000'
39 TAB = u'\t'
40 BACK_SPLASH = u'\\'
41
42 gIncludePattern = re.compile("^#include +[\"<]+([^\"< >]+)[>\"]+$", re.MULTILINE | re.UNICODE)
43
44 ## Convert a python unicode string to a normal string
45 #
46 # Convert a python unicode string to a normal string
47 # UniToStr(u'I am a string') is 'I am a string'
48 #
49 # @param Uni: The python unicode string
50 #
51 # @retval: The formatted normal string
52 #
53 def UniToStr(Uni):
54 return repr(Uni)[2:-1]
55
56 ## Convert a unicode string to a Hex list
57 #
58 # Convert a unicode string to a Hex list
59 # UniToHexList('ABC') is ['0x41', '0x00', '0x42', '0x00', '0x43', '0x00']
60 #
61 # @param Uni: The python unicode string
62 #
63 # @retval List: The formatted hex list
64 #
65 def UniToHexList(Uni):
66 List = []
67 for Item in Uni:
68 Temp = '%04X' % ord(Item)
69 List.append('0x' + Temp[2:4])
70 List.append('0x' + Temp[0:2])
71 return List
72
73 LangConvTable = {'eng':'en', 'fra':'fr', \
74 'aar':'aa', 'abk':'ab', 'ave':'ae', 'afr':'af', 'aka':'ak', 'amh':'am', \
75 'arg':'an', 'ara':'ar', 'asm':'as', 'ava':'av', 'aym':'ay', 'aze':'az', \
76 'bak':'ba', 'bel':'be', 'bul':'bg', 'bih':'bh', 'bis':'bi', 'bam':'bm', \
77 'ben':'bn', 'bod':'bo', 'bre':'br', 'bos':'bs', 'cat':'ca', 'che':'ce', \
78 'cha':'ch', 'cos':'co', 'cre':'cr', 'ces':'cs', 'chu':'cu', 'chv':'cv', \
79 'cym':'cy', 'dan':'da', 'deu':'de', 'div':'dv', 'dzo':'dz', 'ewe':'ee', \
80 'ell':'el', 'epo':'eo', 'spa':'es', 'est':'et', 'eus':'eu', 'fas':'fa', \
81 'ful':'ff', 'fin':'fi', 'fij':'fj', 'fao':'fo', 'fry':'fy', 'gle':'ga', \
82 'gla':'gd', 'glg':'gl', 'grn':'gn', 'guj':'gu', 'glv':'gv', 'hau':'ha', \
83 'heb':'he', 'hin':'hi', 'hmo':'ho', 'hrv':'hr', 'hat':'ht', 'hun':'hu', \
84 'hye':'hy', 'her':'hz', 'ina':'ia', 'ind':'id', 'ile':'ie', 'ibo':'ig', \
85 'iii':'ii', 'ipk':'ik', 'ido':'io', 'isl':'is', 'ita':'it', 'iku':'iu', \
86 'jpn':'ja', 'jav':'jv', 'kat':'ka', 'kon':'kg', 'kik':'ki', 'kua':'kj', \
87 'kaz':'kk', 'kal':'kl', 'khm':'km', 'kan':'kn', 'kor':'ko', 'kau':'kr', \
88 'kas':'ks', 'kur':'ku', 'kom':'kv', 'cor':'kw', 'kir':'ky', 'lat':'la', \
89 'ltz':'lb', 'lug':'lg', 'lim':'li', 'lin':'ln', 'lao':'lo', 'lit':'lt', \
90 'lub':'lu', 'lav':'lv', 'mlg':'mg', 'mah':'mh', 'mri':'mi', 'mkd':'mk', \
91 'mal':'ml', 'mon':'mn', 'mar':'mr', 'msa':'ms', 'mlt':'mt', 'mya':'my', \
92 'nau':'na', 'nob':'nb', 'nde':'nd', 'nep':'ne', 'ndo':'ng', 'nld':'nl', \
93 'nno':'nn', 'nor':'no', 'nbl':'nr', 'nav':'nv', 'nya':'ny', 'oci':'oc', \
94 'oji':'oj', 'orm':'om', 'ori':'or', 'oss':'os', 'pan':'pa', 'pli':'pi', \
95 'pol':'pl', 'pus':'ps', 'por':'pt', 'que':'qu', 'roh':'rm', 'run':'rn', \
96 'ron':'ro', 'rus':'ru', 'kin':'rw', 'san':'sa', 'srd':'sc', 'snd':'sd', \
97 'sme':'se', 'sag':'sg', 'sin':'si', 'slk':'sk', 'slv':'sl', 'smo':'sm', \
98 'sna':'sn', 'som':'so', 'sqi':'sq', 'srp':'sr', 'ssw':'ss', 'sot':'st', \
99 'sun':'su', 'swe':'sv', 'swa':'sw', 'tam':'ta', 'tel':'te', 'tgk':'tg', \
100 'tha':'th', 'tir':'ti', 'tuk':'tk', 'tgl':'tl', 'tsn':'tn', 'ton':'to', \
101 'tur':'tr', 'tso':'ts', 'tat':'tt', 'twi':'tw', 'tah':'ty', 'uig':'ug', \
102 'ukr':'uk', 'urd':'ur', 'uzb':'uz', 'ven':'ve', 'vie':'vi', 'vol':'vo', \
103 'wln':'wa', 'wol':'wo', 'xho':'xh', 'yid':'yi', 'yor':'yo', 'zha':'za', \
104 'zho':'zh', 'zul':'zu'}
105
106 ## GetLanguageCode
107 #
108 # Check the language code read from .UNI file and convert ISO 639-2 codes to RFC 4646 codes if appropriate
109 # ISO 639-2 language codes supported in compatiblity mode
110 # RFC 4646 language codes supported in native mode
111 #
112 # @param LangName: Language codes read from .UNI file
113 #
114 # @retval LangName: Valid lanugage code in RFC 4646 format or None
115 #
116 def GetLanguageCode(LangName, IsCompatibleMode, File):
117 global LangConvTable
118
119 length = len(LangName)
120 if IsCompatibleMode:
121 if length == 3 and LangName.isalpha():
122 TempLangName = LangConvTable.get(LangName.lower())
123 if TempLangName != None:
124 return TempLangName
125 return LangName
126 else:
127 EdkLogger.error("Unicode File Parser", FORMAT_INVALID, "Invalid ISO 639-2 language code : %s" % LangName, File)
128
129 if (LangName[0] == 'X' or LangName[0] == 'x') and LangName[1] == '-':
130 return LangName
131 if length == 2:
132 if LangName.isalpha():
133 return LangName
134 elif length == 3:
135 if LangName.isalpha() and LangConvTable.get(LangName.lower()) == None:
136 return LangName
137 elif length == 5:
138 if LangName[0:2].isalpha() and LangName[2] == '-':
139 return LangName
140 elif length >= 6:
141 if LangName[0:2].isalpha() and LangName[2] == '-':
142 return LangName
143 if LangName[0:3].isalpha() and LangConvTable.get(LangName.lower()) == None and LangName[3] == '-':
144 return LangName
145
146 EdkLogger.error("Unicode File Parser", FORMAT_INVALID, "Invalid RFC 4646 language code : %s" % LangName, File)
147
148 ## StringDefClassObject
149 #
150 # A structure for language definition
151 #
152 class StringDefClassObject(object):
153 def __init__(self, Name = None, Value = None, Referenced = False, Token = None, UseOtherLangDef = ''):
154 self.StringName = ''
155 self.StringNameByteList = []
156 self.StringValue = ''
157 self.StringValueByteList = ''
158 self.Token = 0
159 self.Referenced = Referenced
160 self.UseOtherLangDef = UseOtherLangDef
161 self.Length = 0
162
163 if Name != None:
164 self.StringName = Name
165 self.StringNameByteList = UniToHexList(Name)
166 if Value != None:
167 self.StringValue = Value + u'\x00' # Add a NULL at string tail
168 self.StringValueByteList = UniToHexList(self.StringValue)
169 self.Length = len(self.StringValueByteList)
170 if Token != None:
171 self.Token = Token
172
173 def __str__(self):
174 return repr(self.StringName) + ' ' + \
175 repr(self.Token) + ' ' + \
176 repr(self.Referenced) + ' ' + \
177 repr(self.StringValue) + ' ' + \
178 repr(self.UseOtherLangDef)
179
180 def UpdateValue(self, Value = None):
181 if Value != None:
182 self.StringValue = Value + u'\x00' # Add a NULL at string tail
183 self.StringValueByteList = UniToHexList(self.StringValue)
184 self.Length = len(self.StringValueByteList)
185
186 ## UniFileClassObject
187 #
188 # A structure for .uni file definition
189 #
190 class UniFileClassObject(object):
191 def __init__(self, FileList = [], IsCompatibleMode = False, IncludePathList = []):
192 self.FileList = FileList
193 self.Token = 2
194 self.LanguageDef = [] #[ [u'LanguageIdentifier', u'PrintableName'], ... ]
195 self.OrderedStringList = {} #{ u'LanguageIdentifier' : [StringDefClassObject] }
196 self.IsCompatibleMode = IsCompatibleMode
197 self.IncludePathList = IncludePathList
198 if len(self.FileList) > 0:
199 self.LoadUniFiles(FileList)
200
201 #
202 # Get Language definition
203 #
204 def GetLangDef(self, File, Line):
205 Lang = distutils.util.split_quoted((Line.split(u"//")[0]))
206 if len(Lang) != 3:
207 try:
208 FileIn = codecs.open(File.Path, mode='rb', encoding='utf-16').read()
209 except UnicodeError, X:
210 EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File);
211 except:
212 EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File);
213 LineNo = GetLineNo(FileIn, Line, False)
214 EdkLogger.error("Unicode File Parser", PARSER_ERROR, "Wrong language definition",
215 ExtraData="""%s\n\t*Correct format is like '#langdef en-US "English"'""" % Line, File = File, Line = LineNo)
216 else:
217 LangName = GetLanguageCode(Lang[1], self.IsCompatibleMode, self.File)
218 LangPrintName = Lang[2]
219
220 IsLangInDef = False
221 for Item in self.LanguageDef:
222 if Item[0] == LangName:
223 IsLangInDef = True
224 break;
225
226 if not IsLangInDef:
227 self.LanguageDef.append([LangName, LangPrintName])
228
229 #
230 # Add language string
231 #
232 self.AddStringToList(u'$LANGUAGE_NAME', LangName, LangName, 0, True, Index=0)
233 self.AddStringToList(u'$PRINTABLE_LANGUAGE_NAME', LangName, LangPrintName, 1, True, Index=1)
234
235 if not IsLangInDef:
236 #
237 # The found STRING tokens will be added into new language string list
238 # so that the unique STRING identifier is reserved for all languages in the package list.
239 #
240 FirstLangName = self.LanguageDef[0][0]
241 if LangName != FirstLangName:
242 for Index in range (2, len (self.OrderedStringList[FirstLangName])):
243 Item = self.OrderedStringList[FirstLangName][Index]
244 if Item.UseOtherLangDef != '':
245 OtherLang = Item.UseOtherLangDef
246 else:
247 OtherLang = FirstLangName
248 self.OrderedStringList[LangName].append (StringDefClassObject(Item.StringName, '', Item.Referenced, Item.Token, OtherLang))
249
250 return True
251
252 #
253 # Get String name and value
254 #
255 def GetStringObject(self, Item):
256 Name = ''
257 Language = ''
258 Value = ''
259
260 Name = Item.split()[1]
261 # Check the string name is the upper character
262 if not self.IsCompatibleMode and Name != '':
263 MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)
264 if MatchString == None or MatchString.end(0) != len(Name):
265 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' %(Name, self.File))
266 LanguageList = Item.split(u'#language ')
267 for IndexI in range(len(LanguageList)):
268 if IndexI == 0:
269 continue
270 else:
271 Language = LanguageList[IndexI].split()[0]
272 Value = LanguageList[IndexI][LanguageList[IndexI].find(u'\"') + len(u'\"') : LanguageList[IndexI].rfind(u'\"')] #.replace(u'\r\n', u'')
273 Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
274 self.AddStringToList(Name, Language, Value)
275
276 #
277 # Get include file list and load them
278 #
279 def GetIncludeFile(self, Item, Dir):
280 FileName = Item[Item.find(u'#include ') + len(u'#include ') :Item.find(u' ', len(u'#include '))][1:-1]
281 self.LoadUniFile(FileName)
282
283 #
284 # Pre-process before parse .uni file
285 #
286 def PreProcess(self, File):
287 if not os.path.exists(File.Path) or not os.path.isfile(File.Path):
288 EdkLogger.error("Unicode File Parser", FILE_NOT_FOUND, ExtraData=File.Path)
289
290 try:
291 FileIn = codecs.open(File.Path, mode='rb', encoding='utf-16').readlines()
292 except UnicodeError, X:
293 EdkLogger.error("build", FILE_READ_FAILURE, "File read failure: %s" % str(X), ExtraData=File.Path);
294 except:
295 EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=File.Path);
296
297 Lines = []
298 #
299 # Use unique identifier
300 #
301 for Line in FileIn:
302 Line = Line.strip()
303 #
304 # Ignore comment line and empty line
305 #
306 if Line == u'' or Line.startswith(u'//'):
307 continue
308 Line = Line.replace(u'/langdef', u'#langdef')
309 Line = Line.replace(u'/string', u'#string')
310 Line = Line.replace(u'/language', u'#language')
311 Line = Line.replace(u'/include', u'#include')
312
313 Line = Line.replace(UNICODE_WIDE_CHAR, WIDE_CHAR)
314 Line = Line.replace(UNICODE_NARROW_CHAR, NARROW_CHAR)
315 Line = Line.replace(UNICODE_NON_BREAKING_CHAR, NON_BREAKING_CHAR)
316
317 Line = Line.replace(u'\\\\', u'\u0006')
318 Line = Line.replace(u'\\r\\n', CR + LF)
319 Line = Line.replace(u'\\n', CR + LF)
320 Line = Line.replace(u'\\r', CR)
321 Line = Line.replace(u'\\t', u'\t')
322 Line = Line.replace(u'''\"''', u'''"''')
323 Line = Line.replace(u'\t', u' ')
324 Line = Line.replace(u'\u0006', u'\\')
325
326 # if Line.find(u'\\x'):
327 # hex = Line[Line.find(u'\\x') + 2 : Line.find(u'\\x') + 6]
328 # hex = "u'\\u" + hex + "'"
329
330 IncList = gIncludePattern.findall(Line)
331 if len(IncList) == 1:
332 for Dir in [File.Dir] + self.IncludePathList:
333 IncFile = PathClass(str(IncList[0]), Dir)
334 if os.path.isfile(IncFile.Path):
335 Lines.extend(self.PreProcess(IncFile))
336 break
337 else:
338 EdkLogger.error("Unicode File Parser", FILE_NOT_FOUND, Message="Cannot find include file", ExtraData=str(IncList[0]))
339 continue
340
341 Lines.append(Line)
342
343 return Lines
344
345 #
346 # Load a .uni file
347 #
348 def LoadUniFile(self, File = None):
349 if File == None:
350 EdkLogger.error("Unicode File Parser", PARSER_ERROR, 'No unicode file is given')
351 self.File = File
352 #
353 # Process special char in file
354 #
355 Lines = self.PreProcess(File)
356
357 #
358 # Get Unicode Information
359 #
360 for IndexI in range(len(Lines)):
361 Line = Lines[IndexI]
362 if (IndexI + 1) < len(Lines):
363 SecondLine = Lines[IndexI + 1]
364 if (IndexI + 2) < len(Lines):
365 ThirdLine = Lines[IndexI + 2]
366
367 #
368 # Get Language def information
369 #
370 if Line.find(u'#langdef ') >= 0:
371 self.GetLangDef(File, Line)
372 continue
373
374 Name = ''
375 Language = ''
376 Value = ''
377 #
378 # Get string def information format 1 as below
379 #
380 # #string MY_STRING_1
381 # #language eng
382 # My first English string line 1
383 # My first English string line 2
384 # #string MY_STRING_1
385 # #language spa
386 # Mi segunda secuencia 1
387 # Mi segunda secuencia 2
388 #
389 if Line.find(u'#string ') >= 0 and Line.find(u'#language ') < 0 and \
390 SecondLine.find(u'#string ') < 0 and SecondLine.find(u'#language ') >= 0 and \
391 ThirdLine.find(u'#string ') < 0 and ThirdLine.find(u'#language ') < 0:
392 Name = Line[Line.find(u'#string ') + len(u'#string ') : ].strip(' ')
393 Language = SecondLine[SecondLine.find(u'#language ') + len(u'#language ') : ].strip(' ')
394 for IndexJ in range(IndexI + 2, len(Lines)):
395 if Lines[IndexJ].find(u'#string ') < 0 and Lines[IndexJ].find(u'#language ') < 0:
396 Value = Value + Lines[IndexJ]
397 else:
398 IndexI = IndexJ
399 break
400 # Value = Value.replace(u'\r\n', u'')
401 Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
402 # Check the string name is the upper character
403 if not self.IsCompatibleMode and Name != '':
404 MatchString = re.match('[A-Z0-9_]+', Name, re.UNICODE)
405 if MatchString == None or MatchString.end(0) != len(Name):
406 EdkLogger.error('Unicode File Parser', FORMAT_INVALID, 'The string token name %s defined in UNI file %s contains the invalid lower case character.' %(Name, self.File))
407 self.AddStringToList(Name, Language, Value)
408 continue
409
410 #
411 # Get string def information format 2 as below
412 #
413 # #string MY_STRING_1 #language eng "My first English string line 1"
414 # "My first English string line 2"
415 # #language spa "Mi segunda secuencia 1"
416 # "Mi segunda secuencia 2"
417 # #string MY_STRING_2 #language eng "My first English string line 1"
418 # "My first English string line 2"
419 # #string MY_STRING_2 #language spa "Mi segunda secuencia 1"
420 # "Mi segunda secuencia 2"
421 #
422 if Line.find(u'#string ') >= 0 and Line.find(u'#language ') >= 0:
423 StringItem = Line
424 for IndexJ in range(IndexI + 1, len(Lines)):
425 if Lines[IndexJ].find(u'#string ') >= 0 and Lines[IndexJ].find(u'#language ') >= 0:
426 IndexI = IndexJ
427 break
428 elif Lines[IndexJ].find(u'#string ') < 0 and Lines[IndexJ].find(u'#language ') >= 0:
429 StringItem = StringItem + Lines[IndexJ]
430 elif Lines[IndexJ].count(u'\"') >= 2:
431 StringItem = StringItem[ : StringItem.rfind(u'\"')] + Lines[IndexJ][Lines[IndexJ].find(u'\"') + len(u'\"') : ]
432 self.GetStringObject(StringItem)
433 continue
434
435 #
436 # Load multiple .uni files
437 #
438 def LoadUniFiles(self, FileList):
439 if len(FileList) > 0:
440 for File in FileList:
441 self.LoadUniFile(File)
442
443 #
444 # Add a string to list
445 #
446 def AddStringToList(self, Name, Language, Value, Token = None, Referenced = False, UseOtherLangDef = '', Index = -1):
447 for LangNameItem in self.LanguageDef:
448 if Language == LangNameItem[0]:
449 break
450 else:
451 EdkLogger.error('Unicode File Parser', FORMAT_NOT_SUPPORTED, "The language '%s' for %s is not defined in Unicode file %s." \
452 % (Language, Name, self.File))
453
454 if Language not in self.OrderedStringList:
455 self.OrderedStringList[Language] = []
456
457 IsAdded = True
458 for Item in self.OrderedStringList[Language]:
459 if Name == Item.StringName:
460 IsAdded = False
461 if Value != None:
462 Item.UpdateValue(Value)
463 Item.UseOtherLangDef = ''
464 break
465
466 if IsAdded:
467 Token = len(self.OrderedStringList[Language])
468 if Index == -1:
469 self.OrderedStringList[Language].append(StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef))
470 for LangName in self.LanguageDef:
471 #
472 # New STRING token will be added into all language string lists.
473 # so that the unique STRING identifier is reserved for all languages in the package list.
474 #
475 if LangName[0] != Language:
476 if UseOtherLangDef != '':
477 OtherLangDef = UseOtherLangDef
478 else:
479 OtherLangDef = Language
480 self.OrderedStringList[LangName[0]].append(StringDefClassObject(Name, '', Referenced, Token, OtherLangDef))
481 else:
482 self.OrderedStringList[Language].insert(Index, StringDefClassObject(Name, Value, Referenced, Token, UseOtherLangDef))
483
484 #
485 # Set the string as referenced
486 #
487 def SetStringReferenced(self, Name):
488 #
489 # String stoken are added in the same order in all language string lists.
490 # So, only update the status of string stoken in first language string list.
491 #
492 Lang = self.LanguageDef[0][0]
493 for Item in self.OrderedStringList[Lang]:
494 if Name == Item.StringName:
495 Item.Referenced = True
496 break
497 #
498 # Search the string in language definition by Name
499 #
500 def FindStringValue(self, Name, Lang):
501 for Item in self.OrderedStringList[Lang]:
502 if Item.StringName == Name:
503 return Item
504
505 return None
506
507 #
508 # Search the string in language definition by Token
509 #
510 def FindByToken(self, Token, Lang):
511 for Item in self.OrderedStringList[Lang]:
512 if Item.Token == Token:
513 return Item
514
515 return None
516
517 #
518 # Re-order strings and re-generate tokens
519 #
520 def ReToken(self):
521 #
522 # Retoken all language strings according to the status of string stoken in the first language string.
523 #
524 FirstLangName = self.LanguageDef[0][0]
525
526 #
527 # Use small token for all referred string stoken.
528 #
529 RefToken = 0
530 for Index in range (0, len (self.OrderedStringList[FirstLangName])):
531 FirstLangItem = self.OrderedStringList[FirstLangName][Index]
532 if FirstLangItem.Referenced == True:
533 for LangNameItem in self.LanguageDef:
534 LangName = LangNameItem[0]
535 OtherLangItem = self.OrderedStringList[LangName][Index]
536 OtherLangItem.Referenced = True
537 OtherLangItem.Token = RefToken
538 RefToken = RefToken + 1
539
540 #
541 # Use big token for all unreferred string stoken.
542 #
543 UnRefToken = 0
544 for Index in range (0, len (self.OrderedStringList[FirstLangName])):
545 FirstLangItem = self.OrderedStringList[FirstLangName][Index]
546 if FirstLangItem.Referenced == False:
547 for LangNameItem in self.LanguageDef:
548 LangName = LangNameItem[0]
549 OtherLangItem = self.OrderedStringList[LangName][Index]
550 OtherLangItem.Token = RefToken + UnRefToken
551 UnRefToken = UnRefToken + 1
552
553 #
554 # Show the instance itself
555 #
556 def ShowMe(self):
557 print self.LanguageDef
558 #print self.OrderedStringList
559 for Item in self.OrderedStringList:
560 print Item
561 for Member in self.OrderedStringList[Item]:
562 print str(Member)
563
564 # This acts like the main() function for the script, unless it is 'import'ed into another
565 # script.
566 if __name__ == '__main__':
567 EdkLogger.Initialize()
568 EdkLogger.SetLevel(EdkLogger.DEBUG_0)
569 a = UniFileClassObject(['C:\\Edk\\Strings.uni', 'C:\\Edk\\Strings2.uni'])
570 a.ReToken()
571 a.ShowMe()