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

Comparing ray/src/common/fgetval.c (file contents):
Revision 2.1 by greg, Fri Jun 30 16:06:09 1995 UTC vs.
Revision 2.8 by schorsch, Sun Mar 28 20:33:12 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1995 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Read white space separated values from stream
6 + *
7 + *  External symbols declared in rtio.h
8   */
9  
10 < #include  <stdio.h>
10 > #include  "rtio.h"
11  
12 + #include  <stdlib.h>
13   #include  <math.h>
14
14   #include  <ctype.h>
15  
17
18 #ifdef DCL_ATOF
19 extern double   atof();
20 #endif
21 extern int      atoi();
22 extern long     atol();
23 extern char     *strcpy();
24
25
16   int
17   fgetval(fp, ty, vp)                     /* get specified data word */
18   register FILE   *fp;
19   int     ty;
20 < char    *vp;
20 > void    *vp;    /* type depends on ty */
21   {
32        static char     delims[] = " \t\n\r\f#";
22          char    wrd[64];
23          register char   *cp;
24          register int    c;
# Line 55 | Line 44 | char   *vp;
44          *cp = '\0';
45          switch (ty) {                   /* check and convert it */
46          case 'h':                       /* short */
47 <                if (!isintd(wrd, delims))
47 >                if (!isint(wrd))
48                          return(0);
49                  *(short *)vp = c = atoi(wrd);
50                  if (*(short *)vp != c)
51                          return(0);
52                  return(1);
53          case 'i':                       /* integer */
54 <                if (!isintd(wrd, delims))
54 >                if (!isint(wrd))
55                          return(0);
56                  *(int *)vp = atoi(wrd);
57                  return(1);
58          case 'l':                       /* long */
59 <                if (!isintd(wrd, delims))
59 >                if (!isint(wrd))
60                          return(0);
61                  *(long *)vp = atol(wrd);
62                  return(1);
63          case 'f':                       /* float */
64 <                if (!isfltd(wrd, delims))
64 >                if (!isflt(wrd))
65                          return(0);
66                  *(float *)vp = atof(wrd);
67                  return(1);
68          case 'd':                       /* double */
69 <                if (!isfltd(wrd, delims))
69 >                if (!isflt(wrd))
70                          return(0);
71                  *(double *)vp = atof(wrd);
72                  return(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines