Files
php-gtk-src/generator/reflection_class_checker.php
Christian Weiske b3d9ea3964 The generator writes reflection information for normal
functions now. If you want to compile them, add
#define ENABLE_REFLECTION 1
to config.h (Andrei, could you add a configure switch?)

The time difference between a build with and without reflection
is minimal (0.4s), so I vote for enabling it by default.

The reflection.php is a small helper script if you want to write
reflection code by hand (e.g. for phpg_object.c or so), and
reflection_class_checker.php checks the generated .c files
for unsupported classes which might cause php5 to behave
weird when reflection is used.
2005-05-13 16:55:57 +00:00

37 lines
1009 B
PHP

<?php
/**
* PHP has real problems if a method requires a parameter of a certain
* class and the class doesn't exist...
*
* here we check that
*
* The classes spit out by this script have to be entered in
* generator.php function is_in_php()
*/
$arFiles = array(
'gen_atk.c',
'gen_gdk.c',
'gen_gtk.c',
'gen_pango.c'
);
$strRelPath = '../ext/gtk+/';
chdir(dirname(__FILE__));
$arDeclClasses = get_declared_classes();
$arFoundClasses = array();
foreach ($arFiles as $strFile) {
$arLines = file($strRelPath . $strFile);
foreach ($arLines as $strLine) {
if (strpos($strLine, 'ZEND_ARG_OBJ_INFO') && preg_match_all('/ZEND_ARG_OBJ_INFO\\(.+,.+,\\s*([^,]+)\\s*,.+\\)/', $strLine, $arMatches)) {
$strClass = $arMatches[1][0];
if (!in_array($strClass,$arDeclClasses) && !in_array($strClass, $arFoundClasses)) {
echo "'" . $strClass . "' => 'int',\r\n";
$arFoundClasses[] = $strClass;
}
}
}
}
?>