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.9 by schorsch, Sat Nov 15 17:54:06 2003 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines