Commit 988e4ad8 authored by claes's avatar claes

Wb build WebGraph modified for read of pwg files

parent 03583387
...@@ -812,6 +812,7 @@ void wb_build::xttgraph( pwr_tOid oid) ...@@ -812,6 +812,7 @@ void wb_build::xttgraph( pwr_tOid oid)
void wb_build::webgraph( pwr_tOid oid) void wb_build::webgraph( pwr_tOid oid)
{ {
pwr_tFileName dest_fname; pwr_tFileName dest_fname;
pwr_tFileName src_fname;
pwr_tCmd cmd; pwr_tCmd cmd;
pwr_tString80 java_name; pwr_tString80 java_name;
pwr_tString80 name; pwr_tString80 name;
...@@ -828,6 +829,7 @@ void wb_build::webgraph( pwr_tOid oid) ...@@ -828,6 +829,7 @@ void wb_build::webgraph( pwr_tOid oid)
char dev[80], type[80]; char dev[80], type[80];
int version; int version;
pwr_tString80 appletsignature = ""; pwr_tString80 appletsignature = "";
char *s;
wb_object o = m_session.object(oid); wb_object o = m_session.object(oid);
if ( !o) { if ( !o) {
...@@ -862,102 +864,148 @@ void wb_build::webgraph( pwr_tOid oid) ...@@ -862,102 +864,148 @@ void wb_build::webgraph( pwr_tOid oid)
return; return;
} }
cdh_ToLower( java_name, java_name); if ( isupper(java_name[0])) {
java_name[0] = toupper(java_name[0]); cdh_ToLower( java_name, java_name);
java_name[0] = toupper(java_name[0]);
// Get the .pwg file for this javaname // Get the .pwg file for this javaname
strcpy( graph_name, cdh_Low(java_name)); strcpy( graph_name, cdh_Low(java_name));
sprintf( name, "$pwrp_pop/%s.pwg", graph_name); sprintf( name, "$pwrp_pop/%s.pwg", graph_name);
dcli_translate_filename( name, name); dcli_translate_filename( name, name);
m_sts = dcli_file_time( name, &src_time); m_sts = dcli_file_time( name, &src_time);
if ( evenSts()) { if ( evenSts()) {
// Search in all pwg files // Search in all pwg files
found = 0; found = 0;
strcpy( file_spec, "$pwrp_pop/*.pwg"); strcpy( file_spec, "$pwrp_pop/*.pwg");
for ( fsts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_INIT); for ( fsts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_INIT);
ODD(fsts); ODD(fsts);
fsts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_NEXT)) { fsts = dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_NEXT)) {
fsts = grow_IsJava( found_file, &is_frame, &is_applet, jname); fsts = grow_IsJava( found_file, &is_frame, &is_applet, jname);
if ( EVEN(fsts)) continue; if ( EVEN(fsts)) continue;
if ( is_frame && strcmp( jname, java_name) == 0) { if ( is_frame && strcmp( jname, java_name) == 0) {
dcli_parse_filename( found_file, dev, dir, graph_name, type, &version); dcli_parse_filename( found_file, dev, dir, graph_name, type, &version);
strcpy( name, found_file); strcpy( name, found_file);
found = 1; found = 1;
break; break;
} }
} }
dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_END); dcli_search_file( file_spec, found_file, DCLI_DIR_SEARCH_END);
if ( !found) { if ( !found) {
char msg[200]; char msg[200];
sprintf( msg, "Graph for %s not found", java_name); sprintf( msg, "Graph for %s not found", java_name);
MsgWindow::message('E', msg, msgw_ePop_Yes, oid); MsgWindow::message('E', msg, msgw_ePop_Yes, oid);
m_sts = PWRB__NOBUILT; m_sts = PWRB__NOBUILT;
return; return;
}
} }
}
m_sts = dcli_file_time( name, &src_time); m_sts = dcli_file_time( name, &src_time);
if ( evenSts()) return; if ( evenSts()) return;
// Check exported java frame // Check exported java frame
jexport = 0; jexport = 0;
sprintf( dest_fname, "$pwrp_pop/%s.java", java_name); sprintf( dest_fname, "$pwrp_pop/%s.java", java_name);
dcli_translate_filename( dest_fname, dest_fname); dcli_translate_filename( dest_fname, dest_fname);
fsts = dcli_file_time( dest_fname, &dest_time); fsts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || EVEN(fsts) || time_Acomp( &src_time, &dest_time) == 1) if ( opt.force || EVEN(fsts) || time_Acomp( &src_time, &dest_time) == 1)
jexport = 1; jexport = 1;
if ( jexport) { if ( jexport) {
if ( !m_wnav) { if ( !m_wnav) {
sprintf( cmd, "Build: WebGraph Unable to export java in this environment %s", java_name); sprintf( cmd, "Build: WebGraph Unable to export java in this environment %s", java_name);
MsgWindow::message('W', cmd, msgw_ePop_No, oid); MsgWindow::message('W', cmd, msgw_ePop_No, oid);
} }
else { else {
// Get signature from WebHandler // Get signature from WebHandler
for ( wb_object p = o.parent(); p.oddSts(); p = p.parent()) { for ( wb_object p = o.parent(); p.oddSts(); p = p.parent()) {
if ( p.cid() == pwr_cClass_WebHandler) { if ( p.cid() == pwr_cClass_WebHandler) {
wb_attribute a = m_session.attribute( p.oid(), "RtBody", "AppletSignature"); wb_attribute a = m_session.attribute( p.oid(), "RtBody", "AppletSignature");
if ( !a) { if ( !a) {
m_sts = a.sts(); m_sts = a.sts();
return; return;
}
a.value( appletsignature);
if ( !a) {
m_sts = a.sts();
return;
}
dcli_trim( appletsignature, appletsignature);
break;
} }
}
a.value( appletsignature); Ge *gectx = m_wnav->ge_new( graph_name, 1);
if ( !a) { if ( strcmp( appletsignature, "") == 0)
m_sts = a.sts(); strcpy( cmd, "export java");
return; else
} sprintf( cmd, "export java /signature=\"%s\"", appletsignature);
dcli_trim( appletsignature, appletsignature); m_sts = gectx->command( cmd);
break; if ( evenSts()) {
msg_GetMsg( m_sts, cmd, sizeof(cmd));
MsgWindow::message('E', cmd, msgw_ePop_Yes, oid);
m_sts = PWRB__NOBUILT;
delete gectx;
return;
} }
delete gectx;
sprintf( cmd, "Build: WebGraph Export java %s", java_name);
MsgWindow::message('I', cmd, msgw_ePop_No, oid);
m_sts = PWRB__SUCCESS;
} }
}
}
else {
// Copy from $pwrp_pop to $pwrp_web
strcpy( graph_name, cdh_Low(java_name));
Ge *gectx = m_wnav->ge_new( graph_name, 1); cdh_ToLower( graph_name, graph_name);
if ( strcmp( appletsignature, "") == 0)
strcpy( cmd, "export java"); strcpy( src_fname, "$pwrp_pop/");
else strcat( src_fname, graph_name);
sprintf( cmd, "export java /signature=\"%s\"", appletsignature);
m_sts = gectx->command( cmd);
if ( evenSts()) {
msg_GetMsg( m_sts, cmd, sizeof(cmd));
MsgWindow::message('E', cmd, msgw_ePop_Yes, oid);
m_sts = PWRB__NOBUILT;
delete gectx;
return;
}
delete gectx;
sprintf( cmd, "Build: WebGraph Export java %s", java_name); if ( strstr( src_fname, ".pwg") == 0)
MsgWindow::message('I', cmd, msgw_ePop_No, oid); strcat( src_fname, ".pwg");
dcli_translate_filename( src_fname, src_fname);
m_sts = dcli_file_time( src_fname, &src_time);
if ( evenSts()) {
m_sts = PWRB__NOBUILT;
return;
}
strcpy( dest_fname, "$pwrp_web/");
strcat( dest_fname, graph_name);
if ( strstr( dest_fname, ".pwg") == 0)
strcat( dest_fname, ".pwg");
dcli_translate_filename( dest_fname, dest_fname);
m_sts = dcli_file_time( dest_fname, &dest_time);
if ( opt.force || evenSts() || src_time.tv_sec > dest_time.tv_sec) {
sprintf( cmd, "cp %s %s", src_fname, dest_fname);
system( cmd);
sprintf( cmd, "Build: WebGraph copy $pwrp_pop/%s -> $pwrp_web", graph_name);
MsgWindow::message( 'I', cmd, msgw_ePop_No, oid);
strcpy( name, graph_name);
if (( s = strrchr( name, '.')))
*s = 0;
wb_log::log( wlog_eCategory_GeBuild, name, 0);
m_sts = PWRB__SUCCESS; m_sts = PWRB__SUCCESS;
} }
else
m_sts = PWRB__NOBUILT;
} }
} }
......
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