[liblouis-liblouisxml] Re: ISO language code to table name mapping API

  • From: James Teh <jamie@xxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 10 Nov 2009 07:08:22 +1000

On 10/11/2009 2:33 AM, Michael Whapples wrote:
The last point raises the question should we may be have another
function call:
def list_tables(locale="whatever the system default is", grade=2, dots=6):
"""Returns a list of the tables matching the criteria with the best
match first"""
...
In that when I say best match I mean it will put the most recent
revision of the code first
I think this is a good idea.

and as we have defaults (a python feature
although must be possible to do something similar in C)
You can do this in CC++, but not pure C. We'd probably just need to accept NULL/-1 and treat it as default.

Alternatively why not have this behavior as the single call, so if you
aren't interested in giving the user options then take the first table
in the list (check list length is not 0). That also handles the case of
no matching table.
I agree here too. This reduces complexity by only having one call. The only catch is that in C, you'll need to allocate an array ahead of time, so you'll have to call it first to get the length. The alternative is to have it malloc the memory itself, but this is probably frowned upon, as it means you can't control your own memory allocation.

Jamie


--
James Teh
Email/MSN Messenger/Jabber: jamie@xxxxxxxxxxx
Web site: http://www.jantrid.net/
For a description of the software and to download it go to
http://www.jjb-software.com

Other related posts: