jinclude.h
Go to the documentation of this file.
00001 /*
00002  * jinclude.h
00003  *
00004  * Copyright (C) 1991-1994, Thomas G. Lane.
00005  * This file is part of the Independent JPEG Group's software.
00006  * For conditions of distribution and use, see the accompanying README file.
00007  *
00008  * This file exists to provide a single place to fix any problems with
00009  * including the wrong system include files.  (Common problems are taken
00010  * care of by the standard jconfig symbols, but on really weird systems
00011  * you may have to edit this file.)
00012  *
00013  * NOTE: this file is NOT intended to be included by applications using the
00014  * JPEG library.  Most applications need only include jpeglib.h.
00015  */
00016 
00017 
00018 /* Include auto-config file to find out which system include files we need. */
00019 
00020 #include "jconfig.h"            /* auto configuration options */
00021 #define JCONFIG_INCLUDED        /* so that jpeglib.h doesn't do it again */
00022 
00023 /*
00024  * We need the NULL macro and size_t typedef.
00025  * On an ANSI-conforming system it is sufficient to include <stddef.h>.
00026  * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
00027  * pull in <sys/types.h> as well.
00028  * Note that the core JPEG library does not require <stdio.h>;
00029  * only the default error handler and data source/destination modules do.
00030  * But we must pull it in because of the references to FILE in jpeglib.h.
00031  * You can remove those references if you want to compile without <stdio.h>.
00032  */
00033 
00034 #ifdef HAVE_STDDEF_H
00035 #include <stddef.h>
00036 #endif
00037 
00038 #ifdef HAVE_STDLIB_H
00039 #include <stdlib.h>
00040 #endif
00041 
00042 #ifdef NEED_SYS_TYPES_H
00043 #include <sys/types.h>
00044 #endif
00045 
00046 #include <stdio.h>
00047 
00048 /*
00049  * We need memory copying and zeroing functions, plus strncpy().
00050  * ANSI and System V implementations declare these in <string.h>.
00051  * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
00052  * Some systems may declare memset and memcpy in <memory.h>.
00053  *
00054  * NOTE: we assume the size parameters to these functions are of type size_t.
00055  * Change the casts in these macros if not!
00056  */
00057 
00058 #ifdef NEED_BSD_STRINGS
00059 
00060 #include <strings.h>
00061 #define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))
00062 #define MEMCOPY(dest,src,size)  bcopy((const void *)(src), (void *)(dest), (size_t)(size))
00063 
00064 #else /* not BSD, assume ANSI/SysV string lib */
00065 
00066 #include <string.h>
00067 #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
00068 #define MEMCOPY(dest,src,size)  memcpy((void *)(dest), (const void *)(src), (size_t)(size))
00069 
00070 #endif
00071 
00072 /*
00073  * In ANSI C, and indeed any rational implementation, size_t is also the
00074  * type returned by sizeof().  However, it seems there are some irrational
00075  * implementations out there, in which sizeof() returns an int even though
00076  * size_t is defined as long or unsigned long.  To ensure consistent results
00077  * we always use this SIZEOF() macro in place of using sizeof() directly.
00078  */
00079 
00080 #define SIZEOF(object)  ((size_t) sizeof(object))
00081 
00082 /*
00083  * The modules that use fread() and fwrite() always invoke them through
00084  * these macros.  On some systems you may need to twiddle the argument casts.
00085  * CAUTION: argument order is different from underlying functions!
00086  */
00087 
00088 #define JFREAD(file,buf,sizeofbuf)  \
00089   ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
00090 #define JFWRITE(file,buf,sizeofbuf)  \
00091   ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43