Return the 'most official' of two related names, api and newapi. KHR is more official than EXT is more official than everything else. If there is ambiguity, return api. Accommodate APIs using lower-case vendor suffixes.
(api, newapi)
| 7 | from generator import OutputGenerator, enquote, noneStr |
| 8 | |
| 9 | def mostOfficial(api, newapi): |
| 10 | """Return the 'most official' of two related names, api and newapi. |
| 11 | KHR is more official than EXT is more official than everything else. |
| 12 | If there is ambiguity, return api. |
| 13 | Accommodate APIs using lower-case vendor suffixes.""" |
| 14 | |
| 15 | apicat = api[-3:].upper() |
| 16 | newapicat = newapi[-3:].upper() |
| 17 | |
| 18 | if apicat == 'KHR': |
| 19 | return api |
| 20 | if newapicat == 'KHR': |
| 21 | return newapi; |
| 22 | if apicat == 'EXT': |
| 23 | return api |
| 24 | if newapicat == 'EXT': |
| 25 | return newapi; |
| 26 | return api |
| 27 | |
| 28 | class ScriptOutputGenerator(OutputGenerator): |
| 29 | """ScriptOutputGenerator - subclass of OutputGenerator. |