ReactOS 0.4.16-dev-226-g79f2289
ckconfig.c File Reference
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for ckconfig.c:

Go to the source code of this file.

Classes

struct  methods_struct
 

Macros

#define HAVE_STDDEF_H   /* replace 'define' by 'undef' if error here */
 
#define HAVE_STDLIB_H   /* same thing for stdlib.h */
 
#define HAVE_PROTOTYPES
 
#define HAVE_UNSIGNED_CHAR
 
#define HAVE_UNSIGNED_SHORT
 
#define HAVE_VOID
 
#define HAVE_CONST
 

Typedefs

typedef size_t my_size_t
 
typedef voidvoid_ptr
 
typedef void(* void_func) (int a, int b)
 
typedef struct undefined_structure * undef_struct_ptr
 

Functions

int testfunction (int arg1, int *arg2)
 
int test2function (void)
 
void test3function (void_ptr arg1, void_func arg2)
 
int test4function (const int arg1)
 
int possibly_duplicate_function ()
 
int possibly_dupli_function ()
 
int is_char_signed (int arg)
 
int is_shifting_signed (long arg)
 
int main (int argc, char **argv)
 

Variables

unsigned char un_char
 
unsigned short un_short
 
static const int carray [3] = {1, 2, 3}
 

Macro Definition Documentation

◆ HAVE_CONST

#define HAVE_CONST

Definition at line 181 of file ckconfig.c.

◆ HAVE_PROTOTYPES

#define HAVE_PROTOTYPES

Definition at line 100 of file ckconfig.c.

◆ HAVE_STDDEF_H

#define HAVE_STDDEF_H   /* replace 'define' by 'undef' if error here */

Definition at line 35 of file ckconfig.c.

◆ HAVE_STDLIB_H

#define HAVE_STDLIB_H   /* same thing for stdlib.h */

Definition at line 40 of file ckconfig.c.

◆ HAVE_UNSIGNED_CHAR

#define HAVE_UNSIGNED_CHAR

Definition at line 128 of file ckconfig.c.

◆ HAVE_UNSIGNED_SHORT

#define HAVE_UNSIGNED_SHORT

Definition at line 140 of file ckconfig.c.

◆ HAVE_VOID

#define HAVE_VOID

Definition at line 151 of file ckconfig.c.

Typedef Documentation

◆ my_size_t

typedef size_t my_size_t

Definition at line 90 of file ckconfig.c.

◆ undef_struct_ptr

typedef struct undefined_structure* undef_struct_ptr

Definition at line 205 of file ckconfig.c.

◆ void_func

typedef void(* void_func) (int a, int b)

Definition at line 157 of file ckconfig.c.

◆ void_ptr

typedef void* void_ptr

Definition at line 155 of file ckconfig.c.

Function Documentation

◆ is_char_signed()

int is_char_signed ( int  arg)

Definition at line 243 of file ckconfig.c.

248{
249 if (arg == 189) { /* expected result for unsigned char */
250 return 0; /* type char is unsigned */
251 }
252 else if (arg != -67) { /* expected result for signed char */
253 printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n");
254 printf("I fear the JPEG software will not work at all.\n\n");
255 }
256 return 1; /* assume char is signed otherwise */
257}
#define printf
Definition: freeldr.h:97

Referenced by main().

◆ is_shifting_signed()

int is_shifting_signed ( long  arg)

Definition at line 261 of file ckconfig.c.

267{
268 long res = arg >> 4;
269
270 if (res == -0x7F7E80CL) { /* expected result for signed shift */
271 return 1; /* right shift is signed */
272 }
273 /* see if unsigned-shift hack will fix it. */
274 /* we can't just test exact value since it depends on width of long... */
275 res |= (~0L) << (32-4);
276 if (res == -0x7F7E80CL) { /* expected result now? */
277 return 0; /* right shift is unsigned */
278 }
279 printf("Right shift isn't acting as I expect it to.\n");
280 printf("I fear the JPEG software will not work at all.\n\n");
281 return 0; /* try it with unsigned anyway */
282}
GLuint res
Definition: glext.h:9613
#define L(x)
Definition: ntvdm.h:50

Referenced by main().

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 286 of file ckconfig.c.

292{
293 char signed_char_check = (char) (-67);
294 FILE *outfile;
295
296 /* Attempt to write jconfig.h */
297 if ((outfile = fopen("jconfig.h", "w")) == NULL) {
298 printf("Failed to write jconfig.h\n");
299 return 1;
300 }
301
302 /* Write out all the info */
303 fprintf(outfile, "/* jconfig.h --- generated by ckconfig.c */\n");
304 fprintf(outfile, "/* see jconfig.txt for explanations */\n\n");
305#ifdef HAVE_PROTOTYPES
306 fprintf(outfile, "#define HAVE_PROTOTYPES\n");
307#else
308 fprintf(outfile, "#undef HAVE_PROTOTYPES\n");
309#endif
310#ifdef HAVE_UNSIGNED_CHAR
311 fprintf(outfile, "#define HAVE_UNSIGNED_CHAR\n");
312#else
313 fprintf(outfile, "#undef HAVE_UNSIGNED_CHAR\n");
314#endif
315#ifdef HAVE_UNSIGNED_SHORT
316 fprintf(outfile, "#define HAVE_UNSIGNED_SHORT\n");
317#else
318 fprintf(outfile, "#undef HAVE_UNSIGNED_SHORT\n");
319#endif
320#ifdef HAVE_VOID
321 fprintf(outfile, "/* #define void char */\n");
322#else
323 fprintf(outfile, "#define void char\n");
324#endif
325#ifdef HAVE_CONST
326 fprintf(outfile, "/* #define const */\n");
327#else
328 fprintf(outfile, "#define const\n");
329#endif
330 if (is_char_signed((int) signed_char_check))
331 fprintf(outfile, "#undef CHAR_IS_UNSIGNED\n");
332 else
333 fprintf(outfile, "#define CHAR_IS_UNSIGNED\n");
334#ifdef HAVE_STDDEF_H
335 fprintf(outfile, "#define HAVE_STDDEF_H\n");
336#else
337 fprintf(outfile, "#undef HAVE_STDDEF_H\n");
338#endif
339#ifdef HAVE_STDLIB_H
340 fprintf(outfile, "#define HAVE_STDLIB_H\n");
341#else
342 fprintf(outfile, "#undef HAVE_STDLIB_H\n");
343#endif
344#ifdef NEED_BSD_STRINGS
345 fprintf(outfile, "#define NEED_BSD_STRINGS\n");
346#else
347 fprintf(outfile, "#undef NEED_BSD_STRINGS\n");
348#endif
349#ifdef NEED_SYS_TYPES_H
350 fprintf(outfile, "#define NEED_SYS_TYPES_H\n");
351#else
352 fprintf(outfile, "#undef NEED_SYS_TYPES_H\n");
353#endif
354 fprintf(outfile, "#undef NEED_FAR_POINTERS\n");
355#ifdef NEED_SHORT_EXTERNAL_NAMES
356 fprintf(outfile, "#define NEED_SHORT_EXTERNAL_NAMES\n");
357#else
358 fprintf(outfile, "#undef NEED_SHORT_EXTERNAL_NAMES\n");
359#endif
360#ifdef INCOMPLETE_TYPES_BROKEN
361 fprintf(outfile, "#define INCOMPLETE_TYPES_BROKEN\n");
362#else
363 fprintf(outfile, "#undef INCOMPLETE_TYPES_BROKEN\n");
364#endif
365 fprintf(outfile, "\n#ifdef JPEG_INTERNALS\n\n");
366 if (is_shifting_signed(-0x7F7E80B1L))
367 fprintf(outfile, "#undef RIGHT_SHIFT_IS_UNSIGNED\n");
368 else
369 fprintf(outfile, "#define RIGHT_SHIFT_IS_UNSIGNED\n");
370 fprintf(outfile, "\n#endif /* JPEG_INTERNALS */\n");
371 fprintf(outfile, "\n#ifdef JPEG_CJPEG_DJPEG\n\n");
372 fprintf(outfile, "#define BMP_SUPPORTED /* BMP image file format */\n");
373 fprintf(outfile, "#define GIF_SUPPORTED /* GIF image file format */\n");
374 fprintf(outfile, "#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */\n");
375 fprintf(outfile, "#undef RLE_SUPPORTED /* Utah RLE image file format */\n");
376 fprintf(outfile, "#define TARGA_SUPPORTED /* Targa image file format */\n\n");
377 fprintf(outfile, "#undef TWO_FILE_COMMANDLINE /* You may need this on non-Unix systems */\n");
378 fprintf(outfile, "#undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */\n");
379 fprintf(outfile, "#undef DONT_USE_B_MODE\n");
380 fprintf(outfile, "/* #define PROGRESS_REPORT */ /* optional */\n");
381 fprintf(outfile, "\n#endif /* JPEG_CJPEG_DJPEG */\n");
382
383 /* Close the jconfig.h file */
385
386 /* User report */
387 printf("Configuration check for Independent JPEG Group's software done.\n");
388 printf("\nI have written the jconfig.h file for you.\n\n");
389#ifdef HAVE_PROTOTYPES
390 printf("You should use makefile.ansi as the starting point for your Makefile.\n");
391#else
392 printf("You should use makefile.unix as the starting point for your Makefile.\n");
393#endif
394
395#ifdef NEED_SPECIAL_INCLUDE
396 printf("\nYou'll need to change jconfig.h to include the system include file\n");
397 printf("that you found type size_t in, or add a direct definition of type\n");
398 printf("size_t if that's what you used. Just add it to the end.\n");
399#endif
400
401 return 0;
402}
int is_shifting_signed(long arg)
Definition: ckconfig.c:261
int is_char_signed(int arg)
Definition: ckconfig.c:243
#define NULL
Definition: types.h:112
unsigned char
Definition: typeof.h:29
_Check_return_opt_ _CRTIMP int __cdecl fprintf(_Inout_ FILE *_File, _In_z_ _Printf_format_string_ const char *_Format,...)
_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)
static FILE * outfile
Definition: wrjpgcom.c:81

◆ possibly_dupli_function()

int possibly_dupli_function ( )

Definition at line 222 of file ckconfig.c.

223{
224 return 1;
225}

◆ possibly_duplicate_function()

int possibly_duplicate_function ( )

Definition at line 217 of file ckconfig.c.

218{
219 return 0;
220}

◆ test2function()

int test2function ( void  )

Definition at line 116 of file ckconfig.c.

117{
118 return 0;
119}

◆ test3function()

void test3function ( void_ptr  arg1,
void_func  arg2 
)

Definition at line 163 of file ckconfig.c.

169{
170 char * locptr = (char *) arg1; /* check casting to and from void * */
171 arg1 = (void *) locptr;
172 (*arg2) (1, 2); /* check call of fcn returning void */
173}
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513

◆ test4function()

int test4function ( const int  arg1)

Definition at line 187 of file ckconfig.c.

192{
193 return carray[arg1];
194}
static const int carray[3]
Definition: ckconfig.c:184

◆ testfunction()

int testfunction ( int  arg1,
int arg2 
)

Definition at line 111 of file ckconfig.c.

112{
113 return arg2[arg1];
114}
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514

Variable Documentation

◆ carray

const int carray[3] = {1, 2, 3}
static

Definition at line 184 of file ckconfig.c.

Referenced by test4function(), and write_pointer_description().

◆ un_char

unsigned char un_char

Definition at line 131 of file ckconfig.c.

◆ un_short

unsigned short un_short

Definition at line 143 of file ckconfig.c.