gnuplot_ctrl * gnuplot_init(void) { gnuplot_ctrl * handle ; #ifndef _WIN32 #ifndef __APPLE__ if (getenv("DISPLAY") == NULL) { fprintf(stderr, "cannot find DISPLAY variable: is it set?\n") ; } #endif #endif #ifndef _WIN32 if (gnuplot_get_program_path("gnuplot")==NULL) { fprintf(stderr, "cannot find gnuplot in your PATH"); return NULL ; } #endif if (gnuplot_get_program_path(GNUPLOT_EXEC)==NULL) { fprintf(stderr, "cannot find gnuplot in your PATH"); return NULL ; } /* * Structure initialization: */ handle = (gnuplot_ctrl*)malloc(sizeof(gnuplot_ctrl)) ; handle->nplots = 0 ; gnuplot_setstyle(handle, "points") ; gnuplot_setaxes(handle, "x1y1") ; handle->ntmp = 0 ; handle->gnucmd = popen(GNUPLOT_EXEC " -geometry \"640x480+0+0\"", "w") ; if (handle->gnucmd == NULL) { fprintf(stderr, "error starting gnuplot\n") ; free(handle) ; handle = NULL; return NULL ; } #ifdef _WIN32 gnuplot_setterm(handle,"windows"); #elif __APPLE__ // Try to determine whether we should use aqua or x11 as our default if (getenv("DISPLAY") == NULL || (getenv("USE_AQUA")!=NULL && strcmp(getenv("USE_AQUA"),"1")>=0)) gnuplot_setterm(handle,"aqua"); else gnuplot_setterm(handle,"x11"); #else gnuplot_setterm(handle,"x11"); #endif return handle; }
gnuplot_ctrl * gnuplot_init(void) { gnuplot_ctrl * handle ; if (getenv("DISPLAY") == NULL) { fprintf(stderr, "cannot find DISPLAY variable: is it set?\n") ; } if (gnuplot_get_program_path("gnuplot")==NULL) { fprintf(stderr, "cannot find gnuplot in your PATH"); return NULL ; } /* * Structure initialization: */ handle = (gnuplot_ctrl*)malloc(sizeof(gnuplot_ctrl)) ; handle->nplots = 0 ; gnuplot_setstyle(handle, "points") ; handle->ntmp = 0 ; handle->gnucmd = popen("gnuplot", "w") ; if (handle->gnucmd == NULL) { fprintf(stderr, "error starting gnuplot\n") ; free(handle) ; return NULL ; } return handle; }
gnuplot_ctrl * gnuplot_init ( void ) { gnuplot_ctrl * handle ; if (check_X_display(1)) return NULL ; if (gnuplot_get_program_path("gnuplot")==NULL) { fprintf(stderr, "cannot find gnuplot in your PATH"); return NULL ; } /* * Structure initialization: */ handle = malloc(sizeof(gnuplot_ctrl)) ; handle->nplots = 0 ; gnuplot_setstyle(handle, "points") ; handle->ntmp = 0 ; handle->gnucmd = popen("gnuplot", "w") ; if (handle->gnucmd == NULL) { fprintf(stderr, "error starting gnuplot\n") ; free(handle) ; return NULL ; } return handle; }