44 #define streq(a,b) (strcmp(a,b) == 0) 56 static struct proto Pass[] = {
61 static struct proto Horiz[] = {
66 static struct proto V0[] = {
71 static struct proto VR[] = {
78 static struct proto VL[] = {
85 static struct proto Ext[] = {
90 static struct proto EOLV[] = {
95 static struct proto MakeUpW[] = {
126 static struct proto MakeUpB[] = {
157 static struct proto MakeUp[] = {
174 static struct proto TermW[] = {
242 static struct proto TermB[] = {
310 static struct proto EOLH[] = {
318 int limit = 1 << Size;
321 int width = P->val & 15;
322 int param = P->val >> 4;
323 int incr = 1 <<
width;
325 for (code = P->code; code < limit; code += incr) {
335 static char* storage_class =
"";
336 static char* const_class =
"";
337 static int packoutput = 1;
338 static char* prebrace =
"";
339 static char* postbrace =
"";
347 fprintf(fd,
"%s %s TIFFFaxTabEnt %s[%d] = {",
348 storage_class, const_class, name, Size);
351 for (i = 0; i < Size; i++) {
352 fprintf(fd,
"%s%s%d,%d,%d%s",
354 if (((i+1) % 10) == 0)
362 for (i = 0; i < Size; i++) {
363 fprintf(fd,
"%s%s%3d,%3d,%4d%s",
365 if (((i+1) % 6) == 0)
372 fprintf(fd,
"\n};\n");
385 while ((c = getopt(argc, argv,
"c:s:bp")) != -1)
388 const_class = optarg;
391 storage_class = optarg;
402 "usage: %s [-c const] [-s storage] [-p] [-b] file\n",
406 outputfile = optind < argc ? argv[optind] :
"g3states.h";
407 fd = fopen(outputfile,
"w");
409 fprintf(stderr,
"%s: %s: Cannot create output file.\n",
410 argv[0], outputfile);
413 FillTable(MainTable, 7, Pass,
S_Pass);
414 FillTable(MainTable, 7, Horiz,
S_Horiz);
415 FillTable(MainTable, 7, V0,
S_V0);
416 FillTable(MainTable, 7, VR,
S_VR);
417 FillTable(MainTable, 7, VL,
S_VL);
418 FillTable(MainTable, 7, Ext,
S_Ext);
419 FillTable(MainTable, 7, EOLV,
S_EOL);
420 FillTable(WhiteTable, 12, MakeUpW,
S_MakeUpW);
421 FillTable(WhiteTable, 12, MakeUp,
S_MakeUp);
422 FillTable(WhiteTable, 12, TermW,
S_TermW);
423 FillTable(WhiteTable, 12, EOLH,
S_EOL);
424 FillTable(BlackTable, 13, MakeUpB,
S_MakeUpB);
425 FillTable(BlackTable, 13, MakeUp,
S_MakeUp);
426 FillTable(BlackTable, 13, TermB,
S_TermB);
427 FillTable(BlackTable, 13, EOLH,
S_EOL);
429 fprintf(fd,
"/* WARNING, this file was automatically generated by the\n");
430 fprintf(fd,
" mkg3states program */\n");
431 fprintf(fd,
"#include \"tiff.h\"\n");
432 fprintf(fd,
"#include \"tif_fax3.h\"\n");
433 WriteTable(fd, MainTable, 128,
"TIFFFaxMainTable");
434 WriteTable(fd, WhiteTable, 4096,
"TIFFFaxWhiteTable");
435 WriteTable(fd, BlackTable, 8192,
"TIFFFaxBlackTable");
void WriteTable(FILE *fd, const TIFFFaxTabEnt *T, int Size, const char *name)
GLint GLint GLsizei width
int main(int argc, char *argv[])
TIFFFaxTabEnt WhiteTable[4096]
TIFFFaxTabEnt BlackTable[8192]
GLuint const GLchar * name
TIFFFaxTabEnt MainTable[128]