Commit dfb46882 authored by Claes Sjofors's avatar Claes Sjofors

Plc compile, problem with compile of component subwndows fixed

parent 730c04e2
......@@ -583,6 +583,10 @@ 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);
/*_Methods defined for this module_______________________________________*/
......@@ -2255,7 +2259,8 @@ int gcg_wind_comp_all(
pwr_tObjid window,
unsigned long codetype,
int modified,
int debug
int debug,
int skip_plc
)
{
pwr_tObjid *windlist;
......@@ -2481,7 +2486,7 @@ int gcg_wind_comp_all(
/* End of FIX */
if ( wind_compiled) {
if ( wind_compiled && !skip_plc) {
sts = gcg_plc_compile( plc, codetype, &errorcount, &warningcount, 1,
debug);
if ( sts == GSX__PLCPGM_ERRORS) {
......@@ -2851,6 +2856,8 @@ static void gcg_ctx_delete(
free((char *) gcgctx->iowrite);
if (gcgctx->refcount > 0)
free((char *) gcgctx->ref);
if (gcgctx->arefcount > 0)
free((char *) gcgctx->aref);
free((char *) gcgctx);
}
......@@ -6155,45 +6162,31 @@ int gcg_comp_m1( vldh_t_wind wind,
}
}
/* Delete the context for the window */
gcg_ctx_delete( gcgctx);
/* Generate code for the plc module */
/* sts = gcg_comp_m[0]( wind->hw.plc, codetype, 0, 0, 0);
if ( EVEN(sts)) return sts;
*/
/* Generate code for the rtnode */
/* sts = gcg_comp_rtnode( wind->hw.ldhses, 0,
wind->hw.plc, codetype, &node_errorcount,
&node_warningcount);
if ( EVEN(sts)) return sts;
(*errorcount) += node_errorcount;
(*warningcount) += node_warningcount;
*/
if ( *errorcount > 0 )
{
if ( codetype)
{
if ( *errorcount > 0 ) {
if ( codetype) {
/* Revert the session */
sts = ldh_RevertSession( wind->hw.ldhses);
if ( EVEN(sts)) return sts;
/* Return to previous session access */
if ( session_access != ldh_eAccess_ReadWrite)
{
if ( session_access != ldh_eAccess_ReadWrite) {
/* Set access read write to be able to compile */
sts = ldh_SetSession( ldhses, session_access);
if ( EVEN(sts)) return sts;
}
}
gcg_pending_compile_exec( gcgctx);
gcg_ctx_delete( gcgctx);
return GSX__PLCWIND_ERRORS;
}
else
{
if ( codetype)
{
else {
if ( codetype) {
pwr_tTime time;
/* Store compile time for the window */
......@@ -6206,12 +6199,15 @@ int gcg_comp_m1( vldh_t_wind wind,
if ( EVEN(sts)) return sts;
/* Return to previous session access */
if ( session_access != ldh_eAccess_ReadWrite)
{
if ( session_access != ldh_eAccess_ReadWrite) {
sts = ldh_SetSession( ldhses, session_access);
if ( EVEN(sts)) return sts;
}
}
gcg_pending_compile_exec( gcgctx);
gcg_ctx_delete( gcgctx);
return GSX__SUCCESS;
}
......@@ -13555,7 +13551,7 @@ int gcg_comp_m53( gcg_ctx gcgctx, vldh_t_node node)
/* Compile the subwindow... */
ldhwb = ldh_SessionToWB( ldhses);
sts = gcg_wind_comp_all( ldhwb, ldhses, window_objid,
gcgctx->print, 0, gcg_debug);
gcgctx->print, 0, gcg_debug, 0);
node->hn.subwindowobject[0] = 0;
}
......@@ -14277,7 +14273,6 @@ int gcg_comp_m58( gcg_ctx gcgctx, vldh_t_node node)
pwr_tObjid window_objid;
pwr_tObjid plcpgm_objid;
pwr_sAttrRef attrref[2];
ldh_tWBContext ldhwb;
pwr_sPlcWindow *windbuffer;
pwr_sPlcNode *nodebuffer;
unsigned long point;
......@@ -14471,10 +14466,12 @@ int gcg_comp_m58( gcg_ctx gcgctx, vldh_t_node node)
// sts = ldh_SaveSession( ldhses);
// if ( EVEN(sts)) return sts;
gcg_pending_compile_add( gcgctx, window_objid);
/* Compile the subwindow... */
ldhwb = ldh_SessionToWB( ldhses);
sts = gcg_wind_comp_all( ldhwb, ldhses, window_objid,
gcgctx->print, 0, gcg_debug);
// ldhwb = ldh_SessionToWB( ldhses);
// sts = gcg_wind_comp_all( ldhwb, ldhses, window_objid,
// gcgctx->print, 0, gcg_debug);
node->hn.subwindowobject[0] = 0;
}
else {
......@@ -14499,9 +14496,11 @@ int gcg_comp_m58( gcg_ctx gcgctx, vldh_t_node node)
sts = stat( fname, &info);
if ( sts != -1 && info.st_ctime > compile_time->tv_sec) {
/* Compile the subwindow... */
ldhwb = ldh_SessionToWB( ldhses);
sts = gcg_wind_comp_all( ldhwb, ldhses, window_objid,
gcgctx->print, 0, gcg_debug);
gcg_pending_compile_add( gcgctx, window_objid);
// ldhwb = ldh_SessionToWB( ldhses);
// sts = gcg_wind_comp_all( ldhwb, ldhses, window_objid,
// gcgctx->print, 0, gcg_debug);
}
free( (char *)compile_time);
......@@ -16142,3 +16141,27 @@ static int gcg_is_in_focode( gcg_ctx gcgctx, vldh_t_node node)
return 0;
}
static void gcg_pending_compile_add( gcg_ctx gcgctx, pwr_tOid wind)
{
for ( unsigned int i = 0; i < gcgctx->pending_compile.size(); i++) {
if ( cdh_ObjidIsEqual( wind, gcgctx->pending_compile[i]))
return;
}
gcgctx->pending_compile.push_back( wind);
}
static int gcg_pending_compile_exec( gcg_ctx gcgctx)
{
pwr_tStatus sts;
ldh_tSesContext ldhses = gcgctx->ldhses;
ldh_tWBContext ldhwb = ldh_SessionToWB( ldhses);
for ( unsigned int i = 0; i < gcgctx->pending_compile.size(); i++) {
sts = gcg_wind_comp_all( ldhwb, ldhses, gcgctx->pending_compile[i],
gcgctx->print, 0, gcg_debug, 1);
if ( EVEN(sts)) return sts;
}
return GSX__SUCCESS;
}
......@@ -29,6 +29,7 @@
#endif
#include <stdio.h>
#include <vector>
#include "wb_vldh.h"
......@@ -144,7 +145,7 @@ typedef struct {
gcg_t_areflist *aref;
unsigned long arefcount;
unsigned long compobjcount;
pwr_sAttrRef reset_object;
pwr_sAttrRef reset_object;
unsigned long reset_checked;
unsigned long errorcount;
unsigned long warningcount;
......@@ -155,6 +156,7 @@ typedef struct {
ldh_tSesContext ldhses;
vldh_t_node current_cmanager;
int cmanager_active;
vector<pwr_tOid> pending_compile;
} gcg_t_ctx, *gcg_ctx;
......@@ -299,7 +301,8 @@ int gcg_wind_comp_all(
pwr_tObjid window,
unsigned long codetype,
int modified,
int debug
int debug,
int skip_plc
);
int gcg_comp_volume(
......
......@@ -6777,7 +6777,7 @@ int utl_compile (
if ( EVEN(sts)) return sts;
/* Compile the windows */
sts = gcg_wind_comp_all( ldhwb, l_ldhses, window, 1, modified, debug);
sts = gcg_wind_comp_all( ldhwb, l_ldhses, window, 1, modified, debug, 0);
if ( other_volume_attached)
{
ldh_CloseSession( l_ldhses);
......@@ -6831,7 +6831,7 @@ int utl_compile (
}
/* Compile the windows */
sts = gcg_wind_comp_all( ldhwb, ldhses, window, 1, modified, debug);
sts = gcg_wind_comp_all( ldhwb, ldhses, window, 1, modified, debug, 0);
if ( EVEN(sts))
{
status = sts;
......@@ -6868,7 +6868,7 @@ int utl_compile (
free((char *) windbuffer);
/* Compile the windows */
sts = gcg_wind_comp_all( ldhwb, ldhses, window, 1, modified, debug);
sts = gcg_wind_comp_all( ldhwb, ldhses, window, 1, modified, debug, 0);
if ( EVEN(sts))
{
status = sts;
......
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