Article View: net.micro.atari16
Article #2303Scribble-->Proff (v.2) part 2 of 3
From: Robert Royar
Date: Tue, 14 Oct 1986 01:12
Date: Tue, 14 Oct 1986 01:12
859 lines
22542 bytes
22542 bytes
# This is a shell archive.
# Remove everything above and including the cut line.
# Then run the rest of the file through sh.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: Shell Archiver
# Run the following text with /bin/sh to create:
# envir.c
# device.c
# This archive created: Mon Oct 13 21:04:59 1986
sed 's/^x//' << \SHAR_EOF > envir.c
x/* envir.c major and minor environments for scribble -> proff preprocessor */
x
x#include "scribe.h"
x
xstyle(f)
xint f;
x{
x char stylstr[512];
x register int i;
x register int c;
x int myfence;
x
x i = 0;
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence) {
x error();
x fatal();
x }
x while ((c=text[txtind]) != myfence)
x stylstr[i++] = text[txtind++];
x ++txtind;
x stylstr[i] = '\0';
x if (lastchar(stdout) != '\n')
x putchar('\n');
x printf("@style(%s)\n",stylstr);
x return(TRUE);
x}
x
xsp(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(".sp",stdout);
x while ((c=text[txtind]) != myfence)
x fputc(text[txtind++],stdout);
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x return(TRUE);
x}
x
xux(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".ul all\n.ul on",stdout);
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".ul off");
x return(TRUE);
x}
x
xinclude(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(".source ",stdout);
x while ((c=text[txtind]) != myfence)
x fputc(text[txtind++],stdout);
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x return(TRUE);
x}
x
xvrbate(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".save\n.nap\n.nf\n.ls 1");
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".restore");
x return(TRUE);
x}
x
xenumer(f)
xint f;
x{
x register int c;
x int myfence;
x register int i;
x
x i = 1;
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(".save\n.list\n.item 1.",stdout);
x if (text[txtind] != '\n')
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x if (lastchar(stdout) == '\n' && text[txtind] == '\n')
x printf(".item %d.",++i);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".nolist\n.restore");
x return(TRUE);
x}
x
xquote(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".save\n.in +5\n.rm -5\n.ls 1");
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".restore"); /* turn it off */
x return(TRUE);
x}
x
xitemz(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(".save\n.list\n.br\n.item - ",stdout);
x if (text[txtind] != '\n')
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x if (lastchar(stdout) == '\n' && text[txtind] == '\n')
x fputs(".item - ",stdout);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".nolist\n.restore");
x return(TRUE);
x}
x
xundent(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".in +5\n.ti -5");
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x if (lastchar(stdout) == '\n' && text[txtind] == '\n')
x fputs(".ti -5",stdout);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".in -5");
x return(TRUE);
x}
x
xunbound(f)
xint f;
x{
x if (lastchar(stdout) != '\n')
x putchar('\n');
x printf(".%s\n",command); /* turn on command */
x return(TRUE);
x}
x
xsubh(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".ul all\n.sp 2\n.ul on");
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".ul off\n.sp 2");
x return(TRUE);
x}
x
xhead(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(".sp 4\n.ce on");
x puts(bdon);
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x puts(bdoff);
x puts(".ce off\n.sp 2");
x return(TRUE);
x}
x
xnewpage()
x{
x putchar('\n');
x puts(".bp");
x return(TRUE);
x}
x
xchapter(f)
xint f;
x{
x register int i;
x register int c;
x int myfence;
x i = 0;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x chaptitle[i++] = text[txtind++];
x }
x chaptitle[i] = '\0';
x ++txtind;
x printf("\n.bp\n.sp 4\n.ce on\n%s\n.cl 0 %d %s\n%s\n%s\n.sp 4\n.ce off\n"
,
x bdon,chapnum,chaptitle,chaptitle,bdoff);
x strcpy(curvlbl,"chapter");
x strcpy(cursval,chaptitle);
x putvar(VARSTR);
x sectnum = 1;
x ++chapnum;
x return(TRUE);
x}
x
xsection(f)
xint f;
x{
x register int i;
x register int c;
x int myfence;
x i = 0;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x secttitle[i++] = text[txtind++];
x }
x secttitle[i] = '\0';
x ++txtind;
x printf("\n.sp 2\n%s\n.cl 1 %d.%d %s\n%d.%d %s\n%s\n.sp 2\n",
x ulon,chapnum-1,sectnum,secttitle,chapnum-1,sectnum,secttitle,uloff);
x strcpy(curvlbl,"section");
x strcpy(cursval,secttitle);
x putvar(VARSTR);
x sectnum++;
x return(TRUE);
x}
x
xhe(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(".he ",stdout);
x while ((c=text[txtind]) != myfence)
x fputc(text[txtind++],stdout);
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x return(TRUE);
x}
x
xfo(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(".so ",stdout);
x while ((c=text[txtind]) != myfence)
x fputc(text[txtind++],stdout);
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x return(TRUE);
x}
x
xneed(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(".need ",stdout);
x while ((c=text[txtind]) != myfence)
x fputc(text[txtind++],stdout);
x ++txtind;
x if (lastchar(stdout) != '\n')
x putchar('\n');
x return(TRUE);
x}
x
xcomment(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x while ((c=text[++txtind]) != myfence);
x return(TRUE);
x}
x
xlastchar(fp)
xFILE *fp;
x{
x register char c;
x register char *optr;
x
x optr = fp->_ptr;
x c = *--optr;
x return(c);
x}
SHAR_EOF
sed 's/^x//' << \SHAR_EOF > device.c
x/* device.c printer tables to allow the @device() directive and direct
x * printer control.
x */
x
x#include "scribe.h"
x
x/* printer strings for device support */
x
xchar prnname[15];
xchar bdon[15];
xchar bdoff[15];
xchar ulon[15];
xchar uloff[15];
xchar hlfdn[15];
xchar hlfup[15];
xchar pinit[15];
xchar preset[15];
xchar ptch[15];
xchar lhght[15];
xint devflag;
x
xtypedef struct {
x char prnname[15];
x char bdon[15];
x char bdoff[15];
x char ulon[15];
x char uloff[15];
x char hlfdn[15];
x char hlfup[15];
x char init[15];
x char reset[15];
x char ptch[15];
x char lhght[15];
x int devflag;
x}DVCTAB;
x
xDVCTAB devtab[] = {
x /* vanilla */
x "plain",
x ".bd on",".bd off",".ul on",".ul off",
x "","",
x "",".bp",
x "","",DEVPLN,
x
x /* Brother HR-15,25,35 */
x "Brother",
x "W","&","E","R",
x "U","D",
x ".wr 27 13 80",".wr 27 13 80",
x "","",DEVFNCY,
x
x /* QUME */
x "Qume",
x "W","&","E","R",
x "U","D",
x ".wr 27 13 50",".wr 27 15 50",
x "","",DEVFNCY,
x
x /* Prowriter Jr. */
x "Prowriter",
x "E","F","-","-",
x "T","S\0",
x "@","@",
x "","",DEVFNCY,
x
x /* Epson LX-80 */
x "LX-80",
x "E","F","-","-",
x "T","S\0",
x "@","@",
x "","",DEVFNCY,
x
x /* Epson RX-80 */
x "RX-80",
x "E","F","-","-",
x "T","S\0",
x "@","@",
x "","",DEVFNCY,
x
x /* Atari */
x "Atari",
x "E","F","-","-",
x "T","S\0",
x "@","@",
x "","",DEVFNCY
x
x /* coming soon */
x /* FILE */
x /* CON: */
x};
x
x#define NDEVTAB (sizeof(devtab)/sizeof(devtab[0]))
x
xsetdvc(f)
xint f;
x{
x register DVCTAB *dtp;
x
x dtp = &devtab[0];
x while (dtp < &devtab[NDEVTAB]) {
x if (strcmp(dtp->prnname,prnname)==0) {
x strcpy(bdon,dtp->bdon);
x strcpy(bdoff,dtp->bdoff);
x strcpy(ulon,dtp->ulon);
x strcpy(uloff,dtp->uloff);
x strcpy(hlfdn,dtp->hlfdn);
x strcpy(hlfup,dtp->hlfup);
x strcpy(pinit,dtp->init);
x strcpy(preset,dtp->reset);
x strcpy(ptch,dtp->ptch);
x strcpy(lhght,dtp->lhght);
x devflag = dtp->devflag;
x return(f);
x }
x ++dtp;
x }
x fprintf(stderr,"Device %s is not defined, using %s\n",prnname,DEFPRN);
x strcpy(prnname,DEFPRN);
x setdvc(f);
x return(f);
x}
x
xdevice(f)
xint f;
x{
x register int i;
x register int c;
x int myfence;
x
x i = 0;
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (lastchar(stdout) != '\n')
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x prnname[i++] = text[txtind++];
x }
x prnname[i] = '\0';
x ++txtind;
x setdvc(f);
x fprintf(stderr,"%cNow formatting for device %s\r",0x07,prnname);
x return(TRUE);
x}
x
xheight(f)
xint f;
x{
x char hstr[15];
x register int i;
x register int c;
x int myfence;
x int ascstr;
x
x i = 0;
x myfence = (f == TRUE ? '\0' : fence);
x if (f == TRUE)
x if (gettext() != fence)
x error();
x while ((c=text[txtind]) != myfence)
x hstr[i++] = text[txtind++];
x hstr[i] = '\0';
x ++txtind;
x ascstr = atoi(hstr);
x if (devflag == DEVFNCY) {
x fputs(lhght,stdout);
x putchar(ascstr);
x }
x return(TRUE);
x}
x
xpitch(f)
xint f;
x{
x char pstr[15];
x register int i;
x register int c;
x int myfence;
x int ascstr;
x
x i = 0;
x myfence = (f == TRUE ? '\0' : fence);
x if (f == TRUE)
x if (gettext() != fence)
x error();
x while ((c=text[txtind]) != myfence)
x pstr[i++] = text[txtind++];
x pstr[i] = '\0';
x ++txtind;
x ascstr = atoi(pstr);
x if (devflag == DEVFNCY) {
x fputs(ptch,stdout);
x putchar(ascstr);
x }
x return(TRUE);
x}
x
xu(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(ulon,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(uloff,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x return(TRUE);
x}
x
xbold(f)
xint f;
x{
x register int c;
x int myfence;
x int nowrt = FALSE;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(bdon,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(bdoff,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x return(TRUE);
x}
x
xsuper(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(hlfup,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(hlfdn,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x return(TRUE);
x}
x
xsub(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0': fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(hlfdn,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x while ((c=text[txtind]) != myfence) {
x if (c == '@') {
x fence=getcmd(FALSE);
x execute(FALSE);
x }
x fputc(text[txtind++],stdout);
x }
x ++txtind;
x if (devflag == DEVPLN)
x if (lastchar(stdout) != '\n')
x putchar('\n');
x fputs(hlfup,stdout);
x if (devflag == DEVPLN)
x putchar('\n');
x return(TRUE);
x}
x
xreset(f)
xint f;
x{
x register int c;
x int myfence;
x
x myfence = (f == TRUE ? '\0' : fence);
x
x if (f == TRUE)
x if (gettext() != fence)
x error();
x while ((c=text[++txtind]) != myfence);
x puts(preset);
x return(TRUE);
x}
SHAR_EOF
# End of shell archive
exit 0
%NONAME-W-NOMSG, Message number 00000000
Technical Details
Message-ID:
<8610140449.AA06375@ucbvax.Berkeley.EDU>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!think!nike!ucbcad!ucbvax!ULKYVX.BITNET!RDROYA01Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!think!nike!ucbcad!ucbvax!ULKYVX.BITNET!RDROYA01 From: RDROYA01@ULKYVX.BITNET (Robert Royar) Newsgroups: net.micro.atari16 Subject: Scribble-->Proff (v.2) part 2 of 3 Message-ID: <8610140449.AA06375@ucbvax.Berkeley.EDU> Date: Mon, 13-Oct-86 21:12:00 EDT Article-I.D.: ucbvax.8610140449.AA06375 Posted: Mon Oct 13 21:12:00 1986 Date-Received: Tue, 14-Oct-86 07:21:53 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: University of Louisville Lines: 859