- checked and reduced stack size to 1k (actually used is about 748)
	- changed awgs.h --> aroff.h
	- minor formatting changes
	- added some missing header files
	- eliminated a call to some old GNO v1.0 (?) stdio initialization
print.c:
	- changed awgs.h --> aroff.h
	- minor formatting changes
This commit is contained in:
gdr-ftp 1999-01-15 15:45:04 +00:00
parent d1c781eaf4
commit d49f72c8b0
2 changed files with 42 additions and 28 deletions

View File

@ -4,18 +4,24 @@
Main loop driver code and awgs wordproc file read routines 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 $ $Id: aroff.c,v 1.3 1999/01/15 15:45:04 gdr-ftp Exp $
*/ */
#pragma stacksize 2048
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stddef.h> #include <stddef.h>
#include <gsos.h> #include <gsos.h>
#include <shell.h> #include <shell.h>
#include <orca.h>
#include <gno/gno.h>
#include "aroff.h"
#include "awgs.h" int noboldflag = 0;
saveArray *docSaveArray;
Ruler *docRulers;
textBlock **docTextBlocks; /* an array of textBlockPtrs */
word docSACount, numRulers, numBlocks;
void fileError(char *s) void fileError(char *s)
{ {
@ -32,21 +38,15 @@ void fileError(char *s)
} }
} }
int noboldflag = 0;
saveArray *docSaveArray;
Ruler *docRulers;
textBlock **docTextBlocks; /* an array of textBlockPtrs */
word docSACount, numRulers, numBlocks;
void readAWGS(char *file) void readAWGS(char *file)
{ {
int ref,err,z; /* refnum, err temp, and loop variable */ int ref,err,z; /* refnum, err temp, and loop variable */
long recBlockSize; /* size of the upcoming text block */ long recBlockSize; /* size of the upcoming text block */
int cl[2]; /* pBlock for GS/OS CloseGS call */ int cl[2]; /* pBlock for GS/OS CloseGS call */
GSString255 f; /* converted cstring(file) -> GSString */ static GSString255 f; /* converted cstring(file) -> GSString */
OpenRecGS o; /* pBlock for GS/OS Open call */ static OpenRecGS o; /* pBlock for GS/OS Open call */
SetPositionRecGS p; static SetPositionRecGS p;
IORecGS i; static IORecGS i;
f.length = strlen(file); f.length = strlen(file);
strcpy(f.text,file); strcpy(f.text,file);
@ -154,10 +154,13 @@ int main(int argc, char *argv[])
{ {
int i,z; int i,z;
extern void printAWGS(void); extern void printAWGS(void);
#if 0
extern int _INITGNOSTDIO(); extern int _INITGNOSTDIO();
_INITGNOSTDIO(); _INITGNOSTDIO();
#endif
__REPORT_STACK(); /* show stack usage on exit if __CHECK_STACK__ defined */
if (argc == 1) { if (argc == 1) {
usage(); usage();
} }

View File

@ -3,7 +3,7 @@
the code that formats each individual paragraph is here. the code that formats each individual paragraph is here.
$Id: print.c,v 1.2 1999/01/15 08:36:31 gdr-ftp Exp $ $Id: print.c,v 1.3 1999/01/15 15:45:04 gdr-ftp Exp $
*/ */
#include <stdio.h> #include <stdio.h>
@ -11,8 +11,7 @@
#include <string.h> #include <string.h>
#include <types.h> #include <types.h>
#include <texttool.h> #include <texttool.h>
#include "aroff.h"
#include "awgs.h"
extern saveArray *docSaveArray; extern saveArray *docSaveArray;
extern Ruler *docRulers; extern Ruler *docRulers;
@ -51,17 +50,26 @@ void printPara(RulerPtr ruler, pgraphPtr pptr)
calcLine: calcLine:
/* width determines how long this line is in characters; thus, where /* width determines how long this line is in characters; thus, where
the break for word wrap will occur */ the break for word wrap will occur */
if (curLine == 0) width = (ruler->rightMargin - ruler->indentMargin)/8; if (curLine == 0) {
else width = (ruler->rightMargin - ruler->leftMargin)/8; width = (ruler->rightMargin - ruler->indentMargin)/8;
} else {
width = (ruler->rightMargin - ruler->leftMargin)/8;
}
while (*txt != 0x0d) { while (*txt != 0x0d) {
switch (*txt) { switch (*txt) {
case 1: txt+=3; break; case 1: txt+=3; break;
case 2: case 2:
style = *(++txt); style = *(++txt);
if (noboldflag) { ++txt; break; }/* turn off boldfacing */ if (noboldflag) { /* turn off boldfacing */
if (style & 3) paraBuf[curLine][col++] = 15; ++txt;
else paraBuf[curLine][col++] = 14; break;
}
if (style & 3) {
paraBuf[curLine][col++] = 15;
} else {
paraBuf[curLine][col++] = 14;
}
txt++; txt++;
break; break;
case 3: txt+=2; break; case 3: txt+=2; break;
@ -75,15 +83,17 @@ calcLine:
numctrl = 0; numctrl = 0;
for (z = col - 1; z > 0; z--) { for (z = col - 1; z > 0; z--) {
if (paraBuf[curLine][z] == ' ') { if (paraBuf[curLine][z] == ' ') {
if (z != col - 1) if (z != col - 1) {
memcpy(&paraBuf[curLine+1][0],&paraBuf[curLine][z+1], memcpy(&paraBuf[curLine+1][0],&paraBuf[curLine][z+1],
(size_t) (col - z - 1)); (size_t) (col - z - 1));
}
paraBuf[curLine][z] = 0; paraBuf[curLine][z] = 0;
curLine++; printcol -= (z + 1 + numctrl); curLine++; printcol -= (z + 1 + numctrl);
col -= (z + 1); col -= (z + 1);
goto calcLine; goto calcLine;
} else if (paraBuf[curLine][z] < ' ') {
numctrl++;
} }
else if (paraBuf[curLine][z] < ' ') numctrl++;
} }
curLine++; col = printcol = 0; curLine++; col = printcol = 0;
/* one big word... don't break line */ /* one big word... don't break line */
@ -98,12 +108,13 @@ calcLine:
if (z == 0) { if (z == 0) {
width = (ruler->rightMargin - ruler->indentMargin)/8; width = (ruler->rightMargin - ruler->indentMargin)/8;
left = (ruler->indentMargin)/8; left = (ruler->indentMargin)/8;
} } else {
else {
width = (ruler->rightMargin - ruler->leftMargin)/8; width = (ruler->rightMargin - ruler->leftMargin)/8;
left = (ruler->leftMargin)/8; left = (ruler->leftMargin)/8;
} }
for (i = 0; i < left; i++) putchar(' '); for (i = 0; i < left; i++) {
putchar(' ');
}
printf("%s\n",paraBuf[z]); printf("%s\n",paraBuf[z]);
} }
} }