Subversion Repositories filter_foundry

Rev

Rev 374 | Rev 378 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #!/usr/bin/php
  2. <?php
  3.  
  4. define('DESC_WIDTH', 55);
  5. define('VENDOR_WIDTH', 15);
  6.  
  7. ob_start();
  8.  
  9. echo "OSTypes used in Filter Foundry\n";
  10. echo "==============================\n";
  11. echo "\n";
  12.  
  13. echo "Note: According to the Photoshop API guide:\n";
  14. echo "- All IDs starting with an uppercase letter are reserved by Adobe.\n";
  15. echo "- All IDs that are all uppercase are reserved by Apple.\n";
  16. echo "- All IDs that are all lowercase are reserved by Apple.\n";
  17. echo "- This leaves all IDs that begin with a lowercase letter and have at least\n";
  18. echo "  one uppercase letter for you and other plug-in developers.\n";
  19. echo "\n";
  20.  
  21. # ------------------------------------------------------------------------------
  22.  
  23. ostype_header("AppleScript related");
  24. ostype_info('tELE', 'Plugin Suite ID', 'Telegraphics');
  25. ostype_info('Fltr', 'Class ID "Filter" (PITerminology.h:eventFilter)', 'Adobe');
  26. ostype_info('fiFo', 'Event ID (for non-standalone filter)', 'Telegraphics');
  27. ostype_info('xprR', 'Expression "red" channel (for non-standalone filter)', 'Telegraphics');
  28. ostype_info('xprG', 'Expression "green" channel (for non-standalone filter)', 'Telegraphics');
  29. ostype_info('xprB', 'Expression "blue" channel (for non-standalone filter)', 'Telegraphics');
  30. ostype_info('xprA', 'Expression "alpha" channel (for non-standalone filter)', 'Telegraphics');
  31. ostype_info('cTl0', 'Slider 0 (for non-standalone filter)', 'Telegraphics');
  32. ostype_info('cTl1', 'Slider 1 (for non-standalone filter)', 'Telegraphics');
  33. ostype_info('cTl2', 'Slider 2 (for non-standalone filter)', 'Telegraphics');
  34. ostype_info('cTl3', 'Slider 3 (for non-standalone filter)', 'Telegraphics');
  35. ostype_info('cTl4', 'Slider 4 (for non-standalone filter)', 'Telegraphics');
  36. ostype_info('cTl5', 'Slider 5 (for non-standalone filter)', 'Telegraphics');
  37. ostype_info('cTl6', 'Slider 6 (for non-standalone filter)', 'Telegraphics');
  38. ostype_info('cTl7', 'Slider 7 (for non-standalone filter)', 'Telegraphics');
  39. ostype_footer();
  40.  
  41. echo "Note: For standalone plugins, all FourCC codes above will be replaced ";
  42. echo "by different hashes based on the parameter data of the filter (except `tELE` and `Fltr`).\n\n";
  43.  
  44. // TODO: also display Windows types, e.g. RT_RCDATA = 'DATA' ?
  45. ostype_header("Resource fork types");
  46. ostype_info('aete', 'Apple Event Terminology', 'Apple'); // https://developer.apple.com/library/archive/documentation/mac/pdf/Interapplication_Communication/AE_Term_Resources.pdf
  47. //ostype_info('PiMI', 'Plug-in Meta Information', 'Adobe');
  48. ostype_info('PiPL', 'PlugIn Property List', 'Adobe');
  49. ostype_info('DATA', 'Generic data (replaced by `tpLT` and `obFS`)', '?');
  50. ostype_info('tpLT', 'Template for standalone filter resources', 'Telegraphics'); // actually defined by ViaThinkSoft for Filter Foundry
  51. ostype_info('obFS', 'Filter Foundry obfuscated data', 'Telegraphics'); // actually defined by ViaThinkSoft
  52. ostype_info('PARM', 'Filter Factory parameter data (PARM.h)', 'Adobe');
  53. // https://developer.apple.com/library/archive/documentation/mac/pdf/ResEditReference.pdf
  54. // https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf
  55. ostype_info('ALRT', 'Alert (only Macintosh build)', 'Apple');
  56. ostype_info('DITL', 'Dialog template (only Macintosh build)', 'Apple');
  57. ostype_info('CNTL', 'Control (only Macintosh build)', 'Apple');
  58. ostype_info('DLOG', 'Dialog (only Macintosh build)', 'Apple');
  59. ostype_info('dlgx', 'Extended Dialog (only Macintosh build)', 'Apple');
  60. ostype_info('dftb', 'Dialog Font Table (only Macintosh build)', 'Apple');
  61. ostype_info('PICT', 'Picture (only Macintosh build)', 'Apple');
  62. ostype_info('CURS', 'Cursor (only Macintosh build)', 'Apple');
  63. ostype_info('vers', 'Version number (only Macintosh build)', 'Apple');
  64. ostype_footer();
  65.  
  66. ostype_header("Creator codes");
  67. ostype_info('8BIM', 'Adobe Photoshop', 'Adobe');
  68. ostype_info('8BFM', 'Adobe Filter module (used in `kind` PiPL property)', 'Adobe');
  69. ostype_footer();
  70.  
  71. pipl_property_header("PlugIn Property List (PiPL) properties");
  72. pipl_property_info('8BIM', 'catg', 'PiPL property "Category"', 'Adobe');
  73. pipl_property_info('8BIM', 'name', 'PiPL property "Name"', 'Adobe');
  74. pipl_property_info('8BIM', 'hstm', 'PiPL property "Has terminology"', 'Adobe');
  75. pipl_property_info('8BIM', 'wx86', 'PiPL property PIWin32X86CodeProperty (PIGeneral.h)', 'Adobe');
  76. pipl_property_info('8BIM', '8664', 'PiPL property PIWin64X86CodeProperty (PIGeneral.h)', 'Adobe');
  77. pipl_property_info('8BIM', 'kind', 'PiPL property "Kind" (PIPL.r)', 'Adobe');
  78. pipl_property_info('8BIM', 'vers', 'PiPL property "Version" (PIPL.r)', 'Adobe');
  79. pipl_property_info('8BIM', 'mode', 'PiPL property "SupportedModes" (PIPL.r)', 'Adobe');
  80. pipl_property_info('8BIM', 'ms32', 'PiPL property "PlugInMaxSize" (PIPL.r)', 'Adobe');
  81. pipl_property_info('8BIM', 'fici', 'PiPL property "FilterCaseInfo" (PIPL.r)', 'Adobe');
  82. pipl_property_footer();
  83.  
  84. # ------------------------------------------------------------------------------
  85.  
  86. $out = ob_get_contents();
  87. ob_end_clean();
  88.  
  89. echo $out;
  90.  
  91. file_put_contents(__DIR__.'/os_types.md', $out);
  92.  
  93. # ------------------------------------------------------------------------------
  94.  
  95. function ostype_info($type, $desc, $vendor) {
  96.         $dec = 0;
  97.         for ($i=0;$i<4;$i++) $dec = ($dec<<8) + ord($type[$i]);
  98.         $hex = "0x".str_pad(dechex($dec), 8, "0", STR_PAD_LEFT);
  99.         $dec = str_pad($dec, strlen(hexdec('ffffffff')), " ", STR_PAD_LEFT);
  100.         $desc = str_pad($desc, DESC_WIDTH, " ", STR_PAD_RIGHT);
  101.  
  102.         $illegal = false;
  103.         if ($vendor != '?') {
  104.                 $is_all_uppercase = strtoupper($type) == $type;
  105.                 $is_all_lowercase = strtolower($type) == $type;
  106.                 $starts_with_uppercase = strtoupper($type[0]) == $type[0];
  107.                 if (($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') === false)) $illegal = true;
  108.                 else if (!($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') !== false)) $illegal = true;
  109.                 else if ($starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') === false)) $illegal = true;
  110.                 else if (!$starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') !== false)) $illegal = true;
  111.         }
  112.         // In re 8B##, we just assume that 8B## was legally assigned to Adobe by Apple
  113.         // Note: "8B" sounds like "Adobe"
  114.         if ((substr($type,0,2) === '8B') && (strpos($vendor,'Adobe') !== false)) $illegal = false;
  115.  
  116.         if ($illegal) $vendor .= ' (illegal)';
  117.         $vendor = str_pad($vendor, VENDOR_WIDTH, " ", STR_PAD_RIGHT);
  118.  
  119.         echo "| `$type` | $dec | $hex | $desc | $vendor |\n";
  120. }
  121.  
  122. function ostype_footer() {
  123.         echo "\n";
  124. }
  125.  
  126. function ostype_header($title) {
  127.         echo "$title\n";
  128.         echo str_repeat('-',strlen($title))."\n";
  129.         echo "\n";
  130.         echo "| Type   | Dec        | Hex        | ".str_pad('Description', DESC_WIDTH, " ", STR_PAD_RIGHT)." | ".str_pad('Vendor', VENDOR_WIDTH, " ", STR_PAD_RIGHT)." |\n";
  131.         echo "|--------|------------|------------|".str_repeat('-', DESC_WIDTH+2)."|".str_repeat('-', VENDOR_WIDTH+2)."|\n";
  132. }
  133.  
  134. # ------------------------------------------------------------------------------
  135.  
  136. function pipl_property_info($ven, $type, $desc, $vendor) {
  137.         $vdec = 0;
  138.         for ($i=0;$i<4;$i++) $vdec = ($vdec<<8) + ord($ven[$i]);
  139.         $vhex = "0x".str_pad(dechex($vdec), 8, "0", STR_PAD_LEFT);
  140.         $vdec = str_pad($vdec, strlen(hexdec('ffffffff')), " ", STR_PAD_LEFT);
  141.  
  142.         $dec = 0;
  143.         for ($i=0;$i<4;$i++) $dec = ($dec<<8) + ord($type[$i]);
  144.         $hex = "0x".str_pad(dechex($dec), 8, "0", STR_PAD_LEFT);
  145.         $dec = str_pad($dec, strlen(hexdec('ffffffff')), " ", STR_PAD_LEFT);
  146.  
  147.         $desc = str_pad($desc, DESC_WIDTH, " ", STR_PAD_RIGHT);
  148.  
  149.         // In re 8B##, we just assume that 8B## was legally assigned to Adobe by Apple
  150.         // Note: "8B" sounds like "Adobe"
  151.         $illegal = (substr($ven,0,2) === '8B') != (strpos($vendor,'Adobe') !== false);
  152.  
  153.         if ($illegal) $vendor .= ' (illegal)';
  154.         $vendor = str_pad($vendor, VENDOR_WIDTH, " ", STR_PAD_RIGHT);
  155.  
  156.         echo "| `$ven` | `$type` | $vdec $dec | $vhex $hex | $desc | $vendor |\n";
  157. }
  158.  
  159. function pipl_property_footer() {
  160.         echo "\n";
  161. }
  162.  
  163. function pipl_property_header($title) {
  164.         echo "$title\n";
  165.         echo str_repeat('-',strlen($title))."\n";
  166.         echo "\n";
  167.         echo "| C.code | Prpty. | Dec                   | Hex                   | ".str_pad('Description', DESC_WIDTH, " ", STR_PAD_RIGHT)." | ".str_pad('Vendor', VENDOR_WIDTH, " ", STR_PAD_RIGHT)." |\n";
  168.         echo "|--------|--------|-----------------------|-----------------------|".str_repeat('-', DESC_WIDTH+2)."|".str_repeat('-', VENDOR_WIDTH+2)."|\n";
  169. }
  170.  
  171.