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

Comparing ray/src/common/rexpr.c (file contents):
Revision 2.1 by greg, Tue Nov 12 16:54:41 1991 UTC vs.
Revision 2.2 by greg, Sun Nov 1 11:31:34 1992 UTC

# Line 107 | Line 107 | int iflg, wflag;
107                          if ((c = *sp++) == '\0')
108                                  return(-1);
109                          if (c == '<') {
110 <                                *ep++ = CBRC;
110 >                                if (ep == expbuf || ep[-1] != CBRC)
111 >                                        *ep++ = CBRC;
112                                  continue;
113                          }
114                          if (c == '>') {
# Line 148 | Line 149 | register char  *ep;
149   }
150  
151   char *
152 < eindex(sp)                    /* find the expression in str */
152 > eindex(sp)                    /* find the expression in string sp */
153   register char *sp;
154   {
155 <        if (circf) {
156 <                if (advance(sp, expbuf))
157 <                        return(sp);
155 >        /* check for match at beginning of line, watch CBRC */
156 >        if (advance(sp, expbuf[0]==CBRC ? expbuf+1 : expbuf))
157 >                return(sp);
158 >        if (circf)
159                  return(NULL);
158        }
160          /* fast check for first character */
161          if (expbuf[0]==CCHR) {
162                  register c = expbuf[1];
163 <                do {
163 >                while (*++sp)
164                          if (same(*sp, c) && advance(sp, expbuf))
165                                  return(sp);
165                } while (*sp++);
166                  return(NULL);
167          }
168          /* regular algorithm */
169 <        do {
169 >        while (*++sp)
170                  if (advance(sp, expbuf))
171                          return(sp);
172        } while (*sp++);
172          return(NULL);
173   }
174  
# Line 247 | Line 246 | register char *ep;
246                  return(0);
247  
248          case CBRC:
250                if (lp == alp)
251                        continue;
249                  if ((isalnum(*lp) || *lp == '_') && !(isalnum(lp[-1]) || lp[-1] == '_'))
250                          continue;
251                  return (0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines