Checkpoint.
This commit is contained in:
parent
61f5c35c94
commit
b855148c9b
74 changed files with 5281 additions and 130 deletions
|
|
@ -4,9 +4,6 @@
|
|||
#include "../common/common.h"
|
||||
#include "tr2post.h"
|
||||
|
||||
#undef isspace
|
||||
#define isspace bisspace
|
||||
|
||||
int
|
||||
isspace(Rune r)
|
||||
{
|
||||
|
|
@ -14,7 +11,7 @@ isspace(Rune r)
|
|||
}
|
||||
|
||||
int
|
||||
Bskipws(Biobuf *bp) {
|
||||
Bskipws(Biobufhdr *bp) {
|
||||
int r;
|
||||
char c[UTFmax];
|
||||
int sindex = 0;
|
||||
|
|
@ -36,13 +33,15 @@ Bskipws(Biobuf *bp) {
|
|||
|
||||
int
|
||||
asc2dig(char c, int base) {
|
||||
if (c >= '0' && c <= '9')
|
||||
if (c >= '0' && c <= '9'){
|
||||
if (base == 8 && c > '7') return(-1);
|
||||
else return(c - '0');
|
||||
}
|
||||
|
||||
if (base == 16)
|
||||
if (base == 16){
|
||||
if (c >= 'a' && c <= 'f') return(10 + c - 'a');
|
||||
else if (c >= 'A' && c <= 'F') return(10 + c - 'A');
|
||||
}
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
|
@ -55,7 +54,7 @@ asc2dig(char c, int base) {
|
|||
*/
|
||||
|
||||
int
|
||||
Bgetfield(Biobuf *bp, int type, void *thing, int size) {
|
||||
Bgetfield(Biobufhdr *bp, int type, void *thing, int size) {
|
||||
int r;
|
||||
Rune R;
|
||||
char c[UTFmax];
|
||||
|
|
|
|||
|
|
@ -120,30 +120,31 @@ findpfn(char *fontname, int insflg) {
|
|||
return(-1);
|
||||
}
|
||||
|
||||
char postroffdirname[] = "#9/sys/lib/postscript/troff"; /* "/sys/lib/postscript/troff/"; */
|
||||
char troffmetricdirname[] = "#9/sys/lib/troff/font"; /* "/sys/lib/troff/font/devutf/"; */
|
||||
char postroffdirname[] = LIBDIR "/postscript/troff"; /* "/sys/lib/postscript/troff/"; */
|
||||
char troffmetricdirname[] = LIBDIR "/troff/font"; /* "/sys/lib/troff/font/devutf/"; */
|
||||
|
||||
int
|
||||
readpsfontdesc(char *fontname, int trindex) {
|
||||
static char *filename = 0;
|
||||
Biobuf *bfd;
|
||||
Biobuf *Bfd;
|
||||
Biobufhdr *Bfd;
|
||||
int warn = 0, errorflg = 0, line =1, rv;
|
||||
int start, end, offset;
|
||||
int startfont, endfont, startchar, endchar, i, pfid;
|
||||
char psfontnam[128];
|
||||
struct troffont *tp;
|
||||
/* struct charent *cp[]; */
|
||||
|
||||
if (debug) Bprint(Bstderr, "readpsfontdesc(%s,%d)\n", fontname, trindex);
|
||||
filename=galloc(filename, strlen(postroffdirname)+1+strlen(fontname)+1, "readpsfontdesc: cannot allocate memory\n");
|
||||
sprint(filename, "%s/%s", postroffdirname, fontname);
|
||||
|
||||
bfd = Bopen(unsharp(filename), OREAD);
|
||||
bfd = Bopen(filename, OREAD);
|
||||
if (bfd == 0) {
|
||||
error(WARNING, "cannot open file %s\n", filename);
|
||||
return(0);
|
||||
}
|
||||
Bfd = bfd;
|
||||
Bfd = bfd; /* &(bfd->Biobufhdr); */
|
||||
|
||||
do {
|
||||
offset = 0;
|
||||
|
|
@ -211,7 +212,7 @@ int
|
|||
readtroffmetric(char *fontname, int trindex) {
|
||||
static char *filename = 0;
|
||||
Biobuf *bfd;
|
||||
Biobuf *Bfd;
|
||||
Biobufhdr *Bfd;
|
||||
int warn = 0, errorflg = 0, line =1, rv;
|
||||
struct troffont *tp;
|
||||
struct charent **cp;
|
||||
|
|
@ -225,12 +226,12 @@ readtroffmetric(char *fontname, int trindex) {
|
|||
filename=galloc(filename, strlen(troffmetricdirname)+4+strlen(devname)+1+strlen(fontname)+1, "readtroffmetric():filename");
|
||||
sprint(filename, "%s/dev%s/%s", troffmetricdirname, devname, fontname);
|
||||
|
||||
bfd = Bopen(unsharp(filename), OREAD);
|
||||
bfd = Bopen(filename, OREAD);
|
||||
if (bfd == 0) {
|
||||
error(WARNING, "cannot open file %s\n", filename);
|
||||
return(0);
|
||||
}
|
||||
Bfd = bfd;
|
||||
Bfd = bfd; /* &(bfd->Biobufhdr); */
|
||||
do {
|
||||
/* deal with the few lines at the beginning of the
|
||||
* troff font metric files.
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@
|
|||
#include "tr2post.h"
|
||||
|
||||
void
|
||||
conv(Biobuf *Bp) {
|
||||
conv(Biobufhdr *Bp) {
|
||||
long c, n;
|
||||
int r;
|
||||
char special[10];
|
||||
int save;
|
||||
|
||||
inputlineno = 1;
|
||||
if (debug) Bprint(Bstderr, "conv(Biobuf *Bp=0x%x)\n", Bp);
|
||||
if (debug) Bprint(Bstderr, "conv(Biobufhdr *Bp=0x%x)\n", Bp);
|
||||
while ((r = Bgetrune(Bp)) >= 0) {
|
||||
/* Bprint(Bstderr, "r=<%c>,0x%x\n", r, r); */
|
||||
/* Bflush(Bstderr); */
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ struct sjt {
|
|||
|
||||
/* I won't need this if getfields can replace sscanf
|
||||
|
||||
extern void picture(Biobuf *);
|
||||
extern void picture(Biobufhdr *);
|
||||
extern void notavail(char *);
|
||||
|
||||
void
|
||||
PSInclude(Biobuf *inp) {
|
||||
PSInclude(Biobufhdr *inp) {
|
||||
char buf[256];
|
||||
|
||||
Bgetfield(inp, 's', buf, 256);
|
||||
|
|
@ -51,7 +51,7 @@ struct sjt specialjumptable[] = {
|
|||
*/
|
||||
|
||||
void
|
||||
devcntl(Biobuf *inp) {
|
||||
devcntl(Biobufhdr *inp) {
|
||||
|
||||
char cmd[50], buf[256], str[MAXTOKENSIZE], *line;
|
||||
int c, n, linelen;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ cover(double x, double y) {
|
|||
}
|
||||
|
||||
void
|
||||
drawspline(Biobuf *Bp, int flag) { /* flag!=1 connect end points */
|
||||
drawspline(Biobufhdr *Bp, int flag) { /* flag!=1 connect end points */
|
||||
int x[100], y[100];
|
||||
int i, N;
|
||||
/*
|
||||
|
|
@ -96,7 +96,7 @@ drawspline(Biobuf *Bp, int flag) { /* flag!=1 connect end points */
|
|||
}
|
||||
|
||||
void
|
||||
draw(Biobuf *Bp) {
|
||||
draw(Biobufhdr *Bp) {
|
||||
|
||||
int r, x1, y1, x2, y2, i;
|
||||
int d1, d2;
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@
|
|||
/* #include "ext.h" */
|
||||
|
||||
Biobuf *bfp_pic = NULL;
|
||||
Biobuf *Bfp_pic;
|
||||
Biobuf *picopen(char *);
|
||||
Biobufhdr *Bfp_pic;
|
||||
Biobufhdr *picopen(char *);
|
||||
|
||||
#define MAXGETFIELDS 16
|
||||
char *fields[MAXGETFIELDS];
|
||||
|
|
@ -63,7 +63,7 @@ extern int picflag;
|
|||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
picture(Biobuf *inp, char *buf) {
|
||||
picture(Biobufhdr *inp, char *buf) {
|
||||
int poffset; /* page offset */
|
||||
int indent; /* indent */
|
||||
int length; /* line length */
|
||||
|
|
@ -80,7 +80,7 @@ picture(Biobuf *inp, char *buf) {
|
|||
double adjx = 0.5; /* left-right adjustment */
|
||||
double adjy = 0.5; /* top-bottom adjustment */
|
||||
double rot = 0; /* rotation in clockwise degrees */
|
||||
Biobuf *fp_in; /* for *name */
|
||||
Biobufhdr *fp_in; /* for *name */
|
||||
int i; /* loop index */
|
||||
|
||||
/*
|
||||
|
|
@ -195,18 +195,18 @@ picture(Biobuf *inp, char *buf) {
|
|||
* open file *path and return the resulting file pointer to the caller.
|
||||
*
|
||||
*/
|
||||
Biobuf *
|
||||
Biobufhdr *
|
||||
picopen(char *path) {
|
||||
/* char name[100]; /* pathnames */
|
||||
/* long pos; /* current position */
|
||||
/* long total; /* and sizes - from *fp_pic */
|
||||
Biobuf *bfp;
|
||||
Biobuf *Bfp; /* and pointer for the new temp file */
|
||||
Biobufhdr *Bfp; /* and pointer for the new temp file */
|
||||
|
||||
|
||||
if ((bfp = Bopen(path, OREAD)) == 0)
|
||||
error(FATAL, "can't open %s\n", path);
|
||||
Bfp = bfp;
|
||||
Bfp = bfp; /* &(bfp->Biobufhdr); */
|
||||
return(Bfp);
|
||||
#ifdef UNDEF
|
||||
if (Bfp_pic != NULL) {
|
||||
|
|
@ -219,7 +219,7 @@ picopen(char *path) {
|
|||
error(FATAL, "can't generate temp file name");
|
||||
if ( (bfp = Bopen(pictmpname, ORDWR)) == NULL )
|
||||
error(FATAL, "can't open %s", pictmpname);
|
||||
Bfp = bfp;
|
||||
Bfp = &(bfp->Biobufhdr);
|
||||
piccopy(Bfp_pic, Bfp, total);
|
||||
Bseek(Bfp, 0L, 0);
|
||||
return(Bfp);
|
||||
|
|
@ -230,7 +230,7 @@ picopen(char *path) {
|
|||
if ((bfp = Bopen(path, OREAD)) == 0)
|
||||
Bfp = 0;
|
||||
else
|
||||
Bfp = bfp;
|
||||
Bfp = &(bfp->Biobufhdr);
|
||||
return(Bfp);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -249,7 +249,7 @@ picopen(char *path) {
|
|||
|
||||
#ifdef UNDEF
|
||||
void
|
||||
inlinepic(Biobuf *Bfp, char *buf) {
|
||||
inlinepic(Biobufhdr *Bfp, char *buf) {
|
||||
char name[100]; /* picture file pathname */
|
||||
long total; /* and size - both from *buf */
|
||||
|
||||
|
|
@ -285,7 +285,7 @@ inlinepic(Biobuf *Bfp, char *buf) {
|
|||
/* *fp_out; and output file pointers */
|
||||
/* total; number of bytes to be copied */
|
||||
void
|
||||
piccopy(Biobuf *Bfp_in, Biobuf *Bfp_out, long total) {
|
||||
piccopy(Biobufhdr *Bfp_in, Biobufhdr *Bfp_out, long total) {
|
||||
long i;
|
||||
|
||||
for (i = 0; i < total; i++)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ extern int curfontsize;
|
|||
typedef struct {long start, end;} Section;
|
||||
static char *buf;
|
||||
|
||||
static void
|
||||
copy(Biobuf *fin, Biobuf *fout, Section *s) {
|
||||
static
|
||||
copy(Biobufhdr *fin, Biobufhdr *fout, Section *s) {
|
||||
int cond;
|
||||
if (s->end <= s->start)
|
||||
return;
|
||||
|
|
@ -57,7 +57,7 @@ copy(Biobuf *fin, Biobuf *fout, Section *s) {
|
|||
/* rot; /* rotation - in clockwise degrees */
|
||||
|
||||
void
|
||||
ps_include(Biobuf *fin, Biobuf *fout, int page_no, int whiteout,
|
||||
ps_include(Biobufhdr *fin, Biobufhdr *fout, int page_no, int whiteout,
|
||||
int outline, int scaleboth, double cx, double cy, double sx, double sy,
|
||||
double ax, double ay, double rot) {
|
||||
char **strp;
|
||||
|
|
|
|||
|
|
@ -44,19 +44,19 @@ readDESC(void) {
|
|||
char *descnameformat = "%s/dev%s/DESC";
|
||||
char *descfilename = 0;
|
||||
Biobuf *bfd;
|
||||
Biobuf *Bfd;
|
||||
Biobufhdr *Bfd;
|
||||
int i, state = -1;
|
||||
int fontindex = 0;
|
||||
|
||||
if (debug) Bprint(Bstderr, "readDESC()\n");
|
||||
descfilename = galloc(descfilename, strlen(descnameformat)+strlen(FONTDIR)
|
||||
+strlen(devname)+1, "readdesc");
|
||||
+strlen(devname), "readdesc");
|
||||
sprint(descfilename, descnameformat, FONTDIR, devname);
|
||||
if ((bfd = Bopen(unsharp(descfilename), OREAD)) == 0) {
|
||||
if ((bfd = Bopen(descfilename, OREAD)) == 0) {
|
||||
error(WARNING, "cannot open file %s\n", descfilename);
|
||||
return(0);
|
||||
}
|
||||
Bfd = bfd;
|
||||
Bfd = bfd; /* &(bfd->Biobufhdr); */
|
||||
|
||||
while (Bgetfield(Bfd, 's', token, MAXTOKENSIZE) > 0) {
|
||||
for (i=0; i<NDESCTOKS; i++) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Biobuf binp, *bstdout, bstderr;
|
|||
Biobuf *Bstdin, *Bstdout, *Bstderr;
|
||||
int debug = 0;
|
||||
|
||||
char tmpfilename[MAXTOKENSIZE];
|
||||
char tmpfilename[MAXPATHLEN+1];
|
||||
char copybuf[BUFSIZ];
|
||||
|
||||
|
||||
|
|
@ -41,20 +41,20 @@ prologues(void) {
|
|||
Bprint(Bstdout, "%s %s\n", PAGES, ATEND);
|
||||
Bprint(Bstdout, "%s", ENDCOMMENTS);
|
||||
|
||||
if (cat(unsharp(DPOST))) {
|
||||
if (cat(DPOST)) {
|
||||
Bprint(Bstderr, "can't read %s\n", DPOST);
|
||||
exits("dpost prologue");
|
||||
}
|
||||
|
||||
if (drawflag) {
|
||||
if (cat(unsharp(DRAW))) {
|
||||
if (cat(DRAW)) {
|
||||
Bprint(Bstderr, "can't read %s\n", DRAW);
|
||||
exits("draw prologue");
|
||||
}
|
||||
}
|
||||
|
||||
if (DOROUND)
|
||||
cat(unsharp(ROUNDPAGE));
|
||||
cat(ROUNDPAGE);
|
||||
|
||||
Bprint(Bstdout, "%s", ENDPROLOG);
|
||||
Bprint(Bstdout, "%s", BEGINSETUP);
|
||||
|
|
@ -70,19 +70,19 @@ prologues(void) {
|
|||
if (pointsize != 10) Bprint(Bstdout, "/pointsize %d def\n", pointsize);
|
||||
if (xoffset != .25) Bprint(Bstdout, "/xoffset %g def\n", xoffset);
|
||||
if (yoffset != .25) Bprint(Bstdout, "/yoffset %g def\n", yoffset);
|
||||
cat(unsharp(ENCODINGDIR"/Latin1.enc"));
|
||||
cat(ENCODINGDIR"/Latin1.enc");
|
||||
if (passthrough != 0) Bprint(Bstdout, "%s\n", passthrough);
|
||||
|
||||
Bprint(Bstdout, "setup\n");
|
||||
if (formsperpage > 1) {
|
||||
cat(unsharp(FORMFILE));
|
||||
cat(FORMFILE);
|
||||
Bprint(Bstdout, "%d setupforms \n", formsperpage);
|
||||
}
|
||||
/* output Build character info from charlib if necessary. */
|
||||
|
||||
for (i=0; i<build_char_cnt; i++) {
|
||||
sprint(charlibname, "%s/%s", CHARLIB, build_char_list[i]->name);
|
||||
if (cat(unsharp(charlibname)))
|
||||
if (cat(charlibname))
|
||||
Bprint(Bstderr, "cannot open %s\n", charlibname);
|
||||
}
|
||||
|
||||
|
|
@ -95,24 +95,26 @@ cleanup(void) {
|
|||
}
|
||||
|
||||
main(int argc, char *argv[]) {
|
||||
Biobuf btmp;
|
||||
Biobuf *binp;
|
||||
Biobuf *Binp;
|
||||
int i, tot, ifd;
|
||||
Biobufhdr *Binp;
|
||||
int i, tot, ifd, fd;
|
||||
char *t;
|
||||
|
||||
programname = argv[0];
|
||||
if (Binit(&bstderr, 2, OWRITE) == Beof) {
|
||||
exits("Binit");
|
||||
}
|
||||
Bstderr = &bstderr;
|
||||
Bstderr = &bstderr; /* &bstderr.Biobufhdr; */
|
||||
|
||||
tmpnam(tmpfilename);
|
||||
if ((bstdout=Bopen(tmpfilename, OWRITE)) == 0) {
|
||||
bstdout = &btmp;
|
||||
fd = safe_tmpnam(tmpfilename);
|
||||
if ((Binit(bstdout, fd, OWRITE)) == Beof) {
|
||||
Bprint(Bstderr, "cannot open temporary file %s\n", tmpfilename);
|
||||
exits("Bopen");
|
||||
}
|
||||
atexit(cleanup);
|
||||
Bstdout = bstdout;
|
||||
Bstdout = bstdout; /* &bstdout->Biobufhdr; */
|
||||
|
||||
ARGBEGIN{
|
||||
case 'a': /* aspect ratio */
|
||||
|
|
@ -169,7 +171,7 @@ main(int argc, char *argv[]) {
|
|||
Bprint(Bstderr, "Binit of <stdin> failed.\n");
|
||||
exits("Binit");
|
||||
}
|
||||
Binp = binp;
|
||||
Binp = binp; /* &(binp->Biobufhdr); */
|
||||
if (debug) Bprint(Bstderr, "using standard input\n");
|
||||
conv(Binp);
|
||||
Bterm(Binp);
|
||||
|
|
@ -179,7 +181,7 @@ main(int argc, char *argv[]) {
|
|||
Bprint(Bstderr, "cannot open file %s\n", argv[i]);
|
||||
continue;
|
||||
}
|
||||
Binp = binp;
|
||||
Binp = binp; /* &(binp->Biobufhdr); */
|
||||
inputfilename = argv[i];
|
||||
conv(Binp);
|
||||
Bterm(Binp);
|
||||
|
|
@ -196,7 +198,7 @@ main(int argc, char *argv[]) {
|
|||
Bprint(Bstderr, "Binit of <stdout> failed.\n");
|
||||
exits("Binit");
|
||||
}
|
||||
Bstdout = bstdout;
|
||||
Bstdout = bstdout; /* &(bstdout->Biobufhdr); */
|
||||
prologues();
|
||||
Bflush(Bstdout);
|
||||
tot = 0; i = 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
#define MAXSPECHARS 512
|
||||
#define MAXTOKENSIZE 128
|
||||
#define CHARLIB "#9/sys/lib/troff/font/devutf/charlib"
|
||||
#define CHARLIB FONTDIR "/devutf/charlib"
|
||||
|
||||
/* devname clashes with libc on *BSD */
|
||||
#define devname troff_devname
|
||||
|
||||
extern int debug;
|
||||
extern int fontsize;
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ specialout(char *stoken) {
|
|||
}
|
||||
|
||||
void
|
||||
graphfunc(Biobuf *bp) {
|
||||
graphfunc(Biobufhdr *bp) {
|
||||
}
|
||||
|
||||
long
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue