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