ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/scan.c
Revision: 1.5
Committed: Fri Jan 2 12:45:36 2004 UTC (20 years, 4 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R6P1, rad3R6
Changes since 1.4: +15 -10 lines
Log Message:
Ansification.

File Contents

# User Rev Content
1 greg 1.1 #ifndef lint
2 schorsch 1.5 static const char RCSid[] = "$Id: scan.c,v 1.4 2003/02/22 02:07:28 greg Exp $";
3 greg 1.1 #endif
4 greg 1.2 /*
5 greg 1.1 * writescan.c - fortran interface to picture output routines.
6     *
7     * 4/26/88
8     */
9    
10     #include <stdio.h>
11 schorsch 1.5 #include <string.h>
12 greg 1.1
13    
14     static FILE *outfp; /* output file pointer */
15     static char outfile[128]; /* output file name */
16    
17    
18 schorsch 1.5 void
19     initscan_( /* initialize output file */
20     char *fname,
21     int *width,
22     int *height
23     )
24 greg 1.1 {
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 schorsch 1.5 void
41     writescan_( /* output scanline */
42     float *scan,
43     int *width
44     )
45 greg 1.1 {
46     if (fwritescan(scan, *width, outfp) < 0) {
47     perror(outfile);
48     exit(1);
49     }
50     }
51    
52    
53 schorsch 1.5 void
54     donescan_(void) /* clean up */
55 greg 1.1 {
56     if (fclose(outfp) < 0) {
57     perror(outfile);
58     exit(1);
59     }
60     }