define('MODIFIER_ABSTRACT', 2); define('MODIFIER_FINAL', 4); define('MODIFIER_PUBLIC', 256); define('MODIFIER_PROTECTED', 512); define('MODIFIER_PRIVATE', 1024); xp::$null = new __null(); xp::$loader = new xp(); // Paths are passed via class loader API from *-main.php. Retaining BC: // Paths are constructed inside an array before including this file. if (isset($GLOBALS['paths'])) { xp::$classpath = $GLOBALS['paths']; } else { if (0 === strpos(__FILE__, 'xar://')) { xp::$classpath = [substr(__FILE__, 6, -14)]; } else { xp::$classpath = [__DIR__ . DIRECTORY_SEPARATOR]; } } set_include_path(rtrim(implode(PATH_SEPARATOR, xp::$classpath), PATH_SEPARATOR)); spl_autoload_register(function ($class) { $name = strtr($class, '\\', '.'); $cl = xp::$loader->findClass($name); if (null === $cl) { return false; } $cl->loadClass0($name); return true; }); spl_autoload_register(function ($class) { if (false === strrpos($class, '\\import')) { return false;
function bootstrap($classpath) { set_include_path($classpath); xp::$classpath = explode(PATH_SEPARATOR, $classpath); xp::$loader = new xp(); uses('lang.Object', 'lang.Error', 'lang.XPException', 'lang.XPClass', 'lang.NullPointerException', 'lang.IllegalAccessException', 'lang.IllegalArgumentException', 'lang.IllegalStateException', 'lang.FormatException', 'lang.ClassLoader'); }