www.pudn.com > apdb2ndb.rar > atn_conv_apdb_to_ndb.cc
//
//
//
//
#include "atn_inc.h"
// Ok msg
ATN_FDEF int atn_conv_apdb_to_ndb(atn_com &com)
{
int rcode =0;
int rc = 0;
//
// Initialize PortConvTable
//
try {
com.PortConvTable = new atnPortConvTable(com.num_port*2);
}
catch(...)
{
// No enough memory
com.afm->message("atn0800",
AIR_MSG_CHR,"file",__FILE__,
AIR_MSG_INT,"line",__LINE__,AIR_MSG_END);
}
// convert io_block io_component to ndb-module
rc = atn_conv_to_module(com);
if(rc != 0)
{
/* error message should be omitted */
atn_debug(__FILE__,__LINE__," module");
rcode = -1;
goto exit_func;
}
// convert io pin to ndb-eport
rc = atn_conv_to_eport(com);
if(rc != 0)
{
/* error message should be omitted */
atn_debug(__FILE__,__LINE__," conv_to_eport error rc(%d)\n",rc);
rcode = -1;
goto exit_func;
}
// conver apdb-component to ndb--
rc = atn_conv_to_comp(com);
if(rc != 0)
{
/* error message should be omitted */
atn_debug(__FILE__,__LINE__," conv_to_comp error rc(%d)\n",rc);
rcode = -1;
goto exit_func;
}
// cconvert apdb-block and create ndb-iport from apdb-pin
rc = atn_conv_to_inst(com);
if(rc != 0)
{
/* error message should be omitted */
atn_debug(__FILE__,__LINE__," inst");
rcode = -1;
goto exit_func;
}
// trace apdb connections ,
// convert apdb-net to ndb-net
rc = atn_conv_to_net(com);
if(rc != 0)
{
/* error message should be omitted */
atn_debug(__FILE__,__LINE__," net");
rcode = -1;
goto exit_func;
}
if(com.PortConvTable) delete com.PortConvTable;
exit_func:
return rcode;
}