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

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Wed, 26 Mar 2014 11:35:52 -0500

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

-- 
John J. Boyer; President, Chief Software Developer
Abilitiessoft, Inc.
http://www.abilitiessoft.com
Madison, Wisconsin USA
Developing software for people with disabilities

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

Other related posts: