Commit 384a0080 authored by Claes Sjofors's avatar Claes Sjofors

Plc editor, check that references are not in LibHier added

parent 7ceb1a30
......@@ -128,6 +128,7 @@ disabled <Object is disabled> /error
maxsize <MaxSize is larger than cell size> /error
noseqreset <No SequenceReset object found in main object> /error
compmethod <Invalid compile method> /error
libref <Invalid reference to library hierarchy> /error
.facility FOE,280 /prefix = FOE__ ! Function object editor
......
......@@ -552,61 +552,26 @@ static int gcg_sort_threadlist(
unsigned long size
);
static int gcg_check_ra_plc_user(
char *filename
);
static pwr_tStatus gcg_read_volume_plclist(
gcg_ctx gcgctx,
pwr_tVolumeId volid,
unsigned long *plc_count,
gcg_t_plclist **plclist,
static int gcg_check_ra_plc_user( char *filename);
static pwr_tStatus gcg_read_volume_plclist( gcg_ctx gcgctx, pwr_tVolumeId volid,
unsigned long *plc_count, gcg_t_plclist **plclist,
unsigned long *thread_count,
gcg_t_threadlist **threadlist
);
static int gcg_parname_to_pgmname(
ldh_tSesContext ldhses,
pwr_tClassId cid,
char *parname,
char *pgmname
);
static pwr_tStatus gcg_replace_ref(
gcg_ctx gcgctx,
pwr_sAttrRef *attrref,
vldh_t_node output_node
);
static int gcg_set_cmanager(
vldh_t_wind wind);
static int gcg_cmanager_find_nodes(
vldh_t_wind wind,
vldh_t_node mgr,
vldh_t_node *nodelist,
int node_count);
static int gcg_cmanager_comp(
gcg_ctx gcgctx,
vldh_t_node node);
static int gcg_reset_cmanager(
gcg_ctx gcgctx);
static int gcg_check_attrref(
gcg_ctx gcgctx,
vldh_t_node node,
const char *attr);
static int gcg_is_in_focode(
gcg_ctx gcgctx,
vldh_t_node node);
gcg_t_threadlist **threadlist);
static int gcg_parname_to_pgmname( ldh_tSesContext ldhses, pwr_tClassId cid,
char *parname, char *pgmname);
static pwr_tStatus gcg_replace_ref( gcg_ctx gcgctx, pwr_sAttrRef *attrref,
vldh_t_node output_node);
static int gcg_set_cmanager( vldh_t_wind wind);
static int gcg_cmanager_find_nodes( vldh_t_wind wind, vldh_t_node mgr,
vldh_t_node *nodelist, int node_count);
static int gcg_cmanager_comp( gcg_ctx gcgctx, vldh_t_node node);
static int gcg_reset_cmanager( gcg_ctx gcgctx);
static int gcg_check_attrref( gcg_ctx gcgctx, vldh_t_node node, const char *attr);
static int gcg_is_in_focode( gcg_ctx gcgctx, vldh_t_node node);
static void gcg_pending_compile_add( gcg_ctx gcgctx, pwr_tOid wind);
static int gcg_pending_compile_exec( gcg_ctx gcgctx);
static int gcg_check_grafcet_reset( gcg_ctx gcgctx, vldh_t_node node);
static int gcg_in_libhier( gcg_ctx gcgctx, pwr_tOid oid);
......@@ -3375,6 +3340,13 @@ int gcg_get_outputstring (
free((char *) objdid);
return GSX__NEXTPAR;
}
/* Check that the object is not in a library hierarchy */
if ( gcg_in_libhier( gcgctx, *objdid)) {
gcg_error_msg( gcgctx, GSX__LIBREF, output_node);
free((char *) objdid);
return GSX__NEXTPAR;
}
strcpy( parstring,
(output_bodydef->Par)->Param.Info.PgmName);
if ( output_bodydef->Par->Output.Info.Flags & PWR_MASK_ARRAY)
......@@ -3408,6 +3380,13 @@ int gcg_get_outputstring (
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Check that object is not in a library hierarchy */
if ( gcg_in_libhier( gcgctx, attrref->Objid)) {
gcg_error_msg( gcgctx, GSX__LIBREF, output_node);
free((char *) attrref);
return GSX__NEXTPAR;
}
strcpy( parstring,
(output_bodydef->Par)->Param.Info.PgmName);
if ( output_bodydef->Par->Output.Info.Flags & PWR_MASK_ARRAY)
......@@ -3531,6 +3510,13 @@ static int gcg_get_outputstring_spec(
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Check that the object is not in a library hierarchy */
if ( gcg_in_libhier( gcgctx, attrref->Objid)) {
gcg_error_msg( gcgctx, GSX__LIBREF, output_node);
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Get the attribute name of last segment */
sts = ldh_AttrRefToName( ldhses, attrref, ldh_eName_ArefVol,
&name_p, &size);
......@@ -3586,6 +3572,12 @@ static int gcg_get_outputstring_spec(
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Check that the object is not in a library hierarchy */
if ( gcg_in_libhier( gcgctx, attrref->Objid)) {
gcg_error_msg( gcgctx, GSX__LIBREF, output_node);
free((char *) attrref);
return GSX__NEXTPAR;
}
strcpy( parstring,
(output_bodydef->Par)->Param.Info.PgmName);
......@@ -3631,6 +3623,12 @@ static int gcg_get_outputstring_spec(
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Check that the object is not in a library hierarchy */
if ( gcg_in_libhier( gcgctx, attrref->Objid)) {
gcg_error_msg( gcgctx, GSX__LIBREF, output_node);
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Get the attribute name of last segment */
sts = ldh_AttrRefToName( ldhses, attrref, ldh_eName_ArefVol,
......@@ -3728,6 +3726,12 @@ static int gcg_get_outputstring_spec(
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Check that the object is not in a library hierarchy */
if ( gcg_in_libhier( gcgctx, attrref->Objid)) {
gcg_error_msg( gcgctx, GSX__LIBREF, output_node);
free((char *) attrref);
return GSX__NEXTPAR;
}
/* Check if DisableAttr is present */
sts = ldh_GetAttrRefInfo( ldhses, attrref, &info);
......@@ -16256,3 +16260,21 @@ static int gcg_check_grafcet_reset( gcg_ctx gcgctx, vldh_t_node node)
}
return GSX__SUCCESS;
}
static int gcg_in_libhier( gcg_ctx gcgctx, pwr_tOid oid)
{
pwr_tStatus sts;
pwr_tOid parent;
pwr_tCid cid;
for ( sts = ldh_GetParent( gcgctx->ldhses, oid, &parent);
ODD(sts);
sts = ldh_GetParent( gcgctx->ldhses, parent, &parent)) {
sts = ldh_GetObjectClass( gcgctx->ldhses, parent, &cid);
if ( EVEN(sts)) return 0;
if ( cid == pwr_cClass_LibHier)
return 1;
}
return 0;
}
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