Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
c7dbb803
Commit
c7dbb803
authored
Oct 29, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(codegen): Исправил генератор кода, для устранения warning-а
о нарушении последовательности инициализации полей класса.
parent
e49a602a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
25 deletions
+60
-25
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+54
-21
ctl-cpp-h.xsl
Utilities/codegen/ctl-cpp-h.xsl
+6
-4
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
c7dbb803
...
@@ -426,6 +426,29 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
...
@@ -426,6 +426,29 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::waitSM( int wait_msec, ObjectId _te
}
}
</xsl:template>
</xsl:template>
<xsl:template
name=
"default-init-variables"
>
<xsl:if
test=
"normalize-space(@const)!=''"
>
<xsl:if
test=
"normalize-space(@type)='int'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(0),
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='float'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(0),
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='bool'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(false),
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='str'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(""),
</xsl:if>
</xsl:if>
</xsl:template>
<xsl:template
name=
"init-variables"
>
<xsl:if
test=
"normalize-space(@type)='int'"
>
<xsl:value-of
select=
"normalize-space(@name)"
/>
(uni_atoi( init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
"))),
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='float'"
>
<xsl:value-of
select=
"normalize-space(@name)"
/>
(atof( init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
").c_str())),
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='bool'"
>
<xsl:value-of
select=
"normalize-space(@name)"
/>
(uni_atoi( init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
"))),
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='str'"
>
<xsl:value-of
select=
"normalize-space(@name)"
/>
(init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
")),
</xsl:if>
</xsl:template>
<xsl:template
name=
"COMMON-CC-HEAD"
>
<xsl:template
name=
"COMMON-CC-HEAD"
>
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
/*
/*
...
@@ -460,13 +483,15 @@ node_<xsl:value-of select="@name"/>(DefaultObjectId),
...
@@ -460,13 +483,15 @@ node_<xsl:value-of select="@name"/>(DefaultObjectId),
<xsl:for-each
select=
"//msgmap/item"
><xsl:value-of
select=
"@name"
/>
(DefaultObjectId),
<xsl:for-each
select=
"//msgmap/item"
><xsl:value-of
select=
"@name"
/>
(DefaultObjectId),
node_
<xsl:value-of
select=
"@name"
/>
(DefaultObjectId),
node_
<xsl:value-of
select=
"@name"
/>
(DefaultObjectId),
</xsl:for-each>
</xsl:for-each>
//
const
variables
// variables
<xsl:for-each
select=
"//variables/item"
>
<xsl:for-each
select=
"//variables/item"
>
<xsl:if
test=
"normalize-space(@const)!=''"
>
<xsl:if
test=
"normalize-space(@public)!=''"
>
<xsl:if
test=
"normalize-space(@type)='int'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(0),
</xsl:if>
<xsl:call-template
name=
"default-init-variables"
/>
<xsl:if
test=
"normalize-space(@type)='float'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(0),
</xsl:if>
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='bool'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(false),
</xsl:if>
<xsl:if
test=
"normalize-space(@private)=''"
>
<xsl:if
test=
"normalize-space(@type)='str'"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(""),
</xsl:if>
<xsl:if
test=
"normalize-space(@public)=''"
>
<xsl:call-template
name=
"default-init-variables"
/>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
active(false),
active(false),
...
@@ -480,7 +505,13 @@ maxHeartBeat(10),
...
@@ -480,7 +505,13 @@ maxHeartBeat(10),
confnode(0),
confnode(0),
smReadyTimeout(0),
smReadyTimeout(0),
activated(false),
activated(false),
askPause(2000)
askPause(2000),
<xsl:for-each
select=
"//variables/item"
>
<xsl:if
test=
"normalize-space(@private)!=''"
>
<xsl:call-template
name=
"default-init-variables"
/>
</xsl:if>
</xsl:for-each>
end_private(false)
{
{
unideb[Debug::CRIT]
<<
"
<xsl:value-of
select=
"$CLASSNAME"
/>
: init failed!!!!!!!!!!!!!!!"
<<
endl;
unideb[Debug::CRIT]
<<
"
<xsl:value-of
select=
"$CLASSNAME"
/>
: init failed!!!!!!!!!!!!!!!"
<<
endl;
throw Exception( string(myname+": init failed!!!") );
throw Exception( string(myname+": init failed!!!") );
...
@@ -505,25 +536,21 @@ static const std::string init3_str(const std::string s1, const std::string s2, c
...
@@ -505,25 +536,21 @@ static const std::string init3_str(const std::string s1, const std::string s2, c
<xsl:value-of
select=
"normalize-space(@name)"
/>
(conf->getSensorID(conf->getProp(cnode,"
<xsl:value-of
select=
"normalize-space(@name)"
/>
"))),
<xsl:value-of
select=
"normalize-space(@name)"
/>
(conf->getSensorID(conf->getProp(cnode,"
<xsl:value-of
select=
"normalize-space(@name)"
/>
"))),
node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
( conf->getNodeID(conf->getProp(cnode,"node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
")) ),
node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
( conf->getNodeID(conf->getProp(cnode,"node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
")) ),
</xsl:for-each>
</xsl:for-each>
// Используемые идентификаторы сообщений (имена берутся из конф. файла)
<xsl:for-each
select=
"//msgmap/item"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(conf->getSensorID(conf->getProp(cnode,"
<xsl:value-of
select=
"normalize-space(@name)"
/>
"))),
node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
(conf->getNodeID( conf->getProp(cnode,"node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
"))),
</xsl:for-each>
// variables
// variables
<xsl:for-each
select=
"//variables/item"
>
<xsl:for-each
select=
"//variables/item"
>
<xsl:if
test=
"normalize-space(@
type)='int
'"
>
<xsl:if
test=
"normalize-space(@
public)!='
'"
>
<xsl:
value-of
select=
"normalize-space(@name)"
/>
(uni_atoi( init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
"))),
<xsl:
call-template
name=
"init-variables"
/>
</xsl:if>
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='float'"
>
<xsl:if
test=
"normalize-space(@private)=''"
>
<xsl:value-of
select=
"normalize-space(@name)"
/>
(atof( init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
").c_str())),
<xsl:if
test=
"normalize-space(@public)=''"
>
<xsl:call-template
name=
"init-variables"
/>
</xsl:if>
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='bool'"
>
<xsl:value-of
select=
"normalize-space(@name)"
/>
(uni_atoi( init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
"))),
</xsl:if>
<xsl:if
test=
"normalize-space(@type)='str'"
>
<xsl:value-of
select=
"normalize-space(@name)"
/>
(init3_str(conf->getArgParam("--
<xsl:value-of
select=
"../@arg_prefix"
/><xsl:value-of
select=
"@name"
/>
"),conf->getProp(cnode,"
<xsl:value-of
select=
"@name"
/>
"),"
<xsl:value-of
select=
"normalize-space(@default)"
/>
")),
</xsl:if>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
// Используемые идентификаторы сообщений (имена берутся из конф. файла)
<xsl:for-each
select=
"//msgmap/item"
><xsl:value-of
select=
"normalize-space(@name)"
/>
(conf->getSensorID(conf->getProp(cnode,"
<xsl:value-of
select=
"normalize-space(@name)"
/>
"))),
node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
(conf->getNodeID( conf->getProp(cnode,"node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
"))),
</xsl:for-each>
sleep_msec(
<xsl:call-template
name=
"settings"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
),
sleep_msec(
<xsl:call-template
name=
"settings"
><xsl:with-param
name=
"varname"
select=
"'sleep-msec'"
/></xsl:call-template>
),
active(true),
active(true),
<xsl:if
test=
"normalize-space($TESTMODE)!=''"
>
<xsl:if
test=
"normalize-space($TESTMODE)!=''"
>
...
@@ -538,7 +565,13 @@ maxHeartBeat(10),
...
@@ -538,7 +565,13 @@ maxHeartBeat(10),
confnode(cnode),
confnode(cnode),
smReadyTimeout(0),
smReadyTimeout(0),
activated(false),
activated(false),
askPause(conf->getPIntProp(cnode,"askPause",2000))
askPause(conf->getPIntProp(cnode,"askPause",2000)),
<xsl:for-each
select=
"//variables/item"
>
<xsl:if
test=
"normalize-space(@private)!=''"
>
<xsl:call-template
name=
"init-variables"
/>
</xsl:if>
</xsl:for-each>
end_private(false)
{
{
<xsl:call-template
name=
"COMMON-ID-LIST"
/>
<xsl:call-template
name=
"COMMON-ID-LIST"
/>
...
...
Utilities/codegen/ctl-cpp-h.xsl
View file @
c7dbb803
...
@@ -95,8 +95,6 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
...
@@ -95,8 +95,6 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
// --- end of public variables ---
// --- end of public variables ---
protected:
protected:
<xsl:call-template
name=
"COMMON-HEAD-PROTECTED"
/>
// --- protected variables ---
// --- protected variables ---
<xsl:text>
<xsl:text>
</xsl:text>
</xsl:text>
...
@@ -117,9 +115,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
...
@@ -117,9 +115,9 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:for-each>
</xsl:for-each>
// ---- end of protected variables ----
// ---- end of protected variables ----
private:
<xsl:call-template
name=
"COMMON-HEAD-PROTECTED"
/>
<xsl:call-template
name=
"COMMON-HEAD-PRIVATE"
/>
private:
<xsl:text>
<xsl:text>
</xsl:text>
// --- private variables ---
</xsl:text>
// --- private variables ---
<xsl:for-each
select=
"//variables/item"
>
<xsl:for-each
select=
"//variables/item"
>
...
@@ -135,6 +133,10 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
...
@@ -135,6 +133,10 @@ class <xsl:value-of select="$CLASSNAME"/>_SK:
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:if>
</xsl:for-each>
// --- end of private variables ---
</xsl:for-each>
// --- end of private variables ---
<xsl:call-template
name=
"COMMON-HEAD-PRIVATE"
/>
bool end_private; // вспомогательное поле (для внутреннего использования при генерировании кода)
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment