mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
tr2post and aux/download; download is a shell script in $PLAN9/bin.
This commit is contained in:
parent
8a3cbc1579
commit
e8fb1d3efb
21 changed files with 110 additions and 74 deletions
|
@ -209,7 +209,7 @@ endpage(void) {
|
||||||
int
|
int
|
||||||
cat(char *filename) {
|
cat(char *filename) {
|
||||||
Biobuf *bfile;
|
Biobuf *bfile;
|
||||||
Biobufhdr *Bfile;
|
Biobuf *Bfile;
|
||||||
int n;
|
int n;
|
||||||
static char buf[Bsize];
|
static char buf[Bsize];
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ BOOLEAN isinstring(void);
|
||||||
void startpage(void);
|
void startpage(void);
|
||||||
void endpage(void);
|
void endpage(void);
|
||||||
int cat(char *);
|
int cat(char *);
|
||||||
int Bgetfield(Biobufhdr *, int, void *, int);
|
int Bgetfield(Biobuf*, int, void *, int);
|
||||||
void *galloc(void *, int, char *);
|
void *galloc(void *, int, char *);
|
||||||
void pagelist(char *);
|
void pagelist(char *);
|
||||||
|
|
||||||
|
int safe_tmpnam(char*);
|
||||||
|
|
|
@ -27,10 +27,9 @@ extern int writing; /* and output encoding */
|
||||||
extern char *optarg; /* for getopt() */
|
extern char *optarg; /* for getopt() */
|
||||||
extern int optind;
|
extern int optind;
|
||||||
|
|
||||||
extern void interrupt();
|
extern void interrupt(int);
|
||||||
extern void error();
|
extern int cat(char*);
|
||||||
extern int cat();
|
extern void concat(double*);
|
||||||
extern void concat();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* extern char *tempnam(char*,char*);
|
* extern char *tempnam(char*,char*);
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
int nolist = 0; /* number of specified ranges */
|
int nolist = 0; /* number of specified ranges */
|
||||||
int olist[50]; /* processing range pairs */
|
int olist[50]; /* processing range pairs */
|
||||||
|
|
||||||
|
int str_convert(char **str, int err);
|
||||||
|
void error(int kind, char *mesg, unsigned int a1, unsigned int a2, unsigned int a3);
|
||||||
|
int cat(char *file);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
extern int str_convert();
|
extern int str_convert();
|
||||||
|
|
||||||
|
@ -44,7 +48,7 @@ out_list(str)
|
||||||
stop = str_convert(&str, 9999);
|
stop = str_convert(&str, 9999);
|
||||||
|
|
||||||
if ( start > stop )
|
if ( start > stop )
|
||||||
error(FATAL, "illegal range %d-%d", start, stop);
|
error(FATAL, "illegal range %d-%d", start, stop, 0);
|
||||||
|
|
||||||
olist[nolist++] = start;
|
olist[nolist++] = start;
|
||||||
olist[nolist++] = stop;
|
olist[nolist++] = stop;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<../config
|
<../config
|
||||||
|
|
||||||
LIB=com.a
|
LIB=libcom.a
|
||||||
OFILES=bbox.$O\
|
OFILES=bbox.$O\
|
||||||
glob.$O\
|
glob.$O\
|
||||||
misc.$O\
|
misc.$O\
|
||||||
|
|
|
@ -24,6 +24,9 @@ Request request[MAXREQUEST]; /* next page or global request */
|
||||||
int nextreq = 0; /* goes in request[nextreq] */
|
int nextreq = 0; /* goes in request[nextreq] */
|
||||||
char *requestfile = REQUESTFILE; /* default lookup file */
|
char *requestfile = REQUESTFILE; /* default lookup file */
|
||||||
|
|
||||||
|
void dumprequest(char *want, char *file, FILE *fp_out);
|
||||||
|
extern void error(int errtype, char *fmt, ...);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -31,7 +31,7 @@ mkfname(char *tmpdir, char *prefix)
|
||||||
return fname;
|
return fname;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int mkstemp();
|
extern int mkstemp(char*);
|
||||||
|
|
||||||
char*
|
char*
|
||||||
safe_tempnam(char *tmpdir, char *prefix)
|
safe_tempnam(char *tmpdir, char *prefix)
|
||||||
|
|
|
@ -58,6 +58,8 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "comments.h" /* PostScript file structuring comments */
|
#include "comments.h" /* PostScript file structuring comments */
|
||||||
#include "gen.h" /* general purpose definitions */
|
#include "gen.h" /* general purpose definitions */
|
||||||
|
@ -83,8 +85,22 @@ int atend = FALSE; /* TRUE only if a comment says so */
|
||||||
FILE *fp_in; /* next input file */
|
FILE *fp_in; /* next input file */
|
||||||
FILE *fp_temp = NULL; /* for copying stdin */
|
FILE *fp_temp = NULL; /* for copying stdin */
|
||||||
|
|
||||||
|
void init_signals();
|
||||||
|
void options();
|
||||||
|
void readmap();
|
||||||
|
void readresident();
|
||||||
|
void arguments();
|
||||||
|
void done();
|
||||||
|
void download();
|
||||||
|
int lookup(char *font);
|
||||||
|
void copyfonts(char *list);
|
||||||
|
void copyinput();
|
||||||
|
extern int cat(char *file);
|
||||||
|
extern void error(int errtype, char *fmt, ...);
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
main(agc, agv)
|
main(agc, agv)
|
||||||
|
|
||||||
int agc;
|
int agc;
|
||||||
|
@ -118,8 +134,8 @@ main(agc, agv)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
init_signals()
|
void
|
||||||
|
init_signals(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -143,8 +159,8 @@ init_signals()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
options()
|
void
|
||||||
|
options(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
int ch; /* return value from getopt() */
|
int ch; /* return value from getopt() */
|
||||||
|
@ -214,8 +230,8 @@ options()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
readmap()
|
void
|
||||||
|
readmap(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
|
@ -277,8 +293,8 @@ readmap()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
readresident()
|
void
|
||||||
|
readresident(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -316,8 +332,8 @@ readresident()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
arguments()
|
void
|
||||||
|
arguments(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -352,8 +368,8 @@ arguments()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
done()
|
void
|
||||||
|
done(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -369,8 +385,8 @@ done()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
download()
|
void
|
||||||
|
download(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
int infontlist = FALSE;
|
int infontlist = FALSE;
|
||||||
|
@ -418,6 +434,7 @@ download()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
void
|
||||||
copyfonts(list)
|
copyfonts(list)
|
||||||
|
|
||||||
char *list;
|
char *list;
|
||||||
|
@ -460,8 +477,8 @@ copyfonts(list)
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
copyinput()
|
void
|
||||||
|
copyinput(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -488,6 +505,7 @@ copyinput()
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
int
|
||||||
lookup(font)
|
lookup(font)
|
||||||
|
|
||||||
char *font;
|
char *font;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<$PLAN9/src/mkhdr
|
<$PLAN9/src/mkhdr
|
||||||
|
|
||||||
<../config
|
<../config
|
||||||
TARG=psdownload
|
TARG=auxdownload
|
||||||
|
|
||||||
OFILES=download.$O
|
OFILES=download.$O
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ HFILES=download.h\
|
||||||
$COMMONDIR/path.h\
|
$COMMONDIR/path.h\
|
||||||
$COMMONDIR/ext.h\
|
$COMMONDIR/ext.h\
|
||||||
|
|
||||||
LIB=$COMMONDIR/com.a
|
LIB=$COMMONDIR/libcom.a
|
||||||
BIN=$POSTBIN
|
BIN=$POSTBIN
|
||||||
|
|
||||||
<$PLAN9/src/mkone
|
<$PLAN9/src/mkone
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
#include "../common/common.h"
|
#include "../common/common.h"
|
||||||
#include "tr2post.h"
|
#include "tr2post.h"
|
||||||
|
|
||||||
|
#undef isspace
|
||||||
|
#define isspace risspace
|
||||||
|
|
||||||
int
|
int
|
||||||
isspace(Rune r)
|
isspace(Rune r)
|
||||||
{
|
{
|
||||||
|
@ -11,9 +14,8 @@ isspace(Rune r)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Bskipws(Biobufhdr *bp) {
|
Bskipws(Biobuf *bp) {
|
||||||
int r;
|
int r;
|
||||||
char c[UTFmax];
|
|
||||||
int sindex = 0;
|
int sindex = 0;
|
||||||
|
|
||||||
/* skip over initial white space */
|
/* skip over initial white space */
|
||||||
|
@ -54,7 +56,7 @@ asc2dig(char c, int base) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
Bgetfield(Biobufhdr *bp, int type, void *thing, int size) {
|
Bgetfield(Biobuf *bp, int type, void *thing, int size) {
|
||||||
int r;
|
int r;
|
||||||
Rune R;
|
Rune R;
|
||||||
char c[UTFmax];
|
char c[UTFmax];
|
||||||
|
@ -65,6 +67,8 @@ Bgetfield(Biobufhdr *bp, int type, void *thing, int size) {
|
||||||
int dig;
|
int dig;
|
||||||
unsigned int u = 0;
|
unsigned int u = 0;
|
||||||
|
|
||||||
|
r = 0;
|
||||||
|
|
||||||
/* skip over initial white space */
|
/* skip over initial white space */
|
||||||
if (Bskipws(bp) < 0)
|
if (Bskipws(bp) < 0)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
|
@ -120,17 +120,17 @@ findpfn(char *fontname, int insflg) {
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char postroffdirname[] = LIBDIR "/postscript/troff"; /* "/sys/lib/postscript/troff/"; */
|
char postroffdirname[] = "#9/postscript/troff"; /* "/sys/lib/postscript/troff/"; */
|
||||||
char troffmetricdirname[] = LIBDIR "/troff/font"; /* "/sys/lib/troff/font/devutf/"; */
|
char troffmetricdirname[] = "#9/troff/font"; /* "/sys/lib/troff/font/devutf/"; */
|
||||||
|
|
||||||
int
|
int
|
||||||
readpsfontdesc(char *fontname, int trindex) {
|
readpsfontdesc(char *fontname, int trindex) {
|
||||||
static char *filename = 0;
|
static char *filename = 0;
|
||||||
Biobuf *bfd;
|
Biobuf *bfd;
|
||||||
Biobufhdr *Bfd;
|
Biobuf *Bfd;
|
||||||
int warn = 0, errorflg = 0, line =1, rv;
|
int errorflg = 0, line =1, rv;
|
||||||
int start, end, offset;
|
int start, end, offset;
|
||||||
int startfont, endfont, startchar, endchar, i, pfid;
|
int startfont, endfont, startchar, endchar, pfid;
|
||||||
char psfontnam[128];
|
char psfontnam[128];
|
||||||
struct troffont *tp;
|
struct troffont *tp;
|
||||||
/* struct charent *cp[]; */
|
/* struct charent *cp[]; */
|
||||||
|
@ -139,7 +139,7 @@ readpsfontdesc(char *fontname, int trindex) {
|
||||||
filename=galloc(filename, strlen(postroffdirname)+1+strlen(fontname)+1, "readpsfontdesc: cannot allocate memory\n");
|
filename=galloc(filename, strlen(postroffdirname)+1+strlen(fontname)+1, "readpsfontdesc: cannot allocate memory\n");
|
||||||
sprint(filename, "%s/%s", postroffdirname, fontname);
|
sprint(filename, "%s/%s", postroffdirname, fontname);
|
||||||
|
|
||||||
bfd = Bopen(filename, OREAD);
|
bfd = Bopen(unsharp(filename), OREAD);
|
||||||
if (bfd == 0) {
|
if (bfd == 0) {
|
||||||
error(WARNING, "cannot open file %s\n", filename);
|
error(WARNING, "cannot open file %s\n", filename);
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -212,9 +212,8 @@ int
|
||||||
readtroffmetric(char *fontname, int trindex) {
|
readtroffmetric(char *fontname, int trindex) {
|
||||||
static char *filename = 0;
|
static char *filename = 0;
|
||||||
Biobuf *bfd;
|
Biobuf *bfd;
|
||||||
Biobufhdr *Bfd;
|
Biobuf *Bfd;
|
||||||
int warn = 0, errorflg = 0, line =1, rv;
|
int errorflg = 0, line =1, rv;
|
||||||
struct troffont *tp;
|
|
||||||
struct charent **cp;
|
struct charent **cp;
|
||||||
char stoken[128], *str;
|
char stoken[128], *str;
|
||||||
int ntoken;
|
int ntoken;
|
||||||
|
@ -226,7 +225,7 @@ readtroffmetric(char *fontname, int trindex) {
|
||||||
filename=galloc(filename, strlen(troffmetricdirname)+4+strlen(devname)+1+strlen(fontname)+1, "readtroffmetric():filename");
|
filename=galloc(filename, strlen(troffmetricdirname)+4+strlen(devname)+1+strlen(fontname)+1, "readtroffmetric():filename");
|
||||||
sprint(filename, "%s/dev%s/%s", troffmetricdirname, devname, fontname);
|
sprint(filename, "%s/dev%s/%s", troffmetricdirname, devname, fontname);
|
||||||
|
|
||||||
bfd = Bopen(filename, OREAD);
|
bfd = Bopen(unsharp(filename), OREAD);
|
||||||
if (bfd == 0) {
|
if (bfd == 0) {
|
||||||
error(WARNING, "cannot open file %s\n", filename);
|
error(WARNING, "cannot open file %s\n", filename);
|
||||||
return(0);
|
return(0);
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
#include "tr2post.h"
|
#include "tr2post.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
conv(Biobufhdr *Bp) {
|
conv(Biobuf *Bp) {
|
||||||
long c, n;
|
long n;
|
||||||
int r;
|
int r;
|
||||||
char special[10];
|
char special[10];
|
||||||
int save;
|
int save;
|
||||||
|
|
|
@ -51,10 +51,10 @@ struct sjt specialjumptable[] = {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
devcntl(Biobufhdr *inp) {
|
devcntl(Biobuf *inp) {
|
||||||
|
|
||||||
char cmd[50], buf[256], str[MAXTOKENSIZE], *line;
|
char cmd[50], buf[256], str[MAXTOKENSIZE], *line;
|
||||||
int c, n, linelen;
|
int c, n;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,7 +13,7 @@ cover(double x, double y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drawspline(Biobufhdr *Bp, int flag) { /* flag!=1 connect end points */
|
drawspline(Biobuf *Bp, int flag) { /* flag!=1 connect end points */
|
||||||
int x[100], y[100];
|
int x[100], y[100];
|
||||||
int i, N;
|
int i, N;
|
||||||
/*
|
/*
|
||||||
|
@ -96,7 +96,7 @@ drawspline(Biobufhdr *Bp, int flag) { /* flag!=1 connect end points */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
draw(Biobufhdr *Bp) {
|
draw(Biobuf *Bp) {
|
||||||
|
|
||||||
int r, x1, y1, x2, y2, i;
|
int r, x1, y1, x2, y2, i;
|
||||||
int d1, d2;
|
int d1, d2;
|
||||||
|
@ -234,7 +234,7 @@ drawpath(char *buf, int copy) {
|
||||||
static void
|
static void
|
||||||
parsebuf(char *buf)
|
parsebuf(char *buf)
|
||||||
{
|
{
|
||||||
char *p; /* usually the next token */
|
char *p = (char*)0; /* usually the next token */
|
||||||
char *q;
|
char *q;
|
||||||
int gsavelevel = 0; /* non-zero if we've done a gsave */
|
int gsavelevel = 0; /* non-zero if we've done a gsave */
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ HFILES=tr2post.h\
|
||||||
|
|
||||||
BIN=$POSTBIN
|
BIN=$POSTBIN
|
||||||
|
|
||||||
|
LIB=../common/libcom.a
|
||||||
|
|
||||||
<$PLAN9/src/mkone
|
<$PLAN9/src/mkone
|
||||||
|
|
||||||
CFLAGS=$CFLAGS -c -D'PROGRAMVERSION="0.1"' -D'DOROUND=1' -I$COMMONDIR
|
CFLAGS=$CFLAGS -c -D'PROGRAMVERSION="0.1"' -D'DOROUND=1' -I$COMMONDIR
|
||||||
|
|
|
@ -50,8 +50,8 @@
|
||||||
/* #include "ext.h" */
|
/* #include "ext.h" */
|
||||||
|
|
||||||
Biobuf *bfp_pic = NULL;
|
Biobuf *bfp_pic = NULL;
|
||||||
Biobufhdr *Bfp_pic;
|
Biobuf *Bfp_pic;
|
||||||
Biobufhdr *picopen(char *);
|
Biobuf *picopen(char *);
|
||||||
|
|
||||||
#define MAXGETFIELDS 16
|
#define MAXGETFIELDS 16
|
||||||
char *fields[MAXGETFIELDS];
|
char *fields[MAXGETFIELDS];
|
||||||
|
@ -63,7 +63,7 @@ extern int picflag;
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
picture(Biobufhdr *inp, char *buf) {
|
picture(Biobuf *inp, char *buf) {
|
||||||
int poffset; /* page offset */
|
int poffset; /* page offset */
|
||||||
int indent; /* indent */
|
int indent; /* indent */
|
||||||
int length; /* line length */
|
int length; /* line length */
|
||||||
|
@ -80,7 +80,7 @@ picture(Biobufhdr *inp, char *buf) {
|
||||||
double adjx = 0.5; /* left-right adjustment */
|
double adjx = 0.5; /* left-right adjustment */
|
||||||
double adjy = 0.5; /* top-bottom adjustment */
|
double adjy = 0.5; /* top-bottom adjustment */
|
||||||
double rot = 0; /* rotation in clockwise degrees */
|
double rot = 0; /* rotation in clockwise degrees */
|
||||||
Biobufhdr *fp_in; /* for *name */
|
Biobuf *fp_in; /* for *name */
|
||||||
int i; /* loop index */
|
int i; /* loop index */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -195,13 +195,13 @@ picture(Biobufhdr *inp, char *buf) {
|
||||||
* open file *path and return the resulting file pointer to the caller.
|
* open file *path and return the resulting file pointer to the caller.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Biobufhdr *
|
Biobuf *
|
||||||
picopen(char *path) {
|
picopen(char *path) {
|
||||||
/* char name[100]; /* pathnames */
|
/* char name[100]; /* pathnames */
|
||||||
/* long pos; /* current position */
|
/* long pos; /* current position */
|
||||||
/* long total; /* and sizes - from *fp_pic */
|
/* long total; /* and sizes - from *fp_pic */
|
||||||
Biobuf *bfp;
|
Biobuf *bfp;
|
||||||
Biobufhdr *Bfp; /* and pointer for the new temp file */
|
Biobuf *Bfp; /* and pointer for the new temp file */
|
||||||
|
|
||||||
|
|
||||||
if ((bfp = Bopen(path, OREAD)) == 0)
|
if ((bfp = Bopen(path, OREAD)) == 0)
|
||||||
|
@ -285,7 +285,7 @@ inlinepic(Biobufhdr *Bfp, char *buf) {
|
||||||
/* *fp_out; and output file pointers */
|
/* *fp_out; and output file pointers */
|
||||||
/* total; number of bytes to be copied */
|
/* total; number of bytes to be copied */
|
||||||
void
|
void
|
||||||
piccopy(Biobufhdr *Bfp_in, Biobufhdr *Bfp_out, long total) {
|
piccopy(Biobuf *Bfp_in, Biobuf *Bfp_out, long total) {
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
for (i = 0; i < total; i++)
|
for (i = 0; i < total; i++)
|
||||||
|
|
|
@ -11,9 +11,8 @@ extern int curfontsize;
|
||||||
typedef struct {long start, end;} Section;
|
typedef struct {long start, end;} Section;
|
||||||
static char *buf;
|
static char *buf;
|
||||||
|
|
||||||
static
|
static void
|
||||||
copy(Biobufhdr *fin, Biobufhdr *fout, Section *s) {
|
copy(Biobuf *fin, Biobuf *fout, Section *s) {
|
||||||
int cond;
|
|
||||||
if (s->end <= s->start)
|
if (s->end <= s->start)
|
||||||
return;
|
return;
|
||||||
Bseek(fin, s->start, 0);
|
Bseek(fin, s->start, 0);
|
||||||
|
@ -57,7 +56,7 @@ copy(Biobufhdr *fin, Biobufhdr *fout, Section *s) {
|
||||||
/* rot; /* rotation - in clockwise degrees */
|
/* rot; /* rotation - in clockwise degrees */
|
||||||
|
|
||||||
void
|
void
|
||||||
ps_include(Biobufhdr *fin, Biobufhdr *fout, int page_no, int whiteout,
|
ps_include(Biobuf *fin, Biobuf *fout, int page_no, int whiteout,
|
||||||
int outline, int scaleboth, double cx, double cy, double sx, double sy,
|
int outline, int scaleboth, double cx, double cy, double sx, double sy,
|
||||||
double ax, double ay, double rot) {
|
double ax, double ay, double rot) {
|
||||||
char **strp;
|
char **strp;
|
||||||
|
@ -66,7 +65,7 @@ ps_include(Biobufhdr *fin, Biobufhdr *fout, int page_no, int whiteout,
|
||||||
int nglobal = 0; /* number of global defs so far */
|
int nglobal = 0; /* number of global defs so far */
|
||||||
int maxglobal = 0; /* and the number we've got room for */
|
int maxglobal = 0; /* and the number we've got room for */
|
||||||
Section prolog, page, trailer; /* prologue, page, and trailer offsets */
|
Section prolog, page, trailer; /* prologue, page, and trailer offsets */
|
||||||
Section *global; /* offsets for all global definitions */
|
Section *global = 0; /* offsets for all global definitions */
|
||||||
double llx, lly; /* lower left and */
|
double llx, lly; /* lower left and */
|
||||||
double urx, ury; /* upper right corners - default coords */
|
double urx, ury; /* upper right corners - default coords */
|
||||||
double w = whiteout != 0; /* mostly for the var() macro */
|
double w = whiteout != 0; /* mostly for the var() macro */
|
||||||
|
|
|
@ -44,7 +44,7 @@ readDESC(void) {
|
||||||
char *descnameformat = "%s/dev%s/DESC";
|
char *descnameformat = "%s/dev%s/DESC";
|
||||||
char *descfilename = 0;
|
char *descfilename = 0;
|
||||||
Biobuf *bfd;
|
Biobuf *bfd;
|
||||||
Biobufhdr *Bfd;
|
Biobuf *Bfd;
|
||||||
int i, state = -1;
|
int i, state = -1;
|
||||||
int fontindex = 0;
|
int fontindex = 0;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ readDESC(void) {
|
||||||
descfilename = galloc(descfilename, strlen(descnameformat)+strlen(FONTDIR)
|
descfilename = galloc(descfilename, strlen(descnameformat)+strlen(FONTDIR)
|
||||||
+strlen(devname), "readdesc");
|
+strlen(devname), "readdesc");
|
||||||
sprint(descfilename, descnameformat, FONTDIR, devname);
|
sprint(descfilename, descnameformat, FONTDIR, devname);
|
||||||
if ((bfd = Bopen(descfilename, OREAD)) == 0) {
|
if ((bfd = Bopen(unsharp(descfilename), OREAD)) == 0) {
|
||||||
error(WARNING, "cannot open file %s\n", descfilename);
|
error(WARNING, "cannot open file %s\n", descfilename);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -136,4 +136,5 @@ readDESC(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Bterm(Bfd);
|
Bterm(Bfd);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,10 @@ Biobuf binp, *bstdout, bstderr;
|
||||||
Biobuf *Bstdin, *Bstdout, *Bstderr;
|
Biobuf *Bstdin, *Bstdout, *Bstderr;
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
|
|
||||||
|
#ifndef MAXPATHLEN
|
||||||
|
#define MAXPATHLEN 255
|
||||||
|
#endif
|
||||||
|
|
||||||
char tmpfilename[MAXPATHLEN+1];
|
char tmpfilename[MAXPATHLEN+1];
|
||||||
char copybuf[BUFSIZ];
|
char copybuf[BUFSIZ];
|
||||||
|
|
||||||
|
@ -41,20 +45,20 @@ prologues(void) {
|
||||||
Bprint(Bstdout, "%s %s\n", PAGES, ATEND);
|
Bprint(Bstdout, "%s %s\n", PAGES, ATEND);
|
||||||
Bprint(Bstdout, "%s", ENDCOMMENTS);
|
Bprint(Bstdout, "%s", ENDCOMMENTS);
|
||||||
|
|
||||||
if (cat(DPOST)) {
|
if (cat(unsharp(DPOST))) {
|
||||||
Bprint(Bstderr, "can't read %s\n", DPOST);
|
Bprint(Bstderr, "can't read %s\n", DPOST);
|
||||||
exits("dpost prologue");
|
exits("dpost prologue");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawflag) {
|
if (drawflag) {
|
||||||
if (cat(DRAW)) {
|
if (cat(unsharp(DRAW))) {
|
||||||
Bprint(Bstderr, "can't read %s\n", DRAW);
|
Bprint(Bstderr, "can't read %s\n", DRAW);
|
||||||
exits("draw prologue");
|
exits("draw prologue");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DOROUND)
|
if (DOROUND)
|
||||||
cat(ROUNDPAGE);
|
cat(unsharp(ROUNDPAGE));
|
||||||
|
|
||||||
Bprint(Bstdout, "%s", ENDPROLOG);
|
Bprint(Bstdout, "%s", ENDPROLOG);
|
||||||
Bprint(Bstdout, "%s", BEGINSETUP);
|
Bprint(Bstdout, "%s", BEGINSETUP);
|
||||||
|
@ -70,19 +74,19 @@ prologues(void) {
|
||||||
if (pointsize != 10) Bprint(Bstdout, "/pointsize %d def\n", pointsize);
|
if (pointsize != 10) Bprint(Bstdout, "/pointsize %d def\n", pointsize);
|
||||||
if (xoffset != .25) Bprint(Bstdout, "/xoffset %g def\n", xoffset);
|
if (xoffset != .25) Bprint(Bstdout, "/xoffset %g def\n", xoffset);
|
||||||
if (yoffset != .25) Bprint(Bstdout, "/yoffset %g def\n", yoffset);
|
if (yoffset != .25) Bprint(Bstdout, "/yoffset %g def\n", yoffset);
|
||||||
cat(ENCODINGDIR"/Latin1.enc");
|
cat(unsharp(ENCODINGDIR"/Latin1.enc"));
|
||||||
if (passthrough != 0) Bprint(Bstdout, "%s\n", passthrough);
|
if (passthrough != 0) Bprint(Bstdout, "%s\n", passthrough);
|
||||||
|
|
||||||
Bprint(Bstdout, "setup\n");
|
Bprint(Bstdout, "setup\n");
|
||||||
if (formsperpage > 1) {
|
if (formsperpage > 1) {
|
||||||
cat(FORMFILE);
|
cat(unsharp(FORMFILE));
|
||||||
Bprint(Bstdout, "%d setupforms \n", formsperpage);
|
Bprint(Bstdout, "%d setupforms \n", formsperpage);
|
||||||
}
|
}
|
||||||
/* output Build character info from charlib if necessary. */
|
/* output Build character info from charlib if necessary. */
|
||||||
|
|
||||||
for (i=0; i<build_char_cnt; i++) {
|
for (i=0; i<build_char_cnt; i++) {
|
||||||
sprint(charlibname, "%s/%s", CHARLIB, build_char_list[i]->name);
|
sprint(charlibname, "%s/%s", CHARLIB, build_char_list[i]->name);
|
||||||
if (cat(charlibname))
|
if (cat(unsharp(charlibname)))
|
||||||
Bprint(Bstderr, "cannot open %s\n", charlibname);
|
Bprint(Bstderr, "cannot open %s\n", charlibname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,10 +98,11 @@ cleanup(void) {
|
||||||
remove(tmpfilename);
|
remove(tmpfilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
main(int argc, char *argv[]) {
|
main(int argc, char *argv[]) {
|
||||||
Biobuf btmp;
|
Biobuf btmp;
|
||||||
Biobuf *binp;
|
Biobuf *binp;
|
||||||
Biobufhdr *Binp;
|
Biobuf *Binp;
|
||||||
int i, tot, ifd, fd;
|
int i, tot, ifd, fd;
|
||||||
char *t;
|
char *t;
|
||||||
|
|
||||||
|
@ -217,4 +222,5 @@ main(int argc, char *argv[]) {
|
||||||
finish();
|
finish();
|
||||||
|
|
||||||
exits("");
|
exits("");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define MAXSPECHARS 512
|
#define MAXSPECHARS 512
|
||||||
#define MAXTOKENSIZE 128
|
#define MAXTOKENSIZE 128
|
||||||
#define CHARLIB FONTDIR "/devutf/charlib"
|
#define CHARLIB "#9/troff/font/devutf/charlib"
|
||||||
|
|
||||||
/* devname clashes with libc on *BSD */
|
/* devname clashes with libc on *BSD */
|
||||||
#define devname troff_devname
|
#define devname troff_devname
|
||||||
|
|
|
@ -88,12 +88,13 @@ void
|
||||||
glyphout(Rune rune, char *stoken, BOOLEAN specialflag) {
|
glyphout(Rune rune, char *stoken, BOOLEAN specialflag) {
|
||||||
struct charent **cp;
|
struct charent **cp;
|
||||||
struct troffont *tfp;
|
struct troffont *tfp;
|
||||||
struct psfent *psfp;
|
struct psfent *psfp = (struct psfent*)0;
|
||||||
int i, t;
|
int i, t;
|
||||||
int fontid; /* this is the troff font table index, not the mounted font table index */
|
int fontid; /* this is the troff font table index, not the mounted font table index */
|
||||||
int mi, fi, wid;
|
int mi, wid;
|
||||||
Rune r;
|
Rune r;
|
||||||
|
|
||||||
|
mi = 0;
|
||||||
settrfont();
|
settrfont();
|
||||||
|
|
||||||
/* check current font for the character, special or not */
|
/* check current font for the character, special or not */
|
||||||
|
@ -187,8 +188,6 @@ foundit:
|
||||||
if (t == 0x0001) { /* character is in charlib */
|
if (t == 0x0001) { /* character is in charlib */
|
||||||
endstring();
|
endstring();
|
||||||
if (pageon()) {
|
if (pageon()) {
|
||||||
struct charent *tcp;
|
|
||||||
|
|
||||||
Bprint(Bstdout, "%d %d m ", hpos, vpos);
|
Bprint(Bstdout, "%d %d m ", hpos, vpos);
|
||||||
/* if char is unicode character rather than name, clean up for postscript */
|
/* if char is unicode character rather than name, clean up for postscript */
|
||||||
wid = chartorune(&r, (*cp)->name);
|
wid = chartorune(&r, (*cp)->name);
|
||||||
|
@ -250,7 +249,7 @@ specialout(char *stoken) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
graphfunc(Biobufhdr *bp) {
|
graphfunc(Biobuf *bp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
long
|
long
|
||||||
|
|
Loading…
Reference in a new issue