Thomas G. Lane | 2cbeb8a | 1991-10-07 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * jinclude.h |
| 3 | * |
| 4 | * Copyright (C) 1991, 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 | * <stdio.h> is included to get the FILE typedef and NULL macro. |
| 18 | * Note that the core portable-JPEG files do not actually do any I/O |
| 19 | * using the stdio library; only the user interface, error handler, |
| 20 | * and file reading/writing modules invoke any stdio functions. |
| 21 | * (Well, we did cheat a bit in jvirtmem.c, but only if MEM_STATS is defined.) |
| 22 | */ |
| 23 | |
| 24 | #include <stdio.h> |
| 25 | |
| 26 | /* |
| 27 | * We need the size_t typedef, which defines the parameter type of malloc(). |
| 28 | * In an ANSI-conforming implementation this is provided by <stdio.h>, |
| 29 | * but on non-ANSI systems it's more likely to be in <sys/types.h>. |
| 30 | */ |
| 31 | |
| 32 | #ifndef __STDC__ /* shouldn't need this if __STDC__ */ |
| 33 | #include <sys/types.h> |
| 34 | #endif |
| 35 | |
| 36 | /* |
| 37 | * In ANSI C, and indeed any rational implementation, size_t is also the |
| 38 | * type returned by sizeof(). However, it seems there are some irrational |
| 39 | * implementations out there, in which sizeof() returns an int even though |
| 40 | * size_t is defined as long or unsigned long. To ensure consistent results |
| 41 | * we always use this SIZEOF() macro in place of using sizeof() directly. |
| 42 | */ |
| 43 | |
| 44 | #define SIZEOF(object) ((size_t) sizeof(object)) |
| 45 | |
| 46 | /* |
| 47 | * We need the memcpy() and strcmp() functions, plus memory zeroing. |
| 48 | * ANSI and System V implementations declare these in <string.h>. |
| 49 | * BSD doesn't have the mem() functions, but it does have bcopy()/bzero(). |
| 50 | * NOTE: we assume the size parameters to these functions are of type size_t. |
| 51 | * Insert casts in these macros if not! |
| 52 | */ |
| 53 | |
| 54 | #ifdef __STDC__ |
| 55 | #include <string.h> |
| 56 | #define MEMZERO(voidptr,size) memset((voidptr), 0, (size)) |
| 57 | #else /* not STDC */ |
| 58 | #ifdef BSD |
| 59 | #include <strings.h> |
| 60 | #define MEMZERO(voidptr,size) bzero((voidptr), (size)) |
| 61 | #define memcpy(dest,src,size) bcopy((src), (dest), (size)) |
| 62 | #else /* not BSD, assume Sys V or compatible */ |
| 63 | #include <string.h> |
| 64 | #define MEMZERO(voidptr,size) memset((voidptr), 0, (size)) |
| 65 | #endif /* BSD */ |
| 66 | #endif /* STDC */ |
| 67 | |
| 68 | |
| 69 | /* Now include the portable JPEG definition files. */ |
| 70 | |
| 71 | #include "jconfig.h" |
| 72 | |
| 73 | #include "jpegdata.h" |