From 568a5cea4833a3316f3741dcd32699334f770d26 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 28 Jan 2006 17:09:31 +0000 Subject: Rename "tools" to "buildscripts". --- buildscripts/.htaccess | 1 + buildscripts/jsbuilder/build.php | 152 + buildscripts/jsbuilder/custom_rhino.jar | Bin 0 -> 731885 bytes buildscripts/jsbuilder/packer.js | 539 ++ buildscripts/phpbuilder/build.php | 99 + buildscripts/phpbuilder/files.txt | 89 + buildscripts/texbuilder/build.php | 233 + buildscripts/texbuilder/prado3_quick_start.pdf | 8508 ++++++++++++++++++++++++ buildscripts/texbuilder/prado3_quick_start.tex | 115 + 9 files changed, 9736 insertions(+) create mode 100644 buildscripts/.htaccess create mode 100644 buildscripts/jsbuilder/build.php create mode 100644 buildscripts/jsbuilder/custom_rhino.jar create mode 100644 buildscripts/jsbuilder/packer.js create mode 100644 buildscripts/phpbuilder/build.php create mode 100644 buildscripts/phpbuilder/files.txt create mode 100644 buildscripts/texbuilder/build.php create mode 100644 buildscripts/texbuilder/prado3_quick_start.pdf create mode 100644 buildscripts/texbuilder/prado3_quick_start.tex (limited to 'buildscripts') diff --git a/buildscripts/.htaccess b/buildscripts/.htaccess new file mode 100644 index 00000000..e0198322 --- /dev/null +++ b/buildscripts/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/buildscripts/jsbuilder/build.php b/buildscripts/jsbuilder/build.php new file mode 100644 index 00000000..eac0acae --- /dev/null +++ b/buildscripts/jsbuilder/build.php @@ -0,0 +1,152 @@ +#!/usr/bin/php +, Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package Tools + */ + +//compress using a script, has more options but lesss robut +//define('COMPRESS_COMMAND','java -jar '.dirname(__FILE__).'/custom_rhino.jar packer.js %s > %s'); + +//compress using build-in engine, very robust. +define('COMPRESS_COMMAND','java -jar '.dirname(__FILE__).'/custom_rhino.jar -c %s > %s'); + +/** + * The root directory for storing all source js files + */ +define('SOURCE_DIR',realpath(dirname(__FILE__).'/../../framework/Web/JavaScripts')); +/** + * The directory for storing compressed js files + */ +define('TARGET_DIR',realpath(dirname(__FILE__).'/../../framework/Web/JavaScripts/js')); + +if(SOURCE_DIR===false || TARGET_DIR===false) + die('Unable to determine the build path.'); +if(!is_writable(TARGET_DIR)) + die('Unable to create files under '.TARGET_DIR.'.'); + +/** + * list of js library files to be compressed and built + */ +$libraries = array( + 'prado.js' => array( + + //base javascript functions + 'prototype/prototype.js', + 'prototype/base.js', + 'extended/util.js', + 'extended/base.js', + 'prototype/string.js', + 'extended/string.js', + 'prototype/enumerable.js', + 'prototype/array.js', + 'prototype/hash.js', + 'prototype/range.js', + + //dom functions + 'prototype/dom.js', + 'extended/dom.js', + 'prototype/form.js', + 'prototype/event.js', + 'extended/event.js', + 'prototype/position.js', + 'extra/getElementsBySelector.js', + 'extra/behaviour.js', + 'effects/util.js', + 'extended/date.js', + + //prado core + 'prado/prado.js', + 'prado/form.js', + 'prado/element.js', + 'prado/controls.js' + ), + + //effects + 'effects.js' => array( + 'effects/effects.js', + 'prado/effects.js' + ), + //active controls + 'ajax.js' => array( + 'prototype/ajax.js', + 'prado/ajax.js', + 'extra/json.js', + 'effects/controls.js', + 'effects/dragdrop.js', + 'effects/slider.js', + 'prado/activecontrols.js' + ), + //logging + 'logger.js' => array( + 'extra/logger.js', + ), + + //rico + 'rico.js' => array( + 'rico/rico.js', + 'rico/extension.js' + ), + + //validator + 'validator.js' => array( + 'prado/validation.js', + 'prado/validators.js' + ), + + //date picker + 'datepicker.js' => array( + 'datepicker/datepicker.js' + ) +); + +/** + * Collect specific libraries to be built from command line + */ +$requestedLibs=array(); +for($i=1;$i<$argc;++$i) + $requestedLibs[]=$argv[$i].'.js'; + +/** + * loop through all target files and build them one by one + */ +foreach($libraries as $libFile => $sourceFiles) +{ + if(!empty($requestedLibs) && !in_array($libFile,$requestedLibs)) + continue; + $libFile=TARGET_DIR.'/'.$libFile; + echo "\nBuilding $libFile...\n"; + $contents=''; + foreach($sourceFiles as $sourceFile) + { + $sourceFile=SOURCE_DIR.'/'.$sourceFile; + if(!is_file($sourceFile)) + echo "Source file not found: $sourceFile\n"; + $tempFile=$sourceFile.'.tmp'; + $command=sprintf(COMPRESS_COMMAND,$sourceFile,$tempFile); + echo "...adding $sourceFile\n". + system($command); + $contents.=file_get_contents($tempFile); + @unlink($tempFile); + } + file_put_contents($libFile,$contents); +} + +?> \ No newline at end of file diff --git a/buildscripts/jsbuilder/custom_rhino.jar b/buildscripts/jsbuilder/custom_rhino.jar new file mode 100644 index 00000000..4a97cdeb Binary files /dev/null and b/buildscripts/jsbuilder/custom_rhino.jar differ diff --git a/buildscripts/jsbuilder/packer.js b/buildscripts/jsbuilder/packer.js new file mode 100644 index 00000000..d261be35 --- /dev/null +++ b/buildscripts/jsbuilder/packer.js @@ -0,0 +1,539 @@ +/* + common, version 1.0.4a (2005/06/07) + Copyright 2005, Dean Edwards + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +// this function may be used to cast any javascript object +// to a common object +function ICommon(that) { + if (that != null) { + that.inherit = Common.prototype.inherit; + that.specialize = Common.prototype.specialize; + } + return that; +}; + +// sub-classing +ICommon.specialize = function($prototype, $constructor) { + // initialise class properties + if (!$prototype) $prototype = {}; + if (!$constructor) $constructor = $prototype.constructor; + if ($constructor == {}.constructor) $constructor = new Function; + // build the inheritance chain + // insert a dummy constructor between the ancestor + // and the new constructor. this allows standard + // prototype inheritance plus chained constructor + // functions. + $constructor.valueOf = new Function("return this"); + $constructor.valueOf.prototype = new this.valueOf; + $constructor.valueOf.prototype.specialize($prototype); + $constructor.prototype = new $constructor.valueOf; + $constructor.valueOf.prototype.constructor = $constructor; + $constructor.prototype.constructor = $constructor; + $constructor.ancestor = this; + $constructor.specialize = arguments.callee; + $constructor.ancestorOf = this.ancestorOf; + return $constructor; +}; + +// root of the inheritance chain +ICommon.valueOf = new Function("return this"); + +// common interface +ICommon.valueOf.prototype = { +constructor: ICommon, +inherit: function() { +//- +// Call this method from any other method to call that method's ancestor. +// If there is no ancestor function then this function will throw an error. +//- + return arguments.callee.caller.ancestor.apply(this, arguments); +}, +specialize: function(that) { +//- +// Add the interface of another object to this object +//- + // if this object is the prototype then specialize the /real/ prototype + if (this == this.constructor.prototype && this.constructor.specialize) { + return this.constructor.valueOf.prototype.specialize(that); + } + // add each of one of the source object's properties to this object + for (var i in that) { + switch (i) { + case "constructor": // don't do this one! + case "toString": // do this one maually + case "valueOf": // ignore this one... + continue; + } + // implement inheritance + if (typeof that[i] == "function" && that[i] != this[i]) { + that[i].ancestor = this[i]; + } + // add the property + this[i] = that[i]; + } + // do the "toString" function manually + if (that.toString != this.toString && that.toString != {}.toString) { + that.toString.ancestor = this.toString; + this.toString = that.toString; + } + return this; +}}; + +// create the root +function Common() { +//-- +// empty constructor function +//-- +}; +this.Common = ICommon.specialize({ +constructor: Common, +toString: function() { + return "[common " + (this.constructor.className || "Object") + "]"; +}, +instanceOf: function(klass) { + return this.constructor == klass || klass.ancestorOf(this.constructor); +} +}); +Common.className = "Common"; +Common.ancestor = null; +Common.ancestorOf = function(klass) { + // Is this class an ancestor of the supplied class? + while (klass && klass.ancestor != this) klass = klass.ancestor; + return Boolean(klass); +}; + +// preserve the common prototype so that we can tell when a +// property of the root class has changed +Common.valueOf.ancestor = ICommon; + +// c'est fini! + +/* + ParseMaster, version 1.0.2 (2005-08-19) + Copyright 2005, Dean Edwards + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +/* a multi-pattern parser */ + +// KNOWN BUG: erroneous behavior when using escapeChar with a replacement value that is a function + +function ParseMaster() { + // constants + var $EXPRESSION = 0, $REPLACEMENT = 1, $LENGTH = 2; + // used to determine nesting levels + var $GROUPS = /\(/g, $SUB_REPLACE = /\$\d/, $INDEXED = /^\$\d+$/, + $TRIM = /(['"])\1\+(.*)\+\1\1$/, $$ESCAPE = /\\./g, $QUOTE = /'/, + $$DELETED = /\x01[^\x01]*\x01/g; + var self = this; + // public + this.add = function($expression, $replacement) { + if (!$replacement) $replacement = ""; + // count the number of sub-expressions + // - add one because each pattern is itself a sub-expression + var $length = (_internalEscape(String($expression)).match($GROUPS) || "").length + 1; + // does the pattern deal with sub-expressions? + if ($SUB_REPLACE.test($replacement)) { + // a simple lookup? (e.g. "$2") + if ($INDEXED.test($replacement)) { + // store the index (used for fast retrieval of matched strings) + $replacement = parseInt($replacement.slice(1)) - 1; + } else { // a complicated lookup (e.g. "Hello $2 $1") + // build a function to do the lookup + var i = $length; + var $quote = $QUOTE.test(_internalEscape($replacement)) ? '"' : "'"; + while (i) $replacement = $replacement.split("$" + i--).join($quote + "+a[o+" + i + "]+" + $quote); + $replacement = new Function("a,o", "return" + $quote + $replacement.replace($TRIM, "$1") + $quote); + } + } + // pass the modified arguments + _add($expression || "/^$/", $replacement, $length); + }; + // execute the global replacement + this.exec = function($string) { + _escaped.length = 0; + return _unescape(_escape($string, this.escapeChar).replace( + new RegExp(_patterns, this.ignoreCase ? "gi" : "g"), _replacement), this.escapeChar).replace($$DELETED, ""); + }; + // clear the patterns collection so that this object may be re-used + this.reset = function() { + _patterns.length = 0; + }; + + // private + var _escaped = []; // escaped characters + var _patterns = []; // patterns stored by index + var _toString = function(){return "(" + String(this[$EXPRESSION]).slice(1, -1) + ")"}; + _patterns.toString = function(){return this.join("|")}; + // create and add a new pattern to the patterns collection + function _add() { + arguments.toString = _toString; + // store the pattern - as an arguments object (i think this is quicker..?) + _patterns[_patterns.length] = arguments; + } + // this is the global replace function (it's quite complicated) + function _replacement() { + if (!arguments[0]) return ""; + var i = 1, j = 0, $pattern; + // loop through the patterns + while ($pattern = _patterns[j++]) { + // do we have a result? + if (arguments[i]) { + var $replacement = $pattern[$REPLACEMENT]; + switch (typeof $replacement) { + case "function": return $replacement(arguments, i); + case "number": return arguments[$replacement + i]; + } + var $delete = (arguments[i].indexOf(self.escapeChar) == -1) ? "" : + "\x01" + arguments[i] + "\x01"; + return $delete + $replacement; + // skip over references to sub-expressions + } else i += $pattern[$LENGTH]; + } + }; + // encode escaped characters + function _escape($string, $escapeChar) { + return $escapeChar ? $string.replace(new RegExp("\\" + $escapeChar + "(.)", "g"), function($match, $char) { + _escaped[_escaped.length] = $char; + return $escapeChar; + }) : $string; + }; + // decode escaped characters + function _unescape($string, $escapeChar) { + var i = 0; + return $escapeChar ? $string.replace(new RegExp("\\" + $escapeChar, "g"), function() { + return $escapeChar + (_escaped[i++] || ""); + }) : $string; + }; + function _internalEscape($string) { + return $string.replace($$ESCAPE, ""); + }; +}; +ParseMaster.prototype = { + constructor: ParseMaster, + ignoreCase: false, + escapeChar: "" +}; + + +/* + packer, version 2.0.2 (2005-08-19) + Copyright 2004-2005, Dean Edwards + License: http://creativecommons.org/licenses/LGPL/2.1/ +*/ + +function pack(_script, _encoding, _fastDecode, _specialChars) { + // constants + var $IGNORE = "$1"; + + // validate parameters + _script += "\n"; + _encoding = Math.min(parseInt(_encoding), 95); + + // apply all parsing routines + function _pack($script) { + var i, $parse; + for (i = 0; ($parse = _parsers[i]); i++) { + $script = $parse($script); + } + return $script; + }; + + // unpacking function - this is the boot strap function + // data extracted from this packing routine is passed to + // this function when decoded in the target + var _unpack = function($packed, $ascii, $count, $keywords, $encode, $decode) { + while ($count--) + if ($keywords[$count]) + $packed = $packed.replace(new RegExp('\\b' + $encode($count) + '\\b', 'g'), $keywords[$count]); + return $packed; + }; + + // code-snippet inserted into the unpacker to speed up decoding + var _decode = function() { + // does the browser support String.replace where the + // replacement value is a function? + if (!''.replace(/^/, String)) { + // decode all the values we need + while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count); + // global replacement function + $keywords = [function($encoded){return $decode[$encoded]}]; + // generic match + $encode = function(){return'\\w+'}; + // reset the loop counter - we are now doing a global replace + $count = 1; + } + }; + + // keep a list of parsing functions, they'll be executed all at once + var _parsers = []; + function _addParser($parser) { + _parsers[_parsers.length] = $parser; + }; + + // zero encoding - just removal of white space and comments + function _basicCompression($script) { + var $parser = new ParseMaster; + // make safe + $parser.escapeChar = "\\"; + // protect strings + $parser.add(/'[^'\n\r]*'/, $IGNORE); + $parser.add(/"[^"\n\r]*"/, $IGNORE); + // remove comments + $parser.add(/\/\/[^\n\r]*[\n\r]/, " "); + $parser.add(/\/\*[^*]*\*+([^\/][^*]*\*+)*\//, " "); + // protect regular expressions + $parser.add(/\s+(\/[^\/\n\r\*][^\/\n\r]*\/g?i?)/, "$2"); // IGNORE + $parser.add(/[^\w\x24\/'"*)\?:]\/[^\/\n\r\*][^\/\n\r]*\/g?i?/, $IGNORE); + // remove: ;;; doSomething(); + //if (_specialChars) $parser.add(/;;;[^\n\r]+[\n\r]/); + // remove redundant semi-colons + $parser.add(/\(;;\)/, $IGNORE); // protect for (;;) loops + $parser.add(/;+\s*([};])/, "$2"); + // apply the above + $script = $parser.exec($script); + + // remove white-space + // $parser.add(/(\b|\x24)\s+(\b|\x24)/, "$2 $3"); + // $parser.add(/([+\-])\s+([+\-])/, "$2 $3"); + // $parser.add(/\s+/, ""); + // done + return $parser.exec($script); + }; + + function _encodeSpecialChars($script) { + var $parser = new ParseMaster; + // replace: $name -> n, $$name -> na + $parser.add(/((\x24+)([a-zA-Z$_]+))(\d*)/, function($match, $offset) { + var $length = $match[$offset + 2].length; + var $start = $length - Math.max($length - $match[$offset + 3].length, 0); + return $match[$offset + 1].substr($start, $length) + $match[$offset + 4]; + }); + // replace: _name -> _0, double-underscore (__name) is ignored + var $regexp = /\b_[A-Za-z\d]\w*/; + // build the word list + var $keywords = _analyze($script, _globalize($regexp), _encodePrivate); + // quick ref + var $encoded = $keywords.$encoded; + $parser.add($regexp, function($match, $offset) { + return $encoded[$match[$offset]]; + }); + return $parser.exec($script); + }; + + function _encodeKeywords($script) { + // escape high-ascii values already in the script (i.e. in strings) + if (_encoding > 62) $script = _escape95($script); + // create the parser + var $parser = new ParseMaster; + var $encode = _getEncoder(_encoding); + // for high-ascii, don't encode single character low-ascii + var $regexp = (_encoding > 62) ? /\w\w+/ : /\w+/; + // build the word list + $keywords = _analyze($script, _globalize($regexp), $encode); + var $encoded = $keywords.$encoded; + // encode + $parser.add($regexp, function($match, $offset) { + return $encoded[$match[$offset]]; + }); + // if encoded, wrap the script in a decoding function + return $script && _bootStrap($parser.exec($script), $keywords); + }; + + function _analyze($script, $regexp, $encode) { + // analyse + // retreive all words in the script + var $all = $script.match($regexp); + var $$sorted = []; // list of words sorted by frequency + var $$encoded = {}; // dictionary of word->encoding + var $$protected = {}; // instances of "protected" words + if ($all) { + var $unsorted = []; // same list, not sorted + var $protected = {}; // "protected" words (dictionary of word->"word") + var $values = {}; // dictionary of charCode->encoding (eg. 256->ff) + var $count = {}; // word->count + var i = $all.length, j = 0, $word; + // count the occurrences - used for sorting later + do { + $word = "$" + $all[--i]; + if (!$count[$word]) { + $count[$word] = 0; + $unsorted[j] = $word; + // make a dictionary of all of the protected words in this script + // these are words that might be mistaken for encoding + $protected["$" + ($values[j] = $encode(j))] = j++; + } + // increment the word counter + $count[$word]++; + } while (i); + // prepare to sort the word list, first we must protect + // words that are also used as codes. we assign them a code + // equivalent to the word itself. + // e.g. if "do" falls within our encoding range + // then we store keywords["do"] = "do"; + // this avoids problems when decoding + i = $unsorted.length; + do { + $word = $unsorted[--i]; + if ($protected[$word] != null) { + $$sorted[$protected[$word]] = $word.slice(1); + $$protected[$protected[$word]] = true; + $count[$word] = 0; + } + } while (i); + // sort the words by frequency + $unsorted.sort(function($match1, $match2) { + return $count[$match2] - $count[$match1]; + }); + j = 0; + // because there are "protected" words in the list + // we must add the sorted words around them + do { + if ($$sorted[i] == null) $$sorted[i] = $unsorted[j++].slice(1); + $$encoded[$$sorted[i]] = $values[i]; + } while (++i < $unsorted.length); + } + return {$sorted: $$sorted, $encoded: $$encoded, $protected: $$protected}; + }; + + // build the boot function used for loading and decoding + function _bootStrap($packed, $keywords) { + var $ENCODE = _safeRegExp("$encode\\($count\\)", "g"); + + // $packed: the packed script + $packed = "'" + _escape($packed) + "'"; + + // $ascii: base for encoding + var $ascii = Math.min($keywords.$sorted.length, _encoding) || 1; + + // $count: number of words contained in the script + var $count = $keywords.$sorted.length; + + // $keywords: list of words contained in the script + for (var i in $keywords.$protected) $keywords.$sorted[i] = ""; + // convert from a string to an array + $keywords = "'" + $keywords.$sorted.join("|") + "'.split('|')"; + + // $encode: encoding function (used for decoding the script) + var $encode = _encoding > 62 ? _encode95 : _getEncoder($ascii); + $encode = String($encode).replace(/_encoding/g, "$ascii").replace(/arguments\.callee/g, "$encode"); + var $inline = "$count" + ($ascii > 10 ? ".toString($ascii)" : ""); + + // $decode: code snippet to speed up decoding + if (_fastDecode) { + // create the decoder + var $decode = _getFunctionBody(_decode); + if (_encoding > 62) $decode = $decode.replace(/\\\\w/g, "[\\xa1-\\xff]"); + // perform the encoding inline for lower ascii values + else if ($ascii < 36) $decode = $decode.replace($ENCODE, $inline); + // special case: when $count==0 there are no keywords. I want to keep + // the basic shape of the unpacking funcion so i'll frig the code... + if (!$count) $decode = $decode.replace(_safeRegExp("($count)\\s*=\\s*1"), "$1=0"); + } + + // boot function + var $unpack = String(_unpack); + if (_fastDecode) { + // insert the decoder + $unpack = $unpack.replace(/\{/, "{" + $decode + ";"); + } + $unpack = $unpack.replace(/"/g, "'"); + if (_encoding > 62) { // high-ascii + // get rid of the word-boundaries for regexp matches + $unpack = $unpack.replace(/'\\\\b'\s*\+|\+\s*'\\\\b'/g, ""); + } + if ($ascii > 36 || _encoding > 62 || _fastDecode) { + // insert the encode function + $unpack = $unpack.replace(/\{/, "{$encode=" + $encode + ";"); + } else { + // perform the encoding inline + $unpack = $unpack.replace($ENCODE, $inline); + } + // pack the boot function too + $unpack = pack($unpack, 0, false, true); + + // arguments + var $params = [$packed, $ascii, $count, $keywords]; + if (_fastDecode) { + // insert placeholders for the decoder + $params = $params.concat(0, "{}"); + } + + // the whole thing + return "eval(" + $unpack + "(" + $params + "))\n"; + }; + + // mmm.. ..which one do i need ?? + function _getEncoder($ascii) { + return $ascii > 10 ? $ascii > 36 ? $ascii > 62 ? _encode95 : _encode62 : _encode36 : _encode10; + }; + + // zero encoding + // characters: 0123456789 + var _encode10 = function($charCode) { + return $charCode; + }; + + // inherent base36 support + // characters: 0123456789abcdefghijklmnopqrstuvwxyz + var _encode36 = function($charCode) { + return $charCode.toString(36); + }; + + // hitch a ride on base36 and add the upper case alpha characters + // characters: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ + var _encode62 = function($charCode) { + return ($charCode < _encoding ? '' : arguments.callee(parseInt($charCode / _encoding))) + + (($charCode = $charCode % _encoding) > 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36)); + }; + + // use high-ascii values + // characters: + var _encode95 = function($charCode) { + return ($charCode < _encoding ? '' : arguments.callee($charCode / _encoding)) + + String.fromCharCode($charCode % _encoding + 161); + }; + + // special _chars + var _encodePrivate = function($charCode) { + return "_" + $charCode; + }; + + // protect characters used by the parser + function _escape($script) { + return $script.replace(/([\\'])/g, "\\$1"); + }; + + // protect high-ascii characters already in the script + function _escape95($script) { + return $script.replace(/[\xa1-\xff]/g, function($match) { + return "\\x" + $match.charCodeAt(0).toString(16); + }); + }; + + function _safeRegExp($string, $flags) { + return new RegExp($string.replace(/\$/g, "\\$"), $flags); + }; + + // extract the body of a function + function _getFunctionBody($function) { + with (String($function)) return slice(indexOf("{") + 1, lastIndexOf("}")); + }; + + // set the global flag on a RegExp (you have to create a new one) + function _globalize($regexp) { + return new RegExp(String($regexp).slice(1, -1), "g"); + }; + + // build the parsing routine + _addParser(_basicCompression); + if (_specialChars) _addParser(_encodeSpecialChars); + if (_encoding) _addParser(_encodeKeywords); + + // go! + return _pack(_script); +}; + +print(pack(readFile(arguments[0]))); diff --git a/buildscripts/phpbuilder/build.php b/buildscripts/phpbuilder/build.php new file mode 100644 index 00000000..6df74923 --- /dev/null +++ b/buildscripts/phpbuilder/build.php @@ -0,0 +1,99 @@ +#!/usr/bin/php + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + * @package Tools + */ + +/** + * The merged file name + */ +define('OUTPUT_FILE','pradolite.php'); +/** + * The framework directory + */ +define('FRAMEWORK_DIR',realpath(dirname(__FILE__).'/../../framework')); +/** + * The file containing script list to be built + */ +define('SCRIPT_FILES',dirname(__FILE__).'/files.txt'); + +if(FRAMEWORK_DIR===false) + die('Unable to determine the installation directory of Prado Framework.'); +if(!is_file(SCRIPT_FILES)) + die('Unable to read '.SCRIPT_FILES.'.'); + +$output=''; + +$lines=file(SCRIPT_FILES); +foreach($lines as $line) +{ + $line=trim($line); + if($line==='' || $line[0]==='#') + continue; + echo 'adding '.FRAMEWORK_DIR.'/'.$line."\n"; + $input=file_get_contents(FRAMEWORK_DIR.'/'.$line); + $input = strip_comments($input); + $input=strtr($input,"\r",' '); + $input=preg_replace("/\s*(\n+\s*){2,}\s*/m","\n",$input); + $input=preg_replace('/^Prado::using\([^\*]*?\);/mu','',$input); + $input=preg_replace('/^(require|require_once)\s*\(.*?;/mu','',$input); + $input=preg_replace('/^(include|include_once)\s*\(.*?;/mu','',$input); + + //remove internal logging + $input=preg_replace('/^\s*Prado::trace.*\s*;\s*$/mu','',$input); + + $output.=$input; +} + +file_put_contents(FRAMEWORK_DIR.'/'.OUTPUT_FILE,$output); + +function strip_comments($source) +{ + $tokens = token_get_all($source); + /* T_ML_COMMENT does not exist in PHP 5. + * The following three lines define it in order to + * preserve backwards compatibility. + * + * The next two lines define the PHP 5-only T_DOC_COMMENT, + * which we will mask as T_ML_COMMENT for PHP 4. + */ + if (!defined('T_ML_COMMENT')) { + @define('T_ML_COMMENT', T_COMMENT); + } else { + @define('T_DOC_COMMENT', T_ML_COMMENT); + } + $output = ''; + foreach ($tokens as $token) { + if (is_string($token)) { + // simple 1-character token + $output .= $token; + } else { + // token array + list($id, $text) = $token; + switch ($id) { + case T_COMMENT: + case T_ML_COMMENT: // we've defined this + case T_DOC_COMMENT: // and this + // no action on comments + break; + default: + // anything else -> output "as is" + $output .= $text; + break; + } + } + } + return $output; +} + +?> \ No newline at end of file diff --git a/buildscripts/phpbuilder/files.txt b/buildscripts/phpbuilder/files.txt new file mode 100644 index 00000000..21779094 --- /dev/null +++ b/buildscripts/phpbuilder/files.txt @@ -0,0 +1,89 @@ +TComponent.php +Exceptions/TException.php +Collections/TList.php +Collections/TMap.php +Collections/TAttributeCollection.php +Data/TXmlDocument.php +Web/THttpUtility.php +Data/TCache.php +Log/TLogger.php +core.php +prado.php +TApplication.php +Exceptions/TErrorHandler.php +Web/THttpRequest.php +Web/THttpResponse.php +Web/THttpSession.php +Security/TAuthorizationRule.php +Web/Services/TPageService.php +Web/UI/THtmlWriter.php +Web/UI/TTemplateManager.php +Web/UI/TThemeManager.php +Web/UI/TAssetManager.php +Web/UI/TPageStatePersister.php +Web/UI/TControl.php +Web/UI/TTemplateControl.php +Web/UI/TForm.php +Web/UI/TClientScriptManager.php +Web/UI/TPage.php +Web/UI/WebControls/TFont.php +Web/UI/WebControls/TStyle.php +Web/UI/WebControls/TWebControl.php +Web/UI/WebControls/TPlaceHolder.php +Web/UI/WebControls/TLiteral.php +Web/UI/WebControls/TLabel.php +Web/UI/WebControls/TImage.php +Web/UI/WebControls/TImageButton.php +Web/UI/WebControls/TButton.php +Web/UI/WebControls/TCheckBox.php +Web/UI/WebControls/TRadioButton.php +Web/UI/WebControls/TTextBox.php +# Web/UI/WebControls/TTextHighlighter.php +Web/UI/WebControls/TPanel.php +Web/UI/WebControls/TContent.php +Web/UI/WebControls/TContentPlaceHolder.php +Web/UI/WebControls/TExpression.php +Web/UI/WebControls/TStatements.php +Web/UI/WebControls/TFileUpload.php +Web/UI/WebControls/THead.php +Web/UI/WebControls/THiddenField.php +Web/UI/WebControls/THyperLink.php +Web/UI/WebControls/TTable.php + +Web/UI/WebControls/TDataSourceControl.php +Web/UI/WebControls/TDataSourceView.php + +Web/UI/WebControls/TDataBoundControl.php +Web/UI/WebControls/TCheckBoxList.php +Web/UI/WebControls/TRadioButtonList.php +Web/UI/WebControls/TBulletedList.php + +Web/UI/WebControls/TListControl.php +Web/UI/WebControls/TListBox.php +Web/UI/WebControls/TDropDownList.php + +Web/UI/WebControls/TJavascriptLogger.php +Web/UI/WebControls/TLinkButton.php + +Web/UI/WebControls/TBaseValidator.php +Web/UI/WebControls/TRequiredFieldValidator.php +Web/UI/WebControls/TCompareValidator.php +Web/UI/WebControls/TRegularExpressionValidator.php +Web/UI/WebControls/TEmailAddressValidator.php +Web/UI/WebControls/TCustomValidator.php +Web/UI/WebControls/TValidationSummary.php + +Web/UI/WebControls/TRepeatInfo.php +Web/UI/WebControls/TRepeater.php + +Web/UI/WebControls/TBaseDataList.php +Web/UI/WebControls/TDataList.php +Collections/TPagedDataSource.php +Collections/TDummyDataSource.php +Web/UI/WebControls/TDataGrid.php +Web/UI/WebControls/TDataGridColumn.php +Web/UI/WebControls/TBoundColumn.php +Web/UI/WebControls/TButtonColumn.php +Web/UI/WebControls/TEditCommandColumn.php +Web/UI/WebControls/THyperLinkColumn.php +Web/UI/WebControls/TTemplateColumn.php diff --git a/buildscripts/texbuilder/build.php b/buildscripts/texbuilder/build.php new file mode 100644 index 00000000..1866f868 --- /dev/null +++ b/buildscripts/texbuilder/build.php @@ -0,0 +1,233 @@ +]*>/', '', $html); + $html = preg_replace('/<\/?p>/m', '', $html); + + //escape { and } + $html = preg_replace('/([^\s]+){([^}]*)}([^\s]+)/', '$1\\\{$2\\\}$3', $html); + + //codes + $html = str_replace('$', '\$', $html); + $html = preg_replace('/]*>/', '`1`', $html); + $html = preg_replace('/<\/com:TTextHighlighter>/', '`2`', $html); + $html = preg_replace_callback('/(`1`)([^`]*)(`2`)/m', 'escape_verbatim', $html); + $html = preg_replace_callback('/(
)([^<]*)(<\/div>)/', 'escape_verbatim', $html); + + $html = preg_replace_callback('/"?[^\\/]*\/>/', 'include_image', $html); + + //runbar + $html = preg_replace('//', + 'Try, \texttt{http://../quickstart/index.php?page=$1}', $html); + + //text modifiers + $html = preg_replace('/([^<]*)<\/b>/', '\textbf{$1}', $html); + $html = preg_replace('/([^<]*)<\/i>/', '\emph{$1}', $html); + $html = preg_replace('/([^<]*)<\/tt>/', '\texttt{$1}', $html); + + //links + $html = preg_replace_callback('/]+href="([^"]*)"[^>]*>([^<]*)<\/a>/', + 'make_link', $html); + //anchor + $html = preg_replace_callback('/]+name="([^"]*)"[^>]*><\/a>/', 'anchor', $html); + + //item lists + $html = preg_replace('/
    /', '\begin{itemize}', $html); + $html = preg_replace('/<\/ol>/', '\end{itemize}', $html); + $html = preg_replace('/