Commit 7937731b authored by Michael Büsch's avatar Michael Büsch

library: Always enable extended instructions in library code

Signed-off-by: Michael Büsch's avatarMichael Buesch <[email protected]>
parent 0ac0941b
...@@ -72,6 +72,10 @@ class AwlTranslator(object): ...@@ -72,6 +72,10 @@ class AwlTranslator(object):
oldMnemonics = self.cpu.getSpecs().getConfiguredMnemonics() oldMnemonics = self.cpu.getSpecs().getConfiguredMnemonics()
self.cpu.getSpecs().setConfiguredMnemonics(S7CPUSpecs.MNEMONICS_DE) self.cpu.getSpecs().setConfiguredMnemonics(S7CPUSpecs.MNEMONICS_DE)
# Enable extended instructions for library code.
oldExtEn = self.cpu.extendedInsnsEnabled()
self.cpu.enableExtendedInsns(True)
# Parse the library code # Parse the library code
p = AwlParser() p = AwlParser()
p.parseText(block.getCode()) p.parseText(block.getCode())
...@@ -87,6 +91,9 @@ class AwlTranslator(object): ...@@ -87,6 +91,9 @@ class AwlTranslator(object):
# Translate the library block instructions. # Translate the library block instructions.
block.insns = self.__translateInsns(rawBlock.insns) block.insns = self.__translateInsns(rawBlock.insns)
# Switch back to old extended-instructions state.
self.cpu.enableExtendedInsns(oldExtEn)
# Switch back to old mnemonics. # Switch back to old mnemonics.
self.cpu.getSpecs().setConfiguredMnemonics(oldMnemonics) self.cpu.getSpecs().setConfiguredMnemonics(oldMnemonics)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment