#include #include #include #include #include "common.h" #include "tr2post.h" #include "comments.h" #include "path.h" char *printdesclang = 0; char *encoding = 0; int devres; int unitwidth; int nspechars = 0; struct charent spechars[MAXSPECHARS]; #define NDESCTOKS 9 static char *desctoks[NDESCTOKS] = { "PDL", "Encoding", "fonts", "sizes", "res", "hor", "vert", "unitwidth", "charset" }; char *spechar[MAXSPECHARS]; int hash(char *s, int l) { unsigned i; for (i=0; *s; s++) i = i*10 + *s; return(i % l); } BOOLEAN readDESC(void) { char token[MAXTOKENSIZE]; char *descnameformat = "%s/dev%s/DESC"; char *descfilename = 0; 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), "readdesc"); sprint(descfilename, descnameformat, FONTDIR, devname); if ((bfd = Bopen(descfilename, OREAD)) == 0) { error(WARNING, "cannot open file %s\n", descfilename); return(0); } Bfd = &(bfd->Biobufhdr); while (Bgetfield(Bfd, 's', token, MAXTOKENSIZE) > 0) { for (i=0; i\n", token); break; default: if (*token == '#') Brdline(Bfd, '\n'); else error(WARNING, "unknown token %s in DESC file.\n", token); break; } } Bterm(Bfd); return(TRUE); }