istereo

annotate libs/libjpeg/jinclude.h @ 28:c0ae8e668447

added vmath library
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 08 Sep 2011 08:30:42 +0300
parents
children
rev   line source
nuclear@26 1 /*
nuclear@26 2 * jinclude.h
nuclear@26 3 *
nuclear@26 4 * Copyright (C) 1991-1994, Thomas G. Lane.
nuclear@26 5 * This file is part of the Independent JPEG Group's software.
nuclear@26 6 * For conditions of distribution and use, see the accompanying README file.
nuclear@26 7 *
nuclear@26 8 * This file exists to provide a single place to fix any problems with
nuclear@26 9 * including the wrong system include files. (Common problems are taken
nuclear@26 10 * care of by the standard jconfig symbols, but on really weird systems
nuclear@26 11 * you may have to edit this file.)
nuclear@26 12 *
nuclear@26 13 * NOTE: this file is NOT intended to be included by applications using the
nuclear@26 14 * JPEG library. Most applications need only include jpeglib.h.
nuclear@26 15 */
nuclear@26 16
nuclear@26 17
nuclear@26 18 /* Include auto-config file to find out which system include files we need. */
nuclear@26 19
nuclear@26 20 #include "jconfig.h" /* auto configuration options */
nuclear@26 21 #define JCONFIG_INCLUDED /* so that jpeglib.h doesn't do it again */
nuclear@26 22
nuclear@26 23 /*
nuclear@26 24 * We need the NULL macro and size_t typedef.
nuclear@26 25 * On an ANSI-conforming system it is sufficient to include <stddef.h>.
nuclear@26 26 * Otherwise, we get them from <stdlib.h> or <stdio.h>; we may have to
nuclear@26 27 * pull in <sys/types.h> as well.
nuclear@26 28 * Note that the core JPEG library does not require <stdio.h>;
nuclear@26 29 * only the default error handler and data source/destination modules do.
nuclear@26 30 * But we must pull it in because of the references to FILE in jpeglib.h.
nuclear@26 31 * You can remove those references if you want to compile without <stdio.h>.
nuclear@26 32 */
nuclear@26 33
nuclear@26 34 #ifdef HAVE_STDDEF_H
nuclear@26 35 #include <stddef.h>
nuclear@26 36 #endif
nuclear@26 37
nuclear@26 38 #ifdef HAVE_STDLIB_H
nuclear@26 39 #include <stdlib.h>
nuclear@26 40 #endif
nuclear@26 41
nuclear@26 42 #ifdef NEED_SYS_TYPES_H
nuclear@26 43 #include <sys/types.h>
nuclear@26 44 #endif
nuclear@26 45
nuclear@26 46 #include <stdio.h>
nuclear@26 47
nuclear@26 48 /*
nuclear@26 49 * We need memory copying and zeroing functions, plus strncpy().
nuclear@26 50 * ANSI and System V implementations declare these in <string.h>.
nuclear@26 51 * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
nuclear@26 52 * Some systems may declare memset and memcpy in <memory.h>.
nuclear@26 53 *
nuclear@26 54 * NOTE: we assume the size parameters to these functions are of type size_t.
nuclear@26 55 * Change the casts in these macros if not!
nuclear@26 56 */
nuclear@26 57
nuclear@26 58 #ifdef NEED_BSD_STRINGS
nuclear@26 59
nuclear@26 60 #include <strings.h>
nuclear@26 61 #define MEMZERO(target,size) bzero((void *)(target), (size_t)(size))
nuclear@26 62 #define MEMCOPY(dest,src,size) bcopy((const void *)(src), (void *)(dest), (size_t)(size))
nuclear@26 63
nuclear@26 64 #else /* not BSD, assume ANSI/SysV string lib */
nuclear@26 65
nuclear@26 66 #include <string.h>
nuclear@26 67 #define MEMZERO(target,size) memset((void *)(target), 0, (size_t)(size))
nuclear@26 68 #define MEMCOPY(dest,src,size) memcpy((void *)(dest), (const void *)(src), (size_t)(size))
nuclear@26 69
nuclear@26 70 #endif
nuclear@26 71
nuclear@26 72 /*
nuclear@26 73 * In ANSI C, and indeed any rational implementation, size_t is also the
nuclear@26 74 * type returned by sizeof(). However, it seems there are some irrational
nuclear@26 75 * implementations out there, in which sizeof() returns an int even though
nuclear@26 76 * size_t is defined as long or unsigned long. To ensure consistent results
nuclear@26 77 * we always use this SIZEOF() macro in place of using sizeof() directly.
nuclear@26 78 */
nuclear@26 79
nuclear@26 80 #define SIZEOF(object) ((size_t) sizeof(object))
nuclear@26 81
nuclear@26 82 /*
nuclear@26 83 * The modules that use fread() and fwrite() always invoke them through
nuclear@26 84 * these macros. On some systems you may need to twiddle the argument casts.
nuclear@26 85 * CAUTION: argument order is different from underlying functions!
nuclear@26 86 */
nuclear@26 87
nuclear@26 88 #define JFREAD(file,buf,sizeofbuf) \
nuclear@26 89 ((size_t) fread((void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))
nuclear@26 90 #define JFWRITE(file,buf,sizeofbuf) \
nuclear@26 91 ((size_t) fwrite((const void *) (buf), (size_t) 1, (size_t) (sizeofbuf), (file)))