Various fixes, add spell.

This commit is contained in:
rsc 2004-03-09 12:45:12 +00:00
parent fb7cc74a92
commit d49a2e4801
12 changed files with 1452 additions and 33 deletions

BIN
lib/amspell Normal file

Binary file not shown.

BIN
lib/brspell Normal file

Binary file not shown.

View file

@ -8,7 +8,7 @@ SHORTLIB=sec fs mux regexp9 thread bio 9
<$PLAN9/src/mkmany
BUGGERED='CVS|faces|factotum|oplumb|plumb2|mk|vac|9term|upas|venti|htmlfmt'
DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "$BUGGERED"`
DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "^($BUGGERED)$"`
<$PLAN9/src/mkdirs

28
src/cmd/spell/code.h Normal file
View file

@ -0,0 +1,28 @@
/*
* affix codes
*/
#define ED (1<<0) /* +ed, +ing */
#define ADJ (1<<1) /* (nce)-t_ce, +ize,+al, +ness, -t+cy, +ity, +ly */
#define NOUN (1<<2) /* +s (+es), +make, +hood, +ship +less */
#define PROP_COLLECT (1<<3) /* +'s, +an, +ship(for -manship) +less */
#define ACTOR (1<<4) /* +er */
#define EST (1<<5)
#define COMP (EST|ACTOR) /* +er,+est */
#define DONT_TOUCH (1<<6)
#define ION (1<<7) /* +ion, +or */
#define N_AFFIX (1<<8) /* +ic, +ive, +ize, +like, +al, +ful, +ism, +ist, -t+cy, +c (maniac) */
#define V_AFFIX (1<<9) /* +able, +ive, +ity((bility), +ment */
#define V_IRREG (1<<10) /* +ing +es +s*/
#define VERB (V_IRREG|ED)
#define MAN (1<<11) /* +man, +men, +women, +woman */
#define ADV (1<<12) /* +hood, +ness */
#define STOP (1<<14) /* stop list */
#define NOPREF (1<<13) /* no prefix */
#define MONO (1<<15) /* double final consonant as in fib->fibbing */
#define IN (1<<16) /* in- im- ir, not un- */
#define _Y (1<<17) /* +y */
#define ALL (~(NOPREF|STOP|DONT_TOUCH|MONO|IN)) /*anything goes (no stop or nopref)*/

12
src/cmd/spell/mkfile Normal file
View file

@ -0,0 +1,12 @@
PLAN9=../../..
<$PLAN9/src/mkhdr
TARG=sprog
OFILES=sprog.$O\
HFILES =\
code.h\
SHORTLIB=bio 9
<$PLAN9/src/mkone

21
src/cmd/spell/spell.rc Executable file
View file

@ -0,0 +1,21 @@
#!/bin/rc
spellflags=()
deroffargs=()
fflag=''
for(x){
switch($x){
case -[abcvx]
spellflags=($spellflags $x)
case -f
fflag=$x
case *
if(~ $fflag -f) {
spellflags=($spellflags -f $x)
fflag=''
}
if not deroffargs=($deroffargs $x)
}
}
deroff -w $deroffargs | sort -u | aux/sprog $spellflags

1381
src/cmd/spell/sprog.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -12,6 +12,8 @@
#include <libc.h>
#define EQ(a,b) ((tmp=a)==0?0:(strcmp(tmp,b)==0))
extern int isatty(int); /* <unistd.h> */
int ap;
int ac;
char **av;
@ -21,7 +23,6 @@ void synbad(char *, char *);
int fsizep(char *);
int isdir(char *);
int isreg(char *);
int isatty(int);
int isint(char *, int *);
int hasmode(char *, ulong);
int tio(char *, int);
@ -257,18 +258,6 @@ isreg(char *f)
return(!(dir.mode&DMDIR));
}
int
isatty(int fd)
{
Dir d1, d2;
if(localfstat(fd, &d1) < 0)
return 0;
if(localstat("/dev/cons", &d2) < 0)
return 0;
return d1.type==d2.type && d1.dev==d2.dev && d1.qid.path==d2.qid.path;
}
int
fsizep(char *f)
{

View file

@ -610,7 +610,7 @@ sendtype(int fd0)
}
print("no breakchar\n");
ntypebreak = 0;
cont2:
cont2:;
}
}

View file

@ -197,6 +197,7 @@ void _threadsysfatal(char*, va_list);
long _xdec(long*);
void _xinc(long*);
void _threadremove(Proc*, Thread*);
void threadstatus(void);
extern int _threaddebuglevel;
extern char* _threadexitsallstatus;

View file

@ -1,22 +1,10 @@
<mkhdr
BUGGERED="String|html|httpd|ip|venti"
LIBDIRS=`ls -ld lib* | sed -n 's/^d.* //p' |egrep -v "^lib($BUGGERED)$"`
DIRS=\
lib9\
libbin\
libbio\
libcomplete\
libdraw\
libflate\
libframe\
libfs\
# libhttpd\
# libip\
libmux\
libplumb\
libregexp\
libsec\
libthread\
# libventi\
$LIBDIRS\
cmd\
<mkdirs

View file

@ -156,10 +156,9 @@ cd libregexp
9c regexec.c
9c regsub.c
9c regaux.c
9c rregaux.c
9c rregexec.c
9c rregsub.c
9ar rvc ../../lib/libregexp9.a regcomp.o regerror.o regexec.o regsub.o regaux.o rregaux.o rregexec.o rregsub.o
9ar rvc ../../lib/libregexp9.a regcomp.o regerror.o regexec.o regsub.o regaux.o rregexec.o rregsub.o
cd ..
cd cmd/mk
9c arc.c