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
6aa44c99
Commit
6aa44c99
authored
Jan 14, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(uniset-codegen): добавил генератор скелета класса (--make-skel)
parent
d8bd2aca
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
206 additions
and
8 deletions
+206
-8
Makefile.am
Utilities/codegen/Makefile.am
+1
-1
skel-Makefile.am
Utilities/codegen/skel-Makefile.am
+11
-0
skel-main.cc
Utilities/codegen/skel-main.cc
+55
-0
skel.cc
Utilities/codegen/skel.cc
+38
-0
skel.h
Utilities/codegen/skel.h
+26
-0
skel.src.xml
Utilities/codegen/skel.src.xml
+25
-0
uniset-codegen.in
Utilities/codegen/uniset-codegen.in
+44
-6
libuniset.spec
conf/libuniset.spec
+6
-1
No files found.
Utilities/codegen/Makefile.am
View file @
6aa44c99
...
@@ -3,7 +3,7 @@ SUBDIRS=. tests
...
@@ -3,7 +3,7 @@ SUBDIRS=. tests
bin_SCRIPTS
=
@PACKAGE@-codegen
bin_SCRIPTS
=
@PACKAGE@-codegen
xsldir
=
$(datadir)
/uniset/xslt
xsldir
=
$(datadir)
/uniset/xslt
xsl_DATA
=
*
.xsl
xsl_DATA
=
*
.xsl
skel
*
all-local
:
all-local
:
chmod
'a+x'
@PACKAGE@-codegen
chmod
'a+x'
@PACKAGE@-codegen
...
...
Utilities/codegen/skel-Makefile.am
0 → 100644
View file @
6aa44c99
bin_PROGRAMS = Skel
Skel_SOURCES = Skel_SK.cc Skel.cc
Skel_SK.cc: Skel.src.xml
@UNISET_CODEGEN@ --ask -n Skel --topdir $(top_builddir)/ --no-main Skel.src.xml
clean-local:
rm -rf *_SK.cc *_SK.h
all-local: Skel_SK.cc Skel_SK.h
Utilities/codegen/skel-main.cc
0 → 100644
View file @
6aa44c99
#include <sstream>
#include <ObjectsActivator.h>
#include "Skel.h"
// -----------------------------------------------------------------------------
using
namespace
UniSetTypes
;
using
namespace
std
;
// -----------------------------------------------------------------------------
int
main
(
int
argc
,
const
char
**
argv
)
{
try
{
string
confile
=
uniset_init
(
argc
,
argv
);
string
logfilename
=
conf
->
getArgParam
(
"--logfile"
,
"Skel.log"
);
string
logname
(
conf
->
getLogDir
()
+
logfilename
);
// dlog.logFile( logname.c_str() );
unideb
.
logFile
(
logname
.
c_str
()
);
// conf->initDebug(dlog,"dlog");
ObjectsActivator
act
;
xmlNode
*
cnode
=
conf
->
getNode
(
"Skel"
);
if
(
cnode
==
NULL
)
{
dlog
[
Debug
::
CRIT
]
<<
"(Skel): not found <Skel> in conffile"
<<
endl
;
return
1
;
}
Skel
o
(
"Skel"
,
cnode
);
act
.
addObject
(
static_cast
<
UniSetObject
*>
(
&
o
)
);
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
.
broadcast
(
sm
.
transport_msg
()
);
unideb
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
unideb
[
Debug
::
ANY
]
<<
"(Skel::main): -------------- Skel START -------------------------
\n\n
"
;
dlog
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
dlog
[
Debug
::
ANY
]
<<
"(Skel::main): -------------- Skel START -------------------------
\n\n
"
;
act
.
run
(
false
);
}
catch
(
SystemError
&
err
)
{
cerr
<<
"(Skel::main): "
<<
err
<<
endl
;
}
catch
(
Exception
&
ex
)
{
cerr
<<
"(Skel::main): "
<<
ex
<<
endl
;
}
catch
(...)
{
cerr
<<
"(Skel::main): catch(...)"
<<
endl
;
}
return
0
;
}
// -----------------------------------------------------------------------------
Utilities/codegen/skel.cc
0 → 100644
View file @
6aa44c99
#include "Exceptions.h"
#include "Skel.h"
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
// -----------------------------------------------------------------------------
Skel
::
Skel
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
confnode
)
:
Skel_SK
(
id
,
confnode
)
{
}
// -----------------------------------------------------------------------------
Skel
::~
Skel
()
{
}
// -----------------------------------------------------------------------------
Skel
::
Skel
()
{
cerr
<<
"(Skel): init failed!!!!!!!!!!!!!!!"
<<
endl
;
throw
Exception
();
}
// -----------------------------------------------------------------------------
void
Skel
::
step
()
{
}
// -----------------------------------------------------------------------------
void
Skel
::
sensorInfo
(
SensorMessage
*
sm
)
{
}
// -----------------------------------------------------------------------------
void
Skel
::
timerInfo
(
TimerMessage
*
tm
)
{
}
// -----------------------------------------------------------------------------
void
Skel
::
askSensors
(
UniversalIO
::
UIOCommand
cmd
)
{
}
// -----------------------------------------------------------------------------
Utilities/codegen/skel.h
0 → 100644
View file @
6aa44c99
// -----------------------------------------------------------------------------
#ifndef Skel_H_
#define Skel_H_
// -----------------------------------------------------------------------------
#include "Skel_SK.h"
// -----------------------------------------------------------------------------
class
Skel
:
public
Skel_SK
{
public
:
Skel
(
UniSetTypes
::
ObjectId
id
,
xmlNode
*
confnode
=
UniSetTypes
::
conf
->
getNode
(
"Skel"
)
);
virtual
~
Skel
();
protected
:
Skel
();
virtual
void
step
();
virtual
void
sensorInfo
(
UniSetTypes
::
SensorMessage
*
sm
);
virtual
void
timerInfo
(
UniSetTypes
::
TimerMessage
*
tm
);
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
);
private
:
};
// -----------------------------------------------------------------------------
#endif // Skel_H_
// -----------------------------------------------------------------------------
Utilities/codegen/skel.src.xml
0 → 100644
View file @
6aa44c99
<?xml version="1.0" encoding="utf-8"?>
<!--
name - название класса
msgcount - сколько сообщений обрабатывается за один раз
sleep_msec - пауза между итерациями в работе процесса
type
====
in - входные регистры (только для чтения)
out - выходные регистры (запись)
-->
<Skel>
<settings>
<set
name=
"class-name"
val=
"Skel"
/>
<set
name=
"msg-count"
val=
"20"
/>
<set
name=
"sleep-msec"
val=
"150"
/>
</settings>
<smap>
<!-- name - название переменной в конф. файле -->
</smap>
<msgmap>
<!-- name - название переменной в конф. файле -->
</msgmap>
</Skel>
Utilities/codegen/uniset-codegen.in
View file @
6aa44c99
...
@@ -23,11 +23,15 @@ $PROG - generate source code for control process
...
@@ -23,11 +23,15 @@ $PROG - generate source code for control process
xmlfile - source xml-file
xmlfile - source xml-file
Valid options are:
Valid options are:
-h, --help - display help
-h, --help - display help
-m, --main - filename for main.cc. Default: main.cc
-m, --main - filename for main.cc. Default: main.cc
-n, --name - filename for *_SK files (base class implementation). Default: xmlfilename_SK
-n, --name - filename for *_SK files (base class implementation). Default: xmlfilename_SK
--ask - Use 'ask' templates. See the documentation.
--ask - Use 'ask' templates. See the documentation.
--alone - Use 'alone' templates. See the documentation.
--alone - Use 'alone' templates. See the documentation.
--no-main - Don`t generate main.cc
--make-skel name - generate process skeleton (name.src.xml, Name.cc, Name.hh, Makefile.am, main.cc)
Additional arguments: --no-main, --no-makefile
EOF
EOF
...
@@ -35,7 +39,7 @@ EOF
...
@@ -35,7 +39,7 @@ EOF
}
}
#parse command line options
#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
--
"
$@
"
`
||
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
--
"
$@
"
`
||
exit
1
eval set
--
"
$TEMP
"
eval set
--
"
$TEMP
"
name
=
name
=
...
@@ -50,11 +54,20 @@ localinc=0
...
@@ -50,11 +54,20 @@ localinc=0
add_cc_inc
=
add_cc_inc
=
add_hh_inc
=
add_hh_inc
=
xsltpath
=
xsltpath
=
no_makefile
=
make_skel
=
make_name
=
xls_h
=
"ctl-cpp-h.xsl"
xls_h
=
"ctl-cpp-h.xsl"
xls_c
=
"ctl-cpp-cc.xsl"
xls_c
=
"ctl-cpp-cc.xsl"
xls_m
=
"ctl-cpp-main.xsl"
xls_m
=
"ctl-cpp-main.xsl"
skel_h
=
"skel.h"
skel_c
=
"skel.cc"
skel_m
=
"skel-main.cc"
skel_xml
=
"skel.src.xml"
skel_make
=
"skel-Makefile.am"
while
:
;
do
while
:
;
do
case
"
$1
"
in
case
"
$1
"
in
-h
|
--help
)
print_usage 0
-h
|
--help
)
print_usage 0
...
@@ -116,6 +129,16 @@ while :; do
...
@@ -116,6 +129,16 @@ while :; do
xsltpath
=
"--path
$1
"
xsltpath
=
"--path
$1
"
;;
;;
--make-skel
)
make_skel
=
1
shift
make_name
=
"
$1
"
;;
--no-makefile
)
no_makefile
=
1
;;
--
)
shift
;
break
--
)
shift
;
break
;;
;;
*
)
"unrecognized option:
$1
"
*
)
"unrecognized option:
$1
"
...
@@ -125,6 +148,21 @@ while :; do
...
@@ -125,6 +148,21 @@ while :; do
shift
shift
done
done
if
[
-n
"
$make_skel
"
]
;
then
[
-z
"
$make_name
"
]
&&
print_usage
-1
cp
${
xsltdir
}
/
$skel_h
${
make_name
}
.h
&&
subst
"s|Skel|
${
make_name
}
|g"
${
make_name
}
.h
cp
${
xsltdir
}
/
$skel_c
${
make_name
}
.cc
&&
subst
"s|Skel|
${
make_name
}
|g"
${
make_name
}
.cc
cp
${
xsltdir
}
/
$skel_xml
${
make_name
}
.src.xml
&&
subst
"s|Skel|
${
make_name
}
|g"
${
make_name
}
.src.xml
[
-z
"
$no_main
"
]
&&
cp
${
xsltdir
}
/
$skel_m
${
make_name
}
-main
.cc
&&
subst
"s|Skel|
${
make_name
}
|g"
${
make_name
}
-main
.cc
[
-z
"
$no_makefile
"
]
&&
cp
${
xsltdir
}
/
$skel_make
Makefile.am
&&
subst
"s|Skel|
${
make_name
}
|g"
Makefile.am
exit
0
fi
xmlfile
=
"
$1
"
xmlfile
=
"
$1
"
[
-n
"
$xmlfile
"
]
||
print_usage
[
-n
"
$xmlfile
"
]
||
print_usage
...
...
conf/libuniset.spec
View file @
6aa44c99
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Name: libuniset
Name: libuniset
Version: 1.5
Version: 1.5
Release: alt
9
Release: alt
10
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: GPL
License: GPL
Group: Development/C++
Group: Development/C++
...
@@ -162,6 +162,7 @@ rm -f %buildroot%_libdir/*.la
...
@@ -162,6 +162,7 @@ rm -f %buildroot%_libdir/*.la
%dir %_datadir/%oname/
%dir %_datadir/%oname/
%dir %_datadir/%oname/xslt/
%dir %_datadir/%oname/xslt/
%_datadir/%oname/xslt/*.xsl
%_datadir/%oname/xslt/*.xsl
%_datadir/%oname/xslt/skel*
%files
%files
%_libdir/libUniSet.so.*
%_libdir/libUniSet.so.*
...
@@ -262,6 +263,10 @@ rm -f %buildroot%_libdir/*.la
...
@@ -262,6 +263,10 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
%changelog
* Mon Jan 14 2013 Pavel Vainerman <pv@altlinux.ru> 1.5-alt10
- add error code for MTR (eterbug #8659)
- (uniset-codegen): add generate class Skeleton (--make-skel)
* Sat Jan 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.5-alt9
* Sat Jan 05 2013 Pavel Vainerman <pv@altlinux.ru> 1.5-alt9
- add SQLite support
- add SQLite support
...
...
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