/*! * gplotMakeOutput() * * Input: gplot * Return: 0 if OK; 1 on error * * Notes: * (1) This uses gplot and the new arrays to add a plot * to the output, by writing a new data file and appending * the appropriate plot commands to the command file. * (2) This is the only function in this file that requires the * gnuplot executable, to actually generate the plot. * (3) The gnuplot program for windows is wgnuplot.exe. The * standard gp426win32 distribution does not have a X11 terminal. */ l_int32 gplotMakeOutput(GPLOT *gplot) { char buf[L_BUF_SIZE]; l_int32 ignore; PROCNAME("gplotMakeOutput"); if (!gplot) return ERROR_INT("gplot not defined", procName, 1); gplotGenCommandFile(gplot); gplotGenDataFiles(gplot); #ifndef _WIN32 if (gplot->outformat != GPLOT_X11) snprintf(buf, L_BUF_SIZE, "gnuplot %s", gplot->cmdname); else snprintf(buf, L_BUF_SIZE, "gnuplot -persist -geometry +10+10 %s &", gplot->cmdname); #else if (gplot->outformat != GPLOT_X11) snprintf(buf, L_BUF_SIZE, "wgnuplot %s", gplot->cmdname); else snprintf(buf, L_BUF_SIZE, "wgnuplot -persist %s", gplot->cmdname); #endif /* _WIN32 */ ignore = system(buf); /* gnuplot || wgnuplot */ return 0; }
/*! * \brief gplotMakeOutput() * * \param[in] gplot * \return 0 if OK; 1 on error * * <pre> * Notes: * (1) This uses gplot and the new arrays to add a plot * to the output, by writing a new data file and appending * the appropriate plot commands to the command file. * (2) This is the only function in this file that requires the * gnuplot executable, to actually generate the plot. * (3) The command file name for unix is canonical (i.e., directory /tmp) * but the temp filename paths in the command file must be correct. * (4) The gnuplot program for windows is wgnuplot.exe. * </pre> */ l_int32 gplotMakeOutput(GPLOT *gplot) { char buf[L_BUF_SIZE]; char *cmdname; l_int32 ignore; PROCNAME("gplotMakeOutput"); if (!gplot) return ERROR_INT("gplot not defined", procName, 1); gplotGenCommandFile(gplot); gplotGenDataFiles(gplot); cmdname = genPathname(gplot->cmdname, NULL); #ifndef _WIN32 snprintf(buf, L_BUF_SIZE, "gnuplot %s", cmdname); #else snprintf(buf, L_BUF_SIZE, "wgnuplot %s", cmdname); #endif /* _WIN32 */ ignore = system(buf); /* gnuplot || wgnuplot */ LEPT_FREE(cmdname); return 0; }