home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / unix / volume10 / regexp.pch < prev    next >
Encoding:
Internet Message Format  |  1988-09-11  |  2.3 KB

  1. Path: uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i097:  Bug-fix for regexp() library
  5. Message-ID: <789@uunet.UU.NET>
  6. Date: 7 Aug 87 11:20:15 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 46
  9. Approved: rs@uunet.UU.NET
  10.  
  11. Submitted-by: seismo!ai.toronto.edu!utzoo!henry
  12. Posting-number: Volume 10, Issue 97
  13. Archive-name: regexp.pch
  14.  
  15. FURTHER NOTE by Rich $alz on Tue Apr 26 20:02:59 EDT 1988:
  16.     This is a patch for Henry's regexp posting that appeared in
  17.     volume 3 (first patch was volume3/regexp2; the naming
  18.     convention used by my predecessor).  There is another
  19.     regexp library in volume 7 -- they're unreleated.
  20.  
  21.     The "fastgrep" posting appeards in volume 9.  It also includes
  22.     Henry's volume3 posting and both sets of patches.
  23.  
  24. [  Regexp was published by itself in volume 6, and also as part of the
  25.    "fastest grep around" earlier in this volume.  --r$  ]
  26.  
  27. Jeff Mc Carrell at Berkeley has found (gasp! choke! the horror! the horror!)
  28. another bug in my regexp functions.  One thing my test set did not include
  29. was very large regular expressions.  The bug is in the NEXT macro, which
  30. digs out the offset to the next node of the regexp:  a parenthesization
  31. botch makes trouble if the offset is ever larger than 255.  How humiliating.
  32. Here is the fix to regexp.c:
  33.  
  34. 116c116
  35. < #define    NEXT(p)    (((*((p)+1)&0377)<<8) + *((p)+2)&0377)
  36. ---
  37. > #define    NEXT(p)    (((*((p)+1)&0377)<<8) + (*((p)+2)&0377))
  38.  
  39. and here are some more lines for the "tests" file:
  40.  
  41. [ -~]*    abc    y    &    abc
  42. [ -~ -~]*    abc    y    &    abc
  43. [ -~ -~ -~]*    abc    y    &    abc
  44. [ -~ -~ -~ -~]*    abc    y    &    abc
  45. [ -~ -~ -~ -~ -~]*    abc    y    &    abc
  46. [ -~ -~ -~ -~ -~ -~]*    abc    y    &    abc
  47. [ -~ -~ -~ -~ -~ -~ -~]*    abc    y    &    abc
  48.  
  49.  
  50. Just to let people know:  there is some prospect of me coming out with
  51. a second edition of my regexp stuff, including a number of improvements
  52. that various people have suggested/contributed.  However, it will not be
  53. soon, because I'm very busy right now.  I can't spare the time to sort
  54. it all out, decide what belongs and what doesn't, write the missing bits
  55. of code, and integrate it all.  Sometime later this year, maybe.
  56.  
  57.                 Henry Spencer @ U of Toronto Zoology
  58.                 {allegra,ihnp4,decvax,pyramid}!utzoo!henry
  59.  
  60.  
  61. -- 
  62.  
  63. Rich $alz            "Anger is an energy"
  64. Cronus Project, BBN Labs    rsalz@bbn.com
  65. Moderator, comp.sources.unix    sources@uunet.uu.net
  66.