Commit b60a1058 authored by Claes Sjofors's avatar Claes Sjofors

Report, generate image from graph and insert in report

parent b5f20142
......@@ -272,11 +272,14 @@ int CnvPdfObj::print_image()
#endif
char c;
if ( strchr( text, '/') != 0)
dcli_translate_filename( fname, text);
else {
// Try $pwr_doc/help/
strcpy( fname, "$pwr_doc/help/");
strcat( fname, text);
dcli_translate_filename( fname, fname);
}
sts = cnv_get_image( fname, &image, &pixmap);
if ( EVEN(sts)) {
// Try $pwr_exe
......@@ -912,11 +915,14 @@ int CnvToPdf::print_image( const char *filename)
im_cnt++;
x = pdf_cLeftMargin;
if ( strchr( filename, '/') != 0)
dcli_translate_filename( fname, filename);
else {
// Try $pwr_doc/help/
strcpy( fname, "$pwr_doc/help/");
strcat( fname, filename);
dcli_translate_filename( fname, fname);
}
sts = cnv_get_image( fname, &image, &pixmap);
if ( EVEN(sts)) {
// Try $pwr_exe
......
......@@ -271,10 +271,15 @@ void rt_report::create_report( pwr_sClass_Report *o)
fout << "<topic> index <style> report" << endl;
while ( fin.getline( line, sizeof(line))) {
if ( cdh_NoCaseStrncmp( line, "<execute>", 9) == 0) {
parse( &line[9]);
}
else {
replace_value( newline, sizeof(newline), line);
fout << newline << endl;
}
}
fout << "</topic>" << endl;
......@@ -559,7 +564,7 @@ int rt_report::replace_value( char *out, unsigned int size,
char *in)
{
char str[500] = "";
char str2[500];
char str2[500] = "";
char valstr[500];
char *s1, *s2, *t;
unsigned long len;
......@@ -875,6 +880,47 @@ void rt_report::format_cmd( char *cmd, int cmd_size,
}
}
int rt_report::parse( char *line)
{
char line_array[5][80];
int num;
num = dcli_parse( line, " ", "",
(char *) line_array, sizeof( line_array)/sizeof( line_array[0]),
sizeof( line_array[0]), 0);
if ( num > 0 && cdh_NoCaseStrcmp( line_array[0], "print") == 0) {
if ( num > 1 && cdh_NoCaseStrcmp( line_array[1], "graph") == 0) {
ofstream fout;
pwr_tFileName fname;
pwr_tFileName tmpfile = "$pwrp_tmp/report_print.rtt_com";
pwr_tCmd cmd;
if ( num < 4)
return 0;
dcli_translate_filename( fname, tmpfile);
fout.open( fname);
if ( !fout)
return 0;
fout << "open graph /hide " << line_array[2] << endl;
fout << "export graph /graph=" << line_array[2] << " /file=\"" << line_array[3] << "\"" << endl;
sprintf( cmd, "rt_xtt_cmd -i -q @%s", fname);
system( cmd);
sprintf( cmd, "rm %s", fname);
system( cmd);
}
else
return 0;
}
else
return 0;
return 1;
}
int main()
{
pwr_tStatus sts;
......
......@@ -80,6 +80,7 @@ class rt_report {
const char *reportfile, const char *date);
void periodic_scan();
int periodic_check( pwr_sClass_Report *o);
int parse( char *line);
double scan_time;
pwr_sClass_ReportConfig *conf;
......
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