Commit a295169f authored by Claes Sjofors's avatar Claes Sjofors

Xtt command store without /col didn't work for attribute objects

parent 679d0b6f
...@@ -6961,177 +6961,81 @@ int XNav::show_par_hier_class_name( ...@@ -6961,177 +6961,81 @@ int XNav::show_par_hier_class_name(
char *parametername, char *parametername,
char *hiername, char *hiername,
char *classname, char *classname,
char *name, char *namep,
int add, int add,
int global, int global,
int max_objects) int max_objects)
{ {
char parametername_str[80]; ItemCollect *item;
pwr_tOName name_str;
int sts; int sts;
pwr_tClassId classid; pwr_tAName attr;
pwr_tObjid hierobjid;
pwr_tObjid objid;
char *s; char *s;
int single_object = 0; pwr_tAName obj_name;
char *t; pwr_sAttrRef ar;
char elementstr[10]; pwr_tTypeId a_type_id;
int len; unsigned int a_size;
int element; unsigned int a_offset;
pwr_tOName name_array[2]; unsigned int a_dim;
int names; pwr_tTid a_tid;
ItemObject *item; unsigned int a_flags = 0;
pwr_tAName name;
if ( max_objects == 0)
max_objects = 300;
if ( (parametername == NULL) && (name != NULL)) if ( !namep) {
{ message('E', "Syntax error");
/* Parse the parameter name to get object name and
parameter name */
names = dcli_parse( name, ".", "",
(char *) name_array, sizeof( name_array)/sizeof( name_array[0]),
sizeof( name_array[0]), 0);
if ( names != 2 )
{
message('E',"Name syntax error");
return XNAV__SUCCESS;
}
strncpy( name_str, name_array[0], sizeof(name_str));
strncpy( parametername_str, name_array[1], sizeof(parametername_str));
parametername = parametername_str;
name = name_str;
}
else if (parametername == NULL)
{
message('E', "Enter parameter");
return XNAV__HOLDCOMMAND; return XNAV__HOLDCOMMAND;
} }
if ( name != NULL)
{
/* Check if name does not include a wildcard */
s = strchr( name, '*');
if ( s == 0)
{
/* Get objid for the object */
sts = find_name( name, &objid);
if ( EVEN(sts))
{
message('E',"Object does not exist");
return XNAV__HOLDCOMMAND;
}
single_object = 1;
}
else {
/* Convert name to upper case */
// cdh_ToUpper( name, name);
}
}
/* Check if class */ if ( !add == XNAV_MENU_ADD)
if ( classname != NULL ) brow_pop();
{
/* Get classid for the class */
sts = gdh_ClassNameToId ( classname, &classid);
if ( EVEN(sts))
{
/* Class not found */
message('E',"Unknown class");
return XNAV__HOLDCOMMAND;
}
}
else
classid = 0;
/* Check if hierarchy */ try {
if ( hiername != NULL ) pwr_tAttrRef aref;
{ sts = gdh_NameToAttrref( pwr_cNObjid, namep, &aref);
if ( *hiername == '\0') if ( EVEN(sts)) return sts;
{
/* No value is given, take the title as default */
// sts = rtt_find_hierarchy( parent_ctx, &hierobjid);
sts = 0;
if (EVEN(sts))
{
message('E', "No hierarchy found");
return XNAV__HOLDCOMMAND;
}
}
else
{
/* Get objid for the hierarchy object */
sts = gdh_NameToObjid ( hiername, &hierobjid);
if (EVEN(sts))
{
message('E',"Hierarchy object not found");
return XNAV__HOLDCOMMAND;
}
}
}
else
hierobjid = pwr_cNObjid;
/* Check index in parameter */ sts = gdh_AttrrefToName ( &aref, name, sizeof(name), cdh_mNName);
s = strchr( parametername, '['); if ( EVEN(sts)) return sts;
if ( s == 0)
element = -1;
else
{
t = strchr( parametername, ']');
if ( t == 0)
{
message('E',"Syntax error in parameter name");
return XNAV__HOLDCOMMAND;
}
else
{
len = t - s - 1;
strncpy( elementstr, s + 1, len);
elementstr[ len] = 0;
sscanf( elementstr, "%d", &element);
*s = '\0';
if ( (element < 0) || (element > 1000) )
{
message('E',"Syntax error in parameter name");
return XNAV__HOLDCOMMAND;
}
}
}
if ( !aref.Flags.b.Object && !aref.Flags.b.ObjectAttr) {
if ( (s = strchr( name, '.')) == 0)
return 0;
strcpy( attr, s+1);
if ( !add == XNAV_MENU_ADD) sts = gdh_GetAttributeCharAttrref( &aref, &a_type_id, &a_size, &a_offset,
{ &a_dim);
brow_pop(); if ( EVEN(sts)) return sts;
}
try { sts = gdh_GetAttributeFlags( &ar, &a_flags);
if ( single_object) { if ( EVEN(sts)) return sts;
item = new ItemObject( brow, objid, NULL, flow_eDest_IntoLast, 1);
item->open_attribute( brow, 0, 0, parametername, element); sts = gdh_GetAttrRefTid( &aref, &a_tid);
delete item; if ( EVEN(sts)) return sts;
// sts = rtt_show_parameter_add( objid, &menulist,
// parametername, &index, &element, 0);
} }
else else {
{ sts = get_trace_attr( &aref, attr);
// sts = rtt_get_objects_hier_class_name( parent_ctx, hierobjid, if ( EVEN(sts)) return sts;
// classid, name, max_objects, global, strcpy( obj_name, name);
// &rtt_show_parameter_add, (void *) &menulist, strcat( obj_name, ".");
// (void *) parametername, (void *) &index, strcat( obj_name, attr);
// (void *) &element, 0); sts = gdh_NameToAttrref( pwr_cNObjid, obj_name, &ar);
// if ( sts == XNAV__MAXCOUNT) if ( EVEN(sts)) return sts;
// message('E',"To many object, all objects could not be shown");
// else if ( EVEN (sts)) return sts;
// if ( index) strcpy( attr, strchr(obj_name, '.') + 1);
// sts = rtt_menu_upd_bubblesort( menulist);
// else sts = gdh_GetAttributeCharAttrref( &ar, &a_type_id, &a_size, &a_offset,
// { &a_dim);
// message('E', "No objects found"); if ( EVEN(sts)) return sts;
// return XNAV__HOLDCOMMAND;
// } sts = gdh_GetAttributeFlags( &ar, &a_flags);
if ( EVEN(sts)) return sts;
sts = gdh_GetAttrRefTid( &aref, &a_tid);
if ( EVEN(sts)) return sts;
} }
item = new ItemCollect( brow, aref.Objid, attr, NULL,
flow_eDest_IntoLast, a_type_id, a_tid, a_size, a_flags, 0);
} }
catch ( co_error& e) { catch ( co_error& e) {
brow_push_all(); brow_push_all();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment