ReactOS  0.4.14-dev-98-gb0d4763
mkg3states.c File Reference
#include "tif_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tif_fax3.h"
Include dependency graph for mkg3states.c:

Go to the source code of this file.

Classes

struct  proto
 

Macros

#define streq(a, b)   (strcmp(a,b) == 0)
 

Functions

int getopt (int, char **, char *)
 
static void FillTable (TIFFFaxTabEnt *T, int Size, struct proto *P, int State)
 
void WriteTable (FILE *fd, const TIFFFaxTabEnt *T, int Size, const char *name)
 
int main (int argc, char *argv[])
 

Variables

TIFFFaxTabEnt MainTable [128]
 
TIFFFaxTabEnt WhiteTable [4096]
 
TIFFFaxTabEnt BlackTable [8192]
 
static struct proto Pass []
 
static struct proto Horiz []
 
static struct proto V0 []
 
static struct proto VR []
 
static struct proto VL []
 
static struct proto Ext []
 
static struct proto EOLV []
 
static struct proto MakeUpW []
 
static struct proto MakeUpB []
 
static struct proto MakeUp []
 
static struct proto TermW []
 
static struct proto TermB []
 
static struct proto EOLH []
 
static charstorage_class = ""
 
static charconst_class = ""
 
static int packoutput = 1
 
static charprebrace = ""
 
static charpostbrace = ""
 

Macro Definition Documentation

◆ streq

#define streq (   a,
  b 
)    (strcmp(a,b) == 0)

Definition at line 46 of file mkg3states.c.

Function Documentation

◆ FillTable()

static void FillTable ( TIFFFaxTabEnt T,
int  Size,
struct proto P,
int  State 
)
static

Definition at line 318 of file mkg3states.c.

319 {
320  int limit = 1 << Size;
321 
322  while (P->val) {
323  int width = P->val & 15;
324  int param = P->val >> 4;
325  int incr = 1 << width;
326  int code;
327  for (code = P->code; code < limit; code += incr) {
328  TIFFFaxTabEnt *E = T+code;
329  E->State = State;
330  E->Width = width;
331  E->Param = param;
332  }
333  P++;
334  }
335 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define T
Definition: mbstring.h:31
GLint limit
Definition: glext.h:10326
GLfloat param
Definition: glext.h:5796
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
int code
Definition: i386-dis.c:3591
#define P(row, col)
static const WCHAR E[]
Definition: oid.c:1253
enum State_ State
Definition: pofuncs.h:54

Referenced by main().

◆ getopt()

int getopt ( int  ,
char **  ,
char  
)

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)

hosttype.c Copyright (C) 2002 by Brian Palmer brian.nosp@m.p@sg.nosp@m.inet..nosp@m.com

Definition at line 379 of file mkg3states.c.

380 {
381  FILE* fd;
382  char* outputfile;
383  int c;
384 
385 #if !HAVE_DECL_OPTARG
386  extern int optind;
387  extern char* optarg;
388 #endif
389 
390  while ((c = getopt(argc, argv, "c:s:bp")) != -1)
391  switch (c) {
392  case 'c':
394  break;
395  case 's':
397  break;
398  case 'p':
399  packoutput = 0;
400  break;
401  case 'b':
402  prebrace = "{";
403  postbrace = "}";
404  break;
405  case '?':
406  fprintf(stderr,
407  "usage: %s [-c const] [-s storage] [-p] [-b] file\n",
408  argv[0]);
409  return (-1);
410  }
411  outputfile = optind < argc ? argv[optind] : "g3states.h";
412  fd = fopen(outputfile, "w");
413  if (fd == NULL) {
414  fprintf(stderr, "%s: %s: Cannot create output file.\n",
415  argv[0], outputfile);
416  return (-2);
417  }
420  FillTable(MainTable, 7, V0, S_V0);
421  FillTable(MainTable, 7, VR, S_VR);
422  FillTable(MainTable, 7, VL, S_VL);
433 
434  fprintf(fd, "/* WARNING, this file was automatically generated by the\n");
435  fprintf(fd, " mkg3states program */\n");
436  fprintf(fd, "#include \"tiff.h\"\n");
437  fprintf(fd, "#include \"tif_fax3.h\"\n");
438  WriteTable(fd, MainTable, 128, "TIFFFaxMainTable");
439  WriteTable(fd, WhiteTable, 4096, "TIFFFaxWhiteTable");
440  WriteTable(fd, BlackTable, 8192, "TIFFFaxBlackTable");
441  fclose(fd);
442  return (0);
443 }
static int argc
Definition: ServiceArgs.c:12
static struct proto VL[]
Definition: mkg3states.c:80
#define S_VR
Definition: tif_fax3.h:72
static struct proto TermB[]
Definition: mkg3states.c:244
#define S_EOL
Definition: tif_fax3.h:80
static struct proto V0[]
Definition: mkg3states.c:68
int optind
Definition: getopt.c:47
static struct proto VR[]
Definition: mkg3states.c:73
void WriteTable(FILE *fd, const TIFFFaxTabEnt *T, int Size, const char *name)
Definition: mkg3states.c:344
static int fd
Definition: io.c:51
#define argv
Definition: mplay32.c:18
#define S_Ext
Definition: tif_fax3.h:74
static void FillTable(TIFFFaxTabEnt *T, int Size, struct proto *P, int State)
Definition: mkg3states.c:318
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
smooth NULL
Definition: ftsmooth.c:416
#define S_MakeUpW
Definition: tif_fax3.h:77
#define S_TermW
Definition: tif_fax3.h:75
static struct proto Horiz[]
Definition: mkg3states.c:63
static struct proto EOLH[]
Definition: mkg3states.c:312
storage_class
Definition: widltypes.h:229
int getopt(int, char **, char *)
const GLubyte * c
Definition: glext.h:8905
static struct proto MakeUpW[]
Definition: mkg3states.c:97
static char * const_class
Definition: mkg3states.c:338
#define S_Pass
Definition: tif_fax3.h:69
static struct proto Ext[]
Definition: mkg3states.c:87
TIFFFaxTabEnt WhiteTable[4096]
Definition: mkg3states.c:50
static char * prebrace
Definition: mkg3states.c:340
#define S_MakeUpB
Definition: tif_fax3.h:78
static struct proto MakeUp[]
Definition: mkg3states.c:159
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
TIFFFaxTabEnt BlackTable[8192]
Definition: mkg3states.c:51
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define S_VL
Definition: tif_fax3.h:73
#define S_TermB
Definition: tif_fax3.h:76
static int packoutput
Definition: mkg3states.c:339
static struct proto MakeUpB[]
Definition: mkg3states.c:128
static char * postbrace
Definition: mkg3states.c:341
static struct proto EOLV[]
Definition: mkg3states.c:92
const char * optarg
Definition: getopt.c:49
#define S_Horiz
Definition: tif_fax3.h:70
TIFFFaxTabEnt MainTable[128]
Definition: mkg3states.c:49
#define c
Definition: ke_i.h:80
FILE * stderr
static struct proto Pass[]
Definition: mkg3states.c:58
#define S_V0
Definition: tif_fax3.h:71
#define S_MakeUp
Definition: tif_fax3.h:79
static struct proto TermW[]
Definition: mkg3states.c:176

◆ WriteTable()

void WriteTable ( FILE fd,
const TIFFFaxTabEnt T,
int  Size,
const char name 
)

Definition at line 344 of file mkg3states.c.

345 {
346  int i;
347  char* sep;
348 
349  fprintf(fd, "%s %s TIFFFaxTabEnt %s[%d] = {",
351  if (packoutput) {
352  sep = "\n";
353  for (i = 0; i < Size; i++) {
354  fprintf(fd, "%s%s%d,%d,%d%s",
355  sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
356  if (((i+1) % 10) == 0)
357  sep = ",\n";
358  else
359  sep = ",";
360  T++;
361  }
362  } else {
363  sep = "\n ";
364  for (i = 0; i < Size; i++) {
365  fprintf(fd, "%s%s%3d,%3d,%4d%s",
366  sep, prebrace, T->State, T->Width, (int) T->Param, postbrace);
367  if (((i+1) % 6) == 0)
368  sep = ",\n ";
369  else
370  sep = ",";
371  T++;
372  }
373  }
374  fprintf(fd, "\n};\n");
375 }
static int fd
Definition: io.c:51
#define T
Definition: mbstring.h:31
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
storage_class
Definition: widltypes.h:229
static char * const_class
Definition: mkg3states.c:338
static char * prebrace
Definition: mkg3states.c:340
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static int packoutput
Definition: mkg3states.c:339
static char * postbrace
Definition: mkg3states.c:341
Definition: name.c:36

Referenced by main().

Variable Documentation

◆ BlackTable

TIFFFaxTabEnt BlackTable[8192]

Definition at line 51 of file mkg3states.c.

Referenced by main().

◆ const_class

char* const_class = ""
static

Definition at line 338 of file mkg3states.c.

Referenced by main(), and WriteTable().

◆ EOLH

struct proto EOLH[]
static
Initial value:
= {
{ 0x0000, 11 },
{ 0, 0 }
}

Definition at line 312 of file mkg3states.c.

Referenced by main().

◆ EOLV

struct proto EOLV[]
static
Initial value:
= {
{ 0x0000, 7 },
{ 0, 0 }
}

Definition at line 92 of file mkg3states.c.

Referenced by main().

◆ Ext

◆ Horiz

struct proto Horiz[]
static
Initial value:
= {
{ 0x0004, 3 },
{ 0, 0 }
}

Definition at line 63 of file mkg3states.c.

Referenced by main().

◆ MainTable

TIFFFaxTabEnt MainTable[128]

Definition at line 49 of file mkg3states.c.

Referenced by main().

◆ MakeUp

struct proto MakeUp[]
static
Initial value:
= {
{ 0x0080, 28683 },
{ 0x0180, 29707 },
{ 0x0580, 30731 },
{ 0x0480, 31756 },
{ 0x0c80, 32780 },
{ 0x0280, 33804 },
{ 0x0a80, 34828 },
{ 0x0680, 35852 },
{ 0x0e80, 36876 },
{ 0x0380, 37900 },
{ 0x0b80, 38924 },
{ 0x0780, 39948 },
{ 0x0f80, 40972 },
{ 0, 0 }
}

Definition at line 159 of file mkg3states.c.

Referenced by main().

◆ MakeUpB

struct proto MakeUpB[]
static
Initial value:
= {
{ 0x03c0, 1034 },
{ 0x0130, 2060 },
{ 0x0930, 3084 },
{ 0x0da0, 4108 },
{ 0x0cc0, 5132 },
{ 0x02c0, 6156 },
{ 0x0ac0, 7180 },
{ 0x06c0, 8205 },
{ 0x16c0, 9229 },
{ 0x0a40, 10253 },
{ 0x1a40, 11277 },
{ 0x0640, 12301 },
{ 0x1640, 13325 },
{ 0x09c0, 14349 },
{ 0x19c0, 15373 },
{ 0x05c0, 16397 },
{ 0x15c0, 17421 },
{ 0x0dc0, 18445 },
{ 0x1dc0, 19469 },
{ 0x0940, 20493 },
{ 0x1940, 21517 },
{ 0x0540, 22541 },
{ 0x1540, 23565 },
{ 0x0b40, 24589 },
{ 0x1b40, 25613 },
{ 0x04c0, 26637 },
{ 0x14c0, 27661 },
{ 0, 0 }
}

Definition at line 128 of file mkg3states.c.

Referenced by main().

◆ MakeUpW

struct proto MakeUpW[]
static
Initial value:
= {
{ 0x001b, 1029 },
{ 0x0009, 2053 },
{ 0x003a, 3078 },
{ 0x0076, 4103 },
{ 0x006c, 5128 },
{ 0x00ec, 6152 },
{ 0x0026, 7176 },
{ 0x00a6, 8200 },
{ 0x0016, 9224 },
{ 0x00e6, 10248 },
{ 0x0066, 11273 },
{ 0x0166, 12297 },
{ 0x0096, 13321 },
{ 0x0196, 14345 },
{ 0x0056, 15369 },
{ 0x0156, 16393 },
{ 0x00d6, 17417 },
{ 0x01d6, 18441 },
{ 0x0036, 19465 },
{ 0x0136, 20489 },
{ 0x00b6, 21513 },
{ 0x01b6, 22537 },
{ 0x0032, 23561 },
{ 0x0132, 24585 },
{ 0x00b2, 25609 },
{ 0x0006, 26630 },
{ 0x01b2, 27657 },
{ 0, 0 }
}

Definition at line 97 of file mkg3states.c.

Referenced by main().

◆ packoutput

int packoutput = 1
static

Definition at line 339 of file mkg3states.c.

Referenced by main(), and WriteTable().

◆ Pass

struct proto Pass[]
static
Initial value:
= {
{ 0x0008, 4 },
{ 0, 0 }
}

Definition at line 58 of file mkg3states.c.

Referenced by main(), and NtGdiCreateServerMetaFile().

◆ postbrace

char* postbrace = ""
static

Definition at line 341 of file mkg3states.c.

Referenced by main(), and WriteTable().

◆ prebrace

char* prebrace = ""
static

Definition at line 340 of file mkg3states.c.

Referenced by main(), and WriteTable().

◆ storage_class

char* storage_class = ""
static

Definition at line 337 of file mkg3states.c.

◆ TermB

struct proto TermB[]
static

Definition at line 244 of file mkg3states.c.

Referenced by main().

◆ TermW

struct proto TermW[]
static

Definition at line 176 of file mkg3states.c.

Referenced by main().

◆ V0

struct proto V0[]
static
Initial value:
= {
{ 0x0001, 1 },
{ 0, 0 }
}

Definition at line 68 of file mkg3states.c.

Referenced by main().

◆ VL

struct proto VL[]
static
Initial value:
= {
{ 0x0002, (1<<4)+3 },
{ 0x0010, (2<<4)+6 },
{ 0x0020, (3<<4)+7 },
{ 0, 0 }
}

Definition at line 80 of file mkg3states.c.

Referenced by main().

◆ VR

struct proto VR[]
static
Initial value:
= {
{ 0x0006, (1<<4)+3 },
{ 0x0030, (2<<4)+6 },
{ 0x0060, (3<<4)+7 },
{ 0, 0 }
}

Definition at line 73 of file mkg3states.c.

Referenced by main().

◆ WhiteTable

TIFFFaxTabEnt WhiteTable[4096]

Definition at line 50 of file mkg3states.c.

Referenced by main().