Subversion Repositories filter_foundry

Rev

Rev 374 | 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('aete', 'Apple Event Terminology', 'Apple'); // https://developer.apple.com/library/archive/documentation/mac/pdf/Interapplication_Communication/AE_Term_Resources.pdf
  25. ostype_info('tELE', 'Plugin Suite ID', 'Telegraphics');
  26. ostype_info('Fltr', 'Class ID "Filter" (PITerminology.h:eventFilter)', 'Adobe');
  27. ostype_info('fiFo', 'Event ID (for non-standalone filter)', 'Telegraphics');
  28. ostype_info('xprR', 'Expression "red" channel (for non-standalone filter)', 'Telegraphics');
  29. ostype_info('xprG', 'Expression "green" channel (for non-standalone filter)', 'Telegraphics');
  30. ostype_info('xprB', 'Expression "blue" channel (for non-standalone filter)', 'Telegraphics');
  31. ostype_info('xprA', 'Expression "alpha" channel (for non-standalone filter)', 'Telegraphics');
  32. ostype_info('cTl0', 'Slider 0 (for non-standalone filter)', 'Telegraphics');
  33. ostype_info('cTl1', 'Slider 1 (for non-standalone filter)', 'Telegraphics');
  34. ostype_info('cTl2', 'Slider 2 (for non-standalone filter)', 'Telegraphics');
  35. ostype_info('cTl3', 'Slider 3 (for non-standalone filter)', 'Telegraphics');
  36. ostype_info('cTl4', 'Slider 4 (for non-standalone filter)', 'Telegraphics');
  37. ostype_info('cTl5', 'Slider 5 (for non-standalone filter)', 'Telegraphics');
  38. ostype_info('cTl6', 'Slider 6 (for non-standalone filter)', 'Telegraphics');
  39. ostype_info('cTl7', 'Slider 7 (for non-standalone filter)', 'Telegraphics');
  40. ostype_footer();
  41.  
  42. ostype_header("Resource types");
  43. ostype_info('tpLT', 'Template for standalone filter resources', 'Telegraphics');
  44. ostype_info('DATA', 'Generic Data (used in for obfuscated filters)', 'Apple?');
  45. ostype_info('PARM', 'Filter Factory parameter data (PARM.h)', 'Adobe');
  46. // https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf
  47. ostype_info('ALRT', 'Alert', 'Apple');
  48. ostype_info('CITL', 'Dialog template', 'Apple');
  49. ostype_info('CNTL', 'Control', 'Apple');
  50. ostype_info('DLOG', 'Dialog', 'Apple');
  51. ostype_info('dlgx', 'Extended Dialog', 'Apple');
  52. ostype_info('dftb', 'Dialog Font Table', 'Apple');
  53. ostype_info('PICT', 'Picture', 'Apple');
  54. ostype_info('CURS', 'Cursor', 'Apple');
  55. ostype_info('vers', 'Version number', 'Apple');
  56. ostype_footer();
  57.  
  58. ostype_header("PlugIn Property List (PiPL) related");
  59. //ostype_info('PiMI', 'Plug-in Meta Information', 'Adobe');
  60. ostype_info('PiPL', 'PlugIn Property List', 'Adobe');
  61. ostype_info('catg', 'PiPL property "Category"', 'Adobe');
  62. ostype_info('name', 'PiPL property "Name"', 'Adobe');
  63. ostype_info('hstm', 'PiPL property "Has terminology"', 'Adobe');
  64. ostype_info('8BIM', 'Adobe Photoshop vendor code', 'Adobe');
  65. ostype_info('wx86', 'PIWin32X86CodeProperty (PIGeneral.h)', 'Adobe');
  66. ostype_info('8664', 'PIWin64X86CodeProperty (PIGeneral.h)', 'Adobe');
  67. ostype_info('kind', 'PiPL property "Kind" (PIPL.r)', 'Adobe');
  68. ostype_info('8BFM', 'Filter module (used in \'kind\' property)', 'Adobe');
  69. ostype_info('vers', 'PiPL property "Version" (PIPL.r)', 'Adobe');
  70. ostype_info('mode', 'PiPL property "SupportedModes" (PIPL.r)', 'Adobe');
  71. ostype_info('ms32', 'PiPL property "PlugInMaxSize" (PIPL.r)', 'Adobe');
  72. ostype_info('fici', 'PiPL property "FilterCaseInfo" (PIPL.r)', 'Adobe');
  73.  
  74. # ------------------------------------------------------------------------------
  75.  
  76. $out = ob_get_contents();
  77. ob_end_clean();
  78.  
  79. echo $out;
  80.  
  81. file_put_contents(__DIR__.'/os_types.md', $out);
  82.  
  83. # ------------------------------------------------------------------------------
  84.  
  85. function ostype_info($type, $desc, $vendor) {
  86.         $dec = 0;
  87.         for ($i=0;$i<4;$i++) $dec = ($dec<<8) + ord($type[$i]);
  88.         $hex = "0x".str_pad(dechex($dec), 8, "0", STR_PAD_LEFT);
  89.         $dec = str_pad($dec, strlen(hexdec('ffffffff')), " ", STR_PAD_LEFT);
  90.         $desc = str_pad($desc, DESC_WIDTH, " ", STR_PAD_RIGHT);
  91.  
  92.         if ($vendor != '?') {
  93.                 $is_all_uppercase = strtoupper($type) == $type;
  94.                 $is_all_lowercase = strtolower($type) == $type;
  95.                 $starts_with_uppercase = strtoupper($type[0]) == $type[0];
  96.                 if (($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') === false)) $vendor .= ' (illegal)';
  97.                 else if (!($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') !== false)) $vendor .= ' (illegal)';
  98.                 else if ($starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') === false)) $vendor .= ' (illegal)';
  99.                 else if (!$starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') !== false)) $vendor .= ' (illegal)';
  100.         }
  101.  
  102.         $vendor = str_pad($vendor, VENDOR_WIDTH, " ", STR_PAD_RIGHT);
  103.  
  104.         echo "| `$type` | $dec | $hex | $desc | $vendor |\n";
  105. }
  106.  
  107. function ostype_footer() {
  108.         echo "\n";
  109. }
  110.  
  111. function ostype_header($title) {
  112.         echo "$title\n";
  113.         echo str_repeat('-',strlen($title))."\n";
  114.         echo "\n";
  115.         echo "| Type   | Dec        | Hex        | ".str_pad('Description', DESC_WIDTH, " ", STR_PAD_RIGHT)." | ".str_pad('Vendor', VENDOR_WIDTH, " ", STR_PAD_RIGHT)." |\n";
  116.         echo "|--------|------------|------------|".str_repeat('-', DESC_WIDTH+2)."|".str_repeat('-', VENDOR_WIDTH+2)."|\n";
  117.  
  118. }
  119.