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
c7d8661b
Commit
c7d8661b
authored
Sep 07, 2012
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Xtt display values as hex, octal, binary etc (refs #14)
parent
fc301adb
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
442 additions
and
114 deletions
+442
-114
src/doc/man/en_us/man_opg.dat
src/doc/man/en_us/man_opg.dat
+20
-0
src/doc/man/sv_se/man_opg.dat
src/doc/man/sv_se/man_opg.dat
+20
-0
src/exp/inc/src/pwr.h
src/exp/inc/src/pwr.h
+4
-0
src/lib/co/src/co_cdh.c
src/lib/co/src/co_cdh.c
+24
-0
src/lib/co/src/co_cdh.h
src/lib/co/src/co_cdh.h
+5
-0
xtt/lib/ge/src/ge_dyn.cpp
xtt/lib/ge/src/ge_dyn.cpp
+2
-20
xtt/lib/xtt/gtk/xtt_xattone_gtk.cpp
xtt/lib/xtt/gtk/xtt_xattone_gtk.cpp
+1
-1
xtt/lib/xtt/src/xtt_item.cpp
xtt/lib/xtt/src/xtt_item.cpp
+2
-2
xtt/lib/xtt/src/xtt_item.h
xtt/lib/xtt/src/xtt_item.h
+29
-22
xtt/lib/xtt/src/xtt_xattnav.cpp
xtt/lib/xtt/src/xtt_xattnav.cpp
+2
-1
xtt/lib/xtt/src/xtt_xnav.cpp
xtt/lib/xtt/src/xtt_xnav.cpp
+286
-67
xtt/lib/xtt/src/xtt_xnav.h
xtt/lib/xtt/src/xtt_xnav.h
+13
-1
xtt/lib/xtt/src/xtt_xnav_command.cpp
xtt/lib/xtt/src/xtt_xnav_command.cpp
+34
-0
No files found.
src/doc/man/en_us/man_opg.dat
View file @
c7d8661b
...
...
@@ -1554,6 +1554,7 @@ open trend <t>Open DsTrend or PlotGroup graph <LINK> open trend
read object <t>Read the content of an object from file <LINK> read object
search <t>Search for an object or a string <LINK> search
set advanceduser<t>Set advanced user <LINK> set advanceduser
set display<t>Set format of display for selected attribute <LINK> set display
set folder <t>Set a folder in a tabbed window. <LINK> set folder
set parameter<t>Set the value of an attribute <LINK> set parameter
set subwindow<t>View a graph in a Ge window object. <LINK> set subwindow
...
...
@@ -2227,6 +2228,25 @@ Set or reset advanced user.
advanced user <LINK> advanced user
</TOPIC>
<TOPIC> set display <style> function
Command set display
Set format for display of the selected attribute. The attribute can
be displayed as decimal, hexadecimal, octal, binary, integer or float.
Object identities and attribute references can be displayed
as identity.
<B>xtt> set display default
<B>xtt> set display hexdecimal
<B>xtt> set display decimal
<B>xtt> set display octal
<B>xtt> set display binary
<B>xtt> set display integer
<B>xtt> set display float
<B>xtt> set display identity
</TOPIC>
<TOPIC> setup <style> function
Xtt setup
Setup of xtt properies
...
...
src/doc/man/sv_se/man_opg.dat
View file @
c7d8661b
...
...
@@ -1563,6 +1563,7 @@ open operatorwindow<t>
read object <t>Läs innehållet av ett objekt från fil <LINK> read object
search <t>Leta efter objekt eller sträng <LINK> search
set advanceduser<t>Sätt avancerad användare <LINK> set advanceduser
set display<t>Sätt format for visning av utvalt attribut <LINK> set display
set folder <t>Aktivera en flik i ett flikfönster. <LINK> set folder
set parameter<t>Sätt värdet på ett attribut <LINK> set parameter
set subwindow<t>Visa in graf i ett Ge window objekt. <LINK> set subwindow
...
...
@@ -2189,6 +2190,25 @@ S
advanced user <LINK> advanced user
</TOPIC>
<TOPIC> set display <style> function
Command set display
Sätt format for visning av utvalt attribut. Ett attribut kan visas
som decimalt, hexadecimalt, oktalt, binärt, eller som heltal eller
flyttal. Objektidentiteter och attribut-referenser kan visas som
identiteter.
<B>xtt> set display default
<B>xtt> set display hexdecimal
<B>xtt> set display decimal
<B>xtt> set display octal
<B>xtt> set display binary
<B>xtt> set display integer
<B>xtt> set display float
<B>xtt> set display identity
</TOPIC>
<TOPIC> setup <style> function
Xtt setup
Unställning av xtt egenskaper.
...
...
src/exp/inc/src/pwr.h
View file @
c7d8661b
...
...
@@ -755,9 +755,13 @@ static const pwr_tDeltaTime pwr_cNDeltaTime = {0, 0}; //!< Zero deltatime consta
#if (defined OS_POSIX) && defined HW_X86_64
# define pwr_dFormatUInt64 "%lu"
# define pwr_dFormatInt64 "%ld"
# define pwr_dFormatHexInt64 "%lx"
# define pwr_dFormatOctInt64 "%lo"
#else
# define pwr_dFormatUInt64 "%llu"
# define pwr_dFormatInt64 "%lld"
# define pwr_dFormatHexInt64 "%llx"
# define pwr_dFormatOctInt64 "%llo"
#endif
/*@}*/
...
...
src/lib/co/src/co_cdh.c
View file @
c7d8661b
...
...
@@ -595,6 +595,7 @@ cdh_AttrValueToString (
strncpy
(
String
,
sval
,
MaxSize
);
return
sts
;
}
//! Converts an attribute value given as a text string, to internal binary format.
...
...
@@ -872,6 +873,29 @@ cdh_StringToAttrValue (
return
sts
;
}
//! Converts a bitmask to a binary string.
char
*
cdh_MaskToBinaryString
(
unsigned
int
mask
,
int
noofbits
)
{
static
char
str
[
80
];
unsigned
int
m
;
int
i
;
m
=
1
<<
(
noofbits
-
1
);
strcpy
(
str
,
""
);
for
(
i
=
0
;
i
<
noofbits
;
i
++
)
{
if
(
m
&
mask
)
strcat
(
str
,
"1"
);
else
strcat
(
str
,
"0"
);
m
>>=
1
;
}
return
str
;
}
//! Convert ClassId string to id.
/*!
...
...
src/lib/co/src/co_cdh.h
View file @
c7d8661b
...
...
@@ -867,6 +867,11 @@ cdh_StringToAttrValue (
void
*
Value
);
char
*
cdh_MaskToBinaryString
(
unsigned
int
mask
,
int
noofbits
);
pwr_tStatus
cdh_StringToClassId
(
const
char
*
s
,
...
...
xtt/lib/ge/src/ge_dyn.cpp
View file @
c7d8661b
...
...
@@ -324,24 +324,6 @@ static int dyn_get_typeid( char *format)
return
pwr_eType_Int32
;
}
// Convert a bitmask to binary string
static
char
*
dyn_mask_to_bits
(
unsigned
int
value
,
int
noofbits
)
{
static
char
str
[
40
];
unsigned
int
m
;
m
=
1
<<
(
noofbits
-
1
);
strcpy
(
str
,
""
);
for
(
int
i
=
0
;
i
<
noofbits
;
i
++
)
{
if
(
m
&
value
)
strcat
(
str
,
"1"
);
else
strcat
(
str
,
"0"
);
m
>>=
1
;
}
return
str
;
}
// Replace " to \"
char
*
GeDyn
::
cmd_cnv
(
char
*
instr
)
...
...
@@ -3981,9 +3963,9 @@ int GeValue::scan( grow_tObject object)
switch
(
format
[
strlen
(
format
)
-
1
])
{
case
'b'
:
if
(
strncmp
(
&
format
[
1
],
"16"
,
2
)
==
0
)
strcpy
(
buf
,
dyn_mask_to_bits
(
val
,
16
));
strcpy
(
buf
,
cdh_MaskToBinaryString
(
val
,
16
));
else
strcpy
(
buf
,
dyn_mask_to_bits
(
val
,
32
));
strcpy
(
buf
,
cdh_MaskToBinaryString
(
val
,
32
));
len
=
strlen
(
buf
);
break
;
default:
{
...
...
xtt/lib/xtt/gtk/xtt_xattone_gtk.cpp
View file @
c7d8661b
...
...
@@ -148,7 +148,7 @@ int XAttOneGtk::change_value( int set_focus)
if
(
atype
==
pwr_eType_Text
)
value
=
aval
;
else
{
XNav
::
attrvalue_to_string
(
atype
,
atype
,
&
aval
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
XNav
::
attrvalue_to_string
(
atype
,
atype
,
&
aval
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
,
0
);
value
=
buf
;
}
...
...
xtt/lib/xtt/src/xtt_item.cpp
View file @
c7d8661b
...
...
@@ -766,7 +766,7 @@ ItemAttr::ItemAttr( XNavBrow *brow, pwr_tObjid item_objid,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
)
:
ItemBaseAttr
(
item_objid
,
attr_name
,
attr_type_id
,
attr_tid
,
attr_size
,
attr_flags
,
item_is_root
,
item_display_type
)
attr_type_id
,
attr_tid
,
attr_size
,
attr_flags
,
item_is_root
,
item_display_type
)
{
pwr_tOName
obj_name
;
pwr_tAName
annot
;
...
...
@@ -829,7 +829,7 @@ ItemAttr::ItemAttr( XNavBrow *brow, pwr_tObjid item_objid,
strcat
(
aname
,
attr_name
);
sts
=
gdh_GetObjectInfo
(
aname
,
buff
,
size
);
((
XNav
*
)
brow
->
userdata
)
->
attrvalue_to_string
(
type_id
,
tid
,
buff
,
str
,
sizeof
(
str
),
&
len
,
NULL
);
((
XNav
*
)
brow
->
userdata
)
->
attrvalue_to_string
(
type_id
,
tid
,
buff
,
str
,
sizeof
(
str
),
&
len
,
NULL
,
0
);
brow_SetAnnotation
(
node
,
1
,
str
,
len
);
}
else
...
...
xtt/lib/xtt/src/xtt_item.h
View file @
c7d8661b
...
...
@@ -131,6 +131,7 @@ class Item {
virtual
int
open_crossref
(
XNavBrow
*
brow
,
double
x
,
double
y
)
{
return
1
;}
virtual
void
close
(
XNavBrow
*
brow
,
double
x
,
double
y
)
{}
virtual
void
set_conversion
(
xnav_eConv
c
)
{}
xnav_eItemType
type
;
pwr_tObjid
objid
;
...
...
@@ -142,28 +143,34 @@ class Item {
class
ItemBaseAttr
:
public
Item
{
public:
ItemBaseAttr
(
pwr_tObjid
item_objid
,
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
)
:
Item
(
item_objid
,
item_is_root
),
type_id
(
attr_type_id
),
tid
(
attr_tid
),
size
(
attr_size
),
flags
(
attr_flags
),
subid
(
pwr_cNSubid
),
first_scan
(
1
),
display_type
(
item_display_type
)
{
strcpy
(
attr
,
attr_name
);
memset
(
old_value
,
0
,
sizeof
(
old_value
));
noedit
=
flags
&
PWR_MASK_PRIVATE
?
1
:
0
;};
virtual
int
open_children
(
XNavBrow
*
brow
,
double
x
,
double
y
);
virtual
void
close
(
XNavBrow
*
brow
,
double
x
,
double
y
);
int
type_id
;
pwr_tTid
tid
;
int
size
;
int
flags
;
pwr_tSubid
subid
;
char
old_value
[
80
];
int
first_scan
;
pwr_tOName
attr
;
item_eDisplayType
display_type
;
int
noedit
;
char
*
attr_name
,
int
attr_type_id
,
pwr_tTid
attr_tid
,
int
attr_size
,
int
attr_flags
,
int
item_is_root
,
item_eDisplayType
item_display_type
)
:
Item
(
item_objid
,
item_is_root
),
type_id
(
attr_type_id
),
tid
(
attr_tid
),
size
(
attr_size
),
flags
(
attr_flags
),
subid
(
pwr_cNSubid
),
first_scan
(
1
),
display_type
(
item_display_type
),
conversion
(
xnav_eConv_No
)
{
strcpy
(
attr
,
attr_name
);
memset
(
old_value
,
0
,
sizeof
(
old_value
));
noedit
=
flags
&
PWR_MASK_PRIVATE
?
1
:
0
;};
virtual
int
open_children
(
XNavBrow
*
brow
,
double
x
,
double
y
);
virtual
void
close
(
XNavBrow
*
brow
,
double
x
,
double
y
);
virtual
void
set_conversion
(
xnav_eConv
c
)
{
conversion
=
c
;
memset
(
old_value
,
-
99
,
sizeof
(
old_value
));
}
int
type_id
;
pwr_tTid
tid
;
int
size
;
int
flags
;
pwr_tSubid
subid
;
char
old_value
[
80
];
int
first_scan
;
pwr_tOName
attr
;
item_eDisplayType
display_type
;
int
noedit
;
xnav_eConv
conversion
;
};
class
ItemHeader
:
public
Item
{
...
...
xtt/lib/xtt/src/xtt_xattnav.cpp
View file @
c7d8661b
...
...
@@ -603,7 +603,8 @@ int XAttNav::trace_scan_bc( brow_tObject object, void *p)
else
item
->
first_scan
=
0
;
XNav
::
attrvalue_to_string
(
item
->
type_id
,
item
->
tid
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
);
XNav
::
attrvalue_to_string
(
item
->
type_id
,
item
->
tid
,
p
,
buf
,
sizeof
(
buf
),
&
len
,
NULL
,
item
->
conversion
);
brow_SetAnnotation
(
object
,
1
,
buf
,
len
);
memcpy
(
item
->
old_value
,
p
,
min
(
item
->
size
,
(
int
)
sizeof
(
item
->
old_value
)));
break
;
...
...
xtt/lib/xtt/src/xtt_xnav.cpp
View file @
c7d8661b
This diff is collapsed.
Click to expand it.
xtt/lib/xtt/src/xtt_xnav.h
View file @
c7d8661b
...
...
@@ -165,6 +165,17 @@ typedef enum {
menu_ePixmap_Leaf
}
menu_ePixmap
;
typedef
enum
{
xnav_eConv_No
,
xnav_eConv_Hex
,
xnav_eConv_Decimal
,
xnav_eConv_Binary
,
xnav_eConv_Octal
,
xnav_eConv_Integer
,
xnav_eConv_Float
,
xnav_eConv_Identity
}
xnav_eConv
;
typedef
struct
{
char
title
[
80
];
int
item_type
;
...
...
@@ -414,6 +425,7 @@ class XNav {
int
get_select_all
(
pwr_sAttrRef
**
attrref
,
int
**
is_attr
);
int
get_all_objects
(
pwr_sAttrRef
**
attrref
,
int
**
is_attr
);
int
get_all_collect_objects
(
pwr_sAttrRef
**
attrref
,
int
**
is_attr
);
void
set_select_conversion
(
xnav_eConv
conv
);
int
collect_insert
(
pwr_sAttrRef
*
attrref
);
int
collect_remove
();
int
collect_show
();
...
...
@@ -468,7 +480,7 @@ class XNav {
static
int
attr_string_to_value
(
int
type_id
,
char
*
value_str
,
void
*
buffer_ptr
,
int
buff_size
,
int
attr_size
);
static
void
attrvalue_to_string
(
int
type_id
,
pwr_tTid
tid
,
void
*
value_ptr
,
char
*
str
,
int
size
,
int
*
len
,
char
*
format
);
char
*
str
,
int
size
,
int
*
len
,
char
*
format
,
int
conv
);
static
void
trace_subwindow_cb
(
void
*
ctx
,
pwr_tObjid
objid
);
static
void
trace_display_object_cb
(
void
*
ctx
,
pwr_tObjid
objid
);
static
int
is_authorized_cb
(
void
*
xnav
,
unsigned
int
access
);
...
...
xtt/lib/xtt/src/xtt_xnav_command.cpp
View file @
c7d8661b
...
...
@@ -884,6 +884,40 @@ static int xnav_set_func( void *client_data,
char
c
;
c
=
*
p
;
}
else
if
(
cdh_NoCaseStrncmp
(
arg1_str
,
"DISPLAY"
,
strlen
(
arg1_str
))
==
0
)
{
// Command is "SET DISPLAY"
xnav_eConv
conv
;
char
arg2_str
[
80
];
if
(
EVEN
(
dcli_get_qualifier
(
"dcli_arg2"
,
arg2_str
,
sizeof
(
arg2_str
))))
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
1
;
}
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"HEXADECIMAL"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_Hex
;
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"DECIMAL"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_Decimal
;
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"OCTAL"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_Octal
;
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"BINARY"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_Binary
;
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"FLOAT"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_Float
;
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"INTEGER"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_Integer
;
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"IDENTITY"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_Identity
;
else
if
(
cdh_NoCaseStrncmp
(
arg2_str
,
"DEFAULT"
,
strlen
(
arg2_str
))
==
0
)
conv
=
xnav_eConv_No
;
else
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
1
;
}
xnav
->
set_select_conversion
(
conv
);
}
else
xnav
->
message
(
'E'
,
"Syntax error"
);
return
1
;
...
...
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