"checkit_tiff" is an incredibly fast conformance checker for baseline TIFFs (with various extensions), see http://andreas-romeyke.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
4.0 KiB

4 years ago
  1. About general function
  2. ======================
  3. The checkit-tool validates TIFF-files against a set of rules (see below). The
  4. set of rules works as a whitelist. This means that TIFF tags that are used in
  5. the file but not explicitly checked by a specific rule (not considering if
  6. successful or not) are not allowed. In cases where a rule is executed only
  7. if a predicate is set, the tag is only allowed if the predicate check succeeded.
  8. Developers
  9. ==========
  10. to configure the grammar you could use the PEG-extension for gvim from
  11. https://github.com/gf3/peg.vim
  12. To visualize the grammar, checkout this tools:
  13. * http://bottlecaps.de/convert/
  14. * http://bottlecaps.de/rr/ui
  15. The actual grammar is visualized in grammar.xhtml
  16. Users
  17. =====
  18. To define your own config-file for checking TIFFs, please use this simplified
  19. syntax:
  20. * Each line is either a "modeline", an "include" line, a "tag" line, a comment or empty
  21. * TODO: a modeline uses "mode(MODE)", MODE could be:
  22. ** "baseline", if no modeline is defined, it defaults to "mode(baseline)", too
  23. ** "extended"
  24. * To include a configfile, use "include(FILENAME)", where FILENAME is a correct path
  25. * Comments starts with '# '. They are only allowed to start right at the beginning of a new line.
  26. * A tagline is built as "TAG; REQUIREMENTS; VALUES", where
  27. * a TAG is an increasing number similar to TIFF-Tag numbers (see TIFF specification)
  28. * REQUIREMENTS could be
  29. ** 'mandatory' - a tag must exist in TIFF
  30. ** 'optional' - a tag may exist in TIFF, if it does, it will be checked
  31. ** 'depends(REFERENCE)' - a tag must exist in TIFF if reference exists
  32. ** 'optdepends(REFERENCE)' - a tag may exists in TIFF if reference exists. If it exists it will be checked
  33. * The syntax for a REFERENCE is TAGREFERENCE.VALUEREFERENCE
  34. ** TAGREFERENCE points to a tag number which must be exist,
  35. ** VALUEREFERENCE can be one of:
  36. *** 'any' (which means any match) or
  37. *** a decimal value or
  38. *** 'range(START, END)', where START and END are decimal values
  39. *** 'only(VALUE)', where VALUE is a decimal value
  40. *** 'ntupel(VALUE, ..), decimal values as n-tupel enclosed in brackets
  41. *** 'regex("REGEX")', where REGEX is a Perl compatible regular expression (PCRE) with escaped '"' and '\', it only works with tags of type ascii
  42. ** only if REFERENCE exists in TIFF the REQUIREMENTS rule will be checked
  43. ** The REQUIREMENTS rule will only be checked if REFERENCE exists in the TIF
  44. file.
  45. * VALUES can be one of:
  46. ** 'range(START, END)', where START and END are decimal values
  47. ** 'logical_or( VALUELIST)', where VALUELIST are comma-separated decimale values or ntupels
  48. ** 'any', which means any match
  49. ** 'only(VALUE)', where VALUE is a decimal value
  50. ** 'ntupel(VALUE, ..), decimal values as n-tupel enclosed in brackets
  51. ** 'regex("REGEX")', where REGEX is a Perl compatible regular expression (PCRE) with escaped '"' and '\', it only works with tags of type ascii
  52. * each tagline or comment must be closed with a new line
  53. If multiple rules are defined per tag, they will be combined.
  54. For examples, please check the 'example_configs/' - directory.
  55. Values
  56. ======
  57. At the moment, the parser only supports a limited type of values. To make
  58. handling easier, it uses only the value/offset part of an IFD entry.
  59. Test if grammar parser works correctly
  60. ======================================
  61. You could use the program '/checkit_check_config < your.cfg', this would print
  62. a reversed stack ouput, how echa rule will be applied.
  63. For example, if your rule is
  64. ----
  65. 258; optdepends(262.1); logical_or(1, 4, 8)'
  66. ----
  67. it will print:
  68. ----
  69. ((( parse config file )))
  70. ((( execute execution plan )))
  71. ((( clean execution plan )))
  72. ((( print internal execution plan )))
  73. /* the rules are in stack order, the top comes first */
  74. /* lineno=001 */ PRECOND: fc_tag_quiet tag=258 top i stack=(0)
  75. /* lineno=001 */ PRECOND: fc_tag_has_value_quiet tag=262 top i stack=(1)
  76. /* lineno=001 */ EXEC: fc_internal_logic_combine_open tag=258 top i stack=(1)
  77. /* lineno=001 */ EXEC: fc_tag_has_value tag=258 top i stack=(1)
  78. /* lineno=001 */ EXEC: fc_tag_has_value tag=258 top i stack=(4)
  79. /* lineno=001 */ EXEC: fc_tag_has_value tag=258 top i stack=(8)
  80. ----