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