home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / tsm23s.lha / jpeg_ls / jinclude.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-09  |  4.8 KB  |  157 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. #define HAVE_STDC
  16. #define INCLUDES_ARE_ANSI
  17. #undef AMIGA
  18. #define AMIGA
  19. #define INCOMPLETE_TYPES_BROKEN
  20. #define AMIGA_IO
  21. #undef PROGRESS_REPORT
  22. #define NO_MKTEMP
  23. #undef NEED_SIGNAL_CATCHER
  24. #define SHORTxSHORT_32
  25.  
  26. /*
  27.  * Normally the __STDC__ macro can be taken as indicating that the system
  28.  * include files conform to the ANSI C standard.  However, if you are running
  29.  * GCC on a machine with non-ANSI system include files, that is not the case.
  30.  * In that case change the following, or add -DNONANSI_INCLUDES to your CFLAGS.
  31.  */
  32.  
  33. #ifdef __STDC__
  34. #ifndef NONANSI_INCLUDES
  35. #define INCLUDES_ARE_ANSI    /* this is what's tested before including */
  36. #endif
  37. #endif
  38.  
  39. /*
  40.  * <stdio.h> is included to get the FILE typedef and NULL macro.
  41.  * Note that the core portable-JPEG files do not actually do any I/O
  42.  * using the stdio library; only the user interface, error handler,
  43.  * and file reading/writing modules invoke any stdio functions.
  44.  * (Well, we did cheat a bit in jmemmgr.c, but only if MEM_STATS is defined.)
  45.  */
  46.  
  47. #include <stdio.h>
  48.  
  49. /*
  50.  * We need the size_t typedef, which defines the parameter type of malloc().
  51.  * In an ANSI-conforming implementation this is provided by <stdio.h>,
  52.  * but on non-ANSI systems it's more likely to be in <sys/types.h>.
  53.  * On some not-quite-ANSI systems you may find it in <stddef.h>.
  54.  */
  55.  
  56. #ifndef INCLUDES_ARE_ANSI    /* shouldn't need this if ANSI C */
  57. #include <sys/types.h>
  58. #endif
  59. #ifdef __SASC            /* Amiga SAS C provides it in stddef.h. */
  60. #include <stddef.h>
  61. #endif
  62.  
  63. /*
  64.  * In ANSI C, and indeed any rational implementation, size_t is also the
  65.  * type returned by sizeof().  However, it seems there are some irrational
  66.  * implementations out there, in which sizeof() returns an int even though
  67.  * size_t is defined as long or unsigned long.  To ensure consistent results
  68.  * we always use this SIZEOF() macro in place of using sizeof() directly.
  69.  */
  70.  
  71. #undef SIZEOF            /* in case you included X11/xmd.h */
  72. #define SIZEOF(object)    ((size_t) sizeof(object))
  73.  
  74. /*
  75.  * fread() and fwrite() are always invoked through these macros.
  76.  * On some systems you may need to twiddle the argument casts.
  77.  * CAUTION: argument order is different from underlying functions!
  78.  */
  79.  
  80. // Add AmigaDOS based IO
  81. #ifdef AMIGA_IO
  82. #include <proto/dos.h>
  83. #undef GLOBAL
  84. #define JFREAD(file,buf,sizeofbuf)  \
  85.   ((size_t) FRead(file,(UBYTE *)buf,1L,(ULONG) sizeofbuf))
  86. #define JFWRITE(file,buf,sizeofbuf)  \
  87.   ((size_t) FWrite(file,(UBYTE *)buf,1L,(ULONG) sizeofbuf))
  88. #undef putc
  89. #define putc(c,f) \
  90.   FPutC(f,c)
  91. #undef getc
  92. #define getc(f) \
  93.   FGetC(f)
  94. #define ungetc(c,f) \
  95.   UnGetC(f,c)
  96. #define fprintf(a,b) \
  97.   VFPrintf(a,b,NULL)
  98. #define fprintf1(a,b,c) \
  99.   VFPrintf(a,b,(long *)&c)
  100. #undef stdin
  101. #define stdin Input()
  102. #undef stdout
  103. #define stdout Output()
  104. #undef stderr
  105. #define stderr Output()
  106. #define fopen(a,b) \
  107.   Open(a,b)
  108. #define fclose(a) \
  109.   Close(a)
  110. #undef fflush
  111. #define fflush(a) \
  112.   Flush(a)
  113. #define unlink(a) \
  114.   DeleteFile(a)
  115. #define fseek(a,b,c) \
  116.   Seek(a,b,c)
  117. #else
  118. #define fprintf1 fprintf
  119. #define JFREAD(file,buf,sizeofbuf)  \
  120.   ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
  121. #define JFWRITE(file,buf,sizeofbuf)  \
  122.   ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
  123. #endif
  124.  
  125. /*
  126.  * We need the memcpy() and strcmp() functions, plus memory zeroing.
  127.  * ANSI and System V implementations declare these in <string.h>.
  128.  * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
  129.  * Some systems may declare memset and memcpy in <memory.h>.
  130.  *
  131.  * NOTE: we assume the size parameters to these functions are of type size_t.
  132.  * Change the casts in these macros if not!
  133.  */
  134.  
  135. #ifdef INCLUDES_ARE_ANSI
  136. #include <string.h>
  137. #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
  138. #define MEMCOPY(dest,src,size)    memcpy((void *)(dest), (const void *)(src), (size_t)(size))
  139. #else /* not ANSI */
  140. #ifdef BSD
  141. #include <strings.h>
  142. #define MEMZERO(target,size)    bzero((void *)(target), (size_t)(size))
  143. #define MEMCOPY(dest,src,size)    bcopy((const void *)(src), (void *)(dest), (size_t)(size))
  144. #else /* not BSD, assume Sys V or compatible */
  145. #include <string.h>
  146. #define MEMZERO(target,size)    memset((void *)(target), 0, (size_t)(size))
  147. #define MEMCOPY(dest,src,size)    memcpy((void *)(dest), (const void *)(src), (size_t)(size))
  148. #endif /* BSD */
  149. #endif /* ANSI */
  150.  
  151.  
  152. /* Now include the portable JPEG definition files. */
  153.  
  154. #include "JPEG_LS/jconfig.h"
  155.  
  156. #include "JPEG_LS/jpegdata.h"
  157.