home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Misc / msql-1.0.6 / src / regexp / README < prev    next >
Encoding:
Text File  |  1994-06-29  |  4.8 KB  |  101 lines

  1. NOTE - This library has been modified!  This is not virgin, original
  2. Henry Spencer code.
  3.  
  4. That being said (and hence the usage restrictions have been followed) the
  5. only mods that I have made are the use of bzero() to clear out newly
  6. malloc'ed space and to change the syntax of regsub() so that sub-strings
  7. are extracted using "$n" rather than "\n".
  8.  
  9. My mods are public domain, so the entire package still falls under the
  10. restrictions outlined below.
  11.  
  12.  
  13. David J. Hughes        - bambi@Bond.edu.au    15/1/94
  14. ----------------------------------------------------------------------------
  15.  
  16.  
  17. This is a nearly-public-domain reimplementation of the V8 regexp(3) package.
  18. It gives C programs the ability to use egrep-style regular expressions, and
  19. does it in a much cleaner fashion than the analogous routines in SysV.
  20.  
  21.     Copyright (c) 1986 by University of Toronto.
  22.     Written by Henry Spencer.  Not derived from licensed software.
  23.  
  24.     Permission is granted to anyone to use this software for any
  25.     purpose on any computer system, and to redistribute it freely,
  26.     subject to the following restrictions:
  27.  
  28.     1. The author is not responsible for the consequences of use of
  29.         this software, no matter how awful, even if they arise
  30.         from defects in it.
  31.  
  32.     2. The origin of this software must not be misrepresented, either
  33.         by explicit claim or by omission.
  34.  
  35.     3. Altered versions must be plainly marked as such, and must not
  36.         be misrepresented as being the original software.
  37.  
  38. Barring a couple of small items in the BUGS list, this implementation is
  39. believed 100% compatible with V8.  It should even be binary-compatible,
  40. sort of, since the only fields in a "struct regexp" that other people have
  41. any business touching are declared in exactly the same way at the same
  42. location in the struct (the beginning).
  43.  
  44. This implementation is *NOT* AT&T/Bell code, and is not derived from licensed
  45. software.  Even though U of T is a V8 licensee.  This software is based on
  46. a V8 manual page sent to me by Dennis Ritchie (the manual page enclosed
  47. here is a complete rewrite and hence is not covered by AT&T copyright).
  48. The software was nearly complete at the time of arrival of our V8 tape.
  49. I haven't even looked at V8 yet, although a friend elsewhere at U of T has
  50. been kind enough to run a few test programs using the V8 regexp(3) to resolve
  51. a few fine points.  I admit to some familiarity with regular-expression
  52. implementations of the past, but the only one that this code traces any
  53. ancestry to is the one published in Kernighan & Plauger (from which this
  54. one draws ideas but not code).
  55.  
  56. Simplistically:  put this stuff into a source directory, copy regexp.h into
  57. /usr/include, inspect Makefile for compilation options that need changing
  58. to suit your local environment, and then do "make r".  This compiles the
  59. regexp(3) functions, compiles a test program, and runs a large set of
  60. regression tests.  If there are no complaints, then put regexp.o, regsub.o,
  61. and regerror.o into your C library, and regexp.3 into your manual-pages
  62. directory.
  63.  
  64. Note that if you don't put regexp.h into /usr/include *before* compiling,
  65. you'll have to add "-I." to CFLAGS before compiling.
  66.  
  67. The files are:
  68.  
  69. Makefile    instructions to make everything
  70. regexp.3    manual page
  71. regexp.h    header file, for /usr/include
  72. regexp.c    source for regcomp() and regexec()
  73. regsub.c    source for regsub()
  74. regerror.c    source for default regerror()
  75. regmagic.h    internal header file
  76. try.c        source for test program
  77. timer.c        source for timing program
  78. tests        test list for try and timer
  79.  
  80. This implementation uses nondeterministic automata rather than the
  81. deterministic ones found in some other implementations, which makes it
  82. simpler, smaller, and faster at compiling regular expressions, but slower
  83. at executing them.  In theory, anyway.  This implementation does employ
  84. some special-case optimizations to make the simpler cases (which do make
  85. up the bulk of regular expressions actually used) run quickly.  In general,
  86. if you want blazing speed you're in the wrong place.  Replacing the insides
  87. of egrep with this stuff is probably a mistake; if you want your own egrep
  88. you're going to have to do a lot more work.  But if you want to use regular
  89. expressions a little bit in something else, you're in luck.  Note that many
  90. existing text editors use nondeterministic regular-expression implementations,
  91. so you're in good company.
  92.  
  93. This stuff should be pretty portable, given appropriate option settings.
  94. If your chars have less than 8 bits, you're going to have to change the
  95. internal representation of the automaton, although knowledge of the details
  96. of this is fairly localized.  There are no "reserved" char values except for
  97. NUL, and no special significance is attached to the top bit of chars.
  98. The string(3) functions are used a fair bit, on the grounds that they are
  99. probably faster than coding the operations in line.  Some attempts at code
  100. tuning have been made, but this is invariably a bit machine-specific.
  101.