| 1 |
#ifndef lint
|
| 2 |
static const char RCSid[] = "$Id: scan.c,v 1.5 2004/01/02 12:45:36 schorsch Exp $";
|
| 3 |
#endif
|
| 4 |
/*
|
| 5 |
* writescan.c - fortran interface to picture output routines.
|
| 6 |
*
|
| 7 |
* 4/26/88
|
| 8 |
*/
|
| 9 |
|
| 10 |
#include <stdio.h>
|
| 11 |
#include <string.h>
|
| 12 |
|
| 13 |
|
| 14 |
static FILE *outfp; /* output file pointer */
|
| 15 |
static char outfile[128]; /* output file name */
|
| 16 |
|
| 17 |
|
| 18 |
void
|
| 19 |
initscan_( /* initialize output file */
|
| 20 |
char *fname,
|
| 21 |
int *width,
|
| 22 |
int *height
|
| 23 |
)
|
| 24 |
{
|
| 25 |
if (fname == NULL || fname[0] == '\0') {
|
| 26 |
outfp = stdout;
|
| 27 |
strcpy(outfile, "<stdout>");
|
| 28 |
} else {
|
| 29 |
if ((outfp = fopen(fname, "w")) == NULL) {
|
| 30 |
perror(fname);
|
| 31 |
exit(1);
|
| 32 |
}
|
| 33 |
strcpy(outfile, fname);
|
| 34 |
}
|
| 35 |
fprintf(outfp, "%dx%d picture\n\n-Y %d +X %d\n",
|
| 36 |
*width, *height, *height, *width);
|
| 37 |
}
|
| 38 |
|
| 39 |
|
| 40 |
void
|
| 41 |
writescan_( /* output scanline */
|
| 42 |
float *scan,
|
| 43 |
int *width
|
| 44 |
)
|
| 45 |
{
|
| 46 |
if (fwritescan(scan, *width, outfp) < 0) {
|
| 47 |
perror(outfile);
|
| 48 |
exit(1);
|
| 49 |
}
|
| 50 |
}
|
| 51 |
|
| 52 |
|
| 53 |
void
|
| 54 |
donescan_(void) /* clean up */
|
| 55 |
{
|
| 56 |
if (fclose(outfp) < 0) {
|
| 57 |
perror(outfile);
|
| 58 |
exit(1);
|
| 59 |
}
|
| 60 |
}
|