* * The script will generate a new classes.json on the tools directory as * a merge_changes.log file where you can check methods that were removed. * You should replace the classes.json file on the source_maker/class_selector * with the generated by this script and make manual changes if neccesary. */ //Disable anoying warnings and notices error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING); //Change to correct working directory to be able to execute the script from everywhere chdir(__DIR__); include "source_maker/include/functions.php"; if (!file_exists("../json/classes.json")) { die("classes.json not found on json/"); } $full_classes = unserialize_json(file_get_contents("../json/classes.json")); $binded_classes = unserialize_json(file_get_contents("source_maker/class_selector/classes.json")); $output_classes = array(); file_put_contents("merge_changes.log", ""); //First check if new special flags where added like _platforms to the class definition file_put_contents("merge_changes.log", "New class flags merged\n\n", FILE_APPEND); foreach ($binded_classes as $class_name => $class_methods) { foreach ($full_classes[$class_name] as $full_method_name => $full_method_data) { if ($full_method_name[0] == "_" && $full_method_name != "_implements") { if (!in_array($full_method_name, $class_methods)) { file_put_contents("merge_changes.log", "Merged the class flag {$full_method_name} into {$class_name}\n", FILE_APPEND); } $binded_classes[$class_name][$full_method_name] = $full_method_data; } } } file_put_contents("merge_changes.log", "\n\n", FILE_APPEND);
$defGlobals = unserialize_json(file_get_contents("./../../json/global_variables.json")); //Temporary black list unset($defGlobals['wxEVT_HOTKEY']); unset($defGlobals['wxNullRegion']); unset($defGlobals['wxEVT_POWER_SUSPENDING']); unset($defGlobals['wxEVT_POWER_SUSPENDED']); unset($defGlobals['wxEVT_POWER_SUSPEND_CANCEL']); unset($defGlobals['wxEVT_POWER_RESUME']); //Disable wxWebKitCtrl constants since it is only available for mac unset($defGlobals['wxEVT_WEBKIT_STATE_CHANGED']); unset($defGlobals['wxEVT_WEBKIT_BEFORE_LOAD']); unset($defGlobals['wxEVT_WEBKIT_NEW_WINDOW']); } //Load typedef parsed by the json_generator if (file_exists("./../../json/typedef.json")) { $defTypedef = unserialize_json(file_get_contents("./../../json/typedef.json")); $defTypedef["WXWidget"] = "size_t"; } //Prepair class groups to generate different source files correctly prepair_groups($defClassGroups, $defIni); //Empty the discarded log file_put_contents("discarded.log", "All class methods removed by the cleaning functions\n"); file_put_contents("discarded.log", "====================================================\n\n", FILE_APPEND); //Remove protected methods since they aren't accessible outside the class scope remove_protected_methods($defIni); //Remove virtual methods that override non virtual methods with the same name //since these methods cant be overrided causing conflicts and compilation errors. remove_virtual_methods_overrides($defIni); //Remove operators (TODO: is there a way to implement them on PHP ZEND?) remove_operators($defIni); //Remove non virtual On* methods (this methods are usually used internally on wxWidgets
} //Change to correct working directory to be able to execute the script from everywhere chdir(__DIR__); //Json serializing functions include "../include/functions.php"; //Load the full set of classes available on wxWidgets if (file_exists("full_classes_set.json")) { $cls = unserialize_json(file_get_contents('full_classes_set.json')); } else { die("The file full_classes_set.json wasn't found. Run the xml parser and copy the full_classes_set.json file to the directory where this script resides."); } //Sort the classes by name ksort($cls); //Load previously enabled classes if (file_exists("classes.json")) { $clo = unserialize_json(file_get_contents('classes.json')); } if (!isset($clo)) { //Initialize array that will hold enabled class/methods $clo = array(); } else { //Clean classes not found on full_classes_set.json foreach ($clo as $class_out_name => $class_out_data) { if (!isset($cls[$class_out_name])) { unset($clo[$class_out_name]); } } } //Variable that stores the current clicked class $selClass = null; class wxTaskBarIconCustom extends wxTaskBarIcon