Page MenuHomeCode

No OneTemporary

This document is not UTF8. It was detected as Shift JIS and converted to UTF8 for display.
diff --git a/dev/scripts/autoload.tcl b/dev/scripts/autoload.tcl
index 201e641..42ffa1c 100755
--- a/dev/scripts/autoload.tcl
+++ b/dev/scripts/autoload.tcl
@@ -1,129 +1,133 @@
#!/usr/local/bin/tclsh8.5
#
# php-autoload-generator
-# (c) S饕astien Santoro aka Dereckson, 2010, some rights reserved.
+# (c) Sテゥbastien Santoro aka Dereckson, 2010-2013, some rights resrved.
# Released under BSD license
#
# Last version of the code can be fetch at:
# http://bitbucket.org/dereckson/php-autoload-generator
#
# This code generator write a __autoload() PHP method, when you don't have a
# consistent pattern for classes naming and don't want to register several
# autoloader with spl_autoload_register().
#
# Parses your classes folder & reads each file to check if it contains classes.
#
#
# Configuration
#
#A list of regexp, one per directory to ignore
set config(directoriesToIgnore) {Smarty SmartLine}
#The output to produce before the lines
set config(templateBefore) "<?php
/**
* This magic method is called when a class can't be loaded
*/
function __autoload (\$className) {
//Classes"
#The output to produce after the
set config(templateAfter) "
//Loader
if (array_key_exists(\$className, \$classes)) {
require_once(\$classes\[\$className]);
}
-}
-
-?>"
+}"
#The line format, for %%lines%%
set config(templateClassLine) { $classes['%%class%%'] = '%%file%%';}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Helpers methods
#
#Find .php script
proc find_scripts {directory} {
set dirs {}
foreach i [lsort [glob -nocomplain -dir $directory *]] {
if {[file type $i] == "directory" && ![is_ignored_directory $i]} {
lappend dirs $i
} elseif {[file extension $i] == ".php"} {
- find_classes $i
+ find_objects $i
}
}
foreach subdir $dirs {
#Adds a white line as a separator, then the classes in this dir
- puts " "
+ puts ""
find_scripts $subdir
}
}
#Called when we've got a winner
proc add_class {script class} {
global config
set line $config(templateClassLine)
regsub -all -- "%%class%%" $line $class line
regsub -all -- "%%file%%" $line $script line
puts $line
}
-#Find classes in the file
+#Find objects like classes or interfaces in the file
#Thanks to Richard Suchenwirth for its glob-r code snippet this proc is forked
-proc find_classes {file} {
+proc find_objects {file} {
set fp [open $file]
while {[gets $fp line] >= 0} {
set pos1 [string first "class " $line]
+ if {$pos1 == -1} {
+ set pos1 [string first "interface " $line]
+ set len 10
+ } {
+ set len 6
+ }
set pos2 [string first " \{" $line $pos1]
set pos3 [string first " implements" $line $pos1]
set pos4 [string first " extends" $line $pos1]
if {$pos1 > -1 && $pos2 > -1} {
if {$pos4 > -1} {
#We test implements first, as if a class implements and extends
#the syntax is class Plane extends Vehicle implements FlyingItem
set pos $pos4
} elseif {$pos3 > -1} {
set pos $pos3
} else {
set pos $pos2
}
- set class [string range $line [expr $pos1 + 6] [expr $pos - 1]]
+ set class [string range $line [expr $pos1 + $len] [expr $pos - 1]]
add_class $file $class
}
}
close $fp
}
#Check if the directory is ignored
proc is_ignored_directory {directory} {
global config
foreach re $config(directoriesToIgnore) {
if [regexp $re $directory] {return 1}
}
return 0
}
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Procedural code
#
if {$argc > 0} {
set directory [lindex $argv 0]
} {
set directory .
}
puts $config(templateBefore)
-find_scripts $directory
-puts $config(templateAfter)
\ No newline at end of file
+find_scripts $directory/includes
+puts $config(templateAfter)
diff --git a/includes/autoload.php b/includes/autoload.php
index a6d3700..44d0899 100755
--- a/includes/autoload.php
+++ b/includes/autoload.php
@@ -1,81 +1,59 @@
<?php
-/**
- * Autoloader
- *
- * Zed. The immensity of stars. The HyperShip. The people.
- *
- * (c) 2010, Dereckson, some rights reserved.
- * Released under BSD license.
- *
- * This file provides an __autoload function to help loading objects files.
- *
- * This function is autogenerated by the TCL script dev/scripts/autoload.tcl
- *
- * @package Zed
- * @subpackage Keruald
- * @author Sテゥbastien Santoro aka Dereckson <dereckson@espace-win.org>
- * @copyright 2010 Sテゥbastien Santoro aka Dereckson
- * @license http://www.opensource.org/licenses/bsd-license.php BSD
- * @version 0.1
- * @link http://scherzo.dereckson.be/doc/zed
- * @link http://zed.dereckson.be/
- * @filesource
- */
-
/**
* This magic method is called when a class can't be loaded
- *
- * @param string $className the class to load
*/
-function __autoload ($className) {
+function __autoload ($className) {
//Classes
- $classes['Cache'] = 'includes/cache/cache.php';
- $classes['CacheMemcached'] = 'includes/cache/memcached.php';
- $classes['CacheVoid'] = 'includes/cache/void.php';
+ $classes['Cache'] = './includes/cache/cache.php';
+ $classes['CacheMemcached'] = './includes/cache/memcached.php';
+ $classes['CacheVoid'] = './includes/cache/void.php';
+
+ $classes['ContentFile'] = './includes/content/file.php';
+ $classes['ContentLocation'] = './includes/content/location.php';
+ $classes['ContentZone'] = './includes/content/zone.php';
+
+ $classes['GeoBody'] = './includes/geo/body.php';
+ $classes['GeoGalaxy'] = './includes/geo/galaxy.php';
+ $classes['GeoLocation'] = './includes/geo/location.php';
+ $classes['GeoOctocube'] = './includes/geo/octocube.php';
+ $classes['GeoPlace'] = './includes/geo/place.php';
+ $classes['GeoPoint3D'] = './includes/geo/point3D.php';
+ $classes['GeoPointPolarZ'] = './includes/geo/pointPolarZ.php';
+ $classes['GeoScene'] = './includes/geo/scene.php';
+ $classes['GeoSceneIndex'] = './includes/geo/sceneindex.php';
- $classes['Content'] = 'includes/objects/content.php';
- $classes['ContentFile'] = 'includes/content/file.php';
- $classes['ContentLocation'] = 'includes/content/location.php';
- $classes['ContentZone'] = 'includes/content/zone.php';
-
- $classes['GeoBody'] = 'includes/geo/body.php';
- $classes['GeoGalaxy'] = 'includes/geo/galaxy.php';
- $classes['GeoLocation'] = 'includes/geo/location.php';
- $classes['GeoPlace'] = 'includes/geo/place.php';
- $classes['GeoPoint3D'] = 'includes/geo/point3D.php';
- $classes['GeoScene'] = 'includes/geo/scene.php';
-
- $classes['Application'] = 'includes/objects/application.php';
- $classes['Invite'] = 'includes/objects/invite.php';
- $classes['Message'] = 'includes/objects/message.php';
- $classes['MOTD'] = 'includes/objects/motd.php';
- $classes['Perso'] = 'includes/objects/perso.php';
- $classes['Port'] = 'includes/objects/port.php';
- $classes['Profile'] = 'includes/objects/profile.php';
- $classes['ProfileComment'] = 'includes/objects/profilecomment.php';
- $classes['ProfilePhoto'] = 'includes/objects/profilephoto.php';
- $classes['Ship'] = 'includes/objects/ship.php';
- $classes['User'] = 'includes/objects/user.php';
-
- $classes['SettingsPage'] = 'includes/settings/page.php';
- $classes['Setting'] = 'includes/settings/setting.php';
- $classes['Settings'] = 'includes/settings/settings.php';
-
- $classes['StoryChoice'] = 'includes/story/choice.php';
- $classes['StoryHook'] = 'includes/story/hook.php';
- $classes['DemoStoryHook'] = 'includes/story/hook_demo.php';
- $classes['SpatioportStoryHook'] = 'includes/story/hook_spatioport.php';
- $classes['StorySection'] = 'includes/story/section.php';
- $classes['Story'] = 'includes/story/story.php';
-
- $classes['TravelPlace'] = 'includes/travel/place.php';
- $classes['Travel'] = 'includes/travel/travel.php';
+ $classes['Application'] = './includes/objects/application.php';
+ $classes['Content'] = './includes/objects/content.php';
+ $classes['Invite'] = './includes/objects/invite.php';
+ $classes['Message'] = './includes/objects/message.php';
+ $classes['MOTD'] = './includes/objects/motd.php';
+ $classes['Perso'] = './includes/objects/perso.php';
+ $classes['Port'] = './includes/objects/port.php';
+ $classes['Profile'] = './includes/objects/profile.php';
+ $classes['ProfileComment'] = './includes/objects/profilecomment.php';
+ $classes['ProfilePhoto'] = './includes/objects/profilephoto.php';
+ $classes['Request'] = './includes/objects/request.php';
+ $classes['RequestReply'] = './includes/objects/requestreply.php';
+ $classes['Ship'] = './includes/objects/ship.php';
+ $classes['User'] = './includes/objects/user.php';
+
+ $classes['SettingsPage'] = './includes/settings/page.php';
+ $classes['Setting'] = './includes/settings/setting.php';
+ $classes['Settings'] = './includes/settings/settings.php';
+
+ $classes['StoryChoice'] = './includes/story/choice.php';
+ $classes['StoryHook'] = './includes/story/hook.php';
+ $classes['DemoStoryHook'] = './includes/story/hook_demo.php';
+ $classes['SpatioportStoryHook'] = './includes/story/hook_spatioport.php';
+ $classes['StorySection'] = './includes/story/section.php';
+ $classes['Story'] = './includes/story/story.php';
+
+ $classes['TravelPlace'] = './includes/travel/place.php';
+ $classes['Travel'] = './includes/travel/travel.php';
//Loader
if (array_key_exists($className, $classes)) {
require_once($classes[$className]);
}
}
-
-?>

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 19, 22:55 (4 d, 23 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
20712
Default Alt Text
(9 KB)

Event Timeline