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 1.2 by greg, Tue Jul 16 10:51:42 1991 UTC vs.
Revision 2.3 by greg, Thu Nov 18 09:27:03 1993 UTC

# Line 28 | Line 28 | static char SCCSid[] = "$SunId$ LBL";
28   #define  memcpy(to,from,len)    bcopy(from,to,len)
29   #endif
30  
31 + static int     advance(), cclass();
32 +
33   static char    expbuf[ESIZE];
34   static int     iflag;
35   static int     circf;
# Line 105 | 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 146 | 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);
156        }
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);
163                } while (*sp++);
166                  return(NULL);
167          }
168          /* regular algorithm */
169 <        do {
169 >        while (*++sp)
170                  if (advance(sp, expbuf))
171                          return(sp);
170        } while (*sp++);
172          return(NULL);
173   }
174  
# Line 245 | Line 246 | register char *ep;
246                  return(0);
247  
248          case CBRC:
248                if (lp == expbuf)
249                        continue;
249                  if ((isalnum(*lp) || *lp == '_') && !(isalnum(lp[-1]) || lp[-1] == '_'))
250                          continue;
251                  return (0);
# Line 265 | Line 264 | static int
264   cclass(set, c, af)
265   register char *set;
266   register c;
267 + int af;
268   {
269          register n;
270  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines