Пример #1
0
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
);
}
Пример #2
0
function generateClassCPPImplementation($class, $f)
{
    foreach ($class['consts'] as $k) {
        generateConstCPPImplementation($k, $f, "q_{$class['name']}\$\$");
    }
    foreach ($class['methods'] as $m) {
        generateMethodCPPImplementation($m, $class, $f);
    }
}