$inc_file = "\"ext_{$name}.h\""; } else { $inc_file = "<runtime/ext/ext_{$name}.h>"; } fprintf($f, <<<EOT #include {$inc_file} namespace HPHP { /////////////////////////////////////////////////////////////////////////////// EOT ); foreach ($funcs as $func) { generateFuncCPPImplementation($func, $f); } fprintf($f, <<<EOT /////////////////////////////////////////////////////////////////////////////// } EOT ); } /*****************************************************************************/ if ($inc) { ($f = fopen($inc, 'w')) || die("cannot open {$inc}"); fprintf($f, "#if EXT_TYPE == 0\n"); foreach ($funcs as $func) { generateFuncCPPInclude($func, $f);
function idl_format_cpp_impl($impl) { global $funcs, $name, $mode, $constants, $classes; ($f = fopen($impl, 'w')) || die("cannot open {$impl}"); if ($mode) { $header_file = "\"ext_{$name}.h\""; } else { $header_file = "<runtime/ext/ext_{$name}.h>"; } fprintf($f, <<<EOT #include {$header_file} namespace HPHP { /////////////////////////////////////////////////////////////////////////////// EOT ); foreach ($constants as $const) { generateConstCPPImplementation($const, $f); } foreach ($funcs as $func) { generateFuncCPPImplementation($func, $f); } foreach ($classes as $class) { generateClassCPPImplementation($class, $f); } fprintf($f, <<<EOT /////////////////////////////////////////////////////////////////////////////// } EOT ); }
function generateMethodCPPImplementation($method, $class, $f) { if ($method['flags'] & IsStatic) { $prefix = "c_{$class['name']}::ti_"; } else { $prefix = "c_{$class['name']}::t_"; } generateFuncCPPImplementation($method, $f, $prefix); }