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

Comparing ray/src/cal/calc.c (file contents):
Revision 1.1 by greg, Sat Feb 22 02:07:20 2003 UTC vs.
Revision 1.6 by greg, Tue Dec 9 15:55:46 2003 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7   *     4/1/86
8   */
9  
10 + #include  <stdlib.h>
11   #include  <stdio.h>
12 <
12 > #include  <string.h>
13   #include  <setjmp.h>
13
14   #include  <ctype.h>
15  
16 + #include  "rterror.h"
17   #include  "calcomp.h"
18  
18
19   #define  MAXRES         100
20  
21   double  result[MAXRES];
22   int     nres = 0;
23  
24 #ifndef BSD
25 #define  index          strchr
26 #endif
27 extern char  *index(), *fgets();
28
29
24   jmp_buf  env;
25   int  recover = 0;
26  
27  
28 + int
29   main(argc, argv)
30   int  argc;
31   char  *argv[];
32   {
33 <        char  expr[512];
33 >        char  expr[2048];
34 >        char  *epos;
35          FILE  *fp;
36          int  i;
37          register char  *cp;
# Line 54 | Line 50 | char  *argv[];
50          recover = 1;
51          eclock++;
52  
53 <        while (fgets(expr, sizeof(expr), stdin) != NULL) {
54 <                for (cp = expr; *cp && *cp != '\n'; cp++)
55 <                        ;
56 <                *cp = '\0';
53 >        epos = expr;
54 >        while (fgets(epos, sizeof(expr)-(epos-expr), stdin) != NULL) {
55 >                while (*epos && *epos != '\n')
56 >                        epos++;
57 >                if (*epos && epos > expr && epos[-1] == '\\') {
58 >                        epos[-1] = ' ';
59 >                        continue;               /* escaped newline */
60 >                }
61 >                *epos = '\0';
62 >                epos = expr;
63                  switch (expr[0]) {
64                  case '\0':
65                          continue;
# Line 95 | Line 97 | char  *argv[];
97                          eclock++;
98                          continue;
99                  }
100 <                if ((cp = index(expr, '=')) != NULL ||
101 <                                (cp = index(expr, ':')) != NULL) {
100 >                if ((cp = strchr(expr, '=')) != NULL ||
101 >                                (cp = strchr(expr, ':')) != NULL) {
102                          if (cp[1])
103                                  scompile(expr, NULL, 0);
104                          else if (*cp == '=') {
# Line 122 | Line 124 | char  *argv[];
124  
125          recover = 0;
126          quit(0);
127 +        return 0; /* pro forma exit */
128   }
129  
130  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines