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