Return protect expression translated to a form suitable for use in C preprocessor conditionals (#if expressions). This wraps each identifier in defined() and converts operators: - '+' becomes '&&' (AND) - ',' becomes '||' (OR) Supports '!' prefix on identifiers fo
(protect)
| 296 | return dependencyLanguage(dependency, leafMarkup = leafMarkupC, opMarkup = opMarkupC, parenthesize = True) |
| 297 | |
| 298 | def protectLanguageC(protect): |
| 299 | """Return protect expression translated to a form suitable for |
| 300 | use in C preprocessor conditionals (#if expressions). |
| 301 | |
| 302 | This wraps each identifier in defined() and converts operators: |
| 303 | - '+' becomes '&&' (AND) |
| 304 | - ',' becomes '||' (OR) |
| 305 | Supports '!' prefix on identifiers for NOT: |
| 306 | - '!A' becomes '!defined(A)' |
| 307 | |
| 308 | Examples: |
| 309 | 'VK_A,VK_B' -> 'defined(VK_A) || defined(VK_B)' |
| 310 | 'VK_A+VK_B' -> 'defined(VK_A) && defined(VK_B)' |
| 311 | '(VK_A+VK_B),VK_C' -> '(defined(VK_A) && defined(VK_B)) || defined(VK_C)' |
| 312 | 'VK_A+!VK_B' -> 'defined(VK_A) && !defined(VK_B)' |
| 313 | |
| 314 | - protect - the protect expression string""" |
| 315 | global exprStack |
| 316 | exprStack = [] |
| 317 | protectBNF().parse_string(protect, parse_all=True) |
| 318 | return evalDependencyLanguage(exprStack, leafMarkupCProtect, opMarkupC, |
| 319 | parenthesize=True, root=True, parent_op=None) |
| 320 | |
| 321 | def evalDependencyNames(stack): |
| 322 | """Evaluate an expression stack, returning the set of extension and |
no test coverage detected