Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
5aea23be
Commit
5aea23be
authored
Dec 06, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Symbols for INT_MIN, INT_MAX, FLT_MIN and FLT_MAX
parent
24b6d54a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
17 deletions
+70
-17
wb/lib/wb/src/wb_print_wbl.cpp
wb/lib/wb/src/wb_print_wbl.cpp
+13
-3
wb/lib/wb/src/wb_wblnode.cpp
wb/lib/wb/src/wb_wblnode.cpp
+17
-3
xtt/lib/xtt/src/xtt_xnav.cpp
xtt/lib/xtt/src/xtt_xnav.cpp
+40
-11
No files found.
wb/lib/wb/src/wb_print_wbl.cpp
View file @
5aea23be
/*
* Proview $Id: wb_print_wbl.cpp,v 1.2
0 2007-09-19 15:13:02
claes Exp $
* Proview $Id: wb_print_wbl.cpp,v 1.2
1 2007-12-06 10:53:18
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -655,7 +655,12 @@ bool wb_print_wbl::printValue (wb_volume& v,
sprintf
(
sval
,
"%d"
,
*
(
pwr_tBoolean
*
)
val
);
break
;
case
pwr_eType_Float32
:
sprintf
(
sval
,
"%.*e"
,
FLT_DIG
,
*
(
pwr_tFloat32
*
)
val
);
if
(
*
(
pwr_tFloat32
*
)
val
==
FLT_MIN
)
strcpy
(
sval
,
"FLT_MIN"
);
else
if
(
*
(
pwr_tFloat32
*
)
val
==
FLT_MAX
)
strcpy
(
sval
,
"FLT_MAX"
);
else
sprintf
(
sval
,
"%.*e"
,
FLT_DIG
,
*
(
pwr_tFloat32
*
)
val
);
break
;
case
pwr_eType_Float64
:
sprintf
(
sval
,
"%.*e"
,
DBL_DIG
,
*
(
pwr_tFloat64
*
)
val
);
...
...
@@ -673,7 +678,12 @@ bool wb_print_wbl::printValue (wb_volume& v,
sprintf
(
sval
,
"%d"
,
*
(
pwr_tInt16
*
)
val
);
break
;
case
pwr_eType_Int32
:
sprintf
(
sval
,
"%d"
,
*
(
pwr_tInt32
*
)
val
);
if
(
*
(
pwr_tInt32
*
)
val
==
INT_MIN
)
strcpy
(
sval
,
"INT_MIN"
);
else
if
(
*
(
pwr_tInt32
*
)
val
==
INT_MAX
)
strcpy
(
sval
,
"INT_MAX"
);
else
sprintf
(
sval
,
"%d"
,
*
(
pwr_tInt32
*
)
val
);
break
;
case
pwr_eType_Int64
:
sprintf
(
sval
,
"%lld"
,
*
(
pwr_tInt64
*
)
val
);
...
...
wb/lib/wb/src/wb_wblnode.cpp
View file @
5aea23be
/*
* Proview $Id: wb_wblnode.cpp,v 1.
59 2007-10-23 08:54:16
claes Exp $
* Proview $Id: wb_wblnode.cpp,v 1.
60 2007-12-06 10:53:18
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -17,6 +17,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include <float.h>
#include <limits.h>
#include "pwr_class.h"
#include "co_cdh.h"
#include "co_time.h"
...
...
@@ -2015,7 +2017,13 @@ int wb_wblnode::attrStringToValue( int type_id, char *value_str,
}
case
pwr_eType_Float32
:
{
if
(
sscanf
(
value_str
,
"%f"
,
(
float
*
)
buffer_ptr
)
!=
1
)
if
(
strcmp
(
value_str
,
"FLT_MIN"
)
==
0
)
{
*
(
float
*
)
buffer_ptr
=
FLT_MIN
;
}
else
if
(
strcmp
(
value_str
,
"FLT_MAX"
)
==
0
)
{
*
(
float
*
)
buffer_ptr
=
FLT_MAX
;
}
else
if
(
sscanf
(
value_str
,
"%f"
,
(
float
*
)
buffer_ptr
)
!=
1
)
return
0
;
break
;
}
...
...
@@ -2056,7 +2064,13 @@ int wb_wblnode::attrStringToValue( int type_id, char *value_str,
case
pwr_eType_Status
:
case
pwr_eType_NetStatus
:
{
if
(
sscanf
(
value_str
,
"%d"
,
(
int
*
)
buffer_ptr
)
!=
1
)
if
(
strcmp
(
value_str
,
"INT_MIN"
)
==
0
)
{
*
(
int
*
)
buffer_ptr
=
INT_MIN
;
}
else
if
(
strcmp
(
value_str
,
"INT_MAX"
)
==
0
)
{
*
(
int
*
)
buffer_ptr
=
INT_MAX
;
}
else
if
(
sscanf
(
value_str
,
"%d"
,
(
int
*
)
buffer_ptr
)
!=
1
)
return
0
;
break
;
}
...
...
xtt/lib/xtt/src/xtt_xnav.cpp
View file @
5aea23be
/*
* Proview $Id: xtt_xnav.cpp,v 1.3
4 2007-05-21 14:28:32
claes Exp $
* Proview $Id: xtt_xnav.cpp,v 1.3
5 2007-12-06 10:56:28
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
#include "co_nav_help.h"
#include "pwr_privilege.h"
...
...
@@ -235,7 +236,11 @@ int XNav::attr_string_to_value( int type_id, char *value_str,
break
;
}
case
pwr_eType_Float32
:
{
if
(
sscanf
(
value_str
,
"%f"
,
(
float
*
)
buffer_ptr
)
!=
1
)
if
(
strcmp
(
value_str
,
"FLT_MIN"
)
==
0
)
*
(
float
*
)
buffer_ptr
=
FLT_MIN
;
else
if
(
strcmp
(
value_str
,
"FLT_MAX"
)
==
0
)
*
(
float
*
)
buffer_ptr
=
FLT_MAX
;
else
if
(
sscanf
(
value_str
,
"%f"
,
(
float
*
)
buffer_ptr
)
!=
1
)
return
XNAV__INPUT_SYNTAX
;
break
;
}
...
...
@@ -271,7 +276,11 @@ int XNav::attr_string_to_value( int type_id, char *value_str,
case
pwr_eType_Int32
:
case
pwr_eType_Status
:
case
pwr_eType_NetStatus
:
{
if
(
sscanf
(
value_str
,
"%d"
,
(
int
*
)
buffer_ptr
)
!=
1
)
if
(
strcmp
(
value_str
,
"INT_MIN"
)
==
0
)
*
(
int
*
)
buffer_ptr
=
INT_MIN
;
else
if
(
strcmp
(
value_str
,
"INT_MAX"
)
==
0
)
*
(
int
*
)
buffer_ptr
=
INT_MAX
;
else
if
(
sscanf
(
value_str
,
"%d"
,
(
int
*
)
buffer_ptr
)
!=
1
)
return
XNAV__INPUT_SYNTAX
;
break
;
}
...
...
@@ -436,10 +445,20 @@ void XNav::attrvalue_to_string( int type_id, pwr_tTid tid, void *value_ptr,
break
;
}
case
pwr_eType_Float32
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%f"
,
*
(
float
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
float
*
)
value_ptr
);
if
(
*
(
float
*
)
value_ptr
==
FLT_MIN
)
{
strcpy
(
str
,
"FLT_MIN"
);
*
len
=
strlen
(
str
);
}
else
if
(
*
(
float
*
)
value_ptr
==
FLT_MAX
)
{
strcpy
(
str
,
"FLT_MAX"
);
*
len
=
strlen
(
str
);
}
else
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%f"
,
*
(
float
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
float
*
)
value_ptr
);
}
break
;
}
case
pwr_eType_Float64
:
{
...
...
@@ -471,10 +490,20 @@ void XNav::attrvalue_to_string( int type_id, pwr_tTid tid, void *value_ptr,
break
;
}
case
pwr_eType_Int32
:
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%d"
,
*
(
int
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
int
*
)
value_ptr
);
if
(
*
(
int
*
)
value_ptr
==
INT_MIN
)
{
strcpy
(
str
,
"INT_MIN"
);
*
len
=
strlen
(
str
);
}
else
if
(
*
(
int
*
)
value_ptr
==
INT_MAX
)
{
strcpy
(
str
,
"INT_MAX"
);
*
len
=
strlen
(
str
);
}
else
{
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%d"
,
*
(
int
*
)
value_ptr
);
else
*
len
=
sprintf
(
str
,
format
,
*
(
int
*
)
value_ptr
);
}
break
;
}
case
pwr_eType_Int64
:
{
...
...
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