function generateClassCPPInclude($class, $f) { fprintf($f, '"%s", "%s", ', $class['name'], strtolower($class['parent'])); foreach ($class['ifaces'] as $if) { fprintf($f, '"%s",', strtolower($if)); } fprintf($f, 'NULL, '); foreach ($class['methods'] as $m) { generateMethodCPPInclude($m, $f); fprintf($f, ","); } fprintf($f, "NULL,"); foreach ($class['properties'] as $p) { generatePropertyCPPInclude($p, $f); fprintf($f, ","); } fprintf($f, "NULL,"); foreach ($class['consts'] as $k) { fprintf($f, '"%s", T(%s),', $k['name'], typeenum($k['type'])); } fprintf($f, "NULL,\n"); fprintf($f, 'S(%d), ', $class['flags']); if (!empty($class['doc'])) { fprintf($f, '"%s", ', escape_cpp($class['doc'])); } }
function php_escape_val($val) { if (is_string($val)) { return '"' . escape_cpp($val) . '"'; } else { if ($val === true) { return 'true'; } else { if ($val === false) { return 'false'; } else { if ($val === null) { return 'uninit_null()'; } else { return var_export($val, true); } } } } }