ReactOS 0.4.16-dev-340-g0540c21
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 argc, char *const argv[], const char *optstring)
 
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) {
329 E->State = State;
330 E->Width = width;
331 E->Param = param;
332 }
333 P++;
334 }
335}
#define P(row, col)
static const WCHAR E[]
Definition: oid.c:1253
GLint GLint GLsizei width
Definition: gl.h:1546
GLint limit
Definition: glext.h:10326
GLfloat param
Definition: glext.h:5796
#define T
Definition: mbstring.h:31
Definition: inflate.c:139
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by main().

◆ getopt()

int getopt ( int  argc,
char *const  argv[],
const char optstring 
)

Definition at line 20 of file getopt.c.

21{
22 char *curopt;
23 char *p;
24 int cursubopt;
25
26 if (suboptind == optind-1 && argv[suboptind][subopt] != '\0') {
27 curopt = (char *)argv[suboptind];
28 } else {
29 curopt = (char *)argv[optind];
30 if (curopt == NULL || curopt[0] != '-' || strcmp(curopt, "-") == 0)
31 return -1;
33 subopt = 1;
34 optind++;
35 if (strcmp(curopt, "--") == 0)
36 return -1;
37 }
38 cursubopt = subopt++;
39 if ((p = strchr(optstring, curopt[cursubopt])) == NULL) {
40 optopt = curopt[cursubopt];
41 if (opterr)
42 fprintf(stderr, "%s: illegal option -- %c\n", argv[0], optopt);
43 return '?';
44 }
45 if (p[1] == ':') {
46 if (curopt[cursubopt+1] != '\0') {
47 optarg = curopt+cursubopt+1;
48 suboptind++;
49 return p[0];
50 }
51 if (argv[optind] == NULL) {
52 optopt = p[0];
53 if (opterr)
54 fprintf(stderr, "%s: option requires an argument -- %c\n", argv[0], optopt);
55 if (*optstring == ':')
56 return ':';
57 return '?';
58 }
59 optarg = argv[optind++];
60 }
61 return p[0];
62}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902
#define stderr
Definition: stdio.h:100
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
int optopt
Definition: getopt.c:16
static int subopt
Definition: getopt.c:17
int optind
Definition: getopt.c:14
char * optarg
Definition: getopt.c:13
int opterr
Definition: getopt.c:15
static int suboptind
Definition: getopt.c:18
#define argv
Definition: mplay32.c:18

Referenced by main().

◆ main()

int main ( int argc  ,
char argv[] 
)

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 '?':
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 }
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
const char * optarg
Definition: getopt.c:49
int optind
Definition: getopt.c:47
const GLubyte * c
Definition: glext.h:8905
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
#define c
Definition: ke_i.h:80
static char * prebrace
Definition: mkg3states.c:340
static struct proto EOLV[]
Definition: mkg3states.c:92
static struct proto Pass[]
Definition: mkg3states.c:58
static struct proto V0[]
Definition: mkg3states.c:68
static struct proto Ext[]
Definition: mkg3states.c:87
static void FillTable(TIFFFaxTabEnt *T, int Size, struct proto *P, int State)
Definition: mkg3states.c:318
TIFFFaxTabEnt BlackTable[8192]
Definition: mkg3states.c:51
static struct proto MakeUp[]
Definition: mkg3states.c:159
static struct proto TermW[]
Definition: mkg3states.c:176
TIFFFaxTabEnt WhiteTable[4096]
Definition: mkg3states.c:50
static char * const_class
Definition: mkg3states.c:338
static struct proto MakeUpW[]
Definition: mkg3states.c:97
int getopt(int argc, char *const argv[], const char *optstring)
Definition: getopt.c:20
static struct proto TermB[]
Definition: mkg3states.c:244
TIFFFaxTabEnt MainTable[128]
Definition: mkg3states.c:49
static struct proto VR[]
Definition: mkg3states.c:73
static struct proto EOLH[]
Definition: mkg3states.c:312
void WriteTable(FILE *fd, const TIFFFaxTabEnt *T, int Size, const char *name)
Definition: mkg3states.c:344
static int packoutput
Definition: mkg3states.c:339
static char * postbrace
Definition: mkg3states.c:341
static struct proto VL[]
Definition: mkg3states.c:80
static struct proto Horiz[]
Definition: mkg3states.c:63
static struct proto MakeUpB[]
Definition: mkg3states.c:128
static int fd
Definition: io.c:51
#define S_Ext
Definition: tif_fax3.h:74
#define S_MakeUpB
Definition: tif_fax3.h:78
#define S_TermW
Definition: tif_fax3.h:75
#define S_VR
Definition: tif_fax3.h:72
#define S_EOL
Definition: tif_fax3.h:80
#define S_MakeUp
Definition: tif_fax3.h:79
#define S_Pass
Definition: tif_fax3.h:69
#define S_VL
Definition: tif_fax3.h:73
#define S_Horiz
Definition: tif_fax3.h:70
#define S_TermB
Definition: tif_fax3.h:76
#define S_V0
Definition: tif_fax3.h:71
#define S_MakeUpW
Definition: tif_fax3.h:77
storage_class
Definition: widltypes.h:231

◆ 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}
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
Definition: name.c:39

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().