home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR2 / DVPG30FS.ZIP / JINCLUDE.H < prev    next >
C/C++ Source or Header  |  1993-07-11  |  4KB  |  109 lines

  1. /*
  2.  * jinclude.h
  3.  *
  4.  * Copyright (C) 1991, 1992, 1993, Thomas G. Lane.
  5.  * This file is part of the Independent JPEG Group's software.
  6.  * For conditions of distribution and use, see the accompanying README file.
  7.  *
  8.  * This is the central file that's #include'd by all the JPEG .c files.
  9.  * Its purpose is to provide a single place to fix any problems with
  10.  * including the wrong system include files.
  11.  * You can edit these declarations if you use a system with nonstandard
  12.  * system include files.
  13.  */
  14.  
  15.  
  16. /*
  17.  * Normally the __STDC__ macro can be taken as indicating that the system
  18.  * include files conform to the ANSI C standard.  However, if you are running
  19.  * GCC on a machine with non-ANSI system include files, that is not the case.
  20.  * In that case change the following, or add -DNONANSI_INCLUDES to your CFLAGS.
  21.  */
  22.  
  23. #ifdef __STDC__
  24. #ifndef NONANSI_INCLUDES
  25. #define INCLUDES_ARE_ANSI    /* this is what's tested before including */
  26. #endif
  27. #endif
  28.  
  29. /*
  30.  * <stdio.h> is included to get the FILE typedef and NULL macro.
  31.  * Note that the core portable-JPEG files do not actually do any I/O
  32.  * using the stdio library; only the user interface, error handler,
  33.  * and file reading/writing modules invoke any stdio functions.
  34.  * (Well, we did cheat a bit in jmemmgr.c, but only if MEM_STATS is defined.)
  35.  */
  36.  
  37. #include <stdio.h>
  38.  
  39. /*
  40.  * We need the size_t typedef, which defines the parameter type of malloc().
  41.  * In an ANSI-conforming implementation this is provided by <stdio.h>,
  42.  * but on non-ANSI systems it's more likely to be in <sys/types.h>.
  43.  * On some not-quite-ANSI systems you may find it in <stddef.h>.
  44.  */
  45.  
  46. #ifndef INCLUDES_ARE_ANSI    /* shouldn't need this if ANSI C */
  47. #include <sys/types.h>
  48. #endif
  49. #ifdef __SASC            /* Amiga SAS C provides it in stddef.h. */
  50. #include <stddef.h>
  51. #endif
  52.  
  53. /*
  54.  * In ANSI C, and indeed any rational implementation, size_t is also the
  55.  * type returned by sizeof().  However, it seems there are some irrational
  56.  * implementations out there, in which sizeof() returns an int even though
  57.  * size_t is defined as long or unsigned long.  To ensure consistent results
  58.  * we always use this SIZEOF() macro in place of using sizeof() directly.
  59.  */
  60.  
  61. #undef SIZEOF            /* in case you included X11/xmd.h */
  62. #define SIZEOF(object)    ((size_t) sizeof(object))
  63.  
  64. /*
  65.  * fread() and fwrite() are always invoked through these macros.
  66.  * On some systems you may need to twiddle the argument casts.
  67.  * CAUTION: argument order is different from underlying functions!
  68.  */
  69.  
  70. #define JFREAD(file,buf,sizeofbuf)  \
  71.   ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
  72. #define JFWRITE(file,buf,sizeofbuf)  \
  73.   ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
  74.  
  75. /*
  76.  * We need the memcpy() and strcmp() functions, plus memory zeroing.
  77.  * ANSI and System V implementations declare these in <string.h>.
  78.  * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
  79.  * Some systems may declare memset and memcpy in <memory.h>.
  80.  *
  81.  * NOTE: we assume the size parameters to these functions are of type size_t.
  82.  * Change the casts in these macros if not!
  83.  */
  84.  
  85. #ifdef INCLUDES_ARE_ANSI
  86. #include <string.h>
  87. #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
  88. #define MEMCOPY(dest,src,size)    memcpy((void *)(dest), (const void *)(src), (size_t)(size))
  89. #else /* not ANSI */
  90. #ifdef BSD
  91. #include <strings.h>
  92. #define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))
  93. #define MEMCOPY(dest,src,size)    bcopy((const void *)(src), (void *)(dest), (size_t)(size))
  94. #else /* not BSD, assume Sys V or compatible */
  95. #include <string.h>
  96. #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
  97. #define MEMCOPY(dest,src,size)    memcpy((void *)(dest), (const void *)(src), (size_t)(size))
  98. #endif /* BSD */
  99. #endif /* ANSI */
  100.  
  101.  
  102. /* Now include the portable JPEG definition files. */
  103.  
  104. #include "jconfig.h"
  105.  
  106. #include "jpegdata.h"
  107.  
  108.  
  109.