[liblouis-liblouisxml] Re: Calculation of cursorPos

  • From: "John J. Boyer" <john.boyer@xxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 29 Jan 2013 17:20:33 -0600

Hi Bert, 

The code just has to check outputPos to make sure it is not NULL . The 
change is near line 260 in lou_translateString.c .

John

On Tue, Jan 29, 2013 at 10:39:15PM +0100, Bert Frees wrote:
> Hi John,
> 
> Couldn't we just require from the user that outputPos must not be NULL if he 
> is interested in the cursorPos? Or allocate it ourselfs? Allocating outputPos 
> myself when it is not provided is what I also do in the function 
> translatePrehyphenated.
> 
> Bert
> 
> On 29 Jan 2013, at 19:38, John J. Boyer wrote:
> 
> > It turns out that implementing the method described in my last message 
> > would be simple. I will make the change, and if it doesn't work out we 
> > can revert the file in the epository.
> > 
> > John
> > 
> > On Tue, Jan 29, 2013 at 11:16:45AM -0600, John J. Boyer wrote:
> >> It's an interesting idea. However, it would require that space should 
> >> always be provided for the outputPos array. A possible solution would be 
> >> to use this technique if outputPos is not NULL, but if it is fall back 
> >> on the existing code.
> >> 
> >> John
> >> 
> >> On Tue, Jan 29, 2013 at 04:16:34PM +0100, Bert Frees wrote:
> >>> Hi Jamie,
> >>> 
> >>> AFAICS your reasoning is correct. But I may be overlooking something too.
> >>> 
> >>> Bert
> >>> 
> >>> 
> >>> On 01/29/2013 04:06 PM, James Teh wrote:
> >>>> outputPos maps input positions to output positions. At the beginning
> >>>> of the call, cursorPos is the cursor position in the input. Therefore,
> >>>> unless I'm missing something, the output cursorPos should just be
> >>>> outputPos[cursorPos]. Is there a reason this isn't the case? This
> >>>> would simplify the code a great deal and thereby eliminate existing bugs.
> >>>> 
> >>>> Jamie
> >>>> 
> >>>> On 30/01/2013 1:03 AM, John J. Boyer wrote:
> >>>>> I don't understand this question. outputPos is an array. cursorPos is a
> >>>>> single value. What would be the ideal value of cursorPos? There may be
> >>>>> differing opinions on this.
> >>>>> 
> >>>>> John
> >>>>> 
> >>>>> On Tue, Jan 29, 2013 at 05:53:28PM +1000, James Teh wrote:
> >>>>>> Hi all, especially John,
> >>>>>> 
> >>>>>> Currently, there are still some bugs in the calculation of the output
> >>>>>> cursor position in lou_translate. I can detail these in a separate
> >>>>>> email
> >>>>>> if necessary. However, I'm wondering whether it is simpler to just set
> >>>>>> cursorPos based on outputPos just before returning the translation,
> >>>>>> rather than having separate code for it. Is there any reason cursorPos
> >>>>>> is currently determined separately from outputPos? To put it another
> >>>>>> way, is there any reason that cursorPos should ever be different to
> >>>>>> outputPos[inputCursorPos], where inputCursorPos is the value of
> >>>>>> cursorPos when the function was called?
> >>>>>> 
> >>>>>> Thanks,
> >>>>>> Jamie
> >>>>>> 
> >>>>>> -- 
> >>>>>> James Teh
> >>>>>> Director, NV Access Limited
> >>>>>> Email: jamie@xxxxxxxxxxxx
> >>>>>> Web site: http://www.nvaccess.org/
> >>>>>> Phone: +61 7 5667 8372
> >>>>>> 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
> >> 
> >> -- 
> >> 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
> > 
> > -- 
> > 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
> 
> 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: