Package ghidra.program.util
Class LanguageTranslatorFactory
- java.lang.Object
-
- ghidra.program.util.LanguageTranslatorFactory
-
public class LanguageTranslatorFactory extends java.lang.Object
LanguageTranslatorFactory
manages all language translators within Ghidra. Language translators support either a version translation for a single language, or a language transition from one language to another. The following types of translators are supported:- Simple translators are established based upon a translator XML specification file (*.trans).
- Explicit translators are class implementations of the LanguageTranslator interface. The abstract LanguageTranslatorAdapter has been supplied for this purpose so that default mappings can be used if needed. Such custom translator classes should not be created within the 'ghidra.program.util' package since they will be ignored by the factory.
- Default translators can be instantiated for languages whose address spaces map to one-another. Such default translations may be lossy with register mappings and could result in lost register variables and references.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LANGUAGE_TRANSLATOR_FILE_EXT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LanguageTranslator
getLanguageTranslator(LanguageID languageName, int majorVersion)
Returns a language translation for a language version which is no longer supported.LanguageTranslator
getLanguageTranslator(Language fromLanguage, Language toLanguage)
Returns a language translator for the transition from an oldLanguage to a newLanguage.static LanguageTranslatorFactory
getLanguageTranslatorFactory()
Returns the single instance of the OldLanguageFactory.static void
registerLanguageTranslatorFactoryMinion(LanguageTranslatorFactoryMinion minion)
-
-
-
Field Detail
-
LANGUAGE_TRANSLATOR_FILE_EXT
public static final java.lang.String LANGUAGE_TRANSLATOR_FILE_EXT
- See Also:
- Constant Field Values
-
-
Method Detail
-
registerLanguageTranslatorFactoryMinion
public static void registerLanguageTranslatorFactoryMinion(LanguageTranslatorFactoryMinion minion)
-
getLanguageTranslatorFactory
public static LanguageTranslatorFactory getLanguageTranslatorFactory()
Returns the single instance of the OldLanguageFactory.
-
getLanguageTranslator
public LanguageTranslator getLanguageTranslator(Language fromLanguage, Language toLanguage)
Returns a language translator for the transition from an oldLanguage to a newLanguage. The toLanguage may be a different language or a newer version of fromLanguage.- Parameters:
fromLanguage
- old languagetoLanguage
- new language- Returns:
- language translator if transition is supported, otherwise null is returned.
-
getLanguageTranslator
public LanguageTranslator getLanguageTranslator(LanguageID languageName, int majorVersion)
Returns a language translation for a language version which is no longer supported.- Parameters:
languageName
- old unsupported language namemajorVersion
- language major version within program- Returns:
- language translator if one can be determined, otherwise null is returned.
-
-