Index: tools/class.php =================================================================== --- tools/class.php (revision 14136) +++ tools/class.php (working copy) @@ -13,6 +13,9 @@ foreach (file($path.DIRECTORY_SEPARATOR.$e) as $line) { if ('#' === $line{0}) { continue; + } else if ('@' === $line{0}) { + $inc.= trim($line).PATH_SEPARATOR; + continue; } else if ('~' === $line{0}) { $base= $home; $line= substr($line, 1); } else if ('/' === $line{0} || (':' === $line{1} && '\\' === $line{2})) { Index: tools/web.php =================================================================== --- tools/web.php (revision 14136) +++ tools/web.php (working copy) @@ -11,6 +11,9 @@ foreach (file($path.DIRECTORY_SEPARATOR.$e) as $line) { if ('#' === $line{0}) { continue; + } else if ('@' === $line{0}) { + $inc.= trim($line).PATH_SEPARATOR; + continue; } else if ('~' === $line{0}) { $base= $home; $line= substr($line, 1); } else if ('/' === $line{0} || (':' === $line{1} && '\\' === $line{2})) { Index: tools/xar.php =================================================================== --- tools/xar.php (revision 14136) +++ tools/xar.php (working copy) @@ -13,6 +13,9 @@ foreach (file($path.DIRECTORY_SEPARATOR.$e) as $line) { if ('#' === $line{0}) { continue; + } else if ('@' === $line{0}) { + $inc.= trim($line).PATH_SEPARATOR; + continue; } else if ('~' === $line{0}) { $base= $home; $line= substr($line, 1); } else if ('/' === $line{0} || (':' === $line{1} && '\\' === $line{2})) { Index: skeleton/lang/ClassLoader.class.php =================================================================== --- skeleton/lang/ClassLoader.class.php (revision 14136) +++ skeleton/lang/ClassLoader.class.php (working copy) @@ -47,14 +47,18 @@ * @purpose Class loading */ final class ClassLoader extends Object implements IClassLoader { - protected static - $delegates = array(); + protected static $delegates= array(); static function __static() { xp::$registry['loader']= new self(); // Scan include-path, setting up classloaders for each element + $loaders= array(); foreach (xp::$registry['classpath'] as $element) { + if ('@' === $element{0}) { + $loaders[]= $element; + continue; + } $resolved= realpath($element); if (is_dir($resolved)) { self::registerLoader(FileSystemClassLoader::instanceFor($resolved, FALSE)); @@ -64,6 +68,17 @@ xp::error('[bootstrap] Classpath element ['.$element.'] not found'); } } + + // Set up additional loaders ("@class[]" in include-path) + foreach ($loaders as $spec) { + sscanf($spec, '@%[^<]<%s>', $cl, $args); + $loader= XPClass::forName($cl); + if ($loader->hasConstructor()) { + self::registerLoader($loader->getConstructor()->newInstance(array_map('trim', explode(',', $args)))); + } else { + self::registerLoader($loader->newInstance()); + } + } } /**