INNER CODE UNIT · Python
extract_registrations
apistol78/traktor · scripts/generate-node-emitter-capture.py:69
def extract_registrations(text):
"""Return { node_type_short_name: function_name } from the emitter map."""
reg = re.compile(
r"m_emitters\[\s*&\s*type_of<\s*(\w+)\s*>\(\)\s*\]\s*=\s*new\s+EmitterCast<\s*\w+\s*>\(\s*(\w+)\s*\)"
)
mapping = {}
for m in reg.finditer(text):
mapping[m.group(1)] = m.group(2)
return mapping
def summarize(body):
"""Best-effort one-line GLSL expression for a node, or None if not cleanly
expressible. Reconstructs the single `assign(f, out) << ...;` statement,
substituting emitInput variables with their pin names. Bails on anything
that isn't a single straightforward assignment of literals + input pins."""
vars = {}
for m in re.finditer(r"(\w+)\s*=\s*cx\.emitInput\(\s*node\s*,\s*L\"([^\"]+)\"", body):