Revision: 824988a81968 Author: John Boyer <john.boyer@xxxxxxxxxxxxxxxxx> Date: Mon May 21 09:03:53 2012 Log: Restoring the ability to generate new semantic-action files http://code.google.com/p/liblouisutdml/source/detail?r=824988a81968 Modified: /liblouisutdml/examine_document.c /liblouisutdml/liblouisutdml.c /liblouisutdml/louisutdml.h /liblouisutdml/semantics.c /liblouisutdml/transcriber.c ======================================= --- /liblouisutdml/examine_document.c Sat Mar 3 10:40:43 2012 +++ /liblouisutdml/examine_document.c Mon May 21 09:03:53 2012 @@ -40,7 +40,7 @@ int examine_document (xmlNode * node) { -/*Examine the DOM tree, add semantic attributes and set indicators.*/ +/*Examine the parse tree, add semantic attributes and set indicators.*/ xmlNode *child; if (node == NULL) return 0; ======================================= --- /liblouisutdml/liblouisutdml.c Fri May 11 05:18:32 2012 +++ /liblouisutdml/liblouisutdml.c Mon May 21 09:03:53 2012 @@ -147,15 +147,18 @@ convert_utd (); else { - if (!(haveSemanticFile = compile_semantic_table (rootElement))) - { - lou_logPrint ("Could not set xml semantics"); + haveSemanticFile = compile_semantic_table (rootElement); + do_xpath_expr (); + 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.*/ + if (!haveSemanticFile) + { cleanupLibxml (); return 0; } - do_xpath_expr (); - examine_document (rootElement); - append_new_entries (); if (!transcribe_document (rootElement)) { lou_logPrint ("Document could not be transcribed"); ======================================= --- /liblouisutdml/louisutdml.h Tue May 15 18:51:25 2012 +++ /liblouisutdml/louisutdml.h Mon May 21 09:03:53 2012 @@ -295,8 +295,8 @@ int style_first_line_indent; char xml_header[2 * MAXNAMELEN]; widechar text_buffer[2 * BUFSIZE]; - widechar translated_buffer[2 * BUFSIZE]; int positionsArray[2 * BUFSIZE]; + widechar translated_buffer[2 * BUFSIZE]; unsigned char typeform[2 * BUFSIZE]; char string_buffer[2 * BUFSIZE]; } UserData; ======================================= --- /liblouisutdml/semantics.c Thu May 17 09:47:13 2012 +++ /liblouisutdml/semantics.c Mon May 21 09:03:53 2012 @@ -128,7 +128,7 @@ } static HashTable * -hashNew (void) +hashNew () { HashTable *table; table = malloc (sizeof (HashTable)); @@ -164,7 +164,7 @@ style, unsigned char *macro); void -clean_semantic_table (void) +clean_semantic_table () { int i; HashEntry *e, *next; @@ -322,7 +322,7 @@ } void -destroy_semantic_table (void) +destroy_semantic_table () { hashFree (semanticTable); semanticTable = NULL; @@ -601,7 +601,7 @@ } static void -destroyattrValueCountsTable (void) +destroyattrValueCountsTable () { if (attrValueCounts == NULL) return; @@ -967,7 +967,7 @@ if (ud->semantic_files[k] == ',') break; strncpy (fileName, &ud->semantic_files[currentListPos], - k - currentListPos); + k - currentListPos); fileName[k - currentListPos] = 0; if (fileName[0] == '*') getRootName (rootElement, fileName); @@ -1301,7 +1301,7 @@ } void -append_new_entries (void) +append_new_entries () { int items; char filePrefix[20]; ======================================= --- /liblouisutdml/transcriber.c Tue May 15 18:51:25 2012 +++ /liblouisutdml/transcriber.c Mon May 21 09:03:53 2012 @@ -5107,7 +5107,8 @@ leftMargin=%d \ rightMargin=%d \ topMargin=%d \-bottomMargin=%d", ud->braille_page_number, firstTableName, ud->dpi, ud->paper_width, ud->paper_height, ud->left_margin, ud->right_margin, ud->top_margin, ud->bottom_margin);
+bottomMargin=%d", ud->braille_page_number, firstTableName, (int)ud->dpi,+ud->paper_width, ud->paper_height, ud->left_margin, ud->right_margin, ud->top_margin, ud->bottom_margin); xmlNewProp (newNode, (xmlChar *) "content", (xmlChar *) utilStringBuf);
xmlAddChild (ud->head_node, newNode); } For a description of the software, to download it and links to project pages go to http://www.abilitiessoft.com