• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ImakefileH A D17-Jun-1996294 1712

MakefileH A D17-Jun-19963.1 KiB11045

READMEH A D17-Jun-19965 KiB10186

README.osfH A D17-Jun-19961.3 KiB3729

regerror.cH A D17-Jun-1996182 1512

regexp.3H A D17-Jun-19966.5 KiB180175

regexp.cH A D17-Jun-199627 KiB1,216834

regmagic.hH A D17-Jun-1996153 61

regsub.cH A D17-Jun-19961.9 KiB8253

strerror.cH A D17-Jun-1996138 126

testsH A D17-Jun-19962.7 KiB128127

timer.cH A D17-Jun-19963.7 KiB183136

tptregexp.hH A D17-Jun-1996590 2214

try.cH A D17-Jun-19965.4 KiB239187

README

1#
2# Copyright (c) 1994
3# Open Software Foundation, Inc.
4#
5# Permission is hereby granted to use, copy, modify and freely distribute
6# the software in this file and its documentation for any purpose without
7# fee, provided that the above copyright notice appears in all copies and
8# that both the copyright notice and this permission notice appear in
9# supporting documentation.  Further, provided that the name of Open
10# Software Foundation, Inc. ("OSF") not be used in advertising or
11# publicity pertaining to distribution of the software without prior
12# written permission from OSF.  OSF makes no representations about the
13# suitability of this software for any purpose.  It is provided "as is"
14# without express or implied warranty.
15#
16
17This is a nearly-public-domain reimplementation of the V8 regexp(3) package.
18It gives C programs the ability to use egrep-style regular expressions, and
19does 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
38Barring a couple of small items in the BUGS list, this implementation is
39believed 100% compatible with V8.  It should even be binary-compatible,
40sort of, since the only fields in a "struct regexp" that other people have
41any business touching are declared in exactly the same way at the same
42location in the struct (the beginning).
43
44This implementation is *NOT* AT&T/Bell code, and is not derived from licensed
45software.  Even though U of T is a V8 licensee.  This software is based on
46a V8 manual page sent to me by Dennis Ritchie (the manual page enclosed
47here is a complete rewrite and hence is not covered by AT&T copyright).
48The software was nearly complete at the time of arrival of our V8 tape.
49I haven't even looked at V8 yet, although a friend elsewhere at U of T has
50been kind enough to run a few test programs using the V8 regexp(3) to resolve
51a few fine points.  I admit to some familiarity with regular-expression
52implementations of the past, but the only one that this code traces any
53ancestry to is the one published in Kernighan & Plauger (from which this
54one draws ideas but not code).
55
56Simplistically:  put this stuff into a source directory, copy regexp.h into
57/usr/include, inspect Makefile for compilation options that need changing
58to suit your local environment, and then do "make r".  This compiles the
59regexp(3) functions, compiles a test program, and runs a large set of
60regression tests.  If there are no complaints, then put regexp.o, regsub.o,
61and regerror.o into your C library, and regexp.3 into your manual-pages
62directory.
63
64Note that if you don't put regexp.h into /usr/include *before* compiling,
65you'll have to add "-I." to CFLAGS before compiling.
66
67The files are:
68
69Makefile	instructions to make everything
70regexp.3	manual page
71regexp.h	header file, for /usr/include
72regexp.c	source for regcomp() and regexec()
73regsub.c	source for regsub()
74regerror.c	source for default regerror()
75regmagic.h	internal header file
76try.c		source for test program
77timer.c		source for timing program
78tests		test list for try and timer
79
80This implementation uses nondeterministic automata rather than the
81deterministic ones found in some other implementations, which makes it
82simpler, smaller, and faster at compiling regular expressions, but slower
83at executing them.  In theory, anyway.  This implementation does employ
84some special-case optimizations to make the simpler cases (which do make
85up the bulk of regular expressions actually used) run quickly.  In general,
86if you want blazing speed you're in the wrong place.  Replacing the insides
87of egrep with this stuff is probably a mistake; if you want your own egrep
88you're going to have to do a lot more work.  But if you want to use regular
89expressions a little bit in something else, you're in luck.  Note that many
90existing text editors use nondeterministic regular-expression implementations,
91so you're in good company.
92
93This stuff should be pretty portable, given appropriate option settings.
94If your chars have less than 8 bits, you're going to have to change the
95internal representation of the automaton, although knowledge of the details
96of this is fairly localized.  There are no "reserved" char values except for
97NUL, and no special significance is attached to the top bit of chars.
98The string(3) functions are used a fair bit, on the grounds that they are
99probably faster than coding the operations in line.  Some attempts at code
100tuning have been made, but this is invariably a bit machine-specific.
101

README.osf

1#
2# Copyright (c) 1994
3# Open Software Foundation, Inc.
4#
5# Permission is hereby granted to use, copy, modify and freely distribute
6# the software in this file and its documentation for any purpose without
7# fee, provided that the above copyright notice appears in all copies and
8# that both the copyright notice and this permission notice appear in
9# supporting documentation.  Further, provided that the name of Open
10# Software Foundation, Inc. ("OSF") not be used in advertising or
11# publicity pertaining to distribution of the software without prior
12# written permission from OSF.  OSF makes no representations about the
13# suitability of this software for any purpose.  It is provided "as is"
14# without express or implied warranty.
15#
16
17OSF did not write this code.
18
19Changes made:
20
21    Renamed "regexp.h" to "tptregexp.h" to avoid conflicts with systems that
22    have a /usr/include/regexp.h.  Changed the *.c files in the appropriate
23    places.
24
25    Renamed these routines:
26	regcomp()  -> tpt_regcomp()
27	regexec()  -> tpt_regexec()
28	regsub()   -> tpt_regsub()
29	regerror() -> tpt_regerror()
30    This is to avoid conflicts in the standard C library.
31
32    In Makefile - wrote "all" and "install" targets.  Changed "regexp.h"
33    to "tptregexp.h", as appropriate.
34
35    In regexp.c - added #include <string.h> to keep compiler happy.
36
37