From d1c781eaf43e6bcda56428457ef9ccceb2469865 Mon Sep 17 00:00:00 2001 From: gdr-ftp Date: Fri, 15 Jan 1999 08:36:31 +0000 Subject: [PATCH] Makefile: - completely changed for new builds awgs.c, awgs.h: - renamed to aroff.c and aroff.h, respectively - inserted RCS Id tag - reformatted source (not substantive changes) aroff.1, aroff.rez, aroff.desc: - initial checkin --- bin/aroff/Makefile | 14 +-- bin/aroff/aroff.1 | 31 ++++++ bin/aroff/aroff.c | 256 +++++++++++++++++++++++-------------------- bin/aroff/aroff.desc | 12 ++ bin/aroff/aroff.rez | 19 ++++ bin/aroff/awgs.c | 160 --------------------------- bin/aroff/awgs.h | 57 ---------- bin/aroff/print.c | 184 ++++++++++++++++--------------- 8 files changed, 300 insertions(+), 433 deletions(-) create mode 100644 bin/aroff/aroff.1 create mode 100644 bin/aroff/aroff.desc create mode 100644 bin/aroff/aroff.rez delete mode 100644 bin/aroff/awgs.c delete mode 100644 bin/aroff/awgs.h diff --git a/bin/aroff/Makefile b/bin/aroff/Makefile index 0235a6d..9293649 100644 --- a/bin/aroff/Makefile +++ b/bin/aroff/Makefile @@ -1,13 +1,11 @@ # -# Makefile for aroff -# AWGS WordProc -> Text formatter +# $Id: Makefile,v 1.2 1999/01/15 08:36:31 gdr-ftp Exp $ # -awgs.root: awgs.c awgs.h - compile awgs.c keep=awgs +PROG = aroff +SRCS = aroff.c print.c -print.root: print.c awgs.h - compile print.c keep=print +.INCLUDE : /src/gno/prog.mk -awgs: awgs.root - link awgs print 2/direct256 keep=aroff +aroff.o:: aroff.h +print.o:: aroff.h diff --git a/bin/aroff/aroff.1 b/bin/aroff/aroff.1 new file mode 100644 index 0000000..7f86674 --- /dev/null +++ b/bin/aroff/aroff.1 @@ -0,0 +1,31 @@ +.\" +.\" $Id: aroff.1,v 1.1 1999/01/15 08:36:31 gdr-ftp Exp $ +.\" +.TH AROFF 1 "15 January 1998" GNO "Commands and Applications" +.SH NAME +.BR aroff +\- print Appleworks GS formatted manual pages +.SH SYNOPSIS +.BR aroff +.RI [ -b ] +.IR filename " ..." +.SH DESCRIPTION +.BR aroff +is used to print out documents that are in Appleworks GS word processor +format. It is intended primarily for manual pages that have been so +formatted. +.LP +Early versions of GNO used +.BR aroff +formatted manual pages. The use of this format has been superceded by +.BR nroff (1); +.BR aroff +should be avoided in new documentation. +.SH OPTIONS +.IP \fB-b\fR +Do not use boldface text. +.SH HISTORY +.BR aroff +appeared in GNO v1.0. +.SH SEE ALSO +.BR nroff (1). diff --git a/bin/aroff/aroff.c b/bin/aroff/aroff.c index 23c21b4..c4b295b 100644 --- a/bin/aroff/aroff.c +++ b/bin/aroff/aroff.c @@ -4,6 +4,7 @@ Main loop driver code and awgs wordproc file read routines + $Id: aroff.c,v 1.2 1999/01/15 08:36:31 gdr-ftp Exp $ */ #pragma stacksize 2048 @@ -18,15 +19,17 @@ void fileError(char *s) { -int err; -int cl[2]; - - if (err = toolerror()) { - fprintf(stderr,"%s\n",s); - ERROR(&err); - cl[0] = 1; cl[1] = 0; CloseGS(cl); - exit(1); - } + int err; + int cl[2]; + + if (err = toolerror()) { + fprintf(stderr,"%s\n",s); + ERROR(&err); + cl[0] = 1; + cl[1] = 0; + CloseGS(cl); + exit(1); + } } int noboldflag = 0; @@ -37,124 +40,143 @@ word docSACount, numRulers, numBlocks; void readAWGS(char *file) { -int ref,err,z; /* refnum, err temp, and loop variable */ -long recBlockSize; /* size of the upcoming text block */ -int cl[2]; /* pBlock for GS/OS CloseGS call */ -GSString255 f; /* converted cstring(file) -> GSString */ -OpenRecGS o; /* pBlock for GS/OS Open call */ -SetPositionRecGS p; -IORecGS i; - - f.length = strlen(file); - strcpy(f.text,file); - o.pCount = 7; - o.pathname = &f; - o.requestAccess = readEnable; - o.resourceNumber = 0; - OpenGS(&o); - if (err = toolerror()) { - fprintf(stderr,"aroff: could not open AWGS file %s\n",file); - ERROR(&err); - exit(1); - } - ref = o.refNum; - if ((o.fileType != 0x50) || (o.auxType != 0x8010l)) { - cl[0] = 1; cl[1] = ref; CloseGS(cl); - fprintf(stderr,"aroff: file (%s) is not an AWGS file\n",file); - exit(1); - } - p.pCount = 3; p.refNum = ref; p.base = startPlus; p.displacement = 668l; - SetMarkGS(&p); fileError("SetMarkGS"); - - i.pCount = 4; - i.refNum = ref; - i.dataBuffer = (void *) &docSACount; - i.requestCount = 2l; - ReadGS(&i); fileError("ReadGS (docSACount)"); - -#ifdef DEBUG -fprintf(stderr,"Number of SaveArray entries: %d\n",docSACount); -#endif - - docSaveArray = calloc((size_t) docSACount, sizeof(saveArray)); - i.dataBuffer = (void *) docSaveArray; - i.requestCount = sizeof(saveArray) * docSACount; - ReadGS(&i); fileError("ReadGS (docSaveArray)"); - -#ifdef DEBUG -fprintf(stderr," saNum textBlock rulerNum\n"); -fprintf(stderr," ----- --------- --------\n"); -for (z = 0; z < docSACount; z++) { - fprintf(stderr," [%3d] %5d %5d\n", - z+1, docSaveArray[z].textBlock,docSaveArray[z].rulerNum); -} -#endif - - numRulers = numBlocks = 0; - for (z = 0; z < docSACount; z++) { - if (docSaveArray[z].rulerNum+1 > numRulers) - numRulers = docSaveArray[z].rulerNum+1; - if (docSaveArray[z].textBlock+1 > numBlocks) - numBlocks = docSaveArray[z].textBlock+1; - } -#ifdef DEBUG -fprintf(stderr,"Number of Rulers: %d\n",numRulers); -fprintf(stderr,"Number of Blocks: %d\n",numBlocks); -#endif - - docRulers = calloc((size_t) numRulers, sizeof(Ruler)); - i.dataBuffer = (void *) docRulers; - i.requestCount = sizeof(Ruler) * numRulers; - ReadGS(&i); fileError("ReadGS (docRulers)"); - - docTextBlocks = calloc((size_t) numBlocks, sizeof(textBlockPtr)); - for (z = 0; z < numBlocks; z++) { - i.requestCount = 4l; - i.dataBuffer = (void *) &recBlockSize; - ReadGS(&i); fileError("ReadGS (recBlockSize)"); - -#ifdef DEBUG -fprintf(stderr,"block %d size %8ld : ",z,recBlockSize); -#endif - docTextBlocks[z] = malloc(recBlockSize); - i.requestCount = recBlockSize; - i.dataBuffer = (void *) docTextBlocks[z]; - ReadGS(&i); fileError("ReadGS (textBlock)"); - } + int ref,err,z; /* refnum, err temp, and loop variable */ + long recBlockSize; /* size of the upcoming text block */ + int cl[2]; /* pBlock for GS/OS CloseGS call */ + GSString255 f; /* converted cstring(file) -> GSString */ + OpenRecGS o; /* pBlock for GS/OS Open call */ + SetPositionRecGS p; + IORecGS i; + f.length = strlen(file); + strcpy(f.text,file); + o.pCount = 7; + o.pathname = &f; + o.requestAccess = readEnable; + o.resourceNumber = 0; + OpenGS(&o); + if (err = toolerror()) { + fprintf(stderr,"aroff: could not open AWGS file %s\n",file); + ERROR(&err); + exit(1); + } + ref = o.refNum; + if ((o.fileType != 0x50) || (o.auxType != 0x8010l)) { cl[0] = 1; - cl[1] = ref; + cl[1] = ref; CloseGS(cl); + fprintf(stderr,"aroff: file (%s) is not an AWGS file\n",file); + exit(1); + } + p.pCount = 3; + p.refNum = ref; + p.base = startPlus; + p.displacement = 668l; + SetMarkGS(&p); + fileError("SetMarkGS"); + + i.pCount = 4; + i.refNum = ref; + i.dataBuffer = (void *) &docSACount; + i.requestCount = 2l; + ReadGS(&i); + fileError("ReadGS (docSACount)"); + +#ifdef DEBUG + fprintf(stderr,"Number of SaveArray entries: %d\n",docSACount); +#endif + + docSaveArray = calloc((size_t) docSACount, sizeof(saveArray)); + i.dataBuffer = (void *) docSaveArray; + i.requestCount = sizeof(saveArray) * docSACount; + ReadGS(&i); + fileError("ReadGS (docSaveArray)"); + +#ifdef DEBUG + fprintf(stderr," saNum textBlock rulerNum\n"); + fprintf(stderr," ----- --------- --------\n"); + for (z = 0; z < docSACount; z++) { + fprintf(stderr," [%3d] %5d %5d\n", + z+1, docSaveArray[z].textBlock,docSaveArray[z].rulerNum); + } +#endif + + numRulers = numBlocks = 0; + for (z = 0; z < docSACount; z++) { + if (docSaveArray[z].rulerNum+1 > numRulers) { + numRulers = docSaveArray[z].rulerNum+1; + } + if (docSaveArray[z].textBlock+1 > numBlocks) { + numBlocks = docSaveArray[z].textBlock+1; + } + } +#ifdef DEBUG + fprintf(stderr,"Number of Rulers: %d\n",numRulers); + fprintf(stderr,"Number of Blocks: %d\n",numBlocks); +#endif + + docRulers = calloc((size_t) numRulers, sizeof(Ruler)); + i.dataBuffer = (void *) docRulers; + i.requestCount = sizeof(Ruler) * numRulers; + ReadGS(&i); + fileError("ReadGS (docRulers)"); + + docTextBlocks = calloc((size_t) numBlocks, sizeof(textBlockPtr)); + for (z = 0; z < numBlocks; z++) { + i.requestCount = 4l; + i.dataBuffer = (void *) &recBlockSize; + ReadGS(&i); + fileError("ReadGS (recBlockSize)"); + +#ifdef DEBUG + fprintf(stderr,"block %d size %8ld : ",z,recBlockSize); +#endif + docTextBlocks[z] = malloc(recBlockSize); + i.requestCount = recBlockSize; + i.dataBuffer = (void *) docTextBlocks[z]; + ReadGS(&i); + fileError("ReadGS (textBlock)"); + } + + cl[0] = 1; + cl[1] = ref; + CloseGS(cl); } void usage(void) { - fprintf(stderr,"aroff [-b] file1 [file ...]\n" - "-b don't do any boldfacing (useful for GNO Ref. Manuals)\n"); - exit(1); + fprintf(stderr,"aroff [-b] file1 [file ...]\n" + "-b don't do any boldfacing (useful for GNO Ref. Manuals)\n"); + exit(1); } int main(int argc, char *argv[]) { -int i,z; -extern void printAWGS(void); -extern int _INITGNOSTDIO(); - - _INITGNOSTDIO(); - - if (argc == 1) usage(); - for (i = 1; i < argc; i++) { - if (*argv[i] == '-') { - if (argv[i][1] == 'b') - { noboldflag = 1; continue; } - else usage(); - } - readAWGS(argv[i]); - printAWGS(); - free(docSaveArray); - free(docRulers); - for (z = 0; z < numBlocks; z++) - free(docTextBlocks[z]); - free(docTextBlocks); + int i,z; + extern void printAWGS(void); + extern int _INITGNOSTDIO(); + + _INITGNOSTDIO(); + + if (argc == 1) { + usage(); + } + for (i = 1; i < argc; i++) { + if (*argv[i] == '-') { + if (argv[i][1] == 'b') { + noboldflag = 1; + continue; + } else { + usage(); + } } + readAWGS(argv[i]); + printAWGS(); + free(docSaveArray); + free(docRulers); + for (z = 0; z < numBlocks; z++) { + free(docTextBlocks[z]); + } + free(docTextBlocks); + } } diff --git a/bin/aroff/aroff.desc b/bin/aroff/aroff.desc new file mode 100644 index 0000000..c6b9116 --- /dev/null +++ b/bin/aroff/aroff.desc @@ -0,0 +1,12 @@ +Name: aroff +Version: 2.0 +Shell: GNO, ORCA +Author: Jawaid Bazyar. Maintained by Devin Reade. +Contact: gdr@trenco.gno.org +Where: /bin +FTP: ftp.gno.org + +Aroff (Apple ROFF) prints out documents that are in Appleworks GS word +processor format. It is intended primarily for use with manual pages that +have been so formatted. New manual pages should be written for nroff rather +than for aroff. diff --git a/bin/aroff/aroff.rez b/bin/aroff/aroff.rez new file mode 100644 index 0000000..fca1d9d --- /dev/null +++ b/bin/aroff/aroff.rez @@ -0,0 +1,19 @@ +/* + * $Id: aroff.rez,v 1.1 1999/01/15 08:36:31 gdr-ftp Exp $ + */ + +#include "Types.Rez" +#include "builddate.rez" + +resource rVersion (0x1, purgeable3, nocrossbank) { + + { 2, 0, 0, /* version 1.1.0 */ + release, /* development|alpha|beta|final|release */ + 0 /* non-final release number */ + }, + verUS, + "aroff", + "Apple ROFF.\n" + "Print Appleworks GS format manual pages.\n" + BUILD_DATE +}; diff --git a/bin/aroff/awgs.c b/bin/aroff/awgs.c deleted file mode 100644 index 23c21b4..0000000 --- a/bin/aroff/awgs.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - - awgs.c - - Main loop driver code and awgs wordproc file read routines - -*/ - -#pragma stacksize 2048 -#include -#include -#include -#include -#include -#include - -#include "awgs.h" - -void fileError(char *s) -{ -int err; -int cl[2]; - - if (err = toolerror()) { - fprintf(stderr,"%s\n",s); - ERROR(&err); - cl[0] = 1; cl[1] = 0; CloseGS(cl); - exit(1); - } -} - -int noboldflag = 0; -saveArray *docSaveArray; -Ruler *docRulers; -textBlock **docTextBlocks; /* an array of textBlockPtrs */ -word docSACount, numRulers, numBlocks; - -void readAWGS(char *file) -{ -int ref,err,z; /* refnum, err temp, and loop variable */ -long recBlockSize; /* size of the upcoming text block */ -int cl[2]; /* pBlock for GS/OS CloseGS call */ -GSString255 f; /* converted cstring(file) -> GSString */ -OpenRecGS o; /* pBlock for GS/OS Open call */ -SetPositionRecGS p; -IORecGS i; - - f.length = strlen(file); - strcpy(f.text,file); - o.pCount = 7; - o.pathname = &f; - o.requestAccess = readEnable; - o.resourceNumber = 0; - OpenGS(&o); - if (err = toolerror()) { - fprintf(stderr,"aroff: could not open AWGS file %s\n",file); - ERROR(&err); - exit(1); - } - ref = o.refNum; - if ((o.fileType != 0x50) || (o.auxType != 0x8010l)) { - cl[0] = 1; cl[1] = ref; CloseGS(cl); - fprintf(stderr,"aroff: file (%s) is not an AWGS file\n",file); - exit(1); - } - p.pCount = 3; p.refNum = ref; p.base = startPlus; p.displacement = 668l; - SetMarkGS(&p); fileError("SetMarkGS"); - - i.pCount = 4; - i.refNum = ref; - i.dataBuffer = (void *) &docSACount; - i.requestCount = 2l; - ReadGS(&i); fileError("ReadGS (docSACount)"); - -#ifdef DEBUG -fprintf(stderr,"Number of SaveArray entries: %d\n",docSACount); -#endif - - docSaveArray = calloc((size_t) docSACount, sizeof(saveArray)); - i.dataBuffer = (void *) docSaveArray; - i.requestCount = sizeof(saveArray) * docSACount; - ReadGS(&i); fileError("ReadGS (docSaveArray)"); - -#ifdef DEBUG -fprintf(stderr," saNum textBlock rulerNum\n"); -fprintf(stderr," ----- --------- --------\n"); -for (z = 0; z < docSACount; z++) { - fprintf(stderr," [%3d] %5d %5d\n", - z+1, docSaveArray[z].textBlock,docSaveArray[z].rulerNum); -} -#endif - - numRulers = numBlocks = 0; - for (z = 0; z < docSACount; z++) { - if (docSaveArray[z].rulerNum+1 > numRulers) - numRulers = docSaveArray[z].rulerNum+1; - if (docSaveArray[z].textBlock+1 > numBlocks) - numBlocks = docSaveArray[z].textBlock+1; - } -#ifdef DEBUG -fprintf(stderr,"Number of Rulers: %d\n",numRulers); -fprintf(stderr,"Number of Blocks: %d\n",numBlocks); -#endif - - docRulers = calloc((size_t) numRulers, sizeof(Ruler)); - i.dataBuffer = (void *) docRulers; - i.requestCount = sizeof(Ruler) * numRulers; - ReadGS(&i); fileError("ReadGS (docRulers)"); - - docTextBlocks = calloc((size_t) numBlocks, sizeof(textBlockPtr)); - for (z = 0; z < numBlocks; z++) { - i.requestCount = 4l; - i.dataBuffer = (void *) &recBlockSize; - ReadGS(&i); fileError("ReadGS (recBlockSize)"); - -#ifdef DEBUG -fprintf(stderr,"block %d size %8ld : ",z,recBlockSize); -#endif - docTextBlocks[z] = malloc(recBlockSize); - i.requestCount = recBlockSize; - i.dataBuffer = (void *) docTextBlocks[z]; - ReadGS(&i); fileError("ReadGS (textBlock)"); - } - - cl[0] = 1; - cl[1] = ref; - CloseGS(cl); -} - -void usage(void) -{ - fprintf(stderr,"aroff [-b] file1 [file ...]\n" - "-b don't do any boldfacing (useful for GNO Ref. Manuals)\n"); - exit(1); -} - -int main(int argc, char *argv[]) -{ -int i,z; -extern void printAWGS(void); -extern int _INITGNOSTDIO(); - - _INITGNOSTDIO(); - - if (argc == 1) usage(); - for (i = 1; i < argc; i++) { - if (*argv[i] == '-') { - if (argv[i][1] == 'b') - { noboldflag = 1; continue; } - else usage(); - } - readAWGS(argv[i]); - printAWGS(); - free(docSaveArray); - free(docRulers); - for (z = 0; z < numBlocks; z++) - free(docTextBlocks[z]); - free(docTextBlocks); - } -} diff --git a/bin/aroff/awgs.h b/bin/aroff/awgs.h deleted file mode 100644 index f3a7d54..0000000 --- a/bin/aroff/awgs.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - This file contains the data structures that are - used in AWGS Word Processor files. - - Data structures gleaned from DTS File Type Note TN.50.8010 -*/ - -/* #define DEBUG */ - -typedef struct pgraph { - word firstFont; - byte firstStyle; - byte firstSize; - byte firstColor; - word reserved; -} pgraph, *pgraphPtr; - -typedef struct textBlock { - word blockSize; - word blockUsed; - pgraphPtr pgraphs; -} textBlock, *textBlockPtr; - -typedef struct tabRec { - word tabLocation; - word tabType; -} tabRec, *tabRecPtr; - -#define rsFULL 0x80 -#define rsRIGHT 0x40 -#define rsCENTER 0x20 -#define rsLEFT 0x10 -#define rsNOBREAK 0x08 -#define rsTRIPLE 0x04 -#define rsDOUBLE 0x02 -#define rsSINGLE 0x01 - -typedef struct Ruler { - word numParagraphs; - word statusBits; - word leftMargin; - word indentMargin; - word rightMargin; - word numTabs; - tabRec tabRecs[10]; -} Ruler, *RulerPtr; - -typedef struct SaveArrEntry { - word textBlock; /* Text block number */ - word offset; /* offset + text block = paragraph */ - word attributes; /* 0 = normal text, 1 = page break paragrf */ - word rulerNum; /* #of ruler associated with this paragrf */ - word pixelHeight; /* height of paragraph in pixels */ - word numLines; /* # of lines in this paragraph */ -} saveArray, *saveArrayPtr; - -extern int noboldflag; diff --git a/bin/aroff/print.c b/bin/aroff/print.c index 3ca0737..2012e05 100644 --- a/bin/aroff/print.c +++ b/bin/aroff/print.c @@ -3,6 +3,7 @@ the code that formats each individual paragraph is here. + $Id: print.c,v 1.2 1999/01/15 08:36:31 gdr-ftp Exp $ */ #include @@ -39,72 +40,72 @@ char paraBuf[100][80]; paragraph according to the ruler. */ void printPara(RulerPtr ruler, pgraphPtr pptr) { -char *txt; -int width,z; -int curLine, col, printcol, numctrl; -int i,left,style; - - curLine = col = printcol = 0; - txt = ((char *)pptr) + sizeof(pgraph); - + char *txt; + int width,z; + int curLine, col, printcol, numctrl; + int i,left,style; + + curLine = col = printcol = 0; + txt = ((char *)pptr) + sizeof(pgraph); + calcLine: /* width determines how long this line is in characters; thus, where the break for word wrap will occur */ - if (curLine == 0) width = (ruler->rightMargin - ruler->indentMargin)/8; - else width = (ruler->rightMargin - ruler->leftMargin)/8; - - while (*txt != 0x0d) { - switch (*txt) { - case 1: txt+=3; break; - case 2: - style = *(++txt); - if (noboldflag) { ++txt; break; }/* turn off boldfacing */ - if (style & 3) paraBuf[curLine][col++] = 15; - else paraBuf[curLine][col++] = 14; - txt++; - break; - case 3: txt+=2; break; - case 4: txt+=2; break; - case 5: - case 6: - case 7: break; - - default: - if (printcol == width) { - numctrl = 0; - for (z = col - 1; z > 0; z--) { - if (paraBuf[curLine][z] == ' ') { - if (z != col - 1) - memcpy(¶Buf[curLine+1][0],¶Buf[curLine][z+1], - (size_t) (col - z - 1)); - paraBuf[curLine][z] = 0; - curLine++; printcol -= (z + 1 + numctrl); - col -= (z + 1); - goto calcLine; - } - else if (paraBuf[curLine][z] < ' ') numctrl++; - } - curLine++; col = printcol = 0; - /* one big word... don't break line */ - goto calcLine; - } - paraBuf[curLine][col] = *(txt++); - printcol++; col++; + if (curLine == 0) width = (ruler->rightMargin - ruler->indentMargin)/8; + else width = (ruler->rightMargin - ruler->leftMargin)/8; + + while (*txt != 0x0d) { + switch (*txt) { + case 1: txt+=3; break; + case 2: + style = *(++txt); + if (noboldflag) { ++txt; break; }/* turn off boldfacing */ + if (style & 3) paraBuf[curLine][col++] = 15; + else paraBuf[curLine][col++] = 14; + txt++; + break; + case 3: txt+=2; break; + case 4: txt+=2; break; + case 5: + case 6: + case 7: break; + + default: + if (printcol == width) { + numctrl = 0; + for (z = col - 1; z > 0; z--) { + if (paraBuf[curLine][z] == ' ') { + if (z != col - 1) + memcpy(¶Buf[curLine+1][0],¶Buf[curLine][z+1], + (size_t) (col - z - 1)); + paraBuf[curLine][z] = 0; + curLine++; printcol -= (z + 1 + numctrl); + col -= (z + 1); + goto calcLine; + } + else if (paraBuf[curLine][z] < ' ') numctrl++; + } + curLine++; col = printcol = 0; + /* one big word... don't break line */ + goto calcLine; } + paraBuf[curLine][col] = *(txt++); + printcol++; col++; } - paraBuf[curLine][col] = 0; - for (z = 0; z <= curLine; z++) { - if (z == 0) { - width = (ruler->rightMargin - ruler->indentMargin)/8; - left = (ruler->indentMargin)/8; - } - else { - width = (ruler->rightMargin - ruler->leftMargin)/8; - left = (ruler->leftMargin)/8; - } - for (i = 0; i < left; i++) putchar(' '); - printf("%s\n",paraBuf[z]); + } + paraBuf[curLine][col] = 0; + for (z = 0; z <= curLine; z++) { + if (z == 0) { + width = (ruler->rightMargin - ruler->indentMargin)/8; + left = (ruler->indentMargin)/8; } + else { + width = (ruler->rightMargin - ruler->leftMargin)/8; + left = (ruler->leftMargin)/8; + } + for (i = 0; i < left; i++) putchar(' '); + printf("%s\n",paraBuf[z]); + } } /* this is an obsolete routine that prints a paragraph with no @@ -112,24 +113,24 @@ calcLine: #ifdef NOTDEFINED void printPara(RulerPtr ruler, pgraphPtr pptr) { -char *txt; - - txt = ((char *)pptr) + sizeof(pgraph); - while (*txt != 0x0D) { - switch (*txt) { - case 1: txt+=2; break; - case 2: txt++; break; - case 3: txt++; break; - case 4: txt++; break; - case 5: - case 6: - case 7: break; - - default: putchar(*txt); - } - txt++; - } - putchar('\n'); + char *txt; + + txt = ((char *)pptr) + sizeof(pgraph); + while (*txt != 0x0D) { + switch (*txt) { + case 1: txt+=2; break; + case 2: txt++; break; + case 3: txt++; break; + case 4: txt++; break; + case 5: + case 6: + case 7: break; + + default: putchar(*txt); + } + txt++; + } + putchar('\n'); } #endif @@ -138,20 +139,21 @@ char *txt; void printAWGS(void) { -int z; -pgraphPtr pptr; -char *txt; -char x; - - for (z = 0; z < docSACount; z++) { - pptr = (pgraphPtr) (((byte *)docTextBlocks[docSaveArray[z].textBlock]) - + docSaveArray[z].offset); + int z; + pgraphPtr pptr; + char *txt; + char x; + + for (z = 0; z < docSACount; z++) { + pptr = (pgraphPtr) (((byte *)docTextBlocks[docSaveArray[z].textBlock]) + + docSaveArray[z].offset); #ifdef DEBUG -fprintf(stderr,"[%d] offset %d paragraph : %08lX",z,docSaveArray[z].offset, - pptr); -fprintf(stderr," textBlock: %08lX\n",docTextBlocks[docSaveArray[z].textBlock]); + fprintf(stderr, "[%d] offset %d paragraph : %08lX", z, + docSaveArray[z].offset, pptr); + fprintf(stderr, " textBlock: %08lX\n", + docTextBlocks[docSaveArray[z].textBlock]); #endif - printPara(&docRulers[docSaveArray[z].rulerNum],pptr); - } + printPara(&docRulers[docSaveArray[z].rulerNum],pptr); + } }