MCPcopy
hub / github.com/KhronosGroup/Vulkan-Docs / evaluateStack

Function evaluateStack

scripts/parse_dependency.py:198–217  ·  view source on GitHub ↗

Evaluate an expression stack, returning a boolean result. - stack - the stack - isSupported - function taking a version or extension name string and returning True or False if that name is supported or not.

(stack, isSupported)

Source from the content-addressed store, hash-verified

196}
197
198def evaluateStack(stack, isSupported):
199 """Evaluate an expression stack, returning a boolean result.
200
201 - stack - the stack
202 - isSupported - function taking a version or extension name string and
203 returning True or False if that name is supported or not."""
204
205 op, num_args = stack.pop(), 0
206 if isinstance(op, tuple):
207 op, num_args = op
208
209 if op in '+,':
210 # Note: operands are pushed onto the stack in reverse order
211 op2 = evaluateStack(stack, isSupported)
212 op1 = evaluateStack(stack, isSupported)
213 return _opn[op](op1, op2)
214 elif op[0].isalpha():
215 return isSupported(op)
216 else:
217 raise Exception(f'invalid op: {op}')
218
219def evaluateDependency(dependency, isSupported):
220 """Evaluate a dependency expression, returning a boolean result.

Callers 1

evaluateDependencyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected