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