[comp.windows.news] pspp version 0.08

siegel@hc.DSPO.GOV (josh Siegel) (06/01/89)

I am posting this again because there have started to be versions
floating around I didn't write.  Anyhow, all patches should be
sent against this.

It still HAS BUGS but it also seems to be safe against code.

Also, if it core dumps, pass the code through "fold -1000" first.  Lots
of mac programs dump out PS files that have 10,000 character long lines and
lex doesn't bother to check to see if it is over-running the buffers.

				--Josh Siegel

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	pspp
# This archive created: Tue Feb 14 11:41:08 1989
export PATH; PATH=/bin:$PATH
if test ! -d 'pspp'
then
	echo shar: creating directory "'pspp'"
	mkdir 'pspp'
fi
echo shar: entering directory "'pspp'"
cd 'pspp'
echo shar: extracting "'pspp.l'" '(15885 characters)'
if test -f 'pspp.l'
then
	echo shar: will not over-write existing file "'pspp.l'"
else
sed 's/^	X//' << \SHAR_EOF > 'pspp.l'
	X
	X%{
	X
	X/*
	X
	X                    Copyright (c) 1989, Josh Siegel
	X
	XYou may copy the pspp kit in whole or in part as long as you don't try to
	Xmake money off it, or pretend that you wrote it.
	X
	X Version 0.08
	X    Fixed another core dump problem with lines that were toooo long.
	X    Fixed another comment problem.
	X
	X Version 0.07
	X    Fixed two more comment bugs.
	X    Fixed a core dump when I get a string over BUFSIZ (stdio.h) long.
	X
	X Version 0.06
	X    Fixed comment lines getting stuck together (bug by Dave Yost).
	X
	X Version 0.05
	X    Removed some code that wasn't needed.
	X    Fixed a "cdef" indentation problem
	X    Added a manual page
	X    Added ptags function
	X
	X Version 0.04
	X    Fixed a fix in 0.03
	X    Made it callable on files and sets of files.
	X
	X Version 0.03
	X    Fixed run away white space problem...
	X    Fixed (()) matching
	X    Fixed it turning (\(\)) into (\\(\\))
	X
	X Version 0.02
	X    Added bracstack as well as fixing problems associated with class.ps
	X
	X Version 0.01
	X    initial release
	X*/
	X
	X#define FLAG_BA        0x1
	X#define FLAG_BB        0x2
	X#define FLAG_BS        0x4
	X#define FLAG_CBA    0x8
	X#define FLAG_CBB    0x10
	X#define FLAG_CEA    0x20
	X#define FLAG_CEB    0x40
	X#define FLAG_DA        0x80
	X#define FLAG_DB        0x100
	X#define FLAG_DBA    0x200
	X#define FLAG_DBB    0x400
	X#define FLAG_DEA    0x800
	X#define FLAG_DEB    0x1000
	X#define FLAG_EA        0x2000
	X#define FLAG_EB        0x4000
	X#define FLAG_LCA    0x8000
	X#define FLAG_LCB    0x10000
	X#define FLAG_RCA    0x20000
	X#define FLAG_RCB    0x40000
	X#define FLAG_PN        0x80000
	X#define FLAG_IB        0x100000
	X#define FLAG_IA        0x200000
	X#define FLAG_LBB    0x400000
	X#define FLAG_LBA    0x800000
	X#define FLAG_RBB    0x1000000
	X#define FLAG_RBA    0x2000000
	X#define FLAG_GSB    0x4000000
	X#define FLAG_GSA    0x8000000
	X#define FLAG_GRB    0x10000000
	X#define FLAG_GRA    0x20000000
	X#define FLAG_GI        0x40000000
	X#define FLAG_RA     0x80000000
	X
	X#define DEFAULT_FLAG (FLAG_BA|FLAG_BB|FLAG_BS|FLAG_CBA|FLAG_CBB|\
	X        FLAG_CEA|FLAG_CEB|FLAG_DA|FLAG_DBA|FLAG_DBB|FLAG_DEA|\
	X        FLAG_DEB|FLAG_EA|FLAG_EB|FLAG_LCA|FLAG_RCB| \
	X        FLAG_PN | FLAG_IA | FLAG_GI)
	X
	X#define check_flag(x) ((x) & flags)
	X
	X#define STACK_LEVELS 32
	X
	Xint neednew,i,level,braclevel,flags,minlevel;
	Xint bracstack[STACK_LEVELS],bracpnt;
	Xchar *fname;
	X%}
	XW    [ \t]+    
	X%s PTAGS PSPP NEVER
	X%%
	X<PSPP>\(        {
	X            int pcount;
	X
	X            pcount=1;
	X            i = 1;
	X
	X            while(pcount) {
	X                yytext[i]=input();
	X                switch(yytext[i]) {
	X                    case '\\':
	X                        i++;
	X                        yytext[i]=input();
	X                        break;
	X                    case '(': 
	X                        pcount++; 
	X                        if(check_flag(FLAG_BS)) {
	X                            yytext[i++]='\\';
	X                            yytext[i]='(';
	X                        }
	X                        break;
	X                    case ')': 
	X                        pcount--; 
	X                        if(pcount) {
	X                            if(check_flag(FLAG_BS)) {
	X                                yytext[i++]='\\';
	X                                yytext[i]=')';
	X                            }
	X                        }
	X                        break;
	X                    case '\n':
	X                        yytext[i++]='\\';
	X                        yytext[i]='n';
	X                        break;
	X                    default: break;
	X                }
	X                i++;
	X				if(i >= BUFSIZ-1) {
	X            		yytext[i]= '\0';
	X            		newline();
	X            		fprintf(yyout,"%s",yytext);
	X					i = 0;
	X				}
	X            }
	X            yytext[i]= '\0';
	X            newline();
	X            fprintf(yyout,"%s",yytext);
	X        }
	X
	X<PSPP>\{[ \t]*\}    { /* Yet another special case */ 
	X		newline(); 
	X		fprintf(yyout,yytext); 
	X	}
	X
	X<PSPP>"def"    { /* Rule 3 */
	X                if(check_flag(FLAG_DB))  
	X                    neednew=1;
	X                newline(); 
	X                fprintf(yyout,"%s",yytext);
	X                if(check_flag(FLAG_DA)) 
	X                    neednew=1;
	X        }
	X
	X<PSPP>"{"    { /* Rule 4 */
	X        if(check_flag(FLAG_LCB))
	X            neednew=1;
	X        newline();
	X        level++;
	X        pushbraclevel();
	X        fprintf(yyout,"%s",yytext);
	X        if(check_flag(FLAG_LCA))
	X            neednew=1;
	X    }
	X
	X<PSPP>"}"    { /* rule 5 */
	X    if(check_flag(FLAG_RCB))
	X        neednew=1;
	X    level--;
	X    popbraclevel();
	X    newline();
	X    fprintf(yyout,"%s",yytext);
	X    if(check_flag(FLAG_RCA))
	X        neednew=1;
	X    }
	X
	X<PSPP>"begin"|"dictbegin"|"classbegin"|"["|"gsave"    { /* Rule 6 */
	X                switch(yytext[0]) {
	X                case 'd':
	X                    if(check_flag(FLAG_DBB))
	X                        neednew=1;
	X                    break;
	X                case 'b':
	X                    if(check_flag(FLAG_BB))
	X                        neednew=1;
	X                    break;
	X                case 'c':
	X                    if(check_flag(FLAG_CBB))
	X                        neednew=1;
	X                    break;
	X                case 'g':
	X                    if(check_flag(FLAG_GSB))
	X                        neednew=1;
	X                    break;
	X                case '[':
	X                    if(check_flag(FLAG_LBB))
	X                        neednew=1;
	X                    break;
	X                }
	X                newline();
	X            
	X                fprintf(yyout,"%s",yytext);
	X                braclevel++;
	X                switch(yytext[0]) {
	X                case 'd':
	X                    if(check_flag(FLAG_DBA))
	X                        neednew=1;
	X                    break;
	X                case 'b':
	X                    if(check_flag(FLAG_BA))
	X                        neednew=1;
	X                    break;
	X                case 'c':
	X                    if(check_flag(FLAG_CBA))
	X                        neednew=1;
	X                    break;
	X                case 'g':
	X                    if(check_flag(FLAG_GSA)) 
	X                        neednew=1;
	X                    if(!check_flag(FLAG_GI))
	X                        braclevel--;
	X                    break;
	X                case '[':
	X                    if(check_flag(FLAG_LBA))
	X                        neednew=1;
	X                    break;
	X                }
	X            }
	X
	X
	X<PSPP>"end"|"dictend"|"classend"|"]"|"grestore"     { /* Rule 7 */
	X                braclevel--;
	X                switch(yytext[0]) {
	X                case 'd':
	X                    if(check_flag(FLAG_DEB))
	X                        neednew=1;
	X                    break;
	X                case 'e':
	X                    if(check_flag(FLAG_EB))
	X                        neednew=1;
	X                    break;
	X                case 'c':
	X                    if(check_flag(FLAG_CEB))
	X                        neednew=1;
	X                    break;
	X                case 'g':
	X                    if(check_flag(FLAG_GRB))
	X                        neednew=1;
	X                    if(!check_flag(FLAG_GI))
	X                        braclevel++;
	X                    break;
	X                case ']':
	X                    if(check_flag(FLAG_RBB)) 
	X                        neednew=1;
	X                    break;
	X                }
	X
	X                newline();
	X                fprintf(yyout,"%s",yytext);
	X                switch(yytext[0]) {
	X                case 'd':
	X                    if(check_flag(FLAG_DEA))
	X                        neednew=1;
	X                    break;
	X                case 'e':
	X                    if(check_flag(FLAG_EA))
	X                        neednew=1;
	X                    break;
	X                case 'c':
	X                    if(check_flag(FLAG_CEA))
	X                        neednew=1;
	X                    break;
	X                case 'g':
	X                    if(check_flag(FLAG_GRA))
	X                        neednew=1;
	X                    break;
	X                case ']':
	X                    if(check_flag(FLAG_RBA))
	X                        neednew=1;
	X                    break;
	X                }
	X            }
	X
	X<PSPP>(if|ifelse)            { /* Rule 8 */
	X
	X                if(check_flag(FLAG_IB)) 
	X                    neednew=1;
	X                newline(); 
	X                fprintf(yyout,"%s",yytext);
	X                if(check_flag(FLAG_IA))  
	X                    neednew=1;
	X                }
	X<PSPP>^cdef    {
	X            level=0;
	X            minlevel=0;
	X            braclevel=0; /* Reset the bracket level */
	X            bracpnt=0;  /* Reset the stack */
	X            newline();
	X            fprintf(yyout,"%s",yytext);
	X            level=1; /* Indent one so it looks ncie */
	X            minlevel=1;
	X        }
	X<PSPP>^\%\%=.*\n    { /* rule 10 */
	X                if(neednew) 
	X                    fprintf(yyout,"\n");
	X                yytext[yyleng-1]='\0';
	X                fprintf(yyout,"%s",yytext);
	X                parseflag(&yytext[3]);
	X                neednew=1;
	X            }
	X<PSPP>[ \t]*\%.*    { /* 11 */
	X           /* yytext[yyleng-1]='\0'; */
	X            fprintf(yyout,"%s",yytext);
	X            neednew=1;
	X		}
	X<PSPP>^#.*\n    | /* 12 */
	X<PSPP>^\%.*\n    { /* 13 */
	X            if(neednew) 
	X                fprintf(yyout,"\n");
	X            yytext[yyleng-1]='\0';
	X            fprintf(yyout,"%s",yytext);
	X            neednew=1;
	X        }
	X<PSPP>^[ \t]+\%.*\n {    
	X                char *p;
	X
	X                newline();
	X                yytext[yyleng-1]='\0';
	X                p = yytext;
	X                while(*p!='%') p++;
	X                fprintf(yyout,"%s",p);
	X                neednew=1;
	X                }
	X<PSPP>^{W}       neednew=1;
	X<PSPP>{W}       fprintf(yyout," ");
	X<PSPP>^[ \t]*\n    { if(check_flag(FLAG_PN)) fprintf(yyout,"\n");}
	X<PSPP>\n        neednew=1;
	X
	X<PSPP>[^ \t\n\[\]\{\}\(] {newline();
	X            fprintf(yyout,"%s",yytext);
	X            ; /* Almost everything falls to this */ }
	X<PTAGS>^cdef.*$    {
	X			char buff[255],*p;
	X
	X			sscanf(yytext,"cdef %s(",buff);
	X 			p = (char *) index(buff,'(');
	X			if(p) *p = '\0';
	X
	X			conv(yytext);
	X			fprintf(yyout,"%s	%s	/^%s$/\n",buff,fname,yytext);
	X        }
	X<PTAGS>^.*\%.*\ptag=<.*\>.*$	{
	X			char *p, buff[255];
	X
	X			p = (char *) index(yytext,'%');
	X			p = (char *) index(p,'<');
	X			strcpy(buff,p+1);
	X			p = (char *) index(buff,'>');
	X			*p = '\0';
	X			conv(yytext);
	X			fprintf(yyout,"%s	%s	/^%s$/\n",buff,fname,yytext);
	X		}
	X<PTAGS>\n	;
	X<PTAGS>.	;
	X%%
	X
	Xchar           *ptag_file;
	Xchar           *progname;
	X
	Xmain(argc, argv)
	X	int             argc;
	X	char           *argv[];
	X{
	X	FILE           *fp, *fopen(), *fpo;
	X	char            buff[255], *p, *p2;
	X	int             do_stdin;
	X
	X	extern int      opterr;
	X	extern char    *optarg;
	X 	extern int optind;
	X	int             c,i;
	X
	X
	X	do_stdin = 1;
	X	bracpnt = 0;
	X	neednew = 0;
	X	level = 0;
	X	braclevel = 0;
	X	minlevel = 0;
	X	flags = DEFAULT_FLAG;
	X
	X	p = argv[0];
	X	p2 = p;
	X
	X	while (*p2) {
	X		if (*p2 == '/')
	X			p = p2 + 1;
	X		p2++;
	X	}
	X
	X	if (!strcmp(p, "ptags")) {
	X		BEGIN           PTAGS;
	X
	X		ptag_file = "tags.ps";
	X
	X		while ((c = getopt(argc, argv, "f:")) != EOF)
	X			switch (c) {
	X			case 'f':
	X				ptag_file = optarg;
	X				break;
	X			case '?':
	X				usage();
	X				break;
	X			}
	X
	X
	X		argc -= optind;
	X    	argv += optind;
	X
	X		i = 0;
	X
	X		sprintf(buff,"%s.tmp",ptag_file);
	X
	X		fpo = fopen(buff, "w");
	X
	X		yyout = fpo;
	X
	X		while (i!=argc) {
	X			if(argv[i][0] !='-') {
	X				do_stdin = 0;
	X				fp = fopen(argv[i], "r");
	X				fname = argv[i];
	X				yyin = fp;
	X				yylex();
	X				fclose(fp);
	X			}
	X			i++;
	X		}
	X
	X		if (do_stdin) {
	X			yylex();
	X			fprintf(yyout, "\n");
	X		}
	X
	X		fclose(fpo);
	X		sprintf(buff,"sort < %s.tmp > %s",ptag_file,ptag_file);
	X		system(buff);
	X		sprintf(buff,"%s.tmp",ptag_file);
	X		unlink(buff);
	X	} else {
	X		BEGIN           PSPP;
	X
	X		sprintf(buff, "%s/.pspp", getenv("HOME"));
	X
	X		fp = fopen(buff, "r");
	X
	X		if (fp != NULL) {
	X			while (fgets(buff, 255, fp) != NULL)
	X				parseflag(buff);
	X			fclose(fp);
	X		}
	X		while (--argc) {
	X			if (argv[argc][0] == '-' || argv[argc][0] == '+')
	X				parseflag(argv[argc]);
	X			else {
	X				do_stdin = 0;
	X
	X				sprintf(buff, "%s.BAK", argv[argc]);
	X				unlink(buff);
	X				if (rename(argv[argc], buff) != 0) {
	X					perror("rename");
	X					exit(0);
	X				}
	X				fpo = fopen(argv[argc], "w");
	X				fp = fopen(buff, "r");
	X				yyin = fp;
	X				yyout = fpo;
	X				yylex();
	X				fprintf(fpo, "\n");
	X				fclose(fp);
	X				fclose(fpo);
	X			}
	X		}
	X		if (do_stdin) {
	X			yylex();
	X			fprintf(yyout, "\n");
	X		}
	X	}
	X
	X	exit(0);
	X}
	Xconv(str)
	Xchar *str;
	X{
	X    char buff[255],*p,*p2;
	X
	X    p = str;
	X    p2 = buff;
	X    while(*p) {
	X        if(*p=='/')
	X            *p2++ = '\\';
	X        *p2++ = *p++;
	X    }
	X	*p2='\0';
	X    strcpy(str,buff);
	X}
	Xusage()
	X{
	X	fprintf(stderr, "Usage: ptags [ -f tagfile ]\n");
	X	exit(1);
	X}
	Xnewline()
	X{
	X	int             cnt;
	X
	X	if (!neednew)
	X		return;
	X
	X	fprintf(yyout, "\n");
	X
	X	if (level < minlevel)	/* Save ourselves from errors in the
	X				 * postscript */
	X		level = minlevel;
	X
	X	if (bracpnt > 0) {
	X		if (braclevel < bracstack[bracpnt - 1])
	X			braclevel = bracstack[bracpnt - 1];
	X	} else {
	X		if (braclevel < 0)
	X			braclevel = 0;
	X	}
	X
	X	cnt = level + braclevel;
	X
	X	while (cnt--)
	X		fprintf(yyout, "    ");
	X
	X	neednew = 0;
	X}
	Xparseflag(str)
	X	char           *str;
	X{
	X	char           *p;
	X	int             effect, the_flag;
	X
	X
	X	p = str;
	X
	X
	X	while (*p) {
	X		while (*p == ' ' || *p == '\t')
	X			p++;
	X
	X		effect = 1;	/* Set flag (default) */
	X		the_flag = 0;
	X
	X		switch (*p) {
	X		case '+':
	X			p++;
	X			break;
	X		case '-':
	X			effect = 0;
	X			p++;
	X			break;
	X		default:
	X			return;
	X			break;
	X		}
	X
	X		/*
	X		 * I make no defense of the code below... later I will make a
	X		 * proper hash table (yes.. yes.. I know there are lots of
	X		 * incorrect sets )
	X		 */
	X
	X		if (effect < 2)
	X			switch (p[0]) {
	X			case 'b':
	X				switch (p[1]) {
	X				case 'a':
	X					the_flag = FLAG_BA;
	X					break;
	X				case 'b':
	X					the_flag = FLAG_BB;
	X					break;
	X				case 's':
	X					the_flag = FLAG_BS;
	X					break;
	X				default:
	X					break;
	X				}
	X				break;
	X			case 'c':
	X				if (p[1] == 'b')
	X					if (p[2] == 'a')
	X						the_flag = FLAG_CBA;
	X					else
	X						the_flag = FLAG_CBB;
	X				else if (p[2] == 'a')
	X					the_flag = FLAG_CEA;
	X				else
	X					the_flag = FLAG_CEB;
	X				break;
	X			case 'd':
	X				switch (p[1]) {
	X				case 'a':
	X					the_flag = FLAG_DA;
	X					break;
	X				case 'b':
	X					switch (p[2]) {
	X					case 'a':
	X						the_flag = FLAG_DBA;
	X						break;
	X					case 'b':
	X						the_flag = FLAG_DBB;
	X						break;
	X					default:
	X						the_flag = FLAG_DB;
	X						break;
	X					}
	X					break;
	X				case 'e':
	X					if (p[2] == 'a')
	X						the_flag = FLAG_DEA;
	X					else
	X						the_flag = FLAG_DEB;
	X					break;
	X				default:
	X					break;
	X				}
	X				break;
	X			case 'i':
	X				if (p[1] == 'a')
	X					the_flag = FLAG_IA;
	X				else
	X					the_flag = FLAG_IB;
	X				break;
	X			case 'e':
	X				if (p[1] == 'a')
	X					the_flag = FLAG_EA;
	X				else
	X					the_flag = FLAG_EB;
	X				break;
	X			case 'l':
	X				if (p[1] == 'c')
	X					if (p[2] == 'a')
	X						the_flag = FLAG_LCA;
	X					else
	X						the_flag = FLAG_LCB;
	X				else if (p[2] == 'a')
	X					the_flag = FLAG_LBA;
	X				else
	X					the_flag = FLAG_LBB;
	X				break;
	X			case 'g':
	X				switch (p[1]) {
	X				case 'i':
	X					the_flag = FLAG_GI;
	X					break;
	X				case 's':
	X					if (p[2] == 'b')
	X						the_flag = FLAG_GSB;
	X					else
	X						the_flag = FLAG_GSA;
	X					break;
	X				case 'r':
	X					if (p[2] == 'b')
	X						the_flag = FLAG_GRB;
	X					else
	X						the_flag = FLAG_GRA;
	X					break;
	X				}
	X				break;
	X			case 'r':
	X				switch (p[1]) {
	X				case 'c':
	X					if (p[2] == 'a')
	X						the_flag = FLAG_RCA;
	X					else
	X						the_flag = FLAG_RCB;
	X					break;
	X				case 'b':
	X					if (p[2] == 'a')
	X						the_flag = FLAG_RBA;
	X					else
	X						the_flag = FLAG_RBB;
	X					break;
	X				case 'a':
	X					the_flag = FLAG_RA;
	X					break;
	X				default:
	X					break;
	X				}
	X				break;
	X			case 'p':
	X				the_flag = FLAG_PN;
	X				break;
	X			default:
	X				break;
	X			}
	X
	X		if (the_flag) {
	X			if (effect)
	X				flags |= the_flag;
	X			else
	X				flags &= ~the_flag;
	X		}
	X		p++;
	X
	X		while (*p >= 'a' && *p <= 'z')
	X			p++;
	X	}
	X}
	Xpushbraclevel()
	X{
	X	bracstack[bracpnt] = braclevel;
	X
	X	if (bracpnt < STACK_LEVELS)
	X		bracpnt++;
	X}
	Xpopbraclevel()
	X{
	X	if (bracpnt > 0)
	X		bracpnt--;
	X	else
	X		return;
	X
	X	braclevel = bracstack[bracpnt];
	X}
SHAR_EOF
if test 15885 -ne "`wc -c < 'pspp.l'`"
then
	echo shar: error transmitting "'pspp.l'" '(should have been 15885 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Makefile'" '(1117 characters)'
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	XCFLAGS		 = -g
	X
	XLEX = lex -v
	X
	XDEST	      = /usr/local/bin
	X
	XEXTHDRS	      =
	X
	XHDRS	      =
	X
	XLDFLAGS	      =
	X
	XLIBS	      =  -ll
	X
	XLINKER	      = cc
	X
	XMAKEFILE      = Makefile
	X
	XOBJS	      = pspp.o
	X
	XPRINT	      = pr
	X
	XPROGRAM	      = pspp
	X
	XSRCS	      = pspp.l
	X
	XDOCS          = pspp.1 ptags.1
	X
	Xall:		$(PROGRAM)
	X	@/bin/rm -f ptags
	X	@echo linking ptags to pspp
	X	@ln pspp ptags
	X
	X${PROGRAM}.shar: $(SRCS) ${MAKEFILE} ${DOCS} README patchlevel.h
	X	shar -a README $(SRCS) ${MAKEFILE} ${DOCS} patchlevel.h> ${PROGRAM}.shar
	X
	X$(PROGRAM):     $(OBJS)
	X		@echo -n "Loading $(PROGRAM) ... "
	X		@$(LINKER) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
	X		@echo "done"
	X
	Xclean:;		@rm -f $(OBJS)
	X
	Xdepend:;	@mkmf -f $(MAKEFILE) PROGRAM=$(PROGRAM) DEST=$(DEST)
	X
	Xindex:;		@ctags -wx $(HDRS) $(SRCS)
	X
	Xinstall:	$(PROGRAM)
	X		@echo Installing $(PROGRAM) in $(DEST)
	X		@install -s $(PROGRAM) $(DEST)
	X		@echo Installing ptags in $(DEST)
	X		@/bin/rm -f $(DEST)/ptags
	X		@ln -s $(DEST)/$(PROGRAM) $(DEST)/ptags
	X
	Xprint:;		@$(PRINT) $(HDRS) $(SRCS)
	X
	Xprogram:        $(PROGRAM)
	X
	Xtags:           $(HDRS) $(SRCS); @ctags $(HDRS) $(SRCS)
	X
	Xupdate:		$(DEST)/$(PROGRAM)
	X
	X###
SHAR_EOF
if test 1117 -ne "`wc -c < 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 1117 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'README'" '(1556 characters)'
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
sed 's/^	X//' << \SHAR_EOF > 'README'
	X
	X                    Copyright (c) 1989, Josh Siegel
	X
	XYou may copy the pspp kit in whole or in part as long as you don't try to
	Xmake money off it, or pretend that you wrote it.
	X
	X
	X-----------
	X
	XThis is still a kludge... There is lots of code that can and should
	Xbe rewritten for speed.  Using sort(1) to sort the tags file is
	Xinexcusable.  Using scanf where I could have coded it by hand
	Xis beyond redemption.  The way I parse the arguments for
	Xpspp is criminal.  In general, I need to rewrite large parts
	Xof this code.
	X
	XSend me bugs!  I want to have the functionality settle down before
	XI rewrite it.
	X
	XAlso, I am not going to release the pure postscript version (runs inside
	Xof NeWS) of pspp till after I rewrite the C version.  Also a 
	Xemacs lisp version needs to be written of both as well as a
	Xemacs ptags.
	X
	XOnward....
	X
	X			--Josh Siegel
	X            siegel@hc.dspo.gov
	X
	XTo run:
	X
	X% pspp [options files] < file.in > file.out
	X
	XOr, run it from vi...
	X
	X:%!pspp
	X
	XOr,
	X
	X% pspp -lba foo.cps +lba foobar.ps
	X
	XNote:
	X	pspp is the same program as ptags.  Use "make install" to install
	X	them.
	X
	XSpecial NeWS related features...
	X
	X    lines beginning with cdef are assumed to be cdef calls under NeWS.
	X    This causes the rest of the file (till the next cdef) to be indented one.
	X
	X    Lines beginning with "#" or "%" are passed through unmodified.
	X
	XNote to hackers:
	X    You may notice how I stuck lots of the keywords together into
	X    a single lex rule. I am not going to explain this since the reason
	X	doesn't show up in this version (shows up in the postscript version).
SHAR_EOF
if test 1556 -ne "`wc -c < 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 1556 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'pspp.1'" '(4963 characters)'
if test -f 'pspp.1'
then
	echo shar: will not over-write existing file "'pspp.1'"
else
sed 's/^	X//' << \SHAR_EOF > 'pspp.1'
	X.TH PSPP 1 "5 Feb 1989"
	X.SH NAME 
	Xpspp \- Postscript Pritty Printer
	X.SH SYNOPSIS
	X.B pspp
	X[
	X[\ \fB\-ba\fR\ |\ \fB\+ba\fR\ ]
	X[\ \fB\-bb\fR\ |\ \fB\+bb\fR\ ]
	X[\ \fB\-bs\fR\ |\ \fB\+bs\fR\ ]
	X[\ \fB\-cba\fR\ |\ \fB\+cba\fR\ ]
	X[\ \fB\-cbb\fR\ |\ \fB\+cbb\fR\ ]
	X[\ \fB\-cea\fR\ |\ \fB\+cea\fR\ ]
	X[\ \fB\-ceb\fR\ |\ \fB\+ceb\fR\ ]
	X[\ \fB\-da\fR\ |\ \fB\+da\fR\ ]
	X[\ \fB\-db\fR\ |\ \fB\+db\fR\ ]
	X[\ \fB\-dba\fR\ |\ \fB\+dba\fR\ ]
	X[\ \fB\-dbb\fR\ |\ \fB\+dbb\fR\ ]
	X[\ \fB\-dea\fR\ |\ \fB\+dea\fR\ ]
	X[\ \fB\-deb\fR\ |\ \fB\+deb\fR\ ]
	X[\ \fB\-ea\fR\ |\ \fB\+ea\fR\ ]
	X[\ \fB\-eb\fR\ |\ \fB\+eb\fR\ ]
	X[\ \fB\-lca\fR\ |\ \fB\+lca\fR\ ]
	X[\ \fB\-lcb\fR\ |\ \fB\+lcb\fR\ ]
	X[\ \fB\-rca\fR\ |\ \fB\+rca\fR\ ]
	X[\ \fB\-rcb\fR\ |\ \fB\+rcb\fR\ ]
	X[\ \fB\-pn\fR\ |\ \fB\+pn\fR\ ]
	X[\ \fB\-ib\fR\ |\ \fB\+ib\fR\ ]
	X[\ \fB\-ia\fR\ |\ \fB\+ia\fR\ ]
	X[\ \fB\-lbb\fR\ |\ \fB\+lbb\fR\ ]
	X[\ \fB\-lba\fR\ |\ \fB\+lba\fR\ ]
	X[\ \fB\-rbb\fR\ |\ \fB\+rbb\fR\ ]
	X[\ \fB\-rba\fR\ |\ \fB\+rba\fR\ ]
	X[\ \fB\-gsb\fR\ |\ \fB\+gsb\fR\ ]
	X[\ \fB\-gsa\fR\ |\ \fB\+gsa\fR\ ]
	X[\ \fB\-grb\fR\ |\ \fB\+grb\fR\ ]
	X[\ \fB\-gra\fR\ |\ \fB\+gra\fR\ ]
	X[\ \fB\-gi\fR\ |\ \fB\+gi\fR\ ]
	X[\ \fB\-ra\fR\ |\ \fB\+ra\fR\ ]
	X]
	X[
	X.I input-files
	X]
	X.SH DESCRIPTION
	X.LP
	X.B pspp
	Xis a Postscript formatter that also understands NeWS elements.
	XIt reformats the Postscript program in the
	X.I input-files
	Xor
	X.I stdin
	Xaccording the switches.
	X.SH EXAMPLES
	XThe
	X.I pspp
	Xoptions can be set in several ways.
	X.LP
	XOne way is to put options into a file called
	X.I .pspp
	Xin your home directory.
	X.TP
	XExample:
	X.ne
	X.RS
	X.nf
	X.ft B
	X-bs +cea -dba
	X.ft R
	X.fi
	X.RE
	X.LP
	X.TP
	XAnother way is to put comments in your code:
	X.TP
	XExample:
	X.ne
	X.RS
	X.nf
	X.ft B
	X<beginning of line>%%= -bs +cea -dba
	X.ft R
	X.fi
	X.RE
	X.LP
	XA third way is when you call the program:
	X.TP
	XExample:
	X.ne
	X.RS
	X.nf
	X.ft B
	Xpspp -bs +cea -dba
	X.ft R
	X.fi
	X.RE
	X.LP
	X.SH OPTIONS
	X.LP
	XThe options listed below control the style produced by
	X.I pspp.
	X.TP 15
	X.BR \-bs, \+bs
	XBackslash inner strings
	X.TP
	X.BR \-db, \+db
	XIf
	X.B db
	Xis specified, a blank line is forced before every "def". Default: -db
	X.TP
	X.BR \-bb, \+bb
	XIf
	X.B bb
	Xis specified, a blank line is forced before every "begin". Default: +bb
	X
	X.TP
	X.BR \-cbb, \+cbb
	XIf
	X.B cbb
	Xis specified, a blank line is forced before every "classbegin". Default: +cbb
	X
	X.TP
	X.BR \-dbb, \+dbb
	XIf
	X.B dbb
	Xis specified, a blank line is forced before every "dictbegin". Default: +dbb
	X
	X.TP
	X.BR \-eb, \+eb
	XIf
	X.B eb
	Xis specified, a blank line is forced before every "end". Default: +eb
	X
	X.TP
	X.BR \-ceb, \+ceb
	XIf
	X.B ceb
	Xis specified, a blank line is forced before every "classend". Default: +ceb
	X
	X.TP
	X.BR \-deb, \+deb
	XIf
	X.B deb
	Xis specified, a blank line is forced before every "dictend". Default: +deb
	X
	X.TP
	X.BR \-grb, \+grb
	XIf
	X.B grb
	Xis specified, a blank line is forced before every "grestore". Default: -grb
	X
	X.TP
	X.BR \-gsb, \+gsb
	XIf
	X.B gsb
	Xis specified, a blank line is forced before every "gsave". Default: -gsb
	X
	X.TP
	X.BR \-ib, \+ib
	XIf
	X.B ib
	Xis specified, a blank line is forced before every "if". Default: -ib
	X
	X.TP
	X.BR \-lcb, \+lcb
	XIf
	X.B lcb
	Xis specified, a blank line is forced before every "{". Default: -lcb
	X
	X.TP
	X.BR \-rcb, \+rcb
	XIf
	X.B rcb
	Xis specified, a blank line is forced before every "}". Default: +rcb
	X
	X.TP
	X.BR \-lbb, \+lbb
	XIf
	X.B lbb
	Xis specified, a blank line is forced before every "[". Default: -lbb
	X
	X.TP
	X.BR \-rbb, \+rbb
	XIf
	X.B rbb
	Xis specified, a blank line is forced before every "]". Default: -rbb
	X
	X.TP
	X.BR \-da, \+da
	XIf
	X.B da
	Xis specified, a blank line is forced after every "def". Default: +da
	X
	X.TP
	X.BR \-ba, \+ba
	XIf
	X.B ba
	Xis specified, a blank line is forced after every "begin". Default: +ba
	X
	X.TP
	X.BR \-cba, \+cba
	XIf
	X.B cba
	Xis specified, a blank line is forced after every "classbegin". Default: +cba
	X
	X.TP
	X.BR \-dba, \+dba
	XIf
	X.B dba
	Xis specified, a blank line is forced after every "dictbegin". Default: +dba
	X
	X.TP
	X.BR \-ea, \+ea
	XIf
	X.B ea
	Xis specified, a blank line is forced after every "end". Default: +ea
	X
	X.TP
	X.BR \-cea, \+cea
	XIf
	X.B cea
	Xis specified, a blank line is forced after every "classend". Default: +cea
	X
	X.TP
	X.BR \-dea, \+dea
	XIf
	X.B dea
	Xis specified, a blank line is forced after every "dictend". Default: +dea
	X
	X.TP
	X.BR \-gra, \+gra
	XIf
	X.B gra
	Xis specified, a blank line is forced after every "grestore". Default: -gra
	X
	X.TP
	X.BR \-gsa, \+gsa
	XIf
	X.B gsa
	Xis specified, a blank line is forced after every "gsave". Default: -gsa
	X
	X.TP
	X.BR \-ia, \+ia
	XIf
	X.B ia
	Xis specified, a blank line is forced after every "if". Default: +ia
	X
	X.TP
	X.BR \-lba, \+lba
	XIf
	X.B lba
	Xis specified, a blank line is forced after every "[". Default: -lba
	X
	X.TP
	X.BR \-rba, \+rba
	XIf
	X.B rba
	Xis specified, a blank line is forced after every "]". Default: -rba
	X
	X.TP
	X.BR \-lca, \+lca
	XIf
	X.B lca
	Xis specified, a blank line is forced after every "{". Default: +lca
	X
	X.TP
	X.BR \-rca, \+rca
	XIf
	X.B rca
	Xis specified, a blank line is forced after every "}". Default: -rca
	X.SH SEE ALSO
	Xptags (1)
	X.SH BUGS
	XYou can only put pspp related comments at the beginning of the line.
	X.SH AUTHOR
	XJosh Siegel (siegel@hc.dspo.gov)
SHAR_EOF
if test 4963 -ne "`wc -c < 'pspp.1'`"
then
	echo shar: error transmitting "'pspp.1'" '(should have been 4963 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'patchlevel.h'" '(21 characters)'
if test -f 'patchlevel.h'
then
	echo shar: will not over-write existing file "'patchlevel.h'"
else
sed 's/^	X//' << \SHAR_EOF > 'patchlevel.h'
	X#define PATCHLEVEL 5
SHAR_EOF
if test 21 -ne "`wc -c < 'patchlevel.h'`"
then
	echo shar: error transmitting "'patchlevel.h'" '(should have been 21 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ptags.1'" '(1250 characters)'
if test -f 'ptags.1'
then
	echo shar: will not over-write existing file "'ptags.1'"
else
sed 's/^	X//' << \SHAR_EOF > 'ptags.1'
	X.TH PTAGS 1 "5 Feb 1989"
	X.SH NAME
	Xptags \- create a tags file for use with vi
	X.SH SYNOPSIS
	X.B ptags
	X[
	X.B \-f
	X.I tagsfile
	X]
	X[
	X.I files
	X]
	X.SH DESCRIPTION
	X.B ptags
	Xmakes a tags file for
	X.BR ex (1)
	Xfrom a postscript or NeWS source. See
	X.BR ctags (1) 
	Xfor more information.
	X.LP
	XThere are two ways that a tag can be generated.  The first
	Xway is by looking for a cdef. 
	X.TP
	XExample:
	X.ne
	X.RS
	X.nf
	X.ft B
	Xcdef foobar(int bat)
	X.ft R
	X.fi
	X.RE
	X.TP
	XGenerates a tag foobar.
	X.TP
	XAnother way is by putting comments into your Postscript code.
	X.TP
	XExample:
	X.ne
	X.RS
	X.nf
	X.ft B
	X/golly { % wolly => -    ptag=<golly>
	X.ft R
	X.fi
	X.RE
	X.LP
	XProduces a tag "golly" for that line.  The ptag=<tag>
	Xcan be anywhere in the comment.  Please note that the string
	Xbetween the <...> is the string that is used as the tag.
	X.LP
	XThe default tagfile is
	X.B tags.ps.
	XBecause this is not normally in the tag search path, it helps if you
	Xput:
	X.TP
	X.ne
	X.RS
	X.nf
	X.ft B
	Xset tags=tags tags.ps
	X.ft R
	X.fi
	X.RE
	X.LP
	Xin your .exrc file so that 
	X.I vi (1)
	Xknows what to look for. Depending on the system, you might have
	Xto backslash the space between
	X.I tags
	Xand
	X.I tags.ps.
	X.SH SEE ALSO
	Xpspp (1)
	X.SH BUGS
	XWould like it to be able to figure out more tags on its own.
	X.SH AUTHOR
	XJosh Siegel (siegel@hc.dspo.gov)
SHAR_EOF
if test 1250 -ne "`wc -c < 'ptags.1'`"
then
	echo shar: error transmitting "'ptags.1'" '(should have been 1250 characters)'
fi
fi # end of overwriting check
echo shar: done with directory "'pspp'"
cd ..
#	End of shell archive
exit 0
-- 
Josh Siegel		(siegel@hc.dspo.gov)
"Oh well.. I guess I will just bury my guns... sigh.. " - Standard Gun Owner