Skip to content

Commit

Permalink
Added Henry Spencer's Regex Library for Win32
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Dunlop authored and Scott Dunlop committed Sep 18, 2008
1 parent 2d3d1b1 commit 502d135
Show file tree
Hide file tree
Showing 37 changed files with 6,001 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .bzrignore
Expand Up @@ -24,3 +24,6 @@ stubs/*
mod/site/config.mo
mod/site/config.ms
FUTURE
rx/engine.ih
rx/regcomp.ih
rx/regerror.ih
21 changes: 4 additions & 17 deletions CHANGES
Expand Up @@ -6,23 +6,10 @@
- Added logic to lib/build to manage circular dependencies in standalone
applications by emitting a preload after the core modules are loaded but
before the remainder.
+ BUG: (format '(1 2 3)) yields "(1)" when vm built with -Os, -O3, ...
+ Does not happen with -O1, -O2 and -O0
+ Add SO_REUSEADDR socket option to services.
+ Added HELP for properties.
+ mosref/node has documentation storage
+ props have doc entries, just not tied into help.
+ Add static help topics
+ Added test suite for all MOSREF commands using a local drone.
+ Ensured the initial mode of any executable created by WaspC is 0700.
+ Verify standalone operation of drone.
+ Verify Cross-platform operation using win32.
+ BUG: make test-socks causes timeouts and not closes to be sent,
then hangs forever.
+ Verify Cross-platform operation using darwin.
+ Tagged MOSREF as MOSREF 3.0b1
+ Tagged WASPVM as 0.4 final.

- Removed some superfluous debug spam.
- Tagged WASPVM as 0.4.
- Added Henry Spencer's regex for WIN32 platform, which is regex-poor.

2008/08/30 MOSREF Proxy Command and Fixes
At this point, MOSREF is functional, but could use some improvements; this
milestone is focussed on making MOSREF a production-worthy tool.
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Expand Up @@ -14,12 +14,13 @@ SOFLAGS += -shared
SALSA_OBJS += vm/salsa20$(OBJ) vm/salsa$(OBJ)
CURVE_OBJS += vm/curve$(OBJ) vm/curve25519_i64$(OBJ)

WASPVM_OBJS += vm/boolean$(OBJ) vm/channel$(OBJ) vm/closure$(OBJ) vm/connection$(OBJ) vm/core$(OBJ) vm/error$(OBJ) vm/file$(OBJ) vm/format$(OBJ) vm/init$(OBJ) vm/list$(OBJ) vm/memory$(OBJ) vm/mq$(OBJ) vm/number$(OBJ) vm/package$(OBJ) vm/parse$(OBJ) vm/primitive$(OBJ) vm/print$(OBJ) vm/procedure$(OBJ) vm/process$(OBJ) vm/queue$(OBJ) vm/string$(OBJ) vm/tag$(OBJ) vm/tree$(OBJ) vm/vector$(OBJ) vm/vm$(OBJ) vm/multimethod$(OBJ) vm/shell$(OBJ) vm/os$(OBJ) vm/time$(OBJ) vm/regex$(OBJ) vm/filesystem$(OBJ) $(CURVE_OBJS) $(SALSA_OBJS) vm/crc32$(OBJ)
WASPVM_OBJS += vm/boolean$(OBJ) vm/channel$(OBJ) vm/closure$(OBJ) vm/connection$(OBJ) vm/core$(OBJ) vm/error$(OBJ) vm/file$(OBJ) vm/format$(OBJ) vm/init$(OBJ) vm/list$(OBJ) vm/memory$(OBJ) vm/mq$(OBJ) vm/number$(OBJ) vm/package$(OBJ) vm/parse$(OBJ) vm/primitive$(OBJ) vm/print$(OBJ) vm/procedure$(OBJ) vm/process$(OBJ) vm/queue$(OBJ) vm/string$(OBJ) vm/tag$(OBJ) vm/tree$(OBJ) vm/vector$(OBJ) vm/vm$(OBJ) vm/multimethod$(OBJ) vm/shell$(OBJ) vm/os$(OBJ) vm/time$(OBJ) vm/regex$(OBJ) vm/filesystem$(OBJ) $(CURVE_OBJS) $(SALSA_OBJS) vm/crc32$(OBJ) $(LIBRX)

# vm/plugin$(OBJ) -- Disabled until after 1.0

LIBWASPVM ?= libwaspvm$(SO)

$(WASPVM_EXE): vm/waspvm$(OBJ) $(WASPVM_OBJS)
$(WASPVM_EXE): vm/waspvm$(OBJ) $(WASPVM_OBJS) $(LIBRX)
$(CC) $(CFLAGS) $(LDFLAGS) $(WASPVM_OBJS) $< $(EXEFLAGS) -o $@
test z$(DEBUG) = z && strip $(WASPVM_EXE) || true

Expand All @@ -42,6 +43,9 @@ $(WASP_EXE): $(WASPC_EXE) $(WASPVM_EXE)
cd mod && $(WASPC_EXE) -exe $(WASP_EXE) -stub $(WASPVM_EXE) bin/wasp
chmod +rx $(WASP_EXE)

$(LIBRX):
cd rx && make lib

install: $(WASPDOC_EXE) $(WASP_EXE) $(WASPC_EXE) $(WASPVM_EXE)
cd mod && $(WASP_EXE) bin/install.ms

Expand Down Expand Up @@ -74,6 +78,7 @@ bootstrap:

clean:
rm -f vm/*$(OBJ) $(WASPDOC_EXE) $(WASPVM_EXE) $(WASPC_EXE) $(WASPLD_EXE) $(WASP_EXE)
cd rx && make clean
rm -rf package

test: test-waspvm test-mosref test-affiliation
Expand Down
5 changes: 4 additions & 1 deletion Makefile.cf
Expand Up @@ -30,7 +30,10 @@ SO = .dll
CFLAGS += -mno-cygwin
CFLAGS += -DWASP_SO='".dll"'
CFLAGS += -I/usr/local/include -L/usr/local/lib
EXEFLAGS += -L/usr/local/lib -levent -lws2_32 -lregex
EXEFLAGS += -L/usr/local/lib -levent -lws2_32
CFLAGS += -Irx
LDFLAGS += -Lrx
LIBRX += rx/libregex.a

else # Assuming we're in UNIX..

Expand Down
4 changes: 4 additions & 0 deletions TODO
Expand Up @@ -13,12 +13,16 @@
+ Modified waspdoc/c-file to document primitive types.

????/??/?? Improved I/O loop
+ Add SO_REUSEADDR socket option to services.
+ Removed libevent
+ Wrote API emulating win32 completion-driven semantics on unix.
+ Ported I/O loop to mac os x.
+ Enabled truly asynchronous TCP connection semantics.
+ Moved win32 console I/O logic out.

+ BUG: (format '(1 2 3)) yields "(1)" when vm built with -Os, -O3, ...
+ Does not happen with -O1, -O2 and -O0

- Add Generational GC
+ Ensure NO direct modifications are done of object properties.
+ Rename each property to zxz_ <property>
Expand Down
Binary file modified mod/mosref/drone.mo
Binary file not shown.
2 changes: 0 additions & 2 deletions mod/mosref/drone.ms
Expand Up @@ -87,11 +87,9 @@

(with-input (input-chain (input)
(thaw-filter))
(trace-filter "T-RECV")
(define command (wait))
(with-output (output-chain (output)
(freeze-filter))
(trace-filter "T-XMIT")
(command))))

(define (drone-broken bridge)
Expand Down
Binary file modified mod/mosref/node.mo
Binary file not shown.
6 changes: 2 additions & 4 deletions mod/mosref/node.ms
Expand Up @@ -89,11 +89,9 @@
(error 'off (string-append "Drone " (node-id node) " is offline.")))
(define lane (make-lane (drone-node-bridge node)))
(define xmit (output-chain (lane-xmit lane)
(freeze-filter)
(trace-filter "T-XMIT")))
(freeze-filter)))
(define recv (input-chain (lane-recv lane)
(thaw-filter)
(trace-filter "T-RECV")))
(thaw-filter)))
(send program xmit)
(list xmit recv))
Expand Down
Binary file modified mod/mosref/transport.mo
Binary file not shown.
4 changes: 1 addition & 3 deletions mod/mosref/transport.ms
Expand Up @@ -35,9 +35,7 @@
(define (make-iv) (read-prng 8))
;;; But the node key? Let's aim higher.. Oh Mr. OS...
;(define (make-private-key) (read-entropy 32))
(print "TODO: Use Entropy for Node Keys again..\n")
(define (make-private-key) (read-prng 32))
(define (make-private-key) (read-entropy 32))

(define find-public-key curve25519-public)
(define find-shared-secret curve25519-secret)
Expand Down
4 changes: 3 additions & 1 deletion package.sh
Expand Up @@ -21,7 +21,8 @@ WASPVM=waspvm-$PLATFORM$EXE
rm -rf $PKGDIR
mkdir -pm 0755 $PKGDIR
cp -rf mod/* $PKGDIR
cp $WASPVM $PKGDIR
cp -rf stubs/$WASPVM $PKGDIR
rm $PKGDIR/local-* $(find $PKGDIR -name '*.mf')
cd $PKGDIR

cat >site/config.ms <<EOF
Expand All @@ -37,5 +38,6 @@ EOF
## TODO: This is bogus..
if test z$EXE = z.exe; then
../waspc -exe waspdoc$EXE -stub $WASPVM bin/waspdoc
../waspc$EXE -exe mosref$EXE -stub $WASPVM bin/mosref
fi

20 changes: 20 additions & 0 deletions rx/COPYRIGHT
@@ -0,0 +1,20 @@
Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.

Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it, subject
to the following restrictions:

1. The author is not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.

2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.

3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.

4. This notice may not be removed or altered.
130 changes: 130 additions & 0 deletions rx/Makefile
@@ -0,0 +1,130 @@
# You probably want to take -DREDEBUG out of CFLAGS, and put something like
# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
# internal assertion checking and some debugging facilities).
# Put -Dconst= in for a pre-ANSI compiler.
# Do not take -DPOSIX_MISTAKE out.
# REGCFLAGS isn't important to you (it's for my use in some special contexts).
CFLAGS=-O -I. -DPOSIX_MISTAKE -DNDEBUG $(REGCFLAGS)

# If you have a pre-ANSI compiler, put -o into MKHFLAGS. If you want
# the Berkeley __P macro, put -b in.
MKHFLAGS=

# Flags for linking but not compiling, if any.
LDFLAGS=

# Extra libraries for linking, if any.
LIBS=

# Internal stuff, should not need changing.
OBJPRODN=regcomp.o regexec.o regerror.o regfree.o
OBJS=$(OBJPRODN) split.o debug.o main.o
H=cclass.h cname.h regex2.h utils.h
REGSRC=regcomp.c regerror.c regexec.c regfree.c
ALLSRC=$(REGSRC) engine.c debug.c main.c split.c

# Stuff that matters only if you're trying to lint the package.
LINTFLAGS=-I. -Dstatic= -Dconst= -DREDEBUG
LINTC=regcomp.c regexec.c regerror.c regfree.c debug.c main.c
JUNKLINT=possible pointer alignment|null effect

# arrangements to build forward-reference header files
.SUFFIXES: .ih .h
.c.ih:
sh ./mkh $(MKHFLAGS) -p $< >$@

default: r

lib: purge $(OBJPRODN)
rm -f libregex.a
ar crv libregex.a $(OBJPRODN)

purge:
rm -f *.o

# stuff to build regex.h
REGEXH=regex.h
REGEXHSRC=regex2.h $(REGSRC)
$(REGEXH): $(REGEXHSRC) mkh
sh ./mkh $(MKHFLAGS) -i _REGEX_H_ $(REGEXHSRC) >regex.tmp
cmp -s regex.tmp regex.h 2>/dev/null || cp regex.tmp regex.h
rm -f regex.tmp

# dependencies
$(OBJPRODN) debug.o: utils.h regex.h regex2.h
regcomp.o: cclass.h cname.h regcomp.ih
regexec.o: engine.c engine.ih
regerror.o: regerror.ih
debug.o: debug.ih
main.o: main.ih

# tester
re: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@

# regression test
r: re tests
./re <tests
./re -el <tests
./re -er <tests

# 57 variants, and other stuff, for development use -- not useful to you
ra: ./re tests
-./re <tests
-./re -el <tests
-./re -er <tests

rx: ./re tests
./re -x <tests
./re -x -el <tests
./re -x -er <tests

t: ./re tests
-time ./re <tests
-time ./re -cs <tests
-time ./re -el <tests
-time ./re -cs -el <tests

l: $(LINTC)
lint $(LINTFLAGS) -h $(LINTC) 2>&1 | egrep -v '$(JUNKLINT)' | tee lint

fullprint:
ti README WHATSNEW notes todo | list
ti *.h | list
list *.c
list regex.3 regex.7

print:
ti README WHATSNEW notes todo | list
ti *.h | list
list reg*.c engine.c


mf.tmp: Makefile
sed '/^REGEXH=/s/=.*/=regex.h/' Makefile | sed '/#DEL$$/d' >$@

DTRH=cclass.h cname.h regex2.h utils.h
PRE=COPYRIGHT README WHATSNEW
POST=mkh regex.3 regex.7 tests $(DTRH) $(ALLSRC) fake/*.[ch]
FILES=$(PRE) Makefile $(POST)
DTR=$(PRE) Makefile=mf.tmp $(POST)
dtr: $(FILES) mf.tmp
makedtr $(DTR) >$@
rm mf.tmp

cio: $(FILES)
cio $(FILES)

rdf: $(FILES)
rcsdiff -c $(FILES) 2>&1 | p

# various forms of cleanup
tidy:
rm -f junk* core core.* *.core dtr *.tmp lint

clean: tidy
rm -f *.o *.s *.ih re libregex.a

# don't do this one unless you know what you're doing
spotless: clean
rm -f mkh regex.h
32 changes: 32 additions & 0 deletions rx/README
@@ -0,0 +1,32 @@
alpha3.8 release.
Tue Aug 10 15:51:48 EDT 1999
henry@spsystems.net (formerly henry@zoo.toronto.edu)

See WHATSNEW for change listing.

installation notes:
--------
Read the comments at the beginning of Makefile before running.

Utils.h contains some things that just might have to be modified on
some systems, as well as a nested include (ugh) of <assert.h>.

The "fake" directory contains quick-and-dirty fakes for some header
files and routines that old systems may not have. Note also that
-DUSEBCOPY will make utils.h substitute bcopy() for memmove().

After that, "make r" will build regcomp.o, regexec.o, regfree.o,
and regerror.o (the actual routines), bundle them together into a test
program, and run regression tests on them. No output is good output.

"make lib" builds just the .o files for the actual routines (when
you're happy with testing and have adjusted CFLAGS for production),
and puts them together into libregex.a. You can pick up either the
library or *.o ("make lib" makes sure there are no other .o files left
around to confuse things).

Main.c, debug.c, split.c are used for regression testing but are not part
of the RE routines themselves.

Regex.h goes in /usr/include. All other .h files are internal only.
--------

0 comments on commit 502d135

Please sign in to comment.