Commit b49f7ef3 authored by claes's avatar claes

Build methods for Application and PlcProcess added

parent 6ab5edc4
/*
* Proview $Id: wb_build.cpp,v 1.4 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_build.cpp,v 1.5 2007-01-30 07:13:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -58,6 +58,12 @@ void wb_build::classlist( pwr_tCid cid)
case pwr_cClass_WebHandler:
webhandler( o.oid());
break;
case pwr_cClass_Application:
application( o.oid());
break;
case pwr_cClass_PlcProcess:
application( o.oid());
break;
default:
m_sts = PWRB__NOBUILT;
}
......@@ -192,6 +198,16 @@ void wb_build::rootvolume( pwr_tVid vid)
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_Application);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_PlcProcess);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
}
// Create loadfiles
......@@ -386,6 +402,16 @@ void wb_build::nodehier( pwr_tOid oid)
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_Application);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
classlist( pwr_cClass_PlcProcess);
if ( evenSts()) return;
if ( sumsts == PWRB__NOBUILT && m_sts != PWRB__NOBUILT)
sumsts = m_sts;
m_sts = sumsts;
}
......@@ -612,6 +638,66 @@ void wb_build::webhandler( pwr_tOid oid)
}
}
void wb_build::application( pwr_tOid oid)
{
pwr_tString80 buildcmd;
pwr_tCmd cmd;
int check_hierarchy = cdh_ObjidIsNotNull( m_hierarchy);
int hierarchy_found = 0;
int sts;
wb_object o = m_session.object(oid);
if ( !o) {
m_sts = o.sts();
return;
}
// Check that no ancestor is a LibHier
for ( wb_object p = o.parent(); p.oddSts(); p = p.parent()) {
if ( p.cid() == pwr_eClass_LibHier) {
m_sts = PWRB__INLIBHIER;
return;
}
if ( check_hierarchy && cdh_ObjidIsEqual( m_hierarchy, p.oid()))
hierarchy_found = 1;
}
if ( check_hierarchy && !hierarchy_found) {
m_sts = PWRB__NOBUILT;
return;
}
wb_attribute a = m_session.attribute( oid, "DevBody", "BuildCmd");
if ( !a) {
m_sts = a.sts();
return;
}
a.value( &buildcmd);
if ( !a) {
m_sts = a.sts();
return;
}
if ( strcmp( buildcmd, "") == 0) {
m_sts = PWRB__NOBUILT;
return;
}
// Exectute the build command
dcli_translate_filename( cmd, buildcmd);
sts = system( cmd);
if ( sts != 0) {
char msg[300];
sprintf( msg, "Build Application error %s", o.longName().name(cdh_mName_path | cdh_mName_object));
MsgWindow::message( 'E', msg, msgw_ePop_Yes, oid);
m_sts = PWRB__SUCCESS;
}
else {
m_sts = PWRB__NOBUILT;
}
}
......
/*
* Proview $Id: wb_build.h,v 1.2 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_build.h,v 1.3 2007-01-30 07:13:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -44,6 +44,7 @@ class wb_build : public wb_status
void plcpgm( pwr_tOid oid);
void xttgraph( pwr_tOid oid);
void webhandler( pwr_tOid oid);
void application( pwr_tOid oid);
wb_build_opt opt;
wb_session m_session;
......
/*
* Proview $Id: wb_c_application.cpp,v 1.1 2007-01-30 07:13:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* wb_c_application.cpp -- work bench methods of the Application class. */
#include "wb_pwrs.h"
#include "pwr_baseclasses.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_pwrb_msg.h"
#include "wb_wsx.h"
#include "wb_wsx_msg.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "wb_wnav.h"
#include "wb_build.h"
#include "co_msgwindow.h"
#include "ge.h"
static pwr_tStatus Build (
ldh_sMenuCall *ip
)
{
wb_build build( *(wb_session *)ip->PointedSession, ip->wnav);
build.opt = ip->wnav->gbl.build;
build.application( ip->Pointed.Objid);
if ( build.sts() == PWRB__NOBUILT)
ip->wnav->message( 'I', "Nothing to build");
return build.sts();
}
pwr_dExport pwr_BindMethods(Application) = {
pwr_BindMethod(Build),
pwr_NullMethod
};
/*
* Proview $Id: wb_c_plcprocess.cpp,v 1.1 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_c_plcprocess.cpp,v 1.2 2007-01-30 07:13:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -20,8 +20,9 @@
/* wb_c_plcprocess.c -- work bench methods of the PlcProcess class. */
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_pwrb_msg.h"
#include "wb_ldh.h"
#include "wb_build.h"
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
......@@ -44,11 +45,26 @@ static pwr_tStatus PostCreate (
sizeof(scan_time));
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
return PWRB__SUCCESS;
}
static pwr_tStatus Build (
ldh_sMenuCall *ip
)
{
wb_build build( *(wb_session *)ip->PointedSession, ip->wnav);
build.opt = ip->wnav->gbl.build;
build.application( ip->Pointed.Objid);
if ( build.sts() == PWRB__NOBUILT)
ip->wnav->message( 'I', "Nothing to build");
return build.sts();
}
pwr_dExport pwr_BindMethods(PlcProcess) = {
pwr_BindMethod(PostCreate),
pwr_BindMethod(Build),
pwr_NullMethod
};
......
/*
* Proview $Id: wb_i_base_methods.cpp,v 1.1 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_i_base_methods.cpp,v 1.2 2007-01-30 07:13:02 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -56,6 +56,7 @@ pwr_dImport pwr_BindMethods(WebHandler);
pwr_dImport pwr_BindMethods(PlcProcess);
pwr_dImport pwr_BindMethods(PlcThread);
pwr_dImport pwr_BindMethods(NodeConfig);
pwr_dImport pwr_BindMethods(Application);
pwr_dExport pwr_BindClasses(Base) = {
pwr_BindClass(ASup),
......@@ -93,6 +94,7 @@ pwr_dExport pwr_BindClasses(Base) = {
pwr_BindClass(PlcProcess),
pwr_BindClass(PlcThread),
pwr_BindClass(NodeConfig),
pwr_BindClass(Application),
pwr_NullClass
};
......
......@@ -33,3 +33,4 @@ WebHandler
PlcProcess
PlcThread
NodeConfig
Application
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