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.8 by greg, Thu Dec 19 16:56:31 2013 UTC vs.
Revision 1.10 by greg, Tue Sep 26 18:09:08 2023 UTC

# Line 25 | Line 25 | int  recover = 0;
25  
26  
27   int
28 < main(argc, argv)
29 < int  argc;
30 < char  *argv[];
28 > main(int argc, char *argv[])
29   {
30          char  expr[2048];
31          char  *epos;
# Line 65 | Line 63 | char  *argv[];
63                          epos[-1] = ' ';
64                          continue;               /* escaped newline */
65                  }
66 +                while (epos > expr && isspace(epos[-1]))
67 +                        epos--;                 /* eliminate end spaces */
68                  *epos = '\0';
69                  epos = expr;
70                  switch (expr[0]) {
# Line 73 | Line 73 | char  *argv[];
73                  case '?':
74                          for (cp = expr+1; isspace(*cp); cp++)
75                                  ;
76 +                        if (*calcontext(NULL))
77 +                                printf("context is: %s\n", calcontext(NULL));
78                          if (*cp)
79                                  dprint(cp, stdout);
80                          else
# Line 108 | Line 110 | char  *argv[];
110                          fcompile(cp);
111                          eclock++;
112                          continue;
113 +                case '[':
114 +                        for (cp = expr+1; isspace(*cp); cp++)
115 +                                ;
116 +                        if (!isalpha(*cp)) {
117 +                                eputs("context name required\n");
118 +                                continue;
119 +                        }
120 +                        printf("context now: %s\n", pushcontext(cp));
121 +                        continue;
122 +                case ']':
123 +                        cp = popcontext();
124 +                        if (*cp)
125 +                                printf("context now: %s\n", cp);
126 +                        else
127 +                                printf("at global context\n");
128 +                        continue;
129                  }
130                  if ((cp = strchr(expr, '=')) != NULL ||
131                                  (cp = strchr(expr, ':')) != NULL) {
# Line 155 | Line 173 | int  n;
173  
174  
175   void
176 < eputs(msg)
159 < char  *msg;
176 > eputs(const char *msg)
177   {
178          fputs(msg, stderr);
179   }
180  
181  
182   void
183 < wputs(msg)
167 < char  *msg;
183 > wputs(const char *msg)
184   {
185          eputs(msg);
186   }
187  
188  
189   void
190 < quit(code)
175 < int  code;
190 > quit(int code)
191   {
192          if (recover)                    /* a cavalier approach */
193                  longjmp(env, 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines