Commit a792d6c2 authored by Claes Sjofors's avatar Claes Sjofors

DataCopy, DataReset bugfix, didn't work for attribute object references

parent 83ea0748
...@@ -12279,10 +12279,10 @@ int gcg_comp_m45( gcg_ctx gcgctx, vldh_t_node node) ...@@ -12279,10 +12279,10 @@ int gcg_comp_m45( gcg_ctx gcgctx, vldh_t_node node)
char output_prefix; char output_prefix;
char *name; char *name;
char *refstructname; char *refstructname;
pwr_tObjid refobjdid; pwr_tAttrRef refaref;
pwr_tObjid *refobjdid_ptr; pwr_tAttrRef *refaref_ptr;
ldh_tSesContext ldhses; ldh_tSesContext ldhses;
pwr_tClassId cid; pwr_tClassId cid, refcid;
int dataclass_found; int dataclass_found;
ldhses = (node->hn.wind)->hw.ldhses; ldhses = (node->hn.wind)->hw.ldhses;
...@@ -12332,13 +12332,17 @@ int gcg_comp_m45( gcg_ctx gcgctx, vldh_t_node node) ...@@ -12332,13 +12332,17 @@ int gcg_comp_m45( gcg_ctx gcgctx, vldh_t_node node)
output_node->ln.oid, output_node->ln.oid,
"DevBody", "DevBody",
"DataObject", "DataObject",
(char **)&refobjdid_ptr, &size); (char **)&refaref_ptr, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
refobjdid = *refobjdid_ptr; refaref = *refaref_ptr;
free((char *) refobjdid_ptr); free((char *) refaref_ptr);
sts = gcg_get_structname( gcgctx, refobjdid, &refstructname); sts = ldh_GetAttrRefOrigTid(gcgctx->wind->hw.ldhses, &refaref, &refcid);
if ( EVEN(sts)) return sts;
/* Get name for this class */
sts = gcg_get_structname_from_cid( gcgctx, refcid, &refstructname);
if ( EVEN(sts)) if ( EVEN(sts))
return GSX__NEXTNODE; return GSX__NEXTNODE;
...@@ -13181,12 +13185,16 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node) ...@@ -13181,12 +13185,16 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node)
int size; int size;
pwr_tObjid refobjdid; pwr_tObjid refobjdid;
pwr_tObjid *refobjdid_ptr; pwr_tObjid *refobjdid_ptr;
char *parameter; char *par;
unsigned long info_type; unsigned long info_type;
int found, i; int found, i;
ldh_tSesContext ldhses; ldh_tSesContext ldhses;
pwr_tClassId cid; pwr_tClassId cid;
int info_pointer_flag; int info_pointer_flag;
pwr_tString80 parameter;
char *s;
int pfound;
int idx;
ldhses = (node->hn.wind)->hw.ldhses; ldhses = (node->hn.wind)->hw.ldhses;
...@@ -13235,31 +13243,66 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node) ...@@ -13235,31 +13243,66 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node)
node->ln.oid, node->ln.oid,
"DevBody", "DevBody",
bodydef[1].ParName, bodydef[1].ParName,
(char **)&parameter, &size); (char **)&par, &size);
if ( EVEN(sts)) return sts; if ( EVEN(sts)) return sts;
strncpy( parameter, par, sizeof(parameter));
free((char *) par);
free((char *) bodydef); free((char *) bodydef);
/* Check that the parameter exists in the referenced object */ /* Check that the parameter exists in the referenced object */
pfound = 0;
if ( strncmp( parameter, "Data[", 5) == 0 && sscanf( &parameter[5], "%d", &idx) == 1) {
s = strrchr( parameter, ']');
if ( s && strcmp( s, "].DataP") == 0) {
pfound = 1;
info_pointer_flag = 1;
info_type = 0;
}
else if ( s && strcmp( s, "].Data_Objid") == 0) {
pfound = 1;
info_pointer_flag = 0;
info_type = pwr_eType_Objid;
}
if ( pfound) {
switch( cid) {
case pwr_cClass_NMpsCell60:
case pwr_cClass_NMpsStoreCell60:
if ( idx >= 60) {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE;
}
break;
case pwr_cClass_NMpsCell120:
case pwr_cClass_NMpsStoreCell120:
if ( idx >= 120) {
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE;
}
break;
default:
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE;
}
}
}
if ( !pfound) {
sts = ldh_GetObjectBodyDef( ldhses, cid, "RtBody", 1, sts = ldh_GetObjectBodyDef( ldhses, cid, "RtBody", 1,
&bodydef, &rows); &bodydef, &rows);
if ( EVEN(sts) ) if ( EVEN(sts) ) {
{
gcg_error_msg( gcgctx, GSX__REFCLASS, node); gcg_error_msg( gcgctx, GSX__REFCLASS, node);
return GSX__NEXTNODE; return GSX__NEXTNODE;
} }
for ( i = 0, found = 0; i < rows; i++) for ( i = 0, found = 0; i < rows; i++) {
{
/* ML 961009. Use ParName instead of PgmName */ /* ML 961009. Use ParName instead of PgmName */
if ( strcmp( bodydef[i].ParName, parameter) == 0) if ( strcmp( bodydef[i].ParName, parameter) == 0) {
{
found = 1; found = 1;
break; break;
} }
} }
if ( !found ) if ( !found ) {
{
free((char *) parameter);
gcg_error_msg( gcgctx, GSX__REFPAR, node); gcg_error_msg( gcgctx, GSX__REFPAR, node);
free((char *) bodydef); free((char *) bodydef);
return GSX__NEXTNODE; return GSX__NEXTNODE;
...@@ -13269,8 +13312,7 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node) ...@@ -13269,8 +13312,7 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node)
switch (bodydef[i].ParClass ) { switch (bodydef[i].ParClass ) {
case pwr_eClass_Input: case pwr_eClass_Input:
info_type = bodydef[i].Par->Input.Info.Type ; info_type = bodydef[i].Par->Input.Info.Type ;
if ( bodydef[i].Par->Input.Info.Flags & PWR_MASK_RTVIRTUAL ) if ( bodydef[i].Par->Input.Info.Flags & PWR_MASK_RTVIRTUAL ) {
{
/* Parameter is not defined in runtime */ /* Parameter is not defined in runtime */
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node); gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
free((char *) bodydef); free((char *) bodydef);
...@@ -13299,19 +13341,16 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node) ...@@ -13299,19 +13341,16 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node)
return GSX__NEXTNODE; return GSX__NEXTNODE;
} }
free((char *) bodydef ); free((char *) bodydef );
}
if (node->ln.cid == pwr_cClass_GetDap) if (node->ln.cid == pwr_cClass_GetDap) {
{ if ( !info_pointer_flag) {
if ( !info_pointer_flag)
{
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node); gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE; return GSX__NEXTNODE;
} }
} }
else if (node->ln.cid == pwr_cClass_GetObjidp) else if (node->ln.cid == pwr_cClass_GetObjidp) {
{ if (info_type != pwr_eType_Objid) {
if (info_type != pwr_eType_Objid)
{
gcg_error_msg( gcgctx, GSX__REFPARTYPE, node); gcg_error_msg( gcgctx, GSX__REFPARTYPE, node);
return GSX__NEXTNODE; return GSX__NEXTNODE;
} }
...@@ -13327,8 +13366,6 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node) ...@@ -13327,8 +13366,6 @@ int gcg_comp_m52( gcg_ctx gcgctx, vldh_t_node node)
vldh_IdToStr(0, refobjdid), vldh_IdToStr(0, refobjdid),
parameter); parameter);
free((char *) parameter);
/* Insert object in ref list */ /* Insert object in ref list */
gcg_ref_insert( gcgctx, refobjdid, GCG_PREFIX_REF); gcg_ref_insert( gcgctx, refobjdid, GCG_PREFIX_REF);
......
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