1 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ 2 /* EXIFPROBE - TIFF/JPEG/EXIF image file probe */ 3 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ 4 /* Copyright (C) 2002 by Duane H. Hesser. All rights reserved. */ 5 /* */ 6 /* See the file LICENSE.EXIFPROBE for terms of use. */ 7 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ 8 9 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ 10 /* @(#) $Id: defs.h,v 1.29 2005/07/24 17:04:17 alex Exp $" */ 11 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */ 12 13 /* General defines, used everywhere */ 14 15 #ifndef DEFS_INCLUDED 16 #define DEFS_INCLUDED 17 18 #define HERE (unsigned long)0xffffffff 19 20 #define FNULL (FILE *)0 21 #define CNULL (char *)0 22 #define NULLSTRING "" 23 #define MAXBUFLEN 8192 24 #define MAXIFDS 1024 25 #define MAXINDENT 80 26 #define NOINDENT 0 27 #define SUBINDENT 2 28 #define SMALLINDENT 2 29 #define MEDIUMINDENT 4 30 #define LARGEINDENT 8 31 #define ADDRWIDTH 8 32 #define DUMPALL 0xffffffffUL 33 34 #define DEF_DUMPLENGTH 64 /* Used for unknown files */ 35 #define DEF_SHORTDUMP 36 /* Used for automatic dumps */ 36 37 38 #define HEXTAGNO 0x00000001UL 39 #define DECTAGNO 0x00000002UL 40 #define TAGNO 0x00000003UL 41 42 #define HEXVALUE 0x00000010UL 43 #define DECVALUE 0x00000020UL 44 #define VALUE 0x00000030UL 45 46 #define CAMERA_NAMES 0x00000400UL 47 #define FILENAMES 0x00000800UL 48 49 #define HEXOFFSET 0x00000100UL 50 #define DECOFFSET 0x00000200UL 51 #define OFFSET 0x00000300UL 52 53 #define TAGNAME 0x00001000UL 54 #define TYPE 0x00002000UL 55 56 #define TAG_OPTIONS (TAGNO|TAGNAME|TYPE) 57 58 #define MAKERNOTE_SCHEME 0x00000004UL 59 #define SCHEME_DEBUG 0x00000008UL 60 61 62 #define HEXADDRESS 0x00010000UL 63 #define DECADDRESS 0x00020000UL 64 #define ADDRESS 0x00030000UL 65 #define SECTION 0x00040000UL 66 #define SEGMENT 0x00080000UL 67 68 #define APP_ENTRY 0x00100000UL 69 #define MAKERDUMP 0x00200000UL 70 #define APPNDUMP 0x00400000UL 71 #define IMAGEDUMP 0x00800000UL 72 73 #define VALUE_AT_OFFSET 0x01000000UL 74 #define RAW_VALUES 0x02000000UL 75 #define RELOFFSET 0x04000000UL 76 #define MULTIVAL_PRINT_ALL 0x08000000UL 77 78 #define INDENT_AFTER_ADDRESS 0x10000000UL 79 #define INDENT_BEFORE_ADDRESS 0x20000000UL 80 #define ASCII_IGNORE_LENGTH 0x40000000UL 81 #define TTY_COLOR_CHECK 0x00000080UL 82 #define UNICODE_FLAG 0x00004000UL /* write both bytes */ 83 84 #define ENTRY (TAG_OPTIONS|VALUE|OFFSET|TYPE|RELOFFSET) 85 #define DEF_ENTRY (TAG_OPTIONS|DECVALUE|OFFSET|TYPE) 86 87 #define LONGNAMES_FLAG 0x00000040UL 88 #define LIST_OPTIONS (TAGNAME|DECVALUE|ASCII_IGNORE_LENGTH|LONGNAMES_FLAG|APP_ENTRY) 89 90 #define DEFAULT_OPTIONS (SECTION|SEGMENT|DEF_ENTRY|APP_ENTRY|VALUE_AT_OFFSET|DECADDRESS|HEXADDRESS|PCOLOR|INDENT_AFTER_ADDRESS) 91 #define REPORT_OPTIONS (TAGNAME|DECVALUE|PCOLOR|SECTION|SEGMENT|APP_ENTRY|ASCII_IGNORE_LENGTH|INDENT_AFTER_ADDRESS) 92 93 #define HEX_ONLY (HEXTAGNO|HEXOFFSET|HEXVALUE|HEXADDRESS) 94 #define DECIMAL_ONLY (DECTAGNO|DECOFFSET|DECVALUE|DECADDRESS) 95 96 #define LIST_MODE ((Print_options & (SECTION|VALUE_AT_OFFSET)) == 0) 97 98 #define PRINT_ADDRESS (Print_options & (ADDRESS)) 99 #define PRINT_HEX_ADDRESS (Print_options & HEXADDRESS) 100 #define PRINT_DEC_ADDRESS (Print_options & DECADDRESS) 101 #define PRINT_BOTH_ADDRESS ((PRINT_ADDRESS) == (ADDRESS)) 102 103 #define PRINT_TAGNO (Print_options & (HEXTAGNO|DECTAGNO)) 104 #define PRINT_HEX_TAGNO (Print_options & HEXTAGNO) 105 #define PRINT_DEC_TAGNO (Print_options & DECTAGNO) 106 #define PRINT_BOTH_TAGNO ((PRINT_TAGNO) == (HEXTAGNO|DECTAGNO)) 107 108 109 #define PRINT_VALUE (Print_options & (HEXVALUE|DECVALUE)) 110 #define PRINT_HEX_VALUE (Print_options & HEXVALUE) 111 #define PRINT_DEC_VALUE (Print_options & DECVALUE) 112 #define PRINT_BOTH_VALUE ((PRINT_VALUE) == (HEXVALUE|DECVALUE)) 113 114 #define PRINT_OFFSET (Print_options & (HEXOFFSET|DECOFFSET)) 115 #define PRINT_HEX_OFFSET (Print_options & HEXOFFSET) 116 #define PRINT_DEC_OFFSET (Print_options & DECOFFSET) 117 #define PRINT_BOTH_OFFSET ((PRINT_OFFSET) == (HEXOFFSET|DECOFFSET)) 118 119 120 #define PRINT_TAGNAME (Print_options & TAGNAME) 121 #define PRINT_TYPE (Print_options & TYPE) 122 #define PRINT_TAGINFO (Print_options & TAG_OPTIONS) 123 124 #define PRINT_LONGNAMES (Print_options & LONGNAMES_FLAG) 125 #define PRINT_UNICODE (Print_options & UNICODE_FLAG) 126 #define PRINT_ENTRY (Print_options & ENTRY) 127 #define PRINT_SEGMENT (Print_options & SEGMENT) 128 #define PRINT_SECTION (Print_options & SECTION ) 129 #define PRINT_APPENTRY (Print_options & APP_ENTRY) 130 #define PRINT_ANYTHING (Print_options & (ENTRY|SEGMENT|SECTION)) 131 132 #define PRINT_INDENT_BEFORE_ADDRESS (Print_options & INDENT_BEFORE_ADDRESS) 133 #define PRINT_INDENT_AFTER_ADDRESS (Print_options & INDENT_AFTER_ADDRESS) 134 #define PRINT_INDENT (Print_options & (INDENT_BEFORE_ADDRESS|INDENT_AFTER_ADDRESS)) 135 #define PRINT_RAW_VALUES (Print_options & RAW_VALUES) 136 #define PRINT_ENTRY_RELOFFSET (Print_options & RELOFFSET) 137 #define PRINT_VALUE_AT_OFFSET (Print_options & VALUE_AT_OFFSET) 138 #define PRINT_ASCII_IGNORE_LENGTH (Print_options & ASCII_IGNORE_LENGTH) 139 #define PRINT_MAKERNOTE_SCHEME (Print_options & MAKERNOTE_SCHEME) 140 #define PRINT_SCHEME_DEBUG (Print_options & SCHEME_DEBUG) 141 #define PRINT_MAKERDUMP (Print_options & MAKERDUMP) 142 #define PRINT_APPNDUMP (Print_options & APPNDUMP) 143 #define PRINT_MULTIVAL_ALL (Print_options & MULTIVAL_PRINT_ALL) 144 #define PRINT_CAMERA_NAMES (Print_options & CAMERA_NAMES) 145 #define PRINT_FILENAMES (Print_options & FILENAMES) 146 #define USE_COLOR (Print_options & PCOLOR) 147 #define CHECK_TTY_FOR_COLOR (Print_options & TTY_COLOR_CHECK) 148 149 #define PREFIX "" 150 151 #define UNKNOWN_TYPE -1 152 #define POSSIBLE_PRIMARY_TYPE 0 /* can't be sure which is primary */ 153 #define PRIMARY_TYPE 1 154 #define THUMBNAIL_TYPE 2 155 #define PAGE_TYPE 3 156 #define MASK_TYPE 4 157 #define REDUCED_RES_TYPE 5 /* not full size or marked thumbnail */ 158 159 160 #define UNKNOWN_STRING NULLSTRING 161 #define POSSIBLE_PRIMARY_STRING "primary?" 162 #define PRIMARY_STRING "primary" 163 #define THUMBNAIL_STRING "thumbnail" 164 #define PAGE_STRING "image page" 165 #define MASK_STRING "image mask" 166 #define REDUCED_RES_STRING "reduced-resolution" 167 #define UNSPECIFIED_STRING "" 168 #define QSTRING "???" 169 #define UNKNOWN_CAMERA_STRING "unknown camera" 170 171 /* Status of the jpeg processor */ 172 #define JPEG_NO_ERROR 0x0 173 #define JPEG_EARLY_EOI 0x1 /* found eoi before end of section */ 174 #define JPEG_NO_EOI 0x2 /* soft error */ 175 #define JPEG_NO_SOI 0x4 /* didn't find jpeg */ 176 #define JPEG_HAD_ERROR 0x8 /* failed somewhere after SOI */ 177 178 /* How many consecutive invalid IFD entries will be tolerated before */ 179 /* admitting that a TIFF IFD is unreadable? */ 180 #define MAX_INVALID_ENTRIES 6 181 182 #define TAGWIDTH 27 183 #define PIMTAGWIDTH 17 184 185 /* IFD types */ 186 #define TIFF_IFD 0 187 #define TIFF_SUBIFD 1 188 #define EXIF_IFD 2 189 #define INTEROP_IFD 3 190 #define GPS_IFD 4 191 #define MAKER_IFD 5 192 #define MAKER_SUBIFD 6 193 194 195 #ifdef COLOR 196 #define PCOLOR 0x80000000UL 197 #define PUSHCOLOR(a) pushcolor(a) 198 #define POPCOLOR() popcolor() 199 #else 200 #define PCOLOR 0UL 201 #define PUSHCOLOR(a) 202 #define POPCOLOR() 203 #endif 204 205 #ifdef COLOR 206 207 /* numerical values for ANSI color print sequences */ 208 #define GREEN 32 /* "\033[32m" */ 209 #define HI_GREEN 92 /* "\033[92m" */ 210 #define BLUE 34 /* "\033[34m" */ 211 #define HI_BLUE 94 /* "\033[94m" */ 212 #define RED 31 /* "\033[31m" */ 213 #define HI_RED 91 /* "\033[91m" */ 214 #define MAGENTA 35 /* "\033[35m" */ 215 #define HI_MAGENTA 95 /* "\033[95m" */ 216 217 #define BLACK 30 /* "\033[30m" */ 218 #define HI_BLACK 90 /* "\033[90m" */ 219 220 #define BG_BLACK 40 /* "\033[40m" */ 221 #define BG_HI_BLACK 100 /* "\033[100m" */ 222 #define BG_WHITE 47 /* "\033[47m" */ 223 #define BG_HI_WHITE 107 /* "\033[107m" */ 224 225 #define END_COLOR 0 /* "\033[m" */ 226 #define BOLD_COLOR 1 /* "\033[1m" */ 227 228 229 /* select colors for file sections */ 230 #define SUMMARY_COLOR HI_BLACK 231 #define EXIF_COLOR MAGENTA 232 #define GPS_COLOR BLACK 233 #define MAKER_COLOR HI_BLUE 234 #define INTEROP_COLOR GREEN 235 #define JPEG_COLOR BLACK 236 #define UNCERTAIN_COLOR HI_BLACK 237 238 #else 239 #define GREEN 0 240 #define HI_GREEN 0 241 #define BLUE 0 242 #define HI_BLUE 0 243 #define BOLD_BLUE 0 244 #define RED 0 245 #define HI_RED 0 246 #define BOLD_RED 0 247 248 #define BLACK 0 249 #define HI_BLACK 0 250 #define BOLD_BLACK 0 251 252 #define BG_WHITE 0 253 #define BG_HI_WHITE 0 254 #define END_COLOR 0 255 256 #define IM_COLOR 0 257 #define MAKER_COLOR 0 258 #define EXIF_COLOR 0 259 #define GPS_COLOR 0 260 #define INTEROP_COLOR 0 261 #define JPEG_COLOR 0 262 263 #endif /* COLOR */ 264 265 /* ###%%% temporary? */ 266 #define JPEG_MARKER_DEBUG 0x01 267 #define JPEG_EOI_DEBUG 0x02 268 #define SCAN_DEBUG 0x04 269 #define NOTE_DEBUG 0x08 270 #define END_OF_SECTION_DEBUG 0x10 271 #define OUT_DEBUG 0x20 272 273 #endif /* DEFS_INCLUDED */ 274