[liblouis-liblouisxml] Calling java programmers, java bindings for liblouis ready for further testing and feedback

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Fri, 12 Jun 2009 15:59:07 +0100

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

Other related posts: