Commit 3e0a9704 authored by claes's avatar claes

Fix for backupobject connected to GetIp

parent a7a67031
/* /*
* Proview $Id: wb_gcg.cpp,v 1.9 2007-12-21 13:18:01 claes Exp $ * Proview $Id: wb_gcg.cpp,v 1.10 2008-02-04 13:34:11 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -3442,76 +3442,31 @@ static int gcg_get_outputstring_spec( ...@@ -3442,76 +3442,31 @@ static int gcg_get_outputstring_spec(
switch ( output_node->ln.cid) { switch ( output_node->ln.cid) {
case pwr_cClass_GetDp: { case pwr_cClass_GetDp:
case pwr_cClass_GetAp: {
/********************************************************** /**********************************************************
* GETDP * GetDp, GetAp
***********************************************************/ ***********************************************************/
/* Get the objdid stored in the parameter */ pwr_tObjName pname;
sts = ldh_GetObjectPar(
ldhses,
output_node->ln.oid,
"DevBody",
"DpObject",
(char **)&attrref, &size);
if ( EVEN(sts)) return sts;
sts = gcg_replace_ref( gcgctx, attrref, output_node);
if ( EVEN(sts)) return sts;
/* Check that this is objdid of an existing object */ switch ( output_node->ln.cid) {
sts = ldh_GetAttrRefOrigTid( ldhses, attrref, &cid); case pwr_cClass_GetDp:
if ( EVEN(sts)) { strcpy( pname, "DpObject");
gcg_error_msg( gcgctx, GSX__REFOBJ, output_node); break;
free((char *) attrref); case pwr_cClass_GetAp:
return GSX__NEXTPAR; strcpy( pname, "ApObject");
} break;
/* Get the attribute name of last segment */ default: ;
sts = ldh_AttrRefToName( ldhses, attrref, ldh_eName_ArefVol,
&name_p, &size);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, output_node);
free((char *) attrref);
return GSX__NEXTPAR;
}
free((char *) attrref);
strcpy( aname, name_p);
if ( (s = strrchr( aname, '.')) == 0) {
gcg_error_msg( gcgctx, GSX__REFOBJ, output_node);
return GSX__NEXTPAR;
}
*s = 0;
sts = ldh_NameToAttrRef( ldhses, aname, parattrref);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, output_node);
return GSX__NEXTPAR;
}
sts = ldh_GetAttrRefOrigTid( ldhses, parattrref, &cid);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, output_node);
return GSX__NEXTPAR;
}
sts = gcg_parname_to_pgmname( ldhses, cid, s+1, parstring);
if ( EVEN(sts)) return sts;
*parprefix = GCG_PREFIX_REF;
*partype = GCG_OTYPE_AREF;
return GSX__SPECFOUND;
} }
case pwr_cClass_GetAp: {
/**********************************************************
* GETAP
***********************************************************/
/* Get the objdid stored in the parameter */ /* Get the objdid stored in the parameter */
sts = ldh_GetObjectPar( ldhses, sts = ldh_GetObjectPar(
ldhses,
output_node->ln.oid, output_node->ln.oid,
"DevBody", "DevBody",
"ApObject", pname,
(char **)&attrref, &size); (char **)&attrref, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -3525,7 +3480,6 @@ static int gcg_get_outputstring_spec( ...@@ -3525,7 +3480,6 @@ static int gcg_get_outputstring_spec(
free((char *) attrref); free((char *) attrref);
return GSX__NEXTPAR; return GSX__NEXTPAR;
} }
/* Get the attribute name of last segment */ /* Get the attribute name of last segment */
sts = ldh_AttrRefToName( ldhses, attrref, ldh_eName_ArefVol, sts = ldh_AttrRefToName( ldhses, attrref, ldh_eName_ArefVol,
&name_p, &size); &name_p, &size);
...@@ -3548,13 +3502,11 @@ static int gcg_get_outputstring_spec( ...@@ -3548,13 +3502,11 @@ static int gcg_get_outputstring_spec(
gcg_error_msg( gcgctx, GSX__REFOBJ, output_node); gcg_error_msg( gcgctx, GSX__REFOBJ, output_node);
return GSX__NEXTPAR; return GSX__NEXTPAR;
} }
sts = ldh_GetAttrRefOrigTid( ldhses, parattrref, &cid); sts = ldh_GetAttrRefOrigTid( ldhses, parattrref, &cid);
if ( EVEN(sts)) { if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, output_node); gcg_error_msg( gcgctx, GSX__REFOBJ, output_node);
return GSX__NEXTPAR; return GSX__NEXTPAR;
} }
sts = gcg_parname_to_pgmname( ldhses, cid, s+1, parstring); sts = gcg_parname_to_pgmname( ldhses, cid, s+1, parstring);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
...@@ -5057,16 +5009,16 @@ static pwr_tStatus gcg_read_volume_plclist( ...@@ -5057,16 +5009,16 @@ static pwr_tStatus gcg_read_volume_plclist(
pwr_tFileName fullfilename; pwr_tFileName fullfilename;
char type[20]; char type[20];
int line_count = 0; int line_count = 0;
char line[160]; char line[256];
char objid_str[20]; char objid_str[40];
char thread_str[20]; char thread_str[40];
float scantime; float scantime;
int executeorder; int executeorder;
int prio; int prio;
int sts; int sts;
gcg_t_plclist *plclist_pointer; gcg_t_plclist *plclist_pointer;
gcg_t_threadlist *threadlist_pointer; gcg_t_threadlist *threadlist_pointer;
char name[120]; pwr_tOName name;
sprintf( filenames, "%s%s", gcgmv_filenames[0], sprintf( filenames, "%s%s", gcgmv_filenames[0],
vldh_VolumeIdToStr( volid)); vldh_VolumeIdToStr( volid));
...@@ -11135,6 +11087,7 @@ int gcg_comp_m37( gcg_ctx gcgctx, vldh_t_node node) ...@@ -11135,6 +11087,7 @@ int gcg_comp_m37( gcg_ctx gcgctx, vldh_t_node node)
unsigned long point = 0; unsigned long point = 0;
char *wholeobject; char *wholeobject;
pwr_sAttrRef pararef; pwr_sAttrRef pararef;
pwr_tCid conn_cid;
ldhses = (node->hn.wind)->hw.ldhses; ldhses = (node->hn.wind)->hw.ldhses;
...@@ -11146,15 +11099,14 @@ int gcg_comp_m37( gcg_ctx gcgctx, vldh_t_node node) ...@@ -11146,15 +11099,14 @@ int gcg_comp_m37( gcg_ctx gcgctx, vldh_t_node node)
/* Get the connected object and parameter */ /* Get the connected object and parameter */
sts = gcg_get_connected_par_close( node, point, &conn_node, conn_obj, sts = gcg_get_connected_par_close( node, point, &conn_node, conn_obj,
conn_par); conn_par);
if ( sts == GSX__NOTCON) if ( sts == GSX__NOTCON) {
{
/* Point visible but not connected, errormessage */ /* Point visible but not connected, errormessage */
gcg_error_msg( gcgctx, GSX__NOTCON, node); gcg_error_msg( gcgctx, GSX__NOTCON, node);
strcpy( parname, ""); strcpy( parname, "");
} }
else if ((sts == GSX__NEXTPAR) || ( sts == GSX__SWINDERR) else if (sts == GSX__NEXTPAR ||
|| (sts == GSX__REFPAR)) sts == GSX__SWINDERR ||
{ sts == GSX__REFPAR) {
/* No backup on this parameter */ /* No backup on this parameter */
gcg_error_msg( gcgctx, GSX__NOBACKUP, node); gcg_error_msg( gcgctx, GSX__NOBACKUP, node);
strcpy( parname, ""); strcpy( parname, "");
...@@ -11164,15 +11116,58 @@ int gcg_comp_m37( gcg_ctx gcgctx, vldh_t_node node) ...@@ -11164,15 +11116,58 @@ int gcg_comp_m37( gcg_ctx gcgctx, vldh_t_node node)
gcg_error_msg( gcgctx, GSX__CONBACKUP, node); gcg_error_msg( gcgctx, GSX__CONBACKUP, node);
strcpy( parname, ""); strcpy( parname, "");
} }
else else {
{
strcpy( parname, conn_obj); strcpy( parname, conn_obj);
if ( !(*wholeobject)) if ( !(*wholeobject)) {
{
strcat( parname, "."); strcat( parname, ".");
strcat( parname, conn_par); strcat( parname, conn_par);
} }
} }
sts = ldh_GetObjectClass( ldhses, conn_node->ln.oid, &conn_cid);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, node);
return GSX__NEXTPAR;
}
switch( conn_cid) {
case pwr_cClass_GetIp: {
// Get the referenced object
pwr_tAttrRef *attrref;
pwr_tAttrRef aref;
char *name_p, *s;
sts = ldh_GetObjectPar( ldhses, conn_node->ln.oid,
"DevBody", "IpObject",
(char **)&attrref, &size);
if ( EVEN(sts)) return sts;
aref = *attrref;
free((char *) attrref);
sts = gcg_replace_ref( gcgctx, &aref, conn_node);
if ( EVEN(sts)) return sts;
sts = ldh_AttrRefToName( ldhses, &aref, ldh_eName_ArefVol,
&name_p, &size);
if ( EVEN(sts)) {
gcg_error_msg( gcgctx, GSX__REFOBJ, conn_node);
return GSX__NEXTPAR;
}
strcpy( parname, name_p);
if ( *wholeobject) {
if ( (s = strrchr( parname, '.')) == 0) {
gcg_error_msg( gcgctx, GSX__REFOBJ, conn_node);
return GSX__NEXTPAR;
}
*s = 0;
}
break;
}
default: ;
}
free((char *) wholeobject); free((char *) wholeobject);
sts = ldh_NameToAttrRef( ldhses, parname, &pararef); sts = ldh_NameToAttrRef( ldhses, parname, &pararef);
......
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