home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / ccs / ccs-11tl.lha / lbl / include / jinclude.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-15  |  4.5 KB  |  132 lines

  1. /*
  2.  * jinclude.h
  3.  *
  4.  * Copyright (C) 1991, 1992, 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. #if    defined __STDC__ & !defined NONANSI_INCLUDES
  24. #define INCLUDES_ARE_ANSI    /* this is what's tested before including */
  25. #endif
  26.  
  27. /*
  28.  * <stdio.h> is included to get the FILE typedef and NULL macro.
  29.  * Note that the core portable-JPEG files do not actually do any I/O
  30.  * using the stdio library; only the user interface, error handler,
  31.  * and file reading/writing modules invoke any stdio functions.
  32.  * (Well, we did cheat a bit in jmemmgr.c, but only if MEM_STATS is defined.)
  33.  */
  34.  
  35. #include <stdio.h>
  36.  
  37. /*
  38.  * We need the size_t typedef, which defines the parameter type of malloc().
  39.  * In an ANSI-conforming implementation this is provided by <stdio.h>,
  40.  * but on non-ANSI systems it's more likely to be in <sys/types.h>.
  41.  * On some not-quite-ANSI systems you may find it in <stddef.h>.
  42.  */
  43.  
  44. #ifndef INCLUDES_ARE_ANSI    /* shouldn't need this if ANSI C */
  45. #include <sys/types.h>
  46. #endif
  47. #ifdef __SASC            /* Amiga SAS C provides it in stddef.h. */
  48. #include <stddef.h>
  49. #endif
  50.  
  51. /*
  52.  * In ANSI C, and indeed any rational implementation, size_t is also the
  53.  * type returned by sizeof().  However, it seems there are some irrational
  54.  * implementations out there, in which sizeof() returns an int even though
  55.  * size_t is defined as long or unsigned long.  To ensure consistent results
  56.  * we always use this SIZEOF() macro in place of using sizeof() directly.
  57.  */
  58.  
  59. #undef SIZEOF            /* in case you included X11/xmd.h */
  60. #define SIZEOF(object)    ((size_t) sizeof(object))
  61.  
  62. /*
  63.  * fread() and fwrite() are always invoked through these macros.
  64.  * On some systems you may need to twiddle the argument casts.
  65.  * CAUTION: argument order is different from underlying functions!
  66.  */
  67.  
  68. #ifndef    STREAM_IMAGE
  69. #define JFREAD(file,buf,sizeofbuf)  \
  70.   ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
  71. #else
  72. #define JFREAD(fp,buf,bsize)    \
  73.     (*cinfo->img->read)(buf, 1, bsize, fp)
  74. #endif
  75. #define JFWRITE(file,buf,sizeofbuf)  \
  76.   ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
  77.  
  78. /*
  79.  * We need the memcpy() and strcmp() functions, plus memory zeroing.
  80.  * ANSI and System V implementations declare these in <string.h>.
  81.  * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
  82.  * Some systems may declare memset and memcpy in <memory.h>.
  83.  *
  84.  * NOTE: we assume the size parameters to these functions are of type size_t.
  85.  * Change the casts in these macros if not!
  86.  */
  87.  
  88. #ifdef INCLUDES_ARE_ANSI
  89. #include <string.h>
  90. #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
  91. #define MEMCOPY(dest,src,size)    memcpy((void *)(dest), (const void *)(src), (size_t)(size))
  92. #else /* not ANSI */
  93. #ifdef BSD
  94. #include <strings.h>
  95. #define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))
  96. #define MEMCOPY(dest,src,size)    bcopy((const void *)(src), (void *)(dest), (size_t)(size))
  97. #else /* not BSD, assume Sys V or compatible */
  98. #include <string.h>
  99. #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
  100. #define MEMCOPY(dest,src,size)    memcpy((void *)(dest), (const void *)(src), (size_t)(size))
  101. #endif /* BSD */
  102. #endif /* ANSI */
  103.  
  104.  
  105. /* Now include the portable JPEG definition files. */
  106.  
  107. #include "header.def"
  108. #include "imagedef.h"
  109.  
  110. #include "jconfig.h"
  111.  
  112. #include "jpegdata.h"
  113. /*
  114.  * This list defines the known output image formats
  115.  * (not all of which need be supported by a given version).
  116.  * You can change the default output format by defining DEFAULT_FMT;
  117.  * indeed, you had better do so if you undefine PPM_SUPPORTED.
  118.  */
  119.  
  120. typedef enum {
  121.     FMT_GIF,        /* GIF format */
  122.     FMT_PPM,        /* PPM/PGM (PBMPLUS formats) */
  123.     FMT_RLE,        /* RLE format */
  124.     FMT_TARGA,        /* Targa format */
  125.     FMT_TIFF,        /* TIFF format */
  126.     FMT_DEFAULT
  127. } IMAGE_FORMATS;
  128.  
  129. extern    struct Decompress_info_struct dinfo;
  130. extern    struct External_methods_struct e_methods;
  131. extern    struct Decompress_methods_struct dc_methods;
  132.