[liblouis-liblouisxml] Re: Help with understanding some liblouisutdml code

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 26 Mar 2014 19:01:18 +0000

The line number for where I get stuck is line 5241 and the next few lines.

Michael Whapples
On 26/03/2014 18:53, John J. Boyer wrote:
What is the line number of the first statement in the current transcriber.c in 
the repository? I thought you were talking about left aligning columns. As a 
matter of fact, I don't think that right
aligning has ever been tested. It was included for completeness. To test it you would 
have to write a style with "format alignColumnsRight"

John

On Wed, Mar 26, 2014 at 04:46:17PM +0000, Michael Whapples wrote:
I haven't fully worked out that code.

I did understand that the intent of that code is to pad the cell with
spaces on the left and right align the columns.

What really concerns me is the assignment into the row buffer, I cannot
work out how the index of:
rowBuffer[k + prevCol]
actually works.

As I said it seems like this in the case of the left most position of
the cell, the index is twice prevCol, and I just cannot work out why
that should be so.

I am not sure how much testing this bit of code really is getting. Its
only one option for column alignment and is only for UTD output.

I need to understand how that code works if I can apply a fix for
varying number of cells in a row for when alignment is not left.

Michael Whapples
On 26/03/2014 16:35, John J. Boyer wrote:
Michael,

I think you have probably figured out the code by now. It pads the cell on
the right. The code may look a little odd, but it does work, since the
resulting Braille tables look correct.

John

On Wed, Mar 26, 2014 at 11:09:41AM +0000, Michael Whapples wrote:
Hello,
In fixing the issue where tables may not have all cells in a row
specified, I found some code I cannot work out the actual meaning, may
be someone could help me.

The code in question is in transcriber.c in function utd_doAlignColumns.
The code is:
for (k = bufPos - 1; k >= prevBufPos; k--)
   rowBuf[k + prevCol] = translatedBuffer[k];
for (; k >= prevCol; k--)
   rowBuf[k + prevCol] = ' ';

I understand the main purpose is to copy the translated text of a column
into the row buffer and pad the cell at the beginning with spaces, but I
do not understand why the index of rowBuf should be k + prevCol. Why
should the beginning of a cell always be at twice prevCol? Does this
code even work?

Michael Whapples
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com
For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: