[liblouis-liblouisxml] [liblouisutdml] push by john.bo...@xxxxxxxxxxxxxxxxx - continuing work on Darmstadt-formated Bible conversion on 2012-08-15 09:43 GMT

  • From: liblouisutdml@xxxxxxxxxxxxxx
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 15 Aug 2012 09:43:36 +0000

Revision: b64f4e1301c8
Author:   John Boyer <john.boyer@xxxxxxxxxxxxxxxxx>
Date:     Wed Aug 15 02:42:16 2012
Log:      continuing work on Darmstadt-formated Bible conversion
http://code.google.com/p/liblouisutdml/source/detail?r=b64f4e1301c8

Added:
 /liblouisutdml/utd2dsbible.c
Deleted:
 /liblouisutdml/utd2bible.c
Modified:
 /liblouisutdml/Makefile.am
 /liblouisutdml/convert_utd.c
 /liblouisutdml/liblouisutdml.c
 /liblouisutdml/louisutdml.h
 /liblouisutdml/readconfig.c
 /liblouisutdml/transcribe_paragraph.c
 /liblouisutdml/transcriber.c

=======================================
--- /dev/null
+++ /liblouisutdml/utd2dsbible.c        Wed Aug 15 02:42:16 2012
@@ -0,0 +1,391 @@
+/* liblouisutdml Braille Transcription Library
+
+   This file may contain code borrowed from the Linux screenreader
+   BRLTTY, copyright (C) 1999-2006 by
+   the BRLTTY Team
+
+   Copyright (C) 2004, 2005, 2006
+   ViewPlus Technologies, Inc. www.viewplus.com
+   and
+   JJB Software, Inc. www.jjb-software.com
+   All rights reserved
+
+   This file is free software; you can redistribute it and/or modify it
+   under the terms of the Lesser or Library GNU General Public License
+   as published by the
+   Free Software Foundation; either version 3, or (at your option) any
+   later version.
+
+   This file is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   Library GNU General Public License for more details.
+
+   You should have received a copy of the Library GNU General Public
+   License along with this program; see the file COPYING.  If not, write to
+   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
+
+   Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxx
+   */
+
+#include <stdio.h>
+#include <string.h>
+#include "louisutdml.h"
+
+static int findBrlNodes (xmlNode * node);
+static int dsBibleDoBrlNode (xmlNode * node, int action);
+static int beginDocument ();
+static int finishBrlNode ();
+static int finishDocument ();
+static int doUtdbrlonly (xmlNode * node, int action);
+static int doUtdnewpage (xmlNode * node);
+static int doUtdnewline (xmlNode * node);
+static int doUtdgraphic (xmlNode * node);
+static int firstPage;
+static int firstLineOnPage;
+static int startOfLastLine;
+static widechar firstVerse[MAXNUMLEN];
+static int firstVerseLength;
+static widechar lastVerse[MAXNUMLEN];
+static int lastVerseLength;
+
+static int
+doVerseNumber (widechar * line, int length)
+{
+  widechar number[MAXNUMLEN];
+  int numberLength = 0;
+  int k;
+  int kk;
+  for (k = 0; k < length; k++)
+    if (line[k] >= 16 && line[k] <= 25)
+      break;
+  if (k == length)
+    return length;
+  number[numberLength++] = line[k] + 32;
+  if (line[k + 1] >= 16 && line[k + 1] <= 25)
+    number[numberLength++] = line[k + 1] + 32;
+  if (line[k + 2] >= 16 && line[k + 2] <= 25)
+    number[numberLength++] = line[k + 2] + 32;
+  line[k] = 39;
+  if (numberLength > 1)
+    {
+      k++;
+      for (kk = 0; kk < length; kk++)
+       line[k + kk] = line[k + kk + numberLength - 1];
+      length -= numberLength - 1;
+    }
+  if (numberLength == 1)
+  kk = 1;
+  else kk = 0;
+  for (k = 0; k < numberLength; k++)
+  if (number[k] == 48)
+    line[kk++] = number[k] + 58;
+    else
+    line[kk++] = number[k] + 48;
+  if (firstVerseLength == 0)
+    {
+      firstVerseLength = numberLength;
+      memcpy (firstVerse, number, numberLength * CHARSIZE);
+    }
+  else
+    {
+      lastVerseLength = numberLength;
+      memcpy (lastVerse, number, numberLength * CHARSIZE);
+    }
+  return length;
+}
+
+static void
+makeFooter ()
+{
+  int translationLength;
+  int translatedLength;
+  int k;
+  int kk;
+  firstVerse[firstVerseLength++] = ud->lit_hyphen[0];
+  for (k = 0; k < lastVerseLength; k++)
+    firstVerse[firstVerseLength++] = lastVerse[k];
+  translationLength = firstVerseLength;
+  translatedLength = MAXNUMLEN;
+  lou_translate (ud->main_braille_table, firstVerse, &translationLength,
+                lastVerse, &translatedLength, NULL, NULL,
+                NULL, NULL, NULL, 0);
+  firstVerseLength = 0;
+  kk = startOfLastLine + ((ud->cells_per_line - translatedLength) / 2);
+  for (k = 0; k < translatedLength; k++)
+  ud->outbuf1[kk++] = lastVerse[k];
+}
+
+int
+utd2dsBible (xmlNode * node)
+{
+  ud->top = -1;
+  ud->style_top = -1;
+  firstPage = 1;
+  firstLineOnPage = 1;
+  beginDocument ();
+  findBrlNodes (node);
+  pass2_conv ();
+  finishDocument ();
+  return 1;
+}
+
+static int
+beginDocument ()
+{
+  return 1;
+}
+
+static int
+finishDocument ()
+{
+    return 1;
+  write_buffer (1, 0);
+  ud->outbuf1_len_so_far = 0;
+  return 1;
+}
+
+static int
+doUtdgraphic (xmlNode *node)
+{
+  return 1;
+}
+
+static int
+findBrlNodes (xmlNode * node)
+{
+  xmlNode *child;
+  if (node == NULL)
+    return 0;
+  push_sem_stack (node);
+  switch (ud->stack[ud->top])
+    {
+    case utdmeta:
+      return 1;
+    case utdbrl:
+      dsBibleDoBrlNode (node, 0);
+      pop_sem_stack ();
+      return 1;
+    default:
+      break;
+    }
+  child = node->children;
+  while (child)
+    {
+      switch (child->type)
+       {
+       case XML_ELEMENT_NODE:
+         findBrlNodes (child);
+         break;
+       case XML_TEXT_NODE:
+         break;
+       default:
+         break;
+       }
+      child = child->next;
+    }
+  pop_sem_stack ();
+  return 1;
+}
+
+static char *blanks =
+  "                                                            ";
+static int
+insertCharacters (const char *text, int length)
+{
+  int k;
+  if ((ud->outbuf1_len_so_far + length) >= ud->outbuf1_len)
+    return 0;
+  for (k = 0; k < length; k++)
+    ud->outbuf1[ud->outbuf1_len_so_far++] = text[k];
+  return 1;
+}
+
+static int
+doDotsText (xmlNode * node)
+{
+  ud->text_length = 0;
+  insert_utf8 (node->content);
+  if (!lou_dotsToChar (ud->main_braille_table, ud->text_buffer,
+                      &ud->outbuf1[ud->outbuf1_len_so_far],
+                      ud->text_length, 0))
+    return 0;
+  ud->outbuf1_len_so_far += ud->text_length;
+  return 1;
+}
+
+static int
+doUtdbrlonly (xmlNode * node, int action)
+{
+  xmlNode *child;
+  if (node == NULL)
+    return 0;
+  if (ud->top == 0)
+    action = 1;
+  if (action != 0)
+    push_sem_stack (node);
+  switch (ud->stack[ud->top])
+    {
+    case utdnewpage:
+      doUtdnewpage (node);
+      if (action != 0)
+       pop_sem_stack ();
+      return 1;
+    case utdnewline:
+      doUtdnewline (node);
+      if (action != 0)
+       pop_sem_stack ();
+      return 1;
+    case utdgraphic:
+      transcribe_graphic (node, 0);
+      if (action != 0)
+       pop_sem_stack ();
+      return 1;
+    case changetable:
+      change_table (node);
+      return 1;
+    default:
+      break;
+    }
+  child = node->children;
+  while (child)
+    {
+      switch (child->type)
+       {
+       case XML_ELEMENT_NODE:
+         doUtdbrlonly (child, 1);
+         break;
+       case XML_TEXT_NODE:
+         doDotsText (child);
+         break;
+       default:
+         break;
+       }
+      child = child->next;
+    }
+  if (action != 0)
+    pop_sem_stack ();
+  return 1;
+}
+
+static int lastLinepos;
+
+static int
+doUtdnewpage (xmlNode * node)
+{
+  static int prevBrlPageNum = 1;
+  lastLinepos = ud->page_top;
+  firstLineOnPage = 1;
+  if (firstPage)
+    {
+      firstPage = 0;
+      return 1;
+    }
+  if ((prevBrlPageNum & 1))
+    makeFooter ();
+  insertCharacters (ud->lineEnd, strlen (ud->lineEnd));
+  insertCharacters (ud->pageEnd, strlen (ud->pageEnd));
+  write_buffer (1, 0);
+  prevBrlPageNum = atoi (xmlGetProp (node, (xmlChar *) "brlnumber"));
+  return 1;
+}
+
+static int
+doUtdnewline (xmlNode * node)
+{
+  char *xy;
+  int k;
+  int leadingBlanks;
+  int linepos;
+  if (!firstLineOnPage)
+  {
+    ud->outbuf1_len_so_far = startOfLastLine +
+    doVerseNumber
+    (&ud->outbuf1[startOfLastLine], ud->outbuf1_len_so_far
+   -
+    startOfLastLine);
+    insertCharacters (ud->lineEnd, strlen (ud->lineEnd));
+    }
+  xy = (char *) xmlGetProp (node, (xmlChar *) "xy");
+  for (k = 0; xy[k] != ','; k++);
+  leadingBlanks = (atoi (xy) - ud->left_margin) / ud->cell_width;
+  linepos = (atoi (&xy[k + 1]) - ud->page_top) / ud->normal_line;
+  startOfLastLine = ud->outbuf1_len_so_far;
+  insertCharacters (blanks, leadingBlanks);
+  if (firstLineOnPage)
+    firstLineOnPage = 0;
+  return 1;
+}
+
+int
+dsBibleDoBrlNode (xmlNode * node, int action)
+{
+  xmlNode *child;
+  if (node == NULL)
+    return 0;
+  if (action != 0)
+    push_sem_stack (node);
+  switch (ud->stack[ud->top])
+    {
+    case markhead:
+      if (ud->head_node == NULL)
+       ud->head_node = node;
+      pop_sem_stack ();
+      break;
+    case utdbrlonly:
+      doUtdbrlonly (node, 0);
+      if (action != 0)
+       pop_sem_stack ();
+      return 1;
+    case utdnewpage:
+      doUtdnewpage (node);
+      if (action != 0)
+       pop_sem_stack ();
+      return 1;
+    case utdnewline:
+      doUtdnewline (node);
+      if (action != 0)
+       pop_sem_stack ();
+      return 1;
+    case utdgraphic:
+      transcribe_graphic (node, 0);
+      if (action != 0)
+       pop_sem_stack ();
+      return 1;
+    case changetable:
+      change_table (node);
+      return 1;
+    default:
+      break;
+    }
+  child = node->children;
+  while (child)
+    {
+      switch (child->type)
+       {
+       case XML_ELEMENT_NODE:
+         dsBibleDoBrlNode (child, 1);
+         break;
+       case XML_TEXT_NODE:
+         doDotsText (child);
+         break;
+       default:
+         break;
+       }
+      child = child->next;
+    }
+  if (action != 0)
+    {
+      pop_sem_stack ();
+      return 1;
+    }
+  finishBrlNode ();
+  return 1;
+}
+
+static int
+finishBrlNode ()
+{
+  return 1;
+}
=======================================
--- /liblouisutdml/utd2bible.c  Fri Jun 29 21:54:56 2012
+++ /dev/null
@@ -1,390 +0,0 @@
-/* liblouisutdml Braille Transcription Library
-
-   This file may contain code borrowed from the Linux screenreader
-   BRLTTY, copyright (C) 1999-2006 by
-   the BRLTTY Team
-
-   Copyright (C) 2004, 2005, 2006
-   ViewPlus Technologies, Inc. www.viewplus.com
-   and
-   JJB Software, Inc. www.jjb-software.com
-   All rights reserved
-
-   This file is free software; you can redistribute it and/or modify it
-   under the terms of the Lesser or Library GNU General Public License
-   as published by the
-   Free Software Foundation; either version 3, or (at your option) any
-   later version.
-
-   This file is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   Library GNU General Public License for more details.
-
-   You should have received a copy of the Library GNU General Public
-   License along with this program; see the file COPYING.  If not, write to
-   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-
-   Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxx
-   */
-
-#include <stdio.h>
-#include <string.h>
-#include "louisutdml.h"
-
-static int findBrlNodes (xmlNode * node);
-static int bibleDoBrlNode (xmlNode * node, int action);
-static int beginDocument ();
-static int finishBrlNode ();
-static int finishDocument ();
-static int doUtdbrlonly (xmlNode * node, int action);
-static int doUtdnewpage (xmlNode * node);
-static int doUtdnewline (xmlNode * node);
-static int doUtdgraphic (xmlNode * node);
-static int firstPage;
-static int firstLineOnPage;
-static int startOfLastLine;
-static widechar firstVerse[MAXNUMLEN];
-static int firstVerseLength;
-static widechar lastVerse[MAXNUMLEN];
-static int lastVerseLength;
-
-static int
-doVerseNumber (widechar * line, int length)
-{
-  widechar number[MAXNUMLEN];
-  int numberLength = 0;
-  int k;
-  int kk;
-  for (k = 0; k < length; k++)
-    if (line[k] >= 16 && line[k] <= 25)
-      break;
-  if (k == length)
-    return length;
-  number[numberLength++] = line[k] + 32;
-  if (line[k + 1] >= 16 && line[k + 1] <= 25)
-    number[numberLength++] = line[k + 1] + 32;
-  if (line[k + 2] >= 16 && line[k + 2] <= 25)
-    number[numberLength++] = line[k + 2] + 32;
-  line[k] = 39;
-  if (numberLength > 1)
-    {
-      k++;
-      for (kk = 0; kk < length; kk++)
-       line[k + kk] = line[k + kk + numberLength - 1];
-      length -= numberLength - 1;
-    }
-  if (numberLength == 1)
-  kk = 1;
-  else kk = 0;
-  for (k = 0; k < numberLength; k++)
-  if (number[k] == 48)
-    line[kk++] = number[k] + 58;
-    else
-    line[kk++] = number[k] + 48;
-  if (firstVerseLength == 0)
-    {
-      firstVerseLength = numberLength;
-      memcpy (firstVerse, number, numberLength * CHARSIZE);
-    }
-  else
-    {
-      lastVerseLength = numberLength;
-      memcpy (lastVerse, number, numberLength * CHARSIZE);
-    }
-  return length;
-}
-
-static void
-makeFooter ()
-{
-  int translationLength;
-  int translatedLength;
-  int k;
-  int kk;
-  firstVerse[firstVerseLength++] = ud->lit_hyphen[0];
-  for (k = 0; k < lastVerseLength; k++)
-    firstVerse[firstVerseLength++] = lastVerse[k];
-  translationLength = firstVerseLength;
-  translatedLength = MAXNUMLEN;
-  lou_translate (ud->main_braille_table, firstVerse, &translationLength,
-                lastVerse, &translatedLength, NULL, NULL,
-                NULL, NULL, NULL, 0);
-  firstVerseLength = 0;
-  kk = startOfLastLine + ((ud->cells_per_line - translatedLength) / 2);
-  for (k = 0; k < translatedLength; k++)
-  ud->outbuf1[kk++] = lastVerse[k];
-}
-
-int
-utd2bible (xmlNode * node)
-{
-  ud->top = -1;
-  ud->style_top = -1;
-  firstPage = 1;
-  firstLineOnPage = 1;
-  beginDocument ();
-  findBrlNodes (node);
-  finishDocument ();
-  return 1;
-}
-
-static int
-beginDocument ()
-{
-  return 1;
-}
-
-static int
-finishDocument ()
-{
-    return 1;
-  write_buffer (1, 0);
-  ud->outbuf1_len_so_far = 0;
-  return 1;
-}
-
-static int
-doUtdgraphic (xmlNode *node)
-{
-  return 1;
-}
-
-static int
-findBrlNodes (xmlNode * node)
-{
-  xmlNode *child;
-  if (node == NULL)
-    return 0;
-  push_sem_stack (node);
-  switch (ud->stack[ud->top])
-    {
-    case utdmeta:
-      return 1;
-    case utdbrl:
-      bibleDoBrlNode (node, 0);
-      pop_sem_stack ();
-      return 1;
-    default:
-      break;
-    }
-  child = node->children;
-  while (child)
-    {
-      switch (child->type)
-       {
-       case XML_ELEMENT_NODE:
-         findBrlNodes (child);
-         break;
-       case XML_TEXT_NODE:
-         break;
-       default:
-         break;
-       }
-      child = child->next;
-    }
-  pop_sem_stack ();
-  return 1;
-}
-
-static char *blanks =
-  "                                                            ";
-static int
-insertCharacters (const char *text, int length)
-{
-  int k;
-  if ((ud->outbuf1_len_so_far + length) >= ud->outbuf1_len)
-    return 0;
-  for (k = 0; k < length; k++)
-    ud->outbuf1[ud->outbuf1_len_so_far++] = text[k];
-  return 1;
-}
-
-static int
-doDotsText (xmlNode * node)
-{
-  ud->text_length = 0;
-  insert_utf8 (node->content);
-  if (!lou_dotsToChar (ud->main_braille_table, ud->text_buffer,
-                      &ud->outbuf1[ud->outbuf1_len_so_far],
-                      ud->text_length, 0))
-    return 0;
-  ud->outbuf1_len_so_far += ud->text_length;
-  return 1;
-}
-
-static int
-doUtdbrlonly (xmlNode * node, int action)
-{
-  xmlNode *child;
-  if (node == NULL)
-    return 0;
-  if (ud->top == 0)
-    action = 1;
-  if (action != 0)
-    push_sem_stack (node);
-  switch (ud->stack[ud->top])
-    {
-    case utdnewpage:
-      doUtdnewpage (node);
-      if (action != 0)
-       pop_sem_stack ();
-      return 1;
-    case utdnewline:
-      doUtdnewline (node);
-      if (action != 0)
-       pop_sem_stack ();
-      return 1;
-    case utdgraphic:
-      transcribe_graphic (node, 0);
-      if (action != 0)
-       pop_sem_stack ();
-      return 1;
-    case changetable:
-      change_table (node);
-      return 1;
-    default:
-      break;
-    }
-  child = node->children;
-  while (child)
-    {
-      switch (child->type)
-       {
-       case XML_ELEMENT_NODE:
-         doUtdbrlonly (child, 1);
-         break;
-       case XML_TEXT_NODE:
-         doDotsText (child);
-         break;
-       default:
-         break;
-       }
-      child = child->next;
-    }
-  if (action != 0)
-    pop_sem_stack ();
-  return 1;
-}
-
-static int lastLinepos;
-
-static int
-doUtdnewpage (xmlNode * node)
-{
-  static int prevBrlPageNum = 1;
-  lastLinepos = ud->page_top;
-  firstLineOnPage = 1;
-  if (firstPage)
-    {
-      firstPage = 0;
-      return 1;
-    }
-  if ((prevBrlPageNum & 1))
-    makeFooter ();
-  insertCharacters (ud->lineEnd, strlen (ud->lineEnd));
-  insertCharacters (ud->pageEnd, strlen (ud->pageEnd));
-  write_buffer (1, 0);
-  prevBrlPageNum = atoi (xmlGetProp (node, (xmlChar *) "brlnumber"));
-  return 1;
-}
-
-static int
-doUtdnewline (xmlNode * node)
-{
-  char *xy;
-  int k;
-  int leadingBlanks;
-  int linepos;
-  if (!firstLineOnPage)
-  {
-    ud->outbuf1_len_so_far = startOfLastLine +
-    doVerseNumber
-    (&ud->outbuf1[startOfLastLine], ud->outbuf1_len_so_far
-   -
-    startOfLastLine);
-    insertCharacters (ud->lineEnd, strlen (ud->lineEnd));
-    }
-  xy = (char *) xmlGetProp (node, (xmlChar *) "xy");
-  for (k = 0; xy[k] != ','; k++);
-  leadingBlanks = (atoi (xy) - ud->left_margin) / ud->cell_width;
-  linepos = (atoi (&xy[k + 1]) - ud->page_top) / ud->normal_line;
-  startOfLastLine = ud->outbuf1_len_so_far;
-  insertCharacters (blanks, leadingBlanks);
-  if (firstLineOnPage)
-    firstLineOnPage = 0;
-  return 1;
-}
-
-int
-bibleDoBrlNode (xmlNode * node, int action)
-{
-  xmlNode *child;
-  if (node == NULL)
-    return 0;
-  if (action != 0)
-    push_sem_stack (node);
-  switch (ud->stack[ud->top])
-    {
-    case markhead:
-      if (ud->head_node == NULL)
-       ud->head_node = node;
-      pop_sem_stack ();
-      break;
-    case utdbrlonly:
-      doUtdbrlonly (node, 0);
-      if (action != 0)
-       pop_sem_stack ();
-      return 1;
-    case utdnewpage:
-      doUtdnewpage (node);
-      if (action != 0)
-       pop_sem_stack ();
-      return 1;
-    case utdnewline:
-      doUtdnewline (node);
-      if (action != 0)
-       pop_sem_stack ();
-      return 1;
-    case utdgraphic:
-      transcribe_graphic (node, 0);
-      if (action != 0)
-       pop_sem_stack ();
-      return 1;
-    case changetable:
-      change_table (node);
-      return 1;
-    default:
-      break;
-    }
-  child = node->children;
-  while (child)
-    {
-      switch (child->type)
-       {
-       case XML_ELEMENT_NODE:
-         bibleDoBrlNode (child, 1);
-         break;
-       case XML_TEXT_NODE:
-         doDotsText (child);
-         break;
-       default:
-         break;
-       }
-      child = child->next;
-    }
-  if (action != 0)
-    {
-      pop_sem_stack ();
-      return 1;
-    }
-  finishBrlNode ();
-  return 1;
-}
-
-static int
-finishBrlNode ()
-{
-  return 1;
-}
=======================================
--- /liblouisutdml/Makefile.am  Tue Jun 12 09:06:23 2012
+++ /liblouisutdml/Makefile.am  Wed Aug 15 02:42:16 2012
@@ -43,7 +43,7 @@
        transcribe_paragraph.c \
        convert_utd.c \
        utd2transinxml.c \
-       utd2bible.c \
+       utd2dsbible.c \
        utd2brf.c \
        utd2pef.c \
        utd2volumes.c \
=======================================
--- /liblouisutdml/convert_utd.c        Wed Aug  8 18:00:50 2012
+++ /liblouisutdml/convert_utd.c        Wed Aug 15 02:42:16 2012
@@ -72,8 +72,8 @@
     return 0;
   switch (ud->format_for)
     {
-    case bible:
-      utd2bible (rootElement);
+    case dsbible:
+      utd2dsBible (rootElement);
       break;
     case brf:
       utd2brf (rootElement);
@@ -82,7 +82,7 @@
       utd2transinxml (rootElement);
       break;
     case pef:
-    utd2pef (rootElement);
+      utd2pef (rootElement);
       break;
     case volumes:
     case volumesPef:
@@ -115,29 +115,29 @@
   if (!haveSemanticFile)
     return 0;
   ud->format_for = utd;
-  ud->top = -1;
+  ud->top = 0;
+  ud->stack[0] = no;
   ud->style_top = -1;
   ud->text_length = 0;
   ud->translated_length = 0;
-      child = rootElement->children;
-      while (child)
+  child = rootElement->children;
+  while (child)
+    {
+      switch (child->type)
        {
-         switch (child->type)
-           {
-           case XML_ELEMENT_NODE:
-             transcribe_paragraph (child, 0);
-             break;
-           case XML_TEXT_NODE:
-             insert_text (child);
-             break;
-           case XML_CDATA_SECTION_NODE:
-             transcribe_cdataSection (child);
-             break;
-           default:
-             break;
-           }
-         child = child->next;
+       case XML_ELEMENT_NODE:
+         transcribe_paragraph (child, 0);
+         break;
+       case XML_TEXT_NODE:
+         insert_text (child);
+         break;
+       case XML_CDATA_SECTION_NODE:
+         transcribe_cdataSection (child);
+         break;
+       default:
+         break;
        }
-  end_document ();
+      child = child->next;
+    }
   return 1;
 }
=======================================
--- /liblouisutdml/liblouisutdml.c      Wed Aug  8 18:00:50 2012
+++ /liblouisutdml/liblouisutdml.c      Wed Aug 15 02:42:16 2012
@@ -119,10 +119,10 @@
            ud->doc = xmlParseFile (inputDoc);
          if (ud->doc == NULL)
            {
-      lou_logPrint (
-      "Document could not be processed, probably  malformed");
-      cleanupLibxml ();
-      return 0;
+             lou_logPrint
+               ("Document could not be processed, probably  malformed");
+             cleanupLibxml ();
+             return 0;
            }
        }
     }
@@ -130,13 +130,12 @@
     ud->doc = xmlParseMemory (inputDoc, length);
   if (ud->doc == NULL)
     {
-      lou_logPrint (
-      "Document could not be processed, probably  malformed");
+ lou_logPrint ("Document could not be processed, probably malformed");
       cleanupLibxml ();
       return 0;
     }
-  if (ud->format_for >= utd && ignore_case_comp (ud->doc->encoding,
-  "UTF-8", 5) != 0)
+  if (ud->format_for >= utd && ignore_case_comp (ud->doc->encoding,
+                                                "UTF-8", 5) != 0)
     {
       lou_logPrint ("This format requires UTF-8 encoding, not '%s'",
                    ud->doc->encoding);
@@ -159,13 +158,13 @@
       examine_document (rootElement);
       append_new_entries ();
       /* This will generate a new semantic-action file if none exists
-      * and newEntries is  yes in the configuration file.
-      * Otherwise it generates a new_enhtries file.*/
+       * and newEntries is  yes in the configuration file.
+       * Otherwise it generates a new_enhtries file.*/
       if (!haveSemanticFile)
-      {
-      cleanupLibxml ();
-      return 0;
-      }
+       {
+         cleanupLibxml ();
+         return 0;
+       }
       if (!transcribe_document (rootElement))
        {
          lou_logPrint ("Document could not be transcribed");
@@ -213,9 +212,9 @@
   if (inbuf[k] != '<')
     {
       if (ud->format_for == utd)
-      k = utd_transcribe_text_string ();
+       k = utd_transcribe_text_string ();
       else
-      k = transcribe_text_string ();
+       k = transcribe_text_string ();
       *outlen = ud->outlen_so_far;
       lou_logEnd ();
       return k;
@@ -310,9 +309,9 @@
   else
     ud->outFile = stdout;
   if (ud->format_for == utd)
-  k = utd_transcribe_text_file ();
+    k = utd_transcribe_text_file ();
   else
-  k = transcribe_text_file ();
+    k = transcribe_text_file ();
   if (!k)
     {
       freeEverything ();
@@ -343,9 +342,9 @@
   ud->outlen = *outlen;
   ud->inFile = ud->outFile = NULL;
   if (ud->format_for == utd)
-  k = utd_back_translate_braille_string ();
+    k = utd_back_translate_braille_string ();
   else
-  k = back_translate_braille_string ();
+    k = back_translate_braille_string ();
   if (!k)
     {
       freeEverything ();
@@ -393,9 +392,9 @@
   else
     ud->outFile = stdout;
   if (ud->format_for == utd)
-  k = utd_back_translate_file ();
+    k = utd_back_translate_file ();
   else
-  k = back_translate_file ();
+    k = back_translate_file ();
   if (!k)
     {
       freeEverything ();
=======================================
--- /liblouisutdml/louisutdml.h Wed Aug  8 18:00:50 2012
+++ /liblouisutdml/louisutdml.h Wed Aug 15 02:42:16 2012
@@ -130,7 +130,7 @@
   brf,
   volumesPef,
   volumesBrf,
-  bible
+  dsbible
 } FormatFor;

 typedef enum
@@ -398,4 +398,5 @@
 int utd_transcribe_text_string ();
 int utd_back_translate_braille_string ();
 int utd_back_translate_file ();
+int pass2_conv ();
 #endif /*louisutdml_h */
=======================================
--- /liblouisutdml/readconfig.c Sat Jul 28 21:11:59 2012
+++ /liblouisutdml/readconfig.c Wed Aug 15 02:42:16 2012
@@ -646,7 +646,8 @@
     "35",
     "leftMargin",
     "36",
-// available    "37",
+    "pass2convsem",
+    "37",
     "converterSem",
     "38",
     "braillePageNumber",
@@ -717,7 +718,7 @@
     "brf", "6",
     "volumesPef", "7",
     "volumesBrf", "8",
-    "bible", "9",
+    "dsbible", "9",
     NULL
   };

@@ -930,7 +931,9 @@
        case 36:
          leftMargin = atof (nested->value);
          break;
-// available    case 37:
+    case 37:
+      ud->pass2_conv_sem = alloc_string (nested->value);
+      break;
        case 38:
          ud->converter_sem = alloc_string (nested->value);
          break;
=======================================
--- /liblouisutdml/transcribe_paragraph.c       Mon Jul 30 07:52:19 2012
+++ /liblouisutdml/transcribe_paragraph.c       Wed Aug 15 02:42:16 2012
@@ -363,7 +363,11 @@
            transcribe_paragraph (child, 1);
          break;
        case XML_TEXT_NODE:
+         /*Is there already a <brl> node?*/
+         if (!(ud->format_for == utd && child->next != NULL
+             && strcmp ((char *) child->next->name, "brl") == 0))
          insert_text (child);
+         /*Is there now a <brl>node?*/
          if (ud->format_for == utd && child->next != NULL
              && strcmp ((char *) child->next->name, "brl") == 0)
            child = child->next;     /*skip <brl> node */
=======================================
--- /liblouisutdml/transcriber.c        Wed Aug  8 18:00:50 2012
+++ /liblouisutdml/transcriber.c        Wed Aug 15 02:42:16 2012
@@ -896,7 +896,7 @@
 {
   char attrValue[MAXNAMELEN];
   strcpy (attrValue, get_attr_value (node));
-  if (ud->orig_format_for == bible)
+  if (ud->orig_format_for == dsbible)
   { /* Enbncode verse numbers */
   int k;
   for (k = 0; attrValue[k]; k++)
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts:

  • » [liblouis-liblouisxml] [liblouisutdml] push by john.bo...@xxxxxxxxxxxxxxxxx - continuing work on Darmstadt-formated Bible conversion on 2012-08-15 09:43 GMT - liblouisutdml