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
dad4f5e8
Commit
dad4f5e8
authored
Mar 11, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Исправил баг в функиях conf->getPIntProp() приводивший к тому,
что невозможно передать отрицательное число.
parent
44234ec3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
17 deletions
+60
-17
libuniset.spec
conf/libuniset.spec
+4
-1
test.xml
conf/test.xml
+1
-1
configure.ac
configure.ac
+2
-2
Configuration.cc
src/Various/Configuration.cc
+8
-6
UniXML.cc
src/Various/UniXML.cc
+4
-3
Makefile.am
tests/Makefile.am
+3
-1
conftest.cc
tests/conftest.cc
+34
-0
conftest.sh
tests/conftest.sh
+1
-1
sscanf_hex.cc
tests/sscanf_hex.cc
+3
-2
No files found.
conf/libuniset.spec
View file @
dad4f5e8
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 1.0
Release: alt
7
Release: alt
8
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -191,6 +191,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Fri Mar 11 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt8
- fixed bug in conf->getArgPInt function (new libUniSet revision)
* Wed Mar 02 2011 Pavel Vainerman <pv@altlinux.ru> 1.0-alt7
- add UNet2 to extensions
...
...
conf/test.xml
View file @
dad4f5e8
...
...
@@ -33,7 +33,7 @@
</UniSet>
<dlog
name=
"dlog"
/>
<IOControl
name=
"IOControl"
/>
<testnode
id=
"10
00"
/>
<testnode
name=
"testnode"
id=
"1000"
id2=
"-1
00"
/>
<SharedMemory
name=
"SharedMemory"
shmID=
"SharedMemory"
>
<History
savetime=
"200"
>
<item
filter=
"a1"
fuse_id=
"AlarmFuse1_S"
fuse_invert=
"1"
id=
"1"
size=
"30"
/>
...
...
configure.ac
View file @
dad4f5e8
...
...
@@ -3,7 +3,7 @@
# See doc: http://www.gnu.org/software/hello/manual/autoconf/Generic-Programs.html
# AC_PREREQ(2.59)
AC_INIT([uniset], [1.
0
.0], pv@etersoft.ru)
AC_INIT([uniset], [1.
1
.0], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
# AC_CONFIG_MACRO_DIR([m4])
...
...
@@ -30,7 +30,7 @@ AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AM_PROG_LIBTOOL
LIBVER=1:
0
:0
LIBVER=1:
1
:0
AC_SUBST(LIBVER)
# Checks for libraries.
...
...
src/Various/Configuration.cc
View file @
dad4f5e8
...
...
@@ -422,18 +422,20 @@ int Configuration::getArgInt( const string name, const string defval )
int
Configuration
::
getArgPInt
(
const
string
name
,
int
defval
)
{
int
i
=
getArgInt
(
name
);
if
(
i
<=
0
)
string
param
=
getArgParam
(
name
,
""
);
if
(
param
.
empty
()
)
return
defval
;
return
i
;
return
UniSetTypes
::
uni_atoi
(
param
);
}
int
Configuration
::
getArgPInt
(
const
string
name
,
const
string
strdefval
,
int
defval
)
{
int
i
=
getArgInt
(
name
,
strdefval
);
if
(
i
<=
0
)
string
param
=
getArgParam
(
name
,
strdefval
);
if
(
param
.
empty
()
&&
strdefval
.
empty
()
)
return
defval
;
return
i
;
return
UniSetTypes
::
uni_atoi
(
param
);
}
...
...
src/Various/UniXML.cc
View file @
dad4f5e8
...
...
@@ -133,10 +133,11 @@ int UniXML::getIntProp(const xmlNode* node, const string name )
int
UniXML
::
getPIntProp
(
const
xmlNode
*
node
,
const
string
name
,
int
def
)
{
int
i
=
getIntProp
(
node
,
name
);
if
(
i
<=
0
)
string
param
=
getProp
(
node
,
name
);
if
(
param
.
empty
()
)
return
def
;
return
i
;
return
UniSetTypes
::
uni_atoi
(
param
);
}
void
UniXML
::
setProp
(
xmlNode
*
node
,
string
name
,
string
text
)
...
...
tests/Makefile.am
View file @
dad4f5e8
...
...
@@ -4,7 +4,7 @@
SUBDIRS
=
JrnTests
noinst_PROGRAMS
=
passivetimer unixml ui umutex conftest iterator_test
noinst_PROGRAMS
=
passivetimer unixml ui umutex conftest iterator_test
sscanf_hex
passivetimer_SOURCES
=
passivetimer.cc
passivetimer_LDADD
=
$(top_builddir)
/lib/libUniSet.la
...
...
@@ -30,6 +30,8 @@ conftest_SOURCES = conftest.cc
conftest_LDADD
=
$(top_builddir)
/lib/libUniSet.la
conftest_CPPFLAGS
=
-I
$(top_builddir)
/include
sscanf_hex_SOURCES
=
sscanf_hex.cc
include
$(top_builddir)/conf/setting.mk
tests/conftest.cc
View file @
dad4f5e8
...
...
@@ -38,6 +38,40 @@ int main(int argc, const char **argv)
UniversalIO
::
IOTypes
t3
=
conf
->
getIOType
(
"Input1_S"
);
cout
<<
"**** check getIOType(name): for short name 'Input1_S': ("
<<
t3
<<
") "
<<
(
t3
==
UniversalIO
::
UnknownIOType
?
"FAILED"
:
"OK"
)
<<
endl
;
int
i1
=
uni_atoi
(
"-100"
);
cout
<<
"**** check uni_atoi: '-100' "
<<
(
(
i1
!=
-
100
)
?
"FAILED"
:
"OK"
)
<<
endl
;
int
i2
=
uni_atoi
(
"20"
);
cout
<<
"**** check uni_atoi: '20' "
<<
(
(
i2
!=
20
)
?
"FAILED"
:
"OK"
)
<<
endl
;
xmlNode
*
cnode
=
conf
->
getNode
(
"testnode"
);
if
(
cnode
==
NULL
)
{
cerr
<<
"<testnode name='testnode'> not found"
<<
endl
;
return
1
;
}
cout
<<
"**** check conf->getNode function [OK] "
<<
endl
;
UniXML_iterator
it
(
cnode
);
int
prop2
=
conf
->
getArgInt
(
"--prop-id2"
,
it
.
getProp
(
"id2"
));
cerr
<<
"**** check conf->getArgInt(arg1,...): "
<<
(
(
prop2
==
0
)
?
"[FAILED]"
:
"OK"
)
<<
endl
;
int
prop3
=
conf
->
getArgInt
(
"--prop-dummy"
,
it
.
getProp
(
"id2"
));
cerr
<<
"**** check conf->getArgInt(...,arg2): "
<<
(
(
prop3
!=
-
100
)
?
"[FAILED]"
:
"OK"
)
<<
endl
;
int
prop1
=
conf
->
getArgPInt
(
"--prop-id2"
,
it
.
getProp
(
"id2"
),
0
);
cerr
<<
"**** check conf->getArgPInt(...): "
<<
(
(
prop1
==
0
)
?
"[FAILED]"
:
"OK"
)
<<
endl
;
int
prop4
=
conf
->
getArgPInt
(
"--prop-dummy"
,
it
.
getProp
(
"dummy"
),
20
);
cerr
<<
"**** check conf->getArgPInt(...,...,defval): "
<<
(
(
prop4
!=
20
)
?
"[FAILED]"
:
"OK"
)
<<
endl
;
int
prop5
=
conf
->
getArgPInt
(
"--prop-dummy"
,
it
.
getProp
(
"dummy"
),
0
);
cerr
<<
"**** check conf->getArgPInt(...,...,defval): "
<<
(
(
prop5
!=
0
)
?
"[FAILED]"
:
"OK"
)
<<
endl
;
return
0
;
}
catch
(
SystemError
&
err
)
...
...
tests/conftest.sh
View file @
dad4f5e8
...
...
@@ -5,7 +5,7 @@ SID=$1
[
-z
"
$SID
"
]
&&
SID
=
1
echo
"check auto ID configuration..."
uniset-start.sh
-f
./conftest
--confile
test.xml
uniset-start.sh
-f
./conftest
--confile
test.xml
--prop-id2
-10
echo
"check id from file configuration..."
uniset-start.sh
-f
./conftest
--confile
testID.xml
...
...
tests/sscanf_hex.cc
View file @
dad4f5e8
...
...
@@ -5,8 +5,8 @@ bool check(const char *t, int nres)
int
n
=
105
;
sscanf
(
t
,
"%i"
,
&
n
);
printf
(
"res=%d
\n
"
,
n
);
if
(
n
!=
nres
)
printf
(
"
FAILED
\n
"
);
if
(
n
!=
nres
)
printf
(
"
check %d [FAILED]
\n
"
,
nres
);
return
n
==
nres
;
}
...
...
@@ -20,4 +20,5 @@ int main()
check
(
"-1000"
,
-
1000
);
check
(
""
,
0
);
// check(NULL,0); // SegFault
return
0
;
}
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