Fix idl generation

Make idl generation work; properly use hphp/ paths, tweak some
out-dated names, etc.
Esse commit está contido em:
Chip Turner
2013-05-17 16:11:24 -07:00
commit de Sara Golemon
commit 65c4109224
6 arquivos alterados com 35 adições e 15 exclusões
+5 -2
Ver Arquivo
@@ -776,7 +776,7 @@ EOT
fprintf($f, " // constructor must call setAttributes(%s)\n",
implode('|', $flags));
}
fprintf($f, " public: c_%s(VM::Class* cls = c_%s::s_cls);\n",
fprintf($f, " public: c_%s(Class* cls = c_%s::s_cls);\n",
$class['name'], $class['name']);
fprintf($f, " public: ~c_%s();\n", $class['name']);
foreach ($class['methods'] as $m) {
@@ -851,7 +851,10 @@ function generateFuncCPPImplementation($func, $f, $prefix = 'f_') {
$output = '';
$need_ret = false;
fprintf($f, '%s %s%s(', typename($func['return']), $prefix, $func['name']);
fprintf($f, '%s %s%s(',
typename($func['return']),
$prefix,
strtolower($func['name']));
$var_arg = ($func['flags'] & VarArgsMask);
if ($var_arg) fprintf($f, 'int _argc');
if ($var_arg && count($func['args']) > 0) fprintf($f, ', ');
+2 -2
Ver Arquivo
@@ -14,8 +14,8 @@ foreach ($args as $arg) {
if (substr($target, -4) == '.cpp') {
ob_start();
printf("// @"."generated by idl/class_map.php\n");
printf("#include <runtime/base/base_includes.h>\n");
printf("#include <runtime/ext/ext.h>\n");
printf("#include \"hphp/runtime/base/base_includes.h\"\n");
printf("#include \"hphp/runtime/ext/ext.h\"\n");
printf("namespace HPHP {\n");
write_constants(false);
echo "const char *g_class_map[] = {\n";
+2 -6
Ver Arquivo
@@ -57,9 +57,7 @@ function idl_format_cpp_header($header) {
#ifndef incl_${PREFIX}_${NAME}_H_
#define incl_${PREFIX}_${NAME}_H_
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
#include <runtime/base/base_includes.h>
#include "hphp/runtime/base/base_includes.h"
EOT
);
@@ -160,9 +158,7 @@ function idl_format_test_header($test_header) {
#ifndef incl_TEST_${PREFIX}_${NAME}_H_
#define incl_TEST_${PREFIX}_${NAME}_H_
// >>>>>> Generated by idl.php. Do NOT modify. <<<<<<
#include <test/test_cpp_ext.h>
#include "hphp/test/test_cpp_ext.h"
///////////////////////////////////////////////////////////////////////////////
+16 -1
Ver Arquivo
@@ -26,7 +26,22 @@ EOT
sort($files);
foreach ($files as $file) {
preg_match('%^(?:.*/([^/]*)/)?(.*)\.idl\.json$%', $file, $matches);
// Find the common prefix of our current path (which is
// $SOMETHING/hphp/idl) and whatever is on our command line
// (typically EXT= and FIND_IDL, both from make). From here we know
// the prefix to use when constructing our #include's.
$file = realpath($file);
$cwd = realpath(getcwd()) . "/";
for ($i = strlen($cwd); $i >= 0; --$i) {
if (strncmp($cwd, $file, $i) === 0) {
$file = substr($file, $i);
break;
}
}
// Separate bar/quux/blah.idl.json into $prefix (bar/quux) and $name
// (blah) for generating the includes below. If a prefix can't be
// determined, we assume it is under runtime/ext.
preg_match('%^(.*/)?(.*)\.idl\.json$%', $file, $matches);
$prefix = $matches[1];
$name = $matches[2];
$ucname = $prefix ? camelCase($name) : ucfirst($name);
+2 -2
Ver Arquivo
@@ -14,8 +14,8 @@
+----------------------------------------------------------------------+
*/
// @generated by idl/class_map.php
#include <runtime/base/base_includes.h>
#include <runtime/ext/ext.h>
#include "hphp/runtime/base/base_includes.h"
#include "hphp/runtime/ext/ext.h"
namespace HPHP {
const int64_t k_ABDAY_1 = 131072;
const int64_t k_ABDAY_2 = 131073;
+8 -2
Ver Arquivo
@@ -1,9 +1,15 @@
<?php
chdir(preg_replace('#/hphp/tools/license.php$#', '/src', realpath(__FILE__)));
error_reporting(E_ALL | E_STRICT | E_WARNING);
$dir = preg_replace('#/hphp/tools/license.php$#', '/hphp', realpath(__FILE__));
if (!chdir($dir)) {
print("Unable to chdir to $dir\n");
exit(1);
}
// parse all these files
$inputs = 'find . -regex ".*\.cpp" -or -regex ".*\.c" -or -regex ".*\.h"';
$inputs = 'find . -name "*.cpp" -o -name "*.c" -o -name "*.h"';
// do not touch these files
$excluded = array(