diff --git a/config.php b/config.php index 44f19f4..e6ca983 100644 --- a/config.php +++ b/config.php @@ -30,6 +30,7 @@ class PhDConfig ), 'color_output' => false, 'output_dir' => './', + 'intermediate_output_dir' => '.', 'php_error_output' => NULL, 'php_error_color' => false, 'user_error_output' => NULL, diff --git a/formats/bigxhtml.php b/formats/bigxhtml.php index e132456..d837163 100644 --- a/formats/bigxhtml.php +++ b/formats/bigxhtml.php @@ -1,5 +1,6 @@ 'format_link', 'xref' => 'format_xref', @@ -112,6 +113,7 @@ class PhDBigXHTMLFormat extends PhDXHTMLFormat { } else { $this->close(); } + v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); break; } } diff --git a/formats/php.php b/formats/php.php index b535ec7..4a32fd7 100644 --- a/formats/php.php +++ b/formats/php.php @@ -1,5 +1,6 @@ 'format_suppressed_tags', 'function' => 'format_suppressed_tags', @@ -132,6 +133,10 @@ manual_header(); $this->registerTextMap(static::getDefaultTextMap()); } break; + + case PhDRender::INIT: + v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); + break; } } public function format_suppressed_text($value, $tag) { diff --git a/formats/xhtml.php b/formats/xhtml.php index 14828d3..5e495a2 100644 --- a/formats/xhtml.php +++ b/formats/xhtml.php @@ -1,6 +1,7 @@ 'div', /* Docbook-xsl prints "abstract"... */ 'abbrev' => 'abbr', @@ -594,6 +595,10 @@ class PhDXHTMLFormat extends PhDFormat { $this->registerTextMap(static::getDefaultTextMap()); } break; + + case PhDRender::INIT: + v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); + break; } } diff --git a/include/PhDBuildOptions.class.php b/include/PhDBuildOptions.class.php index 306239b..8555266 100644 --- a/include/PhDBuildOptions.class.php +++ b/include/PhDBuildOptions.class.php @@ -225,8 +225,15 @@ class PhDBuildOptionsParser extends PhDOptionParser public function option_version($k, $v) { - printf("PhD version: %s\n", PHD_VERSION); - printf("Copyright (c) 2008 The PHP Documentation Group\n"); + $color = PhDConfig::phd_info_color(); + $output = PhDConfig::phd_info_output(); + if (isset($GLOBALS['base_revision'])) { + $rev = preg_replace('/\$Re[v](?:ision)?(: ([\d.]+) ?)?\$$/e', "'\\1' == '' ? '??' : '\\2'", $GLOBALS['base_revision']); + fprintf($output, "%s\n", term_color("PhD Version: " . PHD_VERSION . " (" . $rev . ")", $color)); + } else { + fprintf($output, "%s\n", term_color("PhD Version: " . PHD_VERSION, $color)); + } + fprintf($output, "%s\n", term_color("Copyright(c) 2008 The PHP Documentation Group", $color)); exit(0); } diff --git a/include/PhDConfig.class.php b/include/PhDConfig.class.php deleted file mode 100644 index 71b65a9..0000000 --- a/include/PhDConfig.class.php +++ /dev/null @@ -1,52 +0,0 @@ - array( - ), - "output_theme" => array( - ), - "chunk_extra" => array( - ), - "index" => true, - "xml_root" => __DIR__, - "xml_file" => false, - "language" => "en", - "fallback_language" => "en", - "build_log_file" => false, - "verbose" => VERBOSE_ALL, - "date_format" => "H:i:s", - "render_ids" => array( - ), - "skip_ids" => array( - ), - "output_dir" => __DIR__, - "lang_dir" => __DIR__, - ); - - public static function init(array $a) { - self::$opts = array_merge(self::$opts, (array)$a); - } - public static function get($opt) { - if (!is_string($opt)) { - throw new UnexpectedValueException("Excpecting a string"); - } - if (!isset(self::$opts[$opt])) { - throw new UnexpectedValueException("Unknown option: $opt"); - } - return self::$opts[$opt]; - } -} - - diff --git a/include/PhDErrors.php b/include/PhDErrors.php index 43dcdfc..4b0cf43 100644 --- a/include/PhDErrors.php +++ b/include/PhDErrors.php @@ -3,24 +3,38 @@ /* {{{ PhD error & message handler */ -// FC For PHP5.3 -if (!defined("E_DEPRECATED")) { - define("E_DEPRECATED", E_RECOVERABLE_ERROR << 1); +$error_map = array( + E_RECOVERABLE_ERROR => 'PHP Error', + E_WARNING => 'PHP Warning', + E_NOTICE => 'PHP Notice', + E_STRICT => 'PHP Strict Standards Warning', + E_DEPRECATED => 'PHP Deprecated Construct Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', +); + +function define_error($name, $explanation) { + static $lastErrorValue = E_DEPRECATED; + + define($name, $lastErrorValue <<= 1); + $GLOBALS['error_map'][$lastErrorValue] = $explanation; } // PhD verbose flags -define('VERBOSE_INDEXING', E_DEPRECATED << 1); -define('VERBOSE_FORMAT_RENDERING', VERBOSE_INDEXING << 1); -define('VERBOSE_THEME_RENDERING', VERBOSE_FORMAT_RENDERING << 1); -define('VERBOSE_RENDER_STYLE', VERBOSE_THEME_RENDERING << 1); -define('VERBOSE_PARTIAL_READING', VERBOSE_RENDER_STYLE << 1); -define('VERBOSE_PARTIAL_CHILD_READING', VERBOSE_PARTIAL_READING << 1); -define('VERBOSE_TOC_WRITING', VERBOSE_PARTIAL_CHILD_READING << 1); -define('VERBOSE_CHUNK_WRITING', VERBOSE_TOC_WRITING << 1); -define('VERBOSE_NOVERSION', VERBOSE_CHUNK_WRITING << 1); +define_error('VERBOSE_INDEXING', 'PhD Indexer'); +define_error('VERBOSE_FORMAT_RENDERING', 'PhD Output Format'); +define_error('VERBOSE_THEME_RENDERING', 'PhD Output Theme'); +define_error('VERBOSE_RENDER_STYLE', 'PhD Rendering Style'); +define_error('VERBOSE_PARTIAL_READING', 'PhD Partial Reader'); +define_error('VERBOSE_PARTIAL_CHILD_READING', 'PhD Partial Child Reader'); +define_error('VERBOSE_TOC_WRITING', 'PhD TOC Writer'); +define_error('VERBOSE_CHUNK_WRITING', 'PhD Chunk Writer'); +define_error('VERBOSE_NOVERSION', 'Missing Version Information'); +define_error('VERBOSE_DONE', 'PhD Processing Completion'); -define('VERBOSE_ALL', (VERBOSE_NOVERSION << 1)-1); -define('VERBOSE_DEFAULT', (VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING|VERBOSE_NOVERSION))); +define('VERBOSE_ALL', (VERBOSE_NOVERSION << 1)-1); +define('VERBOSE_DEFAULT', (VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING|VERBOSE_NOVERSION|VERBOSE_DONE))); $olderrrep = error_reporting(); error_reporting($olderrrep | VERBOSE_DEFAULT); @@ -47,27 +61,6 @@ function term_color($text, $color) /* {{{ The PhD errorhandler */ function errh($errno, $msg, $file, $line, $ctx = null) { - static $err = array( - E_DEPRECATED => 'E_DEPRECATED', - E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', - E_STRICT => 'E_STRICT', - E_WARNING => 'E_WARNING', - E_NOTICE => 'E_NOTICE', - - E_USER_ERROR => 'E_USER_ERROR', - E_USER_WARNING => 'E_USER_WARNING', - E_USER_NOTICE => 'E_USER_NOTICE', - - VERBOSE_INDEXING => 'VERBOSE_INDEXING', - VERBOSE_FORMAT_RENDERING => 'VERBOSE_FORMAT_RENDERING', - VERBOSE_THEME_RENDERING => 'VERBOSE_THEME_RENDERING', - VERBOSE_RENDER_STYLE => 'VERBOSE_RENDER_STYLE', - VERBOSE_PARTIAL_READING => 'VERBOSE_PARTIAL_READING', - VERBOSE_PARTIAL_CHILD_READING => 'VERBOSE_PARTIAL_CHILD_READING', - VERBOSE_TOC_WRITING => 'VERBOSE_TOC_WRITING', - VERBOSE_CHUNK_WRITING => 'VERBOSE_CHUNK_WRITING', - VERBOSE_NOVERSION => 'VERBOSE_NOVERSION', - ); static $recursive = false; // Respect the error_reporting setting @@ -93,6 +86,7 @@ function errh($errno, $msg, $file, $line, $ctx = null) { case VERBOSE_TOC_WRITING: case VERBOSE_CHUNK_WRITING: case VERBOSE_NOVERSION: + case VERBOSE_DONE: $color = PhDConfig::phd_info_color(); $output = PhDConfig::phd_info_output(); $data = $msg; @@ -123,7 +117,7 @@ function errh($errno, $msg, $file, $line, $ctx = null) { return false; } - $timestamp = term_color(sprintf("[%s - %s]", $time, $err[$errno]), $color); + $timestamp = term_color(sprintf("[%s - %s]", $time, $GLOBALS['error_map'][$errno]), $color); fprintf($output, "%s %s\n", $timestamp, $data); // Abort on fatal errors diff --git a/include/PhDPartialReader.class.php b/include/PhDPartialReader.class.php deleted file mode 100644 index 454e8ae..0000000 --- a/include/PhDPartialReader.class.php +++ /dev/null @@ -1,99 +0,0 @@ -partial = $render_ids; - } else { - $this->partial[$render_ids] = 1; - } - $skip_ids = PhDConfig::skip_ids(); - if ($skip_ids !== NULL) { - if (is_array($skip_ids)) { - $this->skip = $skip_ids; - } else { - $this->skip[$skip_ids] = 1; - } - } - } else { - throw new Exception("Didn't get any IDs to seek"); - } - } - - public function read() { - static $seeked = 0; - static $currently_reading = false; - static $currently_skipping = false; - $ignore = false; - - while($ret = parent::read()) { - if ($this->isChunk) { - $id = $this->getAttributeNs("id", PhDReader::XMLNS_XML); - if (isset($this->partial[$id])) { - if ($this->isChunk == PhDReader::CLOSE_CHUNK) { - v("%s done", $id, VERBOSE_PARTIAL_READING); - - unset($this->partial[$id]); - --$seeked; - $currently_reading = false; - } else { - v("Starting %s...", $id, VERBOSE_PARTIAL_READING); - - $currently_reading = $id; - ++$seeked; - } - return $ret; - } elseif (isset($this->skip[$id])) { - if ($this->isChunk == PhDReader::CLOSE_CHUNK) { - v("%s done", $id, VERBOSE_PARTIAL_READING); - - unset($this->skip[$id]); - $currently_skipping = false; - $ignore = false; - } else { - v("Skipping %s...", $id, VERBOSE_PARTIAL_READING); - - $currently_skipping = $id; - $ignore = true; - } - } elseif ($currently_skipping && $this->skip[$currently_skipping]) { - if ($this->isChunk == PhDReader::OPEN_CHUNK) { - v("Skipping child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING); - } else { - v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING); - } - - $ignore = true; - } elseif ($currently_reading && $this->partial[$currently_reading]) { - if ($this->isChunk == PhDReader::OPEN_CHUNK) { - v("Rendering child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING); - } else { - v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING); - } - return $ret; - } elseif (empty($this->partial)) { - return false; - } else { - $ignore = true; - } - } elseif (!$ignore && $seeked > 0) { - return $ret; - } - } - return $ret; - } -} - -/* -* vim600: sw=4 ts=4 fdm=syntax syntax=php et -* vim<600: sw=4 ts=4 -*/ - diff --git a/include/PhDTheme.class.php b/include/PhDTheme.class.php deleted file mode 100644 index 35957d5..0000000 --- a/include/PhDTheme.class.php +++ /dev/null @@ -1,19 +0,0 @@ -format = $format; - } -} - -interface iPhDTheme { - public function appendData($data, $isChunk); -} - -/* - * vim600: sw=4 ts=4 fdm=syntax syntax=php et - * vim<600: sw=4 ts=4 - */ - diff --git a/mktoc.php b/mktoc.php deleted file mode 100644 index 43f5526..0000000 --- a/mktoc.php +++ /dev/null @@ -1,74 +0,0 @@ - element in the PHP manual -$PARENTS = array(-1 => "ROOT", 1 => "manual", 2 => "manual"); -// PEAR manual needs this line : $PARENTS = array(-1 => "ROOT", 1 => "guide"); - -$lastid = 0; - -while($r->read()) { - if (!($id = $r->getID())) { - $name = $r->name; - if (empty($IDs[$lastid]["sdesc"])) { - if ($name == "refname") { - $IDs[$lastid]["sdesc"] = $refname = trim($r->readContent($name)); - $ref = strtolower(str_replace(array("_", "::", "->"), array("-", "-", "-"), $refname)); - $REFS[$ref] = $lastid; - continue; - } - elseif($name == "titleabbrev") { - $IDs[$lastid]["sdesc"] = trim($r->readContent($name)); - continue; - } - } elseif($name == "refname") { - $refname = trim($r->readContent($name)); - $ref = strtolower(str_replace(array("_", "::", "->"), array("-", "-", "-"), $refname)); - $REFS[$ref] = $lastid; - } - if (empty($IDs[$lastid]["ldesc"])) { - if ($name == "title" || $name == "refpurpose") { - $IDs[$lastid]["ldesc"] = trim($r->readContent($name)); - } - } - - continue; - } - switch($r->isChunk) { - case PhDReader::OPEN_CHUNK: - $CURRENT_FILENAME = $FILENAMES[] = $PARENTS[$r->depth] = $id; - break; - - case PhDReader::CLOSE_CHUNK: - $LAST_CHUNK = array_pop($FILENAMES); - $CURRENT_FILENAME = end($FILENAMES); - - $IDs[$CURRENT_FILENAME]["children"][$LAST_CHUNK] = $IDs[$LAST_CHUNK]; - - - continue 2; - } - - if ($r->nodeType != XMLReader::ELEMENT) { - continue; - } - - $IDs[$id] = array( - "filename" => $CURRENT_FILENAME, - "parent" => $r->isChunk ? $PARENTS[$r->depth-1] : $CURRENT_FILENAME, - "sdesc" => null, - "ldesc" => null, - "children" => array(), - ); - - $lastid = $id; -} - -/* -* vim600: sw=4 ts=4 fdm=syntax syntax=php et -* vim<600: sw=4 ts=4 -*/ - diff --git a/phpdotnet/phd/BuildOptionsParser.php b/phpdotnet/phd/BuildOptionsParser.php index 306239b..8555266 100644 --- a/phpdotnet/phd/BuildOptionsParser.php +++ b/phpdotnet/phd/BuildOptionsParser.php @@ -225,8 +225,15 @@ class PhDBuildOptionsParser extends PhDOptionParser public function option_version($k, $v) { - printf("PhD version: %s\n", PHD_VERSION); - printf("Copyright (c) 2008 The PHP Documentation Group\n"); + $color = PhDConfig::phd_info_color(); + $output = PhDConfig::phd_info_output(); + if (isset($GLOBALS['base_revision'])) { + $rev = preg_replace('/\$Re[v](?:ision)?(: ([\d.]+) ?)?\$$/e', "'\\1' == '' ? '??' : '\\2'", $GLOBALS['base_revision']); + fprintf($output, "%s\n", term_color("PhD Version: " . PHD_VERSION . " (" . $rev . ")", $color)); + } else { + fprintf($output, "%s\n", term_color("PhD Version: " . PHD_VERSION, $color)); + } + fprintf($output, "%s\n", term_color("Copyright(c) 2008 The PHP Documentation Group", $color)); exit(0); } diff --git a/phpdotnet/phd/Config.php b/phpdotnet/phd/Config.php index 44f19f4..e6ca983 100644 --- a/phpdotnet/phd/Config.php +++ b/phpdotnet/phd/Config.php @@ -30,6 +30,7 @@ class PhDConfig ), 'color_output' => false, 'output_dir' => './', + 'intermediate_output_dir' => '.', 'php_error_output' => NULL, 'php_error_color' => false, 'user_error_output' => NULL, diff --git a/phpdotnet/phd/Format/XHTML.php b/phpdotnet/phd/Format/XHTML.php index 14828d3..5e495a2 100644 --- a/phpdotnet/phd/Format/XHTML.php +++ b/phpdotnet/phd/Format/XHTML.php @@ -1,6 +1,7 @@ 'div', /* Docbook-xsl prints "abstract"... */ 'abbrev' => 'abbr', @@ -594,6 +595,10 @@ class PhDXHTMLFormat extends PhDFormat { $this->registerTextMap(static::getDefaultTextMap()); } break; + + case PhDRender::INIT: + v("Starting %s rendering", $this->simpleName, VERBOSE_FORMAT_RENDERING); + break; } } diff --git a/phpdotnet/phd/Reader/Partial.php b/phpdotnet/phd/Reader/Partial.php deleted file mode 100644 index 454e8ae..0000000 --- a/phpdotnet/phd/Reader/Partial.php +++ /dev/null @@ -1,99 +0,0 @@ -partial = $render_ids; - } else { - $this->partial[$render_ids] = 1; - } - $skip_ids = PhDConfig::skip_ids(); - if ($skip_ids !== NULL) { - if (is_array($skip_ids)) { - $this->skip = $skip_ids; - } else { - $this->skip[$skip_ids] = 1; - } - } - } else { - throw new Exception("Didn't get any IDs to seek"); - } - } - - public function read() { - static $seeked = 0; - static $currently_reading = false; - static $currently_skipping = false; - $ignore = false; - - while($ret = parent::read()) { - if ($this->isChunk) { - $id = $this->getAttributeNs("id", PhDReader::XMLNS_XML); - if (isset($this->partial[$id])) { - if ($this->isChunk == PhDReader::CLOSE_CHUNK) { - v("%s done", $id, VERBOSE_PARTIAL_READING); - - unset($this->partial[$id]); - --$seeked; - $currently_reading = false; - } else { - v("Starting %s...", $id, VERBOSE_PARTIAL_READING); - - $currently_reading = $id; - ++$seeked; - } - return $ret; - } elseif (isset($this->skip[$id])) { - if ($this->isChunk == PhDReader::CLOSE_CHUNK) { - v("%s done", $id, VERBOSE_PARTIAL_READING); - - unset($this->skip[$id]); - $currently_skipping = false; - $ignore = false; - } else { - v("Skipping %s...", $id, VERBOSE_PARTIAL_READING); - - $currently_skipping = $id; - $ignore = true; - } - } elseif ($currently_skipping && $this->skip[$currently_skipping]) { - if ($this->isChunk == PhDReader::OPEN_CHUNK) { - v("Skipping child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING); - } else { - v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING); - } - - $ignore = true; - } elseif ($currently_reading && $this->partial[$currently_reading]) { - if ($this->isChunk == PhDReader::OPEN_CHUNK) { - v("Rendering child of %s, %s", $currently_reading, $id, VERBOSE_PARTIAL_CHILD_READING); - } else { - v("%s done", $id, VERBOSE_PARTIAL_CHILD_READING); - } - return $ret; - } elseif (empty($this->partial)) { - return false; - } else { - $ignore = true; - } - } elseif (!$ignore && $seeked > 0) { - return $ret; - } - } - return $ret; - } -} - -/* -* vim600: sw=4 ts=4 fdm=syntax syntax=php et -* vim<600: sw=4 ts=4 -*/ - diff --git a/phpdotnet/phd/Theme.php b/phpdotnet/phd/Theme.php deleted file mode 100644 index 35957d5..0000000 --- a/phpdotnet/phd/Theme.php +++ /dev/null @@ -1,19 +0,0 @@ -format = $format; - } -} - -interface iPhDTheme { - public function appendData($data, $isChunk); -} - -/* - * vim600: sw=4 ts=4 fdm=syntax syntax=php et - * vim<600: sw=4 ts=4 - */ - diff --git a/phpdotnet/phd/functions.php b/phpdotnet/phd/functions.php index 43dcdfc..4b0cf43 100644 --- a/phpdotnet/phd/functions.php +++ b/phpdotnet/phd/functions.php @@ -3,24 +3,38 @@ /* {{{ PhD error & message handler */ -// FC For PHP5.3 -if (!defined("E_DEPRECATED")) { - define("E_DEPRECATED", E_RECOVERABLE_ERROR << 1); +$error_map = array( + E_RECOVERABLE_ERROR => 'PHP Error', + E_WARNING => 'PHP Warning', + E_NOTICE => 'PHP Notice', + E_STRICT => 'PHP Strict Standards Warning', + E_DEPRECATED => 'PHP Deprecated Construct Warning', + E_USER_ERROR => 'User Error', + E_USER_WARNING => 'User Warning', + E_USER_NOTICE => 'User Notice', +); + +function define_error($name, $explanation) { + static $lastErrorValue = E_DEPRECATED; + + define($name, $lastErrorValue <<= 1); + $GLOBALS['error_map'][$lastErrorValue] = $explanation; } // PhD verbose flags -define('VERBOSE_INDEXING', E_DEPRECATED << 1); -define('VERBOSE_FORMAT_RENDERING', VERBOSE_INDEXING << 1); -define('VERBOSE_THEME_RENDERING', VERBOSE_FORMAT_RENDERING << 1); -define('VERBOSE_RENDER_STYLE', VERBOSE_THEME_RENDERING << 1); -define('VERBOSE_PARTIAL_READING', VERBOSE_RENDER_STYLE << 1); -define('VERBOSE_PARTIAL_CHILD_READING', VERBOSE_PARTIAL_READING << 1); -define('VERBOSE_TOC_WRITING', VERBOSE_PARTIAL_CHILD_READING << 1); -define('VERBOSE_CHUNK_WRITING', VERBOSE_TOC_WRITING << 1); -define('VERBOSE_NOVERSION', VERBOSE_CHUNK_WRITING << 1); +define_error('VERBOSE_INDEXING', 'PhD Indexer'); +define_error('VERBOSE_FORMAT_RENDERING', 'PhD Output Format'); +define_error('VERBOSE_THEME_RENDERING', 'PhD Output Theme'); +define_error('VERBOSE_RENDER_STYLE', 'PhD Rendering Style'); +define_error('VERBOSE_PARTIAL_READING', 'PhD Partial Reader'); +define_error('VERBOSE_PARTIAL_CHILD_READING', 'PhD Partial Child Reader'); +define_error('VERBOSE_TOC_WRITING', 'PhD TOC Writer'); +define_error('VERBOSE_CHUNK_WRITING', 'PhD Chunk Writer'); +define_error('VERBOSE_NOVERSION', 'Missing Version Information'); +define_error('VERBOSE_DONE', 'PhD Processing Completion'); -define('VERBOSE_ALL', (VERBOSE_NOVERSION << 1)-1); -define('VERBOSE_DEFAULT', (VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING|VERBOSE_NOVERSION))); +define('VERBOSE_ALL', (VERBOSE_NOVERSION << 1)-1); +define('VERBOSE_DEFAULT', (VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING|VERBOSE_NOVERSION|VERBOSE_DONE))); $olderrrep = error_reporting(); error_reporting($olderrrep | VERBOSE_DEFAULT); @@ -47,27 +61,6 @@ function term_color($text, $color) /* {{{ The PhD errorhandler */ function errh($errno, $msg, $file, $line, $ctx = null) { - static $err = array( - E_DEPRECATED => 'E_DEPRECATED', - E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', - E_STRICT => 'E_STRICT', - E_WARNING => 'E_WARNING', - E_NOTICE => 'E_NOTICE', - - E_USER_ERROR => 'E_USER_ERROR', - E_USER_WARNING => 'E_USER_WARNING', - E_USER_NOTICE => 'E_USER_NOTICE', - - VERBOSE_INDEXING => 'VERBOSE_INDEXING', - VERBOSE_FORMAT_RENDERING => 'VERBOSE_FORMAT_RENDERING', - VERBOSE_THEME_RENDERING => 'VERBOSE_THEME_RENDERING', - VERBOSE_RENDER_STYLE => 'VERBOSE_RENDER_STYLE', - VERBOSE_PARTIAL_READING => 'VERBOSE_PARTIAL_READING', - VERBOSE_PARTIAL_CHILD_READING => 'VERBOSE_PARTIAL_CHILD_READING', - VERBOSE_TOC_WRITING => 'VERBOSE_TOC_WRITING', - VERBOSE_CHUNK_WRITING => 'VERBOSE_CHUNK_WRITING', - VERBOSE_NOVERSION => 'VERBOSE_NOVERSION', - ); static $recursive = false; // Respect the error_reporting setting @@ -93,6 +86,7 @@ function errh($errno, $msg, $file, $line, $ctx = null) { case VERBOSE_TOC_WRITING: case VERBOSE_CHUNK_WRITING: case VERBOSE_NOVERSION: + case VERBOSE_DONE: $color = PhDConfig::phd_info_color(); $output = PhDConfig::phd_info_output(); $data = $msg; @@ -123,7 +117,7 @@ function errh($errno, $msg, $file, $line, $ctx = null) { return false; } - $timestamp = term_color(sprintf("[%s - %s]", $time, $err[$errno]), $color); + $timestamp = term_color(sprintf("[%s - %s]", $time, $GLOBALS['error_map'][$errno]), $color); fprintf($output, "%s %s\n", $timestamp, $data); // Abort on fatal errors diff --git a/render.php b/render.php index 2e4be66..e8bcc7b 100644 --- a/render.php +++ b/render.php @@ -20,6 +20,11 @@ require $ROOT . "/formats/php.php"; //$INDEX = $FILENAME = "/home/bjori/php/cleandocs/json.xml"; define("NO_SQLITE", false); +/* If no docbook file was passed, die */ +if (!is_dir(PhDConfig::xml_root()) || !is_file(PhDConfig::xml_file())) { + trigger_error("No '.manual.xml' file was given. Specify it on the command line with --docbook.", E_USER_ERROR); +} + PhDConfig::init(array( "verbose" => VERBOSE_ALL^(VERBOSE_PARTIAL_CHILD_READING|VERBOSE_CHUNK_WRITING), "lang_dir" => $ROOT . DIRECTORY_SEPARATOR . "include" . DIRECTORY_SEPARATOR . "langs" . DIRECTORY_SEPARATOR,