ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/lampcolor.c
(Generate patch)

Comparing ray/src/cv/lampcolor.c (file contents):
Revision 2.8 by greg, Sat Jun 21 15:05:01 2003 UTC vs.
Revision 2.11 by greg, Sat Dec 28 18:05:14 2019 UTC

# Line 5 | Line 5 | static const char      RCSid[] = "$Id$";
5   * Program to convert lamp color from table and compute radiance.
6   */
7  
8 #include <stdio.h>
9 #include <string.h>
8   #include <math.h>
9  
10 < #include "standard.h"
10 > #include "rtmath.h"
11 > #include "rtio.h"
12   #include "color.h"
13  
14                                  /* lamp parameters */
# Line 25 | Line 24 | static int geomcheck(char *s);
24   static int outpcheck(char *s);
25   static void compute(void);
26   static int getpolygon(void), getsphere(void), getcylinder(void), getring(void);
27 + static int getd(char *name, double *dp, char *help);
28  
29  
30   float   *lampcolor;             /* the lamp color (RGB) */
# Line 56 | Line 56 | for fluorescent fixtures." },
56   };
57  
58  
59 < main(argc, argv)
60 < int     argc;
61 < char    *argv[];
59 > int
60 > main(
61 >        int     argc,
62 >        char    *argv[]
63 > )
64   {
65          char    *lamptab = "lamp.tab";
66          char    buf[64];
# Line 75 | Line 77 | char   *argv[];
77                  while (i < NPARAMS) {
78                          printf("Enter %s [%s]: ", param[i].name,
79                                          param[i].value);
80 <                        if (gets(buf) == NULL)
80 >                        if (fgetline(buf, sizeof(buf), stdin) == NULL)
81                                  exit(0);
82                          if (buf[0] == '?') {
83                                  puts(param[i].help);
# Line 97 | Line 99 | char   *argv[];
99  
100   static int
101   typecheck(                      /* check lamp type */
102 < char    *s
102 >        char    *s
103   )
104   {
105          lampcolor = matchlamp(s);
# Line 107 | Line 109 | char   *s
109  
110   static int
111   unitcheck(                      /* compute conversion to meters */
112 < char    *s
112 >        char    *s
113   )
114   {
115          int     len = strlen(s);
# Line 140 | Line 142 | char   *s
142  
143   static int
144   geomcheck(                      /* check/set lamp geometry */
145 < char    *s
145 >        char    *s
146   )
147   {
148          int     len = strlen(s);
# Line 169 | Line 171 | char   *s
171  
172   static int
173   outpcheck(                      /* check lumen output value */
174 < register char   *s
174 >        register char   *s
175   )
176   {
177          if ((*s < '0' || *s > '9') && *s != '.')
# Line 193 | Line 195 | compute(void)                  /* compute lamp radiance */
195   }
196  
197  
198 < getd(name, dp, help)            /* get a positive double from stdin */
199 < char    *name;
200 < double  *dp;
201 < char    *help;
198 > static int
199 > getd(           /* get a positive double from stdin */
200 >        char    *name,
201 >        double  *dp,
202 >        char    *help
203 > )
204   {
205          char    buf[32];
206   again:
207          printf("%s [%g]: ", name, *dp);
208 <        if (gets(buf) == NULL)
208 >        if (fgets(buf, sizeof(buf), stdin) == NULL)
209                  return(0);
210          if (buf[0] == '?') {
211                  puts(help);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines