mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-06-05 01:29:31 +00:00
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
This commit is contained in:
parent
1fb579993f
commit
d1c781eaf4
|
@ -1,13 +1,11 @@
|
||||||
#
|
#
|
||||||
# Makefile for aroff
|
# $Id: Makefile,v 1.2 1999/01/15 08:36:31 gdr-ftp Exp $
|
||||||
# AWGS WordProc -> Text formatter
|
|
||||||
#
|
#
|
||||||
|
|
||||||
awgs.root: awgs.c awgs.h
|
PROG = aroff
|
||||||
compile awgs.c keep=awgs
|
SRCS = aroff.c print.c
|
||||||
|
|
||||||
print.root: print.c awgs.h
|
.INCLUDE : /src/gno/prog.mk
|
||||||
compile print.c keep=print
|
|
||||||
|
|
||||||
awgs: awgs.root
|
aroff.o:: aroff.h
|
||||||
link awgs print 2/direct256 keep=aroff
|
print.o:: aroff.h
|
||||||
|
|
31
bin/aroff/aroff.1
Normal file
31
bin/aroff/aroff.1
Normal file
|
@ -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).
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
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 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma stacksize 2048
|
#pragma stacksize 2048
|
||||||
|
@ -18,15 +19,17 @@
|
||||||
|
|
||||||
void fileError(char *s)
|
void fileError(char *s)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
int cl[2];
|
int cl[2];
|
||||||
|
|
||||||
if (err = toolerror()) {
|
if (err = toolerror()) {
|
||||||
fprintf(stderr,"%s\n",s);
|
fprintf(stderr,"%s\n",s);
|
||||||
ERROR(&err);
|
ERROR(&err);
|
||||||
cl[0] = 1; cl[1] = 0; CloseGS(cl);
|
cl[0] = 1;
|
||||||
exit(1);
|
cl[1] = 0;
|
||||||
}
|
CloseGS(cl);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int noboldflag = 0;
|
int noboldflag = 0;
|
||||||
|
@ -37,124 +40,143 @@ 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 */
|
GSString255 f; /* converted cstring(file) -> GSString */
|
||||||
OpenRecGS o; /* pBlock for GS/OS Open call */
|
OpenRecGS o; /* pBlock for GS/OS Open call */
|
||||||
SetPositionRecGS p;
|
SetPositionRecGS p;
|
||||||
IORecGS i;
|
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)");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
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[0] = 1;
|
||||||
cl[1] = ref;
|
cl[1] = ref;
|
||||||
CloseGS(cl);
|
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)
|
void usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr,"aroff [-b] file1 [file ...]\n"
|
fprintf(stderr,"aroff [-b] file1 [file ...]\n"
|
||||||
"-b don't do any boldfacing (useful for GNO Ref. Manuals)\n");
|
"-b don't do any boldfacing (useful for GNO Ref. Manuals)\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i,z;
|
int i,z;
|
||||||
extern void printAWGS(void);
|
extern void printAWGS(void);
|
||||||
extern int _INITGNOSTDIO();
|
extern int _INITGNOSTDIO();
|
||||||
|
|
||||||
_INITGNOSTDIO();
|
_INITGNOSTDIO();
|
||||||
|
|
||||||
if (argc == 1) usage();
|
if (argc == 1) {
|
||||||
for (i = 1; i < argc; i++) {
|
usage();
|
||||||
if (*argv[i] == '-') {
|
}
|
||||||
if (argv[i][1] == 'b')
|
for (i = 1; i < argc; i++) {
|
||||||
{ noboldflag = 1; continue; }
|
if (*argv[i] == '-') {
|
||||||
else usage();
|
if (argv[i][1] == 'b') {
|
||||||
}
|
noboldflag = 1;
|
||||||
readAWGS(argv[i]);
|
continue;
|
||||||
printAWGS();
|
} else {
|
||||||
free(docSaveArray);
|
usage();
|
||||||
free(docRulers);
|
}
|
||||||
for (z = 0; z < numBlocks; z++)
|
|
||||||
free(docTextBlocks[z]);
|
|
||||||
free(docTextBlocks);
|
|
||||||
}
|
}
|
||||||
|
readAWGS(argv[i]);
|
||||||
|
printAWGS();
|
||||||
|
free(docSaveArray);
|
||||||
|
free(docRulers);
|
||||||
|
for (z = 0; z < numBlocks; z++) {
|
||||||
|
free(docTextBlocks[z]);
|
||||||
|
}
|
||||||
|
free(docTextBlocks);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
12
bin/aroff/aroff.desc
Normal file
12
bin/aroff/aroff.desc
Normal file
|
@ -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.
|
19
bin/aroff/aroff.rez
Normal file
19
bin/aroff/aroff.rez
Normal file
|
@ -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
|
||||||
|
};
|
160
bin/aroff/awgs.c
160
bin/aroff/awgs.c
|
@ -1,160 +0,0 @@
|
||||||
/*
|
|
||||||
|
|
||||||
awgs.c
|
|
||||||
|
|
||||||
Main loop driver code and awgs wordproc file read routines
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma stacksize 2048
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <gsos.h>
|
|
||||||
#include <shell.h>
|
|
||||||
|
|
||||||
#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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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;
|
|
|
@ -3,6 +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 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -39,72 +40,72 @@ char paraBuf[100][80];
|
||||||
paragraph according to the ruler. */
|
paragraph according to the ruler. */
|
||||||
void printPara(RulerPtr ruler, pgraphPtr pptr)
|
void printPara(RulerPtr ruler, pgraphPtr pptr)
|
||||||
{
|
{
|
||||||
char *txt;
|
char *txt;
|
||||||
int width,z;
|
int width,z;
|
||||||
int curLine, col, printcol, numctrl;
|
int curLine, col, printcol, numctrl;
|
||||||
int i,left,style;
|
int i,left,style;
|
||||||
|
|
||||||
curLine = col = printcol = 0;
|
curLine = col = printcol = 0;
|
||||||
txt = ((char *)pptr) + sizeof(pgraph);
|
txt = ((char *)pptr) + sizeof(pgraph);
|
||||||
|
|
||||||
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) width = (ruler->rightMargin - ruler->indentMargin)/8;
|
||||||
else width = (ruler->rightMargin - ruler->leftMargin)/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) { ++txt; break; }/* turn off boldfacing */
|
||||||
if (style & 3) paraBuf[curLine][col++] = 15;
|
if (style & 3) paraBuf[curLine][col++] = 15;
|
||||||
else paraBuf[curLine][col++] = 14;
|
else paraBuf[curLine][col++] = 14;
|
||||||
txt++;
|
txt++;
|
||||||
break;
|
break;
|
||||||
case 3: txt+=2; break;
|
case 3: txt+=2; break;
|
||||||
case 4: txt+=2; break;
|
case 4: txt+=2; break;
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case 7: break;
|
case 7: break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (printcol == width) {
|
if (printcol == width) {
|
||||||
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(¶Buf[curLine+1][0],¶Buf[curLine][z+1],
|
memcpy(¶Buf[curLine+1][0],¶Buf[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 */
|
||||||
goto calcLine;
|
goto calcLine;
|
||||||
}
|
|
||||||
paraBuf[curLine][col] = *(txt++);
|
|
||||||
printcol++; col++;
|
|
||||||
}
|
}
|
||||||
|
paraBuf[curLine][col] = *(txt++);
|
||||||
|
printcol++; col++;
|
||||||
}
|
}
|
||||||
paraBuf[curLine][col] = 0;
|
}
|
||||||
for (z = 0; z <= curLine; z++) {
|
paraBuf[curLine][col] = 0;
|
||||||
if (z == 0) {
|
for (z = 0; z <= curLine; z++) {
|
||||||
width = (ruler->rightMargin - ruler->indentMargin)/8;
|
if (z == 0) {
|
||||||
left = (ruler->indentMargin)/8;
|
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]);
|
|
||||||
}
|
}
|
||||||
|
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
|
/* this is an obsolete routine that prints a paragraph with no
|
||||||
|
@ -112,24 +113,24 @@ calcLine:
|
||||||
#ifdef NOTDEFINED
|
#ifdef NOTDEFINED
|
||||||
void printPara(RulerPtr ruler, pgraphPtr pptr)
|
void printPara(RulerPtr ruler, pgraphPtr pptr)
|
||||||
{
|
{
|
||||||
char *txt;
|
char *txt;
|
||||||
|
|
||||||
txt = ((char *)pptr) + sizeof(pgraph);
|
txt = ((char *)pptr) + sizeof(pgraph);
|
||||||
while (*txt != 0x0D) {
|
while (*txt != 0x0D) {
|
||||||
switch (*txt) {
|
switch (*txt) {
|
||||||
case 1: txt+=2; break;
|
case 1: txt+=2; break;
|
||||||
case 2: txt++; break;
|
case 2: txt++; break;
|
||||||
case 3: txt++; break;
|
case 3: txt++; break;
|
||||||
case 4: txt++; break;
|
case 4: txt++; break;
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case 7: break;
|
case 7: break;
|
||||||
|
|
||||||
default: putchar(*txt);
|
default: putchar(*txt);
|
||||||
}
|
}
|
||||||
txt++;
|
txt++;
|
||||||
}
|
}
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -138,20 +139,21 @@ char *txt;
|
||||||
|
|
||||||
void printAWGS(void)
|
void printAWGS(void)
|
||||||
{
|
{
|
||||||
int z;
|
int z;
|
||||||
pgraphPtr pptr;
|
pgraphPtr pptr;
|
||||||
char *txt;
|
char *txt;
|
||||||
char x;
|
char x;
|
||||||
|
|
||||||
for (z = 0; z < docSACount; z++) {
|
for (z = 0; z < docSACount; z++) {
|
||||||
pptr = (pgraphPtr) (((byte *)docTextBlocks[docSaveArray[z].textBlock])
|
pptr = (pgraphPtr) (((byte *)docTextBlocks[docSaveArray[z].textBlock])
|
||||||
+ docSaveArray[z].offset);
|
+ docSaveArray[z].offset);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr,"[%d] offset %d paragraph : %08lX",z,docSaveArray[z].offset,
|
fprintf(stderr, "[%d] offset %d paragraph : %08lX", z,
|
||||||
pptr);
|
docSaveArray[z].offset, pptr);
|
||||||
fprintf(stderr," textBlock: %08lX\n",docTextBlocks[docSaveArray[z].textBlock]);
|
fprintf(stderr, " textBlock: %08lX\n",
|
||||||
|
docTextBlocks[docSaveArray[z].textBlock]);
|
||||||
#endif
|
#endif
|
||||||
printPara(&docRulers[docSaveArray[z].rulerNum],pptr);
|
printPara(&docRulers[docSaveArray[z].rulerNum],pptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user