loadXML(file_get_contents(__DIR__ . "/../resources/gl.xml")); $commands = $xml->getElementsByTagName("commands")->item(0); $data = file_get_contents(__DIR__ . "/../headers/gl.h"); $data .= "// GENERATED DATA START\n\n"; /** @var DOMNode $node */ foreach ($commands->childNodes as $node) { if ($node->nodeName !== "command") { continue; } /** @var DOMElement $node */ $proto = $node->getElementsByTagName("proto")->item(0); /** @var DOMElement $name */ $name = $proto->getElementsByTagName("name")[0]; $name->remove(); $returnType = trim($proto->textContent); $functionName = trim($name->textContent); $args = []; foreach ($node->getElementsByTagName("param") as $param) { $args[] = trim($param->textContent); } $data .= "typedef $returnType (* FUNC_$functionName) (" . implode(", ", $args) . ");\n"; } file_put_contents(__DIR__ . "/../headers/gl_generated.h", $data);