mirror of
https://github.com/php/phd.git
synced 2026-03-24 07:02:07 +01:00
* removed no longer necessary files
* added name of format processed * added color and version stuff from RESTRUCTURE branch
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
class PhDBigXHTMLFormat extends PhDXHTMLFormat {
|
||||
private $simpleName = "Big-XHTML";
|
||||
private $myelementmap = array(
|
||||
'link' => '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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
class PhDPHPFormat extends PhDXHTMLFormat {
|
||||
private $simpleName = "PHP";
|
||||
private $myelementmap = array(
|
||||
'acronym' => '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) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
class PhDXHTMLFormat extends PhDFormat {
|
||||
private $simpleName = "XHTML";
|
||||
private $myelementmap = array( /* {{{ */
|
||||
'abstract' => '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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
define('VERBOSE_INDEXING', 0x01);
|
||||
define('VERBOSE_FORMAT_RENDERING', 0x02);
|
||||
define('VERBOSE_THEME_RENDERING', 0x04);
|
||||
define('VERBOSE_RENDER_STYLE', 0x08);
|
||||
define('VERBOSE_PARTIAL_READING', 0x10);
|
||||
define('VERBOSE_PARTIAL_CHILD_READING', 0x20);
|
||||
define('VERBOSE_TOC_WRITING', 0x40);
|
||||
define('VERBOSE_CHUNK_WRITING', 0x80);
|
||||
|
||||
define('VERBOSE_ALL', 0xFF);
|
||||
|
||||
|
||||
class PhDConfig {
|
||||
private static $opts = array(
|
||||
"output_format" => 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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
class PhDPartialReader extends PhDReader {
|
||||
protected $partial = array();
|
||||
protected $skip = array();
|
||||
|
||||
public function __construct($encoding = "UTF-8", $xml_opts = NULL) {
|
||||
parent::__construct($encoding, $xml_opts);
|
||||
|
||||
$render_ids = PhDConfig::render_ids();
|
||||
if ($render_ids !== NULL) {
|
||||
if (is_array($render_ids)) {
|
||||
$this->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
|
||||
*/
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
abstract class PhDTheme extends PhDHelper implements iPhDTheme {
|
||||
protected $format;
|
||||
public function registerFormat($format) {
|
||||
$this->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
|
||||
*/
|
||||
|
||||
74
mktoc.php
74
mktoc.php
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
$r = new PhDReader();
|
||||
$REFS = $FILENAMES = array();
|
||||
$CURRENT_FILENAME = $LAST_CHUNK = "";
|
||||
|
||||
#FIXME: This is a workaround for the <legalnotice> 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
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
class PhDXHTMLFormat extends PhDFormat {
|
||||
private $simpleName = "XHTML";
|
||||
private $myelementmap = array( /* {{{ */
|
||||
'abstract' => '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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
class PhDPartialReader extends PhDReader {
|
||||
protected $partial = array();
|
||||
protected $skip = array();
|
||||
|
||||
public function __construct($encoding = "UTF-8", $xml_opts = NULL) {
|
||||
parent::__construct($encoding, $xml_opts);
|
||||
|
||||
$render_ids = PhDConfig::render_ids();
|
||||
if ($render_ids !== NULL) {
|
||||
if (is_array($render_ids)) {
|
||||
$this->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
|
||||
*/
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
abstract class PhDTheme extends PhDHelper implements iPhDTheme {
|
||||
protected $format;
|
||||
public function registerFormat($format) {
|
||||
$this->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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user