MCPcopy Create free account
hub / github.com/creatale/node-dv / gplotWrite

Function gplotWrite

deps/leptonica/src/gplot.c:911–952  ·  view source on GitHub ↗

! * \brief gplotWrite() * * \param[in] filename * \param[in] gplot * \return 0 if OK; 1 on error */

Source from the content-addressed store, hash-verified

909 * \return 0 if OK; 1 on error
910 */
911l_int32
912gplotWrite(const char *filename,
913 GPLOT *gplot)
914{
915FILE *fp;
916
917 PROCNAME("gplotWrite");
918
919 if (!filename)
920 return ERROR_INT("filename not defined", procName, 1);
921 if (!gplot)
922 return ERROR_INT("gplot not defined", procName, 1);
923
924 if ((fp = fopenWriteStream(filename, "wb")) == NULL)
925 return ERROR_INT("stream not opened", procName, 1);
926
927 fprintf(fp, "Gplot Version %d\n", GPLOT_VERSION_NUMBER);
928 fprintf(fp, "Rootname: %s\n", gplot->rootname);
929 fprintf(fp, "Output format: %d\n", gplot->outformat);
930 fprintf(fp, "Title: %s\n", gplot->title);
931 fprintf(fp, "X axis label: %s\n", gplot->xlabel);
932 fprintf(fp, "Y axis label: %s\n", gplot->ylabel);
933
934 fprintf(fp, "Commandfile name: %s\n", gplot->cmdname);
935 fprintf(fp, "\nCommandfile data:");
936 sarrayWriteStream(fp, gplot->cmddata);
937 fprintf(fp, "\nDatafile names:");
938 sarrayWriteStream(fp, gplot->datanames);
939 fprintf(fp, "\nPlot data:");
940 sarrayWriteStream(fp, gplot->plotdata);
941 fprintf(fp, "\nPlot titles:");
942 sarrayWriteStream(fp, gplot->plottitles);
943 fprintf(fp, "\nPlot styles:");
944 numaWriteStream(fp, gplot->plotstyles);
945
946 fprintf(fp, "Number of plots: %d\n", gplot->nplots);
947 fprintf(fp, "Output file name: %s\n", gplot->outname);
948 fprintf(fp, "Axis scaling: %d\n", gplot->scaling);
949
950 fclose(fp);
951 return 0;
952}

Callers

nothing calls this directly

Calls 3

fopenWriteStreamFunction · 0.85
sarrayWriteStreamFunction · 0.85
numaWriteStreamFunction · 0.85

Tested by

no test coverage detected