commit 522b0689c340d26feeac360640bf7e2e0582353c from: rsc date: Tue Sep 30 19:05:50 2003 UTC Reorg commit - 2df2758496b2ab508d349208449f04d85ae2eb2c commit + 522b0689c340d26feeac360640bf7e2e0582353c blob - c4812392d35836556ae21c6b5280b36fe50b9404 blob + fda598ac23afb9bc730a56e8c1708c801cc5328e --- include/bio.h +++ include/bio.h @@ -71,6 +71,7 @@ long Bread(Biobuf*, void*, long); off_t Bseek(Biobuf*, off_t, int); int Bterm(Biobuf*); int Bungetc(Biobuf*); +int Bungetrune(Biobuf*); long Bwrite(Biobuf*, void*, long); char* Brdstr(Biobuf*, int, int); long Bgetrune(Biobuf*); blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/cmd/mk/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/cmd/mk/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/cmd/mk/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/cmd/mk/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/cmd/mk/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/cmd/mk/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/cmd/mk/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - df21b60dc87bfff61a07ab417951318ecba9c229 blob + 4a718460410a8db1c162e6488b7ddaf6089141f7 --- src/cmd/mk/Makefile +++ src/cmd/mk/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - TARG=mk -VERSION=2.0 -PORTPLACE=devel/mk -NAME=mk OFILES=\ arc.$O\ @@ -51,67 +31,7 @@ HFILES=\ mk.h\ fns.h\ -all: $(TARG) +LDFLAGS+=-lregexp9 -lbio -lfmt -lutf -TGZFILES+=mk.pdf +include $(9SRC)/Makeone -install: $(LIB) - test -d $(PREFIX)/man/man1 || mkdir $(PREFIX)/man/man1 - test -d $(PREFIX)/doc || mkdir $(PREFIX)/doc - install -m 0755 mk $(PREFIX)/bin/mk - cat mk.1 | sed 's;DOCPREFIX;$(PREFIX);g' >mk.1a - install -m 0644 mk.1a $(PREFIX)/man/man1/mk.1 - install -m 0644 mk.pdf $(PREFIX)/doc/mk.pdf - - -$(TARG): $(OFILES) - $(CC) -o $(TARG) $(OFILES) -L$(PREFIX)/lib -lregexp9 -lbio -lfmt -lutf - - -.c.$O: - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - f840b18e9054c99f6b883851233628879c9f29b2 (mode 644) blob + /dev/null --- src/cmd/mk/Makefile.MID +++ /dev/null @@ -1,45 +0,0 @@ -TARG=mk -VERSION=2.0 -PORTPLACE=devel/mk -NAME=mk - -OFILES=\ - arc.$O\ - archive.$O\ - bufblock.$O\ - env.$O\ - file.$O\ - graph.$O\ - job.$O\ - lex.$O\ - main.$O\ - match.$O\ - mk.$O\ - parse.$O\ - recipe.$O\ - rule.$O\ - run.$O\ - sh.$O\ - shprint.$O\ - symtab.$O\ - var.$O\ - varsub.$O\ - word.$O\ - unix.$O\ - -HFILES=\ - mk.h\ - fns.h\ - -all: $(TARG) - -TGZFILES+=mk.pdf - -install: $(LIB) - test -d $(PREFIX)/man/man1 || mkdir $(PREFIX)/man/man1 - test -d $(PREFIX)/doc || mkdir $(PREFIX)/doc - install -m 0755 mk $(PREFIX)/bin/mk - cat mk.1 | sed 's;DOCPREFIX;$(PREFIX);g' >mk.1a - install -m 0644 mk.1a $(PREFIX)/man/man1/mk.1 - install -m 0644 mk.pdf $(PREFIX)/doc/mk.pdf - blob - 46498310499b357cd492afde652e911e3fe6a8eb (mode 644) blob + /dev/null --- src/cmd/mk/bundle.ports +++ /dev/null @@ -1,46 +0,0 @@ ---- Makefile --- -# New ports collection makefile for: mk -# Date Created: 11 Feb 2003 -# Whom: rsc -# -# THIS LINE NEEDS REPLACING. IT'S HERE TO GET BY PORTLINT -# $FreeBSD: ports/devel/mk/Makefile,v 1.1 2003/02/12 00:51:22 rsc Exp $ - -PORTNAME= mk -PORTVERSION= 2.0 -CATEGORIES= devel -MASTER_SITES= http://pdos.lcs.mit.edu/~rsc/software/ -EXTRACT_SUFX= .tgz - -MAINTAINER= rsc@post.harvard.edu - -DEPENDS= ${PORTSDIR}/devel/libutf \ - ${PORTSDIR}/devel/libfmt \ - ${PORTSDIR}/devel/libbio \ - ${PORTSDIR}/devel/libregexp9 - -MAN1= mk.1 -USE_REINPLACE= yes - -.include - -post-patch: - ${REINPLACE_CMD} -e 's,$$(PREFIX),${PREFIX},g' ${WRKSRC}/Makefile - -.include ---- pkg-comment --- -Streamlined replacement for make ---- pkg-descr --- -Mk is a streamlined replacement for make, written for -Tenth Edition Research Unix by Andrew Hume. - -WWW: http://pdos.lcs.mit.edu/~rsc/software/#mk - -Russ Cox -rsc@post.harvard.edu ---- pkg-plist --- -bin/mk -doc/mk.pdf ---- /dev/null --- -This is just a way to make sure blank lines don't -creep into pkg-plist. blob - 101513566065d97abe1f03cab2e5e6b08c4a4cc1 (mode 644) blob + /dev/null --- src/cmd/mk/mkfile +++ /dev/null @@ -1,9 +0,0 @@ -all:V: Makefile Make.FreeBSD-386 Make.Linux-386 Make.HP-UX-9000 Make.OSF1-alpha \ - Make.SunOS-sun4u Make.SunOS-sun4u-cc Make.SunOS-sun4u-gcc \ - Make.NetBSD-386 Make.Darwin-PowerMacintosh - -Makefile:D: ../libutf/Makefile.TOP Makefile.MID ../libutf/Makefile.CMD ../libutf/Makefile.BOT - cat $prereq >$target - -Make.%: ../libutf/Make.% - cp $prereq $target blob - be75e6b8677c4785735416a778e4e3700548a563 (mode 644) blob + /dev/null --- src/cmd/mk/rpm.spec +++ /dev/null @@ -1,29 +0,0 @@ -Summary: Streamlined replacement for make -Name: mk -Version: 2.0 -Release: 1 -Group: Development/Utils -Copyright: Public Domain -Packager: Russ Cox -Source: http://pdos.lcs.mit.edu/~rsc/software/mk-2.0.tgz -URL: http://pdos.lcs.mit.edu/~rsc/software/#mk -Requires: libfmt libbio libregexp9 libutf - -%description -Mk is a streamlined replacement for make, written for -Tenth Edition Research Unix by Andrew Hume. - -http://plan9.bell-labs.com/sys/doc/mk.pdf -%prep -%setup - -%build -make - -%install -make install - -%files -/usr/local/doc/mk.pdf -/usr/local/man/man1/mk.1 -/usr/local/bin/mk blob - f5e91463c1a74991067ae7f679fb7461cdd03a06 blob + bf2917dce6a5450d96039188dc6f649dd9108c36 --- src/cmd/sam/Makefile +++ src/cmd/sam/Makefile @@ -1,18 +1,34 @@ -H=errors.h mesg.h parse.h plumb.h sam.h -SRC= address.c buff.c cmd.c disk.c error.c file.c io.c\ - list.c mesg.c moveto.c multi.c unix.c rasp.c regexp.c\ - sam.c shell.c string.c sys.c util.c xec.c plumb.c +9SRC=.. +include $(9SRC)/Makehdr -CC=gcc -PREFIX=$(HOME) -#PREFIX=/usr/local -CFLAGS=-I. -I$(PREFIX)/include -O -g -LDFLAGS=-L$(PREFIX)/lib -LDLIBS=-l9 -lfmt -lutf +TARG=sam +OFILES=sam.$O\ + address.$O\ + buff.$O\ + cmd.$O\ + disk.$O\ + error.$O\ + file.$O\ + io.$O\ + list.$O\ + mesg.$O\ + moveto.$O\ + multi.$O\ + plumb.$O\ + rasp.$O\ + regexp.$O\ + shell.$O\ + string.$O\ + sys.$O\ + unix.$O\ + util.$O\ + xec.$O\ -all: sam -sam: $(SRC) $(H) - $(CC) -o $@ $(CFLAGS) $(SRC) $(LDFLAGS) $(LDLIBS) -clean: - rm -f *.o *~ - rm -f sam +HFILES=sam.h\ + errors.h\ + mesg.h\ + +LDFLAGS+=-l9 -lfmt -lutf + +include $(9SRC)/Makeone + blob - 85cca1703393d891243f688229fffe6d56117c4d blob + c59b013658dcdcb8424d4be92d9b9c30dbe0a8f0 --- src/cmd/sam/address.c +++ src/cmd/sam/address.c @@ -27,7 +27,7 @@ address(Addr *ap, Address a, int sign) break; case '$': - a.r.p1 = a.r.p2 = f->_.nc; + a.r.p1 = a.r.p2 = f->b.nc; break; case '\'': @@ -52,7 +52,7 @@ address(Addr *ap, Address a, int sign) break; case '*': - a.r.p1 = 0, a.r.p2 = f->_.nc; + a.r.p1 = 0, a.r.p2 = f->b.nc; return a; case ',': @@ -69,7 +69,7 @@ address(Addr *ap, Address a, int sign) if(ap->next) a2 = address(ap->next, a, 0); else - a2.f = a.f, a2.r.p1 = a2.r.p2 = f->_.nc; + a2.f = a.f, a2.r.p1 = a2.r.p2 = f->b.nc; if(a1.f != a2.f) error(Eorder); a.f = a1.f, a.r.p1 = a1.r.p1, a.r.p2 = a2.r.p2; @@ -101,7 +101,7 @@ nextmatch(File *f, String *r, Posn p, int sign) if(!execute(f, p, INFINITY)) error(Esearch); if(sel.p[0].p1==sel.p[0].p2 && sel.p[0].p1==p){ - if(++p>f->_.nc) + if(++p>f->b.nc) p = 0; if(!execute(f, p, INFINITY)) panic("address"); @@ -111,7 +111,7 @@ nextmatch(File *f, String *r, Posn p, int sign) error(Esearch); if(sel.p[0].p1==sel.p[0].p2 && sel.p[0].p2==p){ if(--p<0) - p = f->_.nc; + p = f->b.nc; if(!bexecute(f, p)) panic("address"); } @@ -156,10 +156,10 @@ filematch(File *f, String *r) /* A little dirty... */ if(menu == 0) menu = fileopen(); - bufreset(menu); - bufinsert(menu, 0, genstr.s, genstr.n); + bufreset(&menu->b); + bufinsert(&menu->b, 0, genstr.s, genstr.n); compile(r); - return execute(menu, 0, menu->_.nc); + return execute(menu, 0, menu->b.nc); } Address @@ -171,7 +171,7 @@ charaddr(Posn l, Address addr, int sign) addr.r.p2 = addr.r.p1-=l; else if(sign > 0) addr.r.p1 = addr.r.p2+=l; - if(addr.r.p1<0 || addr.r.p2>addr.f->_.nc) + if(addr.r.p1<0 || addr.r.p2>addr.f->b.nc) error(Erange); return addr; } @@ -203,14 +203,14 @@ lineaddr(Posn l, Address addr, int sign) n = filereadc(f, p++)=='\n'; } while(n < l){ - if(p >= f->_.nc) + if(p >= f->b.nc) error(Erange); if(filereadc(f, p++) == '\n') n++; } a.r.p1 = p; } - while(p < f->_.nc && filereadc(f, p++)!='\n') + while(p < f->b.nc && filereadc(f, p++)!='\n') ; a.r.p2 = p; }else{ blob - 30493c3efb5cc5cdf3b4470eecec9f3b3579ce37 blob + 9a525b66671f9204aaa54422d600aea1955b6176 --- src/cmd/sam/buff.c +++ src/cmd/sam/buff.c @@ -91,8 +91,8 @@ setcache(Buffer *b, uint q0) i = b->cbi; } blp = &b->bl[i]; - while(q+(*blp)->_.n <= q0 && q+(*blp)->_.n < b->nc){ - q += (*blp)->_.n; + while(q+(*blp)->u.n <= q0 && q+(*blp)->u.n < b->nc){ + q += (*blp)->u.n; i++; blp++; if(i >= b->nbl) @@ -102,8 +102,8 @@ setcache(Buffer *b, uint q0) /* remember position */ b->cbi = i; b->cq = q; - sizecache(b, bl->_.n); - b->cnc = bl->_.n; + sizecache(b, bl->u.n); + b->cnc = bl->u.n; /*read block*/ diskread(disk, bl, b->c, b->cnc); } blob - 8c152f94eb726aef7b778e1cfdb0141a75beb217 blob + 6b773f8d4a95b2f24629419ba008b57e36421db7 --- src/cmd/sam/cmd.c +++ src/cmd/sam/cmd.c @@ -185,14 +185,14 @@ termcommand(void) { Posn p; - for(p=cmdpt; p_.nc; p++){ + for(p=cmdpt; pb.nc; p++){ if(terminp >= &termline[BLOCKSIZE]){ - cmdpt = cmd->_.nc; + cmdpt = cmd->b.nc; error(Etoolong); } *terminp++ = filereadc(cmd, p); } - cmdpt = cmd->_.nc; + cmdpt = cmd->b.nc; } void blob - 83b2553db6705261ae1bb1b63f24f05c2b996429 blob + f27e94ba4108f29c6fe906641e231b8627c3a2c9 --- src/cmd/sam/disk.c +++ src/cmd/sam/disk.c @@ -64,20 +64,20 @@ disknewblock(Disk *d, uint n) size = ntosize(n, &i); b = d->free[i]; if(b) - d->free[i] = b->_.next; + d->free[i] = b->u.next; else{ /* allocate in chunks to reduce malloc overhead */ if(blist == nil){ blist = emalloc(100*sizeof(Block)); for(j=0; j<100-1; j++) - blist[j]._.next = &blist[j+1]; + blist[j].u.next = &blist[j+1]; } b = blist; - blist = b->_.next; + blist = b->u.next; b->addr = d->addr; d->addr += size; } - b->_.n = n; + b->u.n = n; return b; } @@ -86,8 +86,8 @@ diskrelease(Disk *d, Block *b) { uint i; - ntosize(b->_.n, &i); - b->_.next = d->free[i]; + ntosize(b->u.n, &i); + b->u.next = d->free[i]; d->free[i] = b; } @@ -98,7 +98,7 @@ diskwrite(Disk *d, Block **bp, Rune *r, uint n) Block *b; b = *bp; - size = ntosize(b->_.n, nil); + size = ntosize(b->u.n, nil); nsize = ntosize(n, nil); if(size != nsize){ diskrelease(d, b); @@ -107,16 +107,16 @@ diskwrite(Disk *d, Block **bp, Rune *r, uint n) } if(pwrite(d->fd, r, n*sizeof(Rune), b->addr) != n*sizeof(Rune)) panic("write error to temp file"); - b->_.n = n; + b->u.n = n; } void diskread(Disk *d, Block *b, Rune *r, uint n) { - if(n > b->_.n) + if(n > b->u.n) panic("internal error: diskread"); - ntosize(b->_.n, nil); /* called only for sanity check on Maxblock */ + ntosize(b->u.n, nil); /* called only for sanity check on Maxblock */ if(pread(d->fd, r, n*sizeof(Rune), b->addr) != n*sizeof(Rune)) panic("read error from temp file"); } blob - 0428379dae478364f4b5c9524360739818675558 blob + bc3c0f4ab406f31f05d3797fb28359cf97f97572 --- src/cmd/sam/file.c +++ src/cmd/sam/file.c @@ -114,7 +114,7 @@ mergeextend(File *f, uint p0) mp0n = merge.p0+merge.n; if(mp0n != p0){ - bufread(f, mp0n, merge.buf+merge.nbuf, p0-mp0n); + bufread(&f->b, mp0n, merge.buf+merge.nbuf, p0-mp0n); merge.nbuf += p0-mp0n; merge.n = p0-merge.p0; } @@ -268,11 +268,11 @@ filedeltext(File *f, Text *t) void fileinsert(File *f, uint p0, Rune *s, uint ns) { - if(p0 > f->_.nc) + if(p0 > f->b.nc) panic("internal error: fileinsert"); if(f->seq > 0) fileuninsert(f, &f->delta, p0, ns); - bufinsert(f, p0, s, ns); + bufinsert(&f->b, p0, s, ns); if(ns) f->mod = TRUE; } @@ -294,11 +294,11 @@ fileuninsert(File *f, Buffer *delta, uint p0, uint ns) void filedelete(File *f, uint p0, uint p1) { - if(!(p0<=p1 && p0<=f->_.nc && p1<=f->_.nc)) + if(!(p0<=p1 && p0<=f->b.nc && p1<=f->b.nc)) panic("internal error: filedelete"); if(f->seq > 0) fileundelete(f, &f->delta, p0, p1); - bufdelete(f, p0, p1); + bufdelete(&f->b, p0, p1); if(p1 > p0) f->mod = TRUE; } @@ -321,7 +321,7 @@ fileundelete(File *f, Buffer *delta, uint p0, uint p1) n = p1 - i; if(n > RBUFSIZE) n = RBUFSIZE; - bufread(f, i, buf, n); + bufread(&f->b, i, buf, n); bufinsert(delta, delta->nc, buf, n); } fbuffree(buf); @@ -334,9 +334,9 @@ filereadc(File *f, uint q) { Rune r; - if(q >= f->_.nc) + if(q >= f->b.nc) return -1; - bufread(f, q, &r, 1); + bufread(&f->b, q, &r, 1); return r; } @@ -402,7 +402,7 @@ fileload(File *f, uint p0, int fd, int *nulls) { if(f->seq > 0) panic("undo in file.load unimplemented"); - return bufload(f, p0, fd, nulls); + return bufload(&f->b, p0, fd, nulls); } int @@ -525,7 +525,7 @@ fileundo(File *f, int isundo, int canredo, uint *q0p, if(canredo) fileundelete(f, epsilon, u.p0, u.p0+u.n); f->mod = u.mod; - bufdelete(f, u.p0, u.p0+u.n); + bufdelete(&f->b, u.p0, u.p0+u.n); raspdelete(f, u.p0, u.p0+u.n, flag); *q0p = u.p0; *q1p = u.p0; @@ -543,7 +543,7 @@ fileundo(File *f, int isundo, int canredo, uint *q0p, if(n > RBUFSIZE) n = RBUFSIZE; bufread(delta, up+i, buf, n); - bufinsert(f, u.p0+i, buf, n); + bufinsert(&f->b, u.p0+i, buf, n); raspinsert(f, u.p0+i, buf, n, flag); } fbuffree(buf); @@ -601,7 +601,7 @@ void fileclose(File *f) { Strclose(&f->name); - bufclose(f); + bufclose(&f->b); bufclose(&f->delta); bufclose(&f->epsilon); if(f->rasp) blob - 236090a00b7d79400e9002f63ae9eb09ee1241f7 blob + c066963195106ddf275f262df1f106fe59192a93 --- src/cmd/sam/io.c +++ src/cmd/sam/io.c @@ -53,7 +53,7 @@ writef(File *f) error(Eappend); n = writeio(f); if(f->name.s[0]==0 || samename){ - if(addr.r.p1==0 && addr.r.p2==f->_.nc) + if(addr.r.p1==0 && addr.r.p2==f->b.nc) f->cleanseq = f->seq; state(f, f->cleanseq==f->seq? Clean : Dirty); } @@ -87,7 +87,7 @@ readio(File *f, int *nulls, int setdate, int toterm) *nulls = FALSE; b = 0; if(f->unread){ - nt = bufload(f, 0, io, nulls); + nt = bufload(&f->b, 0, io, nulls); if(toterm) raspload(f); }else @@ -149,7 +149,7 @@ writeio(File *f) n = BLOCKSIZE; else n = addr.r.p2-p; - bufread(f, p, genbuf, n); + bufread(&f->b, p, genbuf, n); c = Strtoc(tmprstr(genbuf, n)); m = strlen(c); if(Write(io, c, m) != m){ @@ -188,8 +188,7 @@ bootterm(char *machine, char **argv, char **end) argv[0] = "samterm"; *end = 0; exec(samterm, argv); - fprint(2, "can't exec: "); - perror(samterm); + fprint(2, "can't exec %s: %r\n", samterm); _exits("damn"); } if(pipe(ph2t)==-1 || pipe(pt2h)==-1) blob - 189c11acd10eb0f291c71fe53292e35f5ed6376b blob + ec0aa8581cc8d81ba0870c94c5f465a6d5718eab --- src/cmd/sam/mesg.c +++ src/cmd/sam/mesg.c @@ -101,7 +101,7 @@ journaln(int out, long n) int rcvchar(void){ static uchar buf[64]; - static i, nleft = 0; + static int i, nleft = 0; if(nleft <= 0){ nleft = read(0, (char *)buf, sizeof buf); @@ -116,9 +116,9 @@ rcvchar(void){ int rcv(void){ int c; - static state = 0; - static count = 0; - static i = 0; + static int state = 0; + static int count = 0; + static int i = 0; while((c=rcvchar()) != -1) switch(state){ @@ -235,17 +235,17 @@ inmesg(Tmesg type) journaln(0, p1-p0); if(f->unread) panic("Trequest: unread"); - if(p1>f->_.nc) - p1 = f->_.nc; - if(p0>f->_.nc) /* can happen e.g. scrolling during command */ - p0 = f->_.nc; + if(p1>f->b.nc) + p1 = f->b.nc; + if(p0>f->b.nc) /* can happen e.g. scrolling during command */ + p0 = f->b.nc; if(p0 == p1){ i = 0; r.p1 = r.p2 = p0; }else{ r = rdata(f->rasp, p0, p1-p0); i = r.p2-r.p1; - bufread(f, r.p1, buf, i); + bufread(&f->b, r.p1, buf, i); } buf[i]=0; outTslS(Hdata, f->tag, r.p1, tmprstr(buf, i+1)); @@ -271,9 +271,9 @@ inmesg(Tmesg type) if(f->unread) load(f); else{ - if(f->_.nc>0){ - rgrow(f->rasp, 0L, f->_.nc); - outTsll(Hgrow, f->tag, 0L, f->_.nc); + if(f->b.nc>0){ + rgrow(f->rasp, 0L, f->b.nc); + outTsll(Hgrow, f->tag, 0L, f->b.nc); } outTs(Hcheck0, f->tag); moveto(f, f->dot.r); @@ -302,7 +302,7 @@ inmesg(Tmesg type) loginsert(f, p0, str->s, str->n); if(fileupdate(f, FALSE, FALSE)) seq++; - if(f==cmd && p0==f->_.nc-i && i>0 && str->s[i-1]=='\n'){ + if(f==cmd && p0==f->b.nc-i && i>0 && str->s[i-1]=='\n'){ freetmpstr(str); termlocked++; termcommand(); @@ -370,7 +370,7 @@ inmesg(Tmesg type) journaln(0, i); f = whichfile(i); addr.r.p1 = 0; - addr.r.p2 = f->_.nc; + addr.r.p2 = f->b.nc; if(f->name.s[0] == 0) error(Enoname); Strduplstr(&genstr, &f->name); @@ -427,9 +427,9 @@ inmesg(Tmesg type) outTl(Hsnarflen, genstr.n); if(genstr.s[genstr.n-1] != '\n') Straddc(&genstr, '\n'); - loginsert(cmd, cmd->_.nc, genstr.s, genstr.n); + loginsert(cmd, cmd->b.nc, genstr.s, genstr.n); fileupdate(cmd, FALSE, TRUE); - cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->_.nc; + cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->b.nc; telldot(cmd); termcommand(); break; @@ -522,7 +522,7 @@ inmesg(Tmesg type) p = p0; while(p0>0 && (i=filereadc(f, p0 - 1))!=' ' && i!='\t' && i!='\n') p0--; - while(p1_.nc && (i=filereadc(f, p1))!=' ' && i!='\t' && i!='\n') + while(p1b.nc && (i=filereadc(f, p1))!=' ' && i!='\t' && i!='\n') p1++; sprint(cbuf, "click=%ld", p-p0); pm->attr = plumbunpackattr(cbuf); @@ -559,13 +559,13 @@ snarf(File *f, Posn p1, Posn p2, Buffer *buf, int empt return; bufreset(buf); /* Stage through genbuf to avoid compaction problems (vestigial) */ - if(p2 > f->_.nc){ - fprint(2, "bad snarf addr p1=%ld p2=%ld f->_.nc=%d\n", p1, p2, f->_.nc); /*ZZZ should never happen, can remove */ - p2 = f->_.nc; + if(p2 > f->b.nc){ + fprint(2, "bad snarf addr p1=%ld p2=%ld f->b.nc=%d\n", p1, p2, f->b.nc); /*ZZZ should never happen, can remove */ + p2 = f->b.nc; } for(l=p1; lBLOCKSIZE? BLOCKSIZE : p2-l; - bufread(f, l, genbuf, i); + bufread(&f->b, l, genbuf, i); bufinsert(buf, buf->nc, tmprstr(genbuf, i)->s, i); } } @@ -609,7 +609,7 @@ setgenstr(File *f, Posn p0, Posn p1) if(p1-p0 >= TBLOCKSIZE) error(Etoolong); Strinsure(&genstr, p1-p0); - bufread(f, p0, genbuf, p1-p0); + bufread(&f->b, p0, genbuf, p1-p0); memmove(genstr.s, genbuf, RUNESIZE*(p1-p0)); genstr.n = p1-p0; }else{ blob - cb6049765f0413d25866bd330d86d8ec570f5379 (mode 644) blob + /dev/null --- src/cmd/sam/mkfile +++ /dev/null @@ -1,40 +0,0 @@ - f->_.nc) - p0 = f->_.nc; + if(p0 > f->b.nc) + p0 = f->b.nc; oldp0 = p0; p = p0; for(nl=nc=c=0; c!=-1 && nl 0){ - if(*p >= f->_.nc) + if(*p >= f->b.nc) break; c = filereadc(f, (*p)++); }else{ @@ -126,7 +126,7 @@ doubleclick(File *f, Posn p1) Rune *r, *l; Posn p; - if(p1 > f->_.nc) + if(p1 > f->b.nc) return; f->dot.r.p1 = f->dot.r.p2 = p1; for(i=0; left[i]; i++){ @@ -147,7 +147,7 @@ doubleclick(File *f, Posn p1) } /* try right match */ p = p1; - if(p1 == f->_.nc) + if(p1 == f->b.nc) c = '\n'; else c = filereadc(f, p); @@ -156,14 +156,14 @@ doubleclick(File *f, Posn p1) f->dot.r.p1 = p; if(c!='\n' || p!=0 || filereadc(f, 0)=='\n') f->dot.r.p1++; - f->dot.r.p2 = p1+(p1_.nc && c=='\n'); + f->dot.r.p2 = p1+(p1b.nc && c=='\n'); } return; } } /* try filling out word to right */ p = p1; - while(p < f->_.nc && alnum(filereadc(f, p++))) + while(p < f->b.nc && alnum(filereadc(f, p++))) f->dot.r.p2++; /* try filling out word to left */ p = p1; blob - 45ac820679f5d88cdac6482647c98c857dab0b33 blob + c5cc57019ccf3e9f5917f6a23939e77d36b38c4a --- src/cmd/sam/rasp.c +++ src/cmd/sam/rasp.c @@ -35,10 +35,10 @@ raspload(File *f) { if(f->rasp == nil) return; - grown = f->_.nc; + grown = f->b.nc; growpos = 0; - if(f->_.nc) - rgrow(f->rasp, 0, f->_.nc); + if(f->b.nc) + rgrow(f->rasp, 0, f->b.nc); raspdone(f, 1); } @@ -55,14 +55,14 @@ raspstart(File *f) void raspdone(File *f, int toterm) { - if(f->dot.r.p1 > f->_.nc) - f->dot.r.p1 = f->_.nc; - if(f->dot.r.p2 > f->_.nc) - f->dot.r.p2 = f->_.nc; - if(f->mark.p1 > f->_.nc) - f->mark.p1 = f->_.nc; - if(f->mark.p2 > f->_.nc) - f->mark.p2 = f->_.nc; + if(f->dot.r.p1 > f->b.nc) + f->dot.r.p1 = f->b.nc; + if(f->dot.r.p2 > f->b.nc) + f->dot.r.p2 = f->b.nc; + if(f->mark.p1 > f->b.nc) + f->mark.p1 = f->b.nc; + if(f->mark.p2 > f->b.nc) + f->mark.p2 = f->b.nc; if(f->rasp == nil) return; if(grown) blob - dee4377d031ff6f0663658d29f868cef2dcddbf3 blob + d4c850507bb120cf2167bf9f81345107f55ce1f4 --- src/cmd/sam/regexp.c +++ src/cmd/sam/regexp.c @@ -700,7 +700,7 @@ bexecute(File *f, Posn startp) case 3: goto Return; list[0][0].inst = list[1][0].inst = 0; - p = f->_.nc; + p = f->b.nc; goto doloop; default: goto Return; @@ -758,7 +758,7 @@ bexecute(File *f, Posn startp) } break; case EOL: - if(p==f->_.nc || filereadc(f, p)=='\n') + if(p==f->b.nc || filereadc(f, p)=='\n') goto Step; break; case CCLASS: blob - 733b555ce476ecaf832cd263bbb4076463a5a186 (mode 755) blob + /dev/null Binary files src/cmd/sam/sam and /dev/null differ blob - 81ccaf7816e9e5343bf212d1778d89189d5a7e6a blob + 864faec6e3c8884f0b421621eaa91b7f7ce14d14 --- src/cmd/sam/sam.c +++ src/cmd/sam/sam.c @@ -148,7 +148,7 @@ rescue(void) io = -1; for(i=0; i_.nc==0 || !fileisdirty(f)) + if(f==cmd || f->b.nc==0 || !fileisdirty(f)) continue; if(io == -1){ sprint(buf, "%s/sam.save", home); @@ -164,7 +164,7 @@ rescue(void) }else sprint(buf, "nameless.%d", nblank++); fprint(io, "#!%s '%s' $* <<'---%s'\n", SAMSAVECMD, buf, buf); - addr.r.p1 = 0, addr.r.p2 = f->_.nc; + addr.r.p1 = 0, addr.r.p2 = f->b.nc; writeio(f); fprint(io, "\n---%s\n", (char *)buf); } @@ -299,7 +299,7 @@ cmdupdate(void) { if(cmd && cmd->seq!=0){ fileupdate(cmd, FALSE, downloaded); - cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->_.nc; + cmd->dot.r.p1 = cmd->dot.r.p2 = cmd->b.nc; telldot(cmd); } } @@ -354,9 +354,9 @@ edit(File *f, int cmd) if(cmd == 'r') logdelete(f, addr.r.p1, addr.r.p2); if(cmd=='e' || cmd=='I'){ - logdelete(f, (Posn)0, f->_.nc); - addr.r.p2 = f->_.nc; - }else if(f->_.nc!=0 || (f->name.s[0] && Strcmp(&genstr, &f->name)!=0)) + logdelete(f, (Posn)0, f->b.nc); + addr.r.p2 = f->b.nc; + }else if(f->b.nc!=0 || (f->name.s[0] && Strcmp(&genstr, &f->name)!=0)) empty = FALSE; if((io = open(genc, OREAD))<0) { if (curfile && curfile->unread) @@ -485,17 +485,17 @@ readcmd(String *s) fileclose(flist); flist = fileopen(); - addr.r.p1 = 0, addr.r.p2 = flist->_.nc; + addr.r.p1 = 0, addr.r.p2 = flist->b.nc; retcode = plan9(flist, '<', s, FALSE); fileupdate(flist, FALSE, FALSE); flist->seq = 0; - if (flist->_.nc > BLOCKSIZE) + if (flist->b.nc > BLOCKSIZE) error(Etoolong); Strzero(&genstr); - Strinsure(&genstr, flist->_.nc); - bufread(flist, (Posn)0, genbuf, flist->_.nc); - memmove(genstr.s, genbuf, flist->_.nc*RUNESIZE); - genstr.n = flist->_.nc; + Strinsure(&genstr, flist->b.nc); + bufread(&flist->b, (Posn)0, genbuf, flist->b.nc); + memmove(genstr.s, genbuf, flist->b.nc*RUNESIZE); + genstr.n = flist->b.nc; Straddc(&genstr, '\0'); return retcode; } @@ -673,7 +673,7 @@ copy(File *f, Address addr2) ni = addr.r.p2-p; if(ni > BLOCKSIZE) ni = BLOCKSIZE; - bufread(f, p, genbuf, ni); + bufread(&f->b, p, genbuf, ni); loginsert(addr2.f, addr2.r.p2, tmprstr(genbuf, ni)->s, ni); } addr2.f->ndot.r.p2 = addr2.r.p2+(f->dot.r.p2-f->dot.r.p1); blob - 6a2708c18db63b7145aa96df95e45f201a3551d2 blob + c6b6873fdbb2e03a42ce8cd204558369dac850ba --- src/cmd/sam/sam.h +++ src/cmd/sam/sam.h @@ -110,11 +110,10 @@ enum struct Block { uint addr; /* disk address in bytes */ - union - { + union { uint n; /* number of used runes in block */ Block *next; /* pointer to next in free list */ - } _; + } u; }; struct Disk @@ -151,7 +150,7 @@ void bufreset(Buffer*); struct File { - Buffer _; /* the data */ + Buffer b; /* the data */ Buffer delta; /* transcript of changes */ Buffer epsilon; /* inversion of delta for redo */ String name; /* name of associated file */ blob - 42acab0e1a8eff36b542a61b1de4b7dd21771214 blob + b4c68bdb52f918105e09edb35a145d87c3bba2d6 --- src/cmd/sam/xec.c +++ src/cmd/sam/xec.c @@ -231,7 +231,7 @@ s_cmd(File *f, Cmd *cp) j = c-'0'; if(sel.p[j].p2-sel.p[j].p1>BLOCKSIZE) error(Elongtag); - bufread(f, sel.p[j].p1, genbuf, sel.p[j].p2-sel.p[j].p1); + bufread(&f->b, sel.p[j].p1, genbuf, sel.p[j].p2-sel.p[j].p1); Strinsert(&genstr, tmprstr(genbuf, (sel.p[j].p2-sel.p[j].p1)), genstr.n); }else Straddc(&genstr, c); @@ -240,7 +240,7 @@ s_cmd(File *f, Cmd *cp) else{ if(sel.p[0].p2-sel.p[0].p1>BLOCKSIZE) error(Elongrhs); - bufread(f, sel.p[0].p1, genbuf, sel.p[0].p2-sel.p[0].p1); + bufread(&f->b, sel.p[0].p1, genbuf, sel.p[0].p2-sel.p[0].p1); Strinsert(&genstr, tmprstr(genbuf, (int)(sel.p[0].p2-sel.p[0].p1)), genstr.n); @@ -390,15 +390,15 @@ display(File *f) p1 = addr.r.p1; p2 = addr.r.p2; - if(p2 > f->_.nc){ - fprint(2, "bad display addr p1=%ld p2=%ld f->_.nc=%d\n", p1, p2, f->_.nc); /*ZZZ should never happen, can remove */ - p2 = f->_.nc; + if(p2 > f->b.nc){ + fprint(2, "bad display addr p1=%ld p2=%ld f->b.nc=%d\n", p1, p2, f->b.nc); /*ZZZ should never happen, can remove */ + p2 = f->b.nc; } while(p1 < p2){ np = p2-p1; if(np>BLOCKSIZE-1) np = BLOCKSIZE-1; - bufread(f, p1, genbuf, np); + bufread(&f->b, p1, genbuf, np); genbuf[np] = 0; c = Strtoc(tmprstr(genbuf, np+1)); if(downloaded) blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/cmd/samterm/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/cmd/samterm/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/cmd/samterm/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/cmd/samterm/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/cmd/samterm/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/cmd/samterm/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/cmd/samterm/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/cmd/samterm/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/cmd/samterm/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 1706b12b30a5acd4137307b8d80d3e5a012c5cc8 blob + 8e7afe3604564434f05340d48601e5434c439518 --- src/cmd/samterm/Makefile +++ src/cmd/samterm/Makefile @@ -1,23 +1,6 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - TARG=samterm OFILES=\ main.$O\ @@ -33,62 +16,12 @@ OFILES=\ HFILES=\ samterm.h\ flayer.h\ - $(PREFIX)/include/frame.h\ + ../sam/sam.h\ + ../sam/mesg.h\ + $(9SRC)/include/frame.h\ + $(9SRC)/include/draw.h\ -all: $(TARG) +CFLAGS+=-I../sam +LDFLAGS+=-lframe -ldraw -lthread -l9 -lregexp9 -lbio -lfmt -lutf -L$(X11)/lib -lX11 -lm -install: - install -c -m 0755 samterm $(PREFIX)/bin/samterm - - -$(TARG): $(OFILES) - $(CC) -o $(TARG) $(OFILES) -L$(PREFIX)/lib -lframe -ldraw -lthread -l9 -lregexp9 -lbio -lfmt -lutf -L/usr/X11R6/lib -lX11 -lm -ldraw - - -.c.$O: - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports +include ../Makeone blob - e65f98a67a56e92d26883f20657f4f949a721d68 (mode 644) blob + /dev/null --- src/cmd/samterm/Makefile.MID +++ /dev/null @@ -1,22 +0,0 @@ -TARG=samterm -OFILES=\ - main.$O\ - icons.$O\ - menu.$O\ - mesg.$O\ - rasp.$O\ - scroll.$O\ - flayer.$O\ - io.$O\ - plan9.$O\ - -HFILES=\ - samterm.h\ - flayer.h\ - $(PREFIX)/include/frame.h\ - -all: $(TARG) - -install: - install -c -m 0755 samterm $(PREFIX)/bin/samterm - blob - 101513566065d97abe1f03cab2e5e6b08c4a4cc1 (mode 644) blob + /dev/null --- src/cmd/samterm/mkfile +++ /dev/null @@ -1,9 +0,0 @@ -all:V: Makefile Make.FreeBSD-386 Make.Linux-386 Make.HP-UX-9000 Make.OSF1-alpha \ - Make.SunOS-sun4u Make.SunOS-sun4u-cc Make.SunOS-sun4u-gcc \ - Make.NetBSD-386 Make.Darwin-PowerMacintosh - -Makefile:D: ../libutf/Makefile.TOP Makefile.MID ../libutf/Makefile.CMD ../libutf/Makefile.BOT - cat $prereq >$target - -Make.%: ../libutf/Make.% - cp $prereq $target blob - c5333ecb1e7d159530e5bd5f7b9a2f675e55d198 (mode 755) blob + /dev/null Binary files src/cmd/samterm/samterm and /dev/null differ blob - /dev/null blob + 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) --- /dev/null +++ src/Make.Darwin-PowerMacintosh @@ -0,0 +1,6 @@ +CC=gcc +CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/lib9/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/lib9/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/lib9/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/lib9/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/lib9/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/lib9/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/lib9/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/lib9/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/lib9/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 595db7879960cf99426d2225aa20e034ca1d9aca blob + 5f8e5aee35c2a4d73191271d74fd3beda71d6a6f --- src/lib9/Makefile +++ src/lib9/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=lib9.a -VERSION=2.0 -PORTPLACE=devel/lib9 -NAME=lib9 OFILES=\ _exits.$O\ @@ -53,68 +33,5 @@ OFILES=\ HFILES=\ lib9.h\ -all: $(LIB) +include $(9SRC)/Makesyslib -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - # install -m 0644 lib9.3 $(PREFIX)/man/man3/lib9.3 - install -m 0644 lib9.h $(PREFIX)/include/lib9.h - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - -test: $(LIB) test.$O - $(CC) -o test test.$O $(LIB) -L$(PREFIX)/lib -lfmt -lutf - -testfork: $(LIB) testfork.$O - $(CC) -o testfork testfork.$O $(LIB) -L$(PREFIX)/lib -lfmt -lutf - -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - 8b3584cbd1d1609ccebb43d3a6df492bf219bd0c (mode 644) blob + /dev/null --- src/lib9/Makefile.MID +++ /dev/null @@ -1,49 +0,0 @@ -LIB=lib9.a -VERSION=2.0 -PORTPLACE=devel/lib9 -NAME=lib9 - -OFILES=\ - _exits.$O\ - argv0.$O\ - await.$O\ - encodefmt.$O\ - errstr.$O\ - exits.$O\ - ffork-$(SYSNAME).$O\ - getcallerpc-$(OBJTYPE).$O\ - getfields.$O\ - lock.$O\ - malloctag.$O\ - mallocz.$O\ - nrand.$O\ - qlock.$O\ - readn.$O\ - rendez.$O\ - strecpy.$O\ - sysfatal.$O\ - tas-$(OBJTYPE).$O\ - tokenize.$O\ - u16.$O\ - u32.$O\ - u64.$O\ - wait.$O\ - werrstr.$O\ - -HFILES=\ - lib9.h\ - -all: $(LIB) - -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - # install -m 0644 lib9.3 $(PREFIX)/man/man3/lib9.3 - install -m 0644 lib9.h $(PREFIX)/include/lib9.h - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - -test: $(LIB) test.$O - $(CC) -o test test.$O $(LIB) -L$(PREFIX)/lib -lfmt -lutf - -testfork: $(LIB) testfork.$O - $(CC) -o testfork testfork.$O $(LIB) -L$(PREFIX)/lib -lfmt -lutf - blob - 703f6b06d8e3b134af7b4f1b01b739e1b5a86593 (mode 644) blob + /dev/null --- src/lib9/mkfile +++ /dev/null @@ -1,2 +0,0 @@ -<../libutf/mkfile - blob - /dev/null blob + 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) --- /dev/null +++ src/Make.FreeBSD-386 @@ -0,0 +1,7 @@ +CC=gcc +CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) +NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libbio/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/libbio/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/libbio/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libbio/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/libbio/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/libbio/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/libbio/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/libbio/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 2d1a0caddce6eb56d1c146f26172368371fa2a42 blob + e3a39a7baf13e9e41d2735971fbbe1bed9dd81d6 --- src/libbio/Makefile +++ src/libbio/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=libbio.a -VERSION=2.0 -PORTPLACE=devel/libbio -NAME=libbio OFILES=\ bbuffered.$O\ @@ -44,65 +24,8 @@ OFILES=\ HFILES=\ bio.h\ -all: $(LIB) +include $(9SRC)/Makesyslib -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -m 0644 bio.3 $(PREFIX)/man/man3/bio.3 - install -m 0644 bio.h $(PREFIX)/include - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - bcat: bcat.$O $(LIB) - $(CC) -o bcat bcat.$O $(LIB) -L/usr/local/lib -lfmt -lutf + $(CC) -o bcat bcat.$O -L$(9SRC)/lib -lbio -lfmt -lutf -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - 610659ba9bf48c7a127e4a88f9924478747c70d5 (mode 644) blob + /dev/null --- src/libbio/Makefile.MID +++ /dev/null @@ -1,37 +0,0 @@ -LIB=libbio.a -VERSION=2.0 -PORTPLACE=devel/libbio -NAME=libbio - -OFILES=\ - bbuffered.$O\ - bfildes.$O\ - bflush.$O\ - bgetc.$O\ - bgetd.$O\ - binit.$O\ - boffset.$O\ - bprint.$O\ - bputc.$O\ - brdline.$O\ - brdstr.$O\ - bread.$O\ - bseek.$O\ - bwrite.$O\ - bgetrune.$O\ - bputrune.$O\ - -HFILES=\ - bio.h\ - -all: $(LIB) - -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -m 0644 bio.3 $(PREFIX)/man/man3/bio.3 - install -m 0644 bio.h $(PREFIX)/include - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - -bcat: bcat.$O $(LIB) - $(CC) -o bcat bcat.$O $(LIB) -L/usr/local/lib -lfmt -lutf - blob - cf504631c819673260b2e20b57d579eeb46c06e0 (mode 644) blob + /dev/null --- src/libbio/bio.3 +++ /dev/null @@ -1,336 +0,0 @@ -.TH BIO 3 -.SH NAME -Bopen, Binit, Binits, Brdline, Brdstr, Bgetc, Bgetd, Bungetc, Bread, Bseek, Boffset, Bfildes, Blinelen, Bputc, Bprint, Bvprint, Bwrite, Bflush, Bterm, Bbuffered \- buffered input/output -.SH SYNOPSIS -.ta \w'Biobuf* 'u -.B #include -.B #include -.PP -.B -Biobuf* Bopen(char *file, int mode) -.PP -.B -int Binit(Biobuf *bp, int fd, int mode) -.PP -.B -int Bterm(Biobuf *bp) -.PP -.B -int Bprint(Biobuf *bp, char *format, ...) -.PP -.B -int Bvprint(Biobuf *bp, char *format, va_list arglist); -.PP -.B -void* Brdline(Biobuf *bp, int delim) -.PP -.B -char* Brdstr(Biobuf *bp, int delim, int nulldelim) -.PP -.B -int Blinelen(Biobuf *bp) -.PP -.B -off_t Boffset(Biobuf *bp) -.PP -.B -int Bfildes(Biobuf *bp) -.PP -.B -int Bgetc(Biobuf *bp) -.PP -.B -long Bgetrune(Biobufhdr *bp) -.PP -.B -int Bgetd(Biobuf *bp, double *d) -.PP -.B -int Bungetc(Biobuf *bp) -.PP -.B -int Bungetrune(Biobufhdr *bp) -.PP -.B -off_t Bseek(Biobuf *bp, off_t n, int type) -.PP -.B -int Bputc(Biobuf *bp, int c) -.PP -.B -int Bputrune(Biobufhdr *bp, long c) -.PP -.B -long Bread(Biobuf *bp, void *addr, long nbytes) -.PP -.B -long Bwrite(Biobuf *bp, void *addr, long nbytes) -.PP -.B -int Bflush(Biobuf *bp) -.PP -.B -int Bbuffered(Biobuf *bp) -.PP -.SH DESCRIPTION -These routines implement fast buffered I/O. -I/O on different file descriptors is independent. -.PP -.I Bopen -opens -.I file -for mode -.B O_RDONLY -or creates for mode -.BR O_WRONLY . -It calls -.IR malloc (3) -to allocate a buffer. -.PP -.I Binit -initializes a buffer -with the open file descriptor passed in -by the user. -.PP -Arguments -of types pointer to Biobuf and pointer to Biobuf -can be used interchangeably in the following routines. -.PP -.IR Bopen , -.IR Binit , -or -.I Binits -should be called before any of the -other routines on that buffer. -.I Bfildes -returns the integer file descriptor of the associated open file. -.PP -.I Bterm -flushes the buffer for -.IR bp . -If the buffer was allocated by -.IR Bopen , -the buffer is -.I freed -and the file is closed. -.PP -.I Brdline -reads a string from the file associated with -.I bp -up to and including the first -.I delim -character. -The delimiter character at the end of the line is -not altered. -.I Brdline -returns a pointer to the start of the line or -.L 0 -on end-of-file or read error. -.I Blinelen -returns the length (including the delimiter) -of the most recent string returned by -.IR Brdline . -.PP -.I Brdstr -returns a -.IR malloc (3)-allocated -buffer containing the next line of input delimited by -.IR delim , -terminated by a NUL (0) byte. -Unlike -.IR Brdline , -which returns when its buffer is full even if no delimiter has been found, -.I Brdstr -will return an arbitrarily long line in a single call. -If -.I nulldelim -is set, the terminal delimiter will be overwritten with a NUL. -After a successful call to -.IR Brdstr , -the return value of -.I Blinelen -will be the length of the returned buffer, excluding the NUL. -.PP -.I Bgetc -returns the next byte from -.IR bp , -or a negative value -at end of file. -.I Bungetc -may be called immediately after -.I Bgetc -to allow the same byte to be reread. -.PP -.I Bgetrune -calls -.I Bgetc -to read the bytes of the next -.SM UTF -sequence in the input stream and returns the value of the rune -represented by the sequence. -It returns a negative value -at end of file. -.I Bungetrune -may be called immediately after -.I Bgetrune -to allow the same -.SM UTF -sequence to be reread as either bytes or a rune. -.I Bungetc -and -.I Bungetrune -may back up a maximum of five bytes. -.PP -.I Bgetd -uses -.I fmtcharstod -(undocumented) -and -.I Bgetc -to read the formatted -floating-point number in the input stream, -skipping initial blanks and tabs. -The value is stored in -.BR *d. -.PP -.I Bread -reads -.I nbytes -of data from -.I bp -into memory starting at -.IR addr . -The number of bytes read is returned on success -and a negative value is returned if a read error occurred. -.PP -.I Bseek -applies -.IR lseek (2) -to -.IR bp . -It returns the new file offset. -.I Boffset -returns the file offset of the next character to be processed. -.PP -.I Bputc -outputs the low order 8 bits of -.I c -on -.IR bp . -If this causes a -.IR write -to occur and there is an error, -a negative value is returned. -Otherwise, a zero is returned. -.PP -.I Bputrune -calls -.I Bputc -to output the low order -16 bits of -.I c -as a rune -in -.SM UTF -format -on the output stream. -.PP -.I Bprint -is a buffered interface to -.IR print (2). -If this causes a -.IR write -to occur and there is an error, -a negative value -.RB ( Beof ) -is returned. -Otherwise, the number of bytes output is returned. -.I Bvprint -does the same except it takes as argument a -.B va_list -parameter, so it can be called within a variadic function. -.PP -.I Bwrite -outputs -.I nbytes -of data starting at -.I addr -to -.IR bp . -If this causes a -.IR write -to occur and there is an error, -a negative value is returned. -Otherwise, the number of bytes written is returned. -.PP -.I Bflush -causes any buffered output associated with -.I bp -to be written. -The return is as for -.IR Bputc . -.I Bflush -is called on -exit for every buffer still open -for writing. -.PP -.I Bbuffered -returns the number of bytes in the buffer. -When reading, this is the number of bytes still available from the last -read on the file; when writing, it is the number of bytes ready to be -written. -.PP -This library uses -.IR fmt (3) -for diagnostic messages about internal errors, -as well as for the implementation of -.I Bprint -and -.IR Bvprint . -It uses -.IR utf (3) -for the implementation of -.I Bgetrune -and -.IR Bputrune . -.SH SEE ALSO -.IR atexit (3). -.IR open (2), -.IR print (3), -.IR utf (7) -.SH DIAGNOSTICS -.I Bio -routines that return integers yield -.B Beof -if -.I bp -is not the descriptor of an open file. -.I Bopen -returns zero if the file cannot be opened in the given mode. -.SH HISTORY -The -.IR bio (3) -library originally appeared in Plan 9. -This is a port of the Plan 9 bio library. -.SH BUGS -.I Brdline -returns an error on strings longer than the buffer associated -with the file -and also if the end-of-file is encountered -before a delimiter. -.I Blinelen -will tell how many characters are available -in these cases. -In the case of a true end-of-file, -.I Blinelen -will return zero. -At the cost of allocating a buffer, -.I Brdstr -sidesteps these issues. -.PP -The data returned by -.I Brdline -may be overwritten by calls to any other -.I bio -routine on the same -.IR bp. blob - c4812392d35836556ae21c6b5280b36fe50b9404 (mode 644) blob + /dev/null --- src/libbio/bio.h +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef _BIOH_ -#define _BIOH_ 1 - -#include /* for off_t */ -#include /* for O_RDONLY, O_WRONLY */ - -typedef struct Biobuf Biobuf; - -enum -{ - Bsize = 8*1024, - Bungetsize = 4, /* space for ungetc */ - Bmagic = 0x314159, - Beof = -1, - Bbad = -2, - - Binactive = 0, /* states */ - Bractive, - Bwactive, - Bracteof, - - Bend -}; - -struct Biobuf -{ - int icount; /* neg num of bytes at eob */ - int ocount; /* num of bytes at bob */ - int rdline; /* num of bytes after rdline */ - int runesize; /* num of bytes of last getrune */ - int state; /* r/w/inactive */ - int fid; /* open file */ - int flag; /* magic if malloc'ed */ - off_t offset; /* offset of buffer in file */ - int bsize; /* size of buffer */ - unsigned char* bbuf; /* pointer to beginning of buffer */ - unsigned char* ebuf; /* pointer to end of buffer */ - unsigned char* gbuf; /* pointer to good data in buf */ - unsigned char b[Bungetsize+Bsize]; -}; - -#define BGETC(bp)\ - ((bp)->icount?(bp)->bbuf[(bp)->bsize+(bp)->icount++]:Bgetc((bp))) -#define BPUTC(bp,c)\ - ((bp)->ocount?(bp)->bbuf[(bp)->bsize+(bp)->ocount++]=(c),0:Bputc((bp),(c))) -#define BOFFSET(bp)\ - (((bp)->state==Bractive)?\ - (bp)->offset + (bp)->icount:\ - (((bp)->state==Bwactive)?\ - (bp)->offset + ((bp)->bsize + (bp)->ocount):\ - -1)) -#define BLINELEN(bp)\ - (bp)->rdline -#define BFILDES(bp)\ - (bp)->fid - -int Bbuffered(Biobuf*); -int Bfildes(Biobuf*); -int Bflush(Biobuf*); -int Bgetc(Biobuf*); -int Bgetd(Biobuf*, double*); -int Binit(Biobuf*, int, int); -int Binits(Biobuf*, int, int, unsigned char*, int); -int Blinelen(Biobuf*); -off_t Boffset(Biobuf*); -Biobuf* Bopen(char*, int); -int Bprint(Biobuf*, char*, ...); -int Bputc(Biobuf*, int); -void* Brdline(Biobuf*, int); -long Bread(Biobuf*, void*, long); -off_t Bseek(Biobuf*, off_t, int); -int Bterm(Biobuf*); -int Bungetc(Biobuf*); -long Bwrite(Biobuf*, void*, long); -char* Brdstr(Biobuf*, int, int); -long Bgetrune(Biobuf*); -int Bputrune(Biobuf*, long); - -#endif blob - bea32d3475ba5ff22dc2b5f06a30bc996972a085 (mode 644) blob + /dev/null --- src/libbio/bundle.ports +++ /dev/null @@ -1,45 +0,0 @@ ---- Makefile --- -# New ports collection makefile for: libbio -# Date Created: 11 Feb 2003 -# Whom: rsc -# -# THIS LINE NEEDS REPLACING. IT'S HERE TO GET BY PORTLINT -# $FreeBSD: ports/devel/libbio/Makefile,v 1.1 2003/02/12 00:51:22 rsc Exp $ - -PORTNAME= libbio -PORTVERSION= 2.0 -CATEGORIES= devel -MASTER_SITES= http://pdos.lcs.mit.edu/~rsc/software/ -EXTRACT_SUFX= .tgz - -MAINTAINER= rsc@post.harvard.edu - -DEPENDS= ${PORTSDIR}/devel/libfmt ${PORTSDIR}/devel/libutf - -MAN3= bio.3 -USE_REINPLACE= yes - -.include - -post-patch: - ${REINPLACE_CMD} -e 's,$$(PREFIX),${PREFIX},g' ${WRKSRC}/Makefile - -.include ---- pkg-comment --- -Simple buffered I/O library from Plan 9 ---- pkg-descr --- -Libbio is a port of Plan 9's formatted I/O library. -It provides most of the same functionality as stdio or sfio, -but with a simpler interface and smaller footprint. - -WWW: http://pdos.lcs.mit.edu/~rsc/software/#libbio -http://plan9.bell-labs.com/magic/man2html/2/bio - -Russ Cox -rsc@post.harvard.edu ---- pkg-plist --- -lib/libbio.a -include/bio.h ---- /dev/null --- -This is just a way to make sure blank lines don't -creep into pkg-plist. blob - bb99a25ab4d41b82f60096fe078cf4374b5fa108 (mode 644) blob + /dev/null --- src/libbio/mkfile +++ /dev/null @@ -1 +0,0 @@ -<../libutf/mkfile blob - 5cb9830cd6e10d838b2b3b4f3965f755a8180c5e (mode 644) blob + /dev/null --- src/libbio/rpm.spec +++ /dev/null @@ -1,30 +0,0 @@ -Summary: Simple buffered I/O library from Plan 9 -Name: libbio -Version: 2.0 -Release: 1 -Group: Development/C -Copyright: LGPL -Packager: Russ Cox -Source: http://pdos.lcs.mit.edu/~rsc/software/libbio-2.0.tgz -URL: http://pdos.lcs.mit.edu/~rsc/software/#libbio -Requires: libfmt libutf - -%description -Libbio is a port of Plan 9's formatted I/O library. -It provides most of the same functionality as stdio or sfio, -but with a simpler interface and smaller footprint. - -http://plan9.bell-labs.com/magic/man2html/2/bio -%prep -%setup - -%build -make - -%install -make install - -%files -/usr/local/include/bio.h -/usr/local/lib/libbio.a -/usr/local/man/man3/bio.3 blob - /dev/null blob + edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) --- /dev/null +++ src/Make.HP-UX-9000 @@ -0,0 +1,6 @@ +CC=cc +CFLAGS=-O -c -Ae -I. +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/libdraw/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libdraw/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/libdraw/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/libdraw/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libdraw/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/libdraw/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/libdraw/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/libdraw/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/libdraw/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 0aa2cd2dd6379be55e50c439b185e306e5925a78 blob + 8013efa56f01f1dc95427eb7498c5545b6b2beb6 --- src/libdraw/Makefile +++ src/libdraw/Makefile @@ -1,30 +1,8 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=libdraw.a -VERSION=2.0 -PORTPLACE=devel/libdraw -NAME=libdraw -# keyboard.$O\ -# newwindow.$O\ OFILES=\ alloc.$O\ allocimagemix.$O\ @@ -125,70 +103,20 @@ OFILES=\ unix.$O\ HFILES=\ - draw.h\ - memdraw.h + $(9SRC)/include/draw.h\ + $(9SRC)/include/memdraw.h\ + $(9SRC)/include/memlayer.h\ + $(9SRC)/include/event.h\ + $(9SRC)/include/cursor.h\ + $(9SRC)/include/mouse.h\ + $(9SRC)/include/keyboard.h\ + x11-inc.h\ + x11-memdraw.h\ -all: $(LIB) +CFLAGS+=-I$(X11)/include -install: $(LIB) - install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - install -c -m 0644 draw.h $(PREFIX)/include/draw.h - install -c -m 0644 event.h $(PREFIX)/include/event.h - install -c -m 0644 cursor.h $(PREFIX)/include/cursor.h - install -c -m 0644 mouse.h $(PREFIX)/include/mouse.h - install -c -m 0644 keyboard.h $(PREFIX)/include/keyboard.h +include $(9SRC)/Makesyslib test: test.o $(LIB) - gcc -o test test.o $(LIB) -L$(PREFIX)/lib -l9 -lfmt -lutf -L/usr/X11R6/lib -lX11 -lm + gcc -o test test.o -L$(9SRC) -ldraw -l9 -lfmt -lutf -L$(X11)/lib -lX11 -lm -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - 55cf7d4abfbdf9d55701c49d0eaa413cc622eba6 (mode 644) blob + /dev/null --- src/libdraw/Makefile.MID +++ /dev/null @@ -1,123 +0,0 @@ -LIB=libdraw.a -VERSION=2.0 -PORTPLACE=devel/libdraw -NAME=libdraw - -# keyboard.$O\ -# newwindow.$O\ -OFILES=\ - alloc.$O\ - allocimagemix.$O\ - arith.$O\ - bezier.$O\ - border.$O\ - buildfont.$O\ - bytesperline.$O\ - chan.$O\ - cloadimage.$O\ - computil.$O\ - creadimage.$O\ - debug.$O\ - defont.$O\ - draw.$O\ - drawrepl.$O\ - egetrect.$O\ - ellipse.$O\ - emenuhit.$O\ - font.$O\ - freesubfont.$O\ - getdefont.$O\ - getrect.$O\ - getsubfont.$O\ - icossin.$O\ - icossin2.$O\ - init.$O\ - line.$O\ - loadimage.$O\ - menuhit.$O\ - mkfont.$O\ - openfont.$O\ - poly.$O\ - readcolmap.$O\ - readimage.$O\ - readsubfont.$O\ - rectclip.$O\ - replclipr.$O\ - rgb.$O\ - string.$O\ - stringbg.$O\ - stringsubfont.$O\ - stringwidth.$O\ - subfont.$O\ - subfontcache.$O\ - subfontname.$O\ - unloadimage.$O\ - window.$O\ - writecolmap.$O\ - writeimage.$O\ - writesubfont.$O\ - md-alloc.$O\ - md-arc.$O\ - md-cload.$O\ - md-cmap.$O\ - md-cread.$O\ - md-defont.$O\ - md-draw.$O\ - md-ellipse.$O\ - md-fillpoly.$O\ - md-hwdraw.$O\ - md-iprint.$O\ - md-line.$O\ - md-load.$O\ - md-openmemsubfont.$O\ - md-poly.$O\ - md-read.$O\ - md-string.$O\ - md-subfont.$O\ - md-unload.$O\ - md-write.$O\ - ml-draw.$O\ - ml-lalloc.$O\ - ml-layerop.$O\ - ml-ldelete.$O\ - ml-lhide.$O\ - ml-line.$O\ - ml-load.$O\ - ml-lorigin.$O\ - ml-lsetrefresh.$O\ - ml-ltofront.$O\ - ml-ltorear.$O\ - ml-unload.$O\ - x11-alloc.$O\ - x11-cload.$O\ - x11-draw.$O\ - x11-event.$O\ - x11-fill.$O\ - x11-get.$O\ - x11-init.$O\ - x11-itrans.$O\ - x11-keyboard.$O\ - x11-load.$O\ - x11-mouse.$O\ - x11-pixelbits.$O\ - x11-unload.$O\ - devdraw.$O\ - unix.$O\ - -HFILES=\ - draw.h\ - memdraw.h - -all: $(LIB) - -install: $(LIB) - install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - install -c -m 0644 draw.h $(PREFIX)/include/draw.h - install -c -m 0644 event.h $(PREFIX)/include/event.h - install -c -m 0644 cursor.h $(PREFIX)/include/cursor.h - install -c -m 0644 mouse.h $(PREFIX)/include/mouse.h - install -c -m 0644 keyboard.h $(PREFIX)/include/keyboard.h - -test: test.o $(LIB) - gcc -o test test.o $(LIB) -L$(PREFIX)/lib -l9 -lfmt -lutf -L/usr/X11R6/lib -lX11 -lm - blob - 105cd0eff35c958b0902dcb709204b40d9e85bc8 (mode 644) blob + /dev/null --- src/libdraw/cursor.h +++ /dev/null @@ -1,7 +0,0 @@ -typedef struct Cursor Cursor; -struct Cursor -{ - Point offset; - uchar clr[2*16]; - uchar set[2*16]; -}; blob - 0f9ba63aeb6e1f2ad3539c8e3e304583266af299 (mode 644) blob + /dev/null --- src/libdraw/draw.h +++ /dev/null @@ -1,520 +0,0 @@ -typedef struct Cachefont Cachefont; -typedef struct Cacheinfo Cacheinfo; -typedef struct Cachesubf Cachesubf; -typedef struct Display Display; -typedef struct Font Font; -typedef struct Fontchar Fontchar; -typedef struct Image Image; -typedef struct Mouse Mouse; -typedef struct Point Point; -typedef struct Rectangle Rectangle; -typedef struct RGB RGB; -typedef struct Screen Screen; -typedef struct Subfont Subfont; - -extern int Rfmt(Fmt*); -extern int Pfmt(Fmt*); - -enum -{ - DOpaque = 0xFFFFFFFF, - DTransparent = 0x00000000, /* only useful for allocimage, memfillcolor */ - DBlack = 0x000000FF, - DWhite = 0xFFFFFFFF, - DRed = 0xFF0000FF, - DGreen = 0x00FF00FF, - DBlue = 0x0000FFFF, - DCyan = 0x00FFFFFF, - DMagenta = 0xFF00FFFF, - DYellow = 0xFFFF00FF, - DPaleyellow = 0xFFFFAAFF, - DDarkyellow = 0xEEEE9EFF, - DDarkgreen = 0x448844FF, - DPalegreen = 0xAAFFAAFF, - DMedgreen = 0x88CC88FF, - DDarkblue = 0x000055FF, - DPalebluegreen= 0xAAFFFFFF, - DPaleblue = 0x0000BBFF, - DBluegreen = 0x008888FF, - DGreygreen = 0x55AAAAFF, - DPalegreygreen = 0x9EEEEEFF, - DYellowgreen = 0x99994CFF, - DMedblue = 0x000099FF, - DGreyblue = 0x005DBBFF, - DPalegreyblue = 0x4993DDFF, - DPurpleblue = 0x8888CCFF, - - DNotacolor = 0xFFFFFF00, - DNofill = DNotacolor, - -}; - -enum -{ - Displaybufsize = 8000, - ICOSSCALE = 1024, - Borderwidth = 4, -}; - -enum -{ - /* refresh methods */ - Refbackup = 0, - Refnone = 1, - Refmesg = 2 -}; -#define NOREFRESH ((void*)-1) - -enum -{ - /* line ends */ - Endsquare = 0, - Enddisc = 1, - Endarrow = 2, - Endmask = 0x1F -}; - -#define ARROW(a, b, c) (Endarrow|((a)<<5)|((b)<<14)|((c)<<23)) - -typedef enum -{ - /* Porter-Duff compositing operators */ - Clear = 0, - - SinD = 8, - DinS = 4, - SoutD = 2, - DoutS = 1, - - S = SinD|SoutD, - SoverD = SinD|SoutD|DoutS, - SatopD = SinD|DoutS, - SxorD = SoutD|DoutS, - - D = DinS|DoutS, - DoverS = DinS|DoutS|SoutD, - DatopS = DinS|SoutD, - DxorS = DoutS|SoutD, /* == SxorD */ - - Ncomp = 12, -} Drawop; - -/* - * image channel descriptors - */ -enum { - CRed = 0, - CGreen, - CBlue, - CGrey, - CAlpha, - CMap, - CIgnore, - NChan, -}; - -#define __DC(type, nbits) ((((type)&15)<<4)|((nbits)&15)) -#define CHAN1(a,b) __DC(a,b) -#define CHAN2(a,b,c,d) (CHAN1((a),(b))<<8|__DC((c),(d))) -#define CHAN3(a,b,c,d,e,f) (CHAN2((a),(b),(c),(d))<<8|__DC((e),(f))) -#define CHAN4(a,b,c,d,e,f,g,h) (CHAN3((a),(b),(c),(d),(e),(f))<<8|__DC((g),(h))) - -#define NBITS(c) ((c)&15) -#define TYPE(c) (((c)>>4)&15) - -enum { - GREY1 = CHAN1(CGrey, 1), - GREY2 = CHAN1(CGrey, 2), - GREY4 = CHAN1(CGrey, 4), - GREY8 = CHAN1(CGrey, 8), - CMAP8 = CHAN1(CMap, 8), - RGB15 = CHAN4(CIgnore, 1, CRed, 5, CGreen, 5, CBlue, 5), - RGB16 = CHAN3(CRed, 5, CGreen, 6, CBlue, 5), - RGB24 = CHAN3(CRed, 8, CGreen, 8, CBlue, 8), - BGR24 = CHAN3(CBlue, 8, CGreen, 8, CRed, 8), - RGBA32 = CHAN4(CRed, 8, CGreen, 8, CBlue, 8, CAlpha, 8), - ARGB32 = CHAN4(CAlpha, 8, CRed, 8, CGreen, 8, CBlue, 8), /* stupid VGAs */ - XRGB32 = CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8), - XBGR32 = CHAN4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8), -}; - -extern char* chantostr(char*, u32int); -extern u32int strtochan(char*); -extern int chantodepth(u32int); - -struct Point -{ - int x; - int y; -}; - -struct Rectangle -{ - Point min; - Point max; -}; - -typedef void (*Reffn)(Image*, Rectangle, void*); - -struct Screen -{ - Display *display; /* display holding data */ - int id; /* id of system-held Screen */ - Image *image; /* unused; for reference only */ - Image *fill; /* color to paint behind windows */ -}; - -struct Display -{ - QLock qlock; - int locking; /*program is using lockdisplay */ - int dirno; - int imageid; - int local; - void (*error)(Display*, char*); - char *devdir; - char *windir; - char oldlabel[64]; - u32int dataqid; - Image *image; - Image *white; - Image *black; - Image *opaque; - Image *transparent; - uchar *buf; - int bufsize; - uchar *bufp; - uchar *obuf; - int obufsize; - uchar *obufp; - Font *defaultfont; - Subfont *defaultsubfont; - Image *windows; - Image *screenimage; - int _isnewdisplay; -}; - -struct Image -{ - Display *display; /* display holding data */ - int id; /* id of system-held Image */ - Rectangle r; /* rectangle in data area, local coords */ - Rectangle clipr; /* clipping region */ - int depth; /* number of bits per pixel */ - u32int chan; - int repl; /* flag: data replicates to tile clipr */ - Screen *screen; /* 0 if not a window */ - Image *next; /* next in list of windows */ -}; - -struct RGB -{ - u32int red; - u32int green; - u32int blue; -}; - -/* - * Subfonts - * - * given char c, Subfont *f, Fontchar *i, and Point p, one says - * i = f->info+c; - * draw(b, Rect(p.x+i->left, p.y+i->top, - * p.x+i->left+((i+1)->x-i->x), p.y+i->bottom), - * color, f->bits, Pt(i->x, i->top)); - * p.x += i->width; - * to draw characters in the specified color (itself an Image) in Image b. - */ - -struct Fontchar -{ - int x; /* left edge of bits */ - uchar top; /* first non-zero scan-line */ - uchar bottom; /* last non-zero scan-line + 1 */ - char left; /* offset of baseline */ - uchar width; /* width of baseline */ -}; - -struct Subfont -{ - char *name; - short n; /* number of chars in font */ - uchar height; /* height of image */ - char ascent; /* top of image to baseline */ - Fontchar *info; /* n+1 character descriptors */ - Image *bits; /* of font */ - int ref; -}; - -enum -{ - /* starting values */ - LOG2NFCACHE = 6, - NFCACHE = (1<>8)) -#define BPLONG(p, v) (BPSHORT(p, (v)), BPSHORT(p+2, (v)>>16)) - -/* - * Compressed image file parameters and helper routines - */ -#define NMATCH 3 /* shortest match possible */ -#define NRUN (NMATCH+31) /* longest match possible */ -#define NMEM 1024 /* window size */ -#define NDUMP 128 /* maximum length of dump */ -#define NCBLOCK 6000 /* size of compressed blocks */ -extern void _twiddlecompressed(uchar*, int); -extern int _compblocksize(Rectangle, int); - -/* XXX backwards helps; should go */ -extern int log2[]; -extern u32int drawld2chan[]; -extern void drawsetdebug(int); - -/* - * Port magic. - */ -int _drawmsgread(Display*, void*, int); -int _drawmsgwrite(Display*, void*, int); blob - e74183d4efedcfd33146569a3ff2c28bf5523e66 (mode 644) blob + /dev/null --- src/libdraw/event.h +++ /dev/null @@ -1,63 +0,0 @@ -typedef struct Event Event; -typedef struct Menu Menu; - -enum -{ - Emouse = 1, - Ekeyboard = 2, -}; - -enum -{ - MAXSLAVE = 32, - EMAXMSG = 128+8192, /* size of 9p header+data */ -}; - -struct Mouse -{ - int buttons; /* bit array: LMR=124 */ - Point xy; - ulong msec; -}; - -struct Event -{ - int kbdc; - Mouse mouse; - int n; /* number of characters in message */ - void *v; /* data unpacked by general event-handling function */ - uchar data[EMAXMSG]; /* message from an arbitrary file descriptor */ -}; - -struct Menu -{ - char **item; - char *(*gen)(int); - int lasthit; -}; - -/* - * Events - */ -extern void einit(ulong); -extern ulong estart(ulong, int, int); -extern ulong estartfn(ulong, int, int, int (*fn)(int, Event*, uchar*, int)); -extern ulong etimer(ulong, int); -extern ulong event(Event*); -extern ulong eread(ulong, Event*); -extern Mouse emouse(void); -extern int ekbd(void); -extern int ecanread(ulong); -extern int ecanmouse(void); -extern int ecankbd(void); -extern void eresized(int); /* supplied by user */ -extern int emenuhit(int, Mouse*, Menu*); -extern int eatomouse(Mouse*, char*, int); -extern Rectangle getrect(int, Mouse*); -struct Cursor; -extern void esetcursor(struct Cursor*); -extern void emoveto(Point); -extern Rectangle egetrect(int, Mouse*); -extern void edrawgetrect(Rectangle, int); -extern int ereadmouse(Mouse*); -extern int eatomouse(Mouse*, char*, int); blob - a6d99bf6ae3e6493068236a86f34507074fbd9ea (mode 644) blob + /dev/null --- src/libdraw/keyboard.h +++ /dev/null @@ -1,36 +0,0 @@ -typedef struct Keyboardctl Keyboardctl; - -struct Keyboardctl -{ - struct Channel *c; /* chan(Rune)[20] */ - - char *file; - int consfd; /* to cons file */ - int ctlfd; /* to ctl file */ - int pid; /* of slave proc */ -}; - - -extern Keyboardctl* initkeyboard(char*); -extern int ctlkeyboard(Keyboardctl*, char*); -extern void closekeyboard(Keyboardctl*); - -enum { - KF= 0xF000, /* Rune: beginning of private Unicode space */ - /* KF|1, KF|2, ..., KF|0xC is F1, F2, ..., F12 */ - Khome= KF|0x0D, - Kup= KF|0x0E, - Kpgup= KF|0x0F, - Kprint= KF|0x10, - Kleft= KF|0x11, - Kright= KF|0x12, - Kdown= 0x80, - Kview= 0x80, - Kpgdown= KF|0x13, - Kins= KF|0x14, - Kend= '\r', /* [sic] */ - - Kalt= KF|0x15, - Kshift= KF|0x16, - Kctl= KF|0x17, -}; blob - 08784ce92540af3156204a8190ee46eab1e4ab11 (mode 644) blob + /dev/null --- src/libdraw/memdraw.h +++ /dev/null @@ -1,209 +0,0 @@ -typedef struct Memimage Memimage; -typedef struct Memdata Memdata; -typedef struct Memsubfont Memsubfont; -typedef struct Memlayer Memlayer; -typedef struct Memcmap Memcmap; -typedef struct Memdrawparam Memdrawparam; - -/* - * Memdata is allocated from main pool, but .data from the image pool. - * Memdata is allocated separately to permit patching its pointer after - * compaction when windows share the image data. - * The first word of data is a back pointer to the Memdata, to find - * The word to patch. - */ - -struct Memdata -{ - u32int *base; /* allocated data pointer */ - uchar *bdata; /* pointer to first byte of actual data; word-aligned */ - int ref; /* number of Memimages using this data */ - void* imref; - int allocd; /* is this malloc'd? */ -}; - -enum { - Frepl = 1<<0, /* is replicated */ - Fsimple = 1<<1, /* is 1x1 */ - Fgrey = 1<<2, /* is grey */ - Falpha = 1<<3, /* has explicit alpha */ - Fcmap = 1<<4, /* has cmap channel */ - Fbytes = 1<<5, /* has only 8-bit channels */ -}; - -struct Memimage -{ - Rectangle r; /* rectangle in data area, local coords */ - Rectangle clipr; /* clipping region */ - int depth; /* number of bits of storage per pixel */ - int nchan; /* number of channels */ - u32int chan; /* channel descriptions */ - Memcmap *cmap; - - Memdata *data; /* pointer to data; shared by windows in this image */ - int zero; /* data->bdata+zero==&byte containing (0,0) */ - u32int width; /* width in words of a single scan line */ - Memlayer *layer; /* nil if not a layer*/ - u32int flags; - void *X; - - int shift[NChan]; - int mask[NChan]; - int nbits[NChan]; -}; - -struct Memcmap -{ - uchar cmap2rgb[3*256]; - uchar rgb2cmap[16*16*16]; -}; - -/* - * Subfonts - * - * given char c, Subfont *f, Fontchar *i, and Point p, one says - * i = f->info+c; - * draw(b, Rect(p.x+i->left, p.y+i->top, - * p.x+i->left+((i+1)->x-i->x), p.y+i->bottom), - * color, f->bits, Pt(i->x, i->top)); - * p.x += i->width; - * to draw characters in the specified color (itself a Memimage) in Memimage b. - */ - -struct Memsubfont -{ - char *name; - short n; /* number of chars in font */ - uchar height; /* height of bitmap */ - char ascent; /* top of bitmap to baseline */ - Fontchar *info; /* n+1 character descriptors */ - Memimage *bits; /* of font */ -}; - -/* - * Encapsulated parameters and information for sub-draw routines. - */ -enum { - Simplesrc=1<<0, - Simplemask=1<<1, - Replsrc=1<<2, - Replmask=1<<3, - Fullmask=1<<4, -}; -struct Memdrawparam -{ - Memimage *dst; - Rectangle r; - Memimage *src; - Rectangle sr; - Memimage *mask; - Rectangle mr; - int op; - - u32int state; - u32int mval; /* if Simplemask, the mask pixel in mask format */ - u32int mrgba; /* mval in rgba */ - u32int sval; /* if Simplesrc, the source pixel in src format */ - u32int srgba; /* sval in rgba */ - u32int sdval; /* sval in dst format */ -}; - -/* - * Memimage management - */ - -extern Memimage* allocmemimage(Rectangle, u32int); -extern Memimage* allocmemimaged(Rectangle, u32int, Memdata*, void*); -extern Memimage* readmemimage(int); -extern Memimage* creadmemimage(int); -extern int writememimage(int, Memimage*); -extern void freememimage(Memimage*); -extern int loadmemimage(Memimage*, Rectangle, uchar*, int); -extern int cloadmemimage(Memimage*, Rectangle, uchar*, int); -extern int unloadmemimage(Memimage*, Rectangle, uchar*, int); -extern u32int* wordaddr(Memimage*, Point); -extern uchar* byteaddr(Memimage*, Point); -extern int drawclip(Memimage*, Rectangle*, Memimage*, Point*, - Memimage*, Point*, Rectangle*, Rectangle*); -extern void memfillcolor(Memimage*, u32int); -extern int memsetchan(Memimage*, u32int); -extern u32int pixelbits(Memimage*, Point); - -/* - * Graphics - */ -extern void memdraw(Memimage*, Rectangle, Memimage*, Point, - Memimage*, Point, int); -extern void memline(Memimage*, Point, Point, int, int, int, - Memimage*, Point, int); -extern void mempoly(Memimage*, Point*, int, int, int, int, - Memimage*, Point, int); -extern void memfillpoly(Memimage*, Point*, int, int, - Memimage*, Point, int); -extern void _memfillpolysc(Memimage*, Point*, int, int, - Memimage*, Point, int, int, int, int); -extern void memimagedraw(Memimage*, Rectangle, Memimage*, Point, - Memimage*, Point, int); -extern int hwdraw(Memdrawparam*); -extern void memimageline(Memimage*, Point, Point, int, int, int, - Memimage*, Point, int); -extern void _memimageline(Memimage*, Point, Point, int, int, int, - Memimage*, Point, Rectangle, int); -extern Point memimagestring(Memimage*, Point, Memimage*, Point, - Memsubfont*, char*); -extern void memellipse(Memimage*, Point, int, int, int, - Memimage*, Point, int); -extern void memarc(Memimage*, Point, int, int, int, Memimage*, - Point, int, int, int); -extern Rectangle memlinebbox(Point, Point, int, int, int); -extern int memlineendsize(int); -extern void _memmkcmap(void); -extern void memimageinit(void); - -/* - * Subfont management - */ -extern Memsubfont* allocmemsubfont(char*, int, int, int, Fontchar*, Memimage*); -extern Memsubfont* openmemsubfont(char*); -extern void freememsubfont(Memsubfont*); -extern Point memsubfontwidth(Memsubfont*, char*); -extern Memsubfont* getmemdefont(void); - -/* - * Predefined - */ -extern Memimage* memwhite; -extern Memimage* memblack; -extern Memimage* memopaque; -extern Memimage* memtransparent; -extern Memcmap* memdefcmap; - -/* - * Kernel interface - */ -void memimagemove(void*, void*); - -/* - * Kernel cruft - */ -extern void rdb(void); -extern int iprint(char*, ...); -extern int drawdebug; - -/* - * For other implementations, like x11. - */ -extern void _memfillcolor(Memimage*, u32int); -extern Memimage* _allocmemimage(Rectangle, u32int); -extern int _cloadmemimage(Memimage*, Rectangle, uchar*, int); -extern int _loadmemimage(Memimage*, Rectangle, uchar*, int); -extern void _freememimage(Memimage*); -extern u32int _rgbatoimg(Memimage*, u32int); -extern u32int _imgtorgba(Memimage*, u32int); -extern u32int _pixelbits(Memimage*, Point); -extern int _unloadmemimage(Memimage*, Rectangle, uchar*, int); -extern Memdrawparam* _memimagedrawsetup(Memimage*, - Rectangle, Memimage*, Point, Memimage*, - Point, int); -extern void _memimagedraw(Memdrawparam*); -extern void _drawreplacescreenimage(Memimage*); blob - 36d87767db6a4a0d1294cdb813854f5d866cafa0 (mode 644) blob + /dev/null --- src/libdraw/memlayer.h +++ /dev/null @@ -1,48 +0,0 @@ -typedef struct Memscreen Memscreen; -typedef void (*Refreshfn)(Memimage*, Rectangle, void*); - -struct Memscreen -{ - Memimage *frontmost; /* frontmost layer on screen */ - Memimage *rearmost; /* rearmost layer on screen */ - Memimage *image; /* upon which all layers are drawn */ - Memimage *fill; /* if non-zero, picture to use when repainting */ -}; - -struct Memlayer -{ - Rectangle screenr; /* true position of layer on screen */ - Point delta; /* add delta to go from image coords to screen */ - Memscreen *screen; /* screen this layer belongs to */ - Memimage *front; /* window in front of this one */ - Memimage *rear; /* window behind this one*/ - int clear; /* layer is fully visible */ - Memimage *save; /* save area for obscured parts */ - Refreshfn refreshfn; /* function to call to refresh obscured parts if save==nil */ - void *refreshptr; /* argument to refreshfn */ -}; - -/* - * These functions accept local coordinates - */ -int memload(Memimage*, Rectangle, uchar*, int, int); -int memunload(Memimage*, Rectangle, uchar*, int); - -/* - * All these functions accept screen coordinates, not local ones. - */ -void _memlayerop(void (*fn)(Memimage*, Rectangle, Rectangle, void*, int), Memimage*, Rectangle, Rectangle, void*); -Memimage* memlalloc(Memscreen*, Rectangle, Refreshfn, void*, u32int); -void memldelete(Memimage*); -void memlfree(Memimage*); -void memltofront(Memimage*); -void memltofrontn(Memimage**, int); -void _memltofrontfill(Memimage*, int); -void memltorear(Memimage*); -void memltorearn(Memimage**, int); -int memlsetrefresh(Memimage*, Refreshfn, void*); -void memlhide(Memimage*, Rectangle); -void memlexpose(Memimage*, Rectangle); -void _memlsetclear(Memscreen*); -int memlorigin(Memimage*, Point, Point); -void memlnorefresh(Memimage*, Rectangle, void*); blob - bb99a25ab4d41b82f60096fe078cf4374b5fa108 (mode 644) blob + /dev/null --- src/libdraw/mkfile +++ /dev/null @@ -1 +0,0 @@ -<../libutf/mkfile blob - f0a0f697523863e3910a405bf6528a9f06aab175 (mode 644) blob + /dev/null --- src/libdraw/mouse.h +++ /dev/null @@ -1,44 +0,0 @@ -typedef struct Menu Menu; -typedef struct Mousectl Mousectl; - -struct Mouse -{ - int buttons; /* bit array: LMR=124 */ - Point xy; - ulong msec; -}; - -struct Mousectl -{ - Mouse m; - struct Channel *c; /* chan(Mouse) */ - struct Channel *resizec; /* chan(int)[2] */ - /* buffered in case client is waiting for a mouse action before handling resize */ - - char *file; - int mfd; /* to mouse file */ - int cfd; /* to cursor file */ - int pid; /* of slave proc */ - Display *display; - /*Image* image; / * of associated window/display */ -}; - -struct Menu -{ - char **item; - char *(*gen)(int); - int lasthit; -}; - -/* - * Mouse - */ -extern Mousectl* initmouse(char*, Image*); -extern void moveto(Mousectl*, Point); -extern int readmouse(Mousectl*); -extern void closemouse(Mousectl*); -struct Cursor; -extern void setcursor(Mousectl*, struct Cursor*); -extern void drawgetrect(Rectangle, int); -extern Rectangle getrect(int, Mousectl*); -extern int menuhit(int, Mousectl*, Menu*, Screen*); blob - 5d99bb5b727e39e7d26a7eca7558fa870c6adb58 (mode 755) blob + /dev/null Binary files src/libdraw/test and /dev/null differ blob - /dev/null blob + 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) --- /dev/null +++ src/Make.Linux-386 @@ -0,0 +1,7 @@ +CC=gcc +CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) +NAN=nan64.$O blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/libfmt/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 9799dcbb656a8014884566234263a188172fe585 (mode 644) blob + /dev/null --- src/libfmt/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -pg -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/libfmt/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 204328281a9393003647e58e2f347ba3da6a7327 (mode 644) blob + /dev/null --- src/libfmt/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -DNEEDLL -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libfmt/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/libfmt/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/libfmt/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/libfmt/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/libfmt/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 4b8ff604b686d25e43063334db58622800682439 blob + 0b072191e09d725aebf17293724e586668b720b8 --- src/libfmt/Makefile +++ src/libfmt/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=libfmt.a -VERSION=2.0 -PORTPLACE=devel/libfmt -NAME=libfmt NUM=\ charstod.$O\ @@ -64,71 +44,13 @@ OFILES=\ HFILES=\ fmtdef.h\ - fmt.h\ + $(9SRC)/include/fmt.h\ -all: $(LIB) +include $(9SRC)/Makesyslib -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -m 0644 print.3 $(PREFIX)/man/man3/print.3 - install -m 0644 fmtinstall.3 $(PREFIX)/man/man3/fmtinstall.3 - install -m 0644 fmt.h $(PREFIX)/include/fmt.h - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - $(NAN).$O: nan.h strtod.$O: nan.h test: $(LIB) test.$O - $(CC) -o test test.$O $(LIB) -L$(PREFIX)/lib -lutf + $(CC) -o test test.$O $(LIB) -L$(9SRC)/lib -lutf -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - 8302c281c2279bf88a3be92c57fb5cc7cebc0d54 (mode 644) blob + /dev/null --- src/libfmt/Makefile.MID +++ /dev/null @@ -1,63 +0,0 @@ -LIB=libfmt.a -VERSION=2.0 -PORTPLACE=devel/libfmt -NAME=libfmt - -NUM=\ - charstod.$O\ - pow10.$O\ - -OFILES=\ - dofmt.$O\ - errfmt.$O\ - fltfmt.$O\ - fmt.$O\ - fmtfd.$O\ - fmtfdflush.$O\ - fmtlock.$O\ - fmtprint.$O\ - fmtquote.$O\ - fmtrune.$O\ - fmtstr.$O\ - fmtvprint.$O\ - fprint.$O\ - print.$O\ - runefmtstr.$O\ - runeseprint.$O\ - runesmprint.$O\ - runesnprint.$O\ - runesprint.$O\ - runevseprint.$O\ - runevsmprint.$O\ - runevsnprint.$O\ - seprint.$O\ - smprint.$O\ - snprint.$O\ - sprint.$O\ - strtod.$O\ - vfprint.$O\ - vseprint.$O\ - vsmprint.$O\ - vsnprint.$O\ - $(NUM)\ - $(NAN)\ - -HFILES=\ - fmtdef.h\ - fmt.h\ - -all: $(LIB) - -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -m 0644 print.3 $(PREFIX)/man/man3/print.3 - install -m 0644 fmtinstall.3 $(PREFIX)/man/man3/fmtinstall.3 - install -m 0644 fmt.h $(PREFIX)/include/fmt.h - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - -$(NAN).$O: nan.h -strtod.$O: nan.h - -test: $(LIB) test.$O - $(CC) -o test test.$O $(LIB) -L$(PREFIX)/lib -lutf - blob - 9ecf6a245410a906378cf958d99dae5e5b701b95 (mode 644) blob + /dev/null --- src/libfmt/bundle.ports +++ /dev/null @@ -1,51 +0,0 @@ ---- Makefile --- -# New ports collection makefile for: libfmt -# Date Created: 11 Feb 2003 -# Whom: rsc -# -# THIS LINE NEEDS REPLACING. IT'S HERE TO GET BY PORTLINT -# $FreeBSD: ports/devel/libfmt/Makefile,v 1.1 2003/02/12 00:51:22 rsc Exp $ - -PORTNAME= libfmt -PORTVERSION= 2.0 -CATEGORIES= devel -MASTER_SITES= http://pdos.lcs.mit.edu/~rsc/software/ -EXTRACT_SUFX= .tgz - -MAINTAINER= rsc@post.harvard.edu - -DEPENDS= ${PORTSDIR}/devel/libutf - -MAN3= print.3 fmtinstall.3 - -USE_REINPLACE=yes - -.include - -post-patch: - ${REINPLACE_CMD} -e 's,$$(PREFIX),${PREFIX},g' ${WRKSRC}/Makefile - -.include ---- pkg-comment --- -Extensible formatted print C library (printf with user-defined verbs) ---- pkg-descr --- -Libfmt is a port of Plan 9's formatted print library. -As a base it provides all the syntax of ANSI printf -but adds the ability for client programs to install -new print verbs. One such print verb (installed by -default) is %r, which prints the system error string. -Instead of perror("foo"), you can write fprint(2, "foo: %r\n"). -This is especially nice when you write verbs to format -the data structures used by your particular program. - -WWW: http://pdos.lcs.mit.edu/~rsc/software/#libfmt -http://plan9.bell-labs.com/magic/man2html/2/print - -Russ Cox -rsc@post.harvard.edu ---- pkg-plist --- -lib/libfmt.a -include/fmt.h ---- /dev/null --- -This is just a way to make sure blank lines don't -creep into pkg-plist. blob - c913e14a05887a86a8973cd7fff02f3cde9a100f (mode 644) blob + /dev/null --- src/libfmt/fmt.h +++ /dev/null @@ -1,100 +0,0 @@ - -/* - * The authors of this software are Rob Pike and Ken Thompson. - * Copyright (c) 2002 by Lucent Technologies. - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software and in all copies of the supporting - * documentation for such software. - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY - * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY - * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - */ - -#ifndef _FMTH_ -#define _FMTH_ 1 - -#include - -#ifndef _UTFH_ -#include -#endif - -typedef struct Fmt Fmt; -struct Fmt{ - unsigned char runes; /* output buffer is runes or chars? */ - void *start; /* of buffer */ - void *to; /* current place in the buffer */ - void *stop; /* end of the buffer; overwritten if flush fails */ - int (*flush)(Fmt *); /* called when to == stop */ - void *farg; /* to make flush a closure */ - int nfmt; /* num chars formatted so far */ - va_list args; /* args passed to dofmt */ - int r; /* % format Rune */ - int width; - int prec; - unsigned long flags; -}; - -enum{ - FmtWidth = 1, - FmtLeft = FmtWidth << 1, - FmtPrec = FmtLeft << 1, - FmtSharp = FmtPrec << 1, - FmtSpace = FmtSharp << 1, - FmtSign = FmtSpace << 1, - FmtZero = FmtSign << 1, - FmtUnsigned = FmtZero << 1, - FmtShort = FmtUnsigned << 1, - FmtLong = FmtShort << 1, - FmtVLong = FmtLong << 1, - FmtComma = FmtVLong << 1, - FmtByte = FmtComma << 1, - FmtLDouble = FmtByte << 1, - - FmtFlag = FmtLDouble << 1 -}; - -extern int print(char*, ...); -extern char* seprint(char*, char*, char*, ...); -extern char* vseprint(char*, char*, char*, va_list); -extern int snprint(char*, int, char*, ...); -extern int vsnprint(char*, int, char*, va_list); -extern char* smprint(char*, ...); -extern char* vsmprint(char*, va_list); -extern int sprint(char*, char*, ...); -extern int fprint(int, char*, ...); -extern int vfprint(int, char*, va_list); - -extern int runesprint(Rune*, char*, ...); -extern int runesnprint(Rune*, int, char*, ...); -extern int runevsnprint(Rune*, int, char*, va_list); -extern Rune* runeseprint(Rune*, Rune*, char*, ...); -extern Rune* runevseprint(Rune*, Rune*, char*, va_list); -extern Rune* runesmprint(char*, ...); -extern Rune* runevsmprint(char*, va_list); - -extern int fmtfdinit(Fmt*, int, char*, int); -extern int fmtfdflush(Fmt*); -extern int fmtstrinit(Fmt*); -extern char* fmtstrflush(Fmt*); -extern int runefmtstrinit(Fmt*); - -extern int quotestrfmt(Fmt *f); -extern void quotefmtinstall(void); -extern int (*fmtdoquote)(int); - - -extern int fmtinstall(int, int (*)(Fmt*)); -extern int dofmt(Fmt*, char*); -extern int fmtprint(Fmt*, char*, ...); -extern int fmtvprint(Fmt*, char*, va_list); -extern int fmtrune(Fmt*, int); -extern int fmtstrcpy(Fmt*, char*); - -extern double fmtstrtod(const char *, char **); -extern double fmtcharstod(int(*)(void*), void*); - -#endif blob - 2a0e55bf164c92bbf6d34b02105d38e2190fc00f (mode 644) blob + /dev/null --- src/libfmt/fmtinstall.3 +++ /dev/null @@ -1,346 +0,0 @@ -.TH FMTINSTALL 3 -.de EX -.nf -.ft B -.. -.de EE -.fi -.ft R -.. -.SH NAME -fmtinstall, dofmt, fmtprint, fmtvprint, fmtstrcpy, fmtfdinit, fmtfdflush, fmtstrinit, fmtstrflush \- support for user-defined print formats and output routines -.SH SYNOPSIS -.B #include -.PP -.ft L -.nf -.ta \w' 'u +\w' 'u +\w' 'u +\w' 'u +\w' 'u -typedef struct Fmt Fmt; -struct Fmt{ - void *start; /* of buffer */ - void *to; /* current place in the buffer */ - void *stop; /* end of the buffer; overwritten if flush fails */ - int (*flush)(Fmt*); /* called when to == stop */ - void *farg; /* to make flush a closure */ - int nfmt; /* num chars formatted so far */ - va_list args; /* args passed to dofmt */ - int r; /* % format character */ - int width; - int prec; - unsigned long flags; -}; - -enum{ - FmtWidth = 1, - FmtLeft = FmtWidth << 1, - FmtPrec = FmtLeft << 1, - FmtSharp = FmtPrec << 1, - FmtSpace = FmtSharp << 1, - FmtSign = FmtSpace << 1, - FmtZero = FmtSign << 1, - FmtUnsigned = FmtZero << 1, - FmtShort = FmtUnsigned << 1, - FmtLong = FmtShort << 1, - FmtVLong = FmtLong << 1, - FmtComma = FmtVLong << 1, - FmtByte = FmtComma << 1, - FmtLDouble = FmtByte << 1, - - FmtFlag = FmtLDouble << 1 -}; -.fi -.PP -.B -.ta \w'\fLchar* 'u - -.PP -.B -int fmtfdinit(Fmt *f, int fd, char *buf, int nbuf); -.PP -.B -int fmtfdflush(Fmt *f); -.PP -.B -int fmtstrinit(Fmt *f); -.PP -.B -char* fmtstrflush(Fmt *f); -.PP -.B -int fmtinstall(int c, int (*fn)(Fmt*)); -.PP -.B -int dofmt(Fmt *f, char *fmt); -.PP -.B -int fmtprint(Fmt *f, char *fmt, ...); -.PP -.B -int fmtvprint(Fmt *f, char *fmt, va_list v); -.PP -.B -int fmtrune(Fmt *f, int r); -.PP -.B -int fmtstrcpy(Fmt *f, char *s); -.SH DESCRIPTION -The interface described here allows the construction of custom -.IR print (3) -verbs and output routines. -In essence, they provide access to the workings of the formatted print code. -.PP -The -.IR print (3) -suite maintains its state with a data structure called -.BR Fmt . -A typical call to -.IR print (3) -or its relatives initializes a -.B Fmt -structure, passes it to subsidiary routines to process the output, -and finishes by emitting any saved state recorded in the -.BR Fmt . -The details of the -.B Fmt -are unimportant to outside users, except insofar as the general -design influences the interface. -The -.B Fmt -records -the verb being processed, its precision and width, -and buffering parameters. -Most important, it also records a -.I flush -routine that the library will call if a buffer overflows. -When printing to a file descriptor, the flush routine will -emit saved characters and reset the buffer; when printing -to an allocated string, it will resize the string to receive more output. -The flush routine is nil when printing to fixed-size buffers. -User code need never provide a flush routine; this is done internally -by the library. -.SS Custom output routines -To write a custom output routine, such as an error handler that -formats and prints custom error messages, the output sequence can be run -from outside the library using the routines described here. -There are two main cases: output to an open file descriptor -and output to a string. -.PP -To write to a file descriptor, call -.I fmtfdinit -to initialize the local -.B Fmt -structure -.IR f , -giving the file descriptor -.IR fd , -the buffer -.IR buf , -and its size -.IR nbuf . -Then call -.IR fmtprint -or -.IR fmtvprint -to generate the output. -These behave just like -.B fprint -(see -.IR print (3)) -or -.B vfprint -except that the characters are buffered until -.I fmtfdflush -is called. -A typical example of this sequence appears in the Examples section. -.PP -The same basic sequence applies when outputting to an allocated string: -call -.I fmtstrinit -to initialize the -.BR Fmt , -then call -.I fmtprint -and -.I fmtvprint -to generate the output. -Finally, -.I fmtstrflush -will return the allocated string, which should be freed after use. -Regardless of the output style or type, -.I fmtprint -or -.I fmtvprint -generates the characters. -.SS Custom format verbs -.I Fmtinstall -is used to install custom verbs and flags labeled by character -.IR c , -which may be any non-zero Unicode character. -.I Fn -should be declared as -.IP -.EX -int fn(Fmt*) -.EE -.PP -.IB Fp ->r -is the flag or verb character to cause -.I fn -to be called. -In -.IR fn , -.IB fp ->width , -.IB fp ->prec -are the width and precision, and -.IB fp ->flags -the decoded flags for the verb (see -.IR print (3) -for a description of these items). -The standard flag values are: -.B FmtSign -.RB ( + ), -.B FmtLeft -.RB ( - ), -.B FmtSpace -.RB ( '\ ' ), -.B FmtSharp -.RB ( # ), -.B FmtComma -.RB ( , ), -.B FmtLong -.RB ( l ), -.B FmtShort -.RB ( h ), -.B FmtByte -.RB ( hh ), -.B FmtUnsigned -.RB ( u ), -.B FmtLDouble -.RB ( L ), -and -.B FmtVLong -.RB ( ll ). -The flag bits -.B FmtWidth -and -.B FmtPrec -identify whether a width and precision were specified. -.PP -.I Fn -is passed a pointer to the -.B Fmt -structure recording the state of the output. -If -.IB fp ->r -is a verb (rather than a flag), -.I fn -should use -.B Fmt->args -to fetch its argument from the list, -then format it, and return zero. -If -.IB fp ->r -is a flag, -.I fn -should return a negative value: -the negation of one of the above flag values, or some otherwise unused power of two. -All interpretation of -.IB fp ->width\f1, -.IB fp ->prec\f1, -and -.IB fp-> flags -is left up to the conversion routine. -.I Fmtinstall -returns 0 if the installation succeeds, \-1 if it fails. -.PP -.IR Fmtprint -and -.IR fmtvprint -may be called to -help prepare output in custom conversion routines. -However, these functions clear the width, precision, and flags. -The function -.I dofmt -is the underlying formatter; it -uses the existing contents of -.B Fmt -and should be called only by sophisticated conversion routines. -All these routines return the number of characters -produced. -.PP -Some internal functions may be useful to format primitive types. -They honor the width, precision and flags as described in -.IR print (3). -.I Fmtrune -formats a single character -.BR r . -.I Fmtstrcpy -formats a string -.BR s . -All these routines return zero for successful execution. -.SH EXAMPLES -This function prints an error message with a variable -number of arguments and then quits. -Compared to the corresponding example in -.IR print (3), -this version uses a smaller buffer, will never truncate -the output message, but might generate multiple -.B write -system calls to produce its output. -.IP -.EX -.ta 6n +6n +6n +6n +6n +6n +6n +6n +6n - -void fatal(char *fmt, ...) -{ - Fmt f; - char buf[64]; - va_list arg; - - fmtfdinit(&f, 1, buf, sizeof buf); - fmtprint(&f, "fatal: "); - va_start(arg, fmt); - fmtvprint(&f, fmt, arg); - va_end(arg); - fmtprint(&f, "\en"); - fmtfdflush(&f); - exits("fatal error"); -} -.EE -.PP -This example adds a verb to print complex numbers. -.IP -.EX -typedef -struct { - double r, i; -} Complex; - -int -Xfmt(Fmt *f) -{ - Complex c; - - c = va_arg(f->args, Complex); - return fmtprint(f, "(%g,%g)", c.r, c.i); -} - -main(...) -{ - Complex x; - - x.r = 1.5; - x.i = -2.3; - - fmtinstall('X', Xfmt); - print("x = %X\en", x); -} -.EE -.SH SEE ALSO -.IR print (3) -.SH HISTORY -This formatted print library originally -appeared as part of the Plan 9 C library. -.SH BUGS -The Plan 9 version supports Unicode strings and produces UTF output. -This version assumes that characters are always represented by 1-byte values. blob - bb99a25ab4d41b82f60096fe078cf4374b5fa108 (mode 644) blob + /dev/null --- src/libfmt/mkfile +++ /dev/null @@ -1 +0,0 @@ -<../libutf/mkfile blob - 2cd51484bf4be5529d9cbc88c39f3ff7e00f85e1 (mode 644) blob + /dev/null --- src/libfmt/rpm.spec +++ /dev/null @@ -1,34 +0,0 @@ -Summary: Extensible formatted print library. (Printf with user-defined verbs.) -Name: libfmt -Version: 2.0 -Release: 1 -Group: Development/C -Copyright: BSD-like -Packager: Russ Cox -Source: http://pdos.lcs.mit.edu/~rsc/software/libfmt-2.0.tgz -URL: http://pdos.lcs.mit.edu/~rsc/software/#libfmt -Requires: libutf - -%description -Libfmt is a port of Plan 9's formatted print library. -As a base it provides all the syntax of ANSI printf -but adds the ability for client programs to install -new print verbs. One such print verb (installed by -default) is %r, which prints the system error string. -Instead of perror("foo"), you can write fprint(2, "foo: %r\n"). -This is especially nice when you write verbs to format -the data structures used by your particular program. -%prep -%setup - -%build -make - -%install -make install - -%files -/usr/local/include/fmt.h -/usr/local/lib/libfmt.a -/usr/local/man/man3/print.3 -/usr/local/man/man3/fmtinstall.3 blob - /dev/null blob + 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) --- /dev/null +++ src/Make.NetBSD-386 @@ -0,0 +1,7 @@ +CC=gcc +CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) +NAN=nan64.$O blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/libframe/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libframe/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/libframe/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/libframe/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libframe/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/libframe/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/libframe/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/libframe/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/libframe/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 81b73e983741d8711fa2a338c6368103409be0c3 blob + 979e4eb15429c1f03bbaaae5bcd5bf5cb3e2ab2e --- src/libframe/Makefile +++ src/libframe/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=libframe.a -VERSION=2.0 -PORTPLACE=devel/libframe -NAME=libdraw OFILES=\ frbox.$O\ @@ -34,59 +14,9 @@ OFILES=\ frstr.$O\ frutil.$O\ -all: $(LIB) +HFILES=\ + $(9SRC)/include/frame.h\ + $(9SRC)/include/draw.h\ -install: $(LIB) - install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - install -c -m 0644 frame.h $(PREFIX)/include/frame.h -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) +include $(9SRC)/Makesyslib -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I/usr/X11R6/include -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I/usr/X11R6/include -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - f7d29ece6a7f64f8410f81bc9f5a400f23d8ab8f (mode 644) blob + /dev/null --- src/libframe/Makefile.MID +++ /dev/null @@ -1,21 +0,0 @@ -LIB=libframe.a -VERSION=2.0 -PORTPLACE=devel/libframe -NAME=libdraw - -OFILES=\ - frbox.$O\ - frdelete.$O\ - frdraw.$O\ - frinit.$O\ - frinsert.$O\ - frptofchar.$O\ - frselect.$O\ - frstr.$O\ - frutil.$O\ - -all: $(LIB) - -install: $(LIB) - install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - install -c -m 0644 frame.h $(PREFIX)/include/frame.h blob - 9b8194b726b72bc69995dffd0600cc342f41ccf5 (mode 644) blob + /dev/null --- src/libframe/frame.h +++ /dev/null @@ -1,85 +0,0 @@ -typedef struct Frbox Frbox; -typedef struct Frame Frame; - -enum{ - BACK, - HIGH, - BORD, - TEXT, - HTEXT, - NCOL -}; - -#define FRTICKW 3 - -struct Frbox -{ - long wid; /* in pixels */ - long nrune; /* <0 ==> negate and treat as break char */ - uchar *ptr; - short bc; /* break char */ - short minwid; -}; - -struct Frame -{ - Font *font; /* of chars in the frame */ - Display *display; /* on which frame appears */ - Image *b; /* on which frame appears */ - Image *cols[NCOL]; /* text and background colors */ - Rectangle r; /* in which text appears */ - Rectangle entire; /* of full frame */ - void (*scroll)(Frame*, int); /* scroll function provided by application */ - Frbox *box; - ulong p0, p1; /* selection */ - ushort nbox, nalloc; - ushort maxtab; /* max size of tab, in pixels */ - ushort nchars; /* # runes in frame */ - ushort nlines; /* # lines with text */ - ushort maxlines; /* total # lines in frame */ - ushort lastlinefull; /* last line fills frame */ - ushort modified; /* changed since frselect() */ - Image *tick; /* typing tick */ - Image *tickback; /* saved image under tick */ - int ticked; /* flag: is tick onscreen? */ -}; - -ulong frcharofpt(Frame*, Point); -Point frptofchar(Frame*, ulong); -int frdelete(Frame*, ulong, ulong); -void frinsert(Frame*, Rune*, Rune*, ulong); -void frselect(Frame*, Mousectl*); -void frselectpaint(Frame*, Point, Point, Image*); -void frdrawsel(Frame*, Point, ulong, ulong, int); -void frdrawsel0(Frame*, Point, ulong, ulong, Image*, Image*); -void frinit(Frame*, Rectangle, Font*, Image*, Image**); -void frsetrects(Frame*, Rectangle, Image*); -void frclear(Frame*, int); - -uchar *_frallocstr(Frame*, unsigned); -void _frinsure(Frame*, int, unsigned); -Point _frdraw(Frame*, Point); -void _frgrowbox(Frame*, int); -void _frfreebox(Frame*, int, int); -void _frmergebox(Frame*, int); -void _frdelbox(Frame*, int, int); -void _frsplitbox(Frame*, int, int); -int _frfindbox(Frame*, int, ulong, ulong); -void _frclosebox(Frame*, int, int); -int _frcanfit(Frame*, Point, Frbox*); -void _frcklinewrap(Frame*, Point*, Frbox*); -void _frcklinewrap0(Frame*, Point*, Frbox*); -void _fradvance(Frame*, Point*, Frbox*); -int _frnewwid(Frame*, Point, Frbox*); -int _frnewwid0(Frame*, Point, Frbox*); -void _frclean(Frame*, Point, int, int); -void _frredraw(Frame*, Point); -void _fraddbox(Frame*, int, int); -Point _frptofcharptb(Frame*, ulong, Point, int); -Point _frptofcharnb(Frame*, ulong, int); -int _frstrlen(Frame*, int); -void frtick(Frame*, Point, int); -void frinittick(Frame*); - -#define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune) -#define NBYTE(b) strlen((char*)(b)->ptr) blob - bb99a25ab4d41b82f60096fe078cf4374b5fa108 (mode 644) blob + /dev/null --- src/libframe/mkfile +++ /dev/null @@ -1 +0,0 @@ -<../libutf/mkfile blob - /dev/null blob + 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) --- /dev/null +++ src/Make.OSF1-alpha @@ -0,0 +1,6 @@ +CC=cc +CFLAGS+=-g -c -I. +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/libregexp/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libregexp/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/libregexp/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/libregexp/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libregexp/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/libregexp/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/libregexp/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/libregexp/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/libregexp/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 498359a3e04b3425f1538a11c51af0c7549619c3 blob + 7e560b3c65b23765456457b71926ac33350eb528 --- src/libregexp/Makefile +++ src/libregexp/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=libregexp9.a -VERSION=2.0 -PORTPLACE=devel/libregexp9 -NAME=libregexp9 OFILES=\ regcomp.$O\ @@ -29,78 +9,19 @@ OFILES=\ regexec.$O\ regsub.$O\ regaux.$O\ - rregsub.$O\ rregaux.$O\ rregexec.$O\ + rregsub.$O\ HFILES=\ - regexp9.h\ + $(9SRC)/include/regexp9.h\ regcomp.h\ -all: $(LIB) +include $(9SRC)/Makesyslib -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - test -d $(PREFIX)/man/man7 || mkdir $(PREFIX)/man/man7 - install -m 0644 regexp9.3 $(PREFIX)/man/man3/regexp9.3 - install -m 0644 regexp9.7 $(PREFIX)/man/man7/regexp9.7 - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - install -m 0644 regexp9.h $(PREFIX)/include/regexp9.h - test: test.$O $(LIB) $(CC) -o test test.$O $(LIB) -L/usr/local/lib -lfmt -lutf test2: test2.$O $(LIB) $(CC) -o test2 test2.$O $(LIB) -L/usr/local/lib -lfmt -lutf -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - fa8a3a931e3d38f05609f8dd188391a195c4bb64 (mode 644) blob + /dev/null --- src/libregexp/Makefile.MID +++ /dev/null @@ -1,34 +0,0 @@ -LIB=libregexp9.a -VERSION=2.0 -PORTPLACE=devel/libregexp9 -NAME=libregexp9 - -OFILES=\ - regcomp.$O\ - regerror.$O\ - regexec.$O\ - regsub.$O\ - regaux.$O\ - rregsub.$O\ - rregaux.$O\ - -HFILES=\ - regexp9.h\ - regcomp.h\ - -all: $(LIB) - -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - test -d $(PREFIX)/man/man7 || mkdir $(PREFIX)/man/man7 - install -m 0644 regexp9.3 $(PREFIX)/man/man3/regexp9.3 - install -m 0644 regexp9.7 $(PREFIX)/man/man7/regexp9.7 - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - install -m 0644 regexp9.h $(PREFIX)/include/regexp9.h - -test: test.$O $(LIB) - $(CC) -o test test.$O $(LIB) -L/usr/local/lib -lfmt -lutf - -test2: test2.$O $(LIB) - $(CC) -o test2 test2.$O $(LIB) -L/usr/local/lib -lfmt -lutf - blob - 2205e4b94535176a1d4ec978df7cbded1ee482b2 (mode 644) blob + /dev/null --- src/libregexp/bundle.ports +++ /dev/null @@ -1,51 +0,0 @@ ---- Makefile --- -# New ports collection makefile for: libbio -# Date Created: 11 Feb 2003 -# Whom: rsc -# -# THIS LINE NEEDS REPLACING. IT'S HERE TO GET BY PORTLINT -# $FreeBSD: ports/devel/libbio/Makefile,v 1.1 2003/02/12 00:51:22 rsc Exp $ - -PORTNAME= libregexp9 -PORTVERSION= 2.0 -CATEGORIES= devel -MASTER_SITES= http://pdos.lcs.mit.edu/~rsc/software/ -EXTRACT_SUFX= .tgz - -MAINTAINER= rsc@post.harvard.edu - -DEPENDS= ${PORTSDIR}/devel/libfmt ${PORTSDIR}/devel/libutf - -MAN3= regexp9.3 -MAN7= regexp9.7 -USE_REINPLACE= yes - -.include - -post-patch: - ${REINPLACE_CMD} -e 's,$$(PREFIX),${PREFIX},g' ${WRKSRC}/Makefile - -.include ---- pkg-comment --- -Simple regular expression library from Plan 9 ---- pkg-descr --- -Libregexp9 is a port of Plan 9's regexp library. -It is small and simple and provides the traditional -extended regular expressions (as opposed to the -current extended regular expressions, which add {} -and various \x character classes, among other -complications). - -It handles Unicode in wide character or UTF8 format! - -WWW: http://pdos.lcs.mit.edu/~rsc/software/ -http://plan9.bell-labs.com/magic/man2html/2/regexp - -Russ Cox -rsc@post.harvard.edu ---- pkg-plist --- -lib/libregexp9.a -include/regex9.h ---- /dev/null --- -This is just a way to make sure blank lines don't -creep into pkg-plist. blob - bb99a25ab4d41b82f60096fe078cf4374b5fa108 (mode 644) blob + /dev/null --- src/libregexp/mkfile +++ /dev/null @@ -1 +0,0 @@ -<../libutf/mkfile blob - f26035625b810c723f12371267d3fc7e9b10afe2 (mode 644) blob + /dev/null --- src/libregexp/regexp9.3 +++ /dev/null @@ -1,227 +0,0 @@ -.TH REGEXP9 3 -.de EX -.nf -.ft B -.. -.de EE -.fi -.ft R -.. -.de LR -.if t .BR \\$1 \\$2 -.if n .RB ` \\$1 '\\$2 -.. -.de L -.nh -.if t .B \\$1 -.if n .RB ` \\$1 ' -.. -.SH NAME -regcomp, regcomplit, regcompnl, regexec, regsub, regerror \- Plan 9 regular expression library -.SH SYNOPSIS -.B #include -.PP -.ta \w'\fLRegprog 'u -.B -Reprog *regcomp(char *exp) -.PP -.B -Reprog *regcomplit(char *exp) -.PP -.B -Reprog *regcompnl(char *exp) -.PP -.nf -.B -int regexec(Reprog *prog, char *string, Resub *match, int msize) -.PP -.nf -.B -void regsub(char *source, char *dest, int dlen, Resub *match, int msize) -.PP -.nf -.B -int rregexec(Reprog *prog, Rune *string, Resub *match, int msize) -.PP -.nf -.B -void rregsub(Rune *source, Rune *dest, int dlen, Resub *match, int msize) -.PP -.B -void regerror(char *msg) -.SH DESCRIPTION -.I Regcomp -compiles a -regular expression and returns -a pointer to the generated description. -The space is allocated by -.IR malloc (3) -and may be released by -.IR free . -Regular expressions are exactly as in -.IR regexp9 (7). -.PP -.I Regcomplit -is like -.I regcomp -except that all characters are treated literally. -.I Regcompnl -is like -.I regcomp -except that the -.B . -metacharacter matches all characters, including newlines. -.PP -.I Regexec -matches a null-terminated -.I string -against the compiled regular expression in -.IR prog . -If it matches, -.I regexec -returns -.B 1 -and fills in the array -.I match -with character pointers to the substrings of -.I string -that correspond to the -parenthesized subexpressions of -.IR exp : -.BI match[ i ].sp -points to the beginning and -.BI match[ i ].ep -points just beyond -the end of the -.IR i th -substring. -(Subexpression -.I i -begins at the -.IR i th -left parenthesis, counting from 1.) -Pointers in -.B match[0] -pick out the substring that corresponds to -the whole regular expression. -Unused elements of -.I match -are filled with zeros. -Matches involving -.LR * , -.LR + , -and -.L ? -are extended as far as possible. -The number of array elements in -.I match -is given by -.IR msize . -The structure of elements of -.I match -is: -.IP -.EX -typedef struct { - union { - char *sp; - Rune *rsp; - } s; - union { - char *ep; - Rune *rep; - } e; -} Resub; -.EE -.LP -If -.B match[0].s.sp -is nonzero on entry, -.I regexec -starts matching at that point within -.IR string . -If -.B match[0].e.ep -is nonzero on entry, -the last character matched is the one -preceding that point. -.PP -.I Regsub -places in -.I dest -a substitution instance of -.I source -in the context of the last -.I regexec -performed using -.IR match . -Each instance of -.BI \e n\f1, -where -.I n -is a digit, is replaced by the -string delimited by -.BI match[ n ].s.sp -and -.BI match[ n ].e.ep\f1. -Each instance of -.L & -is replaced by the string delimited by -.B match[0].s.sp -and -.BR match[0].e.ep . -The substitution will always be null terminated and -trimmed to fit into dlen bytes. -.PP -.IR Regerror , -called whenever an error is detected in -.IR regcomp , -writes the string -.I msg -on the standard error file and exits. -.I Regerror -can be replaced to perform -special error processing. -If the user supplied -.I regerror -returns rather than exits, -.I regcomp -will return 0. -.PP -.I Rregexec -and -.I rregsub -are variants of -.I regexec -and -.I regsub -that use strings of -.B Runes -instead of strings of -.BR chars . -With these routines, the -.I rsp -and -.I rep -fields of the -.I match -array elements should be used. -.SH "SEE ALSO" -.IR grep (1), -.IR regexp9 (7) -.SH DIAGNOSTICS -.I Regcomp -returns -.B 0 -for an illegal expression -or other failure. -.I Regexec -returns 0 -if -.I string -is not matched. -.SH HISTORY -This particular regular expression was first written by Rob Pike for Plan 9. -It has also appeared as part of the Inferno operating system. -.SH BUGS -There is no way to specify or match a NUL character; NULs terminate patterns and strings. blob - 14a90d0f9360c11a6227473cc89264c5d96451d7 (mode 644) blob + /dev/null --- src/libregexp/regexp9.7 +++ /dev/null @@ -1,150 +0,0 @@ -.TH REGEXP9 7 -.de EX -.nf -.ft B -.. -.de EE -.fi -.ft R -.. -.de LR -.if t .BR \\$1 \\$2 -.if n .RB ` \\$1 '\\$2 -.. -.de L -.nh -.if t .B \\$1 -.if n .RB ` \\$1 ' -.. -.SH NAME -regexp9 \- Plan 9 regular expression notation -.SH DESCRIPTION -This manual page describes the regular expression -syntax used by the Plan 9 regular expression library -.IR regexp9 (3). -It is the form used by -.IR egrep (1) -before -.I egrep -got complicated. -.PP -A -.I "regular expression" -specifies -a set of strings of characters. -A member of this set of strings is said to be -.I matched -by the regular expression. In many applications -a delimiter character, commonly -.LR / , -bounds a regular expression. -In the following specification for regular expressions -the word `character' means any character (rune) but newline. -.PP -The syntax for a regular expression -.B e0 -is -.IP -.EX -e3: literal | charclass | '.' | '^' | '$' | '(' e0 ')' - -e2: e3 - | e2 REP - -REP: '*' | '+' | '?' - -e1: e2 - | e1 e2 - -e0: e1 - | e0 '|' e1 -.EE -.PP -A -.B literal -is any non-metacharacter, or a metacharacter -(one of -.BR .*+?[]()|\e^$ ), -or the delimiter -preceded by -.LR \e . -.PP -A -.B charclass -is a nonempty string -.I s -bracketed -.BI [ \|s\| ] -(or -.BI [^ s\| ]\fR); -it matches any character in (or not in) -.IR s . -A negated character class never -matches newline. -A substring -.IB a - b\f1, -with -.I a -and -.I b -in ascending -order, stands for the inclusive -range of -characters between -.I a -and -.IR b . -In -.IR s , -the metacharacters -.LR - , -.LR ] , -an initial -.LR ^ , -and the regular expression delimiter -must be preceded by a -.LR \e ; -other metacharacters -have no special meaning and -may appear unescaped. -.PP -A -.L . -matches any character. -.PP -A -.L ^ -matches the beginning of a line; -.L $ -matches the end of the line. -.PP -The -.B REP -operators match zero or more -.RB ( * ), -one or more -.RB ( + ), -zero or one -.RB ( ? ), -instances respectively of the preceding regular expression -.BR e2 . -.PP -A concatenated regular expression, -.BR "e1\|e2" , -matches a match to -.B e1 -followed by a match to -.BR e2 . -.PP -An alternative regular expression, -.BR "e0\||\|e1" , -matches either a match to -.B e0 -or a match to -.BR e1 . -.PP -A match to any part of a regular expression -extends as far as possible without preventing -a match to the remainder of the regular expression. -.SH "SEE ALSO" -.IR regexp9 (3) blob - e25658a35cecf85b926ed607106c792ba6e66613 (mode 644) blob + /dev/null --- src/libregexp/regexp9.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _REGEXP9H_ - -#define _REGEXP9H_ 1 -#include - -typedef struct Resub Resub; -typedef struct Reclass Reclass; -typedef struct Reinst Reinst; -typedef struct Reprog Reprog; - -/* - * Sub expression matches - */ -struct Resub{ - union - { - char *sp; - Rune *rsp; - }s; - union - { - char *ep; - Rune *rep; - }e; -}; - -/* - * character class, each pair of rune's defines a range - */ -struct Reclass{ - Rune *end; - Rune spans[64]; -}; - -/* - * Machine instructions - */ -struct Reinst{ - int type; - union { - Reclass *cp; /* class pointer */ - Rune r; /* character */ - int subid; /* sub-expression id for RBRA and LBRA */ - Reinst *right; /* right child of OR */ - }u1; - union { /* regexp relies on these two being in the same union */ - Reinst *left; /* left child of OR */ - Reinst *next; /* next instruction for CAT & LBRA */ - }u2; -}; - -/* - * Reprogram definition - */ -struct Reprog{ - Reinst *startinst; /* start pc */ - Reclass class[16]; /* .data */ - Reinst firstinst[5]; /* .text */ -}; - -extern Reprog *regcomp(char*); -extern Reprog *regcomplit(char*); -extern Reprog *regcompnl(char*); -extern void regerror(char*); -extern int regexec(Reprog*, char*, Resub*, int); -extern void regsub(char*, char*, int, Resub*, int); - -extern int rregexec(Reprog*, Rune*, Resub*, int); -extern void rregsub(Rune*, Rune*, Resub*, int); - -#endif blob - f4c92d66b803ee4ca301dfab3fa30035c64a6d78 (mode 644) blob + /dev/null --- src/libregexp/rpm.spec +++ /dev/null @@ -1,34 +0,0 @@ -Summary: Simple regular expression library from Plan 9 -Name: libregexp9 -Version: 2.0 -Release: 1 -Group: Development/C -Copyright: Public Domain -Packager: Russ Cox -Source: http://pdos.lcs.mit.edu/~rsc/software/libregexp9-2.0.tgz -URL: http://pdos.lcs.mit.edu/~rsc/software/#libregexp9 -Requires: libfmt libutf - -%description -Libregexp9 is a port of Plan 9's regexp library. -It is small and simple and provides the traditional -extended regular expressions (as opposed to the -current extended regular expressions, which add {} -and various \x character classes, among other -complications). - -http://plan9.bell-labs.com/magic/man2html/2/regexp -%prep -%setup - -%build -make - -%install -make install - -%files -/usr/local/include/regexp9.h -/usr/local/lib/libregexp9.a -/usr/local/man/man3/regexp9.3 -/usr/local/man/man7/regexp9.7 blob - /dev/null blob + c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) --- /dev/null +++ src/Make.SunOS-sun4u @@ -0,0 +1,2 @@ +include Make.SunOS-sun4u-$(CC) +NAN=nan64.$O blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/libthread/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libthread/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/libthread/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/libthread/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libthread/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/libthread/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/libthread/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/libthread/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/libthread/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - ebccc1ac5a6c06a482021fe8841d515f0bc64574 blob + cf9887946eed826f28e02fa49a3fe758637c5849 --- src/libthread/Makefile +++ src/libthread/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=libthread.a -VERSION=2.0 -PORTPLACE=devel/libthread -NAME=libthread OFILES=\ $(OBJTYPE).$O\ @@ -53,73 +33,17 @@ OFILES=\ sched.$O\ HFILES=\ - thread.h\ + $(9SRC)/include/thread.h\ label.h\ threadimpl.h\ -all: $(LIB) +include $(9SRC)/Makesyslib -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -m 0644 thread.3 $(PREFIX)/man/man3/thread.3 - install -m 0644 ioproc.3 $(PREFIX)/man/man3/ioproc.3 - install -m 0644 thread.h $(PREFIX)/include/thread.h - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) +tprimes: tprimes.$O + $(CC) -o tprimes tprimes.$O -L$(9SRC)/lib -lthread -l9 -lfmt -lutf -tprimes: $(LIB) tprimes.$O - $(CC) -o tprimes tprimes.$O $(LIB) -L$(PREFIX)/lib -l9 -lfmt -lutf - texec: $(LIB) texec.$O - $(CC) -o texec texec.$O $(LIB) -L$(PREFIX)/lib -l9 -lfmt -lutf + $(CC) -o texec texec.$O -L$(9SRC)/lib -lthread -l9 -lfmt -lutf -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) +CLEANFILES+=tprimes texec -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - 05c34167b53ca8db6547c98e126ccd4f943b54a2 (mode 644) blob + /dev/null --- src/libthread/Makefile.MID +++ /dev/null @@ -1,54 +0,0 @@ -LIB=libthread.a -VERSION=2.0 -PORTPLACE=devel/libthread -NAME=libthread - -OFILES=\ - $(OBJTYPE).$O\ - asm-$(SYSNAME)-$(OBJTYPE).$O\ - channel.$O\ - chanprint.$O\ - create.$O\ - debug.$O\ - exec-unix.$O\ - exit.$O\ - getpid.$O\ - id.$O\ - iocall.$O\ - ioclose.$O\ - ioopen.$O\ - ioproc.$O\ - ioread.$O\ - ioreadn.$O\ - iowrite.$O\ - kill.$O\ - lib.$O\ - main.$O\ - memset.$O\ - memsetd.$O\ - note.$O\ - proctab.$O\ - ref.$O\ - rendez.$O\ - sched.$O\ - -HFILES=\ - thread.h\ - label.h\ - threadimpl.h\ - -all: $(LIB) - -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -m 0644 thread.3 $(PREFIX)/man/man3/thread.3 - install -m 0644 ioproc.3 $(PREFIX)/man/man3/ioproc.3 - install -m 0644 thread.h $(PREFIX)/include/thread.h - install -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - -tprimes: $(LIB) tprimes.$O - $(CC) -o tprimes tprimes.$O $(LIB) -L$(PREFIX)/lib -l9 -lfmt -lutf - -texec: $(LIB) texec.$O - $(CC) -o texec texec.$O $(LIB) -L$(PREFIX)/lib -l9 -lfmt -lutf - blob - adfeb9047f3905f9daa169cccbbfe6691bdffb4c (mode 644) blob + /dev/null --- src/libthread/bundle.ports +++ /dev/null @@ -1,42 +0,0 @@ ---- Makefile --- -# New ports collection makefile for: libthread -# Date Created: 11 Feb 2003 -# Whom: rsc -# - -PORTNAME= libthread -PORTVERSION= 1.0 -CATEGORIES= devel -MASTER_SITES= http://pdos.lcs.mit.edu/~rsc/software/ -DISTNAME= libthread -EXTRACT_SUFX= .tgz - -MAINTAINER= rsc@post.harvard.edu - -MAN3= print.3 fmtinstall.3 -MLINKS= XXX -USE_REINPLACE= XXX (wkj says yes) - -.include - -post-patch: - ${REINPLACE_CMD} -e 's,@@LOCAL@@,${PREFIX},g' ${WRKSRC}/Makefile - -.include - ---- pkg-comment --- -Plan 9 thread library ---- pkg-descr --- -Libthread is a port of Plan 9's thread library. - -WWW: http://pdos.lcs.mit.edu/~rsc/software/ -WWW: http://plan9.bell-labs.com/magic/man2html/2/thread - -Russ Cox -rsc@post.harvard.edu ---- pkg-plist --- -lib/libthread.a -include/thread.h ---- /dev/null --- -This is just a way to make sure blank lines don't -creep into pkg-plist. blob - ab803a2cf87c2ecb28375788fec009d3dd0491b0 blob + 49e1572117d7ef635b20f2a670a4da14586b236b --- src/libthread/create.c +++ src/libthread/create.c @@ -1,6 +1,5 @@ #include "threadimpl.h" -#define free Pqueue _threadpq; static int nextID(void); blob - 1cada2de268c8218fb38b23db5efcb1abd370348 (mode 644) blob + /dev/null --- src/libthread/ioproc.3 +++ /dev/null @@ -1,179 +0,0 @@ -.TH IOPROC 2 -.SH NAME -closeioproc, -iocall, -ioclose, -iointerrupt, -iodial, -ioopen, -ioproc, -ioread, -ioreadn, -iowrite \- slave I/O processes for threaded programs -.SH SYNOPSIS -.PP -.de XX -.ift .sp 0.5 -.ifn .sp -.. -.EX -.ta \w'Ioproc* 'u -#include -#include -#include -.sp -typedef struct Ioproc Ioproc; -.sp -Ioproc* ioproc(void); -.XX -int ioopen(Ioproc *io, char *file, int omode); -int ioclose(Ioproc *io, int fd); -long ioread(Ioproc *io, int fd, void *a, long n); -long ioreadn(Ioproc *io, int fd, void *a, long n); -long iowrite(Ioproc *io, int fd, void *a, long n); -int iodial(Ioproc *io, char *addr, char *local, char *dir, char *cdfp); -.XX -void iointerrupt(Ioproc *io); -void closeioproc(Ioproc *io); -.XX -long iocall(Ioproc *io, long (*op)(va_list *arg), ...); -.EE -.SH DESCRIPTION -.PP -These routines provide access to I/O in slave procs. -Since the I/O itself is done in a slave proc, other threads -in the calling proc can run while the calling thread -waits for the I/O to complete. -.PP -.I Ioproc -forks a new slave proc and returns a pointer to the -.B Ioproc -associated with it. -.I Ioproc -uses -.I mallocz -and -.IR proccreate ; -if either fails, it calls -.I sysfatal -rather than return an error. -.PP -.IR Ioopen , -.IR ioclose , -.IR ioread , -.IR ioreadn , -.IR iowrite , -and -.IR iodial -are execute the -similarly named library or system calls -(see -.IR open (2), -.IR read (2), -and -.IR dial (2)) -in the slave process associated with -.IR io . -It is an error to execute more than one call -at a time in an I/O proc. -.PP -.I Iointerrupt -interrupts the call currently executing in the I/O proc. -If no call is executing, -.IR iointerrupt -is a no-op. -.PP -.I Closeioproc -terminates the I/O proc and frees the associated -.B Ioproc . -.PP -.I Iocall -is a primitive that may be used to implement -more slave I/O routines. -.I Iocall -arranges for -.I op -to be called in -.IR io 's -proc, with -.I arg -set to the variable parameter list, -returning the value that -.I op -returns. -.SH EXAMPLE -Relay messages between two file descriptors, -counting the total number of bytes seen: -.IP -.EX -.ta +\w'xxxx'u +\w'xxxx'u +\w'xxxx'u -int tot; - -void -relaythread(void *v) -{ - int *fd, n; - char buf[1024]; - Ioproc *io; - - fd = v; - io = ioproc(); - while((n = ioread(io, fd[0], buf, sizeof buf)) > 0){ - if(iowrite(io, fd[1], buf, n) != n) - sysfatal("iowrite: %r"); - tot += n; - } - closeioproc(io); -} - -void -relay(int fd0, int fd1) -{ - int fd[4]; - - fd[0] = fd[3] = fd0; - fd[1] = fd[2] = fd1; - threadcreate(relaythread, fd, 8192); - threadcreate(relaythread, fd+2, 8192); -} -.EE -.LP -If the two -.I relaythread -instances were running in different procs, the -common access to -.I tot -would be unsafe. -.EE -.PP -Implement -.IR ioread : -.IP -.EX -static long -_ioread(va_list *arg) -{ - int fd; - void *a; - long n; - - fd = va_arg(*arg, int); - a = va_arg(*arg, void*); - n = va_arg(*arg, long); - return read(fd, a, n); -} - -long -ioread(Ioproc *io, int fd, void *a, long n) -{ - return iocall(io, _ioread, fd, a, n); -} -.EE -.SH SOURCE -.B /sys/src/libthread/io*.c -.SH SEE ALSO -.IR dial (2), -.IR open (2), -.IR read (2), -.IR thread (2) - blob - 703f6b06d8e3b134af7b4f1b01b739e1b5a86593 (mode 644) blob + /dev/null --- src/libthread/mkfile +++ /dev/null @@ -1,2 +0,0 @@ -<../libutf/mkfile - blob - fdc72de213dd4f0e8ac0d1b66599d4a26b808adf (mode 644) blob + /dev/null --- src/libthread/rpm.spec +++ /dev/null @@ -1,26 +0,0 @@ -Summary: Port of Plan 9's thread library -Name: libthread -Version: 2.0 -Release: 1 -Group: Development/C -Copyright: BSD-like -Packager: Russ Cox -Source: http://pdos.lcs.mit.edu/~rsc/software/libthread-2.0.tgz -URL: http://pdos.lcs.mit.edu/~rsc/software/#libthread - -%description -Libthread is a port of Plan 9's thread library -%prep -%setup - -%build -make - -%install -make install - -%files -/usr/local/include/thread.h -/usr/local/lib/libthread.a -/usr/local/man/man3/thread.3 -/usr/local/man/man3/ioproc.3 blob - 3009ac8478712c799d758bfb93e7ef67825cdf5c (mode 644) blob + /dev/null --- src/libthread/thread.3 +++ /dev/null @@ -1,576 +0,0 @@ -.TH THREAD 2 -.SH NAME -alt, -chancreate, -chanfree, -chaninit, -chanprint, -mainstacksize, -proccreate, -procdata, -procexec, -procexecl, -procrfork, -recv, -recvp, -recvul, -send, -sendp, -sendul, -nbrecv, -nbrecvp, -nbrecvul, -nbsend, -nbsendp, -nbsendul, -threadcreate, -threaddata, -threadexits, -threadexitsall, -threadgetgrp, -threadgetname, -threadint, -threadintgrp, -threadkill, -threadkillgrp, -threadmain, -threadnotify, -threadid, -threadpid, -threadsetgrp, -threadsetname, -threadwaitchan, -yield \- thread and proc management -.SH SYNOPSIS -.PP -.EX -.ta 4n +4n +4n +4n +4n +4n +4n -#include -#include -#include -.sp -#define CHANEND 0 -#define CHANSND 1 -#define CHANRCV 2 -#define CHANNOP 3 -#define CHANNOBLK 4 -.sp -.ta \w' 'u +\w'Channel 'u -typedef struct Alt Alt; -struct Alt { - Channel *c; - void *v; - int op; - Channel **tag; - int entryno; -}; -.fi -.de XX -.ift .sp 0.5 -.ifn .sp -.. -.PP -.nf -.ft L -.ta \w'\fLChannel* 'u +4n +4n +4n +4n -void threadmain(int argc, char *argv[]) -int mainstacksize -int proccreate(void (*fn)(void*), void *arg, uint stacksize) -int procrfork(void (*fn)(void*), void *arg, uint stacksize, - int rforkflag) -int threadcreate(void (*fn)(void*), void *arg, uint stacksize) -void threadexits(char *status) -void threadexitsall(char *status) -void yield(void) -.XX -int threadid(void) -int threadgrp(void) -int threadsetgrp(int group) -int threadpid(int id) -.XX -int threadint(int id) -int threadintgrp(int group) -int threadkill(int id) -int threadkillgrp(int group) -.XX -void threadsetname(char *name) -char* threadgetname(void) -.XX -void** threaddata(void) -void** procdata(void) -.XX -int chaninit(Channel *c, int elsize, int nel) -Channel* chancreate(int elsize, int nel) -void chanfree(Channel *c) -.XX -int alt(Alt *alts) -int recv(Channel *c, void *v) -void* recvp(Channel *c) -ulong recvul(Channel *c) -int nbrecv(Channel *c, void *v) -void* nbrecvp(Channel *c) -ulong nbrecvul(Channel *c) -int send(Channel *c, void *v) -int sendp(Channel *c, void *v) -int sendul(Channel *c, ulong v) -int nbsend(Channel *c, void *v) -int nbsendp(Channel *c, void *v) -int nbsendul(Channel *c, ulong v) -int chanprint(Channel *c, char *fmt, ...) -.XX -int procexecl(Channel *cpid, char *file, ...) -int procexec(Channel *cpid, char *file, char *args[]) -Channel* threadwaitchan(void) -.XX -int threadnotify(int (*f)(void*, char*), int in) -.EE -.SH DESCRIPTION -.PP -The thread library provides parallel programming support similar to that -of the languages -Alef and Newsqueak. -Threads -and -procs -occupy a shared address space, -communicating and synchronizing through -.I channels -and shared variables. -.PP -A -.I proc -is a Plan 9 process that contains one or more cooperatively scheduled -.IR threads . -Programs using threads must replace -.I main -by -.IR threadmain . -The thread library provides a -.I main -function that sets up a proc with a single thread executing -.I threadmain -on a stack of size -.I mainstacksize -(default eight kilobytes). -To set -.IR mainstacksize , -declare a global variable -initialized to the desired value -.RI ( e.g. , -.B int -.B mainstacksize -.B = -.BR 1024 ). -.PP -.I Threadcreate -creates a new thread in the calling proc, returning a unique integer -identifying the thread; the thread -executes -.I fn(arg) -on a stack of size -.IR stacksize . -Thread stacks are allocated in shared memory, making it valid to pass -pointers to stack variables between threads and procs. -.I Procrfork -creates a new proc, and inside that proc creates -a single thread as -.I threadcreate -would, -returning the id of the created thread. -.I Procrfork -creates the new proc by calling -.B rfork -(see -.IR fork (2)) -with flags -.BR RFPROC|RFMEM|RFNOWAIT| \fIrforkflag\fR. -(The thread library depends on all its procs -running in the same rendezvous group. -Do not include -.B RFREND -in -.IR rforkflag .) -.I Proccreate -is identical to -.I procrfork -with -.I rforkflag -set to zero. -Be aware that the calling thread may continue -execution before -the newly created proc and thread -are scheduled. -Because of this, -.I arg -should not point to data on the stack of a function that could -return before the new process is scheduled. -.PP -.I Threadexits -terminates the calling thread. -If the thread is the last in its proc, -.I threadexits -also terminates the proc, using -.I status -as the exit status. -.I Threadexitsall -terminates all procs in the program, -using -.I status -as the exit status. -.PP -The threads in a proc are coroutines, scheduled nonpreemptively -in a round-robin fashion. -A thread must explicitly relinquish control of the processor -before another thread in the same proc is run. -Calls that do this are -.IR yield , -.IR proccreate , -.IR procexec , -.IR procexecl , -.IR threadexits , -.IR alt , -.IR send , -and -.I recv -(and the calls related to -.I send -and -.IR recv \(emsee -their descriptions further on). -Procs are scheduled by the operating system. -Therefore, threads in different procs can preempt one another -in arbitrary ways and should synchronize their -actions using -.B qlocks -(see -.IR lock (2)) -or channel communication. -System calls such as -.IR read (2) -block the entire proc; -all threads in a proc block until the system call finishes. -.PP -As mentioned above, each thread has a unique integer thread id. -Thread ids are not reused; they are unique across the life of the program. -.I Threadid -returns the id for the current thread. -Each thread also has a thread group id. -The initial thread has a group id of zero. -Each new thread inherits the group id of -the thread that created it. -.I Threadgrp -returns the group id for the current thread; -.I threadsetgrp -sets it. -.I Threadpid -returns the pid of the Plan 9 process containing -the thread identified by -.IR id , -or \-1 -if no such thread is found. -.PP -.I Threadint -interrupts a thread that is blocked in a channel operation -or system call. -.I Threadintgrp -interrupts all threads with the given group id. -.I Threadkill -marks a thread to die when it next relinquishes the processor -(via one of the calls listed above). -If the thread is blocked in a channel operation or system call, -it is also interrupted. -.I Threadkillgrp -kills all threads with the given group id. -Note that -.I threadkill -and -.I threadkillgrp -will not terminate a thread that never relinquishes -the processor. -.PP -Primarily for debugging, -threads can have string names associated with them. -.I Threadgetname -returns the current thread's name; -.I threadsetname -sets it. -The pointer returned by -.I threadgetname -is only valid until the next call to -.IR threadsetname . -.PP -.I Threaddata -returns a pointer to a per-thread pointer -that may be modified by threaded programs for -per-thread storage. -Similarly, -.I procdata -returns a pointer to a per-proc pointer. -.PP -.I Procexecl -and -.I procexec -are threaded analogues of -.I exec -and -.I execl -(see -.IR exec (2)); -on success, -they replace the calling thread (which must be the only thread in its proc) -and invoke the external program, never returning. -On error, they return \-1. -If -.I cpid -is not null, the pid of the invoked program -will be sent along -.I cpid -once the program has been started, or \-1 will be sent if an -error occurs. -.I Procexec -and -.I procexecl -will not access their arguments after sending a result -along -.IR cpid . -Thus, programs that malloc the -.I argv -passed to -.I procexec -can safely free it once they have -received the -.I cpid -response. -.I Threadwaitchan -returns a channel of pointers to -.B Waitmsg -structures (see -.IR wait (2)). -When an exec'ed process exits, a pointer to a -.B Waitmsg -is sent to this channel. -These -.B Waitmsg -structures have been allocated with -.IR malloc (2) -and should be freed after use. -.PP -A -.B Channel -is a buffered or unbuffered queue for fixed-size messages. -Procs and threads -.I send -messages into the channel and -.I recv -messages from the channel. If the channel is unbuffered, a -.I send -operation blocks until the corresponding -.I recv -operation occurs and -.IR "vice versa" . -.I Chaninit -initializes a -.B Channel -for messages of size -.I elsize -and with a buffer holding -.I nel -messages. -If -.I nel -is zero, the channel is unbuffered. -.IR Chancreate -allocates a new channel and initializes it. -.I Chanfree -frees a channel that is no longer used. -.I Chanfree -can be called by either sender or receiver after the last item has been -sent or received. Freeing the channel will be delayed if there is a thread -blocked on it until that thread unblocks (but -.I chanfree -returns immediately). -.PP -.I Send -sends the element pointed at by -.I v -to the channel -.IR c . -If -.I v -is null, zeros are sent. -.I Recv -receives an element from -.I c -and stores it in -.IR v . -If -.I v -is null, -the received value is discarded. -.I Send -and -.I recv -return 1 on success, \-1 if interrupted. -.I Nbsend -and -.I nbrecv -behave similarly, but return 0 rather than blocking. -.PP -.IR Sendp , -.IR nbsendp , -.IR sendul , -and -.I nbsendul -send a pointer or an unsigned long; the channel must -have been initialized with the appropriate -.IR elsize . -.IR Recvp , -.IR nbrecvp , -.IR recvul , -and -.I nbrecvul -receive a pointer or an unsigned long; -they return zero when a zero is received, -when interrupted, or -(for -.I nbrecvp -and -.IR nbrecvul ) -when the operation would have blocked. -To distinguish between these three cases, -use -.I recv -or -.IR nbrecv . -.PP -.I Alt -can be used to recv from or send to one of a number of channels, -as directed by an array of -.B Alt -structures, -each of which describes a potential send or receive operation. -In an -.B Alt -structure, -.B c -is the channel; -.B v -the value pointer (which may be null); and -.B op -the operation: -.B CHANSND -for a send operation, -.B CHANRECV -for a recv operation; -.B CHANNOP -for no operation -(useful -when -.I alt -is called with a varying set of operations). -The array of -.B Alt -structures is terminated by an entry with -.I op -.B CHANEND -or -.BR CHANNOBLK . -If at least one -.B Alt -structure can proceed, one of them is -chosen at random to be executed. -.I Alt -returns the index of the chosen structure. -If no operations can proceed and the list is terminated with -.BR CHANNOBLK , -.I alt -returns the index of the terminating -.B CHANNOBLK -structure. -Otherwise, -.I alt -blocks until one of the operations can proceed, -eventually returning the index of the structure executes. -.I Alt -returns \-1 when interrupted. -The -.B tag -and -.B entryno -fields in the -.B Alt -structure are used internally by -.I alt -and need not be initialized. -They are not used between -.I alt -calls. -.PP -.I Chanprint -formats its arguments in the manner of -.IR print (2) -and sends the result to the channel -.IR c. -The string delivered by -.I chanprint -is allocated with -.IR malloc (2) -and should be freed upon receipt. -.PP -Thread library functions do not return on failure; -if errors occur, the entire program is aborted. -.PP -Threaded programs should use -.I threadnotify -in place of -.I atnotify -(see -.IR notify (2)). -.PP -It is safe to use -.B sysfatal -(see -.IR perror (2)) -in threaded programs. -.I Sysfatal -will print the error string and call -.IR threadexitsall . -.PP -It is safe to use -.IR rfork -(see -.IR fork (2)) -to manage the namespace, file descriptors, note group, and environment of a -single process. -That is, it is safe to call -.I rfork -with the flags -.BR RFNAMEG , -.BR RFFDG , -.BR RFCFDG , -.BR RFNOTEG , -.BR RFENVG , -and -.BR RFCENVG. -(To create new processes, use -.I proccreate -and -.IR procrfork .) -As mentioned above, -the thread library depends on all procs being in the -same rendezvous group; do not change the rendezvous -group with -.IR rfork . -.SH FILES -.B /sys/lib/acid/thread -contains useful -.IR acid (1) -functions for debugging threaded programs. -.PP -.B /sys/src/libthread/example.c -contains a full example program. -.SH SOURCE -.B /sys/src/libthread -.SH SEE ALSO -.IR intro (2), -.IR ioproc (2) blob - 10aac284824e67af1bff25a3ed7d25090769550d (mode 644) blob + /dev/null --- src/libthread/thread.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef _THREADH_ -#define _THREADH_ 1 - -/* avoid conflicts with socket library */ -#undef send -#define send _threadsend -#undef recv -#define recv _threadrecv - -typedef struct Alt Alt; -typedef struct Channel Channel; -typedef struct Ref Ref; - -/* Channel structure. S is the size of the buffer. For unbuffered channels - * s is zero. v is an array of s values. If s is zero, v is unused. - * f and n represent the state of the queue pointed to by v. - */ - -enum { - Nqwds = 2, - Nqshift = 5, // 2log #of bits in long - Nqmask = - 1, - Nqbits = (1 << Nqshift) * 2, -}; - -struct Channel { - int s; // Size of the channel (may be zero) - unsigned int f; // Extraction point (insertion pt: (f + n) % s) - unsigned int n; // Number of values in the channel - int e; // Element size - int freed; // Set when channel is being deleted - volatile Alt **qentry; // Receivers/senders waiting (malloc) - volatile int nentry; // # of entries malloc-ed - unsigned char v[1]; // Array of s values in the channel -}; - - -/* Channel operations for alt: */ -typedef enum { - CHANEND, - CHANSND, - CHANRCV, - CHANNOP, - CHANNOBLK, -} ChanOp; - -struct Alt { - Channel *c; /* channel */ - void *v; /* pointer to value */ - ChanOp op; /* operation */ - - /* the next variables are used internally to alt - * they need not be initialized - */ - Channel **tag; /* pointer to rendez-vous tag */ - int entryno; /* entry number */ -}; - -struct Ref { - long ref; -}; - -int alt(Alt alts[]); -Channel* chancreate(int elemsize, int bufsize); -int chaninit(Channel *c, int elemsize, int elemcnt); -void chanfree(Channel *c); -int chanprint(Channel *, char *, ...); -long decref(Ref *r); /* returns 0 iff value is now zero */ -void incref(Ref *r); -int nbrecv(Channel *c, void *v); -void* nbrecvp(Channel *c); -unsigned long nbrecvul(Channel *c); -int nbsend(Channel *c, void *v); -int nbsendp(Channel *c, void *v); -int nbsendul(Channel *c, unsigned long v); -int proccreate(void (*f)(void *arg), void *arg, unsigned int stacksize); -int procrfork(void (*f)(void *arg), void *arg, unsigned int stacksize, int flag); -void** procdata(void); -void procexec(Channel *, char *, char *[]); -void procexecl(Channel *, char *, ...); -int recv(Channel *c, void *v); -void* recvp(Channel *c); -unsigned long recvul(Channel *c); -int send(Channel *c, void *v); -int sendp(Channel *c, void *v); -int sendul(Channel *c, unsigned long v); -int threadcreate(void (*f)(void *arg), void *arg, unsigned int stacksize); -void** threaddata(void); -void threadexits(char *); -void threadexitsall(char *); -int threadgetgrp(void); /* return thread group of current thread */ -char* threadgetname(void); -void threadint(int); /* interrupt thread */ -void threadintgrp(int); /* interrupt threads in grp */ -void threadkill(int); /* kill thread */ -void threadkillgrp(int); /* kill threads in group */ -void threadmain(int argc, char *argv[]); -void threadnonotes(void); -int threadnotify(int (*f)(void*, char*), int in); -int threadid(void); -int threadpid(int); -int threadsetgrp(int); /* set thread group, return old */ -void threadsetname(char *name); -Channel* threadwaitchan(void); -int tprivalloc(void); -void tprivfree(int); -void **tprivaddr(int); -void yield(void); - -long threadstack(void); - -extern int mainstacksize; - -/* slave I/O processes */ -typedef struct Ioproc Ioproc; - -Ioproc* ioproc(void); -void closeioproc(Ioproc*); -void iointerrupt(Ioproc*); - -int ioclose(Ioproc*, int); -int iodial(Ioproc*, char*, char*, char*, int*); -int ioopen(Ioproc*, char*, int); -long ioread(Ioproc*, int, void*, long); -long ioreadn(Ioproc*, int, void*, long); -long iowrite(Ioproc*, int, void*, long); -int iosleep(Ioproc*, long); - -long iocall(Ioproc*, long (*)(va_list*), ...); -void ioret(Ioproc*, int); - -#endif /* _THREADH_ */ blob - 52d6f05e21063ad5b8df8754e0e3ed6433fbbd03 (mode 755) blob + /dev/null Binary files src/libthread/tprimes and /dev/null differ blob - /dev/null blob + 829301de8649d40632eb809ae512598af11d48c5 (mode 644) --- /dev/null +++ src/Make.SunOS-sun4u-cc @@ -0,0 +1,6 @@ +CC=cc +CFLAGS+=-g -c -I. -O +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O blob - 14b8d4e7925867693d110c320d9c5a67dcd16758 (mode 644) blob + /dev/null --- src/libutf/Make.Darwin-PowerMacintosh +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I${PREFIX}/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libutf/Make.FreeBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - edbdc111a2a0c008975e297c7ca60e46199397a9 (mode 644) blob + /dev/null --- src/libutf/Make.HP-UX-9000 +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS=-O -c -Ae -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 74b0252c6eae6331b48ede7fcfa1ed760609d1a3 (mode 644) blob + /dev/null --- src/libutf/Make.Linux-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 087ed3abab5ea1bb549989f2c6abbae4ce024922 (mode 644) blob + /dev/null --- src/libutf/Make.NetBSD-386 +++ /dev/null @@ -1,7 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -I. -I$(PREFIX)/include -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O # default, can be overriden by Make.$(SYSNAME) -NAN=nan64.$O blob - 3d45279bba28dbe69c00f89568c444ab83a4ac72 (mode 644) blob + /dev/null --- src/libutf/Make.OSF1-alpha +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - c5fe67b82d86c731a56c101e522e804390e5bd5a (mode 644) blob + /dev/null --- src/libutf/Make.SunOS-sun4u +++ /dev/null @@ -1,2 +0,0 @@ -include Make.SunOS-sun4u-$(CC) -NAN=nan64.$O blob - 829301de8649d40632eb809ae512598af11d48c5 (mode 644) blob + /dev/null --- src/libutf/Make.SunOS-sun4u-cc +++ /dev/null @@ -1,6 +0,0 @@ -CC=cc -CFLAGS+=-g -c -I. -O -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) blob + /dev/null --- src/libutf/Make.SunOS-sun4u-gcc +++ /dev/null @@ -1,6 +0,0 @@ -CC=gcc -CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c -O=o -AR=ar -ARFLAGS=rvc -NAN=nan64.$O blob - 419a8a65d9afbe81326eecf9d2cc5c8201d373e3 blob + 648291a4b42725525bd24f819984a9edbf30b901 --- src/libutf/Makefile +++ src/libutf/Makefile @@ -1,27 +1,7 @@ +9SRC=.. +include $(9SRC)/Makehdr -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - LIB=libutf.a -VERSION=2.0 -PORTPLACE=devel/libutf -NAME=libutf OFILES=\ rune.$O\ @@ -46,67 +26,6 @@ OFILES=\ utfutf.$O\ HFILES=\ - utf.h\ + $(9SRC)/include/utf.h\ -all: $(LIB) - -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3 - install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7 - install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3 - install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3 - install -c -m 0644 utf.h $(PREFIX)/include/utf.h - install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) -.c.$O: - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports +include $(9SRC)/Makesyslib blob - ad852a1f5f623e197559cea654f752b868d9a127 (mode 644) blob + /dev/null --- src/libutf/Makefile.BOT +++ /dev/null @@ -1,47 +0,0 @@ -.c.$O: - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - -%.$O: %.c - $(CC) $(CFLAGS) -I/usr/X11R6/include -I../sam -I$(PREFIX)/include $*.c - - -$(OFILES): $(HFILES) - -tgz: - rm -rf $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - cp Makefile Make.* README LICENSE NOTICE *.[ch137] rpm.spec bundle.ports $(TGZFILES) $(NAME)-$(VERSION) - tar cf - $(NAME)-$(VERSION) | gzip >$(NAME)-$(VERSION).tgz - rm -rf $(NAME)-$(VERSION) - -clean: - rm -f $(OFILES) $(LIB) - -nuke: - rm -f $(OFILES) *.tgz *.rpm $(NUKEFILES) - -rpm: - make tgz - cp $(NAME)-$(VERSION).tgz /usr/src/RPM/SOURCES - rpm -ba rpm.spec - cp /usr/src/RPM/SRPMS/$(NAME)-$(VERSION)-1.src.rpm . - cp /usr/src/RPM/RPMS/i586/$(NAME)-$(VERSION)-1.i586.rpm . - scp *.rpm rsc@amsterdam.lcs.mit.edu:public_html/software - -PORTDIR=/usr/ports/$(PORTPLACE) - -ports: - make tgz - rm -rf $(PORTDIR) - mkdir $(PORTDIR) - cp $(NAME)-$(VERSION).tgz /usr/ports/distfiles - cat bundle.ports | (cd $(PORTDIR) && awk '$$1=="---" && $$3=="---" { ofile=$$2; next} {if(ofile) print >ofile}') - (cd $(PORTDIR); make makesum) - (cd $(PORTDIR); make) - (cd $(PORTDIR); /usr/local/bin/portlint) - rm -rf $(PORTDIR)/work - shar `find $(PORTDIR)` > ports.shar - (cd $(PORTDIR); tar cf - *) | gzip >$(NAME)-$(VERSION)-ports.tgz - scp *.tgz rsc@amsterdam.lcs.mit.edu:public_html/software - -.phony: all clean nuke install tgz rpm ports blob - a817fd3c602fad79918fe87b2601c35599bce965 (mode 644) blob + /dev/null --- src/libutf/Makefile.CMD +++ /dev/null @@ -1,5 +0,0 @@ - -$(TARG): $(OFILES) - $(CC) -o $(TARG) $(OFILES) -L$(PREFIX)/lib -lframe -ldraw -lthread -l9 -lregexp9 -lbio -lfmt -lutf -L/usr/X11R6/lib -lX11 -lm - - blob - 9ebf5606bf0dcb0f1d85b8531987061b7d5b00b3 (mode 644) blob + /dev/null --- src/libutf/Makefile.LIB +++ /dev/null @@ -1,4 +0,0 @@ -$(LIB): $(OFILES) - $(AR) $(ARFLAGS) $(LIB) $(OFILES) - -NUKEFILES+=$(LIB) blob - 9c142d44a7be8d74bb3b2b6a32eff62b2a641fff (mode 644) blob + /dev/null --- src/libutf/Makefile.MID +++ /dev/null @@ -1,41 +0,0 @@ -LIB=libutf.a -VERSION=2.0 -PORTPLACE=devel/libutf -NAME=libutf - -OFILES=\ - rune.$O\ - runestrcat.$O\ - runestrchr.$O\ - runestrcmp.$O\ - runestrcpy.$O\ - runestrdup.$O\ - runestrlen.$O\ - runestrecpy.$O\ - runestrncat.$O\ - runestrncmp.$O\ - runestrncpy.$O\ - runestrrchr.$O\ - runestrstr.$O\ - runetype.$O\ - utfecpy.$O\ - utflen.$O\ - utfnlen.$O\ - utfrrune.$O\ - utfrune.$O\ - utfutf.$O\ - -HFILES=\ - utf.h\ - -all: $(LIB) - -install: $(LIB) - test -d $(PREFIX)/man/man3 || mkdir $(PREFIX)/man/man3 - install -c -m 0644 isalpharune.3 $(PREFIX)/man/man3/isalpharune.3 - install -c -m 0644 utf.7 $(PREFIX)/man/man7/utf.7 - install -c -m 0644 rune.3 $(PREFIX)/man/man3/rune.3 - install -c -m 0644 runestrcat.3 $(PREFIX)/man/man3/runestrcat.3 - install -c -m 0644 utf.h $(PREFIX)/include/utf.h - install -c -m 0644 $(LIB) $(PREFIX)/lib/$(LIB) - blob - f6abc8c1d978dea6e7f45e638b92fb2417741042 (mode 644) blob + /dev/null --- src/libutf/Makefile.TOP +++ /dev/null @@ -1,20 +0,0 @@ - -# this works in gnu make -SYSNAME:=${shell uname} -OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} - -# this works in bsd make -SYSNAME!=uname -OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' - -# the gnu rules will mess up bsd but not vice versa, -# hence the gnu rules come first. - -include Make.$(SYSNAME)-$(OBJTYPE) - -PREFIX=/usr/local - -NUKEFILES= - -TGZFILES= - blob - d5ae00b62bac5da2ccadcfe6561a6dc5513f8b80 (mode 644) blob + /dev/null --- src/libutf/bundle.ports +++ /dev/null @@ -1,43 +0,0 @@ ---- Makefile --- -# New ports collection makefile for: libutf -# Date Created: 11 Feb 2003 -# Whom: rsc -# -# THIS LINE NEEDS REPLACING. IT'S HERE TO GET BY PORTLINT -# $FreeBSD: ports/devel/libfmt/Makefile,v 1.1 2003/02/12 00:51:22 rsc Exp $ - -PORTNAME= libutf -PORTVERSION= 2.0 -CATEGORIES= devel -MASTER_SITES= http://pdos.lcs.mit.edu/~rsc/software/ -EXTRACT_SUFX= .tgz - -MAINTAINER= rsc@post.harvard.edu - -MAN3= rune.3 runestrcat.3 isalpharune.3 -MAN7= utf.7 - -USE_REINPLACE=yes - -.include - -post-patch: - ${REINPLACE_CMD} -e 's,$$(PREFIX),${PREFIX},g' ${WRKSRC}/Makefile - -.include ---- pkg-comment --- -UTF8 support library from Plan 9 ---- pkg-descr --- -UTF8 support library from Plan 9. - -WWW: http://pdos.lcs.mit.edu/~rsc/software/#libutf -http://plan9.bell-labs.com/magic/man2html/3/rune - -Russ Cox -rsc@post.harvard.edu ---- pkg-plist --- -lib/libutf.a -include/utf.h ---- /dev/null --- -This is just a way to make sure blank lines don't -creep into pkg-plist. blob - f9f58cdeab383474bf922659265beb7134597940 (mode 644) blob + /dev/null --- src/libutf/isalpharune.3 +++ /dev/null @@ -1,47 +0,0 @@ -.TH ISALPHARUNE 3 -.SH NAME -isalpharune, islowerrune, isspacerune, istitlerune, isupperrune, tolowerrune, totitlerune, toupperrune \- Unicode character classes and cases -.SH SYNOPSIS -.B #include -.PP -.B -int isalpharune(Rune c) -.PP -.B -int islowerrune(Rune c) -.PP -.B -int isspacerune(Rune c) -.PP -.B -int istitlerune(Rune c) -.PP -.B -int isupperrune(Rune c) -.PP -.B -Rune tolowerrune(Rune c) -.PP -.B -Rune totitlerune(Rune c) -.PP -.B -Rune toupperrune(Rune c) -.SH DESCRIPTION -These routines examine and operate on Unicode characters, -in particular a subset of their properties as defined in the Unicode standard. -Unicode defines some characters as alphabetic and specifies three cases: -upper, lower, and title. -Analogously to -.IR ctype (3) -for -.SM ASCII\c -, -these routines -test types and modify cases for Unicode characters. -The names are self-explanatory. -.PP -The case-conversion routines return the character unchanged if it has no case. -.SH "SEE ALSO -.IR ctype (3) , -.IR "The Unicode Standard" . blob - 9893a06dc9aac52241fcc22360461472f56b4cbd (mode 644) blob + /dev/null --- src/libutf/mkfile +++ /dev/null @@ -1,9 +0,0 @@ -all:V: Makefile Make.FreeBSD-386 Make.Linux-386 Make.NetBSD-386 Make.HP-UX-9000 Make.OSF1-alpha \ - Make.SunOS-sun4u Make.SunOS-sun4u-cc Make.SunOS-sun4u-gcc \ - Make.Darwin-PowerMacintosh - -Makefile:D: ../libutf/Makefile.TOP Makefile.MID ../libutf/Makefile.LIB ../libutf/Makefile.BOT - cat $prereq >$target - -Make.%: ../libutf/Make.% - cp $prereq $target blob - 7412783345249a21979229b480036f9f7c5d8531 (mode 644) blob + /dev/null --- src/libutf/rpm.spec +++ /dev/null @@ -1,28 +0,0 @@ -Summary: Port of Plan 9's UTF8 support functions -Name: libutf -Version: 2.0 -Release: 1 -Group: Development/C -Copyright: Public Domain -Packager: Russ Cox -Source: http://pdos.lcs.mit.edu/~rsc/software/libutf-2.0.tgz -URL: http://pdos.lcs.mit.edu/~rsc/software/#libutf - -%description -Libutf is a port of Plan 9's UTF8 support functions. -%prep -%setup - -%build -make - -%install -make install - -%files -/usr/local/include/utf.h -/usr/local/lib/libutf.a -/usr/local/man/man3/runestrcat.3 -/usr/local/man/man3/isalpharune.3 -/usr/local/man/man3/rune.3 -/usr/local/man/man7/utf.7 blob - 7ce978aed6129fcddddd3f934d4cab541ba103f5 (mode 644) blob + /dev/null --- src/libutf/rune.3 +++ /dev/null @@ -1,187 +0,0 @@ -.TH RUNE 3 -.SH NAME -runetochar, chartorune, runelen, runenlen, fullrune, utfecpy, utflen, utfnlen, utfrune, utfrrune, utfutf \- rune/UTF conversion -.SH SYNOPSIS -.ta \w'\fLchar*xx'u -.B #include -.PP -.B -int runetochar(char *s, Rune *r) -.PP -.B -int chartorune(Rune *r, char *s) -.PP -.B -int runelen(long r) -.PP -.B -int runenlen(Rune *r, int n) -.PP -.B -int fullrune(char *s, int n) -.PP -.B -char* utfecpy(char *s1, char *es1, char *s2) -.PP -.B -int utflen(char *s) -.PP -.B -int utfnlen(char *s, long n) -.PP -.B -char* utfrune(char *s, long c) -.PP -.B -char* utfrrune(char *s, long c) -.PP -.B -char* utfutf(char *s1, char *s2) -.SH DESCRIPTION -These routines convert to and from a -.SM UTF -byte stream and runes. -.PP -.I Runetochar -copies one rune at -.I r -to at most -.B UTFmax -bytes starting at -.I s -and returns the number of bytes copied. -.BR UTFmax , -defined as -.B 3 -in -.BR , -is the maximum number of bytes required to represent a rune. -.PP -.I Chartorune -copies at most -.B UTFmax -bytes starting at -.I s -to one rune at -.I r -and returns the number of bytes copied. -If the input is not exactly in -.SM UTF -format, -.I chartorune -will convert to 0x80 and return 1. -.PP -.I Runelen -returns the number of bytes -required to convert -.I r -into -.SM UTF. -.PP -.I Runenlen -returns the number of bytes -required to convert the -.I n -runes pointed to by -.I r -into -.SM UTF. -.PP -.I Fullrune -returns 1 if the string -.I s -of length -.I n -is long enough to be decoded by -.I chartorune -and 0 otherwise. -This does not guarantee that the string -contains a legal -.SM UTF -encoding. -This routine is used by programs that -obtain input a byte at -a time and need to know when a full rune -has arrived. -.PP -The following routines are analogous to the -corresponding string routines with -.B utf -substituted for -.B str -and -.B rune -substituted for -.BR chr . -.PP -.I Utfecpy -copies UTF sequences until a null sequence has been copied, but writes no -sequences beyond -.IR es1 . -If any sequences are copied, -.I s1 -is terminated by a null sequence, and a pointer to that sequence is returned. -Otherwise, the original -.I s1 -is returned. -.PP -.I Utflen -returns the number of runes that -are represented by the -.SM UTF -string -.IR s . -.PP -.I Utfnlen -returns the number of complete runes that -are represented by the first -.I n -bytes of -.SM UTF -string -.IR s . -If the last few bytes of the string contain an incompletely coded rune, -.I utfnlen -will not count them; in this way, it differs from -.IR utflen , -which includes every byte of the string. -.PP -.I Utfrune -.RI ( utfrrune ) -returns a pointer to the first (last) -occurrence of rune -.I c -in the -.SM UTF -string -.IR s , -or 0 if -.I c -does not occur in the string. -The NUL byte terminating a string is considered to -be part of the string -.IR s . -.PP -.I Utfutf -returns a pointer to the first occurrence of -the -.SM UTF -string -.I s2 -as a -.SM UTF -substring of -.IR s1 , -or 0 if there is none. -If -.I s2 -is the null string, -.I utfutf -returns -.IR s1 . -.SH HISTORY -These routines were written by Rob Pike and Ken Thompson -and first appeared in Plan 9. -.SH SEE ALSO -.IR utf (7), -.IR tcs (1) blob - c012e59e54834ecdc151ffabc2372b2c095f79f5 (mode 644) blob + /dev/null --- src/libutf/runestrcat.3 +++ /dev/null @@ -1,65 +0,0 @@ -.TH RUNESTRCAT 3 -.SH NAME -runestrcat, -runestrncat, -runestrcmp, -runestrncmp, -runestrcpy, -runestrncpy, -runestrecpy, -runestrlen, -runestrchr, -runestrrchr, -runestrdup, -runestrstr \- rune string operations -.SH SYNOPSIS -.B #include -.PP -.ta \w'\fLRune* \fP'u -.B -Rune* runestrcat(Rune *s1, Rune *s2) -.PP -.B -Rune* runestrncat(Rune *s1, Rune *s2, long n) -.PP -.B -int runestrcmp(Rune *s1, Rune *s2) -.PP -.B -int runestrncmp(Rune *s1, Rune *s2, long n) -.PP -.B -Rune* runestrcpy(Rune *s1, Rune *s2) -.PP -.B -Rune* runestrncpy(Rune *s1, Rune *s2, long n) -.PP -.B -Rune* runestrecpy(Rune *s1, Rune *es1, Rune *s2) -.PP -.B -long runestrlen(Rune *s) -.PP -.B -Rune* runestrchr(Rune *s, Rune c) -.PP -.B -Rune* runestrrchr(Rune *s, Rune c) -.PP -.B -Rune* runestrdup(Rune *s) -.PP -.B -Rune* runestrstr(Rune *s1, Rune *s2) -.SH DESCRIPTION -These functions are rune string analogues of -the corresponding functions in -.IR strcat (3). -.SH HISTORY -These routines first appeared in Plan 9. -.SH SEE ALSO -.IR memmove (3), -.IR rune (3), -.IR strcat (2) -.SH BUGS -The outcome of overlapping moves varies among implementations. blob - 97b7b1e7147a5350d7d5e70db522d849595324f7 (mode 644) blob + /dev/null --- src/libutf/utf.7 +++ /dev/null @@ -1,91 +0,0 @@ -.TH UTF 7 -.SH NAME -UTF, Unicode, ASCII, rune \- character set and format -.SH DESCRIPTION -The Plan 9 character set and representation are -based on the Unicode Standard and on the ISO multibyte -.SM UTF-8 -encoding (Universal Character -Set Transformation Format, 8 bits wide). -The Unicode Standard represents its characters in 16 -bits; -.SM UTF-8 -represents such -values in an 8-bit byte stream. -Throughout this manual, -.SM UTF-8 -is shortened to -.SM UTF. -.PP -In Plan 9, a -.I rune -is a 16-bit quantity representing a Unicode character. -Internally, programs may store characters as runes. -However, any external manifestation of textual information, -in files or at the interface between programs, uses a -machine-independent, byte-stream encoding called -.SM UTF. -.PP -.SM UTF -is designed so the 7-bit -.SM ASCII -set (values hexadecimal 00 to 7F), -appear only as themselves -in the encoding. -Runes with values above 7F appear as sequences of two or more -bytes with values only from 80 to FF. -.PP -The -.SM UTF -encoding of the Unicode Standard is backward compatible with -.SM ASCII\c -: -programs presented only with -.SM ASCII -work on Plan 9 -even if not written to deal with -.SM UTF, -as do -programs that deal with uninterpreted byte streams. -However, programs that perform semantic processing on -.SM ASCII -graphic -characters must convert from -.SM UTF -to runes -in order to work properly with non-\c -.SM ASCII -input. -See -.IR rune (2). -.PP -Letting numbers be binary, -a rune x is converted to a multibyte -.SM UTF -sequence -as follows: -.PP -01. x in [00000000.0bbbbbbb] → 0bbbbbbb -.br -10. x in [00000bbb.bbbbbbbb] → 110bbbbb, 10bbbbbb -.br -11. x in [bbbbbbbb.bbbbbbbb] → 1110bbbb, 10bbbbbb, 10bbbbbb -.br -.PP -Conversion 01 provides a one-byte sequence that spans the -.SM ASCII -character set in a compatible way. -Conversions 10 and 11 represent higher-valued characters -as sequences of two or three bytes with the high bit set. -Plan 9 does not support the 4, 5, and 6 byte sequences proposed by X-Open. -When there are multiple ways to encode a value, for example rune 0, -the shortest encoding is used. -.PP -In the inverse mapping, -any sequence except those described above -is incorrect and is converted to rune hexadecimal 0080. -.SH "SEE ALSO" -.IR ascii (1), -.IR tcs (1), -.IR rune (3), -.IR "The Unicode Standard" . blob - 623bfda949c012d56e415408716a85fa0ad55004 (mode 644) blob + /dev/null --- src/libutf/utf.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _UTFH_ -#define _UTFH_ 1 - -typedef unsigned short Rune; /* 16 bits */ - -enum -{ - UTFmax = 3, /* maximum bytes per rune */ - Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */ - Runeself = 0x80, /* rune and UTF sequences are the same (<) */ - Runeerror = 0x80, /* decoding error in UTF */ -}; - -/* - * rune routines - */ -extern int runetochar(char*, Rune*); -extern int chartorune(Rune*, char*); -extern int runelen(long); -extern int runenlen(Rune*, int); -extern int fullrune(char*, int); -extern int utflen(char*); -extern int utfnlen(char*, long); -extern char* utfrune(char*, long); -extern char* utfrrune(char*, long); -extern char* utfutf(char*, char*); -extern char* utfecpy(char*, char*, char*); - -extern Rune* runestrcat(Rune*, Rune*); -extern Rune* runestrchr(Rune*, Rune); -extern int runestrcmp(Rune*, Rune*); -extern Rune* runestrcpy(Rune*, Rune*); -extern Rune* runestrncpy(Rune*, Rune*, long); -extern Rune* runestrecpy(Rune*, Rune*, Rune*); -extern Rune* runestrdup(Rune*); -extern Rune* runestrncat(Rune*, Rune*, long); -extern int runestrncmp(Rune*, Rune*, long); -extern Rune* runestrrchr(Rune*, Rune); -extern long runestrlen(Rune*); -extern Rune* runestrstr(Rune*, Rune*); - -extern Rune tolowerrune(Rune); -extern Rune totitlerune(Rune); -extern Rune toupperrune(Rune); -extern int isalpharune(Rune); -extern int islowerrune(Rune); -extern int isspacerune(Rune); -extern int istitlerune(Rune); -extern int isupperrune(Rune); - -#endif blob - /dev/null blob + 5c41594812a4a27eb848d384cbc356d206c0a44b (mode 644) --- /dev/null +++ src/Make.SunOS-sun4u-gcc @@ -0,0 +1,6 @@ +CC=gcc +CFLAGS+=-Wall -Wno-missing-braces -Wno-parentheses -Wno-switch -O2 -g -c +O=o +AR=ar +ARFLAGS=rvc +NAN=nan64.$O blob - /dev/null blob + 8fd27ca1d47e89d99cd9dbea15a43ee55797654a (mode 644) --- /dev/null +++ src/Makefile @@ -0,0 +1,19 @@ +DIRS=\ + lib9\ + libbio\ + libdraw\ + libfmt\ + libframe\ + libregexp\ + libthread\ + libutf\ + mk\ + sam\ + samterm\ + +clean all install: + for i in $(DIRS); \ + do \ + (echo $$i; cd $$i; $(MAKE) $*); \ + done + blob - /dev/null blob + ed2046045319ac8a0916a115030f072fbdaa8c62 (mode 644) --- /dev/null +++ src/Makehdr @@ -0,0 +1,21 @@ +# this works in gnu make +SYSNAME:=${shell uname} +OBJTYPE:=${shell uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g'} + +# this works in bsd make +SYSNAME!=uname +OBJTYPE!=uname -m | sed 's;i.86;386;; s;/.*;;; s; ;;g' + +# the gnu rules will mess up bsd but not vice versa, +# hence the gnu rules come first. + +X11=/usr/X11R6 +LDFLAGS= +CFLAGS= + +include $(9SRC)/Make.$(SYSNAME)-$(OBJTYPE) +LDFLAGS+=-L$(9SRC)/lib + +CLEANFILES=*.$O +NUKEFILES= + blob - /dev/null blob + d5ab84bb04fb2f1c81989350a8c09ffebfe13237 (mode 644) --- /dev/null +++ src/Makeone @@ -0,0 +1,10 @@ +$(TARG): $(OFILES) + $(CC) -o $(TARG) $(OFILES) $(LDFLAGS) + +CLEANFILES+=$(TARG) + +include $(9SRC)/Makecommon + +install: $(TARG) + cp $(TARG) $(9SRC)/bin + blob - /dev/null blob + 332f460432e9ee3b33b119449aaf3dbb1de00b17 (mode 644) --- /dev/null +++ src/Makesyslib @@ -0,0 +1,7 @@ +all: $(9SRC)/lib/$(LIB) + +$(9SRC)/lib/$(LIB): $(OFILES) + $(AR) $(ARFLAGS) $(9SRC)/lib/$(LIB) $(OFILES) + +include $(9SRC)/Makecommon +