Example #1
0
 */
/*
 * Unless explicitly acquired and licensed from Licensor under another
 * license, the contents of this file are subject to the Reciprocal Public
 * License ("RPL") Version 1.5, or subsequent versions as allowed by the RPL,
 * and You may not copy or use this file in either source code or executable
 * form, except in compliance with the terms and conditions of the RPL.
 *
 * All software distributed under the RPL is provided strictly on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND
 * LICENSOR HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE, QUIET ENJOYMENT, OR NON-INFRINGEMENT. See the RPL for specific
 * language governing rights and limitations under the RPL.
 *
 * -----------------------------------------------------------------------------
 * |    A copy of the RPL 1.5 may be found with this project or online at      |
 * |      http://opensource.org/licenses/rpl1.5.txt			       |
 * -----------------------------------------------------------------------------
 */
/*
 * TODO
 *	Have fun with this project!
 *	If not pick another or do something different.
 *	Find joy!
 */
INI_Set("display_errors", true);
INI_Set("error_reporting", E_ALL | E_STRICT);
INI_Set("date.timezone", "America/Denver");
Header("Content-Type: text/html; charset=utf-8");
Header("Content-disposition: inline; filename=Expressive+Programming.html");
<?php

/*
 * A couple of custom PHP utils to make the code work much more closely to the
 * original Java source code.
 */
/*
 * Put the lib dir on the include path for easy inclusion of library files
 */
INI_Set("include_path", INI_Get("include_path") . PATH_SEPARATOR . dirname(__FILE__) . DIRECTORY_SEPARATOR . "library");
/*
 * Remove the first element off of the argv array, since it represents the file
 * that was called and we only want arguments, in order to mimic Java's args.
 */
if (isset($_SERVER["argv"])) {
    array_shift($_SERVER["argv"]);
}
/*
 * Mimic all classes being in the same Java package by autoloading classes in
 * the same directory
 */
function __autoload($className)
{
    require_once $className . ".php";
}
/*
 * Mimic Java's println()
 */
function println($string_message = "")
{
    return print $string_message . "\n";
<?php

define("APPLICATION_PATH", dirname(__FILE__));
define("DATA_PATH", realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "data"));
/*
 * Put the application directory on the include path so that application files
 * can find their components
 */
INI_Set("include_path", INI_Get("include_path") . PATH_SEPARATOR . realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "library") . PATH_SEPARATOR . APPLICATION_PATH);