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
ae78e4d3
Commit
ae78e4d3
authored
Dec 11, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(codegen): добавлен ключ --gen-vmap для генерирования map и функции
позволяющей получить указатель на in_(out_) переменую по ID.
parent
6e0d9a22
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
5 deletions
+42
-5
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+24
-1
Makefile.am
Utilities/codegen/tests/Makefile.am
+1
-1
TestGen.cc
Utilities/codegen/tests/TestGen.cc
+6
-0
testgen.src.xml
Utilities/codegen/tests/testgen.src.xml
+1
-1
uobject.src.xml
Utilities/codegen/tests/uobject.src.xml
+1
-1
uniset2-codegen.in
Utilities/codegen/uniset2-codegen.in
+9
-1
No files found.
Utilities/codegen/ctl-cpp-common.xsl
View file @
ae78e4d3
...
...
@@ -328,10 +328,17 @@
bool no_snap = {false};
VMonitor vmon;
<xsl:if
test=
"normalize-space($VARMAP)='1'"
>
/*! Получить указатель на переменную храняющую значение, по идентификатору */
long* pvar( UniSetTypes::ObjectId id );
</xsl:if>
</xsl:template>
<xsl:template
name=
"COMMON-HEAD-PRIVATE"
>
<xsl:if
test=
"normalize-space($VARMAP)='1'"
>
std::unordered_map
<
UniSetTypes::ObjectId,long*
>
vmap;
</xsl:if>
</xsl:template>
<xsl:template
name=
"COMMON-CC-FILE"
>
...
...
@@ -454,12 +461,24 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::checkTestMode()
}
// -----------------------------------------------------------------------------
</xsl:if>
<xsl:if
test=
"normalize-space($VARMAP)='1'"
>
long*
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::getVariable( UniSetTypes::ObjectId id )
{
auto i = vmap.find(id);
if( i!= vmap.end() )
return i->second;
return nullptr;
}
</xsl:if>
// -----------------------------------------------------------------------------
void
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::sigterm( int signo )
{
<xsl:if
test=
"normalize-space($BASECLASS)!=''"
><xsl:value-of
select=
"normalize-space($BASECLASS)"
/>
::sigterm(signo);
</xsl:if>
<xsl:if
test=
"normalize-space($BASECLASS)=''"
>
UniSetObject::sigterm(signo);
</xsl:if>
active = false;
}
// -----------------------------------------------------------------------------
bool
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::activateObject()
{
...
...
@@ -780,6 +799,10 @@ end_private(false)
node_
<xsl:value-of
select=
"normalize-space(@name)"
/>
= conf->getLocalNode();
}
<xsl:if
test=
"normalize-space($VARMAP)='1'"
>
vmap.emplace(
<xsl:value-of
select=
"normalize-space(@name)"
/>
,
&
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
);
</xsl:if>
</xsl:for-each>
<xsl:for-each
select=
"//msgmap/item"
>
...
...
Utilities/codegen/tests/Makefile.am
View file @
ae78e4d3
...
...
@@ -14,7 +14,7 @@ GENERATED2=TestGenAlone_SK.h TestGenAlone_SK.cc TestGenAlone-main.cc
GENUOBJ
=
UObject_SK.cc UObject_SK.h
TestGen-main.cc TestGen_SK.cc TestGen_SK.h
:
../@PACKAGE@-codegen testgen.src.xml ../*.xsl
../@PACKAGE@-codegen
-l
$(top_builddir)
/Utilities/codegen
--local-include
-n
TestGen testgen.src.xml
../@PACKAGE@-codegen
-l
$(top_builddir)
/Utilities/codegen
--
gen-varmap
--
local-include
-n
TestGen testgen.src.xml
TestGenAlone-main.cc TestGenAlone_SK.cc TestGenAlone_SK.h
:
../@PACKAGE@-codegen testgen-alone.src.xml ../*.xsl
../@PACKAGE@-codegen
-l
$(top_builddir)
/Utilities/codegen
--local-include
--alone
-n
TestGenAlone testgen-alone.src.xml
...
...
Utilities/codegen/tests/TestGen.cc
View file @
ae78e4d3
...
...
@@ -9,6 +9,12 @@ TestGen::TestGen( UniSetTypes::ObjectId id, xmlNode* confnode ):
{
vmonit
(
int_var
);
vmonit
(
bool_var
);
long
*
i
=
getVariable
(
input2_s
);
if
(
!
i
)
cerr
<<
"input2_s NOT FOUND!!!"
<<
endl
;
else
cerr
<<
"input2_s="
<<
(
*
i
)
<<
endl
;
}
// -----------------------------------------------------------------------------
TestGen
::~
TestGen
()
...
...
Utilities/codegen/tests/testgen.src.xml
View file @
ae78e4d3
<?xml version="1.0" encoding="
koi8-r
"?>
<?xml version="1.0" encoding="
utf-8
"?>
<!--
name - название класса
msgcount - сколько сообщений обрабатывается за один раз
...
...
Utilities/codegen/tests/uobject.src.xml
View file @
ae78e4d3
<?xml version="1.0" encoding="
koi8-r
"?>
<?xml version="1.0" encoding="
utf-8
"?>
<!--
name - название класса
msgcount - сколько сообщений обрабатывается за один раз
...
...
Utilities/codegen/uniset2-codegen.in
View file @
ae78e4d3
...
...
@@ -27,6 +27,7 @@ Valid options are:
-m, --main - filename for main.cc. Default: main.cc
-n, --name - filename for *_SK files (base class implementation). Default: xmlfilename_SK
--ask - Use 'ask' templates. See the documentation.
--gen-varmap - generate variable map. For function: long* getVariable(ObjectId)
--alone - Use 'alone' templates. See the documentation.
--no-main - Don't generate main.cc
...
...
@@ -39,7 +40,7 @@ EOF
}
#parse command line options
TEMP
=
`
getopt
-n
$PROG
-o
h,n:,m:,a,l:,z
-l
help
,name:,main:,no-main,topdir:,path:,alone,ask,no-ask,local:,local-include,add-cc-include,add-hh-include,make-skel:,no-makefile
--
"
$@
"
`
||
exit
1
TEMP
=
`
getopt
-n
$PROG
-o
h,n:,m:,a,l:,z
-l
help
,name:,main:,no-main,topdir:,path:,alone,ask,no-ask,local:,local-include,add-cc-include,add-hh-include,make-skel:,no-makefile
,gen-varmap
--
"
$@
"
`
||
exit
1
eval set
--
"
$TEMP
"
name
=
...
...
@@ -68,6 +69,8 @@ skel_m="skel-main.cc"
skel_xml
=
"skel.src.xml"
skel_make
=
"skel-Makefile.am"
varmap
=
0
while
:
;
do
case
"
$1
"
in
-h
|
--help
)
print_usage 0
...
...
@@ -113,6 +116,10 @@ while :; do
ask
=
;;
--gen-varmap
)
varmap
=
1
;;
-l
|
--local
)
shift
xsltdir
=
$1
...
...
@@ -191,6 +198,7 @@ PARAMS=$( echo \
--stringparam
XML_FILENAME
"
${
fname
}
"
\
--stringparam
CNAME
"
${
name
}
"
\
--stringparam
LOCALINC
"
${
localinc
}
"
\
--stringparam
VARMAP
"
${
varmap
}
"
\
$xsltpath
\
)
# --stringparam ADD_CC_INC "${add_cc_inc}" \
...
...
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