pax_global_header00006660000000000000000000000064130446650730014522gustar00rootroot0000000000000052 comment=0b810994f0eb0ca9dfdfb65e8b2890c56dfcb382 checkit_tiff-0.2.3/000077500000000000000000000000001304466507300141465ustar00rootroot00000000000000checkit_tiff-0.2.3/.gitignore000066400000000000000000000001021304466507300161270ustar00rootroot00000000000000*.o build/* src/.depend src/checkit_check_config src/checkit_tiff checkit_tiff-0.2.3/BUGS000066400000000000000000000001011304466507300146210ustar00rootroot00000000000000* parser could not handle valuedata yet (use ANY as workaround) checkit_tiff-0.2.3/FAQ000066400000000000000000000056741304466507300145140ustar00rootroot00000000000000Q: "make" reports "usage: git rev-list [OPTION] …" A: the Makefile uses version.mk to build a version information for the tool. In that case you should comment out the lines in version.mk and set REPO_REVISION manually Q: I did not have "peg" and my config_dsl.grammar.c has zero size and there are compile errors. A: remove that file and use "git checkout config_dsl.grammar.c" to restore it from repository. Try to avoid "make distclean", because it erases the file. Q: My C-compiler reports error-messages like "cc: error: unrecognized command line option '-fsanitze=undefined'" A: You use an older GCC variant. Try 'SANITIZE="" make' Q: How can I compile a windows version of your program? A: I have only tested creating Windows executables using the crosscompiler minGW under Debian Jessie. You need the installed mingw-w64-x86-32 packages, also you need to download and extract libpcre. in libpcre (pcre-8.37), call "./configure --host=i686-w64-mingw32 --disable-win32-io --disable-shared -enable-static" and "make -j 4". Change into checkit-tiff/build, call: "cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake ../src/ -DPCRE_LIBRARY=~/Downloads/pcre-8.37/.libs/libpcre.a -DPCRE_INCLUDE_DIR=~/Downloads/pcre-8.37/ ../src/" and "make -j 4" A2: I have only tested creating Windows executables using the crosscompiler minGW under Debian Jessie. You need the installed mingw-w64-x86-64 packages, also you need to download and extract libtiff and libpcre. in libpcre (pcre-8.37), call "./configure --host=x86_64-w64-mingw32 --disable-win32-io --disable-shared -enable-static" and "make -j 4". Change into checkit-tiff/build, call: "cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw64.cmake ../src/ -DPCRE_LIBRARY=~/Downloads/pcre-8.37/.libs/libpcre.a -DPCRE_INCLUDE_DIR=~/Downloads/pcre-8.37/ ../src/" and "make -j 4" Q: How to compile to Javascript? A: Use emscripten, do same steps as above but with "emconfigure ./configure...". Compile checkit_tiff with ff. options: $> emcmake cmake -DCMAKE_C_COMPILER=$(which emcc) -DPCRE_LIBRARY=~/Downloads/pcre-8.37/.libs/libpcre.a -DPCRE_INCLUDE_DIR=~/Downloads/pcre-8.37/ -DCMAKE_C_FLAGS="-Oz -s TOTAL_MEMORY=400000000" ../src/" $> make -j 4 $> js checkit_tiff.js -c ../tiffs_should_pass/minimal_valid.tiff ../example_configs/cit_tiff6_baseline_SLUB.cfg Q: Where are older TIFF specs? A: take a look to: TIFF 4: https://web.archive.org/web/20050323073243/http://palimpsest.stanford.edu/bytopic/imaging/std/tiff4.html TIFF 5: https://web.archive.org/web/20050323073243/http://palimpsest.stanford.edu/bytopic/imaging/std/tiff5.html Q: I am using cmake, but it fails with "CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name". But your program is C only, why I need a C++compiler then? A: cmake uses C++-compiler for its checks. Sorry, you need a C++ then. checkit_tiff-0.2.3/LICENSE000066400000000000000000000033101304466507300151500ustar00rootroot00000000000000The software uses some pieces from libtiff, therefore the whole project is licensed under same conditions, too. (c) 2015/16 Andreas Romeyke Copyright (C) 1988-1997 Sam Leffler Copyright (C) 1991-1997 Silicon Graphics, Inc. Portions Copyright (C) 1985-1987, 1990 Regents of the University of California Portions Copyright (C) 1990, 1991 Digital Equipment Corporation Portions Copyright (C) 1990 Sun Microsystems, Inc. Portions Copyright (C) 1990, 1995 Frank D. Cringle Portions Copyright (C) 1996 BancTec AB Portions Copyright (C) 1996 Mike Johnson Portions Copyright (C) 1996 Pixar Portions Copyright (C) 1997 Greg Ward Larson Portions Copyright (C) 2000 Frank Warmerdam Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. checkit_tiff-0.2.3/README.1st_checkit000066400000000000000000000111451304466507300172300ustar00rootroot00000000000000General ======= "checkit_tiff" is a conformance checker for baseline TIFFs (with various extensions). It works in different way than other tools. Instead to use a hardcoded rule set with predefined values, you are able to define tags and corresponding values more fine granulary. The rulesets are human readable and could be adapted to own needs. The "checkit_tiff" works on commandline and therefore it is embedable in scripts The tools are developed for purposes of curation and longterm preservation In detail ========= checkit_tiff: - checks a TIFF against ruleset - needs a Linux or an AIX system with installed libtiff4 (crosscompiling to Windows should work, too) - compile it with: make clean; make all; make strip - help comes with option "checkit_tiff -h" License ======= the sourcecode is licensed under conditions of libtiff, see http://libtiff.maptools.org for details. HINTS ===== * The program could already used to check TIFF-files now * Remember, it is in alpha-state and needs additional rules to validate tiff files completely. * Please, if you find errors or do you have test files like ** https://github.com/EasyinnovaSL/DPFManager/tree/develop/src/test/resources/ ** or https://github.com/openpreserve/jhove/tree/junit_tests/examples/tiff/badfiles * please do not hesitate to contact me. * to *repair* TIFFs, you could give "fixit_tiff" a try: https://github.com/SLUB-digitalpreservation/fixit_tiff == Compile == see file 'README.compile' for details, in short: == Run == Use the builtin help via './checkit_tiff -h' Here an example output using $ ./checkit_tiff tiffs_should_fail/invalid_date.tiff example_configs/cit_tiff6_baseline_SLUB.cfg './checkit_tiff' version: master revision: 68 licensed under conditions of libtiff (see http://libtiff.maptools.org/misc.html) cfg_file=example_configs/cit_tiff6_baseline_SLUB.cfg tiff file=tiffs_should_fail/invalid_date.tiff TIFFFetchNormalTag: Warning, Incorrect value for "Photoshop"; tag ignored. check if all IFDs are word aligned check if only one IFD exists check if tags are in ascending order check if all offsets are used once only check if all offsets are word aligned check if tag 306 (DateTime) is correct tag 306 (DateTime) should have value should be "yyyy:MM:DD hh:mm:ss", but has value (values or count) of datetime was "04.03.2010 09:59:17" check if tag 256 (ImageWidth) has value in range 1 - 4294967295 check if tag 256 (ImageWidth) has valid type check if tag 257 (ImageLength) has value in range 1 - 4294967295 check if tag 257 (ImageLength) has valid type check if tag 258 (BitsPerSample) has these 3-values: 8, 8, 8 check if tag 258 (BitsPerSample) has valid type check if tag 259 (Compression) has value check if tag 259 (Compression) has valid type check if tag 262 (Photometric) has value in range 0 - 2 check if tag 262 (Photometric) has valid type check if tag 273 (StripOffsets) exists check if tag 273 (StripOffsets) has valid type check if tag 277 (SamplesPerPixel) has value check if tag 277 (SamplesPerPixel) has valid type check if tag 278 (RowsPerStrip) has value in range 1 - 4294967295 check if tag 278 (RowsPerStrip) has valid type check if tag 279 (StripByteCounts) has value in range 1 - 4294967295 check if tag 279 (StripByteCounts) has valid type check if tag 282 (XResolution) has value in range 300 - 1200 check if tag 282 (XResolution) has valid type check if tag 283 (YResolution) has value in range 300 - 1200 check if tag 283 (YResolution) has valid type check if tag 296 (ResolutionUnit) has value check if tag 296 (ResolutionUnit) has valid type check if tag 254 (SubFileType) has value check if tag 254 (SubFileType) has valid type check if tag 266 (FillOrder) has value check if tag 266 (FillOrder) has valid type check if tag 269 (DocumentName) has value matching regex '^[[:print:]]*$' check if tag 274 (Orientation) has value check if tag 274 (Orientation) has valid type check if tag 284 (PlanarConfig) has value check if tag 284 (PlanarConfig) has valid type check if tag 297 (PageNumber) has these 2-values: 0, 1 check if tag 297 (PageNumber) has valid type check if tag 305 (Software) has value matching regex '^[[:print:]]*$' check if tag 306 (DateTime) has value matching regex '^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9] tag 306 (DateTime) should have value ^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$, but has value (values or count) 04.03.2010 09:59:17 check if forbidden tags are still existing tag 315 (Artist) is_found, but is not whitelisted (or rule has no matched dependency) tag 34377 (Photoshop Image Ressources) is_found, but is not whitelisted (or rule has no matched dependency) found 4 errors checkit_tiff-0.2.3/README.TIFFrisks000066400000000000000000000066451304466507300166440ustar00rootroot00000000000000Some thoughts about risks in TIFF file format ============================================= == Introduction == TIFF in general is a very simple fileformat. It starts with a constant header entry, which indicates that the file is a TIFF and how it is encoded (byteorder). The header contains an offset entry which points to the first image file directory (IFD). Each IFD has a field which counts the number of associated tags, followed by an array of these tags and an offset entry to the next IFD or to zero, which means there is no further IFD. Each tag in the array is 12 Bytes long. The first 4 bytes indicate the tag itself, the next 2 bytes declare the value-type, followed by 2 bytes counting the values. The last 4 bytes are either an offset or hold the values themselves. == What makes a TIFF robust? == In the TIFF specification, there are some hints which help us to repair broken TIFFs. The first hint is that all offset-addresses must be even. The second importand rule is that the tags in an IFD must be sorted in an ascending order. At last, the TIFF spec defines different areas in the tag range. This is to guarantee that the important values are well defined. If we guarantee that a valid TIFF was stored, there is a good chance to detect and repair broken TIFFs using these three hints. == What are the caveats of TIFF? == As a proof of concept there is also a tool "checkit_tiff_risks" provided in this repository. Using this tool, users can analyze the layout of any baseline TIF file. The most risky memory ranges are the offsets. If a bitflip occurs there, the user must search the complete 4GB range. In practise, the TIF files are smaller, and so this size is the searchspace for offsets. The most risky offsets are the ones which are indirect offsets. This means the IFD0 offset and the StripOffset tag (code 273). Here an example of a possible complex StripOffset encoding: [ditaa] ---- +-------------+ | TIFF header |--\ +-------------+ | | /-----------/ Offset to IFD0 | v +-------------+ | IFD0 | |-------------| | ... | | StripOffset |--\ +-------------+ | | Offset to values /-----------/ of tag StripOffset | v +-------------+ | StripOffs. 0|----\ | StripOffs. 1|--\ | Offset to pixel-data +-------------+ | | of stripe 0 | | /-----------/ | | | v | +-------------+ | | pixel-data 1| | +-------------+ | | /-------------/ | v +-------------+ | pixel-data 1| +-------------+ ---- The problem in this example is that TIFF has no way to find out how many bytes are part of the pixel-data stream. The existing StripByteCounts tag only stores the expected pixel data length *after* decompression. This makes the StripOffset tag very fragile. If a bitflip changes the offset of the StripOffset tag, the whole pixel information might be lost. Also, if a bitflip occurs in the offset area that the StripOffset tag points to, the partial pixel data of the affected stripe is lost. If compression is used, the risk of losing the whole picture is even higher, because the compression methods do not use an end-symbol. Instead, the buffer sizes as stored in the StripByteCount tag are used. Therefore, a bit-error in the Compression tag, the StripOffset tag, the StripByteCount tag or in the memory-map where StripOffset points to, could destroy the picture information. checkit_tiff-0.2.3/README.TIFFspecification000066400000000000000000000013761304466507300203250ustar00rootroot00000000000000== EXIF IFD (and other private IFDs) == Because Adobe registers the private TIFF-tags, we know little about these tags in the wild. In the specification it would be suggested to use a special IFD if you need more than small amount of private TIFF tags. This affects also the tags used for EXIF data. Our interpretation is, if you have an IFD for private tags, they should only be referenced from this IFD and not from base IFD directly. == offsets on word boundary == The specification is very clear. Offsets should only point to odd adresses. We think this is important for longterm preservation, because it makes the TIFF format more robust and repairable if some bit flipping occurs. == tags in ascending order == see offset and word boundary, same reason checkit_tiff-0.2.3/README.compile000066400000000000000000000036261304466507300164640ustar00rootroot00000000000000# You need an installed cmake ######################################################## # compiling under linux ######################################################## mkdir build cd build cmake ../src/ -DCMAKE_C_FLAGS="-W -Wall -Wextra -ansi -pedantic -O2 -Wno-unused-function" make ######################################################## # alternatively for windows crosscompiling using mingw ######################################################## #mkdir build #cd build #cmake -DCMAKE_TOOLCHAIN_FILE=../src/toolchain-mingw32.cmake -DPCRE_LIBRARY=~/Downloads/pcre-8.37/.libs/libpcre.a -DPCRE_INCLUDE_DIR=~/Downloads/pcre-8.37/ ../src/ #make # ######################################################## # examples/options to set specific C-compiler or Flags ######################################################## # cmake ../src/ -DCMAKE_C_COMPILER=$(which gcc) # cmake ../src/ -DCMAKE_C_FLAGS="-O0 -p -g" # cmake ../src/ -DCMAKE_C_COMPILER=$(which clang-3.5) -DCMAKE_C_FLAGS="-Oz -pedantic" # ######################################################## # example SANITIZE options ######################################################## # # SANITIZE with clang++ # cmake ../src/ -DCMAKE_C_COMPILER=/usr/bin/clang-3.5 -DCMAKE_C_FLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" # make # ASAN_OPTIONS=detect_leaks=1 ./checkit_tiff ... # # SANITIZE with gcc # cmake ../src/ -DCMAKE_C_FLAGS="-Og -g -fsanitize=address -fno-omit-frame-pointer" # make # ASAN_OPTIONS=detect_leaks=1 ./checkit_tiff ... # # ######################################################## # example CLANG-TIDY ######################################################## # cmake ../src/ -DCMAKE_C_CLANG_TIDY:STRING="clang-tidy;-checks=-*,readability-*" -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DCMAKE_C_COMPILER=/usr/bin/clang-3.8 -DCMAKE_C_FLAGS="-O0 -g -fsanitize=address -fno-omit-frame-pointer" # make # run-clang-tidy-3.8.py -clang-tidy-binary /usr/bin/clang-tidy-3.8 # checkit_tiff-0.2.3/README.grammar000066400000000000000000000062601304466507300164570ustar00rootroot00000000000000About general function ====================== The checkit-tool validates TIFF-files against a set of rules (see below). The set of rules works as a whitelist. This means that TIFF tags that are used in the file but not explicitely checked by a specific rule (not considering if successful or not) are not allowed. In cases where a rule is executed only if a predicate is set, the tag is only allowed if the predicate check succeeded. Developers ========== to configure the grammar you could use the PEG-extension for gvim from https://github.com/gf3/peg.vim To visualize the grammar, checkout this tools: * http://bottlecaps.de/convert/ * http://bottlecaps.de/rr/ui The actual grammar is visualized in grammar.xhtml Users ===== To define your own config-file for checking TIFFs, please use this simplified syntax: * Each line is either a "modeline", an "include" line, a "tag" line, a comment or empty * TODO: a modeline uses "mode(MODE)", MODE could be: ** "baseline", if no modeline is defined, it defaults to "mode(baseline)", too ** "extended" * To include a configfile, use "include(FILENAME)", where FILENAME is a correct path * Comments starts with '# '. They are only allowed to start right at the beginning of a new line. * A tagline is built as "TAG; REQUIREMENTS; VALUES", where * a TAG is an increasing number similar to TIFF-Tag numbers (see TIFF specification) * REQUIREMENTS could be ** 'mandatory' - a tag must exist in TIFF ** 'optional' - a tag may exist in TIFF, if it does, it will be checked ** 'depends(REFERENCE)' - a tag must exist in TIFF if reference exists ** 'optdepends(REFERENCE)' - a tag may exists in TIFF if reference exists. If it exists it will be checked * The syntax for a REFERENCE is TAGREFERENCE.VALUEREFERENCE ** TAGREFERENCE points to a tag number which must be exist, ** VALUEREFERENCE can be one of: *** 'any' (which means any match) or *** a decimal value or *** 'range(START, END)', where START and END are decimal values *** 'any', which means any match *** 'only(VALUE)', where VALUE is a decimal value *** 'ntupel(VALUE, ..), decimal values as n-tupel enclosed in brackets *** 'regex("REGEX")', where REGEX is a Perl compatible regular expression (PCRE) with escaped '"' and '\', it only works with tags of type ascii ** only if REFERENCE exists in TIFF the REQUIREMENTS rule will be checked ** The REQUIREMENTS rule will only be checked if REFERENCE exists in the TIF file. * VALUES can be one of: ** 'range(START, END)', where START and END are decimal values ** 'logical_or( VALUELIST)', where VALUELIST are comma-separated decimale values or ntupels ** 'any', which means any match ** 'only(VALUE)', where VALUE is a decimal value ** 'ntupel(VALUE, ..), decimal values as n-tupel enclosed in brackets ** 'regex("REGEX")', where REGEX is a Perl compatible regular expression (PCRE) with escaped '"' and '\', it only works with tags of type ascii * each tagline or comment must be closed with a new line If multiple rules are defined per tag, they will be combined. For examples, please check the 'example_configs/' - directory. Values ====== At the moment, the parser only supports a limited type of values. To make handling easier, it uses only the value/offset part of an IFD entry. checkit_tiff-0.2.3/README.icc000066400000000000000000000003061304466507300155620ustar00rootroot00000000000000the ICC validation code is very alpha. Please also check the ICC Signature Registry at http://www.color.org/signatures2.xalter and inform me if you find a bug in checkit_tiff using git-repository checkit_tiff-0.2.3/README.regex000066400000000000000000000010251304466507300161350ustar00rootroot00000000000000= RegEx = the program uses the pcre-library for regular expressions in ascii mathcing rules (in config file). If you use a regex similar to "^[:print:]*$" it does not match on * all strings containing characters outside of printable ascii range (see 'man pcre2pattern' for details) * an empty string "" will not matched, because we defined PCRE_NOTEMPTY. An empty string is not a valid match, this behaviour is a design choice. * Unicode is not set, because TIFF specification is in general ASCII based (PCRE_UTF8 not set) checkit_tiff-0.2.3/TODO000066400000000000000000000004261304466507300146400ustar00rootroot00000000000000- add checks for XMP specification http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMP%20SDK%20Release%20cc-2014-12/XMPSpecificationPart1.pdf - add checks for IPTC specification http://www.iptc.org/download/download.php?fn=IIMV4.1.pdf - add more testfiles checkit_tiff-0.2.3/common/000077500000000000000000000000001304466507300154365ustar00rootroot00000000000000checkit_tiff-0.2.3/common/doxygen.conf000066400000000000000000002374531304466507300200000ustar00rootroot00000000000000# Doxyfile 1.8.4 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = checkit_tiff # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "validates baseline TIFFs" # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doc/ # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Latvian, Lithuanian, Norwegian, Macedonian, # Persian, Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, # Slovak, Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. Note that you specify absolute paths here, but also # relative paths, which will be relative from the directory where doxygen is # started. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 4 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, # and language is one of the parsers supported by doxygen: IDL, Java, # Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, # C++. For instance to make doxygen treat .inc files as Fortran files (default # is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note # that for custom extensions you also need to set FILE_PATTERNS otherwise the # files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by by putting a % sign in front of the word # or globally by setting AUTOLINK_SUPPORT to NO. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate # getter and setter methods for a property. Setting this option to YES (the # default) will make doxygen replace the get and set methods by a property in # the documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields or simple typedef fields will be shown # inline in the documentation of the scope in which they are defined (i.e. file, # namespace, or group documentation), provided this scope is documented. If set # to NO (the default), structs, classes, and unions are shown on a separate # page (for HTML and Man pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This # cache is used to resolve symbols given their name and scope. Since this can # be an expensive process and often the same symbol appear multiple times in # the code, doxygen keeps a cache of pre-resolved symbols. If the cache is too # small doxygen will become slower. If the cache is too large, memory is wasted. # The cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid # range is 0..9, the default is 0, corresponding to a cache size of 2^16 = 65536 # symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal # scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = NO # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = YES # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if section-label ... \endif # and \cond section-label ... \endcond blocks. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. Do not use # file names with spaces, bibtex cannot handle them. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = src/ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = *.c \ *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = * # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be ignored. # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = # If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that # is part of the input, its contents will be placed on the main page # (index.html). This can be useful if you have a project on for instance GitHub # and want reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If left blank doxygen will # generate a default style sheet. Note that it is recommended to use # HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this # tag will in the future become obsolete. HTML_STYLESHEET = # The HTML_EXTRA_STYLESHEET tag can be used to specify an additional # user-defined cascading style sheet that is included after the standard # style sheets created by doxygen. Using this option one can overrule # certain style aspects. This is preferred over using HTML_STYLESHEET # since it does not replace the standard style sheet and is therefor more # robust against future updates. Doxygen will copy the style sheet file to # the output directory. HTML_EXTRA_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely # identify the documentation publisher. This should be a reverse domain-name # style string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.doxygen.Project # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and # SVG. The default value is HTML-CSS, which is slower, but has the best # compatibility. MATHJAX_FORMAT = HTML-CSS # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript # pieces of code that will be used on startup of the MathJax code. MATHJAX_CODEFILE = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a web server instead of a web client using Javascript. # There are two flavours of web server based search depending on the # EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for # searching and an index file used by the script. When EXTERNAL_SEARCH is # enabled the indexing and searching needs to be provided by external tools. # See the manual for details. SERVER_BASED_SEARCH = NO # When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP # script for searching. Instead the search results are written to an XML file # which needs to be processed by an external indexer. Doxygen will invoke an # external search engine pointed to by the SEARCHENGINE_URL option to obtain # the search results. Doxygen ships with an example indexer (doxyindexer) and # search engine (doxysearch.cgi) which are based on the open source search # engine library Xapian. See the manual for configuration details. EXTERNAL_SEARCH = NO # The SEARCHENGINE_URL should point to a search engine hosted by a web server # which will returned the search results when EXTERNAL_SEARCH is enabled. # Doxygen ships with an example search engine (doxysearch) which is based on # the open source search engine library Xapian. See the manual for configuration # details. SEARCHENGINE_URL = # When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed # search data is written to a file for indexing by an external tool. With the # SEARCHDATA_FILE tag the name of this file can be specified. SEARCHDATA_FILE = searchdata.xml # When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the # EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is # useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple # projects and redirect the results back to the right project. EXTERNAL_SEARCH_ID = # The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen # projects other than the one defined by this configuration file, but that are # all added to the same external search index. Each project needs to have a # unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id # of to a relative location where the documentation can be found. # The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = YES # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4 will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # The LATEX_EXTRA_FILES tag can be used to specify one or more extra images # or other source files which should be copied to the LaTeX output directory. # Note that the files will be copied as-is; there are no commands or markers # available. LATEX_EXTRA_FILES = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options related to the DOCBOOK output #--------------------------------------------------------------------------- # If the GENERATE_DOCBOOK tag is set to YES Doxygen will generate DOCBOOK files # that can be used to generate PDF. GENERATE_DOCBOOK = NO # The DOCBOOK_OUTPUT tag is used to specify where the DOCBOOK pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be put in # front of it. If left blank docbook will be used as the default path. DOCBOOK_OUTPUT = docbook #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # If the EXTERNAL_PAGES tag is set to YES all external pages will be listed # in the related pages index. If set to NO, only the current project's # pages will be listed. EXTERNAL_PAGES = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = YES # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # manageable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES checkit_tiff-0.2.3/example_configs/000077500000000000000000000000001304466507300173115ustar00rootroot00000000000000checkit_tiff-0.2.3/example_configs/README.txt000066400000000000000000000020511304466507300210050ustar00rootroot00000000000000cit_tiff_baseline_minimal.cfg Defines rules for checking files against the Baseline TIFF 6 specification. cit_tiff6_baseline_SLUB.cfg Like "cit_tiff_baseline_minimal.cfg", but with the extensions as defined in http://www.slub-dresden.de/ueber-uns/slubarchiv/technische-standards-fuer-die-ablieferung-von-digitalen-dokumenten/handreichung-tiff/ cit_tiff6_baseline_SLUBrelaxed.cfg Like "cit_tiff6_baseline_SLUB.cfg", but with following tags allowed: 33723 83BB IPTC IPTC (International Press Telecommunications Council) metadata. 34377 8649 Photoshop Collection of Photoshop 'Image Resource Blocks'. cit_tiff6_legacy_SLUB.cfg Like "cit_tiff6_baseline_SLUB.cfg", but with optionally allowed tag 315 013B Artist Person who created the image. Some older TIFF files used this tag for storing Copyright information. ..., but only if it contains the exact string "Business Graphics Datentechnik GmbH". cit_tiff-a_whitepaper.cfg Defines rules for checking files against the TI-A's preliminary specification as in http://www.ti-a.org/TI-A%20Whitepaper.pdf checkit_tiff-0.2.3/example_configs/cit_tiff-a_whitepaper.cfg000066400000000000000000000212001304466507300242220ustar00rootroot00000000000000# This defines a sample config for baseline tiffs, based on Whitepaper of the # TI-A initiative (2016-05), see http://www.ti-a.org/TI-A%20Whitepaper.pdf # tag; required; values # # works as whitelist # * tag: any tag number in TIFF # * required: mandatory | optional | depends( $tag.$value ) | optdepends( $tag.$value ) # * values: range($start, $end) | logical_or( $a, …) | only($a) |any # Remember, because it works as whitelist for each required tag we need an # entry here ##### # Required Baseline Tags ##### # 256 0100 ImageWidth The number of columns in the image, i.e., the number of pixels per row. 256; mandatory; range(1, 4294967295) # 257 0101 ImageLength The number of rows of pixels in the image. 257; mandatory; range(1, 4294967295) # 258 0102 BitsPerSample Number of bits per component. ##########################258; mandatory; logical_or(8,16) # Bitonal is optional, grey & RGB is mandatory. If 262 AND 258 exist, then the values need to be in the specified range. 258; depends(262.2); ntupel(8,8,8) #258; depends(262.2); only(16,16,16) # needs to be fixed in parser 258; depends(258.any); logical_or(4, 8) # 259 0103 Compression Compression scheme used on the image data ### (1 means no compression) 259; mandatory; only(1) # 262 0106 PhotometricInterpretation The color space of the image data. ### 2 means RGB, 0 and 1 means bilevel or grayscale, 0 is unusual, 3 is Palette Color (FORBIDDEN), 4 is Transparency Mask (FORBIDDEN) 262; mandatory; range(1, 2) # 273 0111 StripOffsets For each strip, the byte offset of that strip. 273; mandatory; any # 277 0115 SamplesPerPixel The number of components per pixel. ### if RGB then 3 else 1 ### Even though Baseline TIFF allows for SamplesPerPixel>3, we do NOT allow this for long term archival. 277; depends(262.2); only(3) 277; depends(262.1); only(1) # 278 0116 RowsPerStrip The number of rows per strip. 278; mandatory; range(1, 4294967295) # 279 0117 StripByteCounts For each strip, the number of bytes in the strip after compression. 279; mandatory; range(1, 4294967295) # 282 011A XResolution The number of pixels per ResolutionUnit in the ImageWidth direction. 282; depends(296.any); range(300, 1200) # 283 011B YResolution The number of pixels per ResolutionUnit in the ImageLength direction. 283; depends(296.any); range(300, 1200) # 296 0128 ResolutionUnit The unit of measurement for XResolution and YResolution. 1 = No absolute unit of measurement. 2 = Inch. 3 = Centimeter. Default: 2 296; optional; any ##### # optional fields ##### # NO OTHER VALUES FROM THE RANGE (0 - 7) ARE ALLOWED. ONLY "0" IS SUITABLE FOR LONG TERM ARCHIVAL. # 254 00FE NewSubfileType A general indication of the kind of data contained in this subfile. These values are defined as bit flags because they are independent of each other. Default is 0. #254; optional; only(0) # DO NOT UNCOMMENT! THIS TAG IS DEPRECATED! USE NEW SUBFILE TYPE INSTEAD! # 255 00FF SubfileType A general indication of the kind of data contained in this subfile. This field is deprecated. The NewSubfileType field should be used instead. #255; optional; range(1, 3) # DO NOT UNCOMMENT! THRESHOLDING IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 263 0107 Threshholding For black and white TIFF files that represent shades of gray, the technique used to convert from gray to black and white pixels. Default is 1. #263; optional; range(1, 3) # DO NOT UNCOMMENT! CELL WIDTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 264 0108 CellWidth The width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. #264; depends(263.2); any # DO NOT UNCOMMENT! CELL LENGTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 265 0109 CellLength The length of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. This field should only be present if Threshholding = 2. #265; depends(263.2); any ### Support for FillOrder=2 is not required in a Baseline TIFF compliant reader. Default is 1. # 266 010A FillOrder The logical order of bits within a byte. #266; optional; only(1) # 270 010E ImageDescription A string that describes the subject of the image. #270; optional; regex("^[[:print:]]*$") # 271 010F Make The scanner manufacturer. #271; optional; regex("^[[:print:]]*$") # 272 0110 Model The scanner model name or number. #272; optional; regex("^[[:print:]]*$") # 274 0112 Orientation The orientation of the image with respect to the rows and columns. Default is 1, and only this value is Baseline TIFF conform. # 274; optional; range(1, 8) # THIS IS NOT BASELINE TIFF!!! DO NOT UNCOMMENT!!! #274; optional; only(1) # 280 0118 MinSampleValue The minimum component value used. Default is 0. #280; optional; any # 281 0119 MaxSampleValue The maximum component value used; only for statistical purposes. Default is 2**(BitsPerSample) - 1. #281; optional; any # 284 011C PlanarConfiguration How the components of each pixel are stored. 1 = Chunky format. 2 = Planar format and Baseline TIFF readers are not required to support it. Default: 1. #284; optional; only(1) # DO NOT UNCOMMENT! FREE OFFSETS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 288 0120 FreeOffsets For each string of contiguous unused bytes in a TIFF file, the byte offset of the string. Not recommended for general interchange. #288; optional; any # DO NOT UNCOMMENT! FREE BYTE COUNTS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 289 0121 FreeByteCounts For each string of contiguous unused bytes in a TIFF file, the number of bytes in the string. Not recommended for general interchange. #289; optional; any # 290 0122 GrayResponseUnit The precision of the information contained in the GrayResponseCurve. Default: 2; Recommended: 3 #290; optdepends(262.0); range(1, 5) #290; optdepends(262.1); range(1, 5) # 291 0123 GrayResponseCurve For grayscale data, the optical density of each possible pixel value. 291; optdepends(262.0); any 291; optdepends(262.1); any # 297 PageNumber actual page, and total pagecount, the actual page count starts with 0; Recommended: 0, 1 #297; optional; only(0,1) # 305 0131 Software Name and version number of the software package(s) used to create the image. #305; optional; regex("^[[:print:]]*$") # 306 0132 DateTime Date and time of image creation in the format "YYYY:MM:DD HH:MM:SS". 306; optional; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$") # DO NOT UNCOMMENT! ARTIST IS NOT SUITABLE FOR LONG TERM ARCHIVAL DUE TO PRIVACY CONCERNS! # 315 013B Artist Person who created the image. Some older TIFF files used this tag for storing Copyright information. #315; optional; any # DO NOT UNCOMMENT! HOST COMPUTER INFORMATION IS NOT SUITABLE AND IRRELEVANT FOR LONG TERM ARCHIVAL! # 316 013C HostComputer The computer and/or operating system in use at the time of image creation. #316; optional; any # DO NOT UNCOMMENT! COLOR MAP TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 320 0140 ColorMap This field defines a Red-Green-Blue color map (often called a lookup table) for palette color images. #320; optional; any # DO NOT UNCOMMENT! EXTRA SAMPLES TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL BECAUSE THEIR MEANING CANNOT BE DOCUMENTED! # 338 0152 ExtraSamples Description of extra components. #338; optional; range(0-2) # 700 02BC XMP XML packet containing XMP metadata. #700; optional; any # 33432 8298 Copyright Complete copyright notice of the person or organization that claims the copyright to the image. 33432; optional; regex("^[[:print:]]*$") # IPTC METADATA ARE NOT SUITABLE FOR LONG TERM ARCHIVAL, but could be ignored # 33723 83BB IPTC IPTC (International Press Telecommunications Council) metadata. 33723; optional; any # PHOTOSHOP METADATA ARE PROPRIETARY AND HENCE NOT SUITABLE FOR LONG TERM ARCHIVAL, but could be ignored # 34377 8649 Photoshop Collection of Photoshop 'Image Resource Blocks'. 34377; optional; any # 34665 8769 Exif IFD A pointer to the Exif IFD. Exif IFD is a set of tags for recording Exif-specific attribute information. It is pointed to by the offset from the TIFF header (Value Offset) indicated by an Exif private tag value. An Exif IFD has the same structure as that of the IFD specified in TIFF. Ordinarily, however, it does not contain image data as in the case of TIFF. 34665; optional; any # 34675 8773 ICC Profile ICC Profile data 34675; optional; any ##### # unanswered questions ##### # - Image File Directory (IFD) # => genau 1 IFD muss vorhanden sein # (einerseits min. 1. gefordert, andererseits muss ein Baseline-Tiff-Reader max. 1 lesen) # => Einträge müssen aufsteigend geordnet sein # - Bytes 0-1: Anzahl der IFD-Einträge # => muss mit der tatsächlichen Anzahl übereinstimmen # - 4 Bytes: Offset zum nächsten IFD (oder "0000" falls kein IFD mehr kommt) # => Eintrag muss "0000" sein checkit_tiff-0.2.3/example_configs/cit_tiff6_baseline_SLUB.cfg000066400000000000000000000241171304466507300243430ustar00rootroot00000000000000# tag; required; values # # works as whitelist # * tag: any tag number in TIFF # * required: mandatory | optional | depends( $tag.$value ) | optdepends( $tag.$value ) # * values: range($start, $end) | logical_or( $a, …) | only($a) |any # This defines a sample config for baseline tiffs # Remember, because it works as whitelist for each required tag we need an # entry here ##### # Required Baseline Tags ##### # 256 0100 ImageWidth The number of columns in the image, i.e., the number of pixels per row. 256; mandatory; range(1, 4294967295) # 257 0101 ImageLength The number of rows of pixels in the image. 257; mandatory; range(1, 4294967295) # 258 0102 BitsPerSample Number of bits per component. ##########################258; mandatory; logical_or(8,16) # Bitonal is optional, grey & RGB is mandatory. If 262 AND 258 exist, then the values need to be in the specified range. 258; depends(262.2); logical_or(ntupel(8,8,8), ntupel(16,16,16)) 258; optdepends(262.0); logical_or(1, 4, 8) 258; optdepends(262.1); logical_or(1, 4, 8) 258; depends(262.3); logical_or(4, 8) # 259 0103 Compression Compression scheme used on the image data ### (1 means no compression) 259; mandatory; only(1) # 262 0106 PhotometricInterpretation The color space of the image data. ### 2 means RGB, 0 and 1 means bilevel or grayscale, 0 is unusual, 3 is Palette Color (FORBIDDEN), 4 is Transparency Mask (FORBIDDEN) 262; mandatory; range(0, 2) # 273 0111 StripOffsets For each strip, the byte offset of that strip. 273; mandatory; any # 277 0115 SamplesPerPixel The number of components per pixel. ### if RGB then 3 else 1 ### Even though Baseline TIFF allows for SamplesPerPixel>3, we do NOT allow this for long term archival. 277; depends(262.2); only(3) 277; depends(262.1); only(1) 277; depends(262.0); only(1) # 278 0116 RowsPerStrip The number of rows per strip. 278; mandatory; range(1, 4294967295) # 279 0117 StripByteCounts For each strip, the number of bytes in the strip after compression. # Hint: Because value could be an array, only "any" is used 279; mandatory; any # 282 011A XResolution The number of pixels per ResolutionUnit in the ImageWidth direction. # 282; mandatory; range(300, 1200) # exception rule to allow lower resolutions if Image exceeds 6600x9000 pixels (55cm x 75cm) @ 300dpi 282; depends(256.range(6600, 4294967295)); range(200,300) 282; depends(256.range(1,6599)); range(300, 4000) # 283 011B YResolution The number of pixels per ResolutionUnit in the ImageLength direction. # 283; mandatory; range(300, 1200) # exception rule to allow lower resolutions if Image exceeds 6600x9000 pixels (55cm x 75cm) @ 300dpi 283; depends(257.range(9000, 4294967295)); range(200,300) 283; depends(257.range(1,8999)); range(300, 4000) # 296 0128 ResolutionUnit The unit of measurement for XResolution and YResolution. 1 = No absolute unit of measurement. 2 = Inch. 3 = Centimeter. Default: 2 296; mandatory; only(2) ##### # optional fields ##### # NO OTHER VALUES FROM THE RANGE (0 - 7) ARE ALLOWED. ONLY "0" IS SUITABLE FOR LONG TERM ARCHIVAL. # 254 00FE NewSubfileType A general indication of the kind of data contained in this subfile. These values are defined as bit flags because they are independent of each other. Default is 0. 254; optional; only(0) # DO NOT UNCOMMENT! THIS TAG IS DEPRECATED! USE NEW SUBFILE TYPE INSTEAD! # 255 00FF SubfileType A general indication of the kind of data contained in this subfile. This field is deprecated. The NewSubfileType field should be used instead. #255; optional; range(1, 3) # DO NOT UNCOMMENT! THRESHOLDING IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 263 0107 Threshholding For black and white TIFF files that represent shades of gray, the technique used to convert from gray to black and white pixels. Default is 1. #263; optional; range(1, 3) # DO NOT UNCOMMENT! CELL WIDTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 264 0108 CellWidth The width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. #264; depends(263.2); any # DO NOT UNCOMMENT! CELL LENGTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 265 0109 CellLength The length of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. This field should only be present if Threshholding = 2. #265; depends(263.2); any ### Support for FillOrder=2 is not required in a Baseline TIFF compliant reader. Default is 1. # 266 010A FillOrder The logical order of bits within a byte. 266; optional; only(1) # 269 010D Documentname 269; optional; regex("^[[:print:]]*$") # 270 010E ImageDescription A string that describes the subject of the image. 270; optional; regex("^[[:print:]]*$") # 271 010F Make The scanner manufacturer. 271; optional; regex("^[[:print:]]*$") # 272 0110 Model The scanner model name or number. 272; optional; regex("^[[:print:]]*$") # 274 0112 Orientation The orientation of the image with respect to the rows and columns. Default is 1, and only this value is Baseline TIFF conform. # 274; optional; range(1, 8) # THIS IS NOT BASELINE TIFF!!! DO NOT UNCOMMENT!!! 274; optional; only(1) # 280 0118 MinSampleValue The minimum component value used. Default is 0. 280; optional; any # 281 0119 MaxSampleValue The maximum component value used; only for statistical purposes. Default is 2**(BitsPerSample) - 1. 281; optional; any # 284 011C PlanarConfiguration How the components of each pixel are stored. 1 = Chunky format. 2 = Planar format and Baseline TIFF readers are not required to support it. Default: 1. 284; optional; only(1) # DO NOT UNCOMMENT! FREE OFFSETS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 288 0120 FreeOffsets For each string of contiguous unused bytes in a TIFF file, the byte offset of the string. Not recommended for general interchange. #288; optional; any # DO NOT UNCOMMENT! FREE BYTE COUNTS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 289 0121 FreeByteCounts For each string of contiguous unused bytes in a TIFF file, the number of bytes in the string. Not recommended for general interchange. #289; optional; any # 290 0122 GrayResponseUnit The precision of the information contained in the GrayResponseCurve. Default: 2; Recommended: 3 290; optdepends(262.0); range(1, 5) 290; optdepends(262.1); range(1, 5) # 291 0123 GrayResponseCurve For grayscale data, the optical density of each possible pixel value. 291; optdepends(262.0); any 291; optdepends(262.1); any # 297 PageNumber actual page, and total pagecount, the actual page count starts with 0; Recommended: 0, 1 297; optional; ntupel(0,1) # 305 0131 Software Name and version number of the software package(s) used to create the image. 305; optional; regex("^[[:print:]]*$") # 306 0132 DateTime Date and time of image creation in the format "YYYY:MM:DD HH:MM:SS". 306; optional; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$") # DO NOT UNCOMMENT! ARTIST IS NOT SUITABLE FOR LONG TERM ARCHIVAL DUE TO PRIVACY CONCERNS! # 315 013B Artist Person who created the image. Some older TIFF files used this tag for storing Copyright information. #315; optional; any # DO NOT UNCOMMENT! HOST COMPUTER INFORMATION IS NOT SUITABLE AND IRRELEVANT FOR LONG TERM ARCHIVAL! # 316 013C HostComputer The computer and/or operating system in use at the time of image creation. #316; optional; any # WhitePoint, if RGB, points to chromaticity of the white point of the image.This is the chromaticity # when each of the primaries has its ReferenceWhite value. The value is described using the 1931 CIE # xy chromaticity diagram and only the chromaticity is specified. This value can correspond to the # chromaticity of the alignment white of a monitor, the filter set and light source combination of a # scanner or the imaging model of a rendering package. The ordering is white[x], white[y]. # (Source: www.awaresystems.be) # example: CIE Standard Illuminant D65 used by CCIR Recommendation 709 and Kodak PhotoYCC is: # 3127/10000,3290/10000 318; optional; any # PrimaryChromaticities, This is the chromaticity for each of the primaries when it has its ReferenceWhite # value and the other primaries have their ReferenceBlack values. These values are described using the # 1931 CIE xy chromaticity diagram and only the chromaticities are specified. These values can correspond # to the chromaticities of the phosphors of a monitor, the filter set and light source combination of a # scanner or the imaging model of a rendering package. # (Source: www.awaresystems.be) # The ordering is red[x], red[y], green[x], green[y], blue[x], and blue[y]. # For example the CCIR Recommendation 709 primaries are: # 640/1000,330/1000, # 300/1000, 600/1000, # 150/1000, 60/1000 319; optional; any # DO NOT UNCOMMENT! COLOR MAP TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 320 0140 ColorMap This field defines a Red-Green-Blue color map (often called a lookup table) for palette color images. #320; optional; any # DO NOT UNCOMMENT! EXTRA SAMPLES TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL BECAUSE THEIR MEANING CANNOT BE DOCUMENTED! # 338 0152 ExtraSamples Description of extra components. #338; optional; range(0-2) # 700 02BC XMP XML packet containing XMP metadata. 700; optional; any # 33432 8298 Copyright Complete copyright notice of the person or organization that claims the copyright to the image. 33432; optional; regex("^[[:print:]]*$") # DO NOT UNCOMMENT! IPTC METADATA ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 33723 83BB IPTC IPTC (International Press Telecommunications Council) metadata. # http://www.iptc.org/download/download.php?fn=IIMV4.1.pdf #33723; optional; any # DO NOT UNCOMMENT! PHOTOSHOP METADATA ARE PROPRIETARY AND HENCE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 34377 8649 Photoshop Collection of Photoshop 'Image Resource Blocks'. #34377; optional; any # 34665 8769 Exif IFD A pointer to the Exif IFD. Exif IFD is a set of tags for recording Exif-specific attribute information. It is pointed to by the offset from the TIFF header (Value Offset) indicated by an Exif private tag value. An Exif IFD has the same structure as that of the IFD specified in TIFF. Ordinarily, however, it does not contain image data as in the case of TIFF. 34665; optional; any # 34675 8773 ICC Profile ICC Profile data 34675; optional; any checkit_tiff-0.2.3/example_configs/cit_tiff6_baseline_SLUBrelaxed.cfg000066400000000000000000000231441304466507300257070ustar00rootroot00000000000000# tag; required; values # # works as whitelist # * tag: any tag number in TIFF # * required: mandatory | optional | depends( $tag.$value ) | optdepends( $tag.$value ) # * values: range($start, $end) | logical_or( $a, …) | only($a) |any # This defines a sample config for baseline tiffs # Remember, because it works as whitelist for each required tag we need an # entry here ##### # Required Baseline Tags ##### # 256 0100 ImageWidth The number of columns in the image, i.e., the number of pixels per row. 256; mandatory; range(1, 4294967295) # 257 0101 ImageLength The number of rows of pixels in the image. 257; mandatory; range(1, 4294967295) # 258 0102 BitsPerSample Number of bits per component. ##########################258; mandatory; logical_or(8,16) # Bitonal is optional, grey & RGB is mandatory. If 262 AND 258 exist, then the values need to be in the specified range. 258; depends(262.2); ntupel(8,8,8) 258; optdepends(262.0); logical_or(1, 4, 8) 258; optdepends(262.1); logical_or(1, 4, 8) 258; depends(262.3); logical_or(4, 8) # 259 0103 Compression Compression scheme used on the image data ### (1 means no compression) 259; mandatory; only(1) # 262 0106 PhotometricInterpretation The color space of the image data. ### 2 means RGB, 0 and 1 means bilevel or grayscale, 0 is unusual, 3 is Palette Color (FORBIDDEN), 4 is Transparency Mask (FORBIDDEN) 262; mandatory; range(0, 2) # 273 0111 StripOffsets For each strip, the byte offset of that strip. 273; mandatory; any # 277 0115 SamplesPerPixel The number of components per pixel. ### if RGB then 3 else 1 ### Even though Baseline TIFF allows for SamplesPerPixel>3, we do NOT allow this for long term archival. 277; depends(262.2); only(3) 277; depends(262.1); only(1) 277; depends(262.0); only(1) # 278 0116 RowsPerStrip The number of rows per strip. 278; mandatory; range(1, 4294967295) # 279 0117 StripByteCounts For each strip, the number of bytes in the strip after compression. 279; mandatory; range(1, 4294967295) # 282 011A XResolution The number of pixels per ResolutionUnit in the ImageWidth direction. 282; mandatory; range(300, 1200) # 283 011B YResolution The number of pixels per ResolutionUnit in the ImageLength direction. 283; mandatory; range(300, 1200) # 296 0128 ResolutionUnit The unit of measurement for XResolution and YResolution. 1 = No absolute unit of measurement. 2 = Inch. 3 = Centimeter. Default: 2 296; mandatory; only(2) ##### # optional fields ##### # NO OTHER VALUES FROM THE RANGE (0 - 7) ARE ALLOWED. ONLY "0" IS SUITABLE FOR LONG TERM ARCHIVAL. # 254 00FE NewSubfileType A general indication of the kind of data contained in this subfile. These values are defined as bit flags because they are independent of each other. Default is 0. 254; optional; only(0) # DO NOT UNCOMMENT! THIS TAG IS DEPRECATED! USE NEW SUBFILE TYPE INSTEAD! # 255 00FF SubfileType A general indication of the kind of data contained in this subfile. This field is deprecated. The NewSubfileType field should be used instead. #255; optional; range(1, 3) # DO NOT UNCOMMENT! THRESHOLDING IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 263 0107 Threshholding For black and white TIFF files that represent shades of gray, the technique used to convert from gray to black and white pixels. Default is 1. #263; optional; range(1, 3) # DO NOT UNCOMMENT! CELL WIDTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 264 0108 CellWidth The width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. #264; depends(263.2); any # DO NOT UNCOMMENT! CELL LENGTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 265 0109 CellLength The length of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. This field should only be present if Threshholding = 2. #265; depends(263.2); any ### Support for FillOrder=2 is not required in a Baseline TIFF compliant reader. Default is 1. # 266 010A FillOrder The logical order of bits within a byte. 266; optional; only(1) # 269 010D Documentname 269; optional; regex("^[[:print:]]*$") # 270 010E ImageDescription A string that describes the subject of the image. 270; optional; regex("^[[:print:]]*$") # 271 010F Make The scanner manufacturer. 271; optional; regex("^[[:print:]]*$") # 272 0110 Model The scanner model name or number. 272; optional; regex("^[[:print:]]*$") # 274 0112 Orientation The orientation of the image with respect to the rows and columns. Default is 1, and only this value is Baseline TIFF conform. # 274; optional; range(1, 8) # THIS IS NOT BASELINE TIFF!!! DO NOT UNCOMMENT!!! 274; optional; only(1) # 280 0118 MinSampleValue The minimum component value used. Default is 0. 280; optional; any # 281 0119 MaxSampleValue The maximum component value used; only for statistical purposes. Default is 2**(BitsPerSample) - 1. 281; optional; any # 284 011C PlanarConfiguration How the components of each pixel are stored. 1 = Chunky format. 2 = Planar format and Baseline TIFF readers are not required to support it. Default: 1. 284; optional; only(1) # DO NOT UNCOMMENT! FREE OFFSETS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 288 0120 FreeOffsets For each string of contiguous unused bytes in a TIFF file, the byte offset of the string. Not recommended for general interchange. #288; optional; any # DO NOT UNCOMMENT! FREE BYTE COUNTS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 289 0121 FreeByteCounts For each string of contiguous unused bytes in a TIFF file, the number of bytes in the string. Not recommended for general interchange. #289; optional; any # 290 0122 GrayResponseUnit The precision of the information contained in the GrayResponseCurve. Default: 2; Recommended: 3 290; optdepends(262.0); range(1, 5) 290; optdepends(262.1); range(1, 5) # 291 0123 GrayResponseCurve For grayscale data, the optical density of each possible pixel value. 291; optdepends(262.0); any 291; optdepends(262.1); any # 297 PageNumber actual page, and total pagecount, the actual page count starts with 0; Recommended: 0, 1 297; optional; ntupel(0,1) # 305 0131 Software Name and version number of the software package(s) used to create the image. 305; optional; regex("^[[:print:]]*$") # 306 0132 DateTime Date and time of image creation in the format "YYYY:MM:DD HH:MM:SS". 306; optional; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$") # DO NOT UNCOMMENT! ARTIST IS NOT SUITABLE FOR LONG TERM ARCHIVAL DUE TO PRIVACY CONCERNS! # 315 013B Artist Person who created the image. Some older TIFF files used this tag for storing Copyright information. #315; optional; any # DO NOT UNCOMMENT! HOST COMPUTER INFORMATION IS NOT SUITABLE AND IRRELEVANT FOR LONG TERM ARCHIVAL! # 316 013C HostComputer The computer and/or operating system in use at the time of image creation. #316; optional; any # WhitePoint, if RGB, points to chromaticity of the white point of the image.This is the chromaticity # when each of the primaries has its ReferenceWhite value. The value is described using the 1931 CIE # xy chromaticity diagram and only the chromaticity is specified. This value can correspond to the # chromaticity of the alignment white of a monitor, the filter set and light source combination of a # scanner or the imaging model of a rendering package. The ordering is white[x], white[y]. # (Source: www.awaresystems.be) # example: CIE Standard Illuminant D65 used by CCIR Recommendation 709 and Kodak PhotoYCC is: # 3127/10000,3290/10000 318; optional; any # PrimaryChromaticities, This is the chromaticity for each of the primaries when it has its ReferenceWhite # value and the other primaries have their ReferenceBlack values. These values are described using the # 1931 CIE xy chromaticity diagram and only the chromaticities are specified. These values can correspond # to the chromaticities of the phosphors of a monitor, the filter set and light source combination of a # scanner or the imaging model of a rendering package. # (Source: www.awaresystems.be) # The ordering is red[x], red[y], green[x], green[y], blue[x], and blue[y]. # For example the CCIR Recommendation 709 primaries are: # 640/1000,330/1000, # 300/1000, 600/1000, # 150/1000, 60/1000 319; optional; any # DO NOT UNCOMMENT! COLOR MAP TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 320 0140 ColorMap This field defines a Red-Green-Blue color map (often called a lookup table) for palette color images. #320; optional; any # DO NOT UNCOMMENT! EXTRA SAMPLES TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL BECAUSE THEIR MEANING CANNOT BE DOCUMENTED! # 338 0152 ExtraSamples Description of extra components. #338; optional; range(0-2) # 700 02BC XMP XML packet containing XMP metadata. 700; optional; any # 33432 8298 Copyright Complete copyright notice of the person or organization that claims the copyright to the image. 33432; optional; regex("^[[:print:]]*$") # IPTC METADATA ARE NOT SUITABLE FOR LONG TERM ARCHIVAL, but could be ignored # 33723 83BB IPTC IPTC (International Press Telecommunications Council) metadata. # http://www.iptc.org/download/download.php?fn=IIMV4.1.pdf 33723; optional; any # PHOTOSHOP METADATA ARE PROPRIETARY AND HENCE NOT SUITABLE FOR LONG TERM ARCHIVAL, but could be ignored # 34377 8649 Photoshop Collection of Photoshop 'Image Resource Blocks'. 34377; optional; any # 34665 8769 Exif IFD A pointer to the Exif IFD. Exif IFD is a set of tags for recording Exif-specific attribute information. It is pointed to by the offset from the TIFF header (Value Offset) indicated by an Exif private tag value. An Exif IFD has the same structure as that of the IFD specified in TIFF. Ordinarily, however, it does not contain image data as in the case of TIFF. 34665; optional; any # 34675 8773 ICC Profile ICC Profile data 34675; optional; any checkit_tiff-0.2.3/example_configs/cit_tiff6_legacy_SLUB.cfg000066400000000000000000000232141304466507300240220ustar00rootroot00000000000000# tag; required; values # # works as whitelist # * tag: any tag number in TIFF # * required: mandatory | optional | depends( $tag.$value ) | optdepends( $tag.$value ) # * values: range($start, $end) | logical_or( $a, …) | only($a) |any # This defines a sample config for baseline tiffs # Remember, because it works as whitelist for each required tag we need an # entry here ##### # Required Baseline Tags ##### # 256 0100 ImageWidth The number of columns in the image, i.e., the number of pixels per row. 256; mandatory; range(1, 4294967295) # 257 0101 ImageLength The number of rows of pixels in the image. 257; mandatory; range(1, 4294967295) # 258 0102 BitsPerSample Number of bits per component. ##########################258; mandatory; logical_or(8,16) # Bitonal is optional, grey & RGB is mandatory. If 262 AND 258 exist, then the values need to be in the specified range. 258; depends(262.2); ntupel(8,8,8) 258; optdepends(262.0); logical_or(1, 4, 8) 258; optdepends(262.1); logical_or(1, 4, 8) 258; depends(262.3); logical_or(4, 8) # 259 0103 Compression Compression scheme used on the image data ### (1 means no compression) 259; mandatory; only(1) # 262 0106 PhotometricInterpretation The color space of the image data. ### 2 means RGB, 0 and 1 means bilevel or grayscale, 0 is unusual, 3 is Palette Color (FORBIDDEN), 4 is Transparency Mask (FORBIDDEN) 262; mandatory; range(0, 2) # 273 0111 StripOffsets For each strip, the byte offset of that strip. 273; mandatory; any # 277 0115 SamplesPerPixel The number of components per pixel. ### if RGB then 3 else 1 ### Even though Baseline TIFF allows for SamplesPerPixel>3, we do NOT allow this for long term archival. 277; depends(262.2); only(3) 277; depends(262.1); only(1) 277; depends(262.0); only(1) # 278 0116 RowsPerStrip The number of rows per strip. 278; mandatory; range(1, 4294967295) # 279 0117 StripByteCounts For each strip, the number of bytes in the strip after compression. 279; mandatory; range(1, 4294967295) # 282 011A XResolution The number of pixels per ResolutionUnit in the ImageWidth direction. 282; mandatory; range(300, 1200) # 283 011B YResolution The number of pixels per ResolutionUnit in the ImageLength direction. 283; mandatory; range(300, 1200) # 296 0128 ResolutionUnit The unit of measurement for XResolution and YResolution. 1 = No absolute unit of measurement. 2 = Inch. 3 = Centimeter. Default: 2 296; mandatory; only(2) ##### # optional fields ##### # NO OTHER VALUES FROM THE RANGE (0 - 7) ARE ALLOWED. ONLY "0" IS SUITABLE FOR LONG TERM ARCHIVAL. # 254 00FE NewSubfileType A general indication of the kind of data contained in this subfile. These values are defined as bit flags because they are independent of each other. Default is 0. 254; optional; only(0) # DO NOT UNCOMMENT! THIS TAG IS DEPRECATED! USE NEW SUBFILE TYPE INSTEAD! # 255 00FF SubfileType A general indication of the kind of data contained in this subfile. This field is deprecated. The NewSubfileType field should be used instead. #255; optional; range(1, 3) # DO NOT UNCOMMENT! THRESHOLDING IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 263 0107 Threshholding For black and white TIFF files that represent shades of gray, the technique used to convert from gray to black and white pixels. Default is 1. #263; optional; range(1, 3) # DO NOT UNCOMMENT! CELL WIDTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 264 0108 CellWidth The width of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. #264; depends(263.2); any # DO NOT UNCOMMENT! CELL LENGTH IS NOT SUITABLE FOR LONG TERM ARCHIVAL! # 265 0109 CellLength The length of the dithering or halftoning matrix used to create a dithered or halftoned bilevel file. This field should only be present if Threshholding = 2. #265; depends(263.2); any ### Support for FillOrder=2 is not required in a Baseline TIFF compliant reader. Default is 1. # 266 010A FillOrder The logical order of bits within a byte. 266; optional; only(1) # 269 010D Documentname 269; optional; regex("^[[:print:]]*$") # 270 010E ImageDescription A string that describes the subject of the image. 270; optional; regex("^[[:print:]]*$") # 271 010F Make The scanner manufacturer. 271; optional; regex("^[[:print:]]*$") # 272 0110 Model The scanner model name or number. 272; optional; regex("^[[:print:]]*$") # 274 0112 Orientation The orientation of the image with respect to the rows and columns. Default is 1, and only this value is Baseline TIFF conform. # 274; optional; range(1, 8) # THIS IS NOT BASELINE TIFF!!! DO NOT UNCOMMENT!!! 274; optional; only(1) # 280 0118 MinSampleValue The minimum component value used. Default is 0. 280; optional; any # 281 0119 MaxSampleValue The maximum component value used; only for statistical purposes. Default is 2**(BitsPerSample) - 1. 281; optional; any # 284 011C PlanarConfiguration How the components of each pixel are stored. 1 = Chunky format. 2 = Planar format and Baseline TIFF readers are not required to support it. Default: 1. 284; optional; only(1) # DO NOT UNCOMMENT! FREE OFFSETS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 288 0120 FreeOffsets For each string of contiguous unused bytes in a TIFF file, the byte offset of the string. Not recommended for general interchange. #288; optional; any # DO NOT UNCOMMENT! FREE BYTE COUNTS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 289 0121 FreeByteCounts For each string of contiguous unused bytes in a TIFF file, the number of bytes in the string. Not recommended for general interchange. #289; optional; any # 290 0122 GrayResponseUnit The precision of the information contained in the GrayResponseCurve. Default: 2; Recommended: 3 290; optdepends(262.0); range(1, 5) 290; optdepends(262.1); range(1, 5) # 291 0123 GrayResponseCurve For grayscale data, the optical density of each possible pixel value. 291; optdepends(262.0); any 291; optdepends(262.1); any # 297 PageNumber actual page, and total pagecount, the actual page count starts with 0; Recommended: 0, 1 297; optional; ntupel(0,1) # 305 0131 Software Name and version number of the software package(s) used to create the image. 305; optional; regex("^[[:print:]]*$") # 306 0132 DateTime Date and time of image creation in the format "YYYY:MM:DD HH:MM:SS". 306; optional; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$") # DO NOT UNCOMMENT! ARTIST IS NOT SUITABLE FOR LONG TERM ARCHIVAL DUE TO PRIVACY CONCERNS! # 315 013B Artist Person who created the image. Some older TIFF files used this tag for storing Copyright information. 315; optional; regex("Business Graphics Datentechnik GmbH") # DO NOT UNCOMMENT! HOST COMPUTER INFORMATION IS NOT SUITABLE AND IRRELEVANT FOR LONG TERM ARCHIVAL! # 316 013C HostComputer The computer and/or operating system in use at the time of image creation. #316; optional; any # WhitePoint, if RGB, points to chromaticity of the white point of the image.This is the chromaticity # when each of the primaries has its ReferenceWhite value. The value is described using the 1931 CIE # xy chromaticity diagram and only the chromaticity is specified. This value can correspond to the # chromaticity of the alignment white of a monitor, the filter set and light source combination of a # scanner or the imaging model of a rendering package. The ordering is white[x], white[y]. # (Source: www.awaresystems.be) # example: CIE Standard Illuminant D65 used by CCIR Recommendation 709 and Kodak PhotoYCC is: # 3127/10000,3290/10000 318; optional; any # PrimaryChromaticities, This is the chromaticity for each of the primaries when it has its ReferenceWhite # value and the other primaries have their ReferenceBlack values. These values are described using the # 1931 CIE xy chromaticity diagram and only the chromaticities are specified. These values can correspond # to the chromaticities of the phosphors of a monitor, the filter set and light source combination of a # scanner or the imaging model of a rendering package. # (Source: www.awaresystems.be) # The ordering is red[x], red[y], green[x], green[y], blue[x], and blue[y]. # For example the CCIR Recommendation 709 primaries are: # 640/1000,330/1000, # 300/1000, 600/1000, # 150/1000, 60/1000 319; optional; any # DO NOT UNCOMMENT! COLOR MAP TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL! # 320 0140 ColorMap This field defines a Red-Green-Blue color map (often called a lookup table) for palette color images. #320; optional; any # DO NOT UNCOMMENT! EXTRA SAMPLES TIFFS ARE NOT SUITABLE FOR LONG TERM ARCHIVAL BECAUSE THEIR MEANING CANNOT BE DOCUMENTED! # 338 0152 ExtraSamples Description of extra components. #338; optional; range(0-2) # 700 02BC XMP XML packet containing XMP metadata. 700; optional; any # 33432 8298 Copyright Complete copyright notice of the person or organization that claims the copyright to the image. 33432; optional; regex("^[[:print:]]*$") # IPTC METADATA ARE NOT SUITABLE FOR LONG TERM ARCHIVAL, but could be ignored # 33723 83BB IPTC IPTC (International Press Telecommunications Council) metadata. # http://www.iptc.org/download/download.php?fn=IIMV4.1.pdf 33723; optional; any # PHOTOSHOP METADATA ARE PROPRIETARY AND HENCE NOT SUITABLE FOR LONG TERM ARCHIVAL, but could be ignored # 34377 8649 Photoshop Collection of Photoshop 'Image Resource Blocks'. 34377; optional; any # 34665 8769 Exif IFD A pointer to the Exif IFD. Exif IFD is a set of tags for recording Exif-specific attribute information. It is pointed to by the offset from the TIFF header (Value Offset) indicated by an Exif private tag value. An Exif IFD has the same structure as that of the IFD specified in TIFF. Ordinarily, however, it does not contain image data as in the case of TIFF. 34665; optional; any # 34675 8773 ICC Profile ICC Profile data 34675; optional; any checkit_tiff-0.2.3/example_configs/cit_tiff_baseline_minimal.cfg000066400000000000000000000062151304466507300251350ustar00rootroot00000000000000# tag; required; values # # works as whitelist # * tag: any tag number in TIFF # * required: mandatory | optional | depends( $tag.$value ) # * values: range($start, $end) | logical_or( $a, …) | only($a) |any # This defines a sample config for baseline tiffs # Remember, because it works as whitelist for each required tag we need an # entry here # Required Baseline Tags # 254 00fe NewSubfileType A general indication of the kind of data contained in this subfile. ### could be part of baseline TIFF, but value could only be 0, because whether ### another image is contained (bit 0), nor is it a multipage TIFF (bit 2), nor ### it is a transparency mask (bit 3), because baseline does not allow multiple ### IFDs 254; optional; only(0) # 256 0100 ImageWidth The number of columns in the image, i.e., the number of pixels per row. 256; mandatory; any # 257 0101 ImageLength The number of rows of pixels in the image. 257; mandatory; any # 258 0102 BitsPerSample Number of bits per component. ### black/white ### grayscale 258; depends(262.0); logical_or(1,4,8) 258; depends(262.1); logical_or(1,4,8) ### colormap 258; depends(320.any); logical_or(4,8) ### RGB 258; depends(262.2); logical_or(ntupel(8,8,8),ntupel(16,16,16)) # 259 0103 Compression Compression scheme used on the image data ### (1 means no compression, 2 CCIT Group 3, 32773 PackBits) ### black/white (BitsPerSample is optional for b/w) 259; depends(262.0); logical_or(1,2,32773) 259; depends(262.1); logical_or(1,2,32773) ### grayscale (BitsPerSample must exist) 259; depends(258.4); logical_or(1,32773) 259; depends(258.8); logical_or(1,32773) ### colormap 259; depends(262.3); logical_or(1,32773) ### RGB 259; depends(262.2); logical_or(1,32773) # 262 0106 PhotometricInterpretation The color space of the image data. ### 2 means RGB, 0 and 1 means bilevel or grayscale, 0 is unusual, 3 colormap 262; mandatory; logical_or(0,1,2) # TODO: needs checks in code 262; depends(320.any); only(3) # 273 0111 StripOffsets For each strip, the byte offset of that strip. 273; mandatory; any # 274 0112 Orientation The orientation of the image with respect to the rows and columns 274; optional; only(1) # 277 0115 SamplesPerPixel The number of components per pixel. ### if RGB then 3 else 1 277; depends(262.2); only(3) 277; depends(262.3); only(1) 277; depends(262.1); only(1) 277; depends(262.0); only(1) # 278 0116 RowsPerStrip The number of rows per strip. 278; mandatory; any # 279 0117 StripByteCounts For each strip, the number of bytes in the strip after compression. 279; mandatory; any # 282 011A XResolution The number of pixels per ResolutionUnit in the ImageWidth direction. 282; mandatory; any # 283 011B YResolution The number of pixels per ResolutionUnit in the ImageLength direction. 283; mandatory; any # 284 011C PlanarConfiguration If 2 then Bitplanes used, if 1 chunks used, only for RGB relevant ### for baseline only value 1 allowed and only if SamplesPerPixel = 3 284; optdepends(277.3); only(1) # 296 0128 ResolutionUnit The unit of measurement for XResolution and YResolution. ### (2 means inch) 296; optional; logical_or(1,2,3) # 320 ColorMap, only for paletted 320; optional; any checkit_tiff-0.2.3/example_configs/cit_tiff_ep.cfg000066400000000000000000000133651304466507300222550ustar00rootroot00000000000000# This defines a sample config for baseline TIFFs with TIFF/EP extensions, # based on ISO 12234-2:2001 # HINT: because checkit_tiff is designed as a *baseline TIFF* validation tool, # some rules could not be defined to allow a fine granular validation of # TIFF/EP files! # tag; required; values # # works as whitelist # * tag: any tag number in TIFF # * required: mandatory | optional | depends( $tag.$value ) | optdepends( $tag.$value ) # * values: range($start, $end) | logical_or( $a, …) | only($a) |any # Remember, because it works as whitelist for each required tag we need an # entry here # 5.2.1 TIFF/EPStandard ID, should have 4 bytes: 1 0 0 0 37398; mandatory; only(1) # 5.2.2 ImageWidth (depends if Thumbnail or Main, on Thumbnail only 0..256 allowed 256; mandatory; any # 5.2.3 ImageLength (depends if Thumbnail or Main, on Thumbnail only 0..256 allowed 257; mandatory; any # 5.2.4 NewSubFileType, Bit 0 = 1 if thumbnail else 0 254; mandatory; any # 5.2.5 SubIFDs 330; mandatory; any # 5.2.6 XResolution 282; mandatory; any # 5.2.7 YResolution 283; mandatory; any # 5.2.8 ResolutionUnit 284; mandatory; range(1,3) # 5.2.9 FocalPlaneXResolution 37390; optional; any # 5.2.10 FocalPlaneYResolution 37391; optional; any # 5.2.11 FocalPlaneResolutionUnit 37392; optional; range(1,5) # 5.2.12 Orientation 274; optional; logical_or(1, 3, 6, 8, 9) # 5.2.13 Photometric Interpretation 262; mandatory; logical_or(1, 2, 6, 32803, range(32768, 65535)) # 5.2.14 Planar Configuration 284; mandatory; range(1,2) # 5.2.15 Interlace, optional tag indicates the field number of multifield images 34857; optional; range(0, 16383) # 5.2.16 Sensing Method, type of image sensor 37399; mandatory; range(0,8) # 5.2.17 CFARepeatPatternDim, mandatory if PhotometricInterpretation=32803, # optional if PhotometricInterpretation=2|6 && SensingMethod=2 33421; depends(262.32803); range(0,1) 33421; optdepends(37399.2); range(0,1) # 5.2.18 CFAPattern, mandatory if PhotometricInterpretation=32803, # optional if PhotometricInterpretation=2|6 && SensingMethod=2 33422; depends(262.32803); any 33422; optdepends(37399.2); any # 5.2.19 SamplesPerPixel 277; depends(262.range(32768,65535)); any 277; depends(262.1); only(1) 277; depends(262.32803); only(1) 277; depends(262.2); only(3) 277; depends(262.6); only(3) # 5.2.20 BitsPerSample 258; mandatory; range(0, 65535) # 5.2.21 StripOffsets, it is only mandatory if no Tiles used. 273; mandatory; any # 5.2.22 RowsPerStrip 278; depends(273.any); any # 5.2.23 StripByteCounts 279; depends(273.any); any # 5.2.24 TileWidth, it is only mandatory if no Strips used. #322; mandatory; any # 5.2.25 TileLength 323; depends(322.any); any # 5.2.26 TileOffsets 324; depends(322.any); any # 5.2.27 TileByteCounts 325; depends(322.any); any # 5.2.28 Compression 259; mandatory; logical_or(1, 7, range(32768,65535)) # 5.2.29 CompressedBitsPerPixel 37122; optional; any # 5.2.30 JPEGTables 347; optional; any # 5.2.31 YCbCrSubSampling (two values, both are 1,2 or 4) 347; depends(262.6); any # 5.2.32 YCbCrPositioning 531; depends(262.6); only(2) # 5.2.33 YCbCrCoefficents 529; depends(262.6); any # 5.2.34 ReferenceBlackWhite 532; depends(262.6); any # 5.2.35 Make 271; mandatory; any # 5.2.36 Model 272; mandatory; any # 5.2.37 Software 305; mandatory; any # 5.2.38 ImageNumber 37393; optional; any # 5.2.39 Image Description 270; mandatory; any # 5.2.40 Artist 315; optional; any # 5.2.41 Copyright 33432; mandatory; any # 5.2.42 ImageHistory 37395; optional; any # 5.2.43 IPTC/NAA 33723; optional; any # 5.2.44 SecurityClassification 37394; optional; any # 5.2.45 GPSInfo 34853; optional; any # 5.2.46 DateTimeOriginal, mandatory here as part of IFD0 (in opposite to EXIF # DateTimeOriginal which is referenced by EXIF IFD) 36867; mandatory; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$") # 5.2.47 DateTime, mandatory 306; mandatory; regex("^[12][901][0-9][0-9]:[01][0-9]:[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-6][0-9]$") # 5.2.48 TimeZoneOffset 34858; optional; any # 5.2.49 ExposureTime 33434; optional; any # 5.2.50 ShutterSpeedValue 37377; optional; any # 5.2.51 FNumber encodes lens f-number 33437; optional; any # 5.2.52 ApertureValue 37378; optional; any # 5.2.53 MaxApertureValue 37381; optional; any # 5.2.54 BrightnessValue 37379; optional; any # 5.2.55 ExposureBiasValue 37380; optional; any # 5.2.56 Exposure Program 34850; optional; logical_or(range(0, 8), range(32768,65535)) # 5.2.57 Metering Mode 37383; optional; logical_or(range(0,4), range(32768, 65535)) # 5.2.58 Flash, Bitflags encoded # 0b---- ---- ---- ---0 # 0b---- ---- ---- ---1 fire status # 0b---- ---- ---- -00- # 0b---- ---- ---- -10- # 0b---- ---- ---- -11- return sense (01 reserved) # 0b---- ---- ---0 0--- # 0b---- ---- ---0 1--- # 0b---- ---- ---1 0--- # 0b---- ---- ---1 1--- mode bits # 0b---- ---- --0- ---- # 0b---- ---- --1- ---- unit present # 0b0000 0000 00-- ---- reserved 37385; optional; logical_or(0,1,5,7,9,13,15,16,24,25,29,31,32) # 5.2.59 FlashEnergy 37387; optional; any # 5.2.60 FocalLength 37386; optional; any # 5.2.61 SubjectDistance 37382; optional; any # 5.2.62 SubjectLocation 37396; optional; any # 5.2.63 SelfTimerMode 34859; optional; range(0, 65535) # 5.2.64 BatteryLevel 33423; optional; any # 5.2.65 LightSource 37384; optional; any # 5.2.66 InterColourProfile (it is not defined as optional here, mandatory?) 34675; mandatory; any # 5.2.67 ExposureIndex 37397; optional; any # 5.2.68 ISOSpeedRatings 34855; optional; any # 5.2.69 OECF (optp-electorinc conversion function) 34856; optional; any # 5.2.70 SpectralSensitivity 34852; optional; any # 5.2.71 SpatialFrequencyResponse 37388; optional; any # 5.2.72 Noise (optional, because "The camera's 'noise' level may be recorded in the Noise tag-field" 37389; optional; any checkit_tiff-0.2.3/grammar.xhtml000066400000000000000000003575561304466507300166770ustar00rootroot00000000000000 start: Line EndOfFile no referencesLine: CommentLine SpaceLine ModeLine IncludeLine TagLine EndOfLine referenced by: start ModeLine: mode ( Mode ) referenced by: Line LogicalOr: logical_or ( LogicalOrList ) referenced by: Content LogicalOrListElement: any Range Only Number NTupel RegEx referenced by: LogicalOrList LogicalOrList: LogicalOrListElement Colon referenced by: LogicalOr Mode: baseline enhanced referenced by: ModeLine TagLine: Tag Semicolon Requirements Semicolon Content referenced by: Line Tag: Number referenced by: TagLine TagReference: Number referenced by: IfDepends OptDepends Semicolon: ; Space referenced by: TagLine Requirements: mandatory IfDepends OptDepends optional referenced by: TagLine IfDepends: depends ( TagReference Dot ValueReference ) referenced by: Requirements OptDepends: optdepends ( TagReference Dot ValueReference ) referenced by: Requirements Content: any Range LogicalOr Only NTupel RegEx referenced by: TagLine Range: range ( Number Colon Number ) referenced by: Content LogicalOrListElement ValueReference Colon: , Space referenced by: LogicalOrList Range ValueList Dot: . Space referenced by: IfDepends OptDepends ValueList: Value Colon referenced by: NTupel Value: Number referenced by: ValueList NTupel: ntupel ( ValueList ) referenced by: Content LogicalOrListElement ValueReference ValueReference: any Number RegEx Range NTupel Only referenced by: IfDepends OptDepends Only: only ( Number ) referenced by: Content LogicalOrListElement ValueReference RegEx: regex ( " PCRE " ) referenced by: Content LogicalOrListElement ValueReference SpaceLine: Space referenced by: Line EndOfFile: referenced by: start EscapedPCRE: \ \ " referenced by: PCRE CommentLine: # . - EndOfLine referenced by: Line IncludeLine: include ( [A-Z] [a-z] [0-9] _ . / [#x002D] ) referenced by: Line Number: 0x [0-9] [a-f] 2^ Digit referenced by: LogicalOrListElement Only Range Tag TagReference Value ValueReference Space: [#x0009] referenced by: Colon Dot Semicolon SpaceLine Digit: [0-9] referenced by: Number EndOfLine: [#x000D] [#x000A] referenced by: CommentLine Line MiscUntilEOL: [^#x000D#x000A] no referencesPCRE: EscapedPCRE [^"\] referenced by: RegEx   ... generated by Railroad Diagram Generator R R checkit_tiff-0.2.3/src/000077500000000000000000000000001304466507300147355ustar00rootroot00000000000000checkit_tiff-0.2.3/src/CMakeLists.txt000066400000000000000000000061531304466507300175020ustar00rootroot00000000000000cmake_minimum_required (VERSION 2.6) project (checkit_tiff) include_directories("${PROJECT_SOURCE_DIR}/headers") include_directories("${PROJECT_SOURCE_DIR}/validate_icc") include (CheckSymbolExists) include (CheckFunctionExists) file( GLOB checkit_tiff_SOURCES "${PROJECT_SOURCE_DIR}/tagrules/*.c" "${PROJECT_SOURCE_DIR}/ifdrules/*.c" "${PROJECT_SOURCE_DIR}/helper/*.c" "${PROJECT_SOURCE_DIR}/parser/*parser.c" "${PROJECT_SOURCE_DIR}/validate_icc/*.c" "${PROJECT_SOURCE_DIR}/risk_analyzer/*.c" ) file( GLOB checkit_tiff_risk_SOURCES "${PROJECT_SOURCE_DIR}/helper/*.c" "${PROJECT_SOURCE_DIR}/risk_analyzer/*.c" ) # # Make a version file containing the current version from git. # execute_process( COMMAND git rev-list HEAD --count OUTPUT_VARIABLE REPO_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( COMMAND git rev-parse --abbrev-ref HEAD OUTPUT_VARIABLE BUILD_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( COMMAND git rev-parse HEAD OUTPUT_VARIABLE BUILD_REV_ID OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( COMMAND git describe --long --tags --dirty --always OUTPUT_VARIABLE BUILD_REV_ID_SHORT OUTPUT_STRIP_TRAILING_WHITESPACE) add_definitions(-DVERSION="${BUILD_BRANCH}") add_definitions(-DREPO_REVISION="${REPO_REVISION}") add_definitions(-std=gnu11) if(WIN32) add_definitions(-D__WIN32__=1) SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") SET(BUILD_SHARED_LIBRARIES OFF) # needed to increase default stack, because Win7 has only 1MB SET(CMAKE_EXE_LINKER_FLAGS "-static -Wl,--stack,20000000") add_definitions(-DPCRE_STATIC) add_definitions(-D_POSIX_C_SOURCE=200809L) # FIXME: needed for MingW only add_definitions(-D_GNU_SOURCE=1) endif(WIN32) add_executable(checkit_tiff checkit_tiff.c ${checkit_tiff_SOURCES}) add_executable(checkit_check_config checkit_check_config.c ${checkit_tiff_SOURCES}) add_executable(checkit_tiff_risk checkit_tiff_risk.c ${checkit_tiff_risk_SOURCES}) set(CMAKE_EXTRA_INCLUDE_FILES tiff.h) #libpcre #find_package(LIBPCRE REQUIRED) FIND_PATH(PCRE_INCLUDE_DIR NAMES pcre.h) FIND_LIBRARY(PCRE_LIBRARY NAMES pcre) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) if (PCRE_FOUND) SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) SET(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) else(PCRE_FOUND) MESSAGE(FATAL_ERROR "No PCRE library found, add $PCRE_INCLUDE_DIR manually") endif(PCRE_FOUND) #find mmap CHECK_FUNCTION_EXISTS(mmap _HAVE_MMAP) CHECK_FUNCTION_EXISTS(munmap _HAVE_MUNMAP) IF(_HAVE_MMAP AND _HAVE_MUNMAP) MESSAGE(INFO "mmap found") SET(_HAVE__MMAP 1) ENDIF() TARGET_LINK_LIBRARIES(checkit_tiff ${PCRE_LIBRARIES}) TARGET_LINK_LIBRARIES(checkit_check_config ${PCRE_LIBRARIES}) TARGET_LINK_LIBRARIES(checkit_tiff_risk) install( TARGETS checkit_tiff RUNTIME DESTINATION bin LIBRARY DESTINATION lib ) install(DIRECTORY ../example_configs ../tiffs_should_fail ../tiffs_should_pass DESTINATION share/checkit_tiff/ ) file( GLOB README_FILES "../README*" "../FAQ" "../LICENSE" "../TODO" "../BUGS") install(FILES ${README_FILES} DESTINATION share/checkit_tiff/) checkit_tiff-0.2.3/src/Makefile000066400000000000000000000035711304466507300164030ustar00rootroot00000000000000# rule based checks if given TIFF is a specific baseline TIFF # author: Andreas Romeyke, 2015 # licensed under conditions of libtiff # (see http://libtiff.maptools.org/misc.html) ### needs libtiff (>= v4) ### libpcre (>=v3) LIB+=-lpcre -ltiff -lm SANITIZE?=-fsanitize=undefined -fsanitize=shift \ -fsanitize=integer-divide-by-zero -fsanitize=unreachable \ -fsanitize=vla-bound -fsanitize=null -fsanitize=return \ -fsanitize=signed-integer-overflow #-fsanitize=leak CFLAGS?= -g -Wall $(SANITIZE) GRAMMAR=parser/config_dsl.grammar.c SRCS=$(wildcard tagrules/*.c) $(wildcard ifdrules/*.c) $(wildcard helper/*.c) $(wildcard parser/*parser.c) OBJS=$(patsubst %.c,%.o, $(SRCS)) CFLAGS+=-I headers/ # default target all: checkit_tiff checkit_check_config # remove debugging symbols (smaller size) strip: all strip --strip-all checkit_tiff parser/config_parser.c: parser/config_dsl.grammar.c parser/config_dsl.grammar.c: parser/config_dsl.grammar.peg %.o: %.c $(CC) $(CFLAGS) $(INC) -c $< -o $@ # produce parser via PEG %.c: %.peg peg $< > $@ -include version.mk checkit_tiff.o: checkit_tiff.c $(CC) -DVERSION="\"$(BUILD_BRANCH)\"" -DREPO_REVISION="\"0.$(REPO_REVISION)\"" $(CFLAGS) $(INC) -c $< -o $@ # default executable checkit_tiff: $(OBJS) checkit_tiff.o $(CC) -o $@ $(CFLAGS) $(INC) $^ $(LIB) checkit_check_config: $(OBJS) checkit_check_config.o $(CC) -o $@ $(CFLAGS) $(INC) $^ $(LIB) checkit_check_config.c: $(GRAMMAR) # doc doc: ../common/doxygen.conf @doxygen ../common/doxygen.conf # clean workdir clean: @rm -f *.o $(OBJS) @rm -f checkit_tiff checkit_check_config # mrproper clean distclean: clean @find ./ -name "*~" -exec rm -f \{\} \; @rm -f core @rm -Rf doc/ @rm -f .depend @rm -f *.d @rm -f .depend #depend: .depend #.depend: $(SRCS) # rm -f ./.depend # echo $^ # $(CC) $(CFLAGS) -MM $^>>./.depend; #-include .depend .PHONY: all clean distclean strip depend checkit_tiff-0.2.3/src/checkit_check_config.c000066400000000000000000000013571304466507300212030ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "config_parser.h" /* *********** main ************* */ int main() { /* printf("((( print empty plan )))\n"); print_plan(); */ printf("((( parse config file )))\n"); parse_plan (); /* printf("((( print execution plan )))\n"); print_plan(); */ printf("((( execute execution plan )))\n"); // execute_plan(tif); printf("((( clean execution plan )))\n"); clean_plan(); /* printf("((( print empty plan)))\n"); print_plan(); */ return 0; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/checkit_tiff.c000066400000000000000000000156551304466507300175370ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015/2016 * licensed under conditions of libtiff * (see file LICENSE) * */ #include "config_parser.h" #include "check.h" #include "check_helper.h" #include #include #include #include #include #include #include #ifdef __unix__ #include #include #include #else /* #include */ #include #endif #define FLAGGED 1 #define UNFLAGGED 0 /** help function */ void help () { printf ("checkit_tiff\n"); printf ("\tversion: %s\n", VERSION); printf ("\trevision: %s\n", REPO_REVISION); printf("licensed under conditions of libtiff (see http://libtiff.maptools.org/misc.html)\n\n"); printf ("call it with:\n"); printf ("\tcheckit_tiff [-c|-h|-m|-d] \n"); printf ("\nwhere is the tiff file (or directory) to be validated\n"); printf ("and is the file name of the validation profile\n"); printf ("\t-h this help\n"); printf ("\t-c colorized output using ANSI escape sequences\n"); printf ("\t-m uses memmapped I/O (faster validation, but needs more RAM)\n"); printf ("\t-d check all files in that directory\n"); printf ("example:\n\tcheckit_tiff tiffs_should_pass/minimal_valid.tiff example_configs/baseline_minimal.cfg\n"); printf ("\n"); } void simplified_result_push(ret_t res, function_t func) { full_res_t full; full.tag = -1; full.function=func; full.lineno=-1; full.result=res; result_push( full ); } int check_specific_tiff_file( const char * tiff_file, int use_memmapped) { ret_t res = _empty_result(); res = tif_files(tiff_file); ctiff_t * ctif = initialize_ctif( tiff_file, use_memmapped?is_memmap:is_filep ); int is_valid = 0; /* special checks */ res = check_all_IFDs_are_word_aligned( ctif); if (0 != res.returncode) is_valid++; simplified_result_push(res, fc_all_IFDs_are_word_aligned); res = check_has_only_one_ifd( ctif); if (0 != res.returncode) is_valid++; simplified_result_push(res, fc_has_only_one_ifd); res = check_tagorder( ctif); if (0 != res.returncode) is_valid++; simplified_result_push(res, fc_tagorder); res = check_all_offsets_are_used_once_only( ctif ); if (0 != res.returncode) is_valid++; simplified_result_push(res, fc_all_offsets_are_used_once_only); res = check_all_offsets_are_word_aligned( ctif ); if (0 != res.returncode) is_valid++; simplified_result_push(res, fc_all_offsets_are_word_aligned); /* datetime */ res = check_tag_quiet( ctif, TIFFTAG_DATETIME); if (res.returncode == 0) { res = check_datetime( ctif ); if (0 != res.returncode) {is_valid++;} simplified_result_push(res, fc_datetime); } /* ICC */ res = check_tag_quiet( ctif, TIFFTAG_ICCPROFILE); if (res.returncode == 0) { res = check_icc( ctif ); if (0 != res.returncode) {is_valid++;} simplified_result_push(res, fc_icc); } execute_plan(ctif); is_valid = print_plan_results(); free_ctif( ctif ); return is_valid; } /** main */ int main (int argc, char * argv[]) { printf("'%s' version: %s\n", argv[0], VERSION); printf ("\trevision: %s\n", REPO_REVISION); printf("licensed under conditions of libtiff (see http://libtiff.maptools.org/misc.html)\n"); int c; int flag_check_directory=UNFLAGGED; int flag_use_memorymapped_io=UNFLAGGED; while ((c = getopt (argc, argv, "chmdx")) != -1) { switch (c) { case 'h': /* help */ help(); exit (0); case 'c': /* colorize output */ set_renderer_to_ansi(); break; case 'x': /* colorize output */ set_renderer_to_xml(); break; case 'd': /* check directory */ flag_check_directory = FLAGGED; printf("\nCheck all files in given directory\n"); break; case 'm': /* use memory mapped I/O */ flag_use_memorymapped_io=FLAGGED; break; case '?': /* something goes wrong */ /* if (optopt == 'r') { fprintf (stderr, "Option -%c requires an argument.\n", optopt); return (-1); } else*/ if (isprint (optopt)) { fprintf (stderr, "Unknown option `-%c'.\n", optopt); return (-1); } else if (0 !=optopt) { fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); return (-1); } break; default: abort(); } } if (argc - optind != 2) { help(); fprintf( stderr, "%s needs at least two arguments, first should be the tiff-filename, second the config-file, example:\n\t %s tiffs_should_pass/minimal_valid.tiff example_configs/baseline_minimal.cfg\n", argv[0], argv[0]); exit (EXIT_FAILURE); } const char *tiff_file_or_dir=argv[optind]; const char *cfg_file=argv[optind+1]; printf("cfg_file=%s\n", cfg_file); int is_valid = 0; if (flag_check_directory == FLAGGED) { /* iterate through all files */ size_t len = strlen( tiff_file_or_dir); char tiff_dir [ len ]; strncpy(tiff_dir, tiff_file_or_dir, len); tiff_dir[ len ] = 0; DIR *dir; struct dirent *ent; /* remove trailing / */ char *dirsuffix = strrchr(tiff_dir, '/'); if (dirsuffix != NULL) { /* found a / */ if ( 0 == strcmp( dirsuffix, "/" ) ) { /* ok, ends with / */ /* remove last / */ assert(len >= 1); // or whatever you want to do with short strings tiff_dir[len-1] = 0; } } /* iterate through all files in given dir */ if ((dir = opendir (tiff_file_or_dir)) != NULL) { /* print all the files and directories within directory */ while ((ent = readdir (dir)) != NULL) { struct stat attribute; len = strlen( tiff_dir ) + strlen( ent->d_name ) + 2; char fqname [ len ]; snprintf( fqname, len, "%s/%s", tiff_dir, ent->d_name); if (stat( fqname, &attribute) == -1) { fprintf (stderr, "could not stat on file '%s' in directory '%s' (%s)\n", ent->d_name, tiff_dir, fqname); exit(EXIT_FAILURE); } if(attribute.st_mode & S_IFREG) { printf ("%s\n", fqname); parse_plan_via_file(cfg_file); is_valid += check_specific_tiff_file( fqname, flag_use_memorymapped_io); clean_plan(); printf("\n"); } } closedir (dir); } else { /* could not open directory */ fprintf( stderr, "directory '%s' could not be opened\n", tiff_file_or_dir); exit(EXIT_FAILURE); } } else { /* use tiff_file_or_dir */ parse_plan_via_file(cfg_file); is_valid = check_specific_tiff_file( tiff_file_or_dir, flag_use_memorymapped_io); clean_plan(); } if (0 == is_valid) { exit(EXIT_SUCCESS); } else { exit(EXIT_FAILURE); } } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/checkit_tiff_risk.c000066400000000000000000000050641304466507300205600ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015/16 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include #ifdef __unix__ #include #include #include #else /* #include */ #include #endif #include #define FLAGGED 1 #define UNFLAGGED 0 /** help function */ void help () { printf ("checkit_tiff_risk\n"); printf("licensed under conditions of libtiff (see http://libtiff.maptools.org/misc.html)\n\n"); printf ("call it with:\n"); printf ("\tcheckit_tiff_risk [-m|-h|-s] \n"); printf ("\nwhere is the tiff file\n"); printf ("\t-h this help\n"); printf ("\t-m prints a memory map\n"); printf ("\t-s prints statistics\n"); printf ("example:\n\tcheckit_tiff -m tiffs_should_pass/minimal_valid.tiff\n"); printf ("\n"); } /* *********** main ************* */ int main(int argc, char * argv[]) { int c; int flag_print_map = UNFLAGGED; int flag_print_stats = UNFLAGGED; while ((c = getopt (argc, argv, "hms")) != -1) { switch (c) { case 'h': /* help */ help(); exit (0); case 'm': /* mem map */ flag_print_map = FLAGGED; break; case 's': /* stats */ flag_print_stats = FLAGGED; break; case '?': /* something goes wrong */ /* if (optopt == 'r') { fprintf (stderr, "Option -%c requires an argument.\n", optopt); return (-1); } else*/ if (isprint (optopt)) { fprintf (stderr, "Unknown option `-%c'.\n", optopt); return (-1); } else if (0 !=optopt) { fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); return (-1); } break; default: abort(); } } if (argc - optind != 1) { help(); fprintf( stderr, "%s needs at least one arguments, example:\n\t %s tiffs_should_pass/minimal_valid.tiff\n", argv[0], argv[0]); exit (EXIT_FAILURE); } const char *tiff_file=argv[optind]; tif_files(tiff_file); ctiff_t * ctif = initialize_ctif( tiff_file, is_filep ); mem_map_t * memmap_p = scan_mem_map(ctif); if (FLAGGED == flag_print_map) print_mem_map ( memmap_p ); if (FLAGGED == flag_print_stats) print_mem_stats( memmap_p ); return 0; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/headers/000077500000000000000000000000001304466507300163505ustar00rootroot00000000000000checkit_tiff-0.2.3/src/headers/check.h000066400000000000000000000157271304466507300176120ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see file LICENSE) * */ #ifndef _FIXIT_TIFF_CHECK #define _FIXIT_TIFF_CHECK #include #include "tiff.h" #include #include typedef int thandle_t; typedef uint16 tag_t; typedef enum{ is_memmap, is_filep } ct_ioflag_t ; /* flag */ typedef enum{ has_sorted_tags, has_unsorted_tags, unknown_tag_order } tagorder_t; typedef struct ctiff_s { ct_ioflag_t ioflag; tagorder_t tagorder; int tag_cache[65536]; void * streamp; /* TODO: adress of memory-mapped tif stream */ void * actual_streamp; uint32 streamlen; /* TODO: length of tif stream/file (in bytes) */ thandle_t fd; /* filedescriptor */ uint32 ifd0pos; /* offset in tif stream (in bytes) */ uint16 ifd0c; /* count of tags in first ifd */ char isbyteswapped; /* true if BigEndian */ char *filename; /* filename */ /* TODO: add file size */ } ctiff_t; typedef enum{ rm_default, rm_file, rm_rule, rm_tag, rm_value, rm_expected, rm_hard_error, rm_error, rm_warning, rm_precondition, rm_logicalor_error } rm_type_t; typedef struct retmsg_s { rm_type_t rm_type; char * rm_msg; } retmsg_t; typedef struct ret_s { int returncode; int count; retmsg_t * returnmsg; } ret_t; typedef struct ifd_entry_s { uint32 count; /* count of data */ TIFFDataType datatype; enum{ is_offset, is_value, is_error } value_or_offset; union { uint32 data32; uint16 data16[2]; uint8 data8[4]; uint32 data32offset; }; } ifd_entry_t; typedef struct offset_s { uint32 count; /* count of data */ TIFFDataType datatype; union { uint8 *data8p; uint16 *data16p; uint32 *data32p; char *datacharp; int8 *datas8p; int16 *datas16p; int32 *datas32p; float *datafloatp; double *datadoublep; uint64 *data64p; int64 *datas64p; }; } offset_t; typedef enum { mt_unused, /* memory areas, which are not referenced within TIFF file */ mt_constant, /* constant values, which are fix part of TIFF file */ mt_ifd, /* memory areas, which are parts of the IFD (but no value!) */ mt_offset_to_ifd0, mt_offset_to_ifd, /* offset to nex ifd */ mt_ifd_embedded_standardized_value, /* memory areas, with standardized values embedded in ifd */ mt_ifd_embedded_registered_value, /* memory areas, with registered values embedded in ifd */ mt_ifd_embedded_private_value, /* memory areas, with private values embedded in ifd */ mt_ifd_offset_to_standardized_value, /* memory areas, which points to standardized values */ mt_ifd_offset_to_registered_value, /* memory areas, which points to registered values */ mt_ifd_offset_to_private_value, /* memory areas, which points to private values */ mt_ifd_offset_to_stripoffsets, /* offsets which points to stripoffsets */ mt_stripoffset_value, /* offsets which points to stripoffset values, hint: if compression is used stripbytecounts holds only decompressed values! */ mt_standardized_value, /* memory areas, which contains standardized values */ mt_registered_value, /* memory areas, which contains registered values */ mt_private_value, /* memory areas, which contains private values */ mt_END_marker } memtype_t; static const char* memtype_string[] = { "unused/unknown", /* memory areas", which are not referenced within TIFF file */ "constant", /* constant values", which are fix part of TIFF file */ "ifd", /* memory areas", which are parts of the IFD (but no value!) */ "offset_to_ifd0", /* offset to nex ifd */ "offset_to_ifd", /* offset to nex ifd */ "ifd_embedded_standardized_value", /* memory areas", with standardized values embedded in ifd */ "ifd_embedded_registered_value", /* memory areas", with registered values embedded in ifd */ "ifd_embedded_private_value", /* memory areas", with private values embedded in ifd */ "ifd_offset_to_standardized_value", /* memory areas", which points to standardized values */ "ifd_offset_to_registered_value", /* memory areas", which points to registered values */ "ifd_offset_to_private_value", /* memory areas", which points to private values */ "ifd_offset_to_stripoffsets", /* offsets which points to stripoffsets */ "stripoffset_value", /* stripoffset values, hint: if compression is used stripbytecounts holds only decompressed values! */ "standardized_value", /* memory areas", which contains standardized values */ "registered_value", /* memory areas", which contains registered values */ "private_value", /* memory areas", which contains private values */ }; typedef struct mem_map_entry_s { uint32 offset; /* adress within the tiff */ uint32 count; /* count of bytes beginning with offset */ memtype_t mem_type; /* type of memory */ } mem_map_entry_t; typedef struct mem_map_s { int count; mem_map_entry_t * base_p; uint32 max_len; /* TIFF length */ int max_entries; } mem_map_t; #define MAXSTRLEN 1024 #define EXPECTSTRLEN 160 #define VALUESTRLEN 160 #define TIFFAILSTRLEN (EXPECTSTRLEN + VALUESTRLEN) #define MAXRESULT 200000 void tifp_check( ctiff_t * ctif); ret_t tif_returns(tag_t tag, const char* expected, const char* value); ret_t tif_fails_tag(tag_t tag, const char* expected, const char* value); ret_t tif_fails(const char* fail_message); ret_t tif_fails_by_returns( ret_t ret ); ret_t tif_rules_tag(tag_t tag, const char *msg); ret_t tif_rules(const char *msg); ret_t tif_files(const char *msg); ret_t tif_no_tag(tag_t tag); ret_t _empty_result(); const char * float2str(float v); const char* tag2str(tag_t tag); const char* int2str(int v); const char* frac2str(int d, int n); const char* range2str(int d, int n); off_t ct_seek(ctiff_t * ctif, off_t pos, int whence); ssize_t ct_read(ctiff_t * ctif, void *buf, size_t count); ret_t check_tag_has_some_of_these_values( ctiff_t * ctif, tag_t tag, int count, unsigned int * values); ret_t check_tag_has_valuelist( ctiff_t * ctif, tag_t tag, int count, unsigned int * values); ret_t check_tag_has_value_in_range(ctiff_t * ctif, tag_t tag, unsigned int a, unsigned int b); ret_t check_tag_has_value(ctiff_t * ctif, tag_t tag, unsigned int value); ret_t check_tag_has_value_quiet(ctiff_t * ctif, tag_t tag, unsigned int expected_value); ret_t check_tag(ctiff_t * ctif, tag_t tag); ret_t check_tag_quiet(ctiff_t * ctif, tag_t tag); ret_t check_notag(ctiff_t * ctif, tag_t tag); ret_t check_tag_has_valid_type(ctiff_t * ctif, tag_t tag); ret_t check_datetime(ctiff_t * ctif); ret_t check_icc(ctiff_t * ctif); ret_t check_has_only_one_ifd(ctiff_t * ctif); ret_t check_tagorder(ctiff_t * ctif); ret_t check_tag_has_valid_asciivalue(ctiff_t * ctif, tag_t tag); ret_t check_tag_has_value_matching_regex(ctiff_t * ctif, tag_t tag, const char* regex_string); ret_t check_all_offsets_are_word_aligned(ctiff_t * ctif); ret_t check_all_offsets_are_used_once_only(ctiff_t * ctif); ret_t check_all_IFDs_are_word_aligned(ctiff_t * ctif); mem_map_t * scan_mem_map(ctiff_t * ctif) ; void print_mem_map( mem_map_t * memmap_p); void print_mem_stats( mem_map_t * memmap_p); #endif /* _FIXIT_TIFF_CHECK */ checkit_tiff-0.2.3/src/headers/check_helper.h000066400000000000000000000040161304466507300211360ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #ifndef _FIXIT_TIFF_CHECK_HELPER #define _FIXIT_TIFF_CHECK_HELPER #include //#include //#include #define TIFF_ANY 0 void TIFFSwabShort(uint16 *a); void TIFFSwabLong(uint32 *a); typedef enum{ render_default, render_debug, render_ansi, render_xml} render_type; /* helper */ long long fsize(int fd); ret_t check_tag_has_fvalue(ctiff_t * ctif, tag_t tag, float value); ret_t check_tag_has_u16value(ctiff_t * ctif, tag_t tag, uint16 value); ret_t check_tag_has_u32value(ctiff_t * ctif, tag_t tag, uint32 value); const char * TIFFTypeName( uint16 tagtype ); const char * TIFFTagName (tag_t tag); uint32 TIFFGetRawTagTypeListEntry( ctiff_t * ctif, int tagidx ); tag_t TIFFGetRawTagListEntry( ctiff_t * ctif, int tagidx ) ; int TIFFGetRawTagListCount (ctiff_t * ctif, uint32 ifdpos) ; TIFFDataType TIFFGetRawTagType(ctiff_t * ctif, tag_t tag); ifd_entry_t TIFFGetRawIFDEntry( ctiff_t * ctif, tag_t tag); ifd_entry_t TIFFGetRawTagIFDListEntry( ctiff_t * ctif, int tagidx ); int TIFFGetRawTagListIndex(ctiff_t * ctif, tag_t tag); int TIFFGetFieldASCII(ctiff_t * ctif, tag_t tag, char** string_p); int TIFFGetFieldLONG(ctiff_t * ctif, tag_t tag, uint32 ** long_p); int TIFFGetFieldSHORT(ctiff_t * ctif, tag_t tag, uint16 ** short_p); int TIFFGetFieldRATIONAL(ctiff_t * ctif, tag_t tag, float ** float_p); offset_t read_offsetdata( ctiff_t * ctif, uint32 address, uint32 count, uint16 datatype); const char * renderer ( const ret_t ret ); void set_renderer_to_ansi(); void set_renderer_to_xml(); char * secstrcat (char * dest, const char * src, int maxsize); ctiff_t * initialize_ctif( const char * tiff_file, ct_ioflag_t ); void free_ctif( ctiff_t * ctif); uint32 get_ifd0_pos( ctiff_t * ctif ); uint32 get_next_ifd_pos( ctiff_t * ctif, uint32 actual_pos ); uint16 get_ifd0_count( ctiff_t * ctif ); char is_byteswapped( ctiff_t * ctif ); #endif checkit_tiff-0.2.3/src/headers/config_parser.h000066400000000000000000000056671304466507300213600ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #ifndef _FIXIT_TIFF_CONFIG_PARSER #define _FIXIT_TIFF_CONFIG_PARSER #include "check.h" typedef enum { mandatory, ifdepends, optdepends, optional } requirements_t; typedef enum { range, logical_or, any, only, regex, ntupel } values_t; typedef enum { no_ref, any_ref, only_ref, range_ref, ntupel_ref, regex_ref } reference_t; /* MINTAGS - MAXTAGS is range of possible existing TAG numbers */ #define MINTAGS 254 #define MAXTAGS 65536 #define MAXINCLUDEDEPTH 1 /* the stack size depends on count of rules and count of numbers, in general * 65536 should be enough. Otherwise you need to increase it */ #define MAXSTACKDEPTH 65536 typedef enum { fc_true, fc_false, fc_tag_has_some_of_these_values, fc_tag_has_valuelist, fc_tag_has_value_in_range, fc_tag_has_value, fc_tag_has_value_quiet, fc_tag, fc_tag_quiet, fc_notag, fc_tag_has_valid_type, fc_datetime, fc_icc, fc_has_only_one_ifd, fc_tagorder, fc_tag_has_valid_asciivalue, fc_tag_has_value_matching_regex, fc_all_offsets_are_word_aligned, fc_all_offsets_are_used_once_only, fc_all_IFDs_are_word_aligned, fc_internal_logic_combine, fc_dummy } function_t; #define INTERNALSTACKDEPTH 10 typedef struct internal_entry_s { int lineno; int is_precondition; tag_t tag; function_t function; values_t val_stack[INTERNALSTACKDEPTH]; const char * regex_stack[INTERNALSTACKDEPTH]; unsigned int i_stack[INTERNALSTACKDEPTH]; int i_stackp; int val_stackp; int regex_stackp; } internal_entry_t; typedef struct full_res_s { int lineno; tag_t tag; function_t function; ret_t result; } full_res_t; typedef struct parser_state_s { // TODO: Anzahl le-Werte für Tupel in Stack speichern int lineno; int valuelist; int lelist; tag_t tag; tag_t tagref; values_t val_stack[MAXSTACKDEPTH]; const char * regex_stack[MAXSTACKDEPTH]; requirements_t req; unsigned int i_stack[MAXSTACKDEPTH]; int i_stackp; int val_stackp; int regex_stackp; int called_tags[MAXTAGS]; FILE * stream; reference_t any_reference; const char * regex_string; int includedepth; full_res_t result_stack[MAXRESULT]; int result_stackp; int exe_stackp; internal_entry_t exe_stack[MAXSTACKDEPTH]; } parser_state_t; void _helper_push_result(full_res_t res); full_res_t _helper_pop_result(); void _helper_mark_top_n_results(int n, rm_type_t type); full_res_t _helper_get_nth(int n); void set_parse_error(char * msg, char * yytext); void execute_plan (ctiff_t * ctif); void print_plan (); int print_plan_results (); void clean_plan (); void parse_plan (); void parse_plan_via_stream (FILE * file); void parse_plan_via_file (const char * cfg_file); void add_default_rules_to_plan(); void set_include( const char * ); void result_push(full_res_t); #endif /* _FIXIT_TIFF_CONFIG_PARSER */ checkit_tiff-0.2.3/src/headers/tiff.h000066400000000000000000001057101304466507300174550ustar00rootroot00000000000000/* $Id: tiff.h,v 1.68 2012-08-19 16:56:35 bfriesen Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler * Copyright (c) 1991-1997 Silicon Graphics, Inc. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ #ifndef _TIFF_ #define _TIFF_ #include "tiffconf.h" /* * Tag Image File Format (TIFF) * * Based on Rev 6.0 from: * Developer's Desk * Aldus Corporation * 411 First Ave. South * Suite 200 * Seattle, WA 98104 * 206-622-5500 * * (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf) * * For BigTIFF design notes see the following links * http://www.remotesensing.org/libtiff/bigtiffdesign.html * http://www.awaresystems.be/imaging/tiff/bigtiff.html */ #define TIFF_VERSION_CLASSIC 42 #define TIFF_VERSION_BIG 43 #define TIFF_BIGENDIAN 0x4d4d #define TIFF_LITTLEENDIAN 0x4949 #define MDI_LITTLEENDIAN 0x5045 #define MDI_BIGENDIAN 0x4550 /* * Intrinsic data types required by the file format: * * 8-bit quantities int8/uint8 * 16-bit quantities int16/uint16 * 32-bit quantities int32/uint32 * 64-bit quantities int64/uint64 * strings unsigned char* */ typedef TIFF_INT8_T int8; typedef TIFF_UINT8_T uint8; typedef TIFF_INT16_T int16; typedef TIFF_UINT16_T uint16; typedef TIFF_INT32_T int32; typedef TIFF_UINT32_T uint32; typedef TIFF_INT64_T int64; typedef TIFF_UINT64_T uint64; /* * Some types as promoted in a variable argument list * We use uint16_vap rather then directly using int, because this way * we document the type we actually want to pass through, conceptually, * rather then confusing the issue by merely stating the type it gets * promoted to */ typedef int uint16_vap; /* * TIFF header. */ typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ uint16 tiff_version; /* TIFF version number */ } TIFFHeaderCommon; typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ uint16 tiff_version; /* TIFF version number */ uint32 tiff_diroff; /* byte offset to first directory */ } TIFFHeaderClassic; typedef struct { uint16 tiff_magic; /* magic number (defines byte order) */ uint16 tiff_version; /* TIFF version number */ uint16 tiff_offsetsize; /* size of offsets, should be 8 */ uint16 tiff_unused; /* unused word, should be 0 */ uint64 tiff_diroff; /* byte offset to first directory */ } TIFFHeaderBig; /* * NB: In the comments below, * - items marked with a + are obsoleted by revision 5.0, * - items marked with a ! are introduced in revision 6.0. * - items marked with a % are introduced post revision 6.0. * - items marked with a $ are obsoleted by revision 6.0. * - items marked with a & are introduced by Adobe DNG specification. */ /* * Tag data type information. * * Note: RATIONALs are the ratio of two 32-bit integer values. */ typedef enum { TIFF_NOTYPE = 0, /* placeholder */ TIFF_BYTE = 1, /* 8-bit unsigned integer */ TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */ TIFF_SHORT = 3, /* 16-bit unsigned integer */ TIFF_LONG = 4, /* 32-bit unsigned integer */ TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */ TIFF_SBYTE = 6, /* !8-bit signed integer */ TIFF_UNDEFINED = 7, /* !8-bit untyped data */ TIFF_SSHORT = 8, /* !16-bit signed integer */ TIFF_SLONG = 9, /* !32-bit signed integer */ TIFF_SRATIONAL = 10, /* !64-bit signed fraction */ TIFF_FLOAT = 11, /* !32-bit IEEE floating point */ TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */ TIFF_IFD = 13, /* %32-bit unsigned integer (offset) */ TIFF_LONG8 = 16, /* BigTIFF 64-bit unsigned integer */ TIFF_SLONG8 = 17, /* BigTIFF 64-bit signed integer */ TIFF_IFD8 = 18 /* BigTIFF 64-bit unsigned integer (offset) */ } TIFFDataType; /* * TIFF Tag Definitions. */ #define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */ #define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */ #define FILETYPE_PAGE 0x2 /* one page of many */ #define FILETYPE_MASK 0x4 /* transparency mask */ #define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */ #define OFILETYPE_IMAGE 1 /* full resolution image data */ #define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */ #define OFILETYPE_PAGE 3 /* one page of many */ #define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */ #define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */ #define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */ #define TIFFTAG_COMPRESSION 259 /* data compression technique */ #define COMPRESSION_NONE 1 /* dump mode */ #define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */ #define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */ #define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */ #define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */ #define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */ #define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */ #define COMPRESSION_OJPEG 6 /* !6.0 JPEG */ #define COMPRESSION_JPEG 7 /* %JPEG DCT compression */ #define COMPRESSION_T85 9 /* !TIFF/FX T.85 JBIG compression */ #define COMPRESSION_T43 10 /* !TIFF/FX T.43 colour by layered JBIG compression */ #define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */ #define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */ #define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */ #define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */ /* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT */ #define COMPRESSION_DCS 32947 /* Kodak DCS encoding */ #define COMPRESSION_JBIG 34661 /* ISO JBIG */ #define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */ #define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */ #define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */ #define COMPRESSION_LZMA 34925 /* LZMA2 */ #define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */ #define PHOTOMETRIC_MINISWHITE 0 /* min value is white */ #define PHOTOMETRIC_MINISBLACK 1 /* min value is black */ #define PHOTOMETRIC_RGB 2 /* RGB color model */ #define PHOTOMETRIC_PALETTE 3 /* color map indexed */ #define PHOTOMETRIC_MASK 4 /* $holdout mask */ #define PHOTOMETRIC_SEPARATED 5 /* !color separations */ #define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */ #define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */ #define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */ #define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */ #define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */ #define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */ #define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */ #define THRESHHOLD_BILEVEL 1 /* b&w art scan */ #define THRESHHOLD_HALFTONE 2 /* or dithered scan */ #define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */ #define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */ #define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */ #define TIFFTAG_FILLORDER 266 /* data order within a byte */ #define FILLORDER_MSB2LSB 1 /* most significant -> least */ #define FILLORDER_LSB2MSB 2 /* least significant -> most */ #define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */ #define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */ #define TIFFTAG_MAKE 271 /* scanner manufacturer name */ #define TIFFTAG_MODEL 272 /* scanner model name/number */ #define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */ #define TIFFTAG_ORIENTATION 274 /* +image orientation */ #define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */ #define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */ #define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */ #define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */ #define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */ #define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */ #define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */ #define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */ #define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */ #define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */ #define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */ #define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */ #define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */ #define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */ #define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */ #define TIFFTAG_PLANARCONFIG 284 /* storage organization */ #define PLANARCONFIG_CONTIG 1 /* single image plane */ #define PLANARCONFIG_SEPARATE 2 /* separate planes of data */ #define TIFFTAG_PAGENAME 285 /* page name image is from */ #define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */ #define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */ #define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */ #define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */ #define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */ #define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */ #define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */ #define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */ #define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */ #define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */ #define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */ #define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */ #define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */ #define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */ #define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */ #define RESUNIT_NONE 1 /* no meaningful units */ #define RESUNIT_INCH 2 /* english */ #define RESUNIT_CENTIMETER 3 /* metric */ #define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */ #define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */ #define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */ #define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */ #define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */ #define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */ #define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */ #define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */ #define TIFFTAG_SOFTWARE 305 /* name & release */ #define TIFFTAG_DATETIME 306 /* creation date and time */ #define TIFFTAG_ARTIST 315 /* creator of image */ #define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */ #define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */ #define PREDICTOR_NONE 1 /* no prediction scheme used */ #define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */ #define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */ #define TIFFTAG_WHITEPOINT 318 /* image white point */ #define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */ #define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */ #define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */ #define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */ #define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */ #define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */ #define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */ #define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */ #define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */ #define CLEANFAXDATA_CLEAN 0 /* no errors detected */ #define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */ #define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */ #define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */ #define TIFFTAG_SUBIFD 330 /* subimage descriptors */ #define TIFFTAG_INKSET 332 /* !inks in separated image */ #define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */ #define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */ #define TIFFTAG_INKNAMES 333 /* !ascii names of inks */ #define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */ #define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */ #define TIFFTAG_TARGETPRINTER 337 /* !separation target */ #define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */ #define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */ #define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */ #define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */ #define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */ #define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */ #define SAMPLEFORMAT_INT 2 /* !signed integer data */ #define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */ #define SAMPLEFORMAT_VOID 4 /* !untyped data */ #define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */ #define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */ #define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */ #define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */ #define TIFFTAG_CLIPPATH 343 /* %ClipPath [Adobe TIFF technote 2] */ #define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits [Adobe TIFF technote 2] */ #define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits [Adobe TIFF technote 2] */ #define TIFFTAG_INDEXED 346 /* %Indexed [Adobe TIFF Technote 3] */ #define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */ #define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */ /* Tags 400-435 are from the TIFF/FX spec */ #define TIFFTAG_GLOBALPARAMETERSIFD 400 /* ! */ #define TIFFTAG_PROFILETYPE 401 /* ! */ #define PROFILETYPE_UNSPECIFIED 0 /* ! */ #define PROFILETYPE_G3_FAX 1 /* ! */ #define TIFFTAG_FAXPROFILE 402 /* ! */ #define FAXPROFILE_S 1 /* !TIFF/FX FAX profile S */ #define FAXPROFILE_F 2 /* !TIFF/FX FAX profile F */ #define FAXPROFILE_J 3 /* !TIFF/FX FAX profile J */ #define FAXPROFILE_C 4 /* !TIFF/FX FAX profile C */ #define FAXPROFILE_L 5 /* !TIFF/FX FAX profile L */ #define FAXPROFILE_M 6 /* !TIFF/FX FAX profile LM */ #define TIFFTAG_CODINGMETHODS 403 /* !TIFF/FX coding methods */ #define CODINGMETHODS_T4_1D (1 << 1) /* !T.4 1D */ #define CODINGMETHODS_T4_2D (1 << 2) /* !T.4 2D */ #define CODINGMETHODS_T6 (1 << 3) /* !T.6 */ #define CODINGMETHODS_T85 (1 << 4) /* !T.85 JBIG */ #define CODINGMETHODS_T42 (1 << 5) /* !T.42 JPEG */ #define CODINGMETHODS_T43 (1 << 6) /* !T.43 colour by layered JBIG */ #define TIFFTAG_VERSIONYEAR 404 /* !TIFF/FX version year */ #define TIFFTAG_MODENUMBER 405 /* !TIFF/FX mode number */ #define TIFFTAG_DECODE 433 /* !TIFF/FX decode */ #define TIFFTAG_IMAGEBASECOLOR 434 /* !TIFF/FX image base colour */ #define TIFFTAG_T82OPTIONS 435 /* !TIFF/FX T.82 options */ /* * Tags 512-521 are obsoleted by Technical Note #2 which specifies a * revised JPEG-in-TIFF scheme. */ #define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */ #define JPEGPROC_BASELINE 1 /* !baseline sequential */ #define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */ #define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */ #define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */ #define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */ #define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */ #define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */ #define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */ #define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */ #define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */ #define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */ #define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */ #define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */ #define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */ #define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */ #define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */ #define TIFFTAG_STRIPROWCOUNTS 559 /* !TIFF/FX strip row counts */ #define TIFFTAG_XMLPACKET 700 /* %XML packet [Adobe XMP Specification, January 2004 */ #define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID [Adobe TIFF technote] */ /* tags 32952-32956 are private tags registered to Island Graphics */ #define TIFFTAG_REFPTS 32953 /* image reference points */ #define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */ #define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */ #define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */ /* tags 32995-32999 are private tags registered to SGI */ #define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */ #define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */ #define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */ #define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */ /* tags 33300-33309 are private tags registered to Pixar */ /* * TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH * are set when an image has been cropped out of a larger image. * They reflect the size of the original uncropped image. * The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used * to determine the position of the smaller image in the larger one. */ #define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */ #define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */ /* Tags 33302-33306 are used to identify special image modes and data * used by Pixar's texture formats. */ #define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */ #define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */ #define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */ #define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305 #define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306 /* tag 33405 is a private tag registered to Eastman Kodak */ #define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */ /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */ #define TIFFTAG_COPYRIGHT 33432 /* copyright string */ /* IPTC TAG from RichTIFF specifications */ #define TIFFTAG_RICHTIFFIPTC 33723 /* 34016-34029 are reserved for ANSI IT8 TIFF/IT */ #define TIFFTAG_STONITS 37439 /* Sample value to Nits */ /* tag 34929 is a private tag registered to FedEx */ #define TIFFTAG_FEDEX_EDR 34929 /* unknown use */ #define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */ /* Adobe Digital Negative (DNG) format tags */ #define TIFFTAG_DNGVERSION 50706 /* &DNG version number */ #define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */ #define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */ #define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model name */ #define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space mapping */ #define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */ #define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */ #define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for the BlackLevel tag */ #define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */ #define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level differences (columns) */ #define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level differences (rows) */ #define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding level */ #define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */ #define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image area */ #define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image area */ #define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space transformation matrix 1 */ #define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space transformation matrix 2 */ #define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */ #define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */ #define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction matrix 1 */ #define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction matrix 2 */ #define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw values*/ #define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in linear reference space */ #define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in x-y chromaticity coordinates */ #define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero point */ #define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */ #define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of sharpening */ #define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of the green pixels in the blue/green rows track the values of the green pixels in the red/green rows */ #define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */ #define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */ #define TIFFTAG_LENSINFO 50736 /* info about the lens */ #define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */ #define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the camera's anti-alias filter */ #define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */ #define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */ #define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote tag is safe to preserve along with the rest of the EXIF data */ #define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */ #define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */ #define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */ #define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for the raw image data */ #define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original raw file */ #define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original raw file */ #define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels of the sensor */ #define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates of fully masked pixels */ #define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */ #define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space into ICC profile space */ #define TIFFTAG_CURRENTICCPROFILE 50833 /* & */ #define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */ /* tag 65535 is an undefined tag used by Eastman Kodak */ #define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */ /* * The following are ``pseudo tags'' that can be used to control * codec-specific functionality. These tags are not written to file. * Note that these values start at 0xffff+1 so that they'll never * collide with Aldus-assigned tags. * * If you want your private pseudo tags ``registered'' (i.e. added to * this file), please post a bug report via the tracking system at * http://www.remotesensing.org/libtiff/bugs.html with the appropriate * C definitions to add. */ #define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */ #define FAXMODE_CLASSIC 0x0000 /* default, include RTC */ #define FAXMODE_NORTC 0x0001 /* no RTC at end of data */ #define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */ #define FAXMODE_BYTEALIGN 0x0004 /* byte align row */ #define FAXMODE_WORDALIGN 0x0008 /* word align row */ #define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */ #define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */ /* Note: quality level is on the IJG 0-100 scale. Default value is 75 */ #define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */ #define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */ #define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */ #define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */ #define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */ #define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */ /* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */ #define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */ #define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */ #define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */ #define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */ #define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */ #define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */ #define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */ #define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */ /* 65550-65556 are allocated to Oceana Matrix */ #define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */ #define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */ #define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */ #define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */ #define DCSIMAGERFILTER_IR 0 /* infrared filter */ #define DCSIMAGERFILTER_MONO 1 /* monochrome filter */ #define DCSIMAGERFILTER_CFA 2 /* color filter array */ #define DCSIMAGERFILTER_OTHER 3 /* other filter */ #define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */ #define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */ #define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */ #define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */ #define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */ #define TIFFTAG_DCSGAMMA 65554 /* gamma value */ #define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */ #define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */ /* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */ #define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */ #define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */ /* 65559 is allocated to Oceana Matrix */ #define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */ #define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */ #define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */ #define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */ #define SGILOGDATAFMT_RAW 2 /* uninterpreted data */ #define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */ #define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/ #define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/ #define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */ #define TIFFTAG_LZMAPRESET 65562 /* LZMA2 preset (compression level) */ #define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */ #define PERSAMPLE_MERGED 0 /* present as a single value */ #define PERSAMPLE_MULTI 1 /* present as multiple values */ /* * EXIF tags */ #define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */ #define EXIFTAG_FNUMBER 33437 /* F number */ #define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */ #define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */ #define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */ #define EXIFTAG_OECF 34856 /* Optoelectric conversion factor */ #define EXIFTAG_EXIFVERSION 36864 /* Exif version */ #define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original data generation */ #define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital data generation */ #define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */ #define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */ #define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */ #define EXIFTAG_APERTUREVALUE 37378 /* Aperture */ #define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */ #define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */ #define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */ #define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */ #define EXIFTAG_METERINGMODE 37383 /* Metering mode */ #define EXIFTAG_LIGHTSOURCE 37384 /* Light source */ #define EXIFTAG_FLASH 37385 /* Flash */ #define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */ #define EXIFTAG_SUBJECTAREA 37396 /* Subject area */ #define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */ #define EXIFTAG_USERCOMMENT 37510 /* User comments */ #define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */ #define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */ #define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */ #define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */ #define EXIFTAG_COLORSPACE 40961 /* Color space information */ #define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */ #define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */ #define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */ #define EXIFTAG_FLASHENERGY 41483 /* Flash energy */ #define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */ #define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */ #define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */ #define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */ #define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */ #define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */ #define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */ #define EXIFTAG_FILESOURCE 41728 /* File source */ #define EXIFTAG_SCENETYPE 41729 /* Scene type */ #define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */ #define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */ #define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */ #define EXIFTAG_WHITEBALANCE 41987 /* White balance */ #define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */ #define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */ #define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_CONTRAST 41992 /* Contrast */ #define EXIFTAG_SATURATION 41993 /* Saturation */ #define EXIFTAG_SHARPNESS 41994 /* Sharpness */ #define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */ #define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_GAINCONTROL 41991 /* Gain control */ #define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */ #endif /* _TIFF_ */ /* vim: set ts=8 sts=8 sw=8 noet: */ /* * Local Variables: * mode: c * c-basic-offset: 8 * fill-column: 78 * End: */ checkit_tiff-0.2.3/src/headers/tiffconf.h000066400000000000000000000065451304466507300203310ustar00rootroot00000000000000/* libtiff/tiffconf.h. Generated from tiffconf.h.in by configure. */ /* Configuration defines for installed libtiff. This file maintained for backward compatibility. Do not use definitions from this file in your programs. */ #ifndef _TIFFCONF_ #define _TIFFCONF_ /* Signed 16-bit type */ #define TIFF_INT16_T signed short /* Signed 32-bit type */ #define TIFF_INT32_T signed int /* Signed 64-bit type */ #define TIFF_INT64_T signed long /* Signed 8-bit type */ #define TIFF_INT8_T signed char /* Unsigned 16-bit type */ #define TIFF_UINT16_T unsigned short /* Unsigned 32-bit type */ #define TIFF_UINT32_T unsigned int /* Unsigned 64-bit type */ #define TIFF_UINT64_T unsigned long /* Unsigned 8-bit type */ #define TIFF_UINT8_T unsigned char /* Signed size type */ #define TIFF_SSIZE_T signed long /* Pointer difference type */ #define TIFF_PTRDIFF_T ptrdiff_t /* Define to 1 if the system has the type `int16'. */ /* #undef HAVE_INT16 */ /* Define to 1 if the system has the type `int32'. */ /* #undef HAVE_INT32 */ /* Define to 1 if the system has the type `int8'. */ /* #undef HAVE_INT8 */ /* Compatibility stuff. */ /* Define as 0 or 1 according to the floating point format suported by the machine */ #define HAVE_IEEEFP 1 /* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ #define HOST_FILLORDER FILLORDER_LSB2MSB /* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian (Intel) */ #define HOST_BIGENDIAN 0 /* Support CCITT Group 3 & 4 algorithms */ #define CCITT_SUPPORT 1 /* Support JPEG compression (requires IJG JPEG library) */ #define JPEG_SUPPORT 1 /* Support JBIG compression (requires JBIG-KIT library) */ #define JBIG_SUPPORT 1 /* Support LogLuv high dynamic range encoding */ #define LOGLUV_SUPPORT 1 /* Support LZW algorithm */ #define LZW_SUPPORT 1 /* Support NeXT 2-bit RLE algorithm */ #define NEXT_SUPPORT 1 /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ #define OJPEG_SUPPORT 1 /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ #define PIXARLOG_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Support Deflate compression */ #define ZIP_SUPPORT 1 /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ #define STRIPCHOP_DEFAULT TIFF_STRIPCHOP /* Enable SubIFD tag (330) support */ #define SUBIFD_SUPPORT 1 /* Treat extra sample as alpha (default enabled). The RGBA interface will treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA files but don't mark the alpha properly. */ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 /* Pick up YCbCr subsampling info from the JPEG data stream to support files lacking the tag (default enabled). */ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support MS MDI magic number files as TIFF */ #define MDI_SUPPORT 1 /* * Feature support definitions. * XXX: These macros are obsoleted. Don't use them in your apps! * Macros stays here for backward compatibility and should be always defined. */ #define COLORIMETRY_SUPPORT #define YCBCR_SUPPORT #define CMYK_SUPPORT #define ICC_SUPPORT #define PHOTOSHOP_SUPPORT #define IPTC_SUPPORT #endif /* _TIFFCONF_ */ checkit_tiff-0.2.3/src/helper/000077500000000000000000000000001304466507300162145ustar00rootroot00000000000000checkit_tiff-0.2.3/src/helper/check_helper.c000066400000000000000000000041701304466507300207760ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #define _GNU_SOURCE #include #include "check.h" #include "check_helper.h" #include #include #include #include #include /* #define DEBUG */ char * secstrcat (char * dest, const char * src, int maxsize) { if (NULL == dest) { fprintf(stderr, "internal error, dest is NULL!\n"); exit(EXIT_FAILURE); } if (NULL == src) { dest=""; } else { int destsize = strlen(dest); int srclen = strlen(src); //fprintf(stderr, "1dest='%s' , src='%s', destsize=%i, srclen=%i\n", dest, src, destsize, srclen); if (destsize+srclen < maxsize) { strcat( dest, src); } destsize = strlen(dest); //fprintf(stderr, "2dest='%s' , src='%s', destsize=%i, srclen=%i\n", dest, src, destsize, srclen); } return dest; } const char * float2str(float v) { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "%f", v); return strdup(array); } const char* tag2str(tag_t tag) { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "%u (%s)", tag, TIFFTagName(tag)); return strdup(array); } const char* int2str(int v) { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "%u", v); return strdup(array); } const char* frac2str(int d, int n) { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "%u/%u", d, n); return strdup(array); } const char* range2str(int d, int n) { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "<%u-%u>", d, n); return strdup(array); } void TIFFSwabShort(uint16 *a) { uint16 b = ((*a & 0xff) << 8) | ((*a >> 8) & 0xff); *a=b; } void TIFFSwabLong(uint32 *a) { uint8 b0 = (*a) & 0xff; uint8 b1 = (*a >> 8) & 0xff; uint8 b2 = (*a >> 16) & 0xff; uint8 b3 = (*a >> 24) & 0xff; uint32 b = (b0 << 24) | (b1 << 16) | (b2 << 8) | b3; *a=b; } long long fsize(int fd) { struct stat st; fstat(fd, &st); return st.st_size; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/helper/check_print.c000066400000000000000000000136131304466507300206550ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see file LICENSE) * */ #define DEBUG #define _GNU_SOURCE #include #include "check.h" #include "check_helper.h" #ifdef WIN32 static inline char *strndup(const char *s, size_t n) { char *result; size_t len = strlen (s); if (n < len) len = n; result = (char *) malloc (len + 1); if (!result) return 0; result[len] = '\0'; return (char *) strncpy (result, s, len); } #endif ret_t tif_fails(const char* fail_message) { ret_t res; char * str =malloc( sizeof(char) *MAXSTRLEN ); if (NULL==str) { fprintf(stderr, "could not allocate memory for tif_fails\n"); exit(EXIT_FAILURE); }; snprintf (str, MAXSTRLEN-1, "%s", fail_message); res.returnmsg = NULL; res.returncode=1; res.returnmsg = malloc( sizeof( retmsg_t ) ); if (NULL==res.returnmsg) { fprintf(stderr, "could not allocate memory for tif_fails\n"); exit(EXIT_FAILURE); }; res.returnmsg->rm_type=rm_hard_error; res.count = 1; res.returnmsg->rm_msg = str; return res; } ret_t tif_fails_tag(tag_t tag, const char* expected, const char* value) { ret_t res = tif_returns( tag, expected, value); return res; } ret_t tif_rules_tag(tag_t tag, const char *msg) { ret_t res; res.returnmsg = NULL; res.returncode=0; res.count = 3; res.returnmsg = malloc( sizeof( retmsg_t ) * res.count ); if (NULL==res.returnmsg) { fprintf(stderr, "could not allocate memory for tif_rules_tag\n"); exit(EXIT_FAILURE); }; retmsg_t * p = res.returnmsg; // header p->rm_type=rm_rule; p->rm_msg = "check if "; // tag p++; p->rm_type=rm_tag; p->rm_msg = malloc( sizeof(char) *MAXSTRLEN ); if (NULL==p->rm_msg) { fprintf(stderr, "could not allocate memory for 3tif_fails\n"); exit(EXIT_FAILURE); }; snprintf (p->rm_msg, MAXSTRLEN-1, "tag %s ", tag2str(tag)); // rule p++; p->rm_type=rm_rule; p->rm_msg = strndup( msg, MAXSTRLEN); return res; } ret_t tif_no_tag(tag_t tag) { ret_t res; res.returnmsg = NULL; res.returncode=1; res.count = 4; res.returnmsg = malloc( sizeof( retmsg_t ) * res.count ); if (NULL==res.returnmsg) { fprintf(stderr, "could not allocate memory for tif_rules_tag\n"); exit(EXIT_FAILURE); }; retmsg_t * p = res.returnmsg; // header p->rm_type=rm_error; p->rm_msg = ""; // tag p++; p->rm_type=rm_tag; p->rm_msg = malloc( sizeof(char) *MAXSTRLEN ); if (NULL==p->rm_msg) { fprintf(stderr, "could not allocate memory for 3tif_fails\n"); exit(EXIT_FAILURE); }; snprintf (p->rm_msg, MAXSTRLEN-1, "tag %s ", tag2str(tag)); // expected p++; p->rm_type=rm_expected; p->rm_msg = "is found"; // value p++; p->rm_type=rm_value; p->rm_msg = ", but is not whitelisted (or rule has no matched dependency)"; return res; } ret_t tif_rules(const char *msg) { ret_t res; res.returnmsg = NULL; res.returncode=0; res.count = 2; res.returnmsg = malloc( sizeof( retmsg_t ) * res.count ); if (NULL==res.returnmsg) { fprintf(stderr, "could not allocate memory for tif_rules_tag\n"); exit(EXIT_FAILURE); }; retmsg_t * p = res.returnmsg; // header p->rm_type=rm_default; p->rm_msg = "check if "; // rule p++; p->rm_type=rm_rule; p->rm_msg = strndup( msg, MAXSTRLEN); return res; } ret_t tif_files(const char *msg) { ret_t res; res.returnmsg = NULL; res.returncode=0; res.count = 2; res.returnmsg = malloc( sizeof( retmsg_t ) * res.count ); if (NULL==res.returnmsg) { fprintf(stderr, "could not allocate memory for tif_rules_tag\n"); exit(EXIT_FAILURE); }; retmsg_t * p = res.returnmsg; // header p->rm_type=rm_default; p->rm_msg = "tiff file="; // rule p++; p->rm_type=rm_file; p->rm_msg = strndup( msg, MAXSTRLEN); // printf( "%s", renderer( res) ); return res; } void tifp_check( ctiff_t * ctif) { if (NULL == ctif) { tif_fails("ctif_t pointer is empty\n"); }; if (0 > ctif->fd) { tif_fails("TIFF FD pointer is empty\n"); }; if (NULL == ctif->streamp) { tif_fails("TIFF stream pointer is empty\n"); }; } /* TODO: add tif_returns specialized for types */ ret_t tif_returns(tag_t tag, const char* expected, const char* value) { ret_t res; res.returnmsg = NULL; res.returncode=1; res.count = 4; res.returnmsg = malloc( sizeof( retmsg_t) * res.count ); retmsg_t * p = res.returnmsg; if (NULL==res.returnmsg) { fprintf(stderr, "could not allocate memory for tif_fails\n"); exit(EXIT_FAILURE); }; // header p->rm_type=rm_error; p->rm_msg = ""; // tag p++; p->rm_type=rm_tag; p->rm_msg = malloc( sizeof(char) *MAXSTRLEN ); if (NULL==p->rm_msg) { fprintf(stderr, "could not allocate memory for tif_fails\n"); exit(EXIT_FAILURE); }; snprintf (p->rm_msg, MAXSTRLEN-1, "tag %s", tag2str( tag)); // expected p++; p->rm_type=rm_expected; p->rm_msg = malloc( sizeof(char) *MAXSTRLEN ); if (NULL==p->rm_msg) { fprintf(stderr, "could not allocate memory for tif_fails\n"); exit(EXIT_FAILURE); }; snprintf (p->rm_msg, MAXSTRLEN-1, " should have value %s", expected); // value p++; p->rm_type=rm_value; p->rm_msg = malloc( sizeof(char) *MAXSTRLEN ); if (NULL==p->rm_msg) { fprintf(stderr, "could not allocate memory for tif_fails\n"); exit(EXIT_FAILURE); }; snprintf (p->rm_msg, MAXSTRLEN-1, ", but has value (values or count) %s", value); return res; } ret_t tif_fails_by_returns( ret_t ret ) { return ret; } ret_t _empty_result() { ret_t t; t.returncode=0; t.returnmsg=NULL; t.count=1; t.returnmsg = malloc( sizeof( retmsg_t) * t.count ); retmsg_t * p = t.returnmsg; if (NULL==t.returnmsg) { fprintf(stderr, "could not allocate memory for _empty_result\n"); exit(EXIT_FAILURE); }; // header p->rm_type=rm_default; p->rm_msg = "ok"; return t; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/helper/check_renderer.c000066400000000000000000000177251304466507300213370ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015/16 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #define _GNU_SOURCE #include #include "check.h" #include "check_helper.h" #include #include #include #include /* #define DEBUG */ /* color definitions, using ISO 6429 as listed in 'man (5) dir_colors' 0 to restore default color 1 for brighter colors 4 for underlined text 5 for flashing text 30 for black foreground 31 for red foreground 32 for green foreground 33 for yellow (or brown) foreground 34 for blue foreground 35 for purple foreground 36 for cyan foreground 37 for white (or gray) foreground 40 for black background 41 for red background 42 for green background 43 for yellow (or brown) background 44 for blue background 45 for purple background 46 for cyan background 47 for white (or gray) background */ #define ANSI_NORMAL "\033[0m" #define ANSI_BOLD "\033[1m" #define ANSI_RED "\033[00;31m" #define ANSI_RED_BOLD "\033[01;31m" #define ANSI_GREEN "\033[00;32m" #define ANSI_GREEN_BOLD "\033[01;32m" #define ANSI_RESET "\033[0m" #define ANSI_BLACK "\033[00;30m" #define ANSI_BLACK_BOLD "\033[01;30m" #define ANSI_BROWN "\033[00;33m" #define ANSI_BLUE "\033[00;34m" #define ANSI_BLUE_BOLD "\033[01;34m" #define ANSI_PURPLE "\033[00;35m" #define ANSI_CYAN "\033[00;36m" #define ANSI_GREY "\033[00;37m" #define ANSI_DARK_GREY "\033[01;30m" #define ANSI_YELLOW "\033[01;33m" #define ANSI_WHITE "\033[01;37m" #define ANSI_INVERSE "\033[7m" render_type render_engine=render_default; void set_renderer_to_ansi() { if (isatty (STDOUT_FILENO)) { render_engine=render_ansi; } } void set_renderer_to_xml() { render_engine=render_xml; } const char * renderer_debug ( ret_t ret ) { char res[1024] = ""; if (0 == ret.returncode) { secstrcat( res, "\t", 1024 ); secstrcat (res, ANSI_GREEN, 1024); } else { secstrcat( res, "\t", 1024 ); secstrcat (res, ANSI_RED_BOLD, 1024); } retmsg_t * startp = ret.returnmsg; int c = 0; while (NULL != startp && NULL != startp->rm_msg && c < ret.count) { switch (startp->rm_type) { case rm_rule: secstrcat( res, ANSI_NORMAL , 1024); break; case rm_tag: secstrcat( res, ANSI_BOLD , 1024); break; case rm_value: secstrcat( res, ANSI_BLUE , 1024); break; case rm_expected: secstrcat( res, ANSI_RED , 1024); break; case rm_hard_error: secstrcat( res, ANSI_RED_BOLD , 1024); break; case rm_error: secstrcat( res, ANSI_RED , 1024); break; case rm_warning: secstrcat( res, ANSI_YELLOW , 1024); break; case rm_file: secstrcat( res, ANSI_BLUE_BOLD, 1024); break; default: secstrcat( res, ANSI_INVERSE , 1024); } secstrcat(res, startp->rm_msg, 1024); startp++; c++; } secstrcat(res, ANSI_RESET, 1024); secstrcat(res, "\n", 1024); return strdup( res ); } const char * renderer_default ( ret_t ret ) { char res[1024] = ""; if (0 == ret.returncode) { } else { secstrcat( res, "\t", 1024 ); } retmsg_t * startp = ret.returnmsg; int c = 0; while (NULL != startp && NULL != startp->rm_msg && c < ret.count) { secstrcat(res, startp->rm_msg, 1024); startp++; c++; } secstrcat(res, "\n", 1024); return strdup( res ); } const char * renderer_ansi ( ret_t ret ) { char res[1024] = ""; if (0 == ret.returncode) { secstrcat( res, "", 1024 ); secstrcat (res, ANSI_GREEN, 1024); } else { secstrcat (res, ANSI_RED_BOLD, 1024); secstrcat( res, "==> ", 1024 ); } retmsg_t * startp = ret.returnmsg; int c = 0; while (NULL != startp && NULL != startp->rm_msg && c < ret.count) { switch (startp->rm_type) { case rm_rule: secstrcat( res, ANSI_NORMAL , 1024); break; case rm_tag: secstrcat( res, ANSI_BOLD , 1024); break; case rm_value: secstrcat( res, ANSI_BLUE , 1024); break; case rm_expected: secstrcat( res, ANSI_RED , 1024); break; case rm_hard_error: secstrcat( res, ANSI_RED_BOLD , 1024); break; case rm_error: secstrcat( res, ANSI_RED , 1024); break; case rm_warning: secstrcat( res, ANSI_GREY , 1024); break; case rm_logicalor_error: secstrcat( res, ANSI_YELLOW , 1024); break; case rm_file: secstrcat( res, ANSI_BLUE_BOLD, 1024); break; default: secstrcat( res, ANSI_NORMAL , 1024); } /* FIXME: replace all occurrences of a space, backslash, caret, or any control character anywhere in the string, as well as a hash mark as the first character. */ secstrcat(res, startp->rm_msg, 1024); startp++; c++; } secstrcat(res, ANSI_NORMAL, 1024); secstrcat(res, "\n", 1024); return strdup( res ); } const char * renderer_xml ( ret_t ret ) { char res[1024] = ""; if (0 == ret.returncode) { secstrcat( res, "true", 1024 ); } else { secstrcat( res, "false", 1024 ); } retmsg_t * startp = ret.returnmsg; int c = 0; while (NULL != startp && NULL != startp->rm_msg && c < ret.count) { switch (startp->rm_type) { case rm_rule: secstrcat( res, "" , 1024); break; case rm_tag: secstrcat( res, "" , 1024); break; case rm_value: secstrcat( res, "" , 1024); break; case rm_expected: secstrcat( res, "" , 1024); break; case rm_hard_error: secstrcat( res, "" , 1024); break; case rm_error: secstrcat( res, "" , 1024); break; case rm_warning: secstrcat( res, "" , 1024); break; case rm_logicalor_error: secstrcat( res, "" , 1024); break; case rm_file: secstrcat( res, "", 1024); break; default: secstrcat( res, "" , 1024); } /* FIXME: replace all occurrences of a space, backslash, caret, or any control character anywhere in the string, as well as a hash mark as the first character. */ secstrcat(res, startp->rm_msg, 1024); switch (startp->rm_type) { case rm_rule: secstrcat( res, "" , 1024); break; case rm_tag: secstrcat( res, "" , 1024); break; case rm_value: secstrcat( res, "" , 1024); break; case rm_expected: secstrcat( res, "" , 1024); break; case rm_hard_error: secstrcat( res, "" , 1024); break; case rm_error: secstrcat( res, "" , 1024); break; case rm_warning: secstrcat( res, "" , 1024); break; case rm_logicalor_error: secstrcat( res, "" , 1024); break; case rm_file: secstrcat( res, "", 1024); break; default: secstrcat( res, "" , 1024); } startp++; c++; } secstrcat(res, "", 1024); secstrcat(res, "\n", 1024); return strdup( res ); } const char * renderer ( ret_t ret ) { // call debug renderer switch (render_engine) { case render_xml: return renderer_xml( ret ); case render_ansi: return renderer_ansi( ret ); case render_debug: return renderer_debug( ret ); default: return renderer_default( ret ); } return ""; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/helper/check_tiffparse.c000066400000000000000000002245621304466507300215130ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015/2016 * licensed under conditions of libtiff * (see file LICENSE) * */ #define _GNU_SOURCE #include #include "check.h" #include "check_helper.h" #include #include #include #include #include #ifdef _HAVE__MMAP #include #endif #include /* #define DEBUG */ off_t ct_seek(ctiff_t * ctif, off_t pos, int whence) { #ifdef _HAVE__MMAP switch (ctif->ioflag) { case is_filep: assert(ctif->fd >= 0); // TODO: add checks if seek will be outside of file!!! return lseek(ctif->fd, pos, whence); break; case is_memmap: assert( ctif->streamp != NULL); assert( ctif->actual_streamp != NULL); switch (whence) { case SEEK_SET: ctif->actual_streamp = ctif->streamp + pos; break; case SEEK_CUR: ctif->actual_streamp+=pos; break; case SEEK_END: ctif->actual_streamp = ctif->streamp + ctif->streamlen + pos; break; } int testpos = ctif->actual_streamp - ctif->streamp; if ( testpos > ctif->streamlen) { fprintf(stderr, "seek offset outside of file on new pos=%i (filesize=%i)\n", testpos, ctif->streamlen); exit(EXIT_FAILURE); } if ( testpos < 0 ) { fprintf(stderr, "seek offset outside of file on new pos=%i (filesize=%i)\n", testpos, ctif->streamlen); exit(EXIT_FAILURE); } return ctif->actual_streamp - ctif->streamp; break; } #else assert(ctif->fd >= 0); // TODO: add checks if seek will be outside of file!!! return lseek(ctif->fd, pos, whence); #endif } ssize_t ct_read(ctiff_t * ctif, void *buf, size_t count) { #ifdef _HAVE__MMAP switch (ctif->ioflag) { case is_filep: // TODO: add checks if seek will be outside of file!!! assert(ctif->fd >= 0); return read(ctif->fd, buf, count); break; case is_memmap: { assert( ctif->streamp != NULL); assert( ctif->actual_streamp != NULL); int testpos = (ctif->actual_streamp+count) - (ctif->streamp); if ( testpos > ctif->streamlen) { fprintf(stderr, "read offset outside of file on new pos=%i (filesize=%i)\n", testpos, ctif->streamlen); exit(EXIT_FAILURE); } if ( testpos < 0 ) { fprintf(stderr, "read offset outside of file on new pos=%i (filesize=%i)\n", testpos, ctif->streamlen); exit(EXIT_FAILURE); } memcpy(buf, ctif->actual_streamp, count); ctif->actual_streamp+=count; return count; break; } } #else // TODO: add checks if seek will be outside of file!!! assert(ctif->fd >= 0); return read(ctif->fd, buf, count); #endif } const char * TIFFTypeName( uint16 tagtype ) { switch (tagtype) { case TIFF_NOTYPE: return "NOTYPE"; break; case TIFF_BYTE: return "BYTE"; break; case TIFF_ASCII: return "ASCII"; break; case TIFF_SHORT: return "SHORT"; break; case TIFF_LONG: return "LONG"; break; case TIFF_RATIONAL: return "RATIONAL"; break; case TIFF_SBYTE: return "SBYTE"; break; case TIFF_UNDEFINED: return "UNDEFINED"; break; case TIFF_SSHORT: return "SSHORT"; break; case TIFF_SLONG: return "SLONG"; break; case TIFF_SRATIONAL: return "SRATIONAL"; break; case TIFF_FLOAT: return "FLOAT"; break; case TIFF_DOUBLE: return "DOUBLE"; break; case TIFF_IFD: return "IFD"; break; case TIFF_LONG8: return "LONG8"; break; case TIFF_SLONG8: return "SLONG8"; break; case TIFF_IFD8: return "IFD8"; break; default: return "unknown type"; break; } } const char * TIFFTagName( tag_t tag ) { switch (tag) { /* next lines from tiffdump.c */ /* 254 - 255, 0xfe - 0xff */ /* 254 */ case TIFFTAG_SUBFILETYPE: return ("SubFileType" ); /* 255 */ case TIFFTAG_OSUBFILETYPE: return ("OldSubFileType" ); /* 256 - 511, 0x100 - 0x1ff */ /* 256 */ case TIFFTAG_IMAGEWIDTH: return ("ImageWidth" ); /* 257 */ case TIFFTAG_IMAGELENGTH: return ("ImageLength" ); /* 258 */ case TIFFTAG_BITSPERSAMPLE: return ("BitsPerSample" ); /* 259 */ case TIFFTAG_COMPRESSION: return ("Compression" ); /* 262 */ case TIFFTAG_PHOTOMETRIC: return ("Photometric" ); /* 263 */ case TIFFTAG_THRESHHOLDING: return ("Threshholding" ); /* 264 */ case TIFFTAG_CELLWIDTH: return ("CellWidth" ); /* 265 */ case TIFFTAG_CELLLENGTH: return ("CellLength" ); /* 266 */ case TIFFTAG_FILLORDER: return ("FillOrder" ); /* 269 */ case TIFFTAG_DOCUMENTNAME: return ("DocumentName" ); /* 270 */ case TIFFTAG_IMAGEDESCRIPTION: return ("ImageDescription" ); /* 271 */ case TIFFTAG_MAKE: return ("Make" ); /* 272 */ case TIFFTAG_MODEL: return ("Model" ); /* 273 */ case TIFFTAG_STRIPOFFSETS: return ("StripOffsets" ); /* 274 */ case TIFFTAG_ORIENTATION: return ("Orientation" ); /* 277 */ case TIFFTAG_SAMPLESPERPIXEL: return ("SamplesPerPixel" ); /* 278 */ case TIFFTAG_ROWSPERSTRIP: return ("RowsPerStrip" ); /* 279 */ case TIFFTAG_STRIPBYTECOUNTS: return ("StripByteCounts" ); /* 280 */ case TIFFTAG_MINSAMPLEVALUE: return ("MinSampleValue" ); /* 281 */ case TIFFTAG_MAXSAMPLEVALUE: return ("MaxSampleValue" ); /* 282 */ case TIFFTAG_XRESOLUTION: return ("XResolution" ); /* 283 */ case TIFFTAG_YRESOLUTION: return ("YResolution" ); /* 284 */ case TIFFTAG_PLANARCONFIG: return ("PlanarConfig" ); /* 285 */ case TIFFTAG_PAGENAME: return ("PageName" ); /* 286 */ case TIFFTAG_XPOSITION: return ("XPosition" ); /* 287 */ case TIFFTAG_YPOSITION: return ("YPosition" ); /* 288 */ case TIFFTAG_FREEOFFSETS: return ("FreeOffsets" ); /* 289 */ case TIFFTAG_FREEBYTECOUNTS: return ("FreeByteCounts" ); /* 290 */ case TIFFTAG_GRAYRESPONSEUNIT: return ("GrayResponseUnit" ); /* 291 */ case TIFFTAG_GRAYRESPONSECURVE: return ("GrayResponseCurve" ); /* 292 */ case TIFFTAG_GROUP3OPTIONS: return ("Group3Options" ); /* 293 */ case TIFFTAG_GROUP4OPTIONS: return ("Group4Options" ); /* 296 */ case TIFFTAG_RESOLUTIONUNIT: return ("ResolutionUnit" ); /* 297 */ case TIFFTAG_PAGENUMBER: return ("PageNumber" ); /* 300 */ case TIFFTAG_COLORRESPONSEUNIT: return ("ColorResponseUnit" ); /* 301 */ case TIFFTAG_TRANSFERFUNCTION: return ("TransferFunction" ); /* 305 */ case TIFFTAG_SOFTWARE: return ("Software" ); /* 306 */ case TIFFTAG_DATETIME: return ("DateTime" ); /* 315 */ case TIFFTAG_ARTIST: return ("Artist" ); /* 316 */ case TIFFTAG_HOSTCOMPUTER: return ("HostComputer" ); /* 317 */ case TIFFTAG_PREDICTOR: return ("Predictor" ); /* 318 */ case TIFFTAG_WHITEPOINT: return ("Whitepoint" ); /* 319 */ case TIFFTAG_PRIMARYCHROMATICITIES: return ("PrimaryChromaticities" ); /* 320 */ case TIFFTAG_COLORMAP: return ("Colormap" ); /* 321 */ case TIFFTAG_HALFTONEHINTS: return ("HalftoneHints" ); /* 322 */ case TIFFTAG_TILEWIDTH: return ("TileWidth" ); /* 323 */ case TIFFTAG_TILELENGTH: return ("TileLength" ); /* 324 */ case TIFFTAG_TILEOFFSETS: return ("TileOffsets" ); /* 325 */ case TIFFTAG_TILEBYTECOUNTS: return ("TileByteCounts" ); /* 326 */ case TIFFTAG_BADFAXLINES: return ("BadFaxLines" ); /* 327 */ case TIFFTAG_CLEANFAXDATA: return ("CleanFaxData" ); /* 328 */ case TIFFTAG_CONSECUTIVEBADFAXLINES: return ("ConsecutiveBadFaxLines" ); /* 330 */ case TIFFTAG_SUBIFD: return ("SubIFD" ); /* 332 */ case TIFFTAG_INKSET: return ("InkSet" ); /* 333 */ case TIFFTAG_INKNAMES: return ("InkNames" ); /* 334 */ case TIFFTAG_NUMBEROFINKS: return ("NumberOfInks" ); /* 336 */ case TIFFTAG_DOTRANGE: return ("DotRange" ); /* 337 */ case TIFFTAG_TARGETPRINTER: return ("TargetPrinter" ); /* 338 */ case TIFFTAG_EXTRASAMPLES: return ("ExtraSamples" ); /* 339 */ case TIFFTAG_SAMPLEFORMAT: return ("SampleFormat" ); /* 340 */ case TIFFTAG_SMINSAMPLEVALUE: return ("SMinSampleValue" ); /* 341 */ case TIFFTAG_SMAXSAMPLEVALUE: return ("SMaxSampleValue" ); /* 347 */ case TIFFTAG_JPEGTABLES: return ("JPEGTables" ); /* 400 */ case TIFFTAG_GLOBALPARAMETERSIFD: return ("GLOBALPARAMETERSIFD"); /* 401 */ case TIFFTAG_PROFILETYPE: return ("PROFILETYPE"); /* 402 */ case TIFFTAG_FAXPROFILE: return ("FAXPROFILE"); /* 403 */ case TIFFTAG_CODINGMETHODS: return ("CODINGMETHODS"); /* 404 */ case TIFFTAG_VERSIONYEAR: return ("VERSIONYEAR"); /* 405 */ case TIFFTAG_MODENUMBER: return ("MODENUMBER"); /* 433 */ case TIFFTAG_DECODE: return ("DECODE"); /* 434 */ case TIFFTAG_IMAGEBASECOLOR: return ("IMAGEBASECOLOR"); /* 435 */ case TIFFTAG_T82OPTIONS: return ("T82OPTIONS"); /* 512 - 767, 0x200 - 0x2ff */ /* 512 */ case TIFFTAG_JPEGPROC: return ("JPEGProcessingMode" ); /* 513 */ case TIFFTAG_JPEGIFOFFSET: return ("JPEGInterchangeFormat" ); /* 514 */ case TIFFTAG_JPEGIFBYTECOUNT: return ("JPEGInterchangeFormatLength" ); /* 515 */ case TIFFTAG_JPEGRESTARTINTERVAL: return ("JPEGRestartInterval" ); /* 517 */ case TIFFTAG_JPEGLOSSLESSPREDICTORS: return ("JPEGLosslessPredictors" ); /* 518 */ case TIFFTAG_JPEGPOINTTRANSFORM: return ("JPEGPointTransform" ); /* 519 */ case TIFFTAG_JPEGQTABLES: return ("JPEGQTables" ); /* 520 */ case TIFFTAG_JPEGDCTABLES: return ("JPEGDCTables" ); /* 521 */ case TIFFTAG_JPEGACTABLES: return ("JPEGACTables" ); /* 529 */ case TIFFTAG_YCBCRCOEFFICIENTS: return ("YCbCrCoefficients" ); /* 530 */ case TIFFTAG_YCBCRSUBSAMPLING: return ("YCbCrSubsampling" ); /* 531 */ case TIFFTAG_YCBCRPOSITIONING: return ("YCbCrPositioning" ); /* 532 */ case TIFFTAG_REFERENCEBLACKWHITE: return ("ReferenceBlackWhite" ); /* 559 */ case TIFFTAG_STRIPROWCOUNTS: return ("StripRowCounts"); /* 700 */ case TIFFTAG_XMLPACKET: return ("XMP"); /* 20507 */ case 20507: return ("inofficial EXIF ThumbnailData (poss. Olympus)"); /* see http://www.stefanheymann.de/homegallery/exif-felder.htm, but not in Exif2.3 standard */ /* 20515 */ case 20515: return ("inofficial EXIF ThumbnailCompression (poss. Olympus)"); /* see http://www.stefanheymann.de/homegallery/exif-felder.htm, but not in Exif2.3 standard */ /* 20525 */ case 20525: return ("inofficial EXIF ThumbnailResolutionX (poss. Olympus)"); /* see http://www.stefanheymann.de/homegallery/exif-felder.htm, but not in Exif2.3 standard */ /* 20526 */ case 20526: return ("inofficial EXIF ThumbnailResolutionY (poss. Olympus)"); /* see http://www.stefanheymann.de/homegallery/exif-felder.htm, but not in Exif2.3 standard */ /* 20528 */ case 20528: return ("inofficial EXIF ThumbnailResolutionUnit (poss. Olympus)"); /* see http://www.stefanheymann.de/homegallery/exif-felder.htm, but not in Exif2.3 standard */ /* 20624 */ case 20624: return ("inofficial EXIF LuminanceTable (poss. Olympus)"); /* see http://www.stefanheymann.de/homegallery/exif-felder.htm, but not in Exif2.3 standard */ /* 20625 */ case 20625: return ("inofficial EXIF ChrominanceTable (poss. Olympus)"); /* see http://www.stefanheymann.de/homegallery/exif-felder.htm, but not in Exif2.3 standard */ /* 32768 -, 0x8000 - */ /* 32768 */ case 32768: return ("OLD BOGUS Matteing tag" ); /* 32781 */ case TIFFTAG_OPIIMAGEID: return ("OpiImageId"); /* 32835 */ case 32835: return ("XIS private compression scheme tag"); /* see code line 97ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 32836 */ case 32836: return ("XIS private compression scheme tag"); /* see code line 97ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 32837 */ case 32837: return ("XIS private compression scheme tag"); /* see code line 97ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 32838 */ case 32838: return ("XIS private compression scheme tag"); /* see code line 97ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 32839 */ case 32839: return ("XIS private compression scheme tag"); /* see code line 97ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* next 5 lines WANG TIFF */ /* 32931 */ case 32931: return ("TIFF HiTIFF / Wang TIFF"); /* https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/oiwh/include/tifftags.h */ /* 32932 */ case 32932: return ("TIFF annotation data / Wang TIFF"); /* http://web.archive.org/web/20050309141348/http://www.kofile.com/support%20pro/faqs/annospec.htm, for full explanation, see http://web.archive.org/web/20030124024322/http://www5.eistream.com/support_pro/faqs/annospec.htm */ /* 32933 */ case 32933: return ("unknown Wang TIFF"); /* 32934 */ case 32934: return ("Offset to Page Control Structure / Wang TIFF"); /* https://groups.yahoo.com/neo/groups/tiff/conversations/messages/1968 */ /* 32935 */ case 32935: return ("TOC / Wang TIFF"); /* https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/oiwh/include/tifftags.h */ /* 32952 */ case 32952: return ("unknown Ig (Island Graphics)" ); /* http://fileformats.archiveteam.org/wiki/Island_Graphics_TIFF */ /* 32953 */ case TIFFTAG_REFPTS: return ("IgReferencePoints (Island Graphics)" ); /* 32954 */ case TIFFTAG_REGIONTACKPOINT: return ("IgRegionTackPoint (Island Graphics)" ); /* 32955 */ case TIFFTAG_REGIONWARPCORNERS: return ("IgRegionWarpCorners (Island Graphics)" ); /* 32956 */ case TIFFTAG_REGIONAFFINE: return ("IgRegionAffine (Island Graphics)" ); /* 32970 */ case 32970: return ("temperature (COMPIX)"); /* http://www.compix.com/fileformattif.htm */ /* 32971 */ case 32971: return ("Zoombox (COMPIX)"); /* http://www.compix.com/fileformattif.htm */ /* 32972 */ case 32972: return ("WinTES (COMPIX)"); /* http://www.compix.com/fileformattif.htm */ /* 32995 */ case TIFFTAG_MATTEING: return ("OBSOLETE Matteing (Silicon Graphics)" ); /* 32996 */ case TIFFTAG_DATATYPE: return ("OBSOLETE DataType (Silicon Graphics)" ); /* 32997 */ case TIFFTAG_IMAGEDEPTH: return ("ImageDepth (Silicon Graphics)" ); /* 32998 */ case TIFFTAG_TILEDEPTH: return ("TileDepth (Silicon Graphics)" ); /* 33300 */ case TIFFTAG_PIXAR_IMAGEFULLWIDTH: return ("PIXAR_IMAGEFULLWIDTH"); /* 33301 */ case TIFFTAG_PIXAR_IMAGEFULLLENGTH: return ("PIXAR_IMAGEFULLLENGTH"); /* 33302 */ case TIFFTAG_PIXAR_TEXTUREFORMAT: return ("PIXAR_TEXTUREFORMAT"); /* 33303 */ case TIFFTAG_PIXAR_WRAPMODES: return ("PIXAR_WRAPMODES"); /* 33304 */ case TIFFTAG_PIXAR_FOVCOT: return ("PIXAR_FOVCOT"); /* 33305 */ case TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN: return ("PIXAR_MATRIX_WORLDTOSCREEN"); /* 33306 */ case TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA: return ("PIXAR_MATRIX_WORLDTOCAMERA"); /* 33405 */ case TIFFTAG_WRITERSERIALNUMBER: return ("Kodak serial number"); /* 33421 */ case 33421: return ("CFAREPEATPATTERNDIM"); /* 33422 */ case 33422: return ("CFAPATTERN"); /* 33423 */ case 33423: return ("BatteryLevel (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 33424 */ case 33424: return ("Kodak IFD"); /* http://perldoc.net/Image/ExifTool/TagNames.pod#Unknown%20Tags */ /* 33432 */ case TIFFTAG_COPYRIGHT: return ("Copyright" ); /* 33434 */ case 33434: return ("EXIF ExposureTime"); /* EXIF, Exposure time, given in seconds. */ /* 33437 */ case 33437: return ("EXIF FNumber"); /* EXIF, The F number. */ /* 33445 */ case 33445: return ("MD_Filetag"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf or http://www.awaresystems.be/imaging/tiff/tifftags/docs/gel.html*/ /* 33446 */ case 33446: return ("MD_ScalePixel"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */ /* 33447 */ case 33447: return ("MD_Colortable"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */ /* 33448 */ case 33448: return ("MD_LabName"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */ /* 33449 */ case 33449: return ("MD_SampleInfo"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */ /* 33450 */ case 33450: return ("MD_PrepDate"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */ /* 33451 */ case 33451: return ("MD_PrepTime"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */ /* 33452 */ case 33452: return ("MD_FileUnits"); /* http://research.stowers-institute.org/mcm/efg/ScientificSoftware/Utility/TiffTags/GEL-FileFormat.pdf */ /* 33471 */ case 33471: return ("SIS Init Standard Metadata (Olympus)"); /* https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/SISReader.java */ /* 33550 */ case 33550: return ("GeoTIFF ModelPixelScale"); /* http://web.archive.org/web/20160407200550/http://www.remotesensing.org/geotiff/spec/geotiff6.html#6.1 */ /* 33560 */ case 33560: return ("SIS Offset Metadata (Olympus)"); /* https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/SISReader.java */ /* 33609 */ case 33609: return ("Component subsample CMYK/YCBCR (WangTIFF)"); /* line 182, https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 33628 */ case 33628: return ("MetaMorph Stack Image UIC1"); /* see: ftp://ftp.meta.moleculardevices.com/support/stack/STK.doc, but also read comments in https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/PrairieReader.java */ /* 33629 */ case 33629: return ("MetaMorph Stack Image UIC2"); /* see: ftp://ftp.meta.moleculardevices.com/support/stack/STK.doc, but also read comments in https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/PrairieReader.java */ /* 33630 */ case 33630: return ("MetaMorph Stack Image UIC3"); /* see: ftp://ftp.meta.moleculardevices.com/support/stack/STK.doc, but also read comments in https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/PrairieReader.java */ /* 33631 */ case 33631: return ("MetaMorph Stack Image UIC4"); /* see: ftp://ftp.meta.moleculardevices.com/support/stack/STK.doc */ /* 33723 */ case TIFFTAG_RICHTIFFIPTC: return ("RichTIFFIPTC / NAA"); /* see ISO12234-2:2001 for TIFF/EP */ /* 33918 */ case 33918: return ("INGR Packet Data Tag (Intergraph)"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 33919 */ case 33919: return ("INGR Flag Registers (Intergraph)"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 33920 */ case 33920: return ("IrasB Transformation Matrix / obsolete GeoTIFF IntergraphMatrixTag (Intergraph)"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 33921 */ case 33921: return ("Georeferencing Tag / obsolete (Intergraph)"); /* see http://www.awaresystems.be/imaging/tiff/tifftags/docs/intergraph.html */ /* 33922 */ case 33922: return ("GeoTIFF ModelTiepointTag (Intergraph)"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 33923 */ case 33923: return ("Leica Magic Tag"); /* see https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/LeicaReader.java */ /* 33979 */ case 33979: return ("XIS private tag"); /* see code line 89ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 33980 */ case 33980: return ("XIS private tag"); /* see code line 89ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 33981 */ case 33981: return ("XIS private tag"); /* see code line 89ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 33982 */ case 33982: return ("XIS private tag"); /* see code line 89ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 33983 */ case 33983: return ("XIS private tag"); /* see code line 89ff. at https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiff.h */ /* 34016 */ case TIFFTAG_IT8SITE: return ("IT8SITE"); /* 34017 */ case TIFFTAG_IT8COLORSEQUENCE: return ("IT8COLORSEQUENCE"); /* 34018 */ case TIFFTAG_IT8HEADER: return ("IT8HEADER"); /* 34019 */ case TIFFTAG_IT8RASTERPADDING: return ("IT8RASTERPADDING"); /* 34020 */ case TIFFTAG_IT8BITSPERRUNLENGTH: return ("IT8BITSPERRUNLENGTH"); /* 34021 */ case TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH: return ("IT8BITSPEREXTENDEDRUNLENGTH"); /* 34022 */ case TIFFTAG_IT8COLORTABLE: return ("IT8COLORTABLE"); /* 34023 */ case TIFFTAG_IT8IMAGECOLORINDICATOR: return ("IT8IMAGECOLORINDICATOR"); /* 34024 */ case TIFFTAG_IT8BKGCOLORINDICATOR: return ("IT8BKGCOLORINDICATOR"); /* 34025 */ case TIFFTAG_IT8IMAGECOLORVALUE: return ("IT8IMAGECOLORVALUE"); /* 34026 */ case TIFFTAG_IT8BKGCOLORVALUE: return ("IT8BKGCOLORVALUE"); /* 34027 */ case TIFFTAG_IT8PIXELINTENSITYRANGE: return ("IT8PIXELINTENSITYRANGE"); /* 34028 */ case TIFFTAG_IT8TRANSPARENCYINDICATOR: return ("IT8TRANSPARENCYINDICATOR"); /* 34029 */ case TIFFTAG_IT8COLORCHARACTERIZATION: return ("IT8COLORCHARACTERIZATION"); /* 34030 */ case TIFFTAG_IT8HCUSAGE: return ("IT8HCUSAGE"); /* 34031 */ case TIFFTAG_IT8TRAPINDICATOR: return ("IT8TRAPINDICATOR"); /* 34032 */ case TIFFTAG_IT8CMYKEQUIVALENT: return ("IT8CMYKEQUIVALENT"); /* 34232 */ case TIFFTAG_FRAMECOUNT: return ("FRAMECOUNT"); /* 34264 */ case 34264: return ("Geotiff ModelTransformationTag (JPL Carto Group)"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 34310 */ case 34310: return ("Leaf MOS PKTS tag (Raw camera)"); /* see http://fileformats.archiveteam.org/wiki/Leaf_MOS */ /* 34361 */ case 34361: return ("MMHeader (Olympus Fluoview or Andor Bio-imaging Division)"); /* https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/FluoviewReader.java */ /* 34362 */ case 34362: return ("MMStamp (Olympus Fluoview or Andor Bio-imaging Division)"); /* https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/FluoviewReader.java */ /* 34377 */ case TIFFTAG_PHOTOSHOP: return ("Photoshop Image Ressources"); /* see http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577413_pgfId-1039502, also see paragraph "Photoshop Image Resource Metadata Structure" in http://help.accusoft.com/ImageGear/v17.2/Windows/DLL/topic755.html or http://fileformats.archiveteam.org/wiki/Photoshop_Image_Resources, this points to http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1037685 and http://www.awaresystems.be/imaging/tiff/tifftags/docs/photoshopthumbnail.html*/ /* 34665 */ case TIFFTAG_EXIFIFD: return ("EXIFIFDOffset"); /* 34675 */ case TIFFTAG_ICCPROFILE: return ("ICC Profile" ); /* 34730 */ case 34730: return ("Annotation Offsets (Wang TIFF)"); /* line 134, https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiffint.h */ /* 34731 */ case 34731: return ("Mask SUBIFDs (Wang TIFF)"); /* line 135, https://github.com/gasgas4/NT_4.0_SourceCode/blob/master/nt4/private/wangview/xfilexr/include/tiffint.h */ /* 34732 */ case TIFFTAG_IMAGELAYER: return ("ImageLayer"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag, see RFC2301*/ /* 34735 */ case 34735: return ("Geotiff GeoKeyDirectoryTag (SPOT)"); /* http://web.archive.org/web/20160407200550/http://www.remotesensing.org/geotiff/spec/geotiff6.html#6.1 */ /* 34736 */ case 34736: return ("Geotiff GeoDoubleParamsTag (SPOT)"); /* http://web.archive.org/web/20160407200550/http://www.remotesensing.org/geotiff/spec/geotiff6.html#6.1 */ /* 34737 */ case 34737: return ("Geotiff GeoAsciiParamsTag (SPOT)"); /* http://web.archive.org/web/20160407200550/http://www.remotesensing.org/geotiff/spec/geotiff6.html#6.1 */ /* 34750 */ case TIFFTAG_JBIGOPTIONS: return ("JBIG Options" ); /* 34820 */ case 34820: return ("EMC/PixTool SpecificTag"); /* thgere is more informatioon about meaning needed. If tag exists, there was string "Untitled" encoded (as binary) */ /* 34850 */ case 34850: return ("EXIF ExposureProgram"); /* EXIF, The class of the program used by the camera to set exposure when the picture is taken. */ /* 34852 */ case 34852: return ("EXIF SpectralSensitivity"); /* EXIF, Indicates the spectral sensitivity of each channel of the camera used. */ /* 34853 */ case TIFFTAG_GPSIFD: return ("GPSIFD or Olympus SIS TAG2"); /* for Olympus, see https://github.com/openmicroscopy/bioformats/blob/v5.2.4/components/formats-gpl/src/loci/formats/in/SISReader.java */ /* 34855 */ case 34855: return ("EXIF ISOSpeedRatings"); /* EXIF, Indicates the ISO Speed and ISO Latitude of the camera or input device as specified in ISO 12232. */ /* 34856 */ case 34856: return ("EXIF OECF"); /* EXIF, Indicates the Opto-Electric Conversion Function (OECF) specified in ISO 14524. */ /* 34857 */ case 34857: return ("Interlace (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 34858 */ case 34858: return ("TimeZoneOffset (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 34859 */ case 34859: return ("SelfTimerMode (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 34908 */ case TIFFTAG_FAXRECVPARAMS: return ("HylaFax FaxRecvParams"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 34909 */ case TIFFTAG_FAXSUBADDRESS: return ("HylaFax FaxSubAdress"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 34910 */ case TIFFTAG_FAXRECVTIME: return ("HylaFax FaxRecvTime"); /* see http://www.rastermaster.com/RasterMaster%20DLL%20manual/WebHelp/Content/aptifftagswide.htm for explanation of tag*/ /* 36864 */ case 36864: return ("EXIF ExifVersion"); /* EXIF, The version of the supported Exif standard. */ /* 36867 */ case 36867: return ("EXIF DateTimeOriginal"); /* EXIF, The date and time when the original image data was generated. */ /* 36868 */ case 36868: return ("EXIF DateTimeDigitized"); /* EXIF, The date and time when the image was stored as digital data. */ /* 37121 */ case 37121: return ("EXIF ComponentsConfiguration"); /* EXIF, Specific to compressed data; specifies the channels and complements PhotometricInterpretation */ /* 37122 */ case 37122: return ("EXIF CompressedBitsPerPixel"); /* EXIF, Specific to compressed data; states the compressed bits per pixel. */ /* 37377 */ case 37377: return ("EXIF ShutterSpeedValue"); /* EXIF, Shutter speed. */ /* 37378 */ case 37378: return ("EXIF ApertureValue"); /* EXIF, The lens aperture. */ /* 37379 */ case 37379: return ("EXIF BrightnessValue"); /* EXIF, The value of brightness. */ /* 37380 */ case 37380: return ("EXIF ExposureBiasValue"); /* EXIF, The exposure bias. */ /* 37381 */ case 37381: return ("EXIF MaxApertureValue"); /* EXIF, The smallest F number of the lens. */ /* 37382 */ case 37382: return ("EXIF SubjectDistance"); /* EXIF, The distance to the subject, given in meters. */ /* 37383 */ case 37383: return ("EXIF MeteringMode"); /* EXIF, The metering mode. */ /* 37384 */ case 37384: return ("EXIF LightSource"); /* EXIF, The kind of light source. */ /* 37385 */ case 37385: return ("EXIF Flash"); /* EXIF, Indicates the status of flash when the image was shot. */ /* 37386 */ case 37386: return ("EXIF FocalLength"); /* EXIF, The actual focal length of the lens, in mm. */ /* 37387 */ case 37387: return ("FlashEnergy (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37388 */ case 37388: return ("SpatialFrequencyResponse (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37389 */ case 37389: return ("Noise (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37390 */ case 37390: return ("FocalPlaneXResolution (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37391 */ case 37391: return ("FocalPlaneYResolution (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37392 */ case 37392: return ("FocalPlaneResolutionUnit (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37393 */ case 37393: return ("ImageNumber (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37394 */ case 37394: return ("SecurityClassification (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37395 */ case 37395: return ("ImageHistory (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37396 */ case 37396: return ("EXIF SubjectArea"); /* EXIF, Indicates the location and area of the main subject in the overall scene. Similar with SubjectLocation at TIFF/EP */ /* 37397 */ case 37397: return ("ExposureIndex (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37398 */ case 37398: return ("TIFF/EP StandardID"); /* see TIFF/EP ISO12234-2:2001, see http://fileformats.archiveteam.org/wiki/TIFF/EP */ /* 37399 */ case 37399: return ("Sensing Method (TIFF/EP)"); /* see ISO12234-2:2001 for TIFF/EP */ /* 37400 */ case 37400: return ("old Kodak KDC"); /* see 253 && tag == TIFFGetRawTagListEntry( ctif, i )) { return i; }; } */ switch (ctif->tagorder) { case unknown_tag_order: { ctif->tagorder=has_sorted_tags; tag_t last = TIFFGetRawTagListEntry(ctif, 0); for (int i= 1; i < get_ifd0_count( ctif ); i++) { tag_t current = TIFFGetRawTagListEntry( ctif, i ); if (last >= current) { ctif->tagorder=has_unsorted_tags; break; } last = current; }; if (has_sorted_tags == ctif->tagorder) { for (int i= 0; i < get_ifd0_count( ctif ); i++) { tag_t tag = TIFFGetRawTagListEntry( ctif, i ); ctif->tag_cache[tag] = i; } return ctif->tag_cache[tag]; } } break; case has_unsorted_tags: case has_sorted_tags: return ctif->tag_cache[tag]; } return -1; } //------------------------------------------------------------------------------ ret_t check_tag_has_fvalue(ctiff_t * ctif, tag_t tag, float value) { float * valp = NULL; float val; int found=TIFFGetFieldRATIONAL(ctif, tag, &valp); if (1 == found) { val = * valp; if ( fabs(val - value) < 0.01 ) { ret_t res; res.returnmsg=NULL; res.returncode=0; res.count=0; return res; } else { return tif_returns( tag, float2str(value), float2str(val)); } } else { char array[EXPECTSTRLEN]; int written = snprintf(array, sizeof(array), "tag %u should exist, because defined\n", tag); if (written <0) { perror ("could not write string in buffer"); exit( EXIT_FAILURE ); } return tif_fails(array); } } //------------------------------------------------------------------------------ ret_t check_tag_has_u16value(ctiff_t * ctif, tag_t tag, uint16 value) { uint16 * valp = NULL; uint16 val; int found=TIFFGetFieldSHORT(ctif, tag, &valp); if (1 == found) { val = *valp; if ( val == value ) { ret_t res; res.returnmsg=NULL; res.returncode=0; res.count = 0; return res; } else { return tif_returns( tag, int2str(value), int2str(val)); } } else { char array[EXPECTSTRLEN]; int written = snprintf(array, sizeof(array), "tag %u should exist, because defined\n", tag); if (written <0) { perror ("could not write string in buffer"); exit( EXIT_FAILURE ); } return tif_fails(array); } } //------------------------------------------------------------------------------ ret_t check_tag_has_u32value(ctiff_t * ctif, tag_t tag, uint32 value) { uint32 * valp = NULL; uint32 val; int found=TIFFGetFieldLONG(ctif, tag, &valp); if (1 == found) { val = *valp; if ( val == value ) { ret_t res; res.returnmsg=NULL; res.returncode=0; res.count = 0; return res; } else { return tif_returns( tag, int2str(value), int2str(val)); } } else { char array[EXPECTSTRLEN]; int written = snprintf(array, sizeof(array), "tag %u should exist, because defined\n", tag); if (written <0) { perror ("could not write string in buffer"); exit( EXIT_FAILURE ); } return tif_fails(array); } } int parse_header_and_endianess(ctiff_t * ctif) { /* seek the image file directory (bytes 4-7) */ //ct_seek(fd, (off_t) 0, SEEK_SET); if ( ct_seek(ctif, 0, SEEK_SET) != 0) { perror ("TIFF header ct_seek error to 0"); exit( EXIT_FAILURE ); } uint16 header; uint16 magic; int ret; if ( ct_read( ctif, &header, 2) != 2 ) { perror ("TIFF Header ct_read error to magic byte header (first 2 bytes)"); exit( EXIT_FAILURE ); } if (header == 0x4949) ret = 0; /* little endian */ else if (header == 0x4d4d) ret = 1; /* big endian */ else { fprintf (stderr, "TIFF Header error, not Byte Order Bytes for TIFF: 0x%04x\n", header); if (header == 0x4550) fprintf( stderr, "could be a Microsoft Document Image file (little endian), if header begins with by 0x45 0x50 0x2a 0x00\n"); exit(EXIT_FAILURE); } ctif->isbyteswapped = ret; if ( ct_read( ctif, &magic, 2) != 2 ) { perror ("TIFF Header ct_read error to magic byte header (second 2 bytes == 42)"); exit( EXIT_FAILURE ); } uint16 magic2 = magic; if (ret) TIFFSwabShort( &magic2 ); /* big endian */ if (magic2 == 42) { return ret; } else { fprintf (stderr, "TIFF Header error, not a MAGIC BYTE for TIFF: 0x%04x\n", magic); if (magic2==0x002b) fprintf (stderr, "\tbut could be a BigTIFF, see http://www.awaresystems.be/imaging/tiff/bigtiff.html\n"); if (magic2==0x0055) fprintf (stderr, "\tbut could be a Panasonic Raw/RW2, see http://libopenraw.freedesktop.org/wiki/Panasonic_RAW/\n"); if (magic2==0x01bc) fprintf (stderr, "\tbut could be a JPEG XR, see http://www.itu.int/rec/T-REC-T.832\n"); if (magic2==0x314e) fprintf (stderr, "\tbut could be a Navy Image FileFormat, see http://www.navsea.navy.mil/nswc/carderock/tecinfsys/cal-std/doc/28002c.pdf\n"); if (magic2==0x4352) fprintf (stderr, "\tbut could be a DNG camera profile, see http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/products/photoshop/pdfs/dng_spec_1.4.0.0.pdf\n"); if (magic2==0x4f52) fprintf (stderr, "\tbut could be an Olympus ORF, see http://libopenraw.freedesktop.org/wiki/Olympus_ORF/\n"); if (magic2==0x5352) fprintf (stderr, "\tbut could be an Olympus ORF, see http://libopenraw.freedesktop.org/wiki/Olympus_ORF/\n"); exit(EXIT_FAILURE); } } uint32 get_first_IFD(ctiff_t * ctif) { int isByteSwapped = parse_header_and_endianess(ctif); /* seek the image file directory (bytes 4-7) */ if (ct_seek(ctif, 4, SEEK_SET) != 4 ) { perror ("TIFF Header seak error, seek set to byte 4"); exit (EXIT_FAILURE); } uint32 offset; if ( ct_read( ctif, &offset, 4) != 4 ) { perror ("TIFF Header ct_read error, reading 4 bytes from 4"); exit( EXIT_FAILURE ); } if (isByteSwapped) { TIFFSwabLong (&offset); } ctif->ifd0pos=offset; ct_seek(ctif, offset, SEEK_SET); uint16 count; if ( ct_read( ctif, &count, 2) != 2 ) { perror ("TIFF Header ct_read error2, reading ifd0 count (2 bytes)"); exit( EXIT_FAILURE ); } if (is_byteswapped(ctif)) TIFFSwabShort(&count); if (count <= 8) { perror("pointer to IFD0 must be greater than 8, because first 8 Bytes contains the TIFF header"); exit(EXIT_FAILURE); } ctif->ifd0c = count; return offset; } /* scans first IDF and returns count of tags * Hint: sideeffect, if succeed the seek points to beginning of the first * IFD-entry */ int TIFFGetRawTagListCount (ctiff_t * ctif, uint32 ifdpos) { /* parse TIF */ /* seek the image file directory (bytes 4-7) */ uint32 offset = ifdpos; // printf("diroffset to %i (0x%04lx)\n", offset, offset); //printf("byte swapped? %s\n", (TIFFIsByteSwapped(tif)?"true":"false")); /* ct_read and seek to IFD address */ ct_seek(ctif, offset, SEEK_SET); uint16 count; if ( ct_read( ctif, &count, 2) != 2 ) { perror ("TIFF Header ct_read error2"); exit( EXIT_FAILURE ); } if (is_byteswapped(ctif)) TIFFSwabShort(&count); return count; } /* scans first IDF and returns the n-th tag */ tag_t TIFFGetRawTagListEntry( ctiff_t * ctif, int tagidx ) { int byteswapped = is_byteswapped(ctif); int count = get_ifd0_count( ctif); /* ct_read count of tags (2 Bytes) */ int i; /* replace i/o operatrions with in-memory-operations */ uint8 * ifdentries = NULL; ifdentries = malloc ( sizeof(uint8) * 12 * count); ct_seek(ctif, ctif->ifd0pos+2, SEEK_SET); /* IFD0 plus 2byte to get IFD-entries */ if ( ct_read( ctif, ifdentries, 12 * count) != 12*count ) { perror ("TIFF Header ct_read error3"); exit( EXIT_FAILURE ); } uint8 * e = ifdentries; uint16 ret = 0; /* for (i = 0; i= 0); e+=(12*tagidx); uint8 lo = *e; e++; uint8 hi = *e; e++; uint16 tagid = (hi << 8) + lo; if (byteswapped) TIFFSwabShort(&tagid); //printf("tag idx=%i, tag=%u (0x%04x) (0x%02x) (0x%02x)\n", i, tagid, tagid, hi, lo); ret = tagid; LABEL1: /* loop each tag until end or given tag found */ free( ifdentries ); return ret; } #define offset_malloc(fd, of, os, count ) {\ of = NULL; of = malloc ( sizeof(os) * count);\ if ( ct_read( ctif, of, sizeof(os) * count) != sizeof(os) *count ) {\ fprintf(stderr, "TIFF Offset ct_read error, try to read from offset=%li count=%i bytes\n", offset, count);\ exit( EXIT_FAILURE );\ }\ } void offset_swabshort(ctiff_t * ctif, uint16 * address, uint16 count) { if (is_byteswapped(ctif)) for (int i=0; i 0); int byteswapped = is_byteswapped(ctif); #ifdef DEBUG printf(" count of tags = %i\n", tagcount); #endif // int fd = TIFFFileno( tif); //printf("count %i\n", count); /* ct_read count of tags (2 Bytes) */ int i; ifd_entry_t ifd_entry; ifd_entry.value_or_offset = is_error; /* replace i/o operatrions with in-memory-operations */ uint8 * ifdentries = NULL; ifdentries = malloc ( sizeof(uint8) * 12 * tagcount); ct_seek(ctif, ctif->ifd0pos+2, SEEK_SET); /* IFD0 plus 2byte to get IFD-entries */ if ( ct_read( ctif, ifdentries, 12 * tagcount) != 12*tagcount ) { perror ("TIFF Header ct_read error4"); exit( EXIT_FAILURE ); } uint8 * e = ifdentries; for (i = 0; i 4) { /* offset */ ifd_entry.value_or_offset=is_offset; ifd_entry.data32offset=value_or_offset; } else { /* values */ ifd_entry.value_or_offset=is_value; ifd_entry.data8[0] = data[0]; ifd_entry.data8[1] = data[1]; ifd_entry.data8[2] = data[2]; ifd_entry.data8[3] = data[3]; #ifdef DEBUG printf("data8[0]=%u\n", data[0]); printf("data8[1]=%u\n", data[1]); printf("data8[2]=%u\n", data[2]); printf("data8[3]=%u\n", data[3]); #endif }; break; case 3: /* 16-bit unsigned integer */ case 8: /* !16-bit signed integer */ if (count > 2) { /* offset */ ifd_entry.value_or_offset=is_offset; ifd_entry.data32offset=value_or_offset; } else { /* values */ ifd_entry.value_or_offset=is_value; uint16 w0 = (data[0]) + (data[1]<<8); uint16 w1 = (data[2]) + (data[3]<<8); if (byteswapped) { TIFFSwabShort( &w0 ); TIFFSwabShort( &w1 ); } ifd_entry.data16[0] = w0; ifd_entry.data16[1] = w1; #ifdef DEBUG printf("data16[0]=%u\n", w0); printf("data16[1]=%u\n", w1); #endif }; break; case 4: /* 32-bit unsigned integer */ case 9: /* !32-bit signed integer */ if (count > 1) { /* offset */ ifd_entry.value_or_offset=is_offset; ifd_entry.data32offset=value_or_offset; } else { /* values */ ifd_entry.value_or_offset=is_value; ifd_entry.data32=value_or_offset; #ifdef DEBUG printf("data32[0]=%u\n", value_or_offset); #endif }; break; case 5: /* 64-bit unsigned fraction */ case 10: /* !64-bit signed fraction */ case 11: /* !32-bit IEEE floating point */ case 12: /* !64-bit IEEE floating point */ case 13: /* %32-bit unsigned integer (offset) */ case 16: /* BigTIFF 64-bit unsigned integer */ case 17: /* BigTIFF 64-bit signed integer */ case 18: /* BigTIFF 64-bit unsigned integer (offset) */ ifd_entry.value_or_offset=is_offset; ifd_entry.data32offset=value_or_offset; } free( ifdentries ); #ifdef DEBUG printf("tag idx=%i, tag=%u (0x%04x) tagtype=0x%04x is_offset=%s count=%d value_or_offset=0x%08x\n", i, tagid, tagid, tagtype, (ifd_entry.value_or_offset==is_offset ? "true" : "false"), count, value_or_offset); #endif return ifd_entry; } e+=10; } /* loop each tag until end or given tag found */ free( ifdentries ); return ifd_entry; } /* TODO */ ifd_entry_t TIFFGetRawIFDEntry( ctiff_t * ctif, tag_t tag) { int tagidx = -1; for (int i= 0; i < get_ifd0_count( ctif ); i++) { if (tag > 253 && tag == TIFFGetRawTagListEntry( ctif, i )) { tagidx= i; break; }; }; ifd_entry_t ifd_entry; if (tagidx >= 0) { ifd_entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); } else { /* tag not defined */ printf("\ttag %u (%s) was not found, but requested because defined\n", tag, TIFFTagName(tag)); ifd_entry.value_or_offset = is_error; ifd_entry.count = 0; } return ifd_entry; } /* scans first IDF and returns the type of the n-th tag */ uint32 TIFFGetRawTagTypeListEntry( ctiff_t * ctif, int tagidx ) { if (tagidx >= 0) { ifd_entry_t ifd_entry; ifd_entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); return ifd_entry.datatype; } else { /* tag not defined */ fprintf(stderr, "tagidx should be greater equal 0"); exit(EXIT_FAILURE); } } /* ct_reads the datatype of given tag on specified TIFF, * because FieldType of libtiff does not return the true value (because it maps * its own datastructure), we need to use this function instead * @param tif pointer to TIFF structure * @param tag tag * @return datatype of given tag * if tag does not exists the function aborts with an error */ TIFFDataType TIFFGetRawTagType(ctiff_t * ctif, tag_t tag) { int tagidx = -1; for (int i= 0; i < get_ifd0_count( ctif ); i++) { if (tag > 253 && tag == TIFFGetRawTagListEntry( ctif, i )) { tagidx= i; break; }; }; if (tagidx >= 0) { TIFFDataType datatype = TIFFGetRawTagTypeListEntry( ctif, tagidx ); #ifdef DEBUG printf("### datatype=%i \n", datatype); #endif return datatype; } else { /* tag not defined */ printf("\ttag %u (%s) was not found, but requested because defined\n", tag, TIFFTagName(tag)); return -1; } } ctiff_t * initialize_ctif(const char * tiff_file, ct_ioflag_t ioflag) { ctiff_t * ctif = malloc ( sizeof( ctiff_t) ); if (NULL == ctif) { fprintf( stderr, "could not allocate memory for ctiff_t\n"); exit (EXIT_FAILURE); } /* load tiff file */ #ifdef __WIN32__ int tif = open(tiff_file, O_RDONLY | O_BINARY); #else int tif = open(tiff_file, O_RDONLY); #endif if (-1 == tif) { fprintf( stderr, "file '%s' could not be opened\n", tiff_file); exit (EXIT_FAILURE); }; ctif->fd = tif; ctif->streamlen = fsize(tif); ctif->streamp = NULL; ctif->actual_streamp = NULL; ctif->tagorder=unknown_tag_order; for (int i= 0; i < 65536; i++) { ctif->tag_cache[i]= -1; } #ifdef _HAVE__MMAP switch (ioflag) { case is_filep: { /* streamlen */ break; } case is_memmap: { void * tifmap = mmap( NULL, ctif->streamlen, PROT_READ, MAP_PRIVATE, tif, 0 ); if (MAP_FAILED == tifmap) { fprintf( stderr, "file '%s' could not be mem-mapped, %s\n", tiff_file, strerror(errno)); exit (EXIT_FAILURE); }; ctif->streamp=tifmap; ctif->actual_streamp=tifmap; break; } } #endif ctif->ioflag = ioflag; ctif->filename = strdup(tiff_file); ctif->ifd0pos= 0; ctif->ifd0c= 0; parse_header_and_endianess( ctif ); get_first_IFD( ctif ); return ctif; } void free_ctif( ctiff_t * ctif) { assert( NULL != ctif); if (NULL != ctif->filename) free(ctif->filename); ctif->filename=NULL; switch (ctif->ioflag) { case is_filep: { break; } case is_memmap: { /* TODO */ break; } } close(ctif->fd); ctif->fd = -1; free (ctif); ctif = NULL; } uint32 get_ifd0_pos( ctiff_t * ctif ) { assert( NULL != ctif); return ctif->ifd0pos; } uint16 get_ifd0_count( ctiff_t * ctif ) { assert( NULL != ctif); return ctif->ifd0c; } char is_byteswapped( ctiff_t * ctif ) { assert( NULL != ctif); return ctif->isbyteswapped; } uint32 get_next_ifd_pos(ctiff_t * ctif, uint32 actual_pos) { assert( NULL != ctif); ct_seek(ctif, actual_pos, SEEK_SET); uint16 count; if ( ct_read( ctif, &count, 2) != 2 ) { perror ("TIFF Header ct_read error2"); exit( EXIT_FAILURE ); } if (ctif->isbyteswapped) TIFFSwabShort(&count); ct_seek(ctif, 12 * count, SEEK_CUR); uint32 offset; if ( ct_read( ctif, &offset, 4) != 4 ) { perror ("TIFF Header ct_read error3"); exit( EXIT_FAILURE ); } if (ctif->isbyteswapped) TIFFSwabLong(&offset); return offset; } int TIFFGetFieldASCII(ctiff_t * ctif, tag_t tag, char** string_pp) { assert( *string_pp == NULL); int tagidx = TIFFGetRawTagListIndex(ctif, tag); if (tagidx >= 0) { /* there exists the tag */ ifd_entry_t entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); *(string_pp) = malloc( sizeof(char) * entry.count); if (NULL == (* string_pp)) { perror ("could not allocate memory for string_p"); exit( EXIT_FAILURE); } assert (entry.datatype == TIFF_ASCII); if (entry.value_or_offset == is_value) { assert (entry.count >= 0 && entry.count <= 4); for (int i=0; i= 0) { /* there exists the tag */ ifd_entry_t entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); *(long_pp) = malloc( sizeof(uint32) * entry.count); if (NULL == (*long_pp)) { perror ("could not allocate memory for long_p"); exit( EXIT_FAILURE); } assert (entry.datatype == TIFF_LONG); if (entry.value_or_offset == is_value) { assert (entry.count >= 0 && entry.count <= 1); //printf("LONG (direct)=%lu\n", entry.data32); memcpy((void *) (*long_pp), (void *) &entry.data32, (sizeof(uint32)*entry.count)); return (entry.count); } else if (entry.value_or_offset == is_offset) { uint32 data32offset = entry.data32offset; offset_t offset = read_offsetdata( ctif, data32offset, entry.count, entry.datatype); //printf("LONG (offset)=%lu\n", *offset.datacharp); memcpy((void *) (*long_pp), (void *) offset.datacharp, (sizeof(uint32)*offset.count)); free(offset.datacharp); return (entry.count); } } return -1; } int TIFFGetFieldSHORT(ctiff_t * ctif, tag_t tag, uint16 ** short_pp) { assert( *short_pp == NULL); int tagidx = TIFFGetRawTagListIndex(ctif, tag); if (tagidx >= 0) { /* there exists the tag */ ifd_entry_t entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); *(short_pp) = malloc( sizeof(uint16) * entry.count); if (NULL == *(short_pp)) { perror ("could not allocate memory for short_p"); exit( EXIT_FAILURE); } assert (entry.datatype == TIFF_SHORT); if (entry.value_or_offset == is_value) { assert (entry.count >= 0 && entry.count <= 2); memcpy((void *) (*short_pp), (void *) &entry.data16, (sizeof(uint16)*entry.count)); //printf("SHORT (direct)=%u %u\n", entry.data32, **short_pp); return (entry.count); } else if (entry.value_or_offset == is_offset) { uint32 data32offset = entry.data32offset; offset_t offset = read_offsetdata( ctif, data32offset, entry.count, entry.datatype); //printf("SHORT (offset)=%u\n", *offset.datacharp); memcpy((void *) (*short_pp), (void *)offset.datacharp, (sizeof(uint16)*offset.count)); free( offset.datacharp ); offset.datacharp=NULL; return (entry.count); } } return -1; } int TIFFGetFieldRATIONAL(ctiff_t * ctif, tag_t tag, float ** float_pp) { assert( *float_pp == NULL); int tagidx = TIFFGetRawTagListIndex(ctif, tag); if (tagidx >= 0) { /* there exists the tag */ ifd_entry_t entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); // printf("entry.count=%i\n", entry.count); *(float_pp) = malloc( sizeof(float) * (entry.count)); if (NULL == *(float_pp)) { perror ("could not allocate memory for float_p"); exit( EXIT_FAILURE); } assert (entry.datatype == TIFF_RATIONAL); /* rational is defined as 2x32bits */ if (entry.value_or_offset == is_value) { perror ("entry.value_or_offset must be offset"); exit(EXIT_FAILURE); } else if (entry.value_or_offset == is_offset) { uint32 data32offset = entry.data32offset; offset_t offset = read_offsetdata( ctif, data32offset, entry.count, entry.datatype); /* copy to a float */ uint32 numerator = 0; uint32 denominator = 0; uint32 * orig_data32p = offset.data32p; for (int i = 0; i< entry.count; i++) { numerator = *(orig_data32p++); denominator = *(orig_data32p++); //printf("DEBUG: numerator=%i denumeator=%i\n", numerator, denominator); float v; if (denominator == 0) { v=NAN; } else { v = (float) numerator / (float) denominator; } // printf("DEBUG2: *float_pp[%i]=%f (%u / %u)\n", i, v, numerator, denominator); (*(float_pp))[i]=v; } free( offset.data32p ); offset.data32p=NULL; return (entry.count); } } return -1; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/ifdrules/000077500000000000000000000000001304466507300165525ustar00rootroot00000000000000checkit_tiff-0.2.3/src/ifdrules/check_all_IFDs_are_word_aligned.c000066400000000000000000000016561304466507300250450ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include #include /* check if IFDs are word aligned */ ret_t check_all_IFDs_are_word_aligned(ctiff_t * ctif) { //printf("check if all IFDs are word aligned\n"); tif_rules("all IFDs are word aligned"); // assert( NULL != ctif->ifd0p ); uint32 ifd = get_ifd0_pos( ctif ); /* TODO: check all other IFDs, too */ if ( 0 != (ifd & 1)) { // FIXME: tif_fails? char array[VALUESTRLEN]; snprintf(array, sizeof(array), "offset of first IFD points to 0x%08x and is not word-aligned", ifd); return tif_fails(array); } ret_t res; res.returnmsg=NULL; res.returncode=0; return res; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/ifdrules/check_all_offsets_are_used_once_only.c000066400000000000000000000031171304466507300262720ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include /* check if offsets are used only once */ ret_t check_all_offsets_are_used_once_only(ctiff_t * ctif) { //printf("check if all offsets are used once only\n"); tif_rules("all offsets are used once only"); int count = get_ifd0_count( ctif); int tagidx; uint32 offsets[ count ]; uint32 tags[ count ]; int count_of_offsets = 0; int i; for (tagidx = 0; tagidx< count; tagidx++) { offsets[ tagidx ] = 0; tags[ tagidx ] = 0; } for (tagidx = 0; tagidx< count; tagidx++) { ifd_entry_t ifd_entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); if (ifd_entry.value_or_offset==is_offset) { uint32 offset = ifd_entry.data32offset; uint32 tag = TIFFGetRawTagListEntry( ctif, tagidx); for (i=0; i< count_of_offsets; i++) { if (offsets[ i ] == offset) { // FIXME: tif_fails? char array[TIFFAILSTRLEN]; snprintf(array, sizeof(array), "offset of tag %u (%s) points to %08x, which address is used previously by tag %u (%s)", tag, TIFFTagName(tag), offset, tags[i], TIFFTagName(tags[i]) ); return tif_fails(array); } } offsets[ ++count_of_offsets ] = offset; tags[ count_of_offsets ] = tag; } } ret_t res; res.returnmsg=NULL; res.returncode=0; return res; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/ifdrules/check_all_offsets_are_word_aligned.c000066400000000000000000000022521304466507300257220ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include /* check if offsets are word aligned */ ret_t check_all_offsets_are_word_aligned(ctiff_t * ctif) { //printf("check if all offsets are word aligned\n"); tif_rules("all offsets are word aligned"); int count = get_ifd0_count( ctif); int tagidx; for (tagidx = 0; tagidx< count; tagidx++) { ifd_entry_t ifd_entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); if (ifd_entry.value_or_offset==is_offset) { uint32 offset = ifd_entry.data32offset; if ( 0 != (offset & 1)) { uint32 tag = TIFFGetRawTagListEntry( ctif, tagidx); // FIXME: tif_fails? char array[TIFFAILSTRLEN]; snprintf(array, sizeof(array), "pointing to 0x%08x and is not word-aligned", offset); return tif_fails_tag( tag, "word-aligned", array); } } } ret_t res; res.returnmsg=NULL; res.returncode=0; return res; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/ifdrules/check_has_only_one_ifd.c000066400000000000000000000022611304466507300233530ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include /* check if only one IFD exists */ ret_t check_has_only_one_ifd(ctiff_t * ctif) { //printf("check if only one IFD exists\n"); tif_rules("only one IFD exists"); /* next commented lines, because TIFFNumberOfDirectories are in endless loop, * if the TIFF file from https://github.com/EasyinnovaSL/DPFManager/blob/develop/src/test/resources/IFD%20struct/Circular%20E.tif */ /* seek the image file directory (bytes 4-7) */ uint32 offset = get_ifd0_pos(ctif ); uint32 IFDn = get_next_ifd_pos( ctif, offset ); if (0 == IFDn) { ret_t res; res.returnmsg=NULL; res.returncode=0; return res; } else { // FIXME: tif_fails? char array[TIFFAILSTRLEN]; snprintf(array, sizeof(array), "baseline TIFF should have only one IFD, but IFD0 at 0x%08x has pointer to IFDn 0x%08x", offset, IFDn ); return tif_fails( array); } } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/ifdrules/check_tagorder.c000066400000000000000000000034671304466507300216740ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include ret_t check_tagorder(ctiff_t * ctif) { tif_rules("tags are in ascending order"); if (has_sorted_tags != ctif->tagorder) { uint32 offset = get_ifd0_pos(ctif); int count = get_ifd0_count(ctif); /* read count of tags (2 Bytes) */ int i; /* replace i/o operatrions with in-memory-operations */ uint8 * ifdentries = NULL; ifdentries = malloc ( sizeof(uint8) * 12 * count); ct_seek(ctif, offset+2, SEEK_SET); if ( ct_read( ctif, ifdentries, 12 * count) != 12*count ) { perror ("TIFF Header read error5"); exit( EXIT_FAILURE ); } uint8 * e = ifdentries; uint16 lasttag = 0; for (i = 0; i0 && lasttag >= tag) { // printf("tag idx=%i, tag=%u (0x%04x) (0x%02x) (0x%02x)\n", i, tag, tag, hi, lo); free( ifdentries ); // FIXME: tif_fails? char array[TIFFAILSTRLEN]; snprintf(array, sizeof(array), "Invalid TIFF directory; tags are not sorted in ascending order, previous tag:%u (%s) , actual tag:%u (%s) at pos %i of %i\n", lasttag, TIFFTagName(lasttag), tag, TIFFTagName(tag), i, count); return tif_fails(array); } lasttag = tag; e+=10; } /* loop each tag until end or given tag found */ free( ifdentries ); } ret_t res; res.returnmsg=NULL; res.returncode=0; return res; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/parser/000077500000000000000000000000001304466507300162315ustar00rootroot00000000000000checkit_tiff-0.2.3/src/parser/config_dsl.grammar.c000066400000000000000000002250741304466507300221430ustar00rootroot00000000000000/* A recursive-descent parser generated by peg 0.1.15 */ #include #include #include #define YYRULECOUNT 38 #ifndef YY_MALLOC #define YY_MALLOC(C, N) malloc(N) #endif #ifndef YY_REALLOC #define YY_REALLOC(C, P, N) realloc(P, N) #endif #ifndef YY_FREE #define YY_FREE(C, P) free(P) #endif #ifndef YY_LOCAL #define YY_LOCAL(T) static T #endif #ifndef YY_ACTION #define YY_ACTION(T) static T #endif #ifndef YY_RULE #define YY_RULE(T) static T #endif #ifndef YY_PARSE #define YY_PARSE(T) T #endif #ifndef YYPARSE #define YYPARSE yyparse #endif #ifndef YYPARSEFROM #define YYPARSEFROM yyparsefrom #endif #ifndef YYRELEASE #define YYRELEASE yyrelease #endif #ifndef YY_BEGIN #define YY_BEGIN ( yy->__begin= yy->__pos, 1) #endif #ifndef YY_END #define YY_END ( yy->__end= yy->__pos, 1) #endif #ifdef YY_DEBUG # define yyprintf(args) fprintf args #else # define yyprintf(args) #endif #ifndef YYSTYPE #define YYSTYPE int #endif #ifndef YY_STACK_SIZE #define YY_STACK_SIZE 128 #endif #ifndef YY_BUFFER_SIZE #define YY_BUFFER_SIZE 1024 #endif #ifndef YY_PART typedef struct _yycontext yycontext; typedef void (*yyaction)(yycontext *yy, char *yytext, int yyleng); typedef struct _yythunk { int begin, end; yyaction action; struct _yythunk *next; } yythunk; struct _yycontext { char *__buf; int __buflen; int __pos; int __limit; char *__text; int __textlen; int __begin; int __end; int __textmax; yythunk *__thunks; int __thunkslen; int __thunkpos; YYSTYPE __; YYSTYPE *__val; YYSTYPE *__vals; int __valslen; #ifdef YY_CTX_MEMBERS YY_CTX_MEMBERS #endif }; #ifdef YY_CTX_LOCAL #define YY_CTX_PARAM_ yycontext *yyctx, #define YY_CTX_PARAM yycontext *yyctx #define YY_CTX_ARG_ yyctx, #define YY_CTX_ARG yyctx #ifndef YY_INPUT #define YY_INPUT(yy, buf, result, max_size) \ { \ int yyc= getchar(); \ result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \ yyprintf((stderr, "<%c>", yyc)); \ } #endif #else #define YY_CTX_PARAM_ #define YY_CTX_PARAM #define YY_CTX_ARG_ #define YY_CTX_ARG yycontext _yyctx= { 0, 0 }; yycontext *yyctx= &_yyctx; #ifndef YY_INPUT #define YY_INPUT(buf, result, max_size) \ { \ int yyc= getchar(); \ result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \ yyprintf((stderr, "<%c>", yyc)); \ } #endif #endif YY_LOCAL(int) yyrefill(yycontext *yy) { int yyn; while (yy->__buflen - yy->__pos < 512) { yy->__buflen *= 2; yy->__buf= (char *)YY_REALLOC(yy, yy->__buf, yy->__buflen); } #ifdef YY_CTX_LOCAL YY_INPUT(yy, (yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos)); #else YY_INPUT((yy->__buf + yy->__pos), yyn, (yy->__buflen - yy->__pos)); #endif if (!yyn) return 0; yy->__limit += yyn; return 1; } YY_LOCAL(int) yymatchDot(yycontext *yy) { if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; ++yy->__pos; return 1; } YY_LOCAL(int) yymatchChar(yycontext *yy, int c) { if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; if ((unsigned char)yy->__buf[yy->__pos] == c) { ++yy->__pos; yyprintf((stderr, " ok yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos)); return 1; } yyprintf((stderr, " fail yymatchChar(yy, %c) @ %s\n", c, yy->__buf+yy->__pos)); return 0; } YY_LOCAL(int) yymatchString(yycontext *yy, const char *s) { int yysav= yy->__pos; while (*s) { if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; if (yy->__buf[yy->__pos] != *s) { yy->__pos= yysav; return 0; } ++s; ++yy->__pos; } return 1; } YY_LOCAL(int) yymatchClass(yycontext *yy, unsigned char *bits) { int c; if (yy->__pos >= yy->__limit && !yyrefill(yy)) return 0; c= (unsigned char)yy->__buf[yy->__pos]; if (bits[c >> 3] & (1 << (c & 7))) { ++yy->__pos; yyprintf((stderr, " ok yymatchClass @ %s\n", yy->__buf+yy->__pos)); return 1; } yyprintf((stderr, " fail yymatchClass @ %s\n", yy->__buf+yy->__pos)); return 0; } YY_LOCAL(void) yyDo(yycontext *yy, yyaction action, int begin, int end) { while (yy->__thunkpos >= yy->__thunkslen) { yy->__thunkslen *= 2; yy->__thunks= (yythunk *)YY_REALLOC(yy, yy->__thunks, sizeof(yythunk) * yy->__thunkslen); } yy->__thunks[yy->__thunkpos].begin= begin; yy->__thunks[yy->__thunkpos].end= end; yy->__thunks[yy->__thunkpos].action= action; ++yy->__thunkpos; } YY_LOCAL(int) yyText(yycontext *yy, int begin, int end) { int yyleng= end - begin; if (yyleng <= 0) yyleng= 0; else { while (yy->__textlen < (yyleng + 1)) { yy->__textlen *= 2; yy->__text= (char *)YY_REALLOC(yy, yy->__text, yy->__textlen); } memcpy(yy->__text, yy->__buf + begin, yyleng); } yy->__text[yyleng]= '\0'; return yyleng; } YY_LOCAL(void) yyDone(yycontext *yy) { int pos; for (pos= 0; pos < yy->__thunkpos; ++pos) { yythunk *thunk= &yy->__thunks[pos]; int yyleng= thunk->end ? yyText(yy, thunk->begin, thunk->end) : thunk->begin; yyprintf((stderr, "DO [%d] %p %s\n", pos, thunk->action, yy->__text)); thunk->action(yy, yy->__text, yyleng); } yy->__thunkpos= 0; } YY_LOCAL(void) yyCommit(yycontext *yy) { if ((yy->__limit -= yy->__pos)) { memmove(yy->__buf, yy->__buf + yy->__pos, yy->__limit); } yy->__begin -= yy->__pos; yy->__end -= yy->__pos; yy->__pos= yy->__thunkpos= 0; } YY_LOCAL(int) yyAccept(yycontext *yy, int tp0) { if (tp0) { fprintf(stderr, "accept denied at %d\n", tp0); return 0; } else { yyDone(yy); yyCommit(yy); } return 1; } YY_LOCAL(void) yyPush(yycontext *yy, char *text, int count) { yy->__val += count; while (yy->__valslen <= yy->__val - yy->__vals) { long offset= yy->__val - yy->__vals; yy->__valslen *= 2; yy->__vals= (YYSTYPE *)YY_REALLOC(yy, yy->__vals, sizeof(YYSTYPE) * yy->__valslen); yy->__val= yy->__vals + offset; } } YY_LOCAL(void) yyPop(yycontext *yy, char *text, int count) { yy->__val -= count; } YY_LOCAL(void) yySet(yycontext *yy, char *text, int count) { yy->__val[count]= yy->__; } #endif /* YY_PART */ #define YYACCEPT yyAccept(yy, yythunkpos0) YY_RULE(int) yy_EscapedPCRE(yycontext *yy); /* 38 */ YY_RULE(int) yy_PCRE(yycontext *yy); /* 37 */ YY_RULE(int) yy_Value(yycontext *yy); /* 36 */ YY_RULE(int) yy_ValueList(yycontext *yy); /* 35 */ YY_RULE(int) yy_Digit(yycontext *yy); /* 34 */ YY_RULE(int) yy_ValueReference(yycontext *yy); /* 33 */ YY_RULE(int) yy_Dot(yycontext *yy); /* 32 */ YY_RULE(int) yy_OptDepends(yycontext *yy); /* 31 */ YY_RULE(int) yy_IfDepends(yycontext *yy); /* 30 */ YY_RULE(int) yy_Space(yycontext *yy); /* 29 */ YY_RULE(int) yy_TagReference(yycontext *yy); /* 28 */ YY_RULE(int) yy_Content(yycontext *yy); /* 27 */ YY_RULE(int) yy_Requirements(yycontext *yy); /* 26 */ YY_RULE(int) yy_Semicolon(yycontext *yy); /* 25 */ YY_RULE(int) yy_Tag(yycontext *yy); /* 24 */ YY_RULE(int) yy_Colon(yycontext *yy); /* 23 */ YY_RULE(int) yy_RegEx(yycontext *yy); /* 22 */ YY_RULE(int) yy_NTupel(yycontext *yy); /* 21 */ YY_RULE(int) yy_Number(yycontext *yy); /* 20 */ YY_RULE(int) yy_Only(yycontext *yy); /* 19 */ YY_RULE(int) yy_Range(yycontext *yy); /* 18 */ YY_RULE(int) yy_Any(yycontext *yy); /* 17 */ YY_RULE(int) yy_LogicalOrListElement(yycontext *yy); /* 16 */ YY_RULE(int) yy_LogicalOrList(yycontext *yy); /* 15 */ YY_RULE(int) yy_LogicalOr(yycontext *yy); /* 14 */ YY_RULE(int) yy_Mode(yycontext *yy); /* 13 */ YY_RULE(int) yy_ClosingBracket(yycontext *yy); /* 12 */ YY_RULE(int) yy_OpenBracket(yycontext *yy); /* 11 */ YY_RULE(int) yy_MiscUntilEOL(yycontext *yy); /* 10 */ YY_RULE(int) yy_TagLine(yycontext *yy); /* 9 */ YY_RULE(int) yy_IncludeLine(yycontext *yy); /* 8 */ YY_RULE(int) yy_ModeLine(yycontext *yy); /* 7 */ YY_RULE(int) yy_SpaceLine(yycontext *yy); /* 6 */ YY_RULE(int) yy_EndOfLine(yycontext *yy); /* 5 */ YY_RULE(int) yy_CommentLine(yycontext *yy); /* 4 */ YY_RULE(int) yy_EndOfFile(yycontext *yy); /* 3 */ YY_RULE(int) yy_Line(yycontext *yy); /* 2 */ YY_RULE(int) yy_start(yycontext *yy); /* 1 */ YY_ACTION(void) yy_1_EndOfLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_EndOfLine\n")); { incrlineno(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_6_RegEx(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_6_RegEx\n")); { set_parse_error("'regex' expects an open bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_RegEx(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_RegEx\n")); { set_parse_error("'regex' expects an open '\"'", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_RegEx(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_RegEx\n")); { set_parse_error("'regex' expects a PCRE-regex", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_RegEx(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_RegEx\n")); { set_parse_error("'regex' expects a closing '\"'", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_RegEx(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_RegEx\n")); { set_parse_error("'regex' expects a closing bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_RegEx(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_RegEx\n")); { regex_push ( yytext ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_Only(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_Only\n")); { set_parse_error("'only' expects an open bracket", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_Only(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_Only\n")); { set_parse_error("'only' expects a value list", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_Only(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_Only\n")); { set_parse_error("'only' expects a closing bracket", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Only(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Only\n")); { ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_7_ValueReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_7_ValueReference\n")); { set_parse_error("value reference error: '%s'", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_6_ValueReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_6_ValueReference\n")); { parser_state.any_reference = only_ref; ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_ValueReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_ValueReference\n")); { parser_state.any_reference = ntupel_ref; ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_ValueReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_ValueReference\n")); { parser_state.any_reference = range_ref; ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_ValueReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_ValueReference\n")); { parser_state.any_reference = regex_ref; ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_ValueReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_ValueReference\n")); { parser_state.any_reference = only_ref; i_push(atol(yytext) );; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_ValueReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_ValueReference\n")); { parser_state.any_reference = any_ref; ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_NTupel(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_NTupel\n")); { set_parse_error("'ntupel' expects an open bracket", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_NTupel(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_NTupel\n")); { set_parse_error("'ntupel' expects a value list", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_NTupel(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_NTupel\n")); { set_parse_error("'ntupel' expects a closing bracket", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_NTupel(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_NTupel\n")); { int v=parser_state.valuelist; i_push(v); reset_valuelist(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Value(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Value\n")); { incr_values(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Dot(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Dot\n")); { set_parse_error("missed dot", yytext); } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Colon(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Colon\n")); { set_parse_error("missed colon", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_Number(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_Number\n")); { i_push(atol(yytext) );; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_Number(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_Number\n")); { i_push(2<__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Number\n")); { i_push(strtol(yytext, NULL, 0) ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_Range(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_Range\n")); { set_parse_error("'range' expects an open bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_Range(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_Range\n")); { set_parse_error("'range' expects a number", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_Range(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_Range\n")); { set_parse_error("'range' expects a colon", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_Range(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_Range\n")); { set_parse_error("'range' expects a number", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Range(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Range\n")); { set_parse_error("'range' expects a closing bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_6_Content(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_6_Content\n")); { set_parse_error("wrong values-keyword", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_Content(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_Content\n")); { v_push( regex ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_Content(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_Content\n")); { v_push( ntupel ); reset_valuelist() ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_Content(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_Content\n")); { v_push( only ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_Content(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_Content\n")); { v_push( range); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Content(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Content\n")); { v_push( any ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_OptDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_OptDepends\n")); { set_parse_error("'optdepends' expects an open bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_OptDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_OptDepends\n")); { set_parse_error("'optdepends' expects a tagreference", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_OptDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_OptDepends\n")); { set_parse_error("'optdepends' expects a dot", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_OptDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_OptDepends\n")); { set_parse_error("'optdepends' expects a value reference", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_OptDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_OptDepends\n")); { set_parse_error("'optdepends' expects a closing bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_IfDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_IfDepends\n")); { set_parse_error("'depends' expects an open bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_IfDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_IfDepends\n")); { set_parse_error("'depends' expects a tagreference", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_IfDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_IfDepends\n")); { set_parse_error("'depends' expects a dot", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_IfDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_IfDepends\n")); { set_parse_error("'depends' expects a value reference", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_IfDepends(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_IfDepends\n")); { set_parse_error("'depends' expects a closing bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_Requirements(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_Requirements\n")); { set_parse_error("wrong requirements-keyword", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_Requirements(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_Requirements\n")); { set_optional(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_Requirements(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_Requirements\n")); { set_optdepends(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_Requirements(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_Requirements\n")); { set_ifdepends(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Requirements(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Requirements\n")); { set_mandatory(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Semicolon(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Semicolon\n")); { set_parse_error("missed semicolon", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_TagReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_TagReference\n")); { set_parse_error("wrong tagreference", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_TagReference(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_TagReference\n")); { int tag = i_pop(); if (tag < 254) set_parse_error("wrong tagreference (should be >253)", yytext); else if (tag > 65535) set_parse_error("wrong tagreference (should be <65536)", yytext); else settagref( tag ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Tag(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Tag\n")); { int tag = i_pop(); /* rule_tagorder_in_dsl( tag ); */ if (tag < 254) set_parse_error("wrong tag (should be >253)", yytext); else if (tag > 65535) set_parse_error("wrong tag (should be <65536)", yytext); else settag( tag ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_TagLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_TagLine\n")); { set_parse_error("tagline expects missed semicolon here", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_TagLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_TagLine\n")); { set_parse_error("tagline requires a requiemrent-keyword (mandatory, etc.)",yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_TagLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_TagLine\n")); { set_parse_error("tagline expects missed semicolon here", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_TagLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_TagLine\n")); { set_parse_error("tagline requires content", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_TagLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_TagLine\n")); { rule_addtag_config(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Mode(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Mode\n")); { set_parse_error("mode expects either 'baseline' or 'enhanced'", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_7_LogicalOrListElement(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_7_LogicalOrListElement\n")); { set_parse_error("wrong values-keyword", yytext);; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_6_LogicalOrListElement(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_6_LogicalOrListElement\n")); { v_push( regex );incr_logical_elements(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_5_LogicalOrListElement(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_5_LogicalOrListElement\n")); { v_push( ntupel); reset_valuelist(); incr_logical_elements(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_LogicalOrListElement(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_LogicalOrListElement\n")); { v_push( only );incr_logical_elements(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_LogicalOrListElement(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_LogicalOrListElement\n")); { v_push( only );incr_logical_elements(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_LogicalOrListElement(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_LogicalOrListElement\n")); { v_push( range);incr_logical_elements(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_LogicalOrListElement(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_LogicalOrListElement\n")); { v_push( any );incr_logical_elements(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_LogicalOr(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_LogicalOr\n")); { rule_add_logical_config(); reset_logical_list();; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_4_ModeLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_4_ModeLine\n")); { set_parse_error( "modeline requires an open bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_3_ModeLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_3_ModeLine\n")); { set_parse_error( "modeline requires a mode", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_2_ModeLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_2_ModeLine\n")); { set_parse_error( "modeline expects a closing bracket", yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_ModeLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_ModeLine\n")); { set_mode( yytext ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_IncludeLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_IncludeLine\n")); { set_include ( yytext ); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_CommentLine(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_CommentLine\n")); { commentline(); ; } #undef yythunkpos #undef yypos #undef yy } YY_ACTION(void) yy_1_Line(yycontext *yy, char *yytext, int yyleng) { #define __ yy->__ #define yypos yy->__pos #define yythunkpos yy->__thunkpos yyprintf((stderr, "do yy_1_Line\n")); { set_parse_error("wrong line entry",yytext); ; } #undef yythunkpos #undef yypos #undef yy } YY_RULE(int) yy_EscapedPCRE(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "EscapedPCRE")); { int yypos2= yy->__pos, yythunkpos2= yy->__thunkpos; if (!yymatchChar(yy, '\\')) goto l3; if (!yymatchChar(yy, '\\')) goto l3; goto l2; l3:; yy->__pos= yypos2; yy->__thunkpos= yythunkpos2; if (!yymatchChar(yy, '\\')) goto l1; if (!yymatchChar(yy, '"')) goto l1; } l2:; yyprintf((stderr, " ok %s @ %s\n", "EscapedPCRE", yy->__buf+yy->__pos)); return 1; l1:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "EscapedPCRE", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_PCRE(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "PCRE")); { int yypos5= yy->__pos, yythunkpos5= yy->__thunkpos; if (!yy_EscapedPCRE(yy)) goto l6; goto l5; l6:; yy->__pos= yypos5; yy->__thunkpos= yythunkpos5; if (!yymatchClass(yy, (unsigned char *)"\377\377\377\377\373\377\377\377\377\377\377\357\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l4; } l5:; yyprintf((stderr, " ok %s @ %s\n", "PCRE", yy->__buf+yy->__pos)); return 1; l4:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "PCRE", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Value(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Value")); if (!yy_Number(yy)) goto l7; yyDo(yy, yy_1_Value, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "Value", yy->__buf+yy->__pos)); return 1; l7:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Value", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_ValueList(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "ValueList")); if (!yy_Value(yy)) goto l8; l9:; { int yypos10= yy->__pos, yythunkpos10= yy->__thunkpos; if (!yy_Colon(yy)) goto l10; if (!yy_Value(yy)) goto l10; goto l9; l10:; yy->__pos= yypos10; yy->__thunkpos= yythunkpos10; } yyprintf((stderr, " ok %s @ %s\n", "ValueList", yy->__buf+yy->__pos)); return 1; l8:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "ValueList", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Digit(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Digit")); if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l11; yyprintf((stderr, " ok %s @ %s\n", "Digit", yy->__buf+yy->__pos)); return 1; l11:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Digit", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_ValueReference(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "ValueReference")); { int yypos13= yy->__pos, yythunkpos13= yy->__thunkpos; if (!yy_Any(yy)) goto l14; yyDo(yy, yy_1_ValueReference, yy->__begin, yy->__end); goto l13; l14:; yy->__pos= yypos13; yy->__thunkpos= yythunkpos13; if (!yy_Number(yy)) goto l15; yyDo(yy, yy_2_ValueReference, yy->__begin, yy->__end); goto l13; l15:; yy->__pos= yypos13; yy->__thunkpos= yythunkpos13; if (!yy_RegEx(yy)) goto l16; yyDo(yy, yy_3_ValueReference, yy->__begin, yy->__end); goto l13; l16:; yy->__pos= yypos13; yy->__thunkpos= yythunkpos13; if (!yy_Range(yy)) goto l17; yyDo(yy, yy_4_ValueReference, yy->__begin, yy->__end); goto l13; l17:; yy->__pos= yypos13; yy->__thunkpos= yythunkpos13; if (!yy_NTupel(yy)) goto l18; yyDo(yy, yy_5_ValueReference, yy->__begin, yy->__end); goto l13; l18:; yy->__pos= yypos13; yy->__thunkpos= yythunkpos13; if (!yy_Only(yy)) goto l19; yyDo(yy, yy_6_ValueReference, yy->__begin, yy->__end); goto l13; l19:; yy->__pos= yypos13; yy->__thunkpos= yythunkpos13; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l12; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l12; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l12; #undef yytext #undef yyleng } yyDo(yy, yy_7_ValueReference, yy->__begin, yy->__end); } l13:; yyprintf((stderr, " ok %s @ %s\n", "ValueReference", yy->__buf+yy->__pos)); return 1; l12:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "ValueReference", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Dot(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Dot")); { int yypos21= yy->__pos, yythunkpos21= yy->__thunkpos; if (!yymatchChar(yy, '.')) goto l22; l23:; { int yypos24= yy->__pos, yythunkpos24= yy->__thunkpos; if (!yy_Space(yy)) goto l24; goto l23; l24:; yy->__pos= yypos24; yy->__thunkpos= yythunkpos24; } goto l21; l22:; yy->__pos= yypos21; yy->__thunkpos= yythunkpos21; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l20; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l20; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l20; #undef yytext #undef yyleng } yyDo(yy, yy_1_Dot, yy->__begin, yy->__end); } l21:; yyprintf((stderr, " ok %s @ %s\n", "Dot", yy->__buf+yy->__pos)); return 1; l20:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Dot", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_OptDepends(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "OptDepends")); { int yypos26= yy->__pos, yythunkpos26= yy->__thunkpos; if (!yymatchString(yy, "optdepends")) goto l27; if (!yy_OpenBracket(yy)) goto l27; if (!yy_TagReference(yy)) goto l27; if (!yy_Dot(yy)) goto l27; if (!yy_ValueReference(yy)) goto l27; if (!yy_ClosingBracket(yy)) goto l27; goto l26; l27:; yy->__pos= yypos26; yy->__thunkpos= yythunkpos26; if (!yymatchString(yy, "optdepends")) goto l28; if (!yy_OpenBracket(yy)) goto l28; if (!yy_TagReference(yy)) goto l28; if (!yy_Dot(yy)) goto l28; if (!yy_ValueReference(yy)) goto l28; yyDo(yy, yy_1_OptDepends, yy->__begin, yy->__end); goto l26; l28:; yy->__pos= yypos26; yy->__thunkpos= yythunkpos26; if (!yymatchString(yy, "optdepends")) goto l29; if (!yy_OpenBracket(yy)) goto l29; if (!yy_TagReference(yy)) goto l29; if (!yy_Dot(yy)) goto l29; yyDo(yy, yy_2_OptDepends, yy->__begin, yy->__end); goto l26; l29:; yy->__pos= yypos26; yy->__thunkpos= yythunkpos26; if (!yymatchString(yy, "optdepends")) goto l30; if (!yy_OpenBracket(yy)) goto l30; if (!yy_TagReference(yy)) goto l30; yyDo(yy, yy_3_OptDepends, yy->__begin, yy->__end); goto l26; l30:; yy->__pos= yypos26; yy->__thunkpos= yythunkpos26; if (!yymatchString(yy, "optdepends")) goto l31; if (!yy_OpenBracket(yy)) goto l31; yyDo(yy, yy_4_OptDepends, yy->__begin, yy->__end); goto l26; l31:; yy->__pos= yypos26; yy->__thunkpos= yythunkpos26; if (!yymatchString(yy, "optdepends")) goto l25; yyDo(yy, yy_5_OptDepends, yy->__begin, yy->__end); } l26:; yyprintf((stderr, " ok %s @ %s\n", "OptDepends", yy->__buf+yy->__pos)); return 1; l25:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "OptDepends", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_IfDepends(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "IfDepends")); { int yypos33= yy->__pos, yythunkpos33= yy->__thunkpos; if (!yymatchString(yy, "depends")) goto l34; if (!yy_OpenBracket(yy)) goto l34; if (!yy_TagReference(yy)) goto l34; if (!yy_Dot(yy)) goto l34; if (!yy_ValueReference(yy)) goto l34; if (!yy_ClosingBracket(yy)) goto l34; goto l33; l34:; yy->__pos= yypos33; yy->__thunkpos= yythunkpos33; if (!yymatchString(yy, "depends")) goto l35; if (!yy_OpenBracket(yy)) goto l35; if (!yy_TagReference(yy)) goto l35; if (!yy_Dot(yy)) goto l35; if (!yy_ValueReference(yy)) goto l35; yyDo(yy, yy_1_IfDepends, yy->__begin, yy->__end); goto l33; l35:; yy->__pos= yypos33; yy->__thunkpos= yythunkpos33; if (!yymatchString(yy, "depends")) goto l36; if (!yy_OpenBracket(yy)) goto l36; if (!yy_TagReference(yy)) goto l36; if (!yy_Dot(yy)) goto l36; yyDo(yy, yy_2_IfDepends, yy->__begin, yy->__end); goto l33; l36:; yy->__pos= yypos33; yy->__thunkpos= yythunkpos33; if (!yymatchString(yy, "depends")) goto l37; if (!yy_OpenBracket(yy)) goto l37; if (!yy_TagReference(yy)) goto l37; yyDo(yy, yy_3_IfDepends, yy->__begin, yy->__end); goto l33; l37:; yy->__pos= yypos33; yy->__thunkpos= yythunkpos33; if (!yymatchString(yy, "depends")) goto l38; if (!yy_OpenBracket(yy)) goto l38; yyDo(yy, yy_4_IfDepends, yy->__begin, yy->__end); goto l33; l38:; yy->__pos= yypos33; yy->__thunkpos= yythunkpos33; if (!yymatchString(yy, "depends")) goto l32; yyDo(yy, yy_5_IfDepends, yy->__begin, yy->__end); } l33:; yyprintf((stderr, " ok %s @ %s\n", "IfDepends", yy->__buf+yy->__pos)); return 1; l32:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "IfDepends", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Space(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Space")); { int yypos40= yy->__pos, yythunkpos40= yy->__thunkpos; if (!yymatchChar(yy, ' ')) goto l41; goto l40; l41:; yy->__pos= yypos40; yy->__thunkpos= yythunkpos40; if (!yymatchChar(yy, '\t')) goto l39; } l40:; yyprintf((stderr, " ok %s @ %s\n", "Space", yy->__buf+yy->__pos)); return 1; l39:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Space", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_TagReference(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "TagReference")); { int yypos43= yy->__pos, yythunkpos43= yy->__thunkpos; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l44; #undef yytext #undef yyleng } if (!yy_Number(yy)) goto l44; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l44; #undef yytext #undef yyleng } yyDo(yy, yy_1_TagReference, yy->__begin, yy->__end); goto l43; l44:; yy->__pos= yypos43; yy->__thunkpos= yythunkpos43; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l42; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l42; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l42; #undef yytext #undef yyleng } yyDo(yy, yy_2_TagReference, yy->__begin, yy->__end); } l43:; yyprintf((stderr, " ok %s @ %s\n", "TagReference", yy->__buf+yy->__pos)); return 1; l42:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "TagReference", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Content(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Content")); { int yypos46= yy->__pos, yythunkpos46= yy->__thunkpos; if (!yy_Any(yy)) goto l47; yyDo(yy, yy_1_Content, yy->__begin, yy->__end); goto l46; l47:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; if (!yy_Range(yy)) goto l48; yyDo(yy, yy_2_Content, yy->__begin, yy->__end); goto l46; l48:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; if (!yy_LogicalOr(yy)) goto l49; goto l46; l49:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; if (!yy_Only(yy)) goto l50; yyDo(yy, yy_3_Content, yy->__begin, yy->__end); goto l46; l50:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; if (!yy_NTupel(yy)) goto l51; yyDo(yy, yy_4_Content, yy->__begin, yy->__end); goto l46; l51:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; if (!yy_RegEx(yy)) goto l52; yyDo(yy, yy_5_Content, yy->__begin, yy->__end); goto l46; l52:; yy->__pos= yypos46; yy->__thunkpos= yythunkpos46; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l45; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l45; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l45; #undef yytext #undef yyleng } yyDo(yy, yy_6_Content, yy->__begin, yy->__end); } l46:; yyprintf((stderr, " ok %s @ %s\n", "Content", yy->__buf+yy->__pos)); return 1; l45:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Content", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Requirements(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Requirements")); { int yypos54= yy->__pos, yythunkpos54= yy->__thunkpos; if (!yymatchString(yy, "mandatory")) goto l55; yyDo(yy, yy_1_Requirements, yy->__begin, yy->__end); goto l54; l55:; yy->__pos= yypos54; yy->__thunkpos= yythunkpos54; if (!yy_IfDepends(yy)) goto l56; yyDo(yy, yy_2_Requirements, yy->__begin, yy->__end); goto l54; l56:; yy->__pos= yypos54; yy->__thunkpos= yythunkpos54; if (!yy_OptDepends(yy)) goto l57; yyDo(yy, yy_3_Requirements, yy->__begin, yy->__end); goto l54; l57:; yy->__pos= yypos54; yy->__thunkpos= yythunkpos54; if (!yymatchString(yy, "optional")) goto l58; yyDo(yy, yy_4_Requirements, yy->__begin, yy->__end); goto l54; l58:; yy->__pos= yypos54; yy->__thunkpos= yythunkpos54; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l53; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l53; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l53; #undef yytext #undef yyleng } yyDo(yy, yy_5_Requirements, yy->__begin, yy->__end); } l54:; yyprintf((stderr, " ok %s @ %s\n", "Requirements", yy->__buf+yy->__pos)); return 1; l53:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Requirements", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Semicolon(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Semicolon")); { int yypos60= yy->__pos, yythunkpos60= yy->__thunkpos; if (!yymatchChar(yy, ';')) goto l61; l62:; { int yypos63= yy->__pos, yythunkpos63= yy->__thunkpos; if (!yy_Space(yy)) goto l63; goto l62; l63:; yy->__pos= yypos63; yy->__thunkpos= yythunkpos63; } goto l60; l61:; yy->__pos= yypos60; yy->__thunkpos= yythunkpos60; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l59; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l59; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l59; #undef yytext #undef yyleng } yyDo(yy, yy_1_Semicolon, yy->__begin, yy->__end); } l60:; yyprintf((stderr, " ok %s @ %s\n", "Semicolon", yy->__buf+yy->__pos)); return 1; l59:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Semicolon", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Tag(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Tag")); yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l64; #undef yytext #undef yyleng } if (!yy_Number(yy)) goto l64; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l64; #undef yytext #undef yyleng } yyDo(yy, yy_1_Tag, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "Tag", yy->__buf+yy->__pos)); return 1; l64:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Tag", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Colon(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Colon")); { int yypos66= yy->__pos, yythunkpos66= yy->__thunkpos; if (!yymatchChar(yy, ',')) goto l67; l68:; { int yypos69= yy->__pos, yythunkpos69= yy->__thunkpos; if (!yy_Space(yy)) goto l69; goto l68; l69:; yy->__pos= yypos69; yy->__thunkpos= yythunkpos69; } goto l66; l67:; yy->__pos= yypos66; yy->__thunkpos= yythunkpos66; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l65; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l65; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l65; #undef yytext #undef yyleng } yyDo(yy, yy_1_Colon, yy->__begin, yy->__end); } l66:; yyprintf((stderr, " ok %s @ %s\n", "Colon", yy->__buf+yy->__pos)); return 1; l65:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Colon", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_RegEx(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "RegEx")); { int yypos71= yy->__pos, yythunkpos71= yy->__thunkpos; if (!yymatchString(yy, "regex")) goto l72; if (!yy_OpenBracket(yy)) goto l72; if (!yymatchChar(yy, '"')) goto l72; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l72; #undef yytext #undef yyleng } l73:; { int yypos74= yy->__pos, yythunkpos74= yy->__thunkpos; if (!yy_PCRE(yy)) goto l74; goto l73; l74:; yy->__pos= yypos74; yy->__thunkpos= yythunkpos74; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l72; #undef yytext #undef yyleng } if (!yymatchChar(yy, '"')) goto l72; if (!yy_ClosingBracket(yy)) goto l72; yyDo(yy, yy_1_RegEx, yy->__begin, yy->__end); goto l71; l72:; yy->__pos= yypos71; yy->__thunkpos= yythunkpos71; if (!yymatchString(yy, "regex")) goto l75; if (!yy_OpenBracket(yy)) goto l75; if (!yymatchChar(yy, '"')) goto l75; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l75; #undef yytext #undef yyleng } l76:; { int yypos77= yy->__pos, yythunkpos77= yy->__thunkpos; if (!yy_PCRE(yy)) goto l77; goto l76; l77:; yy->__pos= yypos77; yy->__thunkpos= yythunkpos77; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l75; #undef yytext #undef yyleng } if (!yymatchChar(yy, '"')) goto l75; yyDo(yy, yy_2_RegEx, yy->__begin, yy->__end); goto l71; l75:; yy->__pos= yypos71; yy->__thunkpos= yythunkpos71; if (!yymatchString(yy, "regex")) goto l78; if (!yy_OpenBracket(yy)) goto l78; if (!yymatchChar(yy, '"')) goto l78; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l78; #undef yytext #undef yyleng } l79:; { int yypos80= yy->__pos, yythunkpos80= yy->__thunkpos; if (!yy_PCRE(yy)) goto l80; goto l79; l80:; yy->__pos= yypos80; yy->__thunkpos= yythunkpos80; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l78; #undef yytext #undef yyleng } yyDo(yy, yy_3_RegEx, yy->__begin, yy->__end); goto l71; l78:; yy->__pos= yypos71; yy->__thunkpos= yythunkpos71; if (!yymatchString(yy, "regex")) goto l81; if (!yy_OpenBracket(yy)) goto l81; if (!yymatchChar(yy, '"')) goto l81; yyDo(yy, yy_4_RegEx, yy->__begin, yy->__end); goto l71; l81:; yy->__pos= yypos71; yy->__thunkpos= yythunkpos71; if (!yymatchString(yy, "regex")) goto l82; if (!yy_OpenBracket(yy)) goto l82; yyDo(yy, yy_5_RegEx, yy->__begin, yy->__end); goto l71; l82:; yy->__pos= yypos71; yy->__thunkpos= yythunkpos71; if (!yymatchString(yy, "regex")) goto l70; yyDo(yy, yy_6_RegEx, yy->__begin, yy->__end); } l71:; yyprintf((stderr, " ok %s @ %s\n", "RegEx", yy->__buf+yy->__pos)); return 1; l70:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "RegEx", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_NTupel(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "NTupel")); { int yypos84= yy->__pos, yythunkpos84= yy->__thunkpos; if (!yymatchString(yy, "ntupel")) goto l85; if (!yy_OpenBracket(yy)) goto l85; if (!yy_ValueList(yy)) goto l85; if (!yy_ClosingBracket(yy)) goto l85; yyDo(yy, yy_1_NTupel, yy->__begin, yy->__end); goto l84; l85:; yy->__pos= yypos84; yy->__thunkpos= yythunkpos84; if (!yymatchString(yy, "ntupel")) goto l86; if (!yy_OpenBracket(yy)) goto l86; if (!yy_ValueList(yy)) goto l86; yyDo(yy, yy_2_NTupel, yy->__begin, yy->__end); goto l84; l86:; yy->__pos= yypos84; yy->__thunkpos= yythunkpos84; if (!yymatchString(yy, "ntupel")) goto l87; if (!yy_OpenBracket(yy)) goto l87; yyDo(yy, yy_3_NTupel, yy->__begin, yy->__end); goto l84; l87:; yy->__pos= yypos84; yy->__thunkpos= yythunkpos84; if (!yymatchString(yy, "ntupel")) goto l83; yyDo(yy, yy_4_NTupel, yy->__begin, yy->__end); } l84:; yyprintf((stderr, " ok %s @ %s\n", "NTupel", yy->__buf+yy->__pos)); return 1; l83:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "NTupel", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Number(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Number")); { int yypos89= yy->__pos, yythunkpos89= yy->__thunkpos; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l90; #undef yytext #undef yyleng } if (!yymatchString(yy, "0x")) goto l90; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l90; l91:; { int yypos92= yy->__pos, yythunkpos92= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\000\377\003\000\000\000\000\176\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l92; goto l91; l92:; yy->__pos= yypos92; yy->__thunkpos= yythunkpos92; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l90; #undef yytext #undef yyleng } yyDo(yy, yy_1_Number, yy->__begin, yy->__end); goto l89; l90:; yy->__pos= yypos89; yy->__thunkpos= yythunkpos89; if (!yymatchString(yy, "2^")) goto l93; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l93; #undef yytext #undef yyleng } if (!yy_Digit(yy)) goto l93; l94:; { int yypos95= yy->__pos, yythunkpos95= yy->__thunkpos; if (!yy_Digit(yy)) goto l95; goto l94; l95:; yy->__pos= yypos95; yy->__thunkpos= yythunkpos95; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l93; #undef yytext #undef yyleng } yyDo(yy, yy_2_Number, yy->__begin, yy->__end); goto l89; l93:; yy->__pos= yypos89; yy->__thunkpos= yythunkpos89; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l88; #undef yytext #undef yyleng } if (!yy_Digit(yy)) goto l88; l96:; { int yypos97= yy->__pos, yythunkpos97= yy->__thunkpos; if (!yy_Digit(yy)) goto l97; goto l96; l97:; yy->__pos= yypos97; yy->__thunkpos= yythunkpos97; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l88; #undef yytext #undef yyleng } yyDo(yy, yy_3_Number, yy->__begin, yy->__end); } l89:; yyprintf((stderr, " ok %s @ %s\n", "Number", yy->__buf+yy->__pos)); return 1; l88:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Number", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Only(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Only")); { int yypos99= yy->__pos, yythunkpos99= yy->__thunkpos; if (!yymatchString(yy, "only")) goto l100; if (!yy_OpenBracket(yy)) goto l100; if (!yy_Number(yy)) goto l100; if (!yy_ClosingBracket(yy)) goto l100; yyDo(yy, yy_1_Only, yy->__begin, yy->__end); goto l99; l100:; yy->__pos= yypos99; yy->__thunkpos= yythunkpos99; if (!yymatchString(yy, "only")) goto l101; if (!yy_OpenBracket(yy)) goto l101; if (!yy_Number(yy)) goto l101; yyDo(yy, yy_2_Only, yy->__begin, yy->__end); goto l99; l101:; yy->__pos= yypos99; yy->__thunkpos= yythunkpos99; if (!yymatchString(yy, "only")) goto l102; if (!yy_OpenBracket(yy)) goto l102; yyDo(yy, yy_3_Only, yy->__begin, yy->__end); goto l99; l102:; yy->__pos= yypos99; yy->__thunkpos= yythunkpos99; if (!yymatchString(yy, "only")) goto l98; yyDo(yy, yy_4_Only, yy->__begin, yy->__end); } l99:; yyprintf((stderr, " ok %s @ %s\n", "Only", yy->__buf+yy->__pos)); return 1; l98:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Only", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Range(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Range")); { int yypos104= yy->__pos, yythunkpos104= yy->__thunkpos; if (!yymatchString(yy, "range")) goto l105; if (!yy_OpenBracket(yy)) goto l105; if (!yy_Number(yy)) goto l105; if (!yy_Colon(yy)) goto l105; if (!yy_Number(yy)) goto l105; if (!yy_ClosingBracket(yy)) goto l105; goto l104; l105:; yy->__pos= yypos104; yy->__thunkpos= yythunkpos104; if (!yymatchString(yy, "range")) goto l106; if (!yy_OpenBracket(yy)) goto l106; if (!yy_Number(yy)) goto l106; if (!yy_Colon(yy)) goto l106; if (!yy_Number(yy)) goto l106; yyDo(yy, yy_1_Range, yy->__begin, yy->__end); goto l104; l106:; yy->__pos= yypos104; yy->__thunkpos= yythunkpos104; if (!yymatchString(yy, "range")) goto l107; if (!yy_OpenBracket(yy)) goto l107; if (!yy_Number(yy)) goto l107; if (!yy_Colon(yy)) goto l107; yyDo(yy, yy_2_Range, yy->__begin, yy->__end); goto l104; l107:; yy->__pos= yypos104; yy->__thunkpos= yythunkpos104; if (!yymatchString(yy, "range")) goto l108; if (!yy_OpenBracket(yy)) goto l108; if (!yy_Number(yy)) goto l108; yyDo(yy, yy_3_Range, yy->__begin, yy->__end); goto l104; l108:; yy->__pos= yypos104; yy->__thunkpos= yythunkpos104; if (!yymatchString(yy, "range")) goto l109; if (!yy_OpenBracket(yy)) goto l109; yyDo(yy, yy_4_Range, yy->__begin, yy->__end); goto l104; l109:; yy->__pos= yypos104; yy->__thunkpos= yythunkpos104; if (!yymatchString(yy, "range")) goto l103; yyDo(yy, yy_5_Range, yy->__begin, yy->__end); } l104:; yyprintf((stderr, " ok %s @ %s\n", "Range", yy->__buf+yy->__pos)); return 1; l103:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Range", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Any(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Any")); if (!yymatchString(yy, "any")) goto l110; yyprintf((stderr, " ok %s @ %s\n", "Any", yy->__buf+yy->__pos)); return 1; l110:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Any", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_LogicalOrListElement(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "LogicalOrListElement")); { int yypos112= yy->__pos, yythunkpos112= yy->__thunkpos; if (!yy_Any(yy)) goto l113; yyDo(yy, yy_1_LogicalOrListElement, yy->__begin, yy->__end); goto l112; l113:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_Range(yy)) goto l114; yyDo(yy, yy_2_LogicalOrListElement, yy->__begin, yy->__end); goto l112; l114:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_Only(yy)) goto l115; yyDo(yy, yy_3_LogicalOrListElement, yy->__begin, yy->__end); goto l112; l115:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_Number(yy)) goto l116; yyDo(yy, yy_4_LogicalOrListElement, yy->__begin, yy->__end); goto l112; l116:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_NTupel(yy)) goto l117; yyDo(yy, yy_5_LogicalOrListElement, yy->__begin, yy->__end); goto l112; l117:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; if (!yy_RegEx(yy)) goto l118; yyDo(yy, yy_6_LogicalOrListElement, yy->__begin, yy->__end); goto l112; l118:; yy->__pos= yypos112; yy->__thunkpos= yythunkpos112; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l111; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l111; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l111; #undef yytext #undef yyleng } yyDo(yy, yy_7_LogicalOrListElement, yy->__begin, yy->__end); } l112:; yyprintf((stderr, " ok %s @ %s\n", "LogicalOrListElement", yy->__buf+yy->__pos)); return 1; l111:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "LogicalOrListElement", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_LogicalOrList(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "LogicalOrList")); if (!yy_LogicalOrListElement(yy)) goto l119; l120:; { int yypos121= yy->__pos, yythunkpos121= yy->__thunkpos; if (!yy_Colon(yy)) goto l121; if (!yy_LogicalOrListElement(yy)) goto l121; goto l120; l121:; yy->__pos= yypos121; yy->__thunkpos= yythunkpos121; } yyprintf((stderr, " ok %s @ %s\n", "LogicalOrList", yy->__buf+yy->__pos)); return 1; l119:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "LogicalOrList", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_LogicalOr(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "LogicalOr")); if (!yymatchString(yy, "logical_or")) goto l122; if (!yy_OpenBracket(yy)) goto l122; if (!yy_LogicalOrList(yy)) goto l122; if (!yy_ClosingBracket(yy)) goto l122; yyDo(yy, yy_1_LogicalOr, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "LogicalOr", yy->__buf+yy->__pos)); return 1; l122:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "LogicalOr", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Mode(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Mode")); { int yypos124= yy->__pos, yythunkpos124= yy->__thunkpos; if (!yymatchString(yy, "baseline")) goto l125; goto l124; l125:; yy->__pos= yypos124; yy->__thunkpos= yythunkpos124; if (!yymatchString(yy, "enhanced")) goto l126; goto l124; l126:; yy->__pos= yypos124; yy->__thunkpos= yythunkpos124; if (!yy_MiscUntilEOL(yy)) goto l123; yyDo(yy, yy_1_Mode, yy->__begin, yy->__end); } l124:; yyprintf((stderr, " ok %s @ %s\n", "Mode", yy->__buf+yy->__pos)); return 1; l123:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Mode", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_ClosingBracket(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "ClosingBracket")); if (!yymatchChar(yy, ')')) goto l127; yyprintf((stderr, " ok %s @ %s\n", "ClosingBracket", yy->__buf+yy->__pos)); return 1; l127:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "ClosingBracket", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_OpenBracket(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "OpenBracket")); if (!yymatchChar(yy, '(')) goto l128; yyprintf((stderr, " ok %s @ %s\n", "OpenBracket", yy->__buf+yy->__pos)); return 1; l128:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "OpenBracket", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_MiscUntilEOL(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "MiscUntilEOL")); if (!yymatchClass(yy, (unsigned char *)"\377\333\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l129; l130:; { int yypos131= yy->__pos, yythunkpos131= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\377\333\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377")) goto l131; goto l130; l131:; yy->__pos= yypos131; yy->__thunkpos= yythunkpos131; } yyprintf((stderr, " ok %s @ %s\n", "MiscUntilEOL", yy->__buf+yy->__pos)); return 1; l129:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "MiscUntilEOL", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_TagLine(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "TagLine")); { int yypos133= yy->__pos, yythunkpos133= yy->__thunkpos; if (!yy_Tag(yy)) goto l134; if (!yy_Semicolon(yy)) goto l134; if (!yy_Requirements(yy)) goto l134; if (!yy_Semicolon(yy)) goto l134; if (!yy_Content(yy)) goto l134; yyDo(yy, yy_1_TagLine, yy->__begin, yy->__end); goto l133; l134:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; if (!yy_Tag(yy)) goto l135; if (!yy_Semicolon(yy)) goto l135; if (!yy_Requirements(yy)) goto l135; if (!yy_Semicolon(yy)) goto l135; yyDo(yy, yy_2_TagLine, yy->__begin, yy->__end); goto l133; l135:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; if (!yy_Tag(yy)) goto l136; if (!yy_Semicolon(yy)) goto l136; if (!yy_Requirements(yy)) goto l136; yyDo(yy, yy_3_TagLine, yy->__begin, yy->__end); goto l133; l136:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; if (!yy_Tag(yy)) goto l137; if (!yy_Semicolon(yy)) goto l137; yyDo(yy, yy_4_TagLine, yy->__begin, yy->__end); goto l133; l137:; yy->__pos= yypos133; yy->__thunkpos= yythunkpos133; if (!yy_Tag(yy)) goto l132; yyDo(yy, yy_5_TagLine, yy->__begin, yy->__end); } l133:; yyprintf((stderr, " ok %s @ %s\n", "TagLine", yy->__buf+yy->__pos)); return 1; l132:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "TagLine", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_IncludeLine(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "IncludeLine")); if (!yymatchString(yy, "include")) goto l138; if (!yy_OpenBracket(yy)) goto l138; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l138; #undef yytext #undef yyleng } if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\340\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l138; l139:; { int yypos140= yy->__pos, yythunkpos140= yy->__thunkpos; if (!yymatchClass(yy, (unsigned char *)"\000\000\000\000\000\340\377\003\376\377\377\207\376\377\377\007\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l140; goto l139; l140:; yy->__pos= yypos140; yy->__thunkpos= yythunkpos140; } yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l138; #undef yytext #undef yyleng } if (!yy_ClosingBracket(yy)) goto l138; yyDo(yy, yy_1_IncludeLine, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "IncludeLine", yy->__buf+yy->__pos)); return 1; l138:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "IncludeLine", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_ModeLine(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "ModeLine")); { int yypos142= yy->__pos, yythunkpos142= yy->__thunkpos; if (!yymatchString(yy, "mode")) goto l143; if (!yy_OpenBracket(yy)) goto l143; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l143; #undef yytext #undef yyleng } if (!yy_Mode(yy)) goto l143; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l143; #undef yytext #undef yyleng } if (!yy_ClosingBracket(yy)) goto l143; yyDo(yy, yy_1_ModeLine, yy->__begin, yy->__end); goto l142; l143:; yy->__pos= yypos142; yy->__thunkpos= yythunkpos142; if (!yymatchString(yy, "mode")) goto l144; if (!yy_OpenBracket(yy)) goto l144; if (!yy_Mode(yy)) goto l144; yyDo(yy, yy_2_ModeLine, yy->__begin, yy->__end); goto l142; l144:; yy->__pos= yypos142; yy->__thunkpos= yythunkpos142; if (!yymatchString(yy, "mode")) goto l145; if (!yy_OpenBracket(yy)) goto l145; yyDo(yy, yy_3_ModeLine, yy->__begin, yy->__end); goto l142; l145:; yy->__pos= yypos142; yy->__thunkpos= yythunkpos142; if (!yymatchString(yy, "mode")) goto l141; yyDo(yy, yy_4_ModeLine, yy->__begin, yy->__end); } l142:; yyprintf((stderr, " ok %s @ %s\n", "ModeLine", yy->__buf+yy->__pos)); return 1; l141:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "ModeLine", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_SpaceLine(yycontext *yy) { yyprintf((stderr, "%s\n", "SpaceLine")); l147:; { int yypos148= yy->__pos, yythunkpos148= yy->__thunkpos; if (!yy_Space(yy)) goto l148; goto l147; l148:; yy->__pos= yypos148; yy->__thunkpos= yythunkpos148; } yyprintf((stderr, " ok %s @ %s\n", "SpaceLine", yy->__buf+yy->__pos)); return 1; } YY_RULE(int) yy_EndOfLine(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "EndOfLine")); if (!yymatchClass(yy, (unsigned char *)"\000\044\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000")) goto l149; yyDo(yy, yy_1_EndOfLine, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "EndOfLine", yy->__buf+yy->__pos)); return 1; l149:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "EndOfLine", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_CommentLine(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "CommentLine")); if (!yymatchChar(yy, '#')) goto l150; l151:; { int yypos152= yy->__pos, yythunkpos152= yy->__thunkpos; { int yypos153= yy->__pos, yythunkpos153= yy->__thunkpos; if (!yy_EndOfLine(yy)) goto l153; goto l152; l153:; yy->__pos= yypos153; yy->__thunkpos= yythunkpos153; } if (!yymatchDot(yy)) goto l152; goto l151; l152:; yy->__pos= yypos152; yy->__thunkpos= yythunkpos152; } yyDo(yy, yy_1_CommentLine, yy->__begin, yy->__end); yyprintf((stderr, " ok %s @ %s\n", "CommentLine", yy->__buf+yy->__pos)); return 1; l150:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "CommentLine", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_EndOfFile(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "EndOfFile")); { int yypos155= yy->__pos, yythunkpos155= yy->__thunkpos; if (!yymatchDot(yy)) goto l155; goto l154; l155:; yy->__pos= yypos155; yy->__thunkpos= yythunkpos155; } yyprintf((stderr, " ok %s @ %s\n", "EndOfFile", yy->__buf+yy->__pos)); return 1; l154:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "EndOfFile", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_Line(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "Line")); { int yypos157= yy->__pos, yythunkpos157= yy->__thunkpos; if (!yy_CommentLine(yy)) goto l158; if (!yy_EndOfLine(yy)) goto l158; goto l157; l158:; yy->__pos= yypos157; yy->__thunkpos= yythunkpos157; if (!yy_SpaceLine(yy)) goto l159; if (!yy_EndOfLine(yy)) goto l159; goto l157; l159:; yy->__pos= yypos157; yy->__thunkpos= yythunkpos157; if (!yy_ModeLine(yy)) goto l160; if (!yy_EndOfLine(yy)) goto l160; goto l157; l160:; yy->__pos= yypos157; yy->__thunkpos= yythunkpos157; if (!yy_IncludeLine(yy)) goto l161; if (!yy_EndOfLine(yy)) goto l161; goto l157; l161:; yy->__pos= yypos157; yy->__thunkpos= yythunkpos157; if (!yy_TagLine(yy)) goto l162; if (!yy_EndOfLine(yy)) goto l162; goto l157; l162:; yy->__pos= yypos157; yy->__thunkpos= yythunkpos157; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_BEGIN)) goto l156; #undef yytext #undef yyleng } if (!yy_MiscUntilEOL(yy)) goto l156; yyText(yy, yy->__begin, yy->__end); { #define yytext yy->__text #define yyleng yy->__textlen if (!(YY_END)) goto l156; #undef yytext #undef yyleng } yyDo(yy, yy_1_Line, yy->__begin, yy->__end); } l157:; yyprintf((stderr, " ok %s @ %s\n", "Line", yy->__buf+yy->__pos)); return 1; l156:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "Line", yy->__buf+yy->__pos)); return 0; } YY_RULE(int) yy_start(yycontext *yy) { int yypos0= yy->__pos, yythunkpos0= yy->__thunkpos; yyprintf((stderr, "%s\n", "start")); if (!yy_Line(yy)) goto l163; l164:; { int yypos165= yy->__pos, yythunkpos165= yy->__thunkpos; if (!yy_Line(yy)) goto l165; goto l164; l165:; yy->__pos= yypos165; yy->__thunkpos= yythunkpos165; } if (!yy_EndOfFile(yy)) goto l163; yyprintf((stderr, " ok %s @ %s\n", "start", yy->__buf+yy->__pos)); return 1; l163:; yy->__pos= yypos0; yy->__thunkpos= yythunkpos0; yyprintf((stderr, " fail %s @ %s\n", "start", yy->__buf+yy->__pos)); return 0; } #ifndef YY_PART typedef int (*yyrule)(yycontext *yy); YY_PARSE(int) YYPARSEFROM(YY_CTX_PARAM_ yyrule yystart) { int yyok; if (!yyctx->__buflen) { yyctx->__buflen= YY_BUFFER_SIZE; yyctx->__buf= (char *)YY_MALLOC(yyctx, yyctx->__buflen); yyctx->__textlen= YY_BUFFER_SIZE; yyctx->__text= (char *)YY_MALLOC(yyctx, yyctx->__textlen); yyctx->__thunkslen= YY_STACK_SIZE; yyctx->__thunks= (yythunk *)YY_MALLOC(yyctx, sizeof(yythunk) * yyctx->__thunkslen); yyctx->__valslen= YY_STACK_SIZE; yyctx->__vals= (YYSTYPE *)YY_MALLOC(yyctx, sizeof(YYSTYPE) * yyctx->__valslen); yyctx->__begin= yyctx->__end= yyctx->__pos= yyctx->__limit= yyctx->__thunkpos= 0; } yyctx->__begin= yyctx->__end= yyctx->__pos; yyctx->__thunkpos= 0; yyctx->__val= yyctx->__vals; yyok= yystart(yyctx); if (yyok) yyDone(yyctx); yyCommit(yyctx); return yyok; } YY_PARSE(int) YYPARSE(YY_CTX_PARAM) { return YYPARSEFROM(YY_CTX_ARG_ yy_start); } YY_PARSE(yycontext *) YYRELEASE(yycontext *yyctx) { if (yyctx->__buflen) { yyctx->__buflen= 0; YY_FREE(yyctx, yyctx->__buf); YY_FREE(yyctx, yyctx->__text); YY_FREE(yyctx, yyctx->__thunks); YY_FREE(yyctx, yyctx->__vals); } return yyctx; } #endif checkit_tiff-0.2.3/src/parser/config_dsl.grammar.peg000066400000000000000000000252251304466507300224700ustar00rootroot00000000000000# rule based checks if given TIFF is a specific baseline TIFF # # author: Andreas Romeyke, 2015/2016 # licensed under conditions of libtiff # (see http://libtiff.maptools.org/misc.html) # start <- ( Line )+ EndOfFile Line <- CommentLine EndOfLine / SpaceLine EndOfLine / ModeLine EndOfLine / IncludeLine EndOfLine / TagLine EndOfLine / < MiscUntilEOL > { set_parse_error("wrong line entry",yytext); } CommentLine <- '#' ( !EndOfLine . )* { commentline(); } IncludeLine <- 'include' OpenBracket < ( [A-Za-z0-9_./\-]+ ) > ClosingBracket { set_include ( yytext ); } ModeLine <- 'mode' OpenBracket < Mode > ClosingBracket { set_mode( yytext ); } / 'mode' OpenBracket Mode { set_parse_error( "modeline expects a closing bracket", yytext); } / 'mode' OpenBracket { set_parse_error( "modeline requires a mode", yytext); } / 'mode' { set_parse_error( "modeline requires an open bracket", yytext); } LogicalOr <- 'logical_or' OpenBracket LogicalOrList ClosingBracket { rule_add_logical_config(); reset_logical_list();} LogicalOrListElement <- Any { v_push( any );incr_logical_elements(); } / Range { v_push( range);incr_logical_elements(); } / Only { v_push( only );incr_logical_elements(); } / Number { v_push( only );incr_logical_elements(); } / NTupel { v_push( ntupel); reset_valuelist(); incr_logical_elements(); } / RegEx { v_push( regex );incr_logical_elements(); } / < MiscUntilEOL > { set_parse_error("wrong values-keyword", yytext);} LogicalOrList <- LogicalOrListElement (Colon LogicalOrListElement)* Mode <- 'baseline' / 'enhanced' / MiscUntilEOL { set_parse_error("mode expects either 'baseline' or 'enhanced'", yytext); } TagLine <- Tag Semicolon Requirements Semicolon Content { rule_addtag_config(); } / Tag Semicolon Requirements Semicolon { set_parse_error("tagline requires content", yytext); } / Tag Semicolon Requirements { set_parse_error("tagline expects missed semicolon here", yytext); } / Tag Semicolon { set_parse_error("tagline requires a requiemrent-keyword (mandatory, etc.)",yytext); } / Tag { set_parse_error("tagline expects missed semicolon here", yytext); } Tag <- < Number > { int tag = i_pop(); /* rule_tagorder_in_dsl( tag ); */ if (tag < 254) set_parse_error("wrong tag (should be >253)", yytext); else if (tag > 65535) set_parse_error("wrong tag (should be <65536)", yytext); else settag( tag ); } TagReference <- < Number > { int tag = i_pop(); if (tag < 254) set_parse_error("wrong tagreference (should be >253)", yytext); else if (tag > 65535) set_parse_error("wrong tagreference (should be <65536)", yytext); else settagref( tag ); } / < MiscUntilEOL > { set_parse_error("wrong tagreference", yytext); } Semicolon <- ';' ( Space )* / < MiscUntilEOL > { set_parse_error("missed semicolon", yytext);} Requirements <- 'mandatory' { set_mandatory(); } / IfDepends { set_ifdepends(); } / OptDepends { set_optdepends(); } / 'optional' { set_optional(); } / < MiscUntilEOL > { set_parse_error("wrong requirements-keyword", yytext);} IfDepends <- 'depends' OpenBracket TagReference Dot ValueReference ClosingBracket / 'depends' OpenBracket TagReference Dot ValueReference { set_parse_error("'depends' expects a closing bracket", yytext); } / 'depends' OpenBracket TagReference Dot { set_parse_error("'depends' expects a value reference", yytext); } / 'depends' OpenBracket TagReference { set_parse_error("'depends' expects a dot", yytext); } / 'depends' OpenBracket { set_parse_error("'depends' expects a tagreference", yytext); } / 'depends' { set_parse_error("'depends' expects an open bracket", yytext); } OptDepends <- 'optdepends' OpenBracket TagReference Dot ValueReference ClosingBracket / 'optdepends' OpenBracket TagReference Dot ValueReference { set_parse_error("'optdepends' expects a closing bracket", yytext); } / 'optdepends' OpenBracket TagReference Dot { set_parse_error("'optdepends' expects a value reference", yytext); } / 'optdepends' OpenBracket TagReference { set_parse_error("'optdepends' expects a dot", yytext); } / 'optdepends' OpenBracket { set_parse_error("'optdepends' expects a tagreference", yytext); } / 'optdepends' { set_parse_error("'optdepends' expects an open bracket", yytext); } Content <- Any { v_push( any ); } / Range { v_push( range); } / LogicalOr / Only { v_push( only ); } / NTupel { v_push( ntupel ); reset_valuelist() } / RegEx { v_push( regex ); } / < MiscUntilEOL > { set_parse_error("wrong values-keyword", yytext);} Range <- 'range' OpenBracket Number Colon Number ClosingBracket / 'range' OpenBracket Number Colon Number { set_parse_error("'range' expects a closing bracket", yytext); } / 'range' OpenBracket Number Colon { set_parse_error("'range' expects a number", yytext); } / 'range' OpenBracket Number { set_parse_error("'range' expects a colon", yytext); } / 'range' OpenBracket { set_parse_error("'range' expects a number", yytext); } / 'range' { set_parse_error("'range' expects an open bracket", yytext); } Number <- < '0x' ( [0-9a-f]+ ) > { i_push(strtol(yytext, NULL, 0) ); } / '2^' < ( Digit )+ > { i_push(2< { i_push(atol(yytext) );} Colon <- ',' (Space )* / < MiscUntilEOL > { set_parse_error("missed colon", yytext);} Dot <- '.' (Space )* / < MiscUntilEOL > { set_parse_error("missed dot", yytext)} OpenBracket <- '(' ClosingBracket <- ')' ValueList <- Value (Colon Value)* Value <- Number { incr_values(); } NTupel <- 'ntupel' OpenBracket ValueList ClosingBracket {int v=parser_state.valuelist; i_push(v); reset_valuelist(); } / 'ntupel' OpenBracket ValueList { set_parse_error("'ntupel' expects a closing bracket", yytext);} / 'ntupel' OpenBracket { set_parse_error("'ntupel' expects a value list", yytext);} / 'ntupel' { set_parse_error("'ntupel' expects an open bracket", yytext);} ValueReference <- Any { parser_state.any_reference = any_ref; } / Number { parser_state.any_reference = only_ref; i_push(atol(yytext) );} / RegEx { parser_state.any_reference = regex_ref; } / Range { parser_state.any_reference = range_ref; } / NTupel { parser_state.any_reference = ntupel_ref; } / Only { parser_state.any_reference = only_ref; } / < MiscUntilEOL > { set_parse_error("value reference error: '%s'", yytext);} Only <- 'only' OpenBracket Number ClosingBracket { } / 'only' OpenBracket Number { set_parse_error("'only' expects a closing bracket", yytext);} / 'only' OpenBracket { set_parse_error("'only' expects a value list", yytext);} / 'only' { set_parse_error("'only' expects an open bracket", yytext);} RegEx <- 'regex' OpenBracket '"' < ( PCRE )* > '"' ClosingBracket { regex_push ( yytext ); } / 'regex' OpenBracket '"' < ( PCRE )* > '"' { set_parse_error("'regex' expects a closing bracket", yytext); } / 'regex' OpenBracket '"' < ( PCRE )* > { set_parse_error("'regex' expects a closing '\"'", yytext); } / 'regex' OpenBracket '"' { set_parse_error("'regex' expects a PCRE-regex", yytext); } / 'regex' OpenBracket { set_parse_error("'regex' expects an open '\"'", yytext); } / 'regex' { set_parse_error("'regex' expects an open bracket", yytext); } SpaceLine <- ( Space )* Space <- ' ' / '\t' Any <- 'any' Digit <- [0-9] EndOfLine <- [\r\n] {incrlineno(); } EndOfFile <- !. MiscUntilEOL <- [^\r\n]+ PCRE <- EscapedPCRE / [^"\\] # FIXME: unescape char in yybuffer EscapedPCRE <- '\\' '\\' / '\\' '"' checkit_tiff-0.2.3/src/parser/config_parser.c000066400000000000000000000754321304466507300212310ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ // #define YY_DEBUG #include #include #include #include #include "config_parser.h" #include "check.h" #include "check_helper.h" #include #define YY_CTX_LOCAL /* #define EXE_DEBUG 1 #define RULE_DEBUG 1 #define DEBUG 1 #define YY_DEBUG 1 */ /* global vars */ parser_state_t parser_state; /* redefined YY_INPUT to read from stream */ #define YY_INPUT(yyctx, buf, result, max_size) \ { \ int yyc= fgetc(parser_state.stream); \ result= (EOF == yyc) ? 0 : (*(buf)= yyc, 1); \ yyprintf((stderr, "<%c>", yyc)); \ } /* prints a plan (list) of functions */ /* void print_plan () { printf("print plan:\n"); executionentry_t * this_exe_p = plan.start; while (NULL != this_exe_p) { printf("next action is: %s\n", this_exe_p->name); this_exe_p = this_exe_p->next; } } */ #define CHECKUNDERFLOW(SPACE_P, NAME) \ if (((SPACE_P)->NAME ## _stackp) >=MAXRESULT) {\ fprintf(stderr, "stackoverflow in " #SPACE_P "->" #NAME "_stack at lineno=%i, only %i results could be stored, increase MAXRESULT\n", parser_state.lineno, MAXRESULT);\ exit(EXIT_FAILURE);\ } // endmacro CHECKUNDERFLOW #define CHECKOVERFLOW(SPACE_P, NAME) \ if (((SPACE_P)->NAME ## _stackp) >=MAXRESULT) {\ fprintf(stderr, "stackoverflow in " #SPACE_P "->" #NAME "_stack at lineno=%i, only %i results could be stored, increase MAXRESULT\n", parser_state.lineno, MAXRESULT);\ exit(EXIT_FAILURE);\ } // endmacro CHECKOVERFLOW #define PUSH(SPACE_P, NAME, RES) \ (SPACE_P)->NAME ## _stack[((SPACE_P)->NAME ## _stackp)++]=RES;\ CHECKOVERFLOW(SPACE_P, NAME) //endmacro PUSH #define POP(SPACE_P, NAME, RES) \ CHECKUNDERFLOW(SPACE_P, NAME) \ (RES)=(SPACE_P)->NAME ## _stack[--((SPACE_P)->NAME ## _stackp)]; //endmacro POP #define PRINT(SPACE_P, TYPESIG, NAME) \ CHECKOVERFLOW(SPACE_P, NAME) \ CHECKUNDERFLOW(SPACE_P, NAME) \ for (int j=0; j< (SPACE_P)->NAME ## _stackp; j++)\ printf(" " #SPACE_P "->" #NAME "-stack value[ %i ] --> " #TYPESIG "\n", j, (SPACE_P)->NAME ## _stack[j]);\ //endmacro PRINT #define PRINTV(SPACE_P, VSTRINGARRAY, NAME) \ CHECKOVERFLOW(SPACE_P, NAME) \ CHECKUNDERFLOW(SPACE_P, NAME) \ for (int j=0; j< (SPACE_P)->NAME ## _stackp; j++)\ printf(" " #SPACE_P "->" #NAME "-stack value[ %i ] --> %s\n", j, VSTRINGARRAY[(SPACE_P)->NAME ## _stack[j]]);\ //endmacro PRINTV void result_push(full_res_t r) { PUSH(&parser_state, result, r); } full_res_t result_pop() { full_res_t r; POP(&parser_state, result, r); return r; } void result_printstack() { PRINT(&parser_state, "%p", result); } void i_printstack () { PRINT(&parser_state, "%i", i); } void i_push (unsigned int i) { PUSH(&parser_state, i, i);} unsigned int i_pop () { unsigned i; POP(&parser_state, i, i); return i; } void v_printstack () { const char * vname[] = { "range", "logical_or", "any", "only", "regex", "ntupel", }; PRINTV(&parser_state, vname, val); } void v_push ( values_t v) { PUSH(&parser_state, val, v);} values_t v_pop () { values_t v; POP(&parser_state, val, v); return v; } void r_printstack () { PRINT(&parser_state, "%s", regex); } void r_push (const char * r) { PUSH(&parser_state, regex, r); } const char * r_pop () { const char * v; POP(&parser_state, regex, v); return v; } void exe_push (internal_entry_t i) { PUSH(&parser_state, exe, i);} internal_entry_t exe_pop () { internal_entry_t e; POP(&parser_state, exe, e); return e; } const char * function_name( function_t f ) { const char * fname[] = { "fc_true", "fc_false", "fc_tag_has_some_of_these_values", "fc_tag_has_valuelist", "fc_tag_has_value_in_range", "fc_tag_has_value", "fc_tag_has_value_quiet", "fc_tag", "fc_tag_quiet", "fc_notag", "fc_tag_has_valid_type", "fc_datetime", "fc_icc", "fc_has_only_one_ifd", "fc_tagorder", "fc_tag_has_valid_asciivalue", "fc_tag_has_value_matching_regex", "fc_all_offsets_are_word_aligned", "fc_all_offsets_are_used_once_only", "fc_all_IFDs_are_word_aligned", "fc_internal_logic_combine", "fc_dummy", }; return fname[f]; } /* help function to print exe stack */ void exe_printstack () { CHECKOVERFLOW(&parser_state, exe); CHECKUNDERFLOW(&parser_state, exe); for (int j=0; j< parser_state.exe_stackp; j++) { printf(" exe-stack value[ %i ] --> {\n\tlineno=%i\n\tis_precondition=%i\n\ttag=%i\n\tfunction_used=%s (%i)\n", j, parser_state.exe_stack[j].lineno, parser_state.exe_stack[j].is_precondition, parser_state.exe_stack[j].tag, function_name(parser_state.exe_stack[j].function), parser_state.exe_stack[j].function ); /* print i_stack */ if ( parser_state.exe_stack[j].i_stackp >=0 && parser_state.exe_stack[j].i_stackp<=MAXSTACKDEPTH) { for (int i=0; i < parser_state.exe_stack[j].i_stackp; i++) { printf("\ti_stack[%i]=%i\n", i, parser_state.exe_stack[j].i_stack[i]); } } /* print regex_stack */ if ( parser_state.exe_stack[j].regex_stackp >=0 && parser_state.exe_stack[j].regex_stackp<=MAXSTACKDEPTH) { for (int i=0; i < parser_state.exe_stack[j].regex_stackp; i++) { printf("\tregex_stack[%i]=%s\n", i, parser_state.exe_stack[j].regex_stack[i]); } } printf("}\n"); } } /* reduce results */ void reduce_results() { /* go forward and eliminate all valid rule results */ full_res_t tmp[MAXRESULT]; int tmpc=0; int logc=0; for (int i = 0; i < parser_state.result_stackp; i++) { full_res_t full_result = parser_state.result_stack[i]; ret_t e = full_result.result; #ifdef DEBUG printf("reduce i=%i tmpc=%i logc=%i lineno=%i tag=%i func=%s returncode=%i\n", i, tmpc, logc, full_result.lineno, full_result.tag, function_name(full_result.function), e.returncode ); #endif int has_errors=0; if (e.returncode < 0) { /* logical or encoded as -count */ logc= -e.returncode + 1; #ifdef DEBUG printf("\tlogc'=%i", logc); #endif /* check from here to end for n entries and mark them as logicalerror if * all fails */ for (int j = i+1; j < i+logc; j++) { #ifdef DEBUG printf(".... j=%i error=%s\n", j, (parser_state.result_stack[j].result.returncode > 0)?"yes":"no"); #endif if (parser_state.result_stack[j].result.returncode > 0) { has_errors++; } else if (parser_state.result_stack[j].result.returncode == 0) { break; } } #ifdef DEBUG printf("found %i logical or errors (i=%i)\n", has_errors, i); #endif if (-e.returncode > has_errors) { // ok, at least one result is valid #ifdef DEBUG printf("\t erasing errors from j=%i < %i\n", i, i+logc); #endif for (int j = i; j < i+logc; j++) { parser_state.result_stack[j].result.returncode=0; } } } else if (e.returncode > 0) { /* push to tmp */ if (logc > 0) full_result.result.returnmsg->rm_type = rm_logicalor_error; tmp[tmpc++]=full_result; } logc--; } /* copy back */ for (int i = 0; i <= tmpc; i++) { parser_state.result_stack[i]= tmp[i]; } /* copy size */ parser_state.result_stackp=tmpc; } /* stack function for parser */ void exe_i_push (internal_entry_t * ep, unsigned int i) { PUSH( ep, i, i) } unsigned int exe_i_pop(internal_entry_t * ep) { unsigned int i; POP( ep, i, i); return i; } /* stack function for parser */ internal_entry_t * exe_regex_push (internal_entry_t * ep, const char * s) { #ifdef EXE_DEBUG printf("-------------------\n"); printf("\tpush REGEX='%s'\n", s); printf("-------------------\n"); #endif PUSH( ep, regex, strdup(s)) #ifdef EXE_DEBUG printf("\ton top='%s'\n", ep->regex_stack[ (ep->regex_stackp)-1 ]); #endif return ep; } const char * exe_regex_pop(internal_entry_t * ep) { const char * s; POP( ep, regex, s); #ifdef EXE_DEBUG printf("-------------------\n"); printf("\tpop REGEX='%s'\n", s); printf("-------------------\n"); printf("\ton top='%s'\n", ep->regex_stack[ (ep->regex_stackp) ]); #endif return s; } /* executes a plan (list) of functions, checks if predicate-function calls are * needed, too. The plan is a global variable. * @param tif pointer to TIFF structure * @return return-code is 0 if all called functions are succeed */ void execute_plan (ctiff_t * ctif) { /* iterate other function-stack */ int precondition_result=0; int last_run_was_a_precondition=1; int count_of_logical_or=0; for (int i = MINTAGS; irm_msg = str; /* full_res_t full; full.tag = exe.tag; full.function=exe.function; full.lineno=exe.lineno; full.result=res; result_push( full ); */ } if ( ( /* last was sucessfull precondition */ (0 == last_run_was_a_precondition) && (0 == precondition_result) ) || ( /* last was a normal function */ 0 != last_run_was_a_precondition ) ) { /* if true, execute function */ if (exe.tag >= MINTAGS && exe.tag <= (MAXTAGS-1)) parser_state.called_tags[exe.tag]=0; switch (exe.function) { case fc_true: { res.returncode=0; break;} case fc_false: { res.returncode=1; break; } case fc_tag_has_some_of_these_values: { int count = exe_i_pop(&exe); unsigned int values[count]; for (int j=0; j 0) { count_of_logical_or--; } else { last_run_was_a_precondition=exe.is_precondition; } #ifdef EXE_DEBUG if (res.returncode == 0) { printf("tmpresult = {returncode=%i}\n\nexe is precondition=%s\n", res.returncode, exe.is_precondition==0?"true":"false");; }else{ printf("tmpresult = {returncode=%i, count=%i}\n\nexe is precondition=%s\n", res.returncode, res.count, exe.is_precondition==0?"true":"false");; } #endif #ifdef EXE_DEBUG printf("==========\n"); #endif } while (parser_state.exe_stackp > 0); printf("all processed\n"); for (int i = MINTAGS; i res=%i\n", i, res.returncode); #endif full_res_t full; full.tag = i; full.function=fc_notag; full.lineno=-1; full.result=res; result_push( full ); } } } } /* function to clean an execution plan */ void clean_plan () { } /* helper function for parser */ tag_t settag( tag_t tag) { parser_state.tag=tag; return tag; } tag_t settagref( tag_t tag) { parser_state.tagref=tag; return tag; } /* helper function for parser */ tag_t gettag( ) { return parser_state.tag;} int incrlineno() { parser_state.lineno++; #ifdef DEBUG printf("##lineno=%i\n", parser_state.lineno); #endif return parser_state.lineno; } /* helper function for parser */ int getlineno() { return parser_state.lineno;} /* int rule_tagorder_in_dsl( int tag ) { int prevtag = gettag(); #ifdef DEBUG printf ("tag '%i' found (prev tag was: '%i')\n", tag, prevtag); #endif if (prevtag > tag) { fprintf(stderr, "tag '%i' should be greater than previous tag '%i'\n", tag, prevtag); exit( -1 ); } } */ /* helper function for parser */ void tagline() { #ifdef DEBUG printf("tagline, %i\n", parser_state.lineno); #endif } /* helper function for parser */ void commentline() { #ifdef DEBUG printf("commentline, %i\n", parser_state.lineno); #endif } /* helper function for parser */ /* void rule_should_not_occure(char* s) { #ifdef DEBUG printf("no parser rule matched after line %i (prev tag was %u): '%s'\n", getlineno(), gettag(), s); #endif } */ /* helper function for parser */ void set_mandatory() { #ifdef DEBUG printf("tag '%u' is mandatory\n", gettag()); #endif parser_state.req=mandatory; } /* helper function for parser */ void set_optional() { #ifdef DEBUG printf("tag '%u' is optional\n", gettag()); #endif parser_state.req=optional; parser_state.any_reference=any_ref; parser_state.tagref=gettag(); } /* helper function for parser */ void set_ifdepends() { #ifdef DEBUG printf("tag '%u' is set if depends\n", gettag()); #endif parser_state.req=ifdepends; } /* helper function for parser */ void set_optdepends() { #ifdef DEBUG printf("tag '%u' is set optional depends\n", gettag()); #endif parser_state.req=optdepends; } /* helper function for parser */ void regex_push( const char * regex_string) { pcre *re; int erroffset; const char * errorcode; re = pcre_compile( regex_string, /* the pattern */ 0, /* default options */ &errorcode, /* for error code */ &erroffset, /* for error offset */ NULL); /* no compile context */ if (NULL != re) { #ifdef DEBUG printf("regex found: '%s' in line %i\n", regex_string, parser_state.lineno); #endif pcre_free(re); r_push(regex_string); } else { fprintf(stderr, "regex compile error: %s at offset: %i in line %i\n", errorcode, erroffset, parser_state.lineno); exit(EXIT_FAILURE); } } /* helper function for parser */ void set_any_reference( reference_t v ) { parser_state.any_reference = v;} /* helper function for parser */ void reset_valuelist() { parser_state.valuelist = 0; } /* helper function for parser */ void incr_values () { parser_state.valuelist++; } /* helper function for parser */ void reset_logical_list() { parser_state.lelist = 0; } /* helper function for parser */ void incr_logical_elements () { parser_state.lelist++; } internal_entry_t prepare_internal_entry() { internal_entry_t p; p.i_stackp=0; p.regex_stackp=0; p.lineno=getlineno(); p.is_precondition=0; p.tag=parser_state.tagref; p.function=fc_tag_quiet; switch (parser_state.any_reference) { case no_ref: case any_ref: p.function=fc_tag_quiet; break; case only_ref: p.function=fc_tag_has_value_quiet; exe_i_push(&p, i_pop() ); break; case range_ref: p.function=fc_tag_has_value_in_range; exe_i_push(&p, i_pop() ); exe_i_push(&p, i_pop() ); break; case ntupel_ref: { int c = i_pop(); for (int i = 0; ifunction=fc_tag_has_value_in_range; break; } case ntupel: { #ifdef RULE_DEBUG printf("ntupel found\n"); #endif int c = i_pop(); for (int i = 0; ifunction=fc_tag_has_valuelist; break; } case only: { #ifdef RULE_DEBUG printf("only found\n"); #endif exe_i_push(e_p, i_pop() ); e_p->function=fc_tag_has_value; break; } case any: { #ifdef RULE_DEBUG printf("any found\n"); #endif e_p->function=fc_tag; break; } case regex: { #ifdef RULE_DEBUG printf("regex found\n"); #endif exe_regex_push(e_p, r_pop()); e_p->function=fc_tag_has_value_matching_regex; break; } default: fprintf(stderr, "unknown val, should not occure\n"); exit(EXIT_FAILURE); } } void rule_add_logical_config() { #ifdef RULE_DEBUG printf("rule_add_logical_config\n"); #endif internal_entry_t e; e.tag = parser_state.tag; e.i_stackp=0; e.regex_stackp=0; e.lineno=getlineno(); e.is_precondition=1; e.function=fc_internal_logic_combine; exe_i_push(&e, parser_state.lelist); /* stack should be organized as: * [ruleA] * [ruleB] * [logicalorAB] <- combines ruleA and ruleB with OR * [preconditionAB] <- optional * [prepreconditionAB] <-optional */ do { #ifdef RULE_DEBUG printf("was ist noch auf stacks?\n"); printf("--------->\n"); v_printstack(); i_printstack(); r_printstack(); printf("<---------\n"); printf("auf exe stack ist nun:\n"); printf("--------->\n"); exe_printstack(); printf("<---------\n"); #endif values_t val = v_pop(); /* set predicate if and only if lastreq = depends */ /* HINT: order of evaluating last val and last req is IMPORTANT! */ /* HINT: order of calling arguments from stacks is IMPORTANT! */ internal_entry_t c; c.tag = parser_state.tag; c.is_precondition=1; c.i_stackp=0; c.regex_stackp=0; c.lineno=getlineno(); build_functional_structure(&c, val); evaluate_req_and_push_exe( mandatory , c); } while ( parser_state.val_stackp > 0); evaluate_req_and_push_exe( parser_state.req, e); #ifdef RULE_DEBUG printf("auf exe2 (logical) stack ist nun:\n"); printf("--------->\n"); exe_printstack();; printf("<---------\n"); #endif } /* this adds the config of a tagline to execution plan * HINT: order of calling arguments from stacks is IMPORTANT! */ void rule_addtag_config() { if( parser_state.val_stackp > 0) { #ifdef RULE_DEBUG printf("rule_addtag_config\n"); #endif internal_entry_t e; e.i_stackp=0; e.regex_stackp=0; e.lineno=getlineno(); e.is_precondition=1; /* no precondition as default */ e.tag = parser_state.tag; #ifdef RULE_DEBUG printf( "try to match tagline at line %i\n", e.lineno); #endif /* typedef struct internal_entry_s { int lineno; int count_of_arguments; int is_precondition; tag_t tag; logic_t is_combined; function_t function_used; } internal_entry_t; */ /* HINT: order of evaluating last val and last req is IMPORTANT! */ #ifdef RULE_DEBUG v_printstack(); i_printstack(); r_printstack(); #endif /* stack should be organized as: * [ruleA] * [preconditionA] <- optional * [prepreconditionA] <- optional * [ruleB] * [preconditionB] <- optional * [prepreconditionB] <- optional */ do { values_t val = v_pop(); #ifdef RULE_DEBUG printf("was ist noch auf stacks?\n"); v_printstack(); i_printstack(); r_printstack(); printf("auf exe stack ist nun:\n"); exe_printstack(); printf("-----\n"); #endif e.function = fc_dummy; build_functional_structure(&e, val); /* set predicate if and only if lastreq = depends */ /* HINT: order of evaluating last val and last req is IMPORTANT! */ /* HINT: order of calling arguments from stacks is IMPORTANT! */ evaluate_req_and_push_exe( parser_state.req, e); } while ( parser_state.val_stackp > 0); reset_valuelist(); parser_state.any_reference = 0; #ifdef RULE_DEBUG exe_printstack(); #endif } } /* set_mode */ void set_mode(const char * mode) { #ifdef RULE_DEBUG printf("Mode=%s at line=%i (needs to be implemented)\n", mode, parser_state.lineno ); #endif /* TODO: Implement mode setting */ } /* reset the parser state */ void reset_parser_state() { parser_state.any_reference=0; parser_state.exe_stackp=0; parser_state.includedepth=0; parser_state.i_stackp=0; parser_state.lelist=0; parser_state.lineno=1; parser_state.regex_stackp=0; parser_state.req=0; parser_state.result_stackp=0; parser_state.tag=0; parser_state.tagref=-1; parser_state.val_stackp=0; parser_state.valuelist=0; for (int i=0; i= 1) { fprintf( stderr, "only include depth of %i is supported\n", MAXINCLUDEDEPTH); exit (EXIT_FAILURE); } parser_state.includedepth++; printf("Include=%s\n", include_file); FILE * cfg = fopen(include_file, "r"); if (NULL == cfg) { fprintf( stderr, "file '%s' could not be opened\n", include_file); exit (EXIT_FAILURE); }; clean_plan(); yycontext ctx2; memset(&ctx2, 0, sizeof(yycontext)); FILE * old_stream = parser_state.stream; int old_lineno = parser_state.lineno; printf("At lineno %i, file %s, switching to include file %s\n", old_lineno, "", include_file); parser_state.lineno=1; parser_state.stream=cfg; while (yyparse(&ctx2)) /* repeat until EOF */ ; yyrelease(&ctx2); parser_state.includedepth--; printf("End of Include=%s\n", include_file); parser_state.stream = old_stream; parser_state.lineno = old_lineno; fclose(cfg); } /* function to parse a config file from STDIN */ void parse_plan () { reset_parser_state(); /*/ r_printstack(); printf("rp=%i\n", parser_state.regex_stackp); r_push("foo"); r_printstack(); printf("rp=%i\n", parser_state.regex_stackp); const char * v = r_pop(); r_printstack(); printf("rp=%i %s\n", parser_state.regex_stackp, v); fprintf(stderr, "----\n"); r_pop(); */ yycontext ctx; memset(&ctx, 0, sizeof(yycontext)); parser_state.stream=stdin; while (yyparse(&ctx)) /* repeat until EOF */ ; yyrelease(&ctx); } /* function to parse a config file from file stream */ void parse_plan_via_stream( FILE * file ) { reset_parser_state(); yycontext ctx; memset(&ctx, 0, sizeof(yycontext)); parser_state.stream=file; while (yyparse(&ctx)) /* repeat until EOF */ ; yyrelease(&ctx); } /* function to parse a config file */ void parse_plan_via_file( const char * cfg_file ) { FILE * cfg = fopen(cfg_file, "r"); if (NULL == cfg) { fprintf( stderr, "file '%s' could not be opened\n", cfg_file); exit (EXIT_FAILURE); }; clean_plan(); parse_plan_via_stream( cfg ); fclose(cfg); } /* set parse error * @param msg describes the details about what was going wrong * @param yytext gives context of the error */ void set_parse_error(char * msg, char * yytext) { fprintf(stderr, "%s at line %i (error at '%s')\n", msg, parser_state.lineno, yytext); exit(EXIT_FAILURE); } void clean_plan_results() { for (int i=parser_state.result_stackp-1; i >= 0; --i) { if (NULL != parser_state.result_stack[i].result.returnmsg) { free( parser_state.result_stack[i].result.returnmsg ); parser_state.result_stack[i].result.returnmsg=NULL; parser_state.result_stack[i].result.count=0; } } } /* prints a plan (list) of functions and their results*/ int print_plan_results() { #ifdef DEBUG printf("print plan results:\n"); printf("####################(\n"); for (int i=parser_state.result_stackp-1; i >= 0; --i) { if (0 == parser_state.result_stack[i].result.returncode) { printf( "i=%i retcode=%i \n", i, parser_state.result_stack[i].result.returncode); } else { printf( "i=%i retcode=%i count=%i\n", i, parser_state.result_stack[i].result.returncode, parser_state.result_stack[i].result.count); } printf( "p-> %p\n", parser_state.result_stack[i].result.returnmsg); printf( " %s",renderer( parser_state.result_stack[i].result)); } printf(")####################\n"); printf("reduced\n"); #endif reduce_results(); for (int i=parser_state.result_stackp-1; i >= 0; --i) { #ifdef DEBUG printf( "i=%i retcode=%i %s", i, parser_state.result_stack[i].result.returncode, renderer( parser_state.result_stack[i].result)); #endif printf( "%s", renderer( parser_state.result_stack[i].result)); } printf("Found %i errors\n", parser_state.result_stackp); if (parser_state.result_stackp > 0) { printf("No, the given tif is not valid :(\n"); } else { printf("Yes, the given tif is valid :)\n"); } clean_plan_results(); return parser_state.result_stackp; } void _helper_mark_top_n_results( int n, rm_type_t type) { if (parser_state.result_stackp -n < 0) { fprintf(stderr, "stackunderflow using n=%i, only %i on stack", n, parser_state.result_stackp); exit(EXIT_FAILURE); } if (parser_state.result_stackp -n >=MAXRESULT) { fprintf(stderr, "stackoverflow using n=%i, only %i results could be stored, increase MAXRESULT\n", n, MAXRESULT); exit(EXIT_FAILURE); } for (int i = parser_state.result_stackp; i > parser_state.result_stackp-n; i--) { printf("\tmark i=%i\n", i); if (NULL != parser_state.result_stack[i].result.returnmsg) parser_state.result_stack[i].result.returnmsg->rm_type=type; } } full_res_t _helper_get_nth(int n) { if (parser_state.result_stackp -n < 0) { fprintf(stderr, "stackunderflow using n=%i, only %i on stack", n, parser_state.result_stackp); exit(EXIT_FAILURE); } if (parser_state.result_stackp -n >=MAXRESULT) { fprintf(stderr, "stackoverflow using n=%i, only %i results could be stored, increase MAXRESULT\n", n, MAXRESULT); exit(EXIT_FAILURE); } return parser_state.result_stack[parser_state.result_stackp -n]; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/risk_analyzer/000077500000000000000000000000001304466507300176125ustar00rootroot00000000000000checkit_tiff-0.2.3/src/risk_analyzer/lst_offset_mappings.c000066400000000000000000000245461304466507300240370ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015/2016 * licensed under conditions of libtiff * (see file LICENSE) * */ #include "check.h" #include "check_helper.h" #include #include void add_mem_entry(mem_map_t * memmap_p, uint32 offset, uint32 count, memtype_t type) { mem_map_t memmap = *( memmap_p ); assert(NULL != memmap.base_p); assert(0 < memmap.max_entries); assert(memmap.count < memmap.max_entries); assert(type < mt_END_marker); mem_map_entry_t * memmap_it_p = memmap.base_p; memmap_it_p = memmap.base_p + memmap.count; memmap_it_p->offset=offset; memmap_it_p->count=count; memmap_it_p->mem_type=type; memmap.count++; assert( memmap.max_entries > memmap.count); *( memmap_p) = memmap; } int compare_memmap(void const * lhs, void const * rhs) { mem_map_entry_t left = *((mem_map_entry_t *) lhs); mem_map_entry_t right = *((mem_map_entry_t *) rhs); return ((left.offset) - (right.offset)); } /* TODO: add support for StripOffsets and StripByteCounts */ mem_map_t * scan_mem_map(ctiff_t * ctif) { assert( NULL != ctif); static mem_map_t memmap; memmap.count = 0; memmap.base_p = NULL; memmap.max_entries = 2048; memmap.base_p = malloc (sizeof(mem_map_entry_t) * memmap.max_entries); if (NULL == memmap.base_p) { perror ("could not allocate mem for memmap, abort"); } /* size of tiff file in bytes */ memmap.max_len = ctif->streamlen; /* header */ add_mem_entry( &memmap, 0, 4, mt_constant); /* IFD0 Offset */ add_mem_entry( &memmap, 4, 4, mt_offset_to_ifd0); /* IFDO */ uint32 ifd = get_ifd0_pos( ctif ); uint16 count = get_ifd0_count( ctif); add_mem_entry( &memmap, ifd, 2, mt_ifd); /* count of tags in ifd */ int ifdbase=2+ifd; /* iterate through IFD0 entries */ uint16 tagidx; ifd_entry_t stripoffset_entry; for (tagidx = 0; tagidx< count; tagidx++) { add_mem_entry( &memmap, ifdbase+(tagidx*12), 8, mt_ifd); /* tagid, field type, count */ ifd_entry_t ifd_entry = TIFFGetRawTagIFDListEntry( ctif, tagidx ); uint32 tag = TIFFGetRawTagListEntry( ctif, tagidx); TIFFDataType datatype = TIFFGetRawTagType( ctif, tag); int datasize; switch (datatype) { case TIFF_ASCII: datasize = 1; break; case TIFF_LONG: datasize = 4; break; case TIFF_SHORT: datasize = 2; break; case TIFF_BYTE: datasize = 1; break; case TIFF_UNDEFINED: datasize = 1; break; case TIFF_RATIONAL: datasize = 8; break; case TIFF_SSHORT: datasize = 2; break; case TIFF_SBYTE: datasize = 1; break; case TIFF_SLONG: datasize = 4; break; case TIFF_SRATIONAL: datasize = 8; break; case TIFF_FLOAT: datasize = 4; break; case TIFF_DOUBLE: datasize = 8; break; default: fprintf(stderr, "unknown datatype %i, possible a program error", datatype); exit(EXIT_FAILURE); } uint32 offset = ifd_entry.data32offset; uint16 count = ifd_entry.count; if (tag == TIFFTAG_STRIPOFFSETS) { if (ifd_entry.value_or_offset == is_offset) { add_mem_entry( &memmap, ifdbase+(tagidx*12)+8,4,mt_ifd_offset_to_standardized_value ); add_mem_entry( &memmap, offset, ((uint32) count)*datasize, mt_ifd_offset_to_stripoffsets ); } else if (ifd_entry.value_or_offset==is_value) { add_mem_entry( &memmap, ifdbase+(tagidx*12)+8, 4,mt_ifd_embedded_standardized_value ); } stripoffset_entry=ifd_entry; } else if (ifd_entry.value_or_offset==is_offset) { /* offset */ if (tag < 32768) { /* standard tag */ add_mem_entry( &memmap, ifdbase+(tagidx*12)+8, 4,mt_ifd_offset_to_standardized_value ); add_mem_entry( &memmap, offset, ((uint32) count)*datasize, mt_standardized_value ); } else if (tag < 65000) { /* registered tag */ add_mem_entry( &memmap, ifdbase+(tagidx*12)+8, 4,mt_ifd_offset_to_registered_value ); add_mem_entry( &memmap, offset, ((uint32) count)*datasize, mt_registered_value ); } else { /* private tag */ add_mem_entry( &memmap, ifdbase+(tagidx*12)+8, 4,mt_ifd_offset_to_private_value ); add_mem_entry( &memmap, offset, ((uint32) count)*datasize, mt_private_value ); } } else if (ifd_entry.value_or_offset==is_value) { /* embedded value */ if (tag < 32768) { /* standard tag */ add_mem_entry( &memmap, ifdbase+(tagidx*12)+8, 4,mt_ifd_embedded_standardized_value ); } else if (tag < 65000) { /* registered tag */ add_mem_entry( &memmap, ifdbase+(tagidx*12)+8, 4,mt_ifd_embedded_registered_value ); } else { /* private tag */ add_mem_entry( &memmap, ifdbase+(tagidx*12)+8, 4,mt_ifd_embedded_private_value ); } } } /* check next IFD mark */ // uint32 offset = get_ifd0_pos(ctif ); // uint32 IFDn = get_next_ifd_pos( ctif, offset ); // printf("IFD: offset=%i, IFD0=%i IFDn=%i ifd+count=%i\n", offset, ifd, IFDn, ifdbase+12*count); add_mem_entry( &memmap, ifdbase+12*count, 4, mt_offset_to_ifd); /* handle stripoffset data */ //printf("ifd_count=%i, stripoffset_count=%i\n", stripoffset_entry.count, stripoffset_count); uint32 stripoffset_values[stripoffset_entry.count]; switch (stripoffset_entry.datatype) { case TIFF_LONG: { /* value */ if (stripoffset_entry.value_or_offset == is_value) { for (int i=0; i< stripoffset_entry.count; i++) { stripoffset_values[i] = stripoffset_entry.data32; } } /* offset */ if (stripoffset_entry.value_or_offset == is_offset) { offset_t offset = read_offsetdata(ctif, stripoffset_entry.data32offset, stripoffset_entry.count, stripoffset_entry.datatype); uint32 * p = offset.data32p; for (int i=0; i< stripoffset_entry.count; i++) { uint32 pval = *p; if (is_byteswapped(ctif)) { TIFFSwabLong(&pval); } stripoffset_values[i]=pval; p++; } } break; } case TIFF_SHORT: { /* value */ if (stripoffset_entry.value_or_offset == is_value) { for (int i=0; i< stripoffset_entry.count; i++) { stripoffset_values[i]= stripoffset_entry.data16[i]; } } /* offset */ if (stripoffset_entry.value_or_offset == is_offset) { offset_t offset = read_offsetdata(ctif, stripoffset_entry.data32offset, stripoffset_entry.count, stripoffset_entry.datatype); uint16 * p = offset.data16p; for (int i=0; i< count; i++) { uint16 pval = *p; if (is_byteswapped(ctif)) { TIFFSwabShort(&pval); } stripoffset_values[i]=pval; p++; } } break; } default: { perror("stripoffset_entry.datatype has an unexpected value, possible a program error\n"); exit(EXIT_FAILURE); } } //printf("count=%i\n", stripoffset_entry.count); /*TODO: for (int i=0; i< stripoffset_entry.count; i++) { uint32 rawstriplen = TIFFRawStripSize(ctif->tif, i); //printf("OFFSET: p[%i]=%u len=%i\n", i,stripoffset_values[i], rawstriplen); add_mem_entry( &memmap, stripoffset_values[i], rawstriplen, mt_stripoffset_value); } */ /* sort entries by offset */ qsort(memmap.base_p, memmap.count, sizeof( mem_map_entry_t), compare_memmap); /* printf("memmap before HOLE detection\n"); print_mem_map( &memmap ); printf("----------------------------\n"); */ /* add all unused areas */ int memmap_orig_count = memmap.count; for (int j=1; j< memmap_orig_count; j++) { mem_map_entry_t * prev=memmap.base_p+j-1; mem_map_entry_t * act =memmap.base_p+j; uint32 estimated_offset = (prev->offset + prev->count); if (estimated_offset < act->offset) { /* found a hole */ printf("HOLE FOUND at %i\n", estimated_offset); printf("\tprev->offset=%i prev->count=%i estimated=%i\n", prev->offset, prev->count, estimated_offset); printf("\tact->offset=%i act->count=%i\n", act->offset, act->count); add_mem_entry( &memmap, estimated_offset, (act->offset -estimated_offset), mt_unused); } } /* sort entries by offset again */ qsort(memmap.base_p, memmap.count, sizeof( mem_map_entry_t), compare_memmap); /* add unused area at end */ mem_map_entry_t * last = memmap.base_p + memmap.count-1; uint32 estimated_offset = (last->offset + last->count); if (memmap.max_len > estimated_offset) { printf("HOLE (at end) FOUND at %i\n", estimated_offset); add_mem_entry( &memmap, estimated_offset, (memmap.max_len -estimated_offset), mt_unused); } /* sort entries by offset again */ qsort(memmap.base_p, memmap.count, sizeof( mem_map_entry_t), compare_memmap); return &memmap; } void print_mem_map( mem_map_t * memmap_p ) { assert(NULL != memmap_p); mem_map_t memmap = *( memmap_p ); printf("size of file is %u bytes\n", memmap.max_len); for (int j=0; j< memmap.count; j++) { mem_map_entry_t * i=memmap.base_p+j; printf ("entry=%03i, offset_start=%10i, count=%10i, offset_next=%10i, [%02i], type=%s\n", j,i->offset, i->count, (i->offset + i->count), i->mem_type, memtype_string[i->mem_type]); } } void print_mem_stats( mem_map_t * memmap_p) { uint32 size = memmap_p->max_len; uint32 stat[ mt_END_marker ]; uint32 counted=0; for (int i=0; i< mt_END_marker; i++) { stat[i]=0; } for (int j=0; j< memmap_p->count; j++) { mem_map_entry_t * i=memmap_p->base_p+j; stat[i->mem_type]+= i->count; counted+=i->count; } for (int i=0; i #include /** check if date / time values are within correct ranges * @param year year * @param month month * @param day day * @param hour hour * @param min min * @param sec sec * @return 0 if success, otherwise -1 */ int test_plausibility (int * year, int * month, int * day, int * hour, int * min, int * sec) { #ifdef DEBUG printf ("found: y=%d m=%d d=%d h=%d m=%d s=%d\n", *year, *month, *day, *hour, *min, *sec); #endif if ( 1500 < *year && 2100 > *year && 0 < *month && 13 > *month && 0 < *day && 32 > *day && 0 <= *hour && 24 > *hour && 0 <= *min && 60 > *min && 0 <= *sec && 60 > *sec ) { return 0; } else { return -1; } } /** loads a tiff, fix it if needed, stores tiff * @param filename filename which should be processed, repaired */ ret_t check_datetime(ctiff_t * ctif ) { tifp_check( ctif); //printf("check if tag %u (%s) is correct\n", TIFFTAG_DATETIME, TIFFTagName(tif, TIFFTAG_DATETIME)); tif_rules_tag(TIFFTAG_DATETIME, "is correct"); /* find date-tag and fix it */ TIFFDataType datatype = TIFFGetRawTagType( ctif, TIFFTAG_DATETIME ); if (datatype != TIFF_ASCII) { return tif_fails_tag(TIFFTAG_DATETIME, "", "has not the expected datatype ASCII"); } int count=0; char *datetime=NULL; count = TIFFGetFieldASCII(ctif, TIFFTAG_DATETIME, &datetime); // printf("DATETIME='%s'\n", datetime); int day=0; int month=0; int year=0; int hour=0; int min=0; int sec=0; int r = 0; for (int i=0; itif, TIFFTAG_ICCPROFILE, &icc_profile_size, &icc_profile); switch (ifd_entry.datatype) { /* icc datatype should be undefined (val=7) */ case TIFF_UNDEFINED: { icc_profile_size = ifd_entry.count; count = ifd_entry.count; /* offset */ if (ifd_entry.value_or_offset == is_offset) { offset_t offset = read_offsetdata(ctif, ifd_entry.data32offset, count, ifd_entry.datatype); icc_profile = (char *)offset.data32p; } else { return tif_fails_tag( TIFFTAG_ICCPROFILE, "pointing to an offset", "encoded as value instead as offset, but there is no enough space to hold it"); } break; } default: { /* none */ char array[VALUESTRLEN]; snprintf(array, sizeof(array), " but was datatype:%u", ifd_entry.datatype); return tif_returns( TIFFTAG_ICCPROFILE, "of type undefined", array ); break; }; } //printf("DEBUG: iccprofile_size=%i\n", icc_profile_size); // printf("DEBUG: iccprofile='%s'\n", icc_profile); /* DEBUG char * p = icc_profile; int i=0; for (i = 0; i< icc_profile_size; i++, p++) { if (0 == i % 8) printf("|"); printf("%c(%0x) ", (isalnum(*p)?*p:' '),*p); } printf("\n"); */ #define ERRSIZE 1024 char * errmessage = malloc(sizeof(char) * ERRSIZE); unsigned long errsize = ERRSIZE; int ret = parse_icc(icc_profile_size, icc_profile, errsize, errmessage); if (0 != ret) { return tif_fails_tag( TIFFTAG_ICCPROFILE, "pointing to valid ICC profile", errmessage); } free (errmessage); ret_t res; res.returnmsg=NULL; res.returncode=0; return res; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_notag.c000066400000000000000000000012471304466507300212000ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" /* #define DEBUG */ /* checks if TIF does not have a specified tag, * needed only for checks to ensure whitelist */ ret_t check_notag(ctiff_t * ctif, tag_t tag) { tifp_check( ctif); ret_t res = check_tag_quiet( ctif, tag); if (res.returncode == 0) { return tif_no_tag( tag); } else { res.returnmsg=NULL; res.returncode=0; return res; } } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag.c000066400000000000000000000013761304466507300206460ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" /* #define DEBUG */ /* checks if TIF has a specified tag */ ret_t check_tag(ctiff_t * ctif, tag_t tag) { //printf("check if tag %u (%s) exists\n", tag, TIFFTagName(tif, tag)); tifp_check( ctif); tif_rules_tag(tag, "exists"); ret_t res = check_tag_quiet( ctif, tag); if (res.returncode == 0) { return check_tag_has_valid_type( ctif, tag); } else { return tif_fails_tag(tag, "", "was not found, but requested because defined"); } } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag_has_some_of_these_values.c000066400000000000000000000076001304466507300257530ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see file LICENSE) * */ #include "check.h" #include "check_helper.h" #include /* #define DEBUG */ ret_t check_tag_has_some_of_these_values(ctiff_t * ctif, tag_t tag, int count, unsigned int * values) { //printf("check if tag %u (%s) has some of these %i-values", tag, TIFFTagName(tif, tag), count); tifp_check( ctif); char msg[EXPECTSTRLEN]; char expected[EXPECTSTRLEN]=""; snprintf(msg, sizeof(msg), "has some of these %i-values: ", count); unsigned int * p = values; for (int i=0; i< count; i++) { if( i>= 1) secstrcat (expected, ", ", EXPECTSTRLEN); secstrcat (expected, int2str(*p), EXPECTSTRLEN); p++; } secstrcat (msg, expected, EXPECTSTRLEN); tif_rules_tag(tag, strdup(msg)); ret_t res = check_tag_has_valid_type( ctif, tag); if (res.returncode == 0) { TIFFDataType datatype = TIFFGetRawTagType( ctif, tag ); switch (datatype) { case TIFF_LONG: { p = values; ret_t tmp_res; for (int i=0; i< count; i++) { #ifdef DEBUG printf("### value = %u", *p); #endif tmp_res = check_tag_has_u32value(ctif, tag, *p); if (tmp_res.returncode == 0) return tmp_res; p++; } uint32 * valp = NULL; uint32 val; TIFFGetFieldLONG(ctif, tag, &valp); val = *valp; return tif_fails_tag( tag, strdup(expected), int2str(val)); break; } case TIFF_SHORT: { p = values; ret_t tmp_res; for (int i=0; i< count; i++) { #ifdef DEBUG printf("### value = %u", *p); #endif tmp_res = check_tag_has_u16value(ctif, tag, *p); if (tmp_res.returncode == 0) return tmp_res; p++; } uint16 * valp = NULL; uint16 val; TIFFGetFieldSHORT(ctif, tag, &valp); val = *valp; return tif_fails_tag( tag, strdup(expected), int2str(val)); break; } case TIFF_RATIONAL: { p = values; ret_t tmp_res; for (int i=0; i< count; i++) { #ifdef DEBUG printf("### value = %u", *p); #endif tmp_res = check_tag_has_fvalue(ctif, tag, *p); if (tmp_res.returncode == 0) return tmp_res; p++; } float * valp = NULL; float val; TIFFGetFieldRATIONAL(ctif, tag, &valp); val = * valp; return tif_fails_tag( tag, strdup(expected), float2str(val)); //tif_fails("tag %u (%s) does not have some of expected values (but have:%f)\n", tag, TIFFTagName(tif, tag), val); break; } default: /* none */ { // tif_fails("tag %u (%s) should have values of type long, short or float, but was:%i\n", tag, TIFFTagName(tif, tag), datatype); char array[VALUESTRLEN]; snprintf(array, sizeof(array), "but was:%i", datatype); return tif_fails_tag( tag, "of type long, short or float", array); } } } return res; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag_has_valid_asciivalue.c000066400000000000000000000026351304466507300250640ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" /* #define DEBUG */ /* checks if TIF with tag and type ASCII */ ret_t check_tag_has_valid_asciivalue(ctiff_t * ctif, tag_t tag) { tifp_check( ctif); TIFFDataType datatype = TIFFGetRawTagType( ctif, tag ); #ifdef DEBUG printf("### datatype=%i \n", datatype); #endif char *string=NULL; uint32 count=0; int r = 0; if (datatype == TIFF_ASCII) { //printf("check if tag %u (%s) has valid asciivalue\n", tag, TIFFTagName(tif, tag)); tif_rules_tag(tag, "has valid asciivalue"); char * val=NULL; int count = TIFFGetFieldASCII(ctif, tag, &val); if (0 < count) { /* there exists a tag */ for (int i=0; i #include /* #define DEBUG */ ret_t check_tag_has_value(ctiff_t * ctif, tag_t tag, unsigned int value) { // printf("check if tag %u (%s) has value %u\n", tag, TIFFTagName( tag), value); tifp_check( ctif); // tif_rules_tag(tag, "has value"); ret_t ret; ret = check_tag_has_valid_type( ctif, tag); if (ret.returncode == 0) { ret = check_tag_has_value_quiet( ctif, tag, value); if (ret.returncode == 0) { return ret; } } return tif_fails_by_returns( ret ); } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag_has_value_in_range.c000066400000000000000000000120621304466507300245310ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #define _GNU_SOURCE #include #include "check.h" #include "check_helper.h" #include /* #define DEBUG */ ret_t check_tag_has_value_in_range(ctiff_t * ctif, tag_t tag, unsigned int a, unsigned int b) { //printf("check if tag %u (%s) has value in range %u - %u\n", tag, TIFFTagName(tif, tag), a, b); tifp_check( ctif); char msg[EXPECTSTRLEN]; snprintf(msg, sizeof(msg), "has value in range %u - %u", a, b); tif_rules_tag(tag, strdup(msg)); ret_t res = check_tag_has_valid_type( ctif, tag); if (res.returncode == 0) { if (a > b) { unsigned int c=a; a=b; b=c; } TIFFDataType datatype = TIFFGetRawTagType( ctif, tag ); switch (datatype) { case TIFF_LONG: { uint32 * valp = NULL; uint32 val; int found=TIFFGetFieldLONG(ctif, tag, &valp); if (1 == found) { val = *valp; if ((val >= a && val <= b )) { ret_t tmp_res; tmp_res.returnmsg=NULL; tmp_res.returncode=0; free( valp); return tmp_res; } else { free(valp); return tif_fails_tag( tag, range2str(a, b), int2str(val) ); } } else { if (NULL != valp) { free(valp); valp=NULL; } return tif_fails_tag( tag, "", "was not found, but requested because defined"); } break; } case TIFF_SHORT: { uint16 * valp = NULL; uint16 val; int found=TIFFGetFieldSHORT(ctif, tag, &valp); if (1 == found) { val = *valp; if ((val >= a && val <= b )) { ret_t tmp_res; tmp_res.returnmsg=NULL; tmp_res.returncode=0; free( valp); return tmp_res; } else { free( valp); return tif_fails_tag( tag, range2str(a, b), int2str(val) ); } } else { if (NULL != valp) { free(valp); valp=NULL; } return tif_fails_tag( tag, "", "was not found, but requested because defined"); } break; } case TIFF_RATIONAL: { float * valp = NULL; float val; int found=TIFFGetFieldRATIONAL(ctif, tag, &valp); if (1 == found) { val = * valp; if ((val >= a && val <= b )) { ret_t tmp_res; tmp_res.returnmsg=NULL; tmp_res.returncode=0; free( valp); return tmp_res; } else { // tif_fails("tag %u (%s) should have value in range %u - %u, but have count/value=%f\n", tag,TIFFTagName(tif, tag), a, b, val); free( valp); return tif_fails_tag( tag, range2str(a, b), float2str(val) ); } } else { if (NULL != valp) { free(valp); valp=NULL; } return tif_fails_tag( tag, "", "was not found, but requested because defined"); } break; } default: /* none */ { // tif_fails("tag %u (%s) should have values of type long, short or float, but was:%i\n", tag, TIFFTagName(tif, tag), datatype); char array[VALUESTRLEN]; snprintf(array, sizeof(array), "but was:%i", datatype); return tif_fails_tag( tag, "of type long, short or float", array); } } } return tif_fails_by_returns( res ); } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag_has_value_matching_regex.c000066400000000000000000000070671304466507300257440ustar00rootroot00000000000000#include "check.h" #include "check_helper.h" #include #include /* #define DEBUG */ ret_t check_tag_has_value_matching_regex(ctiff_t * ctif, tag_t tag, const char * regex_string) { //printf("check if tag %u (%s) has value matching regex '%s'\n", tag, TIFFTagName(tif, tag), regex_string); tifp_check( ctif); char msg[EXPECTSTRLEN]; snprintf(msg, sizeof(msg), "has value matching regex '%s'", regex_string); tif_rules_tag(tag, strdup(msg)); TIFFDataType datatype = TIFFGetRawTagType( ctif, tag ); switch (datatype) { case TIFF_ASCII: { char * val=NULL; int count = TIFFGetFieldASCII(ctif, tag, &val); if (0 < count) { #define OVECCOUNT 30 /* should be a multiple of 3 */ pcre *re; int erroffset; const char * errorcode; re = pcre_compile( regex_string, /* the pattern */ 0, /* default options */ &errorcode, /* for error code */ &erroffset, /* for error offset */ NULL); /* no compile context */ if (NULL != re) { int ovector[OVECCOUNT]; /* PCRE_NOTEMPTY: An empty string is not a valid match */ int rc = pcre_exec( re, NULL, val, count-1, 0,PCRE_NOTEMPTY, ovector, OVECCOUNT); #ifdef DEBUG printf("tag %s with count=%d and value='%s' -> rc=%d\n", TIFFTagName(tag), count, val, rc); #endif pcre_free( re ); if (rc >= 0 ) { ret_t res; res.returnmsg=NULL; res.returncode=0; return res; } else { switch(rc) { case PCRE_ERROR_NOMATCH: return tif_fails_tag( tag, strdup(regex_string), val); break; /* Handle other special cases if you like */ default: return tif_fails_tag( tag, strdup(regex_string), val); // tif_fails("tag %u with value '%s' called regex '%s' with matching error %d\n", tag, val, regex_string, rc); break; } } } else { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "regex '%s' compile error: %s at offset: %i\n",regex_string, errorcode, erroffset); return tif_fails(array); } } else { return tif_fails_tag( tag, "should exist, because defined", ""); } } default: /* none */ { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "but was:%i\n", datatype); return tif_fails_tag( tag, "of type ASCII", array); } } } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag_has_value_quiet.c000066400000000000000000000043641304466507300241040ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include #include /* #define DEBUG */ ret_t check_tag_has_value_quiet(ctiff_t * ctif, tag_t tag, unsigned int expected_value) { tifp_check( ctif); ifd_entry_t ifd_entry = TIFFGetRawIFDEntry(ctif, tag); if (ifd_entry.count > 1) { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "but has type:%i and count:%i",ifd_entry.datatype, ifd_entry.count); return tif_returns( tag, "of type long, short or float", strdup(array)); } switch (ifd_entry.datatype) { case TIFF_LONG: { if (expected_value != ifd_entry.data32) { return tif_returns( tag, int2str(expected_value),int2str(ifd_entry.data32)); } break; } case TIFF_SHORT: { if (expected_value != ifd_entry.data16[0]) { return tif_returns( tag, int2str(expected_value),int2str(ifd_entry.data16[0])); } break; } case TIFF_RATIONAL: { if (0 == ifd_entry.data16[1]) { return tif_returns( tag, float2str(expected_value),frac2str( ifd_entry.data16[0], ifd_entry.data16[1])); break; } else if (expected_value - (ifd_entry.data16[0] / ifd_entry.data16[1]) > 1) { return tif_returns( tag, float2str(expected_value), frac2str( ifd_entry.data16[0], ifd_entry.data16[1])); break; } }; default: { /* none */ char array[VALUESTRLEN]; snprintf(array, sizeof(array), " but was datatype:%u", ifd_entry.datatype); return tif_returns( tag, "of type long, short or float", array ); break; }; }; ret_t ret; ret.returncode=0; ret.returnmsg=NULL; return ret; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag_has_valuelist.c000066400000000000000000000140031304466507300235600ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" #include #include /* #define DEBUG */ ret_t check_tag_has_valuelist(ctiff_t * ctif, tag_t tag, int count, unsigned int * values) { //printf("check if tag %u (%s) has these %i-values", tag, TIFFTagName(tif, tag), count); tifp_check( ctif); if (count < 0) { perror ("count should be positive!"); exit( EXIT_FAILURE ); } char msg[EXPECTSTRLEN]; snprintf(msg, sizeof(msg), "has these %i-values: ", count); unsigned int * p = values; for (int i=0; i< count; i++) { if (0 < i) { secstrcat (msg, ", ", EXPECTSTRLEN); } secstrcat (msg, int2str(*p), EXPECTSTRLEN); p++; } tif_rules_tag(tag, strdup(msg)); ret_t res = check_tag_has_valid_type( ctif, tag); if (res.returncode == 0) { unsigned int v[count]; for (int i=0; i< count; i++) { v[i] = *values; values++; } ifd_entry_t ifd_entry = TIFFGetRawIFDEntry(ctif, tag); if (count != ifd_entry.count) { char expected[EXPECTSTRLEN]; snprintf(expected, sizeof(expected), "list has %u values", count); char value[VALUESTRLEN]; snprintf(value, sizeof(value), "has %u values", ifd_entry.count); return tif_fails_tag( tag, strdup(expected), strdup(value)); } ret_t tmp_res; tmp_res.returncode=0; tmp_res.returnmsg=NULL; switch (ifd_entry.datatype) { case TIFF_LONG: { /* value */ if (ifd_entry.value_or_offset == is_value) { for (int i=0; i< count; i++) { if (v[i] != ifd_entry.data32) { char expected[EXPECTSTRLEN]; snprintf(expected, sizeof(expected), "at [%u]=%u", i, v[i]); char value[VALUESTRLEN]; snprintf(value, sizeof(value), "at [%u]=%u", i, ifd_entry.data32); return tif_fails_tag( tag, strdup(expected), strdup(value)); //tif_fails_tag( tag2str(tif, tag), "tag %u (%s), tagvalue[%i]=%u differs from value=%u (long)\n", tag, TIFFTagName(tif, tag), i, ifd_entry.data32, v[i]); } } } /* offset */ if (ifd_entry.value_or_offset == is_offset) { offset_t offset = read_offsetdata(ctif, ifd_entry.data32offset, count, ifd_entry.datatype); uint32 * p = offset.data32p; for (int i=0; i< count; i++) { uint32 pval = *p; #ifdef DEBUG printf("OFFSET: v[%i]=%u p[%i]=%u\n", i,v[i],i,pval); #endif if (v[i] != *p) { char expected[EXPECTSTRLEN]; snprintf(expected, sizeof(expected), "at [%u]=%u", i, v[i]); char value[VALUESTRLEN]; snprintf(value, sizeof(value), "at [%u]=%u", i, pval); return tif_fails_tag( tag, strdup(expected), strdup(value)); } p++; } } return tmp_res; break; } case TIFF_SHORT: { /* value */ if (ifd_entry.value_or_offset == is_value) { for (int i=0; i< count; i++) { int c = (v[i]) == (ifd_entry.data16[i]); if (!c) { char expected[EXPECTSTRLEN]; snprintf(expected, sizeof(expected), "at [%u]=%u", i, v[i]); char value[VALUESTRLEN]; snprintf(value, sizeof(value), "at [%u]=%u", i, ifd_entry.data16[i]); return tif_fails_tag( tag, strdup(expected), strdup(value)); //tif_fails("tag %u (%s), tagvalue[%i]=%u differs from value[%i]=%u (short)\n", tag, TIFFTagName(tif, tag), i, ifd_entry.data16[i], i, v[i]); } } } /* offset */ if (ifd_entry.value_or_offset == is_offset) { offset_t offset = read_offsetdata(ctif, ifd_entry.data32offset, count, ifd_entry.datatype); uint16 * p = offset.data16p; for (int i=0; i< count; i++) { uint16 pval = *p; #ifdef DEBUG printf("SHORTOFFSET (tag=%i): v[%i]=%u p[%i]=0x%04x\n", tag, i,v[i],i,pval); #endif if (v[i] != pval) { char expected[EXPECTSTRLEN]; snprintf(expected, sizeof(expected), "at [%u]=%u", i, v[i]); char value[VALUESTRLEN]; snprintf(value, sizeof(value), "at [%u]=%u", i, pval); return tif_fails_tag( tag, strdup(expected), strdup(value)); // tif_fails("tag %u (%s), tagvalue[%i]=%u differs from value=%u (short offset)\n", tag, TIFFTagName(tif, tag), i, pval, v[i]); } p++; } } return tmp_res; break; } default: /* none */ { char array[VALUESTRLEN]; snprintf(array, sizeof(array), "type:%i", ifd_entry.datatype); return tif_fails_tag( tag, "of type long, short or float", array); } } } return tif_fails_by_returns( res ); } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/tagrules/check_tag_quiet.c000066400000000000000000000011421304466507300220440ustar00rootroot00000000000000/* rule based checks if given TIFF is a specific baseline TIFF * * author: Andreas Romeyke, 2015 * licensed under conditions of libtiff * (see http://libtiff.maptools.org/misc.html) * */ #include "check.h" #include "check_helper.h" /* #define DEBUG */ /* checks if TIF has a specified tag */ ret_t check_tag_quiet(ctiff_t * ctif, tag_t tag) { tifp_check( ctif); ret_t res; res.returnmsg=NULL; if (-1 < TIFFGetRawTagListIndex(ctif, tag)) { res.returncode=0; return res; } res.returncode=1; return res; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/toolchain-mingw32.cmake000066400000000000000000000006001304466507300211770ustar00rootroot00000000000000set (CMAKE_SYSTEM_NAME Windows) set (CMAKE_C_COMPILER i686-w64-mingw32-gcc) set (CMAKE_CXX_COMPILER i686-w64-mingw32-g++) set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # call cmake: # cmake -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake SRCPATH checkit_tiff-0.2.3/src/validate_icc/000077500000000000000000000000001304466507300173445ustar00rootroot00000000000000checkit_tiff-0.2.3/src/validate_icc/check_icc_header.c000066400000000000000000000246651304466507300227300ustar00rootroot00000000000000/* checks ICC Profile, using Spec http://www.color.org/specification/ICC1v43_2010-12.pdf */ #include "validate_icc.h" /* #define USE_WARNING #ifdef USE_WARNING #define FAIL(...) {fprintf(stderr, __VA_ARGS__); return 1;}; #define INFO(...) fprintf(stderr,__VA_ARGS__); #else #define FAIL(...) {return 1;}; #define INFO(...) ; #endif */ #define FAIL(...) {snprintf(errmessage, errsize, __VA_ARGS__); return 1;}; #define INFO(...) ; // TODO: errormessage pointer und maxsize übergeben int parse_icc_header_v240_v430(unsigned long iccsize, char * iccdata, unsigned long errsize, char * errmessage) { assert(iccdata != NULL); assert(errmessage != NULL); assert(errsize > 0); if (iccsize < 128) FAIL("Invalid ICC profile, minimum size is 128 byte"); unsigned long profilesize = ( ((iccdata[0] & 0x00ff) <<24) | ((iccdata[1] & 0x00ff) <<16) | ((iccdata[2] & 0x00ff) <<8) | (iccdata[3] & 0x00ff) ) & 0xffffffff; INFO("ICC: profilesize=%li %0x\n", profilesize, profilesize); if (profilesize != iccsize) FAIL("commited ICC size (%li / 0x%04x) differs from encoded profilesize (%li / 0x%04x)", iccsize, iccsize, profilesize, profilesize); /* -- */ char preferredcmmtype[5]=" "; memcpy(preferredcmmtype, &iccdata[4],4); INFO("ICC: preferredcmmtype='%s'\n", preferredcmmtype); /* TODO: check if this is really correct, because found some TIFFs with * value 'Lino', handle with care! */ if ( /* see document http://www.color.org/registry/signature/TagRegistry-2016-05.pdf */ ('\0' != preferredcmmtype[0]) && (0 != strncmp("ADBE", preferredcmmtype, 4)) && (0 != strncmp("ACMS", preferredcmmtype, 4)) && (0 != strncmp("appl", preferredcmmtype, 4)) && (0 != strncmp("CCMS", preferredcmmtype, 4)) && (0 != strncmp("UCCM", preferredcmmtype, 4)) && (0 != strncmp("UCMS", preferredcmmtype, 4)) && (0 != strncmp("EFI ", preferredcmmtype, 4)) && (0 != strncmp("FF ", preferredcmmtype, 4)) && (0 != strncmp("EXAC", preferredcmmtype, 4)) && (0 != strncmp("HCMM", preferredcmmtype, 4)) && (0 != strncmp("argl", preferredcmmtype, 4)) && (0 != strncmp("LgoS", preferredcmmtype, 4)) && (0 != strncmp("HDM ", preferredcmmtype, 4)) && (0 != strncmp("lcms", preferredcmmtype, 4)) && (0 != strncmp("KCMS", preferredcmmtype, 4)) && (0 != strncmp("MCML", preferredcmmtype, 4)) && (0 != strncmp("WCS ", preferredcmmtype, 4)) && (0 != strncmp("SIGN", preferredcmmtype, 4)) && (0 != strncmp("RGMS", preferredcmmtype, 4)) && (0 != strncmp("SICC", preferredcmmtype, 4)) && (0 != strncmp("TCMM", preferredcmmtype, 4)) && (0 != strncmp("32BT", preferredcmmtype, 4)) && (0 != strncmp("WTG ", preferredcmmtype, 4)) && (0 != strncmp("zc00", preferredcmmtype, 4)) ) FAIL("preferred cmmtype ('%s') should be empty or (possibly, because ICC validation is alpha code) one of following strings: 'ADBE' 'ACMS' 'appl' 'CCMS' 'UCCM' 'UCMS' 'EFI ' 'FF ' 'EXAC' 'HCMM' 'argl' 'LgoS' 'HDM ' 'lcms' 'KCMS' 'MCML' 'WCS ' 'SIGN' 'RGMS' 'SICC' 'TCMM' '32BT' 'WTG ' 'zc00'", preferredcmmtype); /* -- */ char profileversion[6]=" "; snprintf(profileversion, 6, "%i.%i.%i", (iccdata[8]) & 0x000f, ((iccdata[9] & 0x00f0) >>4), (iccdata[9] & 0x000f)); INFO("ICC: profileversion='%s'\n", profileversion); // TODO: 2.4.0 or 4.3.0, others not allowed? /* -- */ char profileclass[5]=" "; memcpy(profileclass, &iccdata[12],4); INFO("ICC: profileclass='%s'\n", profileclass); if ( /* see page 13, table 11 of http://www.color.org/ICC_Minor_Revision_for_Web.pdf */ (0 != strncmp("scnr", profileclass, 4)) && (0 != strncmp("mntr", profileclass, 4)) && (0 != strncmp("prtr", profileclass, 4)) && (0 != strncmp("link", profileclass, 4)) && (0 != strncmp("spac", profileclass, 4)) && (0 != strncmp("abst", profileclass, 4)) && (0 != strncmp("nmcl", profileclass, 4)) ) FAIL("profile class ('%s'), should be one of following strings for device classes: 'scnr', 'mntr', 'prtr' or for profile classes: 'link', 'spac', 'abst', 'nmcl'", profileclass); /* -- */ char colorspacedata[5]=" "; memcpy(colorspacedata, &iccdata[16],4); INFO("ICC: colorspacedata='%s'\n", colorspacedata); if ( /* see page 14, table 13 of http://www.color.org/ICC_Minor_Revision_for_Web.pdf */ (0 != strncmp("XYZ ", colorspacedata, 4)) && (0 != strncmp("Lab ", colorspacedata, 4)) && (0 != strncmp("Luv ", colorspacedata, 4)) && (0 != strncmp("YCbr", colorspacedata, 4)) && (0 != strncmp("Yvx ", colorspacedata, 4)) && (0 != strncmp("RGB ", colorspacedata, 4)) && (0 != strncmp("GRAY", colorspacedata, 4)) && (0 != strncmp("HSV ", colorspacedata, 4)) && (0 != strncmp("HLS ", colorspacedata, 4)) && (0 != strncmp("CMYK", colorspacedata, 4)) && (0 != strncmp("CMY ", colorspacedata, 4)) && (0 != strncmp("2CLR", colorspacedata, 4)) && (0 != strncmp("3CLR", colorspacedata, 4)) && (0 != strncmp("4CLR", colorspacedata, 4)) && (0 != strncmp("5CLR", colorspacedata, 4)) && (0 != strncmp("6CLR", colorspacedata, 4)) && (0 != strncmp("7CLR", colorspacedata, 4)) && (0 != strncmp("8CLR", colorspacedata, 4)) && (0 != strncmp("9CLR", colorspacedata, 4)) && (0 != strncmp("ACLR", colorspacedata, 4)) && (0 != strncmp("BCLR", colorspacedata, 4)) && (0 != strncmp("CCLR", colorspacedata, 4)) && (0 != strncmp("DCLR", colorspacedata, 4)) && (0 != strncmp("ECLR", colorspacedata, 4)) && (0 != strncmp("FCLR", colorspacedata, 4)) ) FAIL("colorspace data ('%s'), should be one of following strings: 'XYZ ' 'Lab ' 'Luv ' 'YCbr' 'Yvx ' 'RGB ' 'GRAY' 'HSV ' 'HLS ' 'CMYK' 'CMY ' '2CLR' '3CLR' '4CLR' '5CLR' '6CLR' '7CLR' '8CLR' '9CLR' 'ACLR' 'BCLR' 'CCLR' 'DCLR' 'ECLR' 'FCLR'", colorspacedata); /* -- */ char connectionspacedata[5]=" "; memcpy(connectionspacedata, &iccdata[20],4); INFO("ICC: connectionspacedata(PCS)='%s'\n", connectionspacedata); if ( /* see page 15, table 14 of http://www.color.org/ICC_Minor_Revision_for_Web.pdf */ (0 != strncmp("XYZ ", connectionspacedata, 4)) && (0 != strncmp("Lab ", connectionspacedata, 4)) ) FAIL("connection space data ('%s') should be one of following strings: 'XYZ ' 'Lab '", connectionspacedata); /* -- */ // datetime 24-35 char datetime[20]; snprintf(datetime, 20, "%.4d:%.2d:%.2d %.2d:%.2d:%.2d", ((iccdata[24] & 0x00ff)<<8 | (iccdata[25] & 0x00ff)), // yyyy ((iccdata[26] & 0x00ff)<<8 | (iccdata[27] & 0x00ff)), // MM ((iccdata[28] & 0x00ff)<<8 | (iccdata[29] & 0x00ff)), // DD ((iccdata[30] & 0x00ff)<<8 | (iccdata[31] & 0x00ff)), // hh ((iccdata[32] & 0x00ff)<<8 | (iccdata[33] & 0x00ff)), // mm ((iccdata[34] & 0x00ff)<<8 | (iccdata[35] & 0x00ff)) // ss ); INFO("ICC: datetime='%s'\n", datetime); /* -- */ char profilefilesignature[5]=" "; memcpy(profilefilesignature, &iccdata[36],4); INFO("ICC: profilefilesignature='%s'\n", profilefilesignature); /* -- */ char primaryplattformsignature[5]=" "; memcpy(primaryplattformsignature, &iccdata[40],4); INFO("ICC: primaryplattformsignature='%s'\n", primaryplattformsignature); if ( /* see page 15, table 15 of http://www.color.org/ICC_Minor_Revision_for_Web.pdf */ ('\0' != primaryplattformsignature[0]) && (0 != strncmp("APPL", primaryplattformsignature, 4)) && (0 != strncmp("MSFT", primaryplattformsignature, 4)) && (0 != strncmp("SGI ", primaryplattformsignature, 4)) && (0 != strncmp("SUNW", primaryplattformsignature, 4)) && (0 != strncmp("TGNT", primaryplattformsignature, 4)) ) FAIL("primary plattform signature ('%s') should be empty or one of following strings: 'APPL', 'MSFT', 'SGI ', 'SUNW', 'TGNT'", primaryplattformsignature); /* -- */ // Profile Flags 44-47 /* -- */ char devicemanufacturer[5]=" "; memcpy(devicemanufacturer, &iccdata[48],4); INFO("ICC: devicemanufacturer='%s'\n", devicemanufacturer); /* -- */ char devicemodel[5]=" "; memcpy(devicemodel, &iccdata[52],4); INFO("ICC: devicemodel='%s'\n", devicemodel); /* -- */ // device attributes 56-63 /* -- */ // rendering intent field 64-67 /* -- */ return 0; } /* checks a ICC header, see chapter 7 of http://www.color.org/specification/ICC1v43_2010-12.pdf */ int parse_icc_v430(unsigned long iccsize, char* iccdata, unsigned long errsize, char * errmessage) { assert(iccdata != NULL); assert(errmessage != NULL); assert(errsize > 0); if (iccsize < 128) FAIL ("Invalid ICC profile 1v43_2010, see http://www.color.org/specification/ICC1v43_2010-12.pdf for details"); int ret_header = parse_icc_header_v240_v430( iccsize, iccdata, errsize, errmessage); if (0 != ret_header) return ret_header; else { // PCS illuminant field 68-79 /* -- */ // Profile creator field 80-83 /* -- */ // Profile ID field 84-99 /* -- */ // Reserved field bytes 100-127 }; return 0; } /* checks a ICC header, see chapter 6 of http://www.color.org/ICC_Minor_Revision_for_Web.pdf */ int parse_icc_v240(unsigned long iccsize, char* iccdata, unsigned long errsize, char * errmessage) { assert(iccdata != NULL); assert(errmessage != NULL); assert(errsize > 0); if (iccsize < 128) FAIL ("Invalid ICC profile ICC.1:2001-04, see http://www.color.org/ICC_Minor_Revision_for_Web.pdf for details"); int ret_header = parse_icc_header_v240_v430( iccsize, iccdata, errsize, errmessage); if (0 != ret_header) return ret_header; else { // PCS xyz illuminant 68-79 /* -- */ // Profile creator signature 80-83 /* -- */ // Reserved field bytes 84-127 }; return 0; } /* returns 0 if valid, !0 if errorneous */ int parse_icc(unsigned long iccsize, char* iccdata, unsigned long errsize, char * errmessage) { assert(iccdata != NULL); assert(errmessage != NULL); assert(errsize > 0); if (iccsize < 10) FAIL ("Invalid ICC profile"); char profileversion[6]=" "; snprintf(profileversion, 6, "%i.%i.%i", (iccdata[8]) & 0x000f, ((iccdata[9] & 0x00f0) >>4), (iccdata[9] & 0x000f)); INFO("ICC: profileversion='%s'\n", profileversion); if (0==strncmp(profileversion, "4.3.0",5)) return parse_icc_v430(iccsize, iccdata, errsize, errmessage); else if (0==strncmp(profileversion, "2.4.0",5)) return parse_icc_v240(iccsize,iccdata, errsize, errmessage); else { return parse_icc_header_v240_v430(iccsize,iccdata, errsize, errmessage); } return 0; } /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab :*/ checkit_tiff-0.2.3/src/validate_icc/validate_icc.h000066400000000000000000000002341304466507300221230ustar00rootroot00000000000000#include #include #include int parse_icc(unsigned long iccsize, char* iccdata, unsigned long errsize, char * errmessage); checkit_tiff-0.2.3/src/version.mk000066400000000000000000000015161304466507300167560ustar00rootroot00000000000000# # source from Ralph Williamsen, # see http://stackoverflow.com/questions/4120001/what-is-the-git-equivalent-for-revision-number # # Set the source control revision similar to subversion to use in 'c' # files as a define. # You must build in the master branch otherwise the build branch will # be prepended to the revision and/or "dirty" appended. This is to # clearly ID developer builds. REPO_REVISION_:=$(shell git rev-list HEAD --count) BUILD_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD) BUILD_REV_ID:=$(shell git rev-parse HEAD) BUILD_REV_ID_SHORT:=$(shell git describe --long --tags --dirty --always) ifeq ($(BUILD_BRANCH), master) REPO_REVISION:=$(REPO_REVISION_)_g$(BUILD_REV_ID_SHORT) else REPO_REVISION:=$(BUILD_BRANCH)_$(REPO_REVISION_)_r$(BUILD_REV_ID_SHORT) endif export REPO_REVISION export BUILD_BRANCH export BUILD_REV_ID checkit_tiff-0.2.3/t/000077500000000000000000000000001304466507300144115ustar00rootroot00000000000000checkit_tiff-0.2.3/t/Testcall.pm000066400000000000000000000030571304466507300165270ustar00rootroot00000000000000use strict; use warnings; package Testcall; use Exporter 'import'; our @EXPORT = qw( $testdir call_checkit_tiff call_checkit_check_config prepare cleanup ); my $testdir = "./testdir/"; my $checkit_check_config="../build/checkit_check_config"; my $checkit_tiff="../build/checkit_tiff"; sub call_checkit_tiff { my $cfg=shift; my $tiff = shift; #print "DEBUG: $checkit_tiff -c $tiff $cfg\n"; print "------------------------\n"; system("$checkit_tiff", "-c", $tiff, $cfg); print "========================\n"; my $ret=0; if ($? == -1) { die "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; return $?; } else { $ret=$?>>8; #printf "child exited with value %d\n", $? >> 8; } return ($ret == 0) } sub call_checkit_check_config { my $grammar = shift; open(my $FOO, "|$checkit_check_config >/dev/null") or die "check failed: $!\n"; print $FOO $grammar; close $FOO; #print "test '$?'\n"; my $ret=0; if ($? == -1) { die "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; return $?; } else { $ret=$?>>8; #printf "child exited with value %d\n", $? >> 8; } return ($ret == 0) } sub prepare { mkdir "$testdir"; return $testdir; } sub cleanup { rmdir "$testdir"; } 1; checkit_tiff-0.2.3/t/test_config_examples.t000066400000000000000000000010201304466507300207710ustar00rootroot00000000000000#!/usr/bin/perl -w use strict; use warnings; use File::Path; use File::Slurp; use Testcall; use Test::More tests => 6; my $testdir=prepare(); my $cfgdir="../example_configs/"; opendir (my $dirh, $cfgdir) || die "could not open dir '$cfgdir', $!\n"; while(readdir $dirh) { if ($_ !~ /^\./ && $_ =~ /\.cfg$/ && -f "$cfgdir/$_") { my $cfg = "$cfgdir/$_"; my $cfgstring=read_file($cfg); ok ( call_checkit_check_config( $cfgstring), "call (<$cfg)" ); } } cleanup(); checkit_tiff-0.2.3/t/test_grammar.t000066400000000000000000000475551304466507300173030ustar00rootroot00000000000000#!/usr/bin/perl -w use strict; use warnings; use File::Path; use File::Slurp; use Testcall; use Test::More tests => 166; my $testdir=prepare(); ok( call_checkit_check_config('') , "empty grammar"); ok(! call_checkit_check_config('#') , "empty comment"); ok( call_checkit_check_config("#mode( test )\n") , "single comment (1)"); ok( call_checkit_check_config("# mode( test )\n") , "single comment (2)"); ok( call_checkit_check_config("\n") , "empty grammar with newline only"); ok( call_checkit_check_config("#\n") , "empty comment with newline"); ok( call_checkit_check_config("# mode( test )\n# modal( test )\n") , "double comment"); #ok(! call_checkit_check_config('mode( baseline )') , "mode( baseline )"); #ok(! call_checkit_check_config('mode( extended )') , "mode( extended )"); #ok(! call_checkit_check_config('mode( nonexist )') , "mode( nonexist )"); ok( call_checkit_check_config("256; mandatory; any\n") , "simple tag mandatory any"); ok(! call_checkit_check_config("0; mandatory; any\n") , "simple non-tag mandatory any"); ok(call_checkit_check_config("65535; mandatory; any\n") , "simple 65535 mandatory any"); ok(call_checkit_check_config("2^8; mandatory; any\n") , "simple 2^8 mandatory any"); ok( call_checkit_check_config("256; mandatory; any\n") , "simple tag mandatory any"); ok( call_checkit_check_config("256; mandatory; only(1)\n") , "simple tag mandatory only(1)"); ok( call_checkit_check_config("256; mandatory; ntupel(1,1,1)\n") , "simple tag mandatory ntupel(1,1,1)"); ok( call_checkit_check_config("256; mandatory; regex(\"string\")\n") , "simple tag mandatory regex(\"string\")"); ok( call_checkit_check_config("256; mandatory; regex(\"^string\")\n") , "simple tag mandatory regex(\"^string\")"); ok( call_checkit_check_config("256; mandatory; regex(\"string\$\")\n") , "simple tag mandatory regex(\"string\$\")"); ok( call_checkit_check_config("256; mandatory; regex(\"^string\$\")\n") , "simple tag mandatory regex(\"^string\$\")"); ok( call_checkit_check_config("256; mandatory; regex(\"s*\")\n") , "simple tag mandatory regex(\"s*\")"); ok( call_checkit_check_config("256; mandatory; regex(\"s?\")\n") , "simple tag mandatory regex(\"s?\")"); ok( call_checkit_check_config("256; mandatory; regex(\"s\\+\")\n") , "simple tag mandatory regex(\"s\\+\")"); ok( call_checkit_check_config("256; mandatory; regex(\"[A-Z]\")\n") , "simple tag mandatory regex(\"[A-Z]\")"); ok( call_checkit_check_config("256; mandatory; regex(\"[^A-Z]\")\n") , "simple tag mandatory regex(\"[^A-Z]\")"); ok( call_checkit_check_config("256; mandatory; range(1,100)\n") , "simple tag mandatory range(1,100)"); ok( call_checkit_check_config("256; mandatory; range(100,1)\n") , "simple tag mandatory range(100,1)"); ok( call_checkit_check_config("256; mandatory; logical_or(100,1)\n") , "simple tag mandatory logical_or(100,1)"); ok( call_checkit_check_config("256; mandatory; logical_or(1,100)\n") , "simple tag mandatory logical_or(1,100)"); ok( call_checkit_check_config("256; mandatory; logical_or(only(100),only(1))\n") , "simple tag mandatory logical_or(only(100),only(1))"); ok( call_checkit_check_config("256; mandatory; logical_or(only(1),only(100))\n") , "simple tag mandatory logical_or(only(1),only(100))"); ok( call_checkit_check_config("256; mandatory; logical_or(ntupel(1,1,1),1)\n") , "simple tag mandatory logical_or(ntupel(1,1,1),1)"); ok( call_checkit_check_config("256; mandatory; logical_or(ntupel(1,1,1),1,regex(\"string\"))\n") , "simple tag mandatory logical_or(ntupel(1,1,1),1,regex(\"string\"))"); ok( call_checkit_check_config("256; mandatory; logical_or(ntupel(8,8,8),ntupel(16,16,16))\n") , "simple tag mandatory logical_or(ntupel(8,8,8),ntupel(16,16,16))"); # ok( call_checkit_check_config("256; optional; any\n") , "simple tag optional any"); ok(! call_checkit_check_config("0; optional; any\n") , "simple non-tag optional any"); ok( call_checkit_check_config("256; optional; any\n") , "simple tag optional any"); ok( call_checkit_check_config("256; optional; only(1)\n") , "simple tag optional only(1)"); ok( call_checkit_check_config("256; optional; ntupel(1,1,1)\n") , "simple tag optional ntupel(1,1,1)"); ok( call_checkit_check_config("256; optional; regex(\"string\")\n") , "simple tag optional regex(\"string\")"); ok( call_checkit_check_config("256; optional; range(1,100)\n") , "simple tag optional range(1,100)"); ok( call_checkit_check_config("256; optional; range(100,1)\n") , "simple tag optional range(100,1)"); ok( call_checkit_check_config("256; optional; logical_or(100,1)\n") , "simple tag optional logical_or(100,1)"); ok( call_checkit_check_config("256; optional; logical_or(1,100)\n") , "simple tag optional logical_or(1,100)"); ok( call_checkit_check_config("256; optional; logical_or(only(100),only(1))\n") , "simple tag optional logical_or(only(100,1))"); ok( call_checkit_check_config("256; optional; logical_or(only(1),only(100))\n") , "simple tag optional logical_or(only(1,100))"); # ok( call_checkit_check_config("256; depends(255.1); any\n") , "simple tag depends(255.1) any"); ok(! call_checkit_check_config("0; depends(255.1); any\n") , "simple non-tag depends(255.1) any"); ok( call_checkit_check_config("256; depends(255.1); any\n") , "simple tag depends(255.1) any"); ok( call_checkit_check_config("256; depends(255.1); only(1)\n") , "simple tag depends(255.1) only(1)"); ok( call_checkit_check_config("256; depends(255.1); ntupel(1,1,1)\n") , "simple tag depends(255.1) ntupel(1,1,1)"); ok( call_checkit_check_config("256; depends(255.1); regex(\"string\")\n") , "simple tag depends(255.1) regex(\"string\")"); ok( call_checkit_check_config("256; depends(255.1); range(1,100)\n") , "simple tag depends(255.1) range(1,100)"); ok( call_checkit_check_config("256; depends(255.1); range(100,1)\n") , "simple tag depends(255.1) range(100,1)"); ok( call_checkit_check_config("256; depends(255.1); logical_or(100,1)\n") , "simple tag depends(255.1) logical_or(100,1)"); ok( call_checkit_check_config("256; depends(255.1); logical_or(1,100)\n") , "simple tag depends(255.1) logical_or(1,100)"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); any\n") , "simple tag depends(255.regex(\"test\")) any"); ok(! call_checkit_check_config("0; depends(255.regex(\"test\")); any\n") , "simple non-tag depends(255.regex(\"test\")) any"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); any\n") , "simple tag depends(255.regex(\"test\")) any"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); only(1)\n") , "simple tag depends(255.regex(\"test\")) only(1)"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); ntupel(1,1,1)\n") , "simple tag depends(255.regex(\"test\")) ntupel(1,1,1)"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); regex(\"string\")\n") , "simple tag depends(255.regex(\"test\")) regex(\"string\")"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); range(1,100)\n") , "simple tag depends(255.regex(\"test\")) range(1,100)"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); range(100,1)\n") , "simple tag depends(255.regex(\"test\")) range(100,1)"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); logical_or(100,1)\n") , "simple tag depends(255.regex(\"test\")) logical_or(100,1)"); ok( call_checkit_check_config("256; depends(255.regex(\"test\")); logical_or(1,100)\n") , "simple tag depends(255.regex(\"test\")) logical_or(1,100)"); ok( call_checkit_check_config("256; depends(255.any); any\n") , "simple tag depends(255.any) any"); ok(! call_checkit_check_config("0; depends(255.any); any\n") , "simple non-tag depends(255.any) any"); ok( call_checkit_check_config("256; depends(255.any); any\n") , "simple tag depends(255.any) any"); ok( call_checkit_check_config("256; depends(255.any); only(1)\n") , "simple tag depends(255.any) only(1)"); ok( call_checkit_check_config("256; depends(255.any); ntupel(1,1,1)\n") , "simple tag depends(255.any) ntupel(1,1,1)"); ok( call_checkit_check_config("256; depends(255.any); regex(\"string\")\n") , "simple tag depends(255.any) regex(\"string\")"); ok( call_checkit_check_config("256; depends(255.any); range(1,100)\n") , "simple tag depends(255.any) range(1,100)"); ok( call_checkit_check_config("256; depends(255.any); range(100,1)\n") , "simple tag depends(255.any) range(100,1)"); ok( call_checkit_check_config("256; depends(255.any); logical_or(100,1)\n") , "simple tag depends(255.any) logical_or(100,1)"); ok( call_checkit_check_config("256; depends(255.any); logical_or(1,100)\n") , "simple tag depends(255.any) logical_or(1,100)"); ok( call_checkit_check_config("256; depends(255.range(1,100)); any\n") , "simple tag depends(255.range(1,100)) any"); ok(! call_checkit_check_config("0; depends(255.range(1,100)); any\n") , "simple non-tag depends(255.range(1,100)) any"); ok( call_checkit_check_config("256; depends(255.range(1,100)); any\n") , "simple tag depends(255.range(1,100)) any"); ok( call_checkit_check_config("256; depends(255.range(1,100)); only(1)\n") , "simple tag depends(255.range(1,100)) only(1)"); ok( call_checkit_check_config("256; depends(255.range(1,100)); ntupel(1,1,1)\n") , "simple tag depends(255.range(1,100)) ntupel(1,1,1)"); ok( call_checkit_check_config("256; depends(255.range(1,100)); regex(\"string\")\n") , "simple tag depends(255.range(1,100)) regex(\"string\")"); ok( call_checkit_check_config("256; depends(255.range(1,100)); range(1,100)\n") , "simple tag depends(255.range(1,100)) range(1,100)"); ok( call_checkit_check_config("256; depends(255.range(1,100)); range(100,1)\n") , "simple tag depends(255.range(1,100)) range(100,1)"); ok( call_checkit_check_config("256; depends(255.range(1,100)); logical_or(100,1)\n") , "simple tag depends(255.range(1,100)) logical_or(100,1)"); ok( call_checkit_check_config("256; depends(255.range(1,100)); logical_or(1,100)\n") , "simple tag depends(255.range(1,100)) logical_or(1,100)"); ok( call_checkit_check_config("256; depends(255.range(0,1)); any\n") , "simple tag depends(255.range(0,1)) any"); ok(! call_checkit_check_config("0; depends(255.range(0,1)); any\n") , "simple non-tag depends(255.range(0,1)) any"); ok( call_checkit_check_config("256; depends(255.range(0,1)); any\n") , "simple tag depends(255.range(0,1)) any"); ok( call_checkit_check_config("256; depends(255.range(0,1)); only(1)\n") , "simple tag depends(255.range(0,1)) only(1)"); ok( call_checkit_check_config("256; depends(255.range(0,1)); ntupel(1,1,1)\n") , "simple tag depends(255.range(0,1)) ntupel(1,1,1)"); ok( call_checkit_check_config("256; depends(255.range(0,1)); regex(\"string\")\n") , "simple tag depends(255.range(0,1)) regex(\"string\")"); ok( call_checkit_check_config("256; depends(255.range(0,1)); range(1,100)\n") , "simple tag depends(255.range(0,1)) range(1,100)"); ok( call_checkit_check_config("256; depends(255.range(0,1)); range(100,1)\n") , "simple tag depends(255.range(0,1)) range(100,1)"); ok( call_checkit_check_config("256; depends(255.range(0,1)); logical_or(100,1)\n") , "simple tag depends(255.range(0,1)) logical_or(100,1)"); ok( call_checkit_check_config("256; depends(255.range(0,1)); logical_or(1,100)\n") , "simple tag depends(255.range(0,1)) logical_or(1,100)"); ok( call_checkit_check_config("256; depends(255.range(0,1)); logical_or(only(100),only(1))\n") , "simple tag depends(255.range(0,1)) logical_or(only(100),only(1)))"); ok( call_checkit_check_config("256; depends(255.range(0,1)); logical_or(only(1),only(100))\n") , "simple tag depends(255.range(0,1)) logical_or(only(1),only(100)))"); ok( call_checkit_check_config("258; depends(262.2); ntupel(8,8,8)\n") , "simple tag depends(262.2); ntupel(8,8,8)"); # ok( call_checkit_check_config("256; optdepends(255.1); any\n") , "simple tag optdepends(255.1) any"); ok(! call_checkit_check_config("0; optdepends(255.1); any\n") , "simple non-tag optdepends(255.1) any"); ok( call_checkit_check_config("256; optdepends(255.1); any\n") , "simple tag optdepends(255.1) any"); ok( call_checkit_check_config("256; optdepends(255.1); only(1)\n") , "simple tag optdepends(255.1) only(1)"); ok( call_checkit_check_config("256; optdepends(255.1); ntupel(1,1,1)\n") , "simple tag optdepends(255.1) ntupel(1,1,1)"); ok( call_checkit_check_config("256; optdepends(255.1); regex(\"string\")\n") , "simple tag optdepends(255.1) regex(\"string\")"); ok( call_checkit_check_config("256; optdepends(255.1); range(1,100)\n") , "simple tag optdepends(255.1) range(1,100)"); ok( call_checkit_check_config("256; optdepends(255.1); range(100,1)\n") , "simple tag optdepends(255.1) range(100,1)"); ok( call_checkit_check_config("256; optdepends(255.1); logical_or(100,1)\n") , "simple tag optdepends(255.1) logical_or(100,1)"); ok( call_checkit_check_config("256; optdepends(255.1); logical_or(1,100)\n") , "simple tag optdepends(255.1) logical_or(1,100)"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); any\n") , "simple tag optdepends(255.regex(\"test\")) any"); ok(! call_checkit_check_config("0; optdepends(255.regex(\"test\")); any\n") , "simple non-tag optdepends(255.regex(\"test\")) any"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); any\n") , "simple tag optdepends(255.regex(\"test\")) any"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); only(1)\n") , "simple tag optdepends(255.regex(\"test\")) only(1)"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); ntupel(1,1,1)\n") , "simple tag optdepends(255.regex(\"test\")) ntupel(1,1,1)"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); regex(\"string\")\n") , "simple tag optdepends(255.regex(\"test\")) regex(\"string\")"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); range(1,100)\n") , "simple tag optdepends(255.regex(\"test\")) range(1,100)"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); range(100,1)\n") , "simple tag optdepends(255.regex(\"test\")) range(100,1)"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); logical_or(100,1)\n") , "simple tag optdepends(255.regex(\"test\")) logical_or(100,1)"); ok( call_checkit_check_config("256; optdepends(255.regex(\"test\")); logical_or(1,100)\n") , "simple tag optdepends(255.regex(\"test\")) logical_or(1,100)"); ok( call_checkit_check_config("256; optdepends(255.any); any\n") , "simple tag optdepends(255.any) any"); ok(! call_checkit_check_config("0; optdepends(255.any); any\n") , "simple non-tag optdepends(255.any) any"); ok( call_checkit_check_config("256; optdepends(255.any); any\n") , "simple tag optdepends(255.any) any"); ok( call_checkit_check_config("256; optdepends(255.any); only(1)\n") , "simple tag optdepends(255.any) only(1)"); ok( call_checkit_check_config("256; optdepends(255.any); ntupel(1,1,1)\n") , "simple tag optdepends(255.any) ntupel(1,1,1)"); ok( call_checkit_check_config("256; optdepends(255.any); regex(\"string\")\n") , "simple tag optdepends(255.any) regex(\"string\")"); ok( call_checkit_check_config("256; optdepends(255.any); range(1,100)\n") , "simple tag optdepends(255.any) range(1,100)"); ok( call_checkit_check_config("256; optdepends(255.any); range(100,1)\n") , "simple tag optdepends(255.any) range(100,1)"); ok( call_checkit_check_config("256; optdepends(255.any); logical_or(100,1)\n") , "simple tag optdepends(255.any) logical_or(100,1)"); ok( call_checkit_check_config("256; optdepends(255.any); logical_or(1,100)\n") , "simple tag optdepends(255.any) logical_or(1,100)"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); any\n") , "simple tag optdepends(255.range(1,100)) any"); ok(! call_checkit_check_config("0; optdepends(255.range(1,100)); any\n") , "simple non-tag optdepends(255.range(1,100)) any"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); any\n") , "simple tag optdepends(255.range(1,100)) any"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); only(1)\n") , "simple tag optdepends(255.range(1,100)) only(1)"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); ntupel(1,1,1)\n") , "simple tag optdepends(255.range(1,100)) ntupel(1,1,1)"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); regex(\"string\")\n") , "simple tag optdepends(255.range(1,100)) regex(\"string\")"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); range(1,100)\n") , "simple tag optdepends(255.range(1,100)) range(1,100)"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); range(100,1)\n") , "simple tag optdepends(255.range(1,100)) range(100,1)"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); logical_or(100,1)\n") , "simple tag optdepends(255.range(1,100)) logical_or(100,1)"); ok( call_checkit_check_config("256; optdepends(255.range(1,100)); logical_or(1,100)\n") , "simple tag optdepends(255.range(1,100)) logical_or(1,100)"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); any\n") , "simple tag optdepends(255.range(0,1)) any"); ok(! call_checkit_check_config("0; optdepends(255.range(0,1)); any\n") , "simple non-tag optdepends(255.range(0,1)) any"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); any\n") , "simple tag optdepends(255.range(0,1)) any"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); only(1)\n") , "simple tag optdepends(255.range(0,1)) only(1)"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); ntupel(1,1,1)\n") , "simple tag optdepends(255.range(0,1)) ntupel(1,1,1)"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); regex(\"string\")\n") , "simple tag optdepends(255.range(0,1)) regex(\"string\")"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); range(1,100)\n") , "simple tag optdepends(255.range(0,1)) range(1,100)"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); range(100,1)\n") , "simple tag optdepends(255.range(0,1)) range(100,1)"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); logical_or(only(100),only(1))\n") , "simple tag optdepends(255.range(0,1)) logical_or(only(100),only(1)))"); ok( call_checkit_check_config("256; optdepends(255.range(0,1)); logical_or(only(1),only(100))\n") , "simple tag optdepends(255.range(0,1)) logical_or(only(1),only(100)))"); # my $grammarfile="$testdir/grammar"; my $grammar=<<"GRAMMAR"; 256; mandatory; any GRAMMAR write_file($grammarfile, $grammar); ok( call_checkit_check_config("include($grammarfile)\n"), "include( $grammarfile )"); ok(call_checkit_check_config("256; mandatory; only(2^32)\n") , "simple tag only(2^32)"); ok(call_checkit_check_config("256; mandatory; only(0x0)\n") , "simple tag only(0x0)"); ok(call_checkit_check_config("256; mandatory; only(0x0000)\n") , "simple tag only(0x0000)"); ok(call_checkit_check_config("256; mandatory; only(0xffff)\n") , "simple tag only(0xffff)"); # ### next tests should fail! ok(! call_checkit_check_config("0; mandatory; any\n") , "simple non-tag (0) mandatory any"); ok(! call_checkit_check_config("253; mandatory; any\n") , "simple non-tag (253) mandatory any"); ok(! call_checkit_check_config("65536; mandatory; any\n") , "simple non-tag (65536) mandatory any"); ok(! call_checkit_check_config("2^16; mandatory; any\n") , "simple non-tag (2^16) mandatory any"); ok(! call_checkit_check_config("0x; mandatory; any\n") , "simple non-tag (0x) mandatory any"); ok(! call_checkit_check_config("0x0; mandatory; any\n") , "simple non-tag (0x0) mandatory any"); ok(! call_checkit_check_config("0xffx; mandatory; any\n") , "simple non-tag (0xffx) mandatory any"); ok(! call_checkit_check_config("0xff0x; mandatory; any\n") , "simple non-tag (0xff0x) mandatory any"); ok(! call_checkit_check_config("0xg; mandatory; any\n") , "simple non-tag (0xg) mandatory any"); ok(! call_checkit_check_config("0x10000; mandatory; any\n") , "simple non-tag (0x10000) mandatory any"); ok(! call_checkit_check_config("256; mandatory; only(1,1,1)\n") , "simple tag mandatory only(1,1,1)"); ok(! call_checkit_check_config("256; mandatory; ntupel(\"1\",\"1\",\"1\")\n") , "simple tag mandatory ntupel(\"1\",\"1\",\"1\")"); ok(! call_checkit_check_config("256, mandatory; any\n") , "simple non-tag (256, mandatory)"); ok(! call_checkit_check_config("256; mandatory, any\n") , "simple tag (mandatory, any)"); cleanup(); checkit_tiff-0.2.3/t/test_should_fail.t000066400000000000000000000032351304466507300201310ustar00rootroot00000000000000#!/usr/bin/perl -w use strict; use warnings; use File::Path; use File::Slurp; use Testcall; use Test::More tests => 14; my $testdir=prepare(); my $checkit_check_config="../build/checkit_check_config"; my $checkit_tiff="../build/checkit_tiff"; my $cfg="$testdir/cit_tiff.cfg"; my $tiffdir="../tiffs_should_fail"; # config base is: ../example_configs/cit_tiff_baseline_minimal.cfg # but with tag 269 optionally allowed my $cfgstring=< 6; my $testdir=prepare(); my $cfgfile="../example_configs/cit_tiff_baseline_minimal.cfg"; my $tiffdir="../tiffs_should_pass"; my $baselinetiff="$tiffdir/minimal_valid_baseline.tiff"; my $smalltiff="$tiffdir/minimal_valid.tiff"; ok ( call_checkit_tiff( $cfgfile, $baselinetiff), "call ($cfgfile, $baselinetiff), TIFF6 baseline" ); ## all mandatory my $cfg=<