static void save_wisdom(void){ char *final_wisdom; final_wisdom = fftw_export_wisdom_to_string(); if (!initial_wisdom || strings_are_equal(initial_wisdom, final_wisdom) != TRUE) { FILE *wf; wf = gapp_openw(gapp, wisdom_file); if (wf) { fftw_export_wisdom_to_file(wf); gapp_close(wf); } } fftw_free(final_wisdom); if (initial_wisdom) { fftw_free(initial_wisdom); } }
/* * If writing to a file, check to see if it exists */ void do_hardcopy(const GProject *gp) { Quark *project = gproject_get_top(gp); GraceApp *gapp = gapp_from_quark(project); RunTime *rt; Canvas *canvas; char fname[GR_MAXPATHLEN]; view v; double vx, vy; int truncated_out, res; FILE *prstream; if (!gapp) { return; } rt = gapp->rt; canvas = grace_get_canvas(gapp->grace); if (get_ptofile(gapp)) { if (string_is_empty(rt->print_file)) { Device_entry *dev = get_device_props(canvas, rt->hdevice); sprintf(rt->print_file, "%s.%s", QIDSTR(project), dev->fext); } strcpy(fname, rt->print_file); prstream = gapp_openw(gapp, fname); } else { strcpy(fname, "gappXXXXXX"); prstream = gapp_tmpfile(fname); } if (prstream == NULL) { return; } canvas_set_prstream(canvas, prstream); select_device(canvas, rt->hdevice); res = gproject_render(gp); gapp_close(prstream); if (res != RETURN_SUCCESS) { return; } get_bbox(canvas, BBOX_TYPE_GLOB, &v); project_get_viewport(project, &vx, &vy); if (v.xv1 < 0.0 - VP_EPSILON || v.xv2 > vx + VP_EPSILON || v.yv1 < 0.0 - VP_EPSILON || v.yv2 > vy + VP_EPSILON) { truncated_out = TRUE; } else { truncated_out = FALSE; } if (get_ptofile(gapp) == FALSE) { if (truncated_out == FALSE || yesno("Printout is truncated. Continue?", NULL, NULL, NULL)) { gapp_print(gapp, fname); #ifndef PRINT_CMD_UNLINKS remove(fname); #endif } } else { if (truncated_out == TRUE) { errmsg("Output is truncated - tune device dimensions"); } } }