Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

ckconfig.c File Reference

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.


Data Structures

struct  methods_struct

Defines

#define HAVE_STDDEF_H
#define HAVE_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 void * void_ptr
typedef void(* void_func )(int a, int b)
typedef 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
const int carray [3] = {1, 2, 3}

Define Documentation

#define HAVE_CONST
 

Definition at line 181 of file ckconfig.c.

#define HAVE_PROTOTYPES
 

Definition at line 100 of file ckconfig.c.

#define HAVE_STDDEF_H
 

Definition at line 35 of file ckconfig.c.

#define HAVE_STDLIB_H
 

Definition at line 40 of file ckconfig.c.

#define HAVE_UNSIGNED_CHAR
 

Definition at line 128 of file ckconfig.c.

#define HAVE_UNSIGNED_SHORT
 

Definition at line 140 of file ckconfig.c.

#define HAVE_VOID
 

Definition at line 151 of file ckconfig.c.


Typedef Documentation

typedef size_t my_size_t
 

Definition at line 90 of file ckconfig.c.

typedef struct undefined_structure* undef_struct_ptr
 

Definition at line 205 of file ckconfig.c.

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

Definition at line 157 of file ckconfig.c.

Referenced by test3function().

typedef void* void_ptr
 

Definition at line 155 of file ckconfig.c.

Referenced by test3function().


Function Documentation

int is_char_signed int    arg
 

Definition at line 243 of file ckconfig.c.

References arg.

Referenced by main().

00248 {
00249   if (arg == 189) {             /* expected result for unsigned char */
00250     return 0;                   /* type char is unsigned */
00251   }
00252   else if (arg != -67) {        /* expected result for signed char */
00253     printf("Hmm, it seems 'char' is not eight bits wide on your machine.\n");
00254     printf("I fear the JPEG software will not work at all.\n\n");
00255   }
00256   return 1;                     /* assume char is signed otherwise */
00257 }

int is_shifting_signed long    arg
 

Definition at line 261 of file ckconfig.c.

References arg, and L.

Referenced by main().

00267 {
00268   long res = arg >> 4;
00269 
00270   if (res == -0x7F7E80CL) {     /* expected result for signed shift */
00271     return 1;                   /* right shift is signed */
00272   }
00273   /* see if unsigned-shift hack will fix it. */
00274   /* we can't just test exact value since it depends on width of long... */
00275   res |= (~0L) << (32-4);
00276   if (res == -0x7F7E80CL) {     /* expected result now? */
00277     return 0;                   /* right shift is unsigned */
00278   }
00279   printf("Right shift isn't acting as I expect it to.\n");
00280   printf("I fear the JPEG software will not work at all.\n\n");
00281   return 0;                     /* try it with unsigned anyway */
00282 }

int main int    argc,
char **    argv
 

Definition at line 286 of file ckconfig.c.

References argc, is_char_signed(), and is_shifting_signed().

00292 {
00293   char signed_char_check = (char) (-67);
00294   FILE *outfile;
00295 
00296   /* Attempt to write jconfig.h */
00297   if ((outfile = fopen("jconfig.h", "w")) == NULL) {
00298     printf("Failed to write jconfig.h\n");
00299     return 1;
00300   }
00301 
00302   /* Write out all the info */
00303   fprintf(outfile, "/* jconfig.h --- generated by ckconfig.c */\n");
00304   fprintf(outfile, "/* see jconfig.doc for explanations */\n\n");
00305 #ifdef HAVE_PROTOTYPES
00306   fprintf(outfile, "#define HAVE_PROTOTYPES\n");
00307 #else
00308   fprintf(outfile, "#undef HAVE_PROTOTYPES\n");
00309 #endif
00310 #ifdef HAVE_UNSIGNED_CHAR
00311   fprintf(outfile, "#define HAVE_UNSIGNED_CHAR\n");
00312 #else
00313   fprintf(outfile, "#undef HAVE_UNSIGNED_CHAR\n");
00314 #endif
00315 #ifdef HAVE_UNSIGNED_SHORT
00316   fprintf(outfile, "#define HAVE_UNSIGNED_SHORT\n");
00317 #else
00318   fprintf(outfile, "#undef HAVE_UNSIGNED_SHORT\n");
00319 #endif
00320 #ifdef HAVE_VOID
00321   fprintf(outfile, "/* #define void char */\n");
00322 #else
00323   fprintf(outfile, "#define void char\n");
00324 #endif
00325 #ifdef HAVE_CONST
00326   fprintf(outfile, "/* #define const */\n");
00327 #else
00328   fprintf(outfile, "#define const\n");
00329 #endif
00330   if (is_char_signed((int) signed_char_check))
00331     fprintf(outfile, "#undef CHAR_IS_UNSIGNED\n");
00332   else
00333     fprintf(outfile, "#define CHAR_IS_UNSIGNED\n");
00334 #ifdef HAVE_STDDEF_H
00335   fprintf(outfile, "#define HAVE_STDDEF_H\n");
00336 #else
00337   fprintf(outfile, "#undef HAVE_STDDEF_H\n");
00338 #endif
00339 #ifdef HAVE_STDLIB_H
00340   fprintf(outfile, "#define HAVE_STDLIB_H\n");
00341 #else
00342   fprintf(outfile, "#undef HAVE_STDLIB_H\n");
00343 #endif
00344 #ifdef NEED_BSD_STRINGS
00345   fprintf(outfile, "#define NEED_BSD_STRINGS\n");
00346 #else
00347   fprintf(outfile, "#undef NEED_BSD_STRINGS\n");
00348 #endif
00349 #ifdef NEED_SYS_TYPES_H
00350   fprintf(outfile, "#define NEED_SYS_TYPES_H\n");
00351 #else
00352   fprintf(outfile, "#undef NEED_SYS_TYPES_H\n");
00353 #endif
00354   fprintf(outfile, "#undef NEED_FAR_POINTERS\n");
00355 #ifdef NEED_SHORT_EXTERNAL_NAMES
00356   fprintf(outfile, "#define NEED_SHORT_EXTERNAL_NAMES\n");
00357 #else
00358   fprintf(outfile, "#undef NEED_SHORT_EXTERNAL_NAMES\n");
00359 #endif
00360 #ifdef INCOMPLETE_TYPES_BROKEN
00361   fprintf(outfile, "#define INCOMPLETE_TYPES_BROKEN\n");
00362 #else
00363   fprintf(outfile, "#undef INCOMPLETE_TYPES_BROKEN\n");
00364 #endif
00365   fprintf(outfile, "\n#ifdef JPEG_INTERNALS\n\n");
00366   if (is_shifting_signed(-0x7F7E80B1L))
00367     fprintf(outfile, "#undef RIGHT_SHIFT_IS_UNSIGNED\n");
00368   else
00369     fprintf(outfile, "#define RIGHT_SHIFT_IS_UNSIGNED\n");
00370   fprintf(outfile, "\n#endif /* JPEG_INTERNALS */\n");
00371   fprintf(outfile, "\n#ifdef JPEG_CJPEG_DJPEG\n\n");
00372   fprintf(outfile, "#define BMP_SUPPORTED               /* BMP image file format */\n");
00373   fprintf(outfile, "#define GIF_SUPPORTED               /* GIF image file format */\n");
00374   fprintf(outfile, "#define PPM_SUPPORTED               /* PBMPLUS PPM/PGM image file format */\n");
00375   fprintf(outfile, "#undef RLE_SUPPORTED                /* Utah RLE image file format */\n");
00376   fprintf(outfile, "#define TARGA_SUPPORTED             /* Targa image file format */\n\n");
00377   fprintf(outfile, "#undef TWO_FILE_COMMANDLINE /* You may need this on non-Unix systems */\n");
00378   fprintf(outfile, "#undef NEED_SIGNAL_CATCHER  /* Define this if you use jmemname.c */\n");
00379   fprintf(outfile, "#undef DONT_USE_B_MODE\n");
00380   fprintf(outfile, "/* #define PROGRESS_REPORT */       /* optional */\n");
00381   fprintf(outfile, "\n#endif /* JPEG_CJPEG_DJPEG */\n");
00382 
00383   /* Close the jconfig.h file */
00384   fclose(outfile);
00385 
00386   /* User report */
00387   printf("Configuration check for Independent JPEG Group's software done.\n");
00388   printf("\nI have written the jconfig.h file for you.\n\n");
00389 #ifdef HAVE_PROTOTYPES
00390   printf("You should use makefile.ansi as the starting point for your Makefile.\n");
00391 #else
00392   printf("You should use makefile.unix as the starting point for your Makefile.\n");
00393 #endif
00394 
00395 #ifdef NEED_SPECIAL_INCLUDE
00396   printf("\nYou'll need to change jconfig.h to include the system include file\n");
00397   printf("that you found type size_t in, or add a direct definition of type\n");
00398   printf("size_t if that's what you used.  Just add it to the end.\n");
00399 #endif
00400 
00401   return 0;
00402 }

int possibly_dupli_function  
 

Definition at line 222 of file ckconfig.c.

00223 {
00224   return 1;
00225 }

int possibly_duplicate_function  
 

Definition at line 217 of file ckconfig.c.

00218 {
00219   return 0;
00220 }

int test2function void   
 

Definition at line 116 of file ckconfig.c.

00117 {
00118   return 0;
00119 }

void test3function void_ptr    arg1,
void_func    arg2
 

Definition at line 163 of file ckconfig.c.

References void_func, and void_ptr.

00169 {
00170   char * locptr = (char *) arg1; /* check casting to and from void * */
00171   arg1 = (void *) locptr;
00172   (*arg2) (1, 2);               /* check call of fcn returning void */
00173 }

int test4function const int    arg1
 

Definition at line 187 of file ckconfig.c.

References carray.

00192 {
00193   return carray[arg1];
00194 }

int testfunction int    arg1,
int *    arg2
 

Definition at line 111 of file ckconfig.c.

00112 {
00113   return arg2[arg1];
00114 }

Variable Documentation

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

Definition at line 184 of file ckconfig.c.

Referenced by test4function().

unsigned char un_char
 

Definition at line 131 of file ckconfig.c.

unsigned short un_short
 

Definition at line 143 of file ckconfig.c.

 

Powered by Plone

This site conforms to the following standards: