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