Target PlcOpen XML (IEC 61131-3 ST) More...
#include <cgp_plcoxml.h>
Protected Member Functions | |
void | DoGenerate (void) |
code generation hook (overall) | |
void | DoGenerateFunction (void) |
code generation hook (cyclic function) | |
void | DoGenerateInterface (void) |
code generation (cyclic function, interface) | |
void | DoGenerateBody (void) |
code generation (cyclicg function, st body) | |
void | DoGenerateLookups (void) |
code generation hook (symbolic name lookup functions) | |
virtual void | VariableDeclare (const std::string &ladd, const std::string <ype) |
generate code: conditionals | |
virtual void | VariableDeclare (const std::string &ladd, const std::string <ype, const std::string &lval) |
generate code: conditionals | |
virtual void | CintarrayDeclare (const AA &address, int offset, const std::vector< int > &val) |
generate code: conditionals | |
virtual void | CwordarrayDeclare (const AA &address, int offset, const std::vector< word_t > &val) |
generate code: conditionals | |
virtual void | CstrarrayDeclare (const AA &address, int offset, const std::vector< std::string > &val) |
generate code: conditionals | |
virtual void | IntarrayDeclare (const AA &address, int offset, int len) |
generate code: conditionals | |
virtual void | IntarrayDeclare (const AA &address, int offset, const std::vector< int > &val) |
generate code: conditionals | |
virtual void | WordarrayDeclare (const AA &address, int offset, int len) |
generate code: conditionals | |
virtual void | WordarrayDeclare (const AA &address, int offset, const std::vector< word_t > &val) |
generate code: conditionals | |
virtual void | DeclareImportPhysicalIo (void) |
generate code: conditionals | |
virtual void | XmlBeginPlainText () |
virtual void | XmlEndPlainText () |
virtual void | XmlDocumentation (const std::string &text) |
virtual void | DoReadTargetConfiguration (TokenReader &rTr) |
File i/o. More... | |
virtual void | DoWriteTargetConfiguration (TokenWriter &rTw) const |
File i/o. More... | |
Protected Member Functions inherited from Iec61131stCodeGenerator | |
void | DoCompile (void) |
add my preferences to DoCompile | |
virtual void | DecrementTimers (void) |
code snippet | |
void | BeginCyclicCode (void) |
reimplemented code snippets | |
void | EndCyclicCode (void) |
reimplemented code snippets | |
virtual std::string | TargetAddress (const AA &address) |
abstract address conversion | |
virtual AX | TargetExpression (const AA &address) |
abstract address conversion | |
void | CurrentVariableType (const IECVariableType &type) |
IECVariableType | CurrentVariableType (void) |
virtual void | Comment (const std::string &text) |
generate code: conditionals | |
virtual void | IntegerDeclare (const AA &address) |
generate code: conditionals | |
virtual void | IntegerDeclare (const AA &address, int val) |
generate code: conditionals | |
virtual void | IntegerAssign (const AA &address, int val) |
generate code: conditionals | |
virtual void | IntegerAssign (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual void | IntegerIncrement (const AA &address, int val) |
generate code: conditionals | |
virtual AX | IntegerQuotient (const AX &expression, int val) |
generate code: conditionals | |
virtual AX | IntegerRemainder (const AX &expression, int val) |
generate code: conditionals | |
virtual AX | IntegerBitmask (const AX &expression) |
generate code: conditionals | |
virtual AX | IntegerIsEq (const AA &address, int val) |
generate code: conditionals | |
virtual AX | IntegerIsEq (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual AX | IntegerIsNotEq (const AA &address, int val) |
generate code: conditionals | |
virtual AX | IntegerIsNotEq (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual AX | IntegerIsGreater (const AA &address, int val) |
generate code: conditionals | |
virtual AX | IntegerIsLess (const AA &address, int val) |
generate code: conditionals | |
virtual AX | IntegerConstant (int val) |
generate code: conditionals | |
virtual bool | HasIntmaths (void) |
generate code: conditionals | |
virtual void | WordDeclare (const AA &address) |
generate code: conditionals | |
virtual void | WordDeclare (const AA &address, word_t val) |
generate code: conditionals | |
virtual void | WordAssign (const AA &address, word_t val) |
generate code: conditionals | |
virtual void | WordAssign (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual void | WordOr (const AA &address, word_t val) |
generate code: conditionals | |
virtual void | WordOr (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual void | WordOr (const AA &address, const AA &op1, const AA &op2) |
generate code: conditionals | |
virtual void | WordOr (const AA &address, const AA &op1, word_t op2) |
generate code: conditionals | |
virtual void | WordAnd (const AA &address, word_t val) |
generate code: conditionals | |
virtual void | WordAnd (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual void | WordAnd (const AA &address, const AA &op1, const AA &op2) |
generate code: conditionals | |
virtual void | WordAnd (const AA &address, const AA &op1, word_t op2) |
generate code: conditionals | |
virtual void | WordNand (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual AX | WordIsBitSet (const AA &address, int idx) |
generate code: conditionals | |
virtual AX | WordIsBitClr (const AA &address, int idx) |
generate code: conditionals | |
virtual AX | WordIsMaskSet (const AA &address, word_t mask) |
generate code: conditionals | |
virtual AX | WordIsEq (const AA &address, word_t val) |
generate code: conditionals | |
virtual AX | WordIsNotEq (const AA &address, word_t val) |
generate code: conditionals | |
virtual AX | WordConstant (word_t val) |
generate code: conditionals | |
virtual void | BooleanDeclare (const AA &address) |
generate code: conditionals | |
virtual void | BooleanDeclare (const AA &address, int val) |
generate code: conditionals | |
virtual void | BooleanAssign (const AA &address, int val) |
generate code: conditionals | |
virtual void | BooleanAssign (const AA &address, const AX &expression) |
generate code: conditionals | |
virtual AX | BooleanIsEq (const AA &op1, const AA &op2) |
generate code: conditionals | |
virtual AX | BooleanIsNotEq (const AA &op1, const AA &op2) |
generate code: conditionals | |
virtual AA | CintarrayAccess (const AA &address, int index) |
generate code: conditionals | |
virtual AA | CintarrayAccess (const AA &address, const AA &indexaddr) |
generate code: conditionals | |
virtual bool | HasCintarray (void) |
generate code: conditionals | |
virtual AA | CwordarrayAccess (const AA &address, int index) |
generate code: conditionals | |
virtual AA | CwordarrayAccess (const AA &address, const AA &indexaddr) |
generate code: conditionals | |
virtual bool | HasCwordarray (void) |
generate code: conditionals | |
virtual AA | CstrarrayAccess (const AA &address, int index) |
generate code: conditionals | |
virtual AA | CstrarrayAccess (const AA &address, const AA &indexaddr) |
generate code: conditionals | |
virtual bool | HasCstrarray (void) |
generate code: conditionals | |
virtual AA | IntarrayAccess (const AA &address, int index) |
generate code: conditionals | |
virtual AA | IntarrayAccess (const AA &address, const AA &indexaddr) |
generate code: conditionals | |
virtual bool | HasIntarray (void) |
generate code: conditionals | |
virtual AA | WordarrayAccess (const AA &address, int index) |
generate code: conditionals | |
virtual AA | WordarrayAccess (const AA &address, const AA &indexaddr) |
generate code: conditionals | |
virtual bool | HasWordarray (void) |
generate code: conditionals | |
virtual void | IfTrue (const AX &expression) |
generate code: conditionals | |
virtual void | IfFalse (const AX &expression) |
generate code: conditionals | |
virtual void | IfWord (const AX &expression) |
generate code: conditionals | |
virtual void | IfElse (void) |
generate code: conditionals | |
virtual void | IfElseIfTrue (const AX &expression) |
generate code: conditionals | |
virtual void | IfEnd (void) |
generate code: conditionals | |
virtual void | SwitchBegin (const AA &address) |
generate code: conditionals | |
virtual void | SwitchCase (const AA &address, int val) |
generate code: conditionals | |
virtual void | SwitchCases (const AA &address, int from, int to) |
generate code: conditionals | |
virtual void | SwitchCases (const AA &address, const std::set< int > &vals) |
generate code: conditionals | |
virtual void | SwitchBreak (void) |
generate code: conditionals | |
virtual void | SwitchEnd (void) |
generate code: conditionals | |
virtual bool | HasMultiCase (void) |
generate code: conditionals | |
virtual void | LoopBegin (void) |
generate code: conditionals | |
virtual void | LoopBreak (const AX &expression) |
generate code: conditionals | |
virtual void | LoopEnd (void) |
generate code: conditionals | |
virtual void | FunctionReturn (void) |
generate code: conditionals | |
virtual void | RunActionSet (const std::string &address) |
generate code: conditionals | |
virtual void | RunActionClr (const std::string &address) |
generate code: conditionals | |
virtual void | RunActionExe (const AX &expression) |
generate code: conditionals | |
virtual void | TimerDeclare (const AA &address, const std::string &val) |
generate code: conditionals | |
virtual void | TimerStart (const AA &address) |
generate code: conditionals | |
virtual void | TimerStop (const AA &address) |
generate code: conditionals | |
virtual void | TimerReset (const AA &address, const std::string &val) |
generate code: conditionals | |
virtual AX | TimerIsElapsed (const AA &address) |
generate code: conditionals | |
virtual void | DeclareTimers (void) |
generate code: conditionals | |
virtual void | ResetState (void) |
generate code: conditionals | |
virtual AX | TimeConstant (int val) |
generate code: conditionals | |
virtual AX | IntarrayConstant (const std::vector< int > &val) |
generate code: conditionals | |
virtual AX | WordarrayConstant (const std::vector< word_t > &val) |
generate code: conditionals | |
virtual AX | StringConstant (const std::string &val) |
generate code: conditionals | |
virtual AX | StrarrayConstant (const std::vector< std::string > &val) |
generate code: conditionals | |
virtual void | DeclareImportSymbolicIo (void) |
generate code: conditionals | |
virtual int | CountImportPhysicalIo (void) |
generate code: conditionals | |
virtual int | CountImportSymbolicIo (void) |
generate code: conditionals | |
virtual void | LiteralCyclic (void) |
generate code: conditionals | |
virtual void | DeclareSystime (void) |
generate code: conditionals | |
virtual void | UpdateSystime (void) |
generate code: conditionals | |
virtual void | InsertExecHooks (void) |
generate code: conditionals | |
Protected Member Functions inherited from CodePrimitives | |
virtual void | DoGenerateDeclarations (void) |
cut-and-paste template for code snippet assembly | |
virtual void | DoGenerateResetCode (void) |
cut-and-paste template for code snippet assembly | |
virtual void | DoGenerateCyclicCode (void) |
cut-and-paste template for code snippet assembly | |
virtual void | LiteralPrepend (void) |
Cosmetic: prepend literally from configuration data. | |
virtual void | DeclareStatus (void) |
Declare "status". | |
virtual void | DeclareReset (void) |
Declare "reset". | |
virtual void | DeclareRecentEvent (void) |
Declare "recent_event". | |
virtual void | DeclareParallelState (void) |
Declare "parallel_state". | |
virtual void | DeclarePendingEvents (void) |
Declare "pending_events" and "enabled_events". | |
virtual void | DeclareLoopState (void) |
Declare loop state, i.e. line levels, loop flag. | |
virtual void | DeclareAux (void) |
Declare variables local to the provided snippets, e.g. helpers for bit-mask computation. | |
virtual void | DeclareLargeCarray (void) |
Declare compiled transition relations. | |
virtual void | DeclareSmallCarray (void) |
Declare bit-mask loop-ups. | |
virtual void | DeclareEventNameLookup (void) |
Declare symbolic name lookup tables. | |
virtual void | DeclareStateNameLookup (void) |
Declare symbolic name lookup tables. | |
virtual void | ResetReturn (void) |
Reset bail out. | |
virtual void | SenseInputs (void) |
Sense input events and add to "pending_events". | |
virtual void | SenseTimerElapse (void) |
Sense timer elapse vents and add to "pending_events". | |
virtual void | BeginExecutionLoop (void) |
Execution Loop, begin. | |
virtual void | UpdateEnabled (void) |
Update "enabled_events" from "parallel_state" if "exec_event" was set. | |
virtual void | ScheduleEvent (void) |
Select event to execute from "pending_and_enabled_events" or "enabled_events". | |
virtual void | BreakExecutionLoop (void) |
Execution Loop, break. | |
virtual void | ExecuteEvent (void) |
Take transition and figure new state. | |
virtual void | OperateTimers (void) |
Start/stop/reset timers w.r.t. "exec_event". | |
virtual void | OperateOutputs (void) |
Operate output lines w.r.t. "exec_event". | |
virtual void | EndExecutionLoop (void) |
Loop end. | |
virtual void | LiteralAppend (void) |
Cosmetic: append literally from configuration. | |
virtual void | ExecuteEventBySwitching (void) |
Alternative implementation of ExecuteEvent() | |
virtual void | ExecuteEventByInterpreter (void) |
Alternative implementation of ExecuteEventBy() | |
virtual void | UpdateEnabledBySwitching (void) |
Alternative implementations UpdateEnabled() | |
virtual void | UpdateEnabledByInterpreter (void) |
Alternative implementations UpdateEnabled() | |
virtual std::string | TargetSymbol (const std::string &str) |
Mangle string to valid target symbol. | |
virtual void | IntegerDecrement (const AA &address, int val=1) |
virtual void | BitarrayDeclare (const AA &address, int blen) |
virtual void | BitarrayDeclare (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayAssign (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayAssign (const AA &address, const AA &otherarray) |
virtual void | BitarrayClear (const AA &address) |
virtual void | BitarrayFull (const AA &address) |
virtual void | BitarraySetBit (const AA &address, int bitaddr) |
virtual void | BitarraySetBit (const AA &address, const AA &indexaddr, int offset=0, const std::vector< bool > &hint=std::vector< bool >()) |
virtual void | BitarrayClrBit (const AA &address, int bitaddr) |
virtual void | BitarrayClrBit (const AA &address, const AA &indexaddr, int offset=0, const std::vector< bool > &hint=std::vector< bool >()) |
virtual void | BitarrayIsBitSet (const AA &address, const AA &indexaddr, const AA &result, int offset=0, const std::vector< bool > &hint=std::vector< bool >()) |
virtual void | BitarrayOr (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayOr (const AA &address, const AA &op1, const std::vector< bool > &op2) |
virtual void | BitarrayOrAllWords (const AA &address, const AA &result) |
virtual void | BitarrayAnd (const AA &address, const std::vector< bool > &val) |
virtual void | BitarrayAnd (const AA &address, const AA &otherarray) |
virtual void | BitarrayAnd (const AA &address, const AA &op1, const AA &op2) |
virtual void | BitarrayAnd (const AA &address, const AA &op1, const std::vector< bool > &op2) |
virtual void | BitarrayFindFirst (const AA &address, const AA &result, int offset=0) |
virtual void | EventSetDeclare (const AA &address) |
virtual void | EventSetDeclare (const AA &address, const EventSet &evset) |
virtual void | EventSetAssign (const AA &address, const EventSet &evset) |
virtual void | EventSetInsert (const AA &address, const EventSet &evset) |
virtual void | EventSetInsert (const AA &address, Idx ev) |
virtual void | EventSetInsert (const AA &address, const AA &evaddr) |
virtual void | EventSetInsert (const AA &address, const AA &evaddr, const EventSet &hint) |
virtual void | EventSetErase (const AA &address, const EventSet &evset) |
virtual void | EventSetErase (const AA &address, Idx ev) |
virtual void | EventSetErase (const AA &address, const AA &evaddr) |
virtual void | EventSetErase (const AA &address, const AA &evaddr, const EventSet &hint) |
virtual void | EventSetExists (const AA &address, const AA &evaddr, const AA &result, const EventSet &hint) |
virtual void | EventSetRestrict (const AA &address, const AA &otherset) |
virtual void | EventSetUnion (const AA &address, const AA &op1, const EventSet &op2) |
virtual void | EventSetIntersection (const AA &address, const AA &op1, const EventSet &op2) |
virtual void | EventSetClear (const AA &address) |
virtual void | EventSetFull (const AA &address) |
virtual void | EventSetIsNotEmpty (const AA &address, const AA &result) |
virtual void | EventSetFindHighestPriority (const AA &address, const AA &result) |
virtual AX | ReadInputLine (const std::string &address) |
virtual AX | InputExpression (const std::string &expression) |
virtual int | StateTargetIdx (size_t git, Idx idx) |
Overload base class to use the vector address only if the respective code option is active) | |
virtual Idx | StateFaudesIdx (size_t git, int idx) |
Overload base class to use the vector address only if the respective code option is active) | |
Protected Member Functions inherited from CodeGenerator | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Read the configuration from TokenReader, see faudes Type for public wrappers. More... | |
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Writes the configuration to TokenWriter, see faudes Type for public wrappers. More... | |
Protected Attributes | |
std::string | mIecSchemeVersion |
option: plcopen-xml version "v1.01" or "v2.01" | |
std::string | mIecToolVendor |
option: xml entry file header "company" | |
std::string | mIecContentAuthor |
option: xml entry content header "author" | |
std::string | mIecContentOrganization |
option: xml entry content header "company" | |
std::string | mIecContentVersion |
option: xml entry content header "version" | |
std::string | mIecTextElement |
option: plain text xml-element "cdata", "xhtml", or "pre" | |
Protected Attributes inherited from Iec61131stCodeGenerator | |
std::string | mIecDeclarePhysical |
option: formal declaration of io lines | |
bool | mHasIecTimeOperators |
option: overloaded operators for time maths | |
std::string | mLiteralCyclic |
option: extra cyclic code | |
Protected Attributes inherited from CodePrimitives | |
std::string | mWordType |
target data type for word | |
std::string | mIntegerType |
target data type for integer | |
std::string | mPrefix |
universal prefix (pseudo name space) | |
bool | mArrayForTransitions |
code option: use const array to represent transitions | |
bool | mMaintainStateIndices |
code option: use state indices as provided | |
bool | mBitAddressArithmetic |
code option: compute bit and word address on target | |
bool | mArrayForBitmasks |
code option: use const array to represent bit-masks | |
bool | mArrayForBitarray |
code option: use const array to represent bit-masks | |
bool | mBisectionForBitfind |
code option: use bisection to fing lowest set bit | |
bool | mArrayForState |
code option: use int arrays to represent that overall state | |
bool | mEventsetsForPerformance |
code option: eventsets for performance | |
bool | mLoopPendingInputs |
code option: loop until all inputs are resolved | |
bool | mLoopEnabledOutputs |
code option: loop until all enabled outputs are executed | |
bool | mStrictEventSynchronisation |
code option: strict event synchronisation | |
bool | mEventNameLookup |
code option: event name lookup | |
bool | mStateNameLookup |
code option: state name lookup | |
std::vector< bool > | mHasStateNames |
record per generator whether there is a lookup table | |
bool | mExistStateNames |
record whether there exist statenames at all | |
std::string | mEventExecutionHook |
code option: event exec hook | |
std::string | mStateUpdateHook |
code option: state change hook | |
std::string | mLiteralPrepend |
extra code to prepend | |
std::string | mLiteralAppend |
extra code to prepend | |
std::map< std::string, bitarray_rec > | mBitarrays |
Record of all declared bit-arrays. | |
Protected Attributes inherited from CodeGenerator | |
std::string | mName |
faudes object name (aka project name) | |
std::vector< TimedGenerator > | mGenerators |
list of executors | |
std::vector< std::string > | mGeneratorNames |
list of filenames when generator are read from file | |
cgEventSet | mAlphabet |
event configuration by attributes | |
int | mWordSize |
compressed boolean capacity of target type word | |
int | mIntegerSize |
compressed boolean capacity of target type integer | |
std::map< Idx, int > | mEventBitAddress |
mapping from faudes event idx to bit address (descending priority, range 0 . More... | |
std::map< int, Idx > | mEventFaudesIdx |
mapping from bit address to faudes event idx | |
int | mLastInputEvent |
highest bit-address with input (or timer) event (-1 for none) | |
int | mLastOutputEvent |
highest bit-address with output event (-1 for none) | |
std::vector< std::map< Idx, int > > | mStateVectorAddress |
mapping from faudes state idx to vector index | |
std::vector< std::map< int, Idx > > | mStateFaudesIndex |
mapping from vector state idx to faudes index | |
std::vector< bool > | mUsingVectorAddressStates |
configuration of state indexing per generator | |
std::vector< std::vector< int > > | mTransitionVector |
compiled transition-sets, represented as vectors of integers with 0 as separator | |
EventSet | mUsedEvents |
configured events that are referred to by some generator | |
EventSet | mOutputEvents |
used events that are configured as outputs | |
EventSet | mInputEvents |
used events that are configured as inputs (incl timer) | |
EventSet | mInternalEvents |
used events that are configured as internal events (excl. More... | |
std::map< std::string, LineAddress > | mLines |
input event generation | |
std::map< std::string, FlagExpression > | mFlags |
input event generation | |
std::map< std::string, TimerConfiguration > | mTimers |
timer definitions | |
std::map< std::string, ActionAddress > | mActionAddresses |
action addresses | |
std::map< std::string, TimerAction > | mTimerActions |
timer actions by event name | |
int | mVerbLevel |
diagnpstic-output level | |
std::string | mOutMode |
output file name (base) | |
char | mMuteMode |
current output mode | |
bool | mMuteComments |
mute comments | |
std::string | mRecentMutedComment |
recent muted comment | |
std::ostream * | pOutStream |
output stream | |
std::ostream * | pErrStream |
error stream | |
Basic Class Maintenance | |
PlcoxmlCodeGenerator (void) | |
Constructor. | |
virtual | ~PlcoxmlCodeGenerator (void) |
Explicit destructor. | |
virtual void | Clear (void) |
Clear all data. | |
Additional Inherited Members | |
Public Types inherited from Iec61131stCodeGenerator | |
enum | IECVariableType { LOCAL , TEMP , INPUT , OUTPUT , INOUT , EXTERNAL , GLOBAL , ACCESS , NONE } |
Public Types inherited from CodeGenerator | |
enum | OutSink { CONSOLE , FILE , STRING } |
typedef std::vector< TimedGenerator >::const_iterator | Iterator |
Iterator for read-only access of generators. | |
typedef unsigned long | word_t |
Code-generator internal data type of target words. | |
typedef std::map< std::string, LineAddress >::iterator | LineIterator |
Access to line records by iterator. | |
typedef std::map< std::string, FlagExpression >::iterator | FlagIterator |
Access to flag records by iterator. | |
typedef std::map< std::string, TimerConfiguration >::iterator | TimerIterator |
Access to timer records by iterator. | |
typedef std::map< std::string, ActionAddress >::iterator | ActionAddressIterator |
Access to action record by iterator. | |
typedef std::map< std::string, TimerAction >::iterator | TimerActionIterator |
Access to timer records by iterator. | |
Public Member Functions inherited from Iec61131stCodeGenerator | |
Iec61131stCodeGenerator (void) | |
Constructor. | |
virtual | ~Iec61131stCodeGenerator (void) |
Explicit destructor. | |
Public Member Functions inherited from CodePrimitives | |
CodePrimitives (void) | |
Constructor. | |
virtual | ~CodePrimitives (void) |
Explicit destructor. | |
Public Member Functions inherited from CodeGenerator | |
Idx | Size (void) const |
Number of generators. | |
void | Insert (const std::string &file) |
Add a Generator from file. More... | |
void | Insert (const TimedGenerator &rGen) |
Add a generator by reference. More... | |
const TimedGenerator & | At (int i) const |
Direct access for read-only access of generators. | |
Iterator | Begin (void) const |
Begin-iterator for read-only access of generators. | |
Iterator | End (void) const |
End-iterator for read-only access of generators. | |
virtual int | EventTargetIdx (Idx idx) |
Get target event Idx from faudes Idx (use bit-address + 1) | |
virtual int | EventTargetIdx (const std::string &ev) |
Get target event Idx from faudes name (use bit-address + 1) | |
int | EventBitAddress (Idx idx) |
Get event bit-address from faudes Idx (consecutive, starts at 0) | |
Idx | EventFaudesIdx (int idx) |
Get faudes Idx from target Idx (aka from bit-address + 1) | |
std::vector< bool > | EventBitMask (Idx idx) |
Get vector representation for a single faudes event Idx. | |
std::vector< bool > | EventBitMask (const EventSet &eset) |
Get vector representation for faudes event set. | |
int | EventBitMaskSize (void) |
Get overall number of events. | |
word_t | WordFromBitVector (const std::vector< bool > &vect, int wordindex) |
Extract individual word from boolean vector. | |
std::vector< word_t > | WordVectorFromBitVector (const std::vector< bool > &vect) |
Convert boolean vector to word array. | |
LineIterator | LinesBegin () |
Access to line records by iterator. | |
LineIterator | LinesEnd () |
Access to line records by iterator. | |
FlagIterator | FlagsBegin () |
Access to flag records by iterator. | |
FlagIterator | FlagsEnd () |
Access to flag records by iterator. | |
TimerIterator | TimersBegin () |
Access to timer records by iterator. | |
TimerIterator | TimersEnd () |
Access to timer records by iterator. | |
ActionAddressIterator | ActionAddressesBegin () |
Access to action addresses by iterator. | |
ActionAddressIterator | ActionAddressesEnd () |
Access to action addresses by iterator. | |
TimerActionIterator | TimerActionsBegin () |
Access to timer records by iterator. | |
TimerActionIterator | TimerActionsEnd () |
Access to timer records by iterator. | |
CodeGenerator (void) | |
Constructor. | |
virtual | ~CodeGenerator (void) |
Destructor. | |
virtual void | Name (const std::string &rName) |
Set objects's name (reimplementing base faudes::Type) More... | |
virtual const std::string & | Name (void) const |
Get objects's name (reimplementing base faudes::Type) More... | |
virtual void | Compile (void) |
Compile input data for alternative representation. More... | |
Idx | EventIndex (const std::string &rName) const |
Faudes-event index lookup. More... | |
std::string | EventName (Idx index) const |
Faudes-event name lookup. More... | |
const AttributeCodeGeneratorEvent & | EventAttribute (Idx ev) const |
Event configuration attribute lookup. More... | |
void | EventAttribute (Idx ev, const AttributeCodeGeneratorEvent &attr) |
Set event attribute. More... | |
void | Alphabet (const cgEventSet &rAlphabet) |
Set all event attributes. More... | |
const cgEventSet & | Alphabet (void) const |
Access alphabet (incl event attributes) More... | |
const std::vector< int > & | TransitionVector (size_t git) |
Get target state index (refer to vector representation as default, overload in CodePrimitives) | |
virtual void | Generate (void) |
Generate code. More... | |
void | Verbose (int level, std::ostream *altout=0) |
Set verbosity level. More... | |
virtual void | OutputMode (const std::string &mode) |
Set code output mode. More... | |
std::string | OutputMode (void) |
Report code output mode. More... | |
virtual std::ostream & | Output (void) |
Output stream. More... | |
const std::string & | OutputString (void) |
Get accumulated output as string. More... | |
void | OutputString (const std::string &strbuf) |
Set output to string. More... | |
virtual void | MuteMode (char mode) |
Set current mute mode. More... | |
virtual void | MuteCond (char mode) |
Set mode condition. More... | |
virtual void | LineFeed (int lines=1) |
LineFeed (convenience support for derived classes) | |
virtual std::string | LineCount (void) |
LineFeed (convenience support for derived classes) | |
virtual void | IndentInc () |
Indentation (convenience support for derived classes) | |
virtual void | IndentDec () |
Indentation (convenience support for derived classes) | |
std::string | RecentComment (void) |
Recent muted comment (convenience support for derived classes) | |
virtual void | XmlTextEscape (bool on) |
XmlTextEscape (escape "<", ">", "&", "\"" and "'") | |
virtual void | XmlCdataEscape (bool on) |
XmlCdataEscape (escape "]]>") | |
virtual void | MuteComments (bool on) |
Mute comments (convenience support for derived classes) | |
virtual void | MuteVspace (bool on) |
Mute empty lines (convenience support for derived classes) | |
Static Public Member Functions inherited from CodeGenerator | |
static std::string | VersionString (void) |
Version (refers to macro COMPILEDES_VERSION, defined in cgp_codegenerator.h) | |
static void | Register (const std::string &type, CodeGenerator *(*newcg)(void)) |
Insert derived class in the registry. More... | |
static std::vector< std::string > | Registry (void) |
Access registry contents. More... | |
static CodeGenerator * | New (const std::string &type) |
Instantiate by identifier (returns 0 on unknown class) More... | |
Public Attributes inherited from CodeGenerator | |
std::vector< int > | mWordAddressVector |
Look-up table to map a bit-address to the word-index. | |
std::vector< word_t > | mBitMaskVector |
Look-up table to map a bit-address to the word-bitmask. | |
This class is a specialisation of the Iec61131stCodeGenerator to generate code in the PlcOpen XML format [see also here]. The current status of this code generator backend is "experimental". The generated code complies with the XML scheme (validated with xmlcopyeditor), it can be imported by TwinCAT, CodeSys, GEB IDE and PLCopenEditor.
In contrast to its base class, PlcoxmlCodeGenerator does not allow for the insertion of configuration code. As a consequence, i/o is restricted to boolean variables, either symbolic marker or explicit i/o addresses. More flexible approaches that integrate CompileDES generated code with the PlcOpen XML data model are currently studied in an industrial application context.
The following code-options are supported.
IecSchemeVersion. This option specifies the XML-scheme used for generating output. Possible values are v1.01
(dated late 2005) and v2.01
(dated mid 2009). For the code generated by CompileDES, this effects only the parameters for the outer XML-element <project>
. For recent code editors, version v2.01
should be fine. This is the default.
<IecSchemeVersion val="v2.01"/>
IecToolVendor. This option specifies the companyName
attribute in the PlcOpen XML file header. It defaults to FGDES/LRT
.
<IecToolVendor val="FeelGood Inc."/>
IecContentAuthor, IecContentOrganization, IecContentVersion. These options specify the respective attributes in the PCLopen XML content header. The default is empty. We have experienced editors that insist in the version
attribute to be set.
<IecContentAuthor val="James Brown"/> <IecContentOrganization val="Federal Records"/> <IecContentVersion val="stable"/>
IecTextElement. This option specifies the output format for plain text, i.e., IEC ST code and comments. The documentation indicates that any XHTML-formated text should be fine. This includes plain ascii text with <, > and & escaped. This is the default behaviour. Setting this option to xhtml
adds an outer XHTML element, as seen when exporting from TwinCAT and CodeSys. Alternatively, setting the option to cdata
uses a CDATA
element to emphasises preformated text, as seen when exporting with PLCopenEditor.
<IecTextElement val="cdata"/>
IMPORTANT NOTE. The current implementation does not validate user provided XML attributes. They will be quoted in double quotes and not escaped whatsoever. Thus, attributes are effectively restricted to plain ascii with no double quote and no indicator characters. A future implementation will have an appropriate wrapper to format attributes.
Definition at line 91 of file cgp_plcoxml.h.
|
protectedvirtual |
Reads global configuration from TokenReader, excl. label
rTr | TokenReader to read from |
Exception |
|
Reimplemented from Iec61131stCodeGenerator.
Definition at line 61 of file cgp_plcoxml.cpp.
|
protectedvirtual |
Write global configuration to TokenWriter, excl. label
rTw | Reference to TokenWriter |
Exception |
|
Reimplemented from Iec61131stCodeGenerator.
Definition at line 100 of file cgp_plcoxml.cpp.