Hello,Thanks John, I think I will remove the ability to use spacing in my bindings, and do as you suggest (also as done by the python bindings) and just set spacing to null.
As for the typeforms, this is quite an involved thing. As the situation stands anyone using my bindings must set the size of typeforms, but as setting it too small can crash the JVM this doesn't feel good. As I said I can copy the typeforms the calling app provides and so put the information into an array I can guarantee is big enough (so avoiding the JVM crashing issue). By copying it I would need to return the typeforms in an object (like I do for the lou_translate and lou_backTranslate functions) should users want this information. So my question is: Is typeforms data after calling the translation functions another feature there but rarely used, or is it something people may find critical? Reading through the liblouis docs I have to say I can't imagine having much use for the data in typeforms after calling the translation functions. IE. I think the only data of real great interest after calling the translation functions (lou_translateString and lou_backTranslateString) is the content of outbuf.
Michael Whapples On 12/06/09 16:33, John J. Boyer wrote:
Michael, On the problem of the typeform parameter, It is best to provide more space than you think will be needed for outbuf and typeform and spacing. The same holds for the hyphens parameter in a call to lou_hyphenate. Very few people use the spacing parameter, so you can just set it to NULl. John On Fri, Jun 12, 2009 at 03:59:07PM +0100, Michael Whapples wrote:Hello, I am pleased to say that my java bindings for liblouis feel reasonably complete and stable enough to recommend that some initial further testing by other java developers can happen. I am not going to make a release at this point as there are a few things I would like to attend to first (eg. javadocs, junit tests, jar packaging). The code can be retrieved from my mercurial repository, details at http://bitbucket.org/mwhapples/jlouis. To use you must have java native access (JNA) from http://jna.dev.java.net installed and in your classpath. The sample app class is Test.java (please note TestBrl.java uses the JNA interface directly which isn't recommended). To run the sample app you must compile the code and then at the top of the repository directory (IE. directly in the jlouis directory) give a command like: java Test en-us-g2.ctb,hyph_en_US.dic "international" I would like some feedback on how the API may be altered to suit other java developers. This relates to a few questions I have: * How often will people want information back from typeforms? The problem is that at the moment you pass in an array, it should contain information about italics, bold, etc but should be of the length of the output, which unfortunately you can't really know and my bindings deal with setting the size of outbuf. Should you set typeforms too small this may lead to a crash of the JVM, so I could use java.util.Arrays.copyOf to copy typeforms to a suitable size. The problem with copying the array will mean that the calling app will be unable to retrieve information from the array as it will hold a reference to the array object it passed in rather than the copy. Therefore if users want typeforms information after calling the translation methods I will need to return it as well, hence the question of how important this is. * A similar problem to that I described for typeforms exists for spacing. I also believe that passing in spacing seems to possibly cause a crash of the JVM, so I am tempted to remove the ability to pass in a spacing parameter. I notice the python bindings also don't allow use of spacing, any reason? * In the lou_translate and lou_backTranslate functions you can pass in a cursor position, if you pass in a cursor position outside the range in inbuf liblouis doesn't have a problem it just doesn't set it to anything else as its an invalid cursor position. In java style should I have my bindings throw something like an IndexOutOfRangeException to indicate this? Enjoy these bindings and I look forward to hearing feedback. Michael Whapples For a description of the software and to download it go to http://www.jjb-software.com
For a description of the software and to download it go to http://www.jjb-software.com