33 FD_DCG(
"GebtoolsCodeGenerator(" <<
this <<
")::GebtoolsCodeGenerator()");
39 FD_DCG(
"GebtoolsCodeGenerator(" <<
this <<
")::~GebtoolsCodeGenerator()");
45 FD_DCG(
"GebtoolsCodeGenerator::Clear()");
54 FD_DCG(
"GebtoolsCodeGenerator::DoReadTargetConfiguration()");
59 if(rTr.ExistsBegin(
"IecTypedArrayConstants")) {
60 rTr.ReadBegin(
"IecTypedArrayConstants",token);
62 rTr.ReadEnd(
"IecTypedArrayConstants");
68 FD_DCG(
"GebtoolsCodeGenerator::DoWriteTargetConfiguration()");
73 token.SetEmpty(
"IecTypedArrayConstants");
97 Comment(
"************************************************");
98 Comment(
"* array types --- GEB IDE specific *");
99 Comment(
"************************************************");
108 EventSetDeclare(
AA(
"aux_locenabled"));
109 EventSetDeclare(
AA(
"aux_executables"));
117 Comment(
"************************************************");
118 Comment(
"* function block to host cyclic code *");
119 Comment(
"************************************************");
151 Output() <<
"VAR_EXTERNAL";
169 Output() <<
"END_FUNCTION_BLOCK (* end of " <<
mPrefix <<
"cyclic_fb *)";
180 Comment(
"************************************************");
181 Comment(
"* initialised array types --- GEB IDE specific *");
182 Comment(
"************************************************");
215 FCG_ERR(
"GebtoolsCodeGenerator::Cintarray(): ignoring empty const vector");
219 FCG_ERR(
"GebtoolsCodeGenerator::Cwordarray(): const vector exceeds address range");
247 FCG_ERR(
"GebtoolsCodeGenerator::Cwordarray(): ignoring empty const vector");
251 FCG_ERR(
"GebtoolsCodeGenerator::Cwordarray(): const vector exceeds addres range");
279 FCG_ERR(
"GebtoolsCodeGenerator::Cstrarray(): ignoring empty const vector");
283 FCG_ERR(
"GebtoolsCodeGenerator::Cstrarray(): const vector exceeds addres range");
293 for(
size_t i=0; i<val.size(); ++i)
294 if(val[i].size()>len) len=val[i].size();
300 Output() <<
TargetAddress(address) <<
"_st" <<
" : STRING[" << ToStringInteger(len) <<
"];";
302 Output() <<
TargetAddress(
AA(address+
"_t")) <<
" : ARRAY[" << offset <<
".." << val.size()+offset-1 <<
"] OF "<<
320 FCG_ERR(
"GebtoolsCodeGenerator::Intarray(): ignoring empty const vector");
324 FCG_ERR(
"GebtoolsCodeGenerator::Intarray(): const vector exceeds addres range");
352 FCG_ERR(
"GebtoolsCodeGenerator::Intarray(): ignoring empty vector");
355 if(((
unsigned long long) len+offset) >= (1ULL << (
mIntegerSize-1))) {
356 FCG_ERR(
"GebtoolsCodeGenerator::Intarray(): const vector exceeds addres range");
379 FCG_ERR(
"GebtoolsCodeGenerator::Wordarray(): ignoring empty const vector");
383 FCG_ERR(
"GebtoolsCodeGenerator::Wordarray(): const vector exceeds addres range");
411 FCG_ERR(
"GebtoolsCodeGenerator::Wordarray(): ignoring empty vector");
414 if(((
unsigned long long) len+offset ) >= (1ULL << (
mIntegerSize-1))) {
415 FCG_ERR(
"GebtoolsCodeGenerator::Wordarray(): const vector exceeds addres range");
#define FAUDES_REGISTERCODEGENERATOR(ftype, ctype)
Class registration macro.
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 DoGenerateCyclicCode(void)
cut-and-paste template for code snippet assembly
virtual AX IntarrayConstant(const std::vector< int > &val)
generate code: conditionals
virtual void MuteMode(char mode)
Set current mute mode.
virtual void CstrarrayDeclare(const AA &address, int offset, const std::vector< std::string > &val)
re-implement primitives (extra pass to generate type declarations)
virtual void DeclareImportPhysicalIo(void)
generate code: conditionals
virtual void DeclareStatus(void)
Declare "status".
virtual void DeclareRecentEvent(void)
Declare "recent_event".
virtual void LiteralCyclic(void)
generate code: conditionals
virtual void Clear(void)
Clear all data.
void DoGenerateFunction(void)
re-implement program block
virtual std::ostream & Output(void)
Output stream.
virtual void DoGenerateResetCode(void)
cut-and-paste template for code snippet assembly
virtual void DoWriteTargetConfiguration(TokenWriter &rTw) const
File i/o.
Implementation of primitives by IEC 61131 ST.
virtual void LineFeed(int lines=1)
LineFeed (convenience support for derived classes)
virtual std::string TargetAddress(const AA &address)
abstract address conversion
virtual void DoGenerateLookups(void)
code generation hook (lookup functions)
virtual void DeclareSmallCarray(void)
Declare bit-mask loop-ups.
Target GEB Automation toolchain (IEC 61131 ST)
virtual AX StrarrayConstant(const std::vector< std::string > &val)
generate code: conditionals
virtual void IntarrayDeclare(const AA &address, int offset, const std::vector< int > &val)
re-implement primitives (extra pass to generate type declarations)
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 DeclareImportSymbolicIo(void)
generate code: conditionals
virtual void WordarrayDeclare(const AA &address, int offset, int len)
generate code: conditionals
virtual void DeclareReset(void)
Declare "reset".
virtual void DeclareTimers(void)
generate code: conditionals
virtual void IndentInc()
Indentation (convenience support for derived classes)
virtual void DoReadTargetConfiguration(TokenReader &rTr)
File i/o.
virtual AX WordarrayConstant(const std::vector< word_t > &val)
generate code: conditionals
virtual void IntarrayDeclare(const AA &address, int offset, int len)
generate code: conditionals
std::string mIntegerType
target data type for integer
virtual void DeclareStateNameLookup(void)
Declare symbolic name lookup tables.
virtual void DeclareParallelState(void)
Declare "parallel_state".
int mIntegerSize
compressed boolean capacity of target type integer
virtual ~GebtoolsCodeGenerator(void)
Explicit destructor.
GebtoolsCodeGenerator(void)
Constructor.
std::string mWordType
target data type for word
virtual void DeclareLoopState(void)
Declare loop state, i.e. line levels, loop flag.
bool mEventNameLookup
code option: event name lookup
std::string mIecDeclarePhysical
option: formal declaration of io lines
virtual void DeclarePendingEvents(void)
Declare "pending_events" and "enabled_events".
virtual void MuteCond(char mode)
Set mode condition.
virtual int CountImportSymbolicIo(void)
generate code: conditionals
virtual void DeclareEventNameLookup(void)
Declare symbolic name lookup tables.
virtual void Clear(void)
Clear all data.
Abstract address; see also Absstract_Addresses.
virtual int CountImportPhysicalIo(void)
generate code: conditionals
bool mStateNameLookup
code option: state name lookup
virtual void CwordarrayDeclare(const AA &address, int offset, const std::vector< word_t > &val)
re-implement primitives (extra pass to generate type declarations)
virtual void WordarrayDeclare(const AA &address, int offset, const std::vector< word_t > &val)
re-implement primitives (extra pass to generate type declarations)
std::string mPrefix
universal prefix (pseudo name space)
virtual void IndentDec()
Indentation (convenience support for derived classes)
virtual void CstrarrayDeclare(const AA &address, int offset, const std::vector< std::string > &val)
generate code: conditionals
virtual void DeclareSystime(void)
generate code: conditionals
virtual void CintarrayDeclare(const AA &address, int offset, const std::vector< int > &val)
re-implement primitives (extra pass to generate type declarations)
virtual void DoReadTargetConfiguration(TokenReader &rTr)
File i/o.
Code-generator GEB toolchain (IEC 61131-3 ST)
virtual void DecrementTimers(void)
code snippet
virtual void Comment(const std::string &text)
generate code: conditionals
virtual void DoWriteTargetConfiguration(TokenWriter &rTw) const
File i/o.
void DoGenerateLookups(void)
re-implement program block
bool mIecTypedArrayConstants
option: formal declaration of array constants