home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / xap / xfm / xfm-1.000 / xfm-1 / xfm-1.3.2 / regexp / README < prev    next >
Encoding:
Text File  |  1995-04-06  |  4.6 KB  |  93 lines

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