Rev 515 | Rev 526 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 515 | Rev 519 | ||
---|---|---|---|
1 | #!/usr/bin/php |
1 | #!/usr/bin/php |
2 | <?php |
2 | <?php |
3 | 3 | ||
4 | /* |
4 | /* |
5 | This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop |
5 | This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop |
6 | Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.com.au |
6 | Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.com.au |
7 | Copyright (C) 2018-2022 Daniel Marschall, ViaThinkSoft |
7 | Copyright (C) 2018-2022 Daniel Marschall, ViaThinkSoft |
8 | 8 | ||
9 | This program is free software; you can redistribute it and/or modify |
9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by |
10 | it under the terms of the GNU General Public License as published by |
11 | the Free Software Foundation; either version 2 of the License, or |
11 | the Free Software Foundation; either version 2 of the License, or |
12 | (at your option) any later version. |
12 | (at your option) any later version. |
13 | 13 | ||
14 | This program is distributed in the hope that it will be useful, |
14 | This program is distributed in the hope that it will be useful, |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. |
17 | GNU General Public License for more details. |
18 | 18 | ||
19 | You should have received a copy of the GNU General Public License |
19 | You should have received a copy of the GNU General Public License |
20 | along with this program; if not, write to the Free Software |
20 | along with this program; if not, write to the Free Software |
21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 | */ |
22 | */ |
23 | 23 | ||
24 | // This script generates the documentation file os_types.md |
24 | // This script generates the documentation file os_types.md |
25 | 25 | ||
26 | define('DESC_WIDTH', 55); |
26 | define('DESC_WIDTH', 55); |
27 | define('VENDOR_WIDTH', 15); |
27 | define('VENDOR_WIDTH', 15); |
28 | 28 | ||
29 | ob_start(); |
29 | ob_start(); |
30 | 30 | ||
31 | echo "OSTypes used in Filter Foundry\n"; |
31 | echo "OSTypes used in Filter Foundry\n"; |
32 | echo "==============================\n"; |
32 | echo "==============================\n"; |
33 | echo "\n"; |
33 | echo "\n"; |
34 | 34 | ||
35 | echo "Note: According to the Photoshop API guide:\n"; |
35 | echo "Note: According to the Photoshop API guide:\n"; |
36 | echo "- All IDs starting with an uppercase letter are reserved by Adobe.\n"; |
36 | echo "- All IDs starting with an uppercase letter are reserved by Adobe.\n"; |
37 | echo "- All IDs that are all uppercase are reserved by Apple.\n"; |
37 | echo "- All IDs that are all uppercase are reserved by Apple.\n"; |
38 | echo "- All IDs that are all lowercase are reserved by Apple.\n"; |
38 | echo "- All IDs that are all lowercase are reserved by Apple.\n"; |
39 | echo "- This leaves all IDs that begin with a lowercase letter and have at least\n"; |
39 | echo "- This leaves all IDs that begin with a lowercase letter and have at least\n"; |
40 | echo " one uppercase letter for you and other plug-in developers.\n"; |
40 | echo " one uppercase letter for you and other plug-in developers.\n"; |
41 | echo "\n"; |
41 | echo "\n"; |
42 | 42 | ||
43 | # ------------------------------------------------------------------------------ |
43 | # ------------------------------------------------------------------------------ |
44 | 44 | ||
45 | ostype_header("AppleScript related"); |
45 | ostype_header("AppleScript related"); |
46 | ostype_info('tELE', 'Plugin Suite ID', 'Telegraphics'); |
46 | ostype_info('tELE', 'Plugin Suite ID', 'Telegraphics'); |
47 | ostype_info('Fltr', 'Class ID "Filter" (PITerminology.h:eventFilter)', 'Adobe'); |
47 | ostype_info('Fltr', 'Class ID "Filter" (PITerminology.h:eventFilter)', 'Adobe'); |
48 | ostype_info('fiFo', 'Event ID (for non-standalone filter)', 'Telegraphics'); |
48 | ostype_info('fiFo', 'Event ID (for non-standalone filter)', 'Telegraphics'); |
49 | ostype_info('xprR', 'Expression "red" channel (for non-standalone filter)', 'Telegraphics'); |
49 | ostype_info('xprR', 'Expression "red" channel (for non-standalone filter)', 'Telegraphics'); |
50 | ostype_info('xprG', 'Expression "green" channel (for non-standalone filter)', 'Telegraphics'); |
50 | ostype_info('xprG', 'Expression "green" channel (for non-standalone filter)', 'Telegraphics'); |
51 | ostype_info('xprB', 'Expression "blue" channel (for non-standalone filter)', 'Telegraphics'); |
51 | ostype_info('xprB', 'Expression "blue" channel (for non-standalone filter)', 'Telegraphics'); |
52 | ostype_info('xprA', 'Expression "alpha" channel (for non-standalone filter)', 'Telegraphics'); |
52 | ostype_info('xprA', 'Expression "alpha" channel (for non-standalone filter)', 'Telegraphics'); |
53 | ostype_info('cTl0', 'Slider 0 (for non-standalone filter)', 'Telegraphics'); |
53 | ostype_info('cTl0', 'Slider 0 (for non-standalone filter)', 'Telegraphics'); |
54 | ostype_info('cTl1', 'Slider 1 (for non-standalone filter)', 'Telegraphics'); |
54 | ostype_info('cTl1', 'Slider 1 (for non-standalone filter)', 'Telegraphics'); |
55 | ostype_info('cTl2', 'Slider 2 (for non-standalone filter)', 'Telegraphics'); |
55 | ostype_info('cTl2', 'Slider 2 (for non-standalone filter)', 'Telegraphics'); |
56 | ostype_info('cTl3', 'Slider 3 (for non-standalone filter)', 'Telegraphics'); |
56 | ostype_info('cTl3', 'Slider 3 (for non-standalone filter)', 'Telegraphics'); |
57 | ostype_info('cTl4', 'Slider 4 (for non-standalone filter)', 'Telegraphics'); |
57 | ostype_info('cTl4', 'Slider 4 (for non-standalone filter)', 'Telegraphics'); |
58 | ostype_info('cTl5', 'Slider 5 (for non-standalone filter)', 'Telegraphics'); |
58 | ostype_info('cTl5', 'Slider 5 (for non-standalone filter)', 'Telegraphics'); |
59 | ostype_info('cTl6', 'Slider 6 (for non-standalone filter)', 'Telegraphics'); |
59 | ostype_info('cTl6', 'Slider 6 (for non-standalone filter)', 'Telegraphics'); |
60 | ostype_info('cTl7', 'Slider 7 (for non-standalone filter)', 'Telegraphics'); |
60 | ostype_info('cTl7', 'Slider 7 (for non-standalone filter)', 'Telegraphics'); |
61 | ostype_footer(); |
61 | ostype_footer(); |
62 | 62 | ||
63 | echo "Note: For standalone plugins, all FourCC codes above will be replaced "; |
63 | echo "Note: For standalone plugins, all FourCC codes above will be replaced "; |
64 | echo "by different hashes based on the parameter data of the filter (except `tELE` and `Fltr`).\n\n"; |
64 | echo "by different hashes based on the parameter data of the filter (except `tELE` and `Fltr`).\n\n"; |
65 | 65 | ||
66 | // TODO: also display Windows types, e.g. RT_RCDATA = 'DATA' ? |
66 | // TODO: also display Windows types, e.g. RT_RCDATA = 'DATA' ? |
67 | ostype_header("Resource fork types"); |
67 | ostype_header("Resource fork types"); |
68 | ostype_info('aete', 'Apple Event Terminology', 'Apple'); // https://developer.apple.com/library/archive/documentation/mac/pdf/Interapplication_Communication/AE_Term_Resources.pdf |
68 | ostype_info('aete', 'Apple Event Terminology', 'Apple'); // https://developer.apple.com/library/archive/documentation/mac/pdf/Interapplication_Communication/AE_Term_Resources.pdf |
69 | //ostype_info('PiMI', 'Plug-in Meta Information', 'Adobe'); |
69 | //ostype_info('PiMI', 'Plug-in Meta Information', 'Adobe'); |
70 | ostype_info('PiPL', 'PlugIn Property List', 'Adobe'); |
70 | ostype_info('PiPL', 'PlugIn Property List', 'Adobe'); |
71 | ostype_info('DATA', 'Generic data (replaced by `tpLT` and `obFS`)', '?'); |
71 | ostype_info('DATA', 'Generic data (replaced by `tpLT` and `obFS`)', '?'); |
72 | ostype_info('tpLT', 'Template for standalone filter resources', 'ViaThinkSoft'); |
72 | ostype_info('tpLT', 'Template for standalone filter resources', 'ViaThinkSoft'); |
73 | ostype_info('obFS', 'Filter Foundry obfuscated data', 'ViaThinkSoft'); |
73 | ostype_info('obFS', 'Filter Foundry obfuscated data', 'ViaThinkSoft'); |
74 | ostype_info('PARM', 'Filter Factory parameter data (PARM.h)', 'Adobe'); |
74 | ostype_info('PARM', 'Filter Factory parameter data (PARM.h)', 'Adobe'); |
75 | // https://developer.apple.com/library/archive/documentation/mac/pdf/ResEditReference.pdf |
75 | // https://developer.apple.com/library/archive/documentation/mac/pdf/ResEditReference.pdf |
76 | // https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf |
76 | // https://developer.apple.com/library/archive/documentation/mac/pdf/MoreMacintoshToolbox.pdf |
77 | ostype_info('ALRT', 'Alert (only Macintosh build)', 'Apple'); |
77 | ostype_info('ALRT', 'Alert (only Macintosh build)', 'Apple'); |
78 | ostype_info('DITL', 'Dialog template (only Macintosh build)', 'Apple'); |
78 | ostype_info('DITL', 'Dialog template (only Macintosh build)', 'Apple'); |
79 | ostype_info('CNTL', 'Control (only Macintosh build)', 'Apple'); |
79 | ostype_info('CNTL', 'Control (only Macintosh build)', 'Apple'); |
80 | ostype_info('DLOG', 'Dialog (only Macintosh build)', 'Apple'); |
80 | ostype_info('DLOG', 'Dialog (only Macintosh build)', 'Apple'); |
81 | ostype_info('dlgx', 'Extended Dialog (only Macintosh build)', 'Apple'); |
81 | ostype_info('dlgx', 'Extended Dialog (only Macintosh build)', 'Apple'); |
82 | ostype_info('dftb', 'Dialog Font Table (only Macintosh build)', 'Apple'); |
82 | ostype_info('dftb', 'Dialog Font Table (only Macintosh build)', 'Apple'); |
83 | ostype_info('PICT', 'Picture (only Macintosh build)', 'Apple'); |
83 | ostype_info('PICT', 'Picture (only Macintosh build)', 'Apple'); |
84 | ostype_info('CURS', 'Cursor (only Macintosh build)', 'Apple'); |
84 | ostype_info('CURS', 'Cursor (only Macintosh build)', 'Apple'); |
85 | ostype_info('vers', 'Version number (only Macintosh build)', 'Apple'); |
85 | ostype_info('vers', 'Version number (only Macintosh build)', 'Apple'); |
86 | ostype_footer(); |
86 | ostype_footer(); |
87 | 87 | ||
- | 88 | ostype_header("File type"); |
|
- | 89 | ostype_info('8BFM', 'Adobe Filter module (used in `kind` PiPL property)', 'Adobe'); |
|
- | 90 | ostype_info('TEXT', 'Text file', 'Apple'); |
|
- | 91 | ostype_footer(); |
|
- | 92 | ||
88 | ostype_header("Creator codes"); |
93 | ostype_header("Creator codes"); |
89 | ostype_info('8BIM', 'Adobe Photoshop', 'Adobe'); |
94 | ostype_info('8BIM', 'Adobe Photoshop', 'Adobe'); |
- | 95 | ostype_info('ttxt', 'Text file', 'Apple'); |
|
90 | ostype_info('8BFM', 'Adobe Filter module (used in `kind` PiPL property)', 'Adobe'); |
96 | ostype_info('pled', 'Property List Editor', 'Apple'); |
91 | ostype_footer(); |
97 | ostype_footer(); |
92 | 98 | ||
93 | pipl_property_header("PlugIn Property List (PiPL) properties"); |
99 | pipl_property_header("PlugIn Property List (PiPL) properties"); |
94 | pipl_property_info('8BIM', 'catg', 'PiPL property "Category"', 'Adobe'); |
100 | pipl_property_info('8BIM', 'catg', 'PiPL property "Category"', 'Adobe'); |
95 | pipl_property_info('8BIM', 'name', 'PiPL property "Name"', 'Adobe'); |
101 | pipl_property_info('8BIM', 'name', 'PiPL property "Name"', 'Adobe'); |
- | 102 | pipl_property_info('8BIM', 'cmpt', 'PiPL property "Component" (PIPL.r)', 'Adobe'); |
|
96 | pipl_property_info('8BIM', 'hstm', 'PiPL property "Has terminology"', 'Adobe'); |
103 | pipl_property_info('8BIM', 'hstm', 'PiPL property "HasTerminology" (PIPL.r)', 'Adobe'); |
97 | pipl_property_info('8BIM', 'wx86', 'PiPL property PIWin32X86CodeProperty (PIGeneral.h)', 'Adobe'); |
104 | pipl_property_info('8BIM', 'wx86', 'PiPL property PIWin32X86CodeProperty (PIGeneral.h)', 'Adobe'); |
98 | pipl_property_info('8BIM', '8664', 'PiPL property PIWin64X86CodeProperty (PIGeneral.h)', 'Adobe'); |
105 | pipl_property_info('8BIM', '8664', 'PiPL property PIWin64X86CodeProperty (PIGeneral.h)', 'Adobe'); |
99 | pipl_property_info('8BIM', 'kind', 'PiPL property "Kind" (PIPL.r)', 'Adobe'); |
106 | pipl_property_info('8BIM', 'kind', 'PiPL property "Kind" (PIPL.r)', 'Adobe'); |
- | 107 | pipl_property_info('8BIM', 'prty', 'PiPL property "Priority" (PIPL.r)', 'Adobe'); |
|
100 | pipl_property_info('8BIM', 'vers', 'PiPL property "Version" (PIPL.r)', 'Adobe'); |
108 | pipl_property_info('8BIM', 'vers', 'PiPL property "Version" (PIPL.r)', 'Adobe'); |
101 | pipl_property_info('8BIM', 'mode', 'PiPL property "SupportedModes" (PIPL.r)', 'Adobe'); |
109 | pipl_property_info('8BIM', 'mode', 'PiPL property "SupportedModes" (PIPL.r)', 'Adobe'); |
102 | pipl_property_info('8BIM', 'ms32', 'PiPL property "PlugInMaxSize" (PIPL.r)', 'Adobe'); |
110 | pipl_property_info('8BIM', 'ms32', 'PiPL property "PlugInMaxSize" (PIPL.r)', 'Adobe'); |
- | 111 | pipl_property_info('8BIM', 'host', 'PiPL property "RequiredHost" (PIPL.r)', 'Adobe'); |
|
- | 112 | pipl_property_info('8BIM', 'flly', 'PiPL property "FilterLayerSupport" (PIPL.r)', 'Adobe'); |
|
- | 113 | pipl_property_info('8BIM', 'enbl', 'PiPL property "EnableInfo" (PIPL.r)', 'Adobe'); |
|
- | 114 | pipl_property_info('8BIM', 'pmsa', 'PiPL property "MonitorScalingAware" (PIPL.r)', 'Adobe'); |
|
103 | pipl_property_info('8BIM', 'fici', 'PiPL property "FilterCaseInfo" (PIPL.r)', 'Adobe'); |
115 | pipl_property_info('8BIM', 'fici', 'PiPL property "FilterCaseInfo" (PIPL.r)', 'Adobe'); |
104 | pipl_property_info('ViaT', 'ObId', 'PiPL property "Object Identifier"', 'ViaThinkSoft'); |
116 | pipl_property_info('ViaT', 'ObId', 'PiPL property "Object Identifier"', 'ViaThinkSoft'); |
105 | pipl_property_footer(); |
117 | pipl_property_footer(); |
106 | 118 | ||
107 | ostype_header("Host signatures"); |
119 | ostype_header("Host signatures"); |
108 | ostype_info('8BIM', 'Adobe Photoshop', 'Adobe', true); |
120 | ostype_info('8BIM', 'Adobe Photoshop', 'Adobe'); |
109 | ostype_info('8BIM', 'PluginCommander (illegal usage of "8BIM")', 'ISV', true); |
121 | ostype_info('8BIM', 'PluginCommander', 'Other'); |
110 | ostype_info('8BIM', 'Serif Photoplus (illegal usage of "8BIM")', 'ISV', true); |
122 | ostype_info('8BIM', 'Serif Photoplus', 'Other'); |
111 | ostype_info('8B)M', 'Adobe Premiere', 'Adobe', true); |
123 | ostype_info('8B)M', 'Adobe Premiere', 'Adobe'); |
112 | ostype_info('PMIG', 'GIMP', 'ISV', true); |
124 | ostype_info('PMIG', 'GIMP', 'Other', true); |
113 | ostype_info('UP20', 'IrfanView', 'ISV', true); |
125 | ostype_info('UP20', 'IrfanView', 'Other', true); |
114 | ostype_info('PSP9', 'JASC PaintShop Pro X', 'ISV', true); |
126 | ostype_info('PSP9', 'JASC PaintShop Pro X', 'Other', true); |
115 | ostype_info('NDP.', 'Paint.net', 'ISV', true); |
127 | ostype_info('NDP.', 'Paint.net', 'Other', true); |
- | 128 | ostype_info(' ', 'Any host', 'Adobe', true); |
|
116 | ostype_footer(); |
129 | ostype_footer(); |
117 | 130 | ||
118 | ostype_header("Miscellaneous / internal use"); |
131 | ostype_header("Miscellaneous / internal use"); |
119 | ostype_info('bNUL', 'No Nuffer Suite (BUFVERSION_NULL)', 'ViaThinkSoft'); |
132 | ostype_info('bNUL', 'No Nuffer Suite (BUFVERSION_NULL)', 'ViaThinkSoft'); |
120 | ostype_info('bST1', 'Standard Buffer Suite 32bit (BUFVERSION_STD32)', 'ViaThinkSoft'); |
133 | ostype_info('bST1', 'Standard Buffer Suite 32bit (BUFVERSION_STD32)', 'ViaThinkSoft'); |
121 | ostype_info('bST2', 'Standard Buffer Suite 64bit (BUFVERSION_STD64)', 'ViaThinkSoft'); |
134 | ostype_info('bST2', 'Standard Buffer Suite 64bit (BUFVERSION_STD64)', 'ViaThinkSoft'); |
122 | ostype_info('bSU1', 'PICA Buffer Suite 1.0 (BUFVERSION_SUITE32)', 'ViaThinkSoft'); |
135 | ostype_info('bSU1', 'PICA Buffer Suite 1.0 (BUFVERSION_SUITE32)', 'ViaThinkSoft'); |
123 | ostype_info('bSU2', 'PICA Buffer Suite 2.0 (BUFVERSION_SUITE64)', 'ViaThinkSoft'); |
136 | ostype_info('bSU2', 'PICA Buffer Suite 2.0 (BUFVERSION_SUITE64)', 'ViaThinkSoft'); |
124 | ostype_info('hNUL', 'No Handle Suite (HDLVERSION_NULL)', 'ViaThinkSoft'); |
137 | ostype_info('hNUL', 'No Handle Suite (HDLVERSION_NULL)', 'ViaThinkSoft'); |
125 | ostype_info('hSTD', 'Standard Handle Suite (HDLVERSION_STANDARD)', 'ViaThinkSoft'); |
138 | ostype_info('hSTD', 'Standard Handle Suite (HDLVERSION_STANDARD)', 'ViaThinkSoft'); |
126 | ostype_info('hSU1', 'PICA Handle Suite 1.0 (HDLVERSION_SUITE1)', 'ViaThinkSoft'); |
139 | ostype_info('hSU1', 'PICA Handle Suite 1.0 (HDLVERSION_SUITE1)', 'ViaThinkSoft'); |
127 | ostype_info('hSU2', 'PICA Handle Suite 2.0 (HDLVERSION_SUITE2)', 'ViaThinkSoft'); |
140 | ostype_info('hSU2', 'PICA Handle Suite 2.0 (HDLVERSION_SUITE2)', 'ViaThinkSoft'); |
128 | ostype_info('tDRW', 'Initial preview timer (IDT_TIMER_INITPREVIEW_DRAW)', 'ViaThinkSoft'); |
141 | ostype_info('tDRW', 'Initial preview timer (IDT_TIMER_INITPREVIEW_DRAW)', 'ViaThinkSoft'); |
129 | ostype_footer(); |
142 | ostype_footer(); |
130 | 143 | ||
131 | # ------------------------------------------------------------------------------ |
144 | # ------------------------------------------------------------------------------ |
132 | 145 | ||
133 | $out = ob_get_contents(); |
146 | $out = ob_get_contents(); |
134 | ob_end_clean(); |
147 | ob_end_clean(); |
135 | 148 | ||
136 | echo $out; |
149 | echo $out; |
137 | 150 | ||
138 | file_put_contents(__DIR__.'/os_types.md', $out); |
151 | file_put_contents(__DIR__.'/os_types.md', $out); |
139 | 152 | ||
140 | # ------------------------------------------------------------------------------ |
153 | # ------------------------------------------------------------------------------ |
141 | 154 | ||
142 | function ostype_info($type, $desc, $vendor, $no_legality_check=false) { |
155 | function ostype_info($type, $desc, $vendor, $no_legality_check=false) { |
143 | $dec = 0; |
156 | $dec = 0; |
144 | for ($i=0;$i<4;$i++) $dec = ($dec<<8) + ord($type[$i]); |
157 | for ($i=0;$i<4;$i++) $dec = ($dec<<8) + ord($type[$i]); |
145 | $hex = "0x".str_pad(dechex($dec), 8, "0", STR_PAD_LEFT); |
158 | $hex = "0x".str_pad(dechex($dec), 8, "0", STR_PAD_LEFT); |
146 | $dec = str_pad((string)$dec, strlen((string)hexdec('ffffffff')), " ", STR_PAD_LEFT); |
159 | $dec = str_pad((string)$dec, strlen((string)hexdec('ffffffff')), " ", STR_PAD_LEFT); |
147 | $desc = str_pad($desc, DESC_WIDTH, " ", STR_PAD_RIGHT); |
160 | $desc = str_pad($desc, DESC_WIDTH, " ", STR_PAD_RIGHT); |
148 | 161 | ||
149 | $illegal = false; |
162 | $illegal = false; |
150 | if ($vendor != '?') { |
163 | if ($vendor != '?') { |
151 | $is_all_uppercase = strtoupper($type) == $type; |
164 | $is_all_uppercase = strtoupper($type) == $type; |
152 | $is_all_lowercase = strtolower($type) == $type; |
165 | $is_all_lowercase = strtolower($type) == $type; |
153 | $starts_with_uppercase = strtoupper($type[0]) == $type[0]; |
166 | $starts_with_uppercase = strtoupper($type[0]) == $type[0]; |
154 | if (($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') === false)) $illegal = true; |
167 | if (($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') === false)) $illegal = true; |
155 | else if (!($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') !== false)) $illegal = true; |
168 | else if (!($is_all_uppercase || $is_all_lowercase) && (strpos($vendor,'Apple') !== false)) $illegal = true; |
156 | else if ($starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') === false)) $illegal = true; |
169 | else if ($starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') === false)) $illegal = true; |
157 | else if (!$starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') !== false)) $illegal = true; |
170 | else if (!$starts_with_uppercase && !$is_all_uppercase && (strpos($vendor,'Adobe') !== false)) $illegal = true; |
158 | } |
171 | } |
159 | // In re 8B##, we just assume that 8B## was legally assigned to Adobe by Apple |
172 | // In re 8B##, we just assume that 8B## was legally assigned to Adobe by Apple |
160 | // Note: "8B" sounds like "Adobe" |
173 | // Note: "8B" sounds like "Adobe" |
161 | if ((substr($type,0,2) === '8B') && (strpos($vendor,'Adobe') !== false)) $illegal = false; |
174 | if ((substr($type,0,2) === '8B') && (strpos($vendor,'Adobe') !== false)) $illegal = false; |
162 | 175 | ||
163 | if ($no_legality_check) $illegal = false; |
176 | if ($no_legality_check) $illegal = false; |
164 | 177 | ||
165 | if ($illegal) $vendor .= ' (illegal)'; |
178 | if ($illegal) $vendor .= ' (illegal)'; |
166 | $vendor = str_pad($vendor, VENDOR_WIDTH, " ", STR_PAD_RIGHT); |
179 | $vendor = str_pad($vendor, VENDOR_WIDTH, " ", STR_PAD_RIGHT); |
167 | 180 | ||
168 | echo "| `$type` | $dec | $hex | $desc | $vendor |\n"; |
181 | echo "| `$type` | $dec | $hex | $desc | $vendor |\n"; |
169 | } |
182 | } |
170 | 183 | ||
171 | function ostype_footer() { |
184 | function ostype_footer() { |
172 | echo "\n"; |
185 | echo "\n"; |
173 | } |
186 | } |
174 | 187 | ||
175 | function ostype_header($title) { |
188 | function ostype_header($title) { |
176 | echo "$title\n"; |
189 | echo "$title\n"; |
177 | echo str_repeat('-',strlen($title))."\n"; |
190 | echo str_repeat('-',strlen($title))."\n"; |
178 | echo "\n"; |
191 | echo "\n"; |
179 | echo "| Type | Dec | Hex | ".str_pad('Description', DESC_WIDTH, " ", STR_PAD_RIGHT)." | ".str_pad('Vendor', VENDOR_WIDTH, " ", STR_PAD_RIGHT)." |\n"; |
192 | echo "| Type | Dec | Hex | ".str_pad('Description', DESC_WIDTH, " ", STR_PAD_RIGHT)." | ".str_pad('Vendor', VENDOR_WIDTH, " ", STR_PAD_RIGHT)." |\n"; |
180 | echo "|--------|------------|------------|".str_repeat('-', DESC_WIDTH+2)."|".str_repeat('-', VENDOR_WIDTH+2)."|\n"; |
193 | echo "|--------|------------|------------|".str_repeat('-', DESC_WIDTH+2)."|".str_repeat('-', VENDOR_WIDTH+2)."|\n"; |
181 | } |
194 | } |
182 | 195 | ||
183 | # ------------------------------------------------------------------------------ |
196 | # ------------------------------------------------------------------------------ |
184 | 197 | ||
185 | function pipl_property_info($ven, $type, $desc, $vendor) { |
198 | function pipl_property_info($ven, $type, $desc, $vendor) { |
186 | $vdec = 0; |
199 | $vdec = 0; |
187 | for ($i=0;$i<4;$i++) $vdec = ($vdec<<8) + ord($ven[$i]); |
200 | for ($i=0;$i<4;$i++) $vdec = ($vdec<<8) + ord($ven[$i]); |
188 | $vhex = "0x".str_pad(dechex($vdec), 8, "0", STR_PAD_LEFT); |
201 | $vhex = "0x".str_pad(dechex($vdec), 8, "0", STR_PAD_LEFT); |
189 | $vdec = str_pad((string)$vdec, strlen((string)hexdec('ffffffff')), " ", STR_PAD_LEFT); |
202 | $vdec = str_pad((string)$vdec, strlen((string)hexdec('ffffffff')), " ", STR_PAD_LEFT); |
190 | 203 | ||
191 | $dec = 0; |
204 | $dec = 0; |
192 | for ($i=0;$i<4;$i++) $dec = ($dec<<8) + ord($type[$i]); |
205 | for ($i=0;$i<4;$i++) $dec = ($dec<<8) + ord($type[$i]); |
193 | $hex = "0x".str_pad(dechex($dec), 8, "0", STR_PAD_LEFT); |
206 | $hex = "0x".str_pad(dechex($dec), 8, "0", STR_PAD_LEFT); |
194 | $dec = str_pad((string)$dec, strlen((string)hexdec('ffffffff')), " ", STR_PAD_LEFT); |
207 | $dec = str_pad((string)$dec, strlen((string)hexdec('ffffffff')), " ", STR_PAD_LEFT); |
195 | 208 | ||
196 | $desc = str_pad($desc, DESC_WIDTH, " ", STR_PAD_RIGHT); |
209 | $desc = str_pad($desc, DESC_WIDTH, " ", STR_PAD_RIGHT); |
197 | 210 | ||
198 | // In re 8B##, we just assume that 8B## was legally assigned to Adobe by Apple |
211 | // In re 8B##, we just assume that 8B## was legally assigned to Adobe by Apple |
199 | // Note: "8B" sounds like "Adobe" |
212 | // Note: "8B" sounds like "Adobe" |
200 | $illegal = (substr($ven,0,2) === '8B') != (strpos($vendor,'Adobe') !== false); |
213 | $illegal = (substr($ven,0,2) === '8B') != (strpos($vendor,'Adobe') !== false); |
201 | 214 | ||
202 | if ($illegal) $vendor .= ' (illegal)'; |
215 | if ($illegal) $vendor .= ' (illegal)'; |
203 | $vendor = str_pad($vendor, VENDOR_WIDTH, " ", STR_PAD_RIGHT); |
216 | $vendor = str_pad($vendor, VENDOR_WIDTH, " ", STR_PAD_RIGHT); |
204 | 217 | ||
205 | echo "| `$ven` | `$type` | $vdec $dec | $vhex $hex | $desc | $vendor |\n"; |
218 | echo "| `$ven` | `$type` | $vdec $dec | $vhex $hex | $desc | $vendor |\n"; |
206 | } |
219 | } |
207 | 220 | ||
208 | function pipl_property_footer() { |
221 | function pipl_property_footer() { |
209 | echo "\n"; |
222 | echo "\n"; |
210 | } |
223 | } |
211 | 224 | ||
212 | function pipl_property_header($title) { |
225 | function pipl_property_header($title) { |
213 | echo "$title\n"; |
226 | echo "$title\n"; |
214 | echo str_repeat('-',strlen($title))."\n"; |
227 | echo str_repeat('-',strlen($title))."\n"; |
215 | echo "\n"; |
228 | echo "\n"; |
216 | echo "| C.code | Prpty. | Dec | Hex | ".str_pad('Description', DESC_WIDTH, " ", STR_PAD_RIGHT)." | ".str_pad('Vendor', VENDOR_WIDTH, " ", STR_PAD_RIGHT)." |\n"; |
229 | echo "| C.code | Prpty. | Dec | Hex | ".str_pad('Description', DESC_WIDTH, " ", STR_PAD_RIGHT)." | ".str_pad('Vendor', VENDOR_WIDTH, " ", STR_PAD_RIGHT)." |\n"; |
217 | echo "|--------|--------|-----------------------|-----------------------|".str_repeat('-', DESC_WIDTH+2)."|".str_repeat('-', VENDOR_WIDTH+2)."|\n"; |
230 | echo "|--------|--------|-----------------------|-----------------------|".str_repeat('-', DESC_WIDTH+2)."|".str_repeat('-', VENDOR_WIDTH+2)."|\n"; |
218 | } |
231 | } |
219 | 232 |