[liblouis-liblouisxml] Re: Problem with context opcode

  • From: Michał Bałamut <mb@xxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Sat, 2 Jun 2012 20:18:27 +0200

Hi,
I think I have fixed the problems with the accent and tilde characters. The 
patch is attached.

I found one more bug with the context opcode. When the replacement mark [] 
stands before the first matched character, liblouis enters a loop which is 
aborted only by overflowing the output buffer.
The reason is in lou_translateString.c line 1751:
            src = endReplace;
If both variables are equal, src never gets incremented.
Some rules suffering from this bug are:

context []$u$mpsS @6
context `[]$u$mpsS @6

The answer you gave me in the previous message:

context _$mpsS[]$u$mpsS @6

also doesn't work because of the same bug, as the underscore character makes 
src be again equal to endReplace.
So far I don't have enough knowledge about liblouis code to fix this myself 
without breaking anything else.

regards,
MB

John J. Boyer wrote:

> Try putting an underscore _ in front of the first operand. for example:

> context _$mpsS[]$u$mpsS @6

> This causes liblouis to look back one position from where it is. That 
> would be on the lowercase letter. By backing up one position it finds 
> the punctuation, space, etc.

> liblouis how has a more readable scripting language, which you might 
> try. the above example would be:

> context script if back attr(mpsS)  mark attr(mpsS) then @6

> This language will be extended to deal more effectively with emphasis 
> and capitalization following a word.

> John

>  
> On Fri, Jun 01, 2012 at 11:50:43PM +0200, Micha� Ba�amut wrote:
>> Hi,
>> In my table I need to make a rule where every word consisting of one 
>> lowercase letter is preceeded by dot 6.
>> I tried this:

>> context $mpsS[]$u$mpsS @6
>> context `[]$u$mpsS @6
>> context $mpsS[]$u~ @6
>> context `[]$u~ @6

>> When compiling the table, lines containing the ` character trigger the 
>> folowing error:
>> "Test/if part must contain characters, dots, attributes or class swap."

>> Also, the ~ character doesn't seem to work. For example, the rule:

>> context $mpsS[]$u~ @6

>> doesn't match single letters at the end of translated string.
>> Am I doing something wrong or is this a bug?

>> Thanks,
>> MB

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

Other related posts: