Loading doc/translator.py +1 −42 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ 2010/09/27 - The underscore in \latexonly part of the generated language.doc was prefixed by backslash (was LaTeX related error). 2013/02/19 - Better diagnostics when translator_xx.h is too crippled. 2013/06/25 - TranslatorDecoder checks removed after removing the class. """ from __future__ import generators Loading Loading @@ -185,7 +186,6 @@ class Transl: self.missingMethods = None # list of prototypes to be implemented self.implementedMethods = None # list of implemented required methods self.adaptMinClass = None # The newest adapter class that can be used self.isDecodedTranslator = None # Flag related to internal usage of UTF-8 def __tokenGenerator(self): """Generator that reads the file and yields tokens as 4-tuples. Loading Loading @@ -1117,13 +1117,6 @@ class Transl: else: self.missingMethods.append(p) # Set the least important note first if the translator is decoded. # If yes, then it means that the implementation should be switched # to UTF-8 later (suggestion). self.isDecodedTranslator = self.classId in self.manager.decodedTranslators if self.isDecodedTranslator: self.note = 'Reimplementation using UTF-8 suggested.' # Check whether adapter must be used or suggest the newest one. # Change the status and set the note accordingly. if self.baseClassId != 'Translator': Loading Loading @@ -1307,44 +1300,10 @@ class TrManager: self.numLang = None # excluding coupled En-based self.doxVersion = None # Doxygen version # Capture the knowledge about translators that are not implemented # to use UTF-8 internally. self.decodedTranslators = self.getDecodedTranslators() # Build objects where each one is responsible for one translator. self.__build() def getDecodedTranslators(self): """Parses language.cpp to find what translators do not use UTF-8 yet""" decodedTranslators = [] # Regular expression to detect the lines like # theTranslator=new TranslatorDecoder(new TranslatorSwedish); rex = re.compile(r'^\s*theTranslator\s*=\s*new\s+.*$') # Regular expression to get the (optional) TranslatorDecoder and TranslatorXXX rex2 = re.compile(r'\bTranslator\w+') # Parse the lines in the specific source code. f = open(os.path.join(self.src_path, 'language.cpp'), 'rU') for line in f: if rex.match(line): lst = rex2.findall(line) if lst[0] == 'TranslatorDecoder': decodedTranslators.append(lst[1]) f.close() # Display warning when all translator implementations were converted # to UTF-8. if len(decodedTranslators) == 0: print 'This script should be updated. All translators do use UTF-8' print 'internally. The TranslatorDecoder adapter should be removed' print 'from the code and its usage should not be checked any more.' return decodedTranslators def __build(self): """Find the translator files and build the objects for translators.""" Loading Loading
doc/translator.py +1 −42 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ 2010/09/27 - The underscore in \latexonly part of the generated language.doc was prefixed by backslash (was LaTeX related error). 2013/02/19 - Better diagnostics when translator_xx.h is too crippled. 2013/06/25 - TranslatorDecoder checks removed after removing the class. """ from __future__ import generators Loading Loading @@ -185,7 +186,6 @@ class Transl: self.missingMethods = None # list of prototypes to be implemented self.implementedMethods = None # list of implemented required methods self.adaptMinClass = None # The newest adapter class that can be used self.isDecodedTranslator = None # Flag related to internal usage of UTF-8 def __tokenGenerator(self): """Generator that reads the file and yields tokens as 4-tuples. Loading Loading @@ -1117,13 +1117,6 @@ class Transl: else: self.missingMethods.append(p) # Set the least important note first if the translator is decoded. # If yes, then it means that the implementation should be switched # to UTF-8 later (suggestion). self.isDecodedTranslator = self.classId in self.manager.decodedTranslators if self.isDecodedTranslator: self.note = 'Reimplementation using UTF-8 suggested.' # Check whether adapter must be used or suggest the newest one. # Change the status and set the note accordingly. if self.baseClassId != 'Translator': Loading Loading @@ -1307,44 +1300,10 @@ class TrManager: self.numLang = None # excluding coupled En-based self.doxVersion = None # Doxygen version # Capture the knowledge about translators that are not implemented # to use UTF-8 internally. self.decodedTranslators = self.getDecodedTranslators() # Build objects where each one is responsible for one translator. self.__build() def getDecodedTranslators(self): """Parses language.cpp to find what translators do not use UTF-8 yet""" decodedTranslators = [] # Regular expression to detect the lines like # theTranslator=new TranslatorDecoder(new TranslatorSwedish); rex = re.compile(r'^\s*theTranslator\s*=\s*new\s+.*$') # Regular expression to get the (optional) TranslatorDecoder and TranslatorXXX rex2 = re.compile(r'\bTranslator\w+') # Parse the lines in the specific source code. f = open(os.path.join(self.src_path, 'language.cpp'), 'rU') for line in f: if rex.match(line): lst = rex2.findall(line) if lst[0] == 'TranslatorDecoder': decodedTranslators.append(lst[1]) f.close() # Display warning when all translator implementations were converted # to UTF-8. if len(decodedTranslators) == 0: print 'This script should be updated. All translators do use UTF-8' print 'internally. The TranslatorDecoder adapter should be removed' print 'from the code and its usage should not be checked any more.' return decodedTranslators def __build(self): """Find the translator files and build the objects for translators.""" Loading