[net.micro.atari16] Proff part 3 of 4

bammi@cwruecmp.UUCP (Jwahar R. Bammi) (03/22/86)

#!/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:
#	putwrd.c
#	pxlex.c
#	pxxparse.c
#	read.me
#	see.me
#	stack.c
# This archive created: Fri Mar 21 22:45:09 1986
# By:	Jwahar R. Bammi ()
export PATH; PATH=/bin:$PATH
echo shar: extracting "'putwrd.c'" '(993 characters)'
if test -f 'putwrd.c'
then
	echo shar: over-writing existing file "'putwrd.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'putwrd.c'
X#include <stdio.h>
X#include "proff.h"
X#include "debug.h"
X
X#define brk brrk
X
X/*
X * putwrd - put a word in outbuf; includes margin justification
X *
X */
Xputwrd(wrdbuf)
Xchar wrdbuf[];
X{
X	int last, llval, extra, w;
X
Xdprintf("putwrd  ");
X	w = width(wrdbuf);
X	last = strlen(wrdbuf) + outp;         /* new end of outbuf */
X#ifdef DEBUG
Xprintf("strlen(wrdbuf) = %d\n",strlen(wrdbuf));
X#endif
X	llval = rmval - tival;
X	if (outw + w > llval || last >= MAXOUT) {    /* too big */
X		last -= outp;
X		extra = llval - outw;
X#ifdef DEBUG
Xprintf("extra = %d\n",extra);
X#endif
X		for ( ; outp > 0; outp--)
X			if (outbuf[outp-1] == ' ')
X				extra++;
X			else
X				break;
X		if (rjust == YES) {
X			spread(outbuf, outp, extra, outwds);
X			if (extra > 0 && outwds > 1)
X				outp += extra;
X		}
X		brk();		/* flush previous line */
X	}
X#ifdef DEBUG
Xprintf("putwrd: last=%d w=%d outp=%d llval=%d outw=%d extra=%d\n",
X		last,w,outp,llval,outw,extra);
X#endif
X	strcpy(&outbuf[outp],wrdbuf);
X	outp = last;
X	outw += w;
X	outwds++;
X}
SHAR_EOF
if test 993 -ne "`wc -c 'putwrd.c'`"
then
	echo shar: error transmitting "'putwrd.c'" '(should have been 993 characters)'
fi
echo shar: extracting "'pxlex.c'" '(3355 characters)'
if test -f 'pxlex.c'
then
	echo shar: over-writing existing file "'pxlex.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'pxlex.c'
X#include <stdio.h>
X#include <math.h>
X#include <ctype.h>
X
X/* translation table for control chars */
X
Xchar c_ctrl[] = { 
X		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
X		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
X		0,  0,  0,  0,  0,  0,  0,  0,
X		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
X		0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
X		0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
X		10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
X		23, 25, 26, 27, 28, 29, 30, 31, 0,  1,  2,  3,  4,  5,
X		6,  7,  8,  9,  10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
X		20, 21, 22, 23, 24, 25, 26, 0,  0,  0,  0,  0
X		};
X
X/*
X * getval - evaluate optional numeric argument
X *
X * increments i
X */
Xint
Xgetval(buf,i,argtyp)
Xchar buf[];
Xint *i;
Xint *argtyp;
X{
X	int j,k;
X
X	j = *i;
X	k = *argtyp;
X
X	skipbl(buf, &j);
X	k = buf[j];
X	if (k == '+' || k == '-')
X		j++;
X	*i = j;
X	*argtyp = k;
X	return(ctoi(buf,i));
X}
X
X/*
X * getarg - get the next argument from the buffer
X *
X * return values:      -1 - no argument
X *			n - number of chars in argument
X *
X * also handles quoted ("..") strings. If a quote is wanted
X * in the string, use "" or \". quotes are stripped.
X *
X * argument delimiters: blank, tab or comma (,).
X *
X * increments i
X *
X */
Xint
Xgetarg(buf,i,arg)
Xchar buf[];
Xint *i;
Xchar arg[];
X{
X	int j,k;
X	register char ch;
X
X	j = *i;
X
X	k = -1;
X	skipbl(buf,&j);
X	if (buf[j] != '\0') {
X		k = 0;
X		if (buf[j] == '\"') {
X			j++;
X			while (buf[j] != '\0') {
X				if (buf[j] == '\"') {
X					if (buf[j+1] == '\"') {
X						arg[k++] = '\"';
X						j += 2;
X					}
X					else
X						break;
X				}
X				arg[k++] = buf[j++];
X			}
X			arg[k] = '\0';
X			j++;			/* skip the quote */
X			/* peek next char */
X			if (isalnum(buf[j]))
X				error("improper argument list.");
X			j++;			/* skip the delimeter */
X		}
X		else {
X			ch = buf[j];
X			while (ch != ' '&& 
X			    ch != '\t' 	&& 
X			    ch != ',' 	&&
X			    ch != '\r' 	&& 
X			    ch != '\n' 	&& 
X			    ch != '\0') {
X				arg[k++] = buf[j++];
X				ch = buf[j];
X			}
X			arg[k] = '\0';
X			if (ch != '\0')	/* if non-null delimiter, skip */
X				j++;
X		}
X		*i = j;
X	}
X	return(k);
X}
X
X/*
X * getpstr - get a special string to print out
X *
X */
Xgetpstr(buf,out)
Xregister char *buf;
Xregister char *out;
X{
X	register int i;
X	register char c, cc;
X	register char *num;
X	char numbuf[9];
X
X	while(*buf != '\n' && *buf != '\0') {
X		c = *buf;
X		switch(c) {
X		case ' ':
X		case '\t':
X			while (*buf == ' ' || *buf == '\t')
X				buf++;	/* skip blanks */
X			break;
X		case '\\':
X			if (*(buf+1) != '\0') {
X				*out++ = *(buf+1);
X				buf += 2;
X			}
X			else
X				buf++;
X			break;
X		case '^':
X			if ((cc = c_ctrl[*(buf+1)]) != 0)
X				*out++ = cc;
X			buf += 2;
X			break;
X		case '\"':
X			buf++;	/* skip the quote */
X			while (*buf != '\0') {
X				if (*buf != '\"')
X					*out++ = *buf++;
X				else if (*(buf+1) == '\"') {
X						*out++ = '\"';
X						buf += 2;
X				}
X				else
X					break;
X			}
X			buf++;	/* skip the quote */
X			break;
X		case '0':
X		case '1':
X		case '2':
X		case '3':
X		case '4':
X		case '5':
X		case '6':
X		case '7':
X		case '8':
X		case '9':
X			num = numbuf;
X			while (isdigit(*buf))
X				*num++ = *buf++;
X			*num = '\0';
X			if ((i = atoi(numbuf)) > 256)
X				error("non-ascii char value in write string.");
X			else if (i > 0)		/* do not output null */
X				*out++ = (char) i;
X			break;
X		default:
X			*out++ = *buf++;
X		}
X	}
X	*out = '\0';
X}
SHAR_EOF
if test 3355 -ne "`wc -c 'pxlex.c'`"
then
	echo shar: error transmitting "'pxlex.c'" '(should have been 3355 characters)'
fi
echo shar: extracting "'pxxparse.c'" '(9665 characters)'
if test -f 'pxxparse.c'
then
	echo shar: over-writing existing file "'pxxparse.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'pxxparse.c'
X#include <stdio.h>
X#include <ctype.h>
X#include "proff.h"
X#include "debug.h"
X#include "lextab.h"
X
X#define brk brrk
X
X#define RUNOFF	1 		/* recognise RUNOFF commands */
X
Xchar literal = NO;		/* literal flag		     */
X
X/*
X * command - perform formatting command
X *
X */
Xcommand(buf)
Xchar buf[];
X{
X	char token[MAXTOK], xtoken[MAXTOK], variable[MAXTOK], *defn;
X	char special[MAXTOK];
X	int argtyp, ct, at, spval, i, flags;
X	register int val, n, rest;
X	char onflag = FALSE; 
X	char offlag = FALSE;
X	struct lexlist *xp;
X
X	dovar(tbuf1,buf);	/* use scratch buffer to expand variables */
X	strcpy(buf,tbuf1);
X
X	i = 1;
X	n = getwrd(buf, &i, token);	/* get the command token */
X	rest = i;			/* remaining string */
X	ct = comtype(token, n, &defn, &flags);
X	if (ct == UNKNOWN)
X		return;
X	if (literal && ct != ELT) {	/* ignore while literal  */
X		put(buf);
X		return;
X	}
X
X#ifdef DOUBLEWORD
X	if (flags == 2) {	/* check for 2-word command */
X		n = getwrd(buf, &i, xtoken);
X		if (n == 0) {
X			fprintf(stderr,"%c%s what ?\n", cchar, token);
X			return;
X		}
X		if ((at = comtype(xtoken, n, &defn, &flags)) == UNKNOWN) {
X			fprintf(stderr,"%c%s %s unknown.\n", cchar,
X			token,
X			xtoken);
X			return;
X		}
X		else
X			ct += at;
X	}
X#endif
X
X	doesc(buf, variable, MAXLINE);	/* expand escapes */
X	n = getarg(buf, &i, xtoken);	/* first parameter*/
X	argtyp = '\n';	/* defaulted ** cludge ** */
X	val = 0;
X	if (n > 0) {
X		if (*xtoken == '+' || *xtoken == '-') {
X			argtyp = *xtoken;
X			val = atoi(xtoken+1);
X		}
X		else if (isdigit(*xtoken)) {
X			argtyp = 0;
X			val = atoi(xtoken);
X		}
X		else {
X			/* check some common flags */
X			if (strcmp("on",xtoken) == 0)
X				onflag = TRUE;
X			else if (strcmp("off",xtoken) == 0)
X				offlag = TRUE;
X		}
X	}
X
X	switch(ct) {
X
X	case MACRO:
X		eval(buf, defn);
X		break;
X	case FI:
X		brk();
X		fill = YES;
X		break;
X	case NF:
X		brk();
X		fill = NO;
X		break;
X	case BR:
X		brk();
X		break;
X	case LS:
X		set(&lsval, val, argtyp, 1, 1, HUGE);
X		break;
X	case CE:
X		brk();
X		if (onflag)
X			CEon = TRUE;
X		else if (offlag) {
X			CEon = FALSE;
X			ceval = 0;		/* reset */
X		}
X		else
X			set(&ceval, val, argtyp, 1, 0, HUGE);
X		break;
X	case UL:
X		if (onflag) {
X			ULon = TRUE;
X			break;
X		}
X		else if (offlag) {
X			ULon = FALSE;
X	 		ulval = 0;		/* reset */
X			break;
X		}
X		else 
X			set(&ulval, val, argtyp, 0, 1, HUGE);
X
X		if (!isdigit(*xtoken)) {
X			if (strcmp("all",xtoken) == 0) {
X					ulblnk = '_';
X					ulval = 0;
X			}
X			else if (strcmp("words",xtoken) == 0) {
X				ulblnk = ' ';
X				ulval = 0;
X			}
X		}
X		break;
X	case BD:
X		if (bolding == YES) {
X			if (onflag)
X				BDon = TRUE;
X			else if (offlag) {
X				BDon = FALSE;
X				boval = 0;	/* reset */
X			}
X			else
X				set(&boval, val, argtyp, 0, 1, HUGE);
X		}
X		break;
X	case HE:
X		gettl(buf, ehead, ehlim);
X		gettl(buf, ohead, ohlim);
X		break;
X	case FO:
X		gettl(buf, efoot, eflim);
X		gettl(buf, ofoot, oflim);
X		break;
X	case BP:
X		if (paging == NO)
X			break;
X		brk();
X		if (lineno > 0)
X			space(HUGE);
X		set(&curpag, val, argtyp, curpag+1, -HUGE, HUGE);
X		newpag = curpag;
X		break;
X	case SP:
X		set(&spval, val, argtyp, 1, 0, HUGE);
X		space(spval);
X		break;
X	case IN:
X		brk();
X		set(&inval, val, argtyp, 0, 0, rmval-1);
X		tival = inval;
X		break;
X	case RM:
X		set(&rmval, val, argtyp, PAGEWIDTH, tival+1, HUGE);
X		break;
X	case TI:
X		brk();
X		set(&tival, val, argtyp, 0, 0, rmval);
X		break;
X	case LEX:	/****/
X		if ((xp = remove(xtoken,lextab)) != NULL) {
X			if (getwrd(buf, &i, variable) != 0)
X				lexinstal(variable,xp->val,xp->flag,lextab);
X		}
X		else 
X		    fprintf(stderr,"%s undefined.\n",xtoken);
X		break;
X	case PN:	/****/
X		if (strcmp(xtoken,"roman") == 0)
X			roman = TRUE;
X		else if (strcmp(xtoken,"arabic") == 0)
X			roman = FALSE;
X		else
X			fprintf(stderr,"%c%s does not have %s option.\n",
X			cchar,token,xtoken);
X		break;
X	case IG:	/****/
X		break;
X	case SET:	/****/
X		if (n > 0) {
X			if (isdigit(*xtoken)) {
X				fprintf(stderr,"illegal variable name %s\n",
X				xtoken);
X				break;
X			}
X			*variable = '\0';
X			n = getarg(buf, &i, variable);
X			if (n <= 0) {
X				fprintf(stderr,"%s: ", xtoken);
X				gets(variable);
X
X			}
X			if (*variable != '\0')
X				install(xtoken, variable, gentab);
X		}
X		else
X			fprintf(stderr,"%c%s needs a variable name.\n",
X			cchar, token);
X		break;
X	case GET:	/****/
X		if (n > 0) {
X			if (isdigit(*xtoken)) {
X				fprintf(stderr,"illegal variable name %s\n",
X				xtoken);
X				break;
X			}
X			*variable = '\0';
X			n = getarg(buf, &i, tbuf3); /* using temp buf3 */
X			if (n > 0) {
X				fprintf(stderr,"%s", tbuf3);
X				gets(variable);
X
X			}
X			if (*variable != '\0')
X				install(xtoken,variable, gentab);
X		}
X		else
X			fprintf(stderr,"%c%s needs a variable name.\n",
X			cchar, token);
X		break;
X	case CL:	/****/
X		if (argtyp == '\n') {
X			clast->level = 0;
X			clast->str = NULL;
X		}
X		else {
X			skipbl(buf,&i);
X			if (*(buf+i) == '\0')
X				break;		/* no contents line here ! */
X			clast->level = val * 3; /* level * indent 	   */
X			n = i;
X			while(*(buf+n) != '\n')
X				n++;
X			*(buf+n) = '\0';	/* destroy CR with a null  */
X			clast->str = strsave(buf+i);
X			clast->page = curpag;
X		}
X		clast->nextc = (struct clist *) malloc(sizeof(struct clist));
X		p_memoryus += sizeof(struct clist);
X		clast = clast->nextc;
X		clast->nextc = NULL;
X		break;
X	case PC:	/****/
X		brk();
X		clast = chead;
X		while(clast->nextc != NULL) {
X			if (clast->str == NULL)
X				put("\n");
X			else {
X				tival = (int) clast->level + inval;
X				i = rmval - tival;
X				docline(variable, i, clast->str, clast->page);
X				put(variable);
X			}
X			clast = clast->nextc;
X		}
X		break;
X	case DBO:	/****/
X		bolding = NO;
X		break;
X	case EBO:	/****/
X		bolding = YES;
X		break;
X	case AP:	/****/
X		autopar = YES;
X		break;
X	case NAP:	/****/
X		autopar = NO;
X		break;
X	case SAV:	/****/
X		brk();
X		save();
X		break;
X	case RST:	/****/
X		brk();
X		restore();
X		break;
X	case NPA:	/****/
X		paging = NO;
X		savpl = plval;
X		plval = HUGE;
X		bottom = plval - m3val - m4val;
X		break;
X	case PGI:	/****/
X		bottom = lineno - 1;	/* force end-of-page */
X		brk();
X		plval = savpl;
X		break;
X	case LTR:	/****/
X		brk();
X		if (save()) {
X			inval = 0;
X			rmval = 132;
X			autopar = NO;
X			lsval = 0;
X			fill = NO;
X			literal = YES;
X		}
X		break;
X	case ELT:	/****/
X		restore();
X		literal = NO;
X		break;
X	case WR:	/****/
X		brk();
X		getpstr(buf+rest,special);
X		defn = special;
X		while(*defn)
X			putchar(*defn++);
X		break;
X	case PL:
X		if (paging == NO)
X			break;
X		set(&plval, val, argtyp, PAGELEN,
X		m1val + m2val + m3val + m4val + 1, HUGE);
X		bottom = plval - m3val - m4val;
X		break;
X	case PO:
X		set(&offset, val, argtyp, 0, 0, rmval - 1);
X		break;
X	case M1:
X		set(&m1val, val, argtyp, 3, 0,
X		plval - m2val - m3val - m4val - 1);
X		break;
X	case M2:
X		set(&m2val, val, argtyp, 2, 0,
X		plval - m1val - m3val - m4val - 1);
X		break;
X	case M3:
X		set(&m3val, val, argtyp, 2, 0,
X		plval - m1val - m2val - m4val - 1);
X		bottom = plval - m3val - m4val;
X		break;
X	case M4:
X		set(&m4val, val, argtyp, 3, 0,
X		plval - m1val - m2val - m3val - 1);
X		bottom = plval - m3val - m4val;
X		break;
X	case EH:
X		gettl(buf, ehead, ehlim);
X		break;
X	case OH:
X		gettl(buf, ohead, ohlim);
X		break;
X	case EF:
X		gettl(buf, efoot, eflim);
X		break;
X	case OF:
X		gettl(buf, ofoot, oflim);
X		break;
X	case CC:
X		cchar = *xtoken;
X		if (cchar == '\0' || cchar == '\n')
X			cchar = '.';
X		if ((lineno + val) > bottom && lineno <= bottom) {
X			space(val);
X			lineno = 0;
X		}
X		break;
X	case EC:
X		genesc = *xtoken;
X		if (genesc == '\0' || genesc == '\n')
X			genesc = '_';
X		break;
X	case NE:
X		if ((lineno + val) > bottom && lineno <= bottom) {
X			space(val);
X			lineno = 0;
X		}
X		break;
X	case BS:
X		set(&bsval, val, argtyp, 1, 0, HUGE);
X		break;
X	case JU:
X		rjust = YES;
X		break;
X	case NJ:
X		rjust = NO;
X		break;
X	case SO:
X		if (n <= 0)
X			return;
X		if (level + 1 == NFILES)
X			error("? SO commands nested too deeply.");
X		if ((infile[level + 1] = fopen(xtoken, "r")) != NULL) {
X			level++;
X			if (verbose == YES)
X#ifdef rainbow
X				fprintf(stderr,"source \033[7m%s\033[0m\n",
X					xtoken);
X#else
X				fprintf(stderr,"source %s\n",xtoken);
X#endif
X		}
X		else
X			fprintf(stderr,"%s: cannot open.\n",xtoken);
X		break;
X	case OU:	/*****/
X		/* skip for now. */
X		break;
X
X	case OE:	/*****/
X		/* skip for now. */
X		break;
X
X	case CU:
X		ulblnk = '_';
X		set(&ulval, val, argtyp, 0, 1, HUGE);
X		break;
X	case DE:
X
X#ifdef DEBUG
Xprintf("Command++: calling dodef Fp %ld\n",infile[level]);
X#endif
X		dodef(buf, infile[level]);
X		break;
X	case NR:
X		if (n <= 0)
X			return;
X		if (*xtoken < 'a' || *xtoken > 'z')
X			error("invalid number register [%c].",*xtoken);
X
X		val = getval(buf, &i, &argtyp);
X		set(&nr[xtoken[0] - 'a'], val, argtyp, 0, -HUGE, HUGE);
X		break;
X	case ST:
X		if (argtyp == '-')
X			spval = plval;
X		else
X			spval = 0;
X		set(&spval, val, argtyp, 0, 1, bottom);
X		if (spval > lineno && lineno == 0)
X			phead();
X		if (spval > lineno)
X			space(spval - lineno);
X		break;
X	case RESET:	/****/
X		finit();
X		break;
X	default:
X		error("? Botch in command.");
X		break;
X	}
X}
X
X/*
X * comtype - decode the command type
X *
X */
Xint
Xcomtype(buf, siz, defn, flags)
Xchar buf[];
Xint siz;
Xchar **defn;
Xint *flags;
X{
X
X	struct hashlist *np;
X	struct lexlist *xp;
X	extern	struct lexlist *lexlook();
X	int i,comtyp;
X	char c1,c2;
X
X
X#ifdef DEBUG
X	printf("comtype:  (token)\n");
X#endif
X
X	if ((np = lookup(buf, macrotab)) != NULL) {
X		*defn=np->def;
X		return(MACRO);
X	}
X	comtyp = UNKNOWN;
X
X	if (*buf == '#' || *buf == '!')
X		return(comtyp);
X
X	if ((xp = lexlook(buf,lextab)) != NULL)
X		if (onlyrunoff && (xp->flag != RUNOFF)) {
X			fprintf(stderr,"%c%s is not a runoff command.\n",
X			cchar,buf);
X			return(UNKNOWN);
X		}
X		else {	
X			comtyp = xp->val;
X			*flags = xp->flag;
X		}
X
X	if (comtyp == UNKNOWN)
X		fprintf(stderr,"unknown command %c%s\n",cchar,buf);
X	return(comtyp);
X}
SHAR_EOF
if test 9665 -ne "`wc -c 'pxxparse.c'`"
then
	echo shar: error transmitting "'pxxparse.c'" '(should have been 9665 characters)'
fi
echo shar: extracting "'read.me'" '(1426 characters)'
if test -f 'read.me'
then
	echo shar: over-writing existing file "'read.me'"
fi
sed 's/^X//' << \SHAR_EOF > 'read.me'
XProff - A portable formatter
X
XThis is the first distribution of PROFF, a formatter based
Xon software tools ROFF. It is mainly a C re-write of ROFF,
X(now known as FORMAT), with some expansions. It is mainly
Xintended for non-UN*X systems, CP/M, MS-DOS and the like.
X
XProff was originally written for The Faculty of Administrative
XStudies, York University, tto supplement their microcomputer
Xenvironment. As of this release, the formatter is in the
Xcontrol of The Faculty of Administrative Studies.
X
XThere is no man page for proff, for it was never intended
Xfor UN*X systems. There is, however two comprehensive
Xdocuments to answer all questions.
X
XThe C code for PROFF is quite warped, and should be approached
Xcarefully. [Ok..Ok.. it is all my fault.. too much midnight
Xoil..]	It is reasonably customazible, by changing proffsym.new.
XThis file is processed by ltb, a static hash table generator.
XThis approach is most useful to change the operator keywords,
Xcreate aliases, and it also bypassess the initialization
Xoverhead. [see the makefile for the right output file names
Xfor ltb]
X
XPROFF is not copyrighted, at least for this release. Future
Xreleases may contain York University copyright.
X
XPlease send me all updates, bugfixes and other tidbits,
Xso that future releases may be coordinated smoothly.
X
Xenjoy.
X		oz
X		bitnet: oz@yuyetti
X			oz@yusol
X		useet: {ihnp4|decvax|allegra|linus}!utzoo!yetti!oz
X		phonet: (416) 667 3976
X
SHAR_EOF
if test 1426 -ne "`wc -c 'read.me'`"
then
	echo shar: error transmitting "'read.me'" '(should have been 1426 characters)'
fi
echo shar: extracting "'see.me'" '(2491 characters)'
if test -f 'see.me'
then
	echo shar: over-writing existing file "'see.me'"
fi
sed 's/^X//' << \SHAR_EOF > 'see.me'
X	After capturing and unshar'ing all the parts of this proff
Xposting you should end up with the following files:
X
Xproff.uud			lookup.h	proff.c		putwrd.c
Xdebug.h		lextab.d	ltb.c		proff.h		pxlex.c
Xdecl.h		lextab.h	make.sh		proff01.c	pxxparse.c
Xdefs.h		lnk		makefile	proff02.c	read.me
Xdostuff2.c	look.c		map.c		proffman.prf	see.me
Xeval.c		lookup.c	pinit.c		proffsym.new	stack.c
X
XThis file is see.me
X
XHow to make proff on the ST:
X
X	1) You will have to edit stdio.h supplied with the dev. system
Xto include the following lines at the bottom of stdio.h.
X
X	#ifdef DECL
X	#include <decl.h>
X	#endif
X
X	We do this so that when the pre-processor symbol DECL is
Xdefined the file decl.h gets included, and if it isn't then stdio.h
Xlooks exactly like it did before we added the lines. In decl.h we
Xdeclare all the commonly used function in C that do not returns the
Xtype int. This a important as in the Alcyon C compiler
X sizeof(int) != sizeof(int *). You may if you like include decl.h
Xelsewhere, but you will have to ensure that each of the modules
X(source files) has decl.h included. We found it convenient to put it
Xin stdio.h as above.
X
X	2) For those of you who have Micro C Shell and CC that i had
Xposted earlier to this newgroup, you can simply hit
X
X	make
X	
Xat the Micro C Shell prompt. 
X
X	3) For those who don't have Micro C Shell, but have CC, see
Xthe file make.sh, and enter those commands.
X
X	4) For those who don't have either, you will have to see
Xmake.sh and compile each C file such that DECL is defined, so you may
Xhave to  change your normal batch file somewhat to have the
Xpreprocessor switch in there to define the symbol DECL.
X
XPlease note that make.sh was set up to have all the sources, objects
Xetc in the current directory. If you are compiling on floppies you may
Xhave to  change that.
X
XThe file lnk contains the list of files to be linked, and is used with
Xlink68 as follows
X
X	link68 [com[lnk]]
X	relmod proff
X
XThe above process should yield proff.prg. If you want to use it from
Xthe desktop, rename it to proff.ttp.
X
X
XMaking Proff on the Vax
X	Simply hit
X	make
X
XMaking the users guide
X	On either the St or Vax hitting
X
X	proff -po8 proffman.prf proff.man
X	
X	Will result in proff.man. (You may want to play with -po<n> to
Xget the correct left margin spacing for your printer).
X
X	If you have any problems/suggestions i may be reached at the
Xfollowing addresses:
X
X	   Usenet:  .....!decvax!cwruecmp!bammi
X	   CSnet:  bammi@case
X	   Arpa:  bammi%case@csnet-relay
X	   CompuServe:  71515,155
SHAR_EOF
if test 2491 -ne "`wc -c 'see.me'`"
then
	echo shar: error transmitting "'see.me'" '(should have been 2491 characters)'
fi
echo shar: extracting "'stack.c'" '(1909 characters)'
if test -f 'stack.c'
then
	echo shar: over-writing existing file "'stack.c'"
fi
sed 's/^X//' << \SHAR_EOF > 'stack.c'
X#include <stdio.h>
X#include "proff.h"
X
Xstruct _proffitem {
X		int	Xinval;
X		int	Xrmval;
X		int	Xoffset;
X		int	Xlsval;
X		int	Xplval;
X		int	Xm1val;
X		int	Xm2val;
X		int	Xm3val;
X		int	Xm4val;
X		int	Xfill;
X		int	Xrjust;
X
X		char	Xcchar;
X		char	Xgenesc;
X		char	Xroman;
X		char	Xbolding;
X		char	Xpaging;
X		char	Xautopar;
X
X		struct 	_proffitem *prev;
X};
X
Xstatic struct
X_proffitem *head = NULL;
Xstatic struct
X_proffitem *top  = NULL;
X
X
Xchar *pusherr = "save: stack overflow.\n";
Xchar *poperr  = "restore: stack underflow.\n";
X
X/*
X * save - save proff parameters
X *
X */
Xsave()
X{
X	struct _proffitem *sp;
X	char *malloc();
X
X	if ((sp = (struct _proffitem *) malloc(sizeof(*sp))) == NULL) {
X		fprintf(stderr,pusherr);
X		return(FALSE);
X	}
X	else {
X		p_memoryus += sizeof(struct _proffitem);
X		if (head == NULL) {	/* first element in stack */
X			head = sp;
X			top = NULL;	
X		}
X		
X		sp->Xinval = inval;
X		sp->Xrmval = rmval;
X		sp->Xoffset= offset;
X		sp->Xlsval = lsval;
X		sp->Xplval = plval;
X		sp->Xm1val = m1val;
X		sp->Xm2val = m2val;
X		sp->Xm3val = m3val;
X		sp->Xm4val = m4val;
X		sp->Xfill  = fill;
X		sp->Xrjust = rjust;
X		sp->Xcchar = cchar;
X		sp->Xgenesc= genesc;
X		sp->Xroman = roman;
X		sp->Xbolding = bolding;
X		sp->Xpaging = paging;
X		sp->Xautopar = autopar;
X
X		sp->prev = top;
X		top = sp;
X	}
X	return(TRUE);
X}
X
Xrestore()
X{
X	struct _proffitem *sp;
X
X	if (top != NULL) {
X
X		inval = top->Xinval;
X		rmval = top->Xrmval;
X		offset= top->Xoffset;
X		lsval = top->Xlsval;
X		plval = top->Xplval;
X		m1val = top->Xm1val;
X		m2val = top->Xm2val;
X		m3val = top->Xm3val;
X		m4val = top->Xm4val;
X		fill  = top->Xfill;
X		rjust = top->Xrjust;
X		cchar = top->Xcchar;
X		genesc= top->Xgenesc;
X		roman = top->Xroman;
X		bolding = top->Xbolding;
X		paging = top->Xpaging;
X		autopar = top->Xautopar;
X
X		sp = top->prev;
X		free(top);
X		p_memoryus -= sizeof(struct _proffitem);
X		if ((top = sp) == NULL)
X			head = NULL;
X	}
X	else
X		fprintf(stderr,poperr);
X}
SHAR_EOF
if test 1909 -ne "`wc -c 'stack.c'`"
then
	echo shar: error transmitting "'stack.c'" '(should have been 1909 characters)'
fi
#	End of shell archive
exit 0

-- 
					Jwahar R. Bammi
			       Usenet:  .....!decvax!cwruecmp!bammi
			        CSnet:  bammi@case
				 Arpa:  bammi%case@csnet-relay
			   CompuServe:  71515,155