List:Commits« Previous MessageNext Message »
From:jon Date:September 7 2008 8:56pm
Subject:svn commit - mysqldoc@docsrva: r11711 - in trunk/dynamic-docs/command-optvars/ndb: config-params errors
View as plain text  
Author: jstephens
Date: 2008-09-07 22:56:33 +0200 (Sun, 07 Sep 2008)
New Revision: 11711

Log:

Working on some DTDs and things for error code and configuration
parameter files...



Added:
   trunk/dynamic-docs/command-optvars/ndb/errors/errors.dtd
   trunk/dynamic-docs/command-optvars/ndb/errors/errortypes.dtd
   trunk/dynamic-docs/command-optvars/ndb/errors/write_errors.php
Modified:
   trunk/dynamic-docs/command-optvars/ndb/config-params/ndb-config-params.dtd
   trunk/dynamic-docs/command-optvars/ndb/errors/error-regexes.txt


Modified: trunk/dynamic-docs/command-optvars/ndb/config-params/ndb-config-params.dtd
===================================================================
--- trunk/dynamic-docs/command-optvars/ndb/config-params/ndb-config-params.dtd	2008-09-07 17:19:08 UTC (rev 11710)
+++ trunk/dynamic-docs/command-optvars/ndb/config-params/ndb-config-params.dtd	2008-09-07 20:56:33 UTC (rev 11711)
Changed blocks: 1, Lines Added: 1, Lines Deleted: 1; 788 bytes

@@ -36,7 +36,7 @@
 
 <!ATTLIST value-set inversion CDATA #IMPLIED>
 <!ATTLIST value-set outversion CDATA #IMPLIED>
-<!ATTLIST value-set type (bool | num | string | filename | enum | datetime | bitmap) #REQUIRED>
+<!ATTLIST value-set type (bool | numeric | string | filename | enum | datetime | bitmap) #REQUIRED>
 <!ATTLIST value-set platform (all | linux | windows | macosx | hpux | solaris | netware) #REQUIRED>
 
 


Modified: trunk/dynamic-docs/command-optvars/ndb/errors/error-regexes.txt
===================================================================
--- trunk/dynamic-docs/command-optvars/ndb/errors/error-regexes.txt	2008-09-07 17:19:08 UTC (rev 11710)
+++ trunk/dynamic-docs/command-optvars/ndb/errors/error-regexes.txt	2008-09-07 20:56:33 UTC (rev 11711)
Changed blocks: 1, Lines Added: 1, Lines Deleted: 1; 689 bytes

@@ -5,7 +5,7 @@
 
 s/\{\s*(.*)\, (.*)\, (.*)\, "(.*)"\s*\}\,?/<row><entry><errorcode>$1</errorcode></entry><entry><errorname>$2</errorname></entry><entry><errortype>$3</errortype></entry><entry><errortext>$4</errortext></entry></row>/
 
-on the ErrorCodes array in ndberror.c
+on the ErrorCodes array in storage/ndb/src/ndbapi/ndberror.c
 
 MATCHES:
 


Added: trunk/dynamic-docs/command-optvars/ndb/errors/errors.dtd
===================================================================
--- trunk/dynamic-docs/command-optvars/ndb/errors/errors.dtd	                        (rev 0)
+++ trunk/dynamic-docs/command-optvars/ndb/errors/errors.dtd	2008-09-07 20:56:33 UTC (rev 11711)
Changed blocks: 1, Lines Added: 16, Lines Deleted: 0; 752 bytes

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!ELEMENT errors (error*)>
+
+<!ELEMENT error (code , type , mysqlerror, messages)>
+
+<!ELEMENT code EMPTY>
+
+<!ATTLIST code value CDATA #REQUIRED>
+
+<!ELEMENT type EMPTY>
+<!ATTLIST type value (NE|AE|CE|ND|CV|SE|UD|IS|TR|NR|OL|TO|NS|IT|UR|UE|IE|NI) #REQUIRED>
+<!ELEMENT mysqlerror (CDATA)>
+<!ELEMENT messages (message*)>
+<!ELEMENT message (CDATA)>
+<!ATTLIST message lang CDATA "en">
+


Added: trunk/dynamic-docs/command-optvars/ndb/errors/errortypes.dtd
===================================================================
--- trunk/dynamic-docs/command-optvars/ndb/errors/errortypes.dtd	                        (rev 0)
+++ trunk/dynamic-docs/command-optvars/ndb/errors/errortypes.dtd	2008-09-07 20:56:33 UTC (rev 11711)
Changed blocks: 1, Lines Added: 12, Lines Deleted: 0; 756 bytes

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!ELEMENT errortypes (errortype*)>
+
+<!ELEMENT errortype (descriptions)>
+<!ATTLIST errortype type (NE|AE|CE|ND|CV|SE|UD|IS|TR|NR|OL|TO|NS|IT|UR|UE|IE|NI) #REQUIRED>
+<!ATTLIST errortype status (SUCCESS|PERMANENT_ERROR|TEMPORARY_ERROR|UNKNOWN_RESULT) #REQUIRED>
+
+<!ELEMENT descriptions (description+)>
+
+<!ELEMENT description (CDATA)>
+<!ATTLIST description lang CDATA "en">


Added: trunk/dynamic-docs/command-optvars/ndb/errors/write_errors.php
===================================================================
--- trunk/dynamic-docs/command-optvars/ndb/errors/write_errors.php	                        (rev 0)
+++ trunk/dynamic-docs/command-optvars/ndb/errors/write_errors.php	2008-09-07 20:56:33 UTC (rev 11711)
Changed blocks: 1, Lines Added: 145, Lines Deleted: 0; 3029 bytes

@@ -0,0 +1,145 @@
+#!usr/bin/php
+<?php
+
+  $errortypes = array();
+  
+  
+
+/*
+
+  #  Target markup:
+
+  <row>
+    <entry>
+      <errorcode>$1</errorcode>
+    </entry>
+    <entry>
+      <errorname>$2</errorname>
+    </entry>
+    <entry>
+      <errortype>$3</errortype>
+    </entry>
+    <entry>
+      <errortext>$4</errortext>
+    </entry>
+  </row>
+*/
+
+  $dir = argv[$1];
+
+  $lines = file("$dir/storage/ndb/src/ndbapi/ndberror.c");
+  
+  $lines = get_valid_lines($lines);
+
+  $tags = array(, 'code', 'name', 'type', 'text');
+  
+/*
+  $temp = $matches[2];
+  $matches[2] = $matches[1];
+  $matches[1] = $temp;
+*/
+  
+  function get_valid_lines($inputs)
+  {
+    $begin = FALSE;
+    $end = FALSE;
+    
+    $outputs = array();
+    
+    foreach($inputs as $input)
+    {        
+      if
+      (
+        preg_match('^\S*$', $input) == 0
+        ||
+        preg_match('\{|\}', $input) == 0
+      )
+      {
+        continue;
+      }
+    
+      if($end)
+      {
+        break;
+      }
+      else
+      {
+        if(strpos($line, '};') !== FALSE)
+        {
+          $end = TRUE;
+        }       
+      }
+      
+      if($begin)
+      {
+        $whole_line = FALSE;
+        $temp = '';
+        
+        do
+        {
+          $temp .= preg_replace('(\n|\r|\l)', '', $input);
+          $whole_line = preg_match('.*\}\,?$'. $input) != 0;
+        }
+        while(!$whole_line);
+        
+        $outputs []= $temp;
+      }
+      else
+      {
+        $begin = strpos($line, 'ErrorBundle ErrorCodes[] = {') === FALSE) : TRUE ? FALSE;
+      }
+    }
+    
+    return $outputs;
+  }
+  
+  function lineToXMLRow($line)
+  {
+    global $tags;
+    
+    $matches = preg_grep('\{\s*(.*)\, (.*)\, (.*)\, "(.*)"\s*\}\,?', $line);
+      
+    $row = $xmldoc->createElement('row');
+    
+    for($i=1; $i<=4; $i++)
+    {
+      $entry = $xmldoc->createElement('entry');    
+      $child = $xmldoc->createElement('error' . $tags[$i]);      
+      $text = $xmldoc->createTextNode(matches[$i]);
+      
+      $child->appendChild($text);
+      $entry->appendChild($child);      
+      $row->appendChild($entry);
+    }
+      
+    return $row;
+  }
+  
+  $tgroup = $xmldoc->createElement('tgroup');  
+  $tgroup->setAttribute('cols', count($colwidths));
+  
+  foreach($colwidths as $colwidth)
+  {
+    $colspec = $xmldoc->createElement('colspec');
+    $colspec->setAttribute('', "$colwidth*");
+    
+    $tgroup->appendChild($colspec);
+  }
+  
+  $tbody = $xmldoc->createElement('tbody');
+  
+  #  !!!
+  
+  $rows = getErrorsByTypeAsXMLRows($xmldoc, $type, $lines);
+  
+  foreach($rows as $row)
+    $tbody->appendChild($row);
+  
+  $tgroup->appendChild($tbody);
+    
+  $table = $xmldoc->createElement('informaltable');
+  $table->appendChild($tgroup);
+  
+  
+?>
+


Thread
svn commit - mysqldoc@docsrva: r11711 - in trunk/dynamic-docs/command-optvars/ndb: config-params errorsjon7 Sep