wanleung/libcangjie — pull request #12 by bochecha (2013-01-28 11:08:37+00:00)
Title: Cleanup, and HK-specific characters

This really should be 2 pull requests, but I still haven't figured out how to do that with Github...

### First, some cleanup

* 4c3c48f Rename the table LICENSE file

LICENSE was just a wrong name, and COPYING wouldn't do as it would conflict with our main COPYING file, which would make life harder for distro packagers.

* 37b8689 Greatly simplify the handling of tables
* 2a521a7 Add a README.tables

I got tired of constantly mixing the tables, because really, it isn't obvious that "13053" means "Traditional Chinese"...

As a bonus, it simplifies the unit test and the Makefile.am, which is always a good thing.

The README.tables just makes things very explicit.

* 86b1edc Remove some old unused comments

Well, this speaks for itself.

### Next, a new feature

@antonyho complained on IRC that he couldn't input some Hong Kong specific characters with ibus-cangjie.

On closer inspection, it turns out that they exist in our tables, but not in the TC-only ones. And of course, Hong Kong people will use the TC-only tables by default.

So these HK-specific characters really ought to be in the TC tables.

So that's what the second part of the PR does.

* 21a8ab0 Export the two helper functions to a util module

This separates the `startswith` and `endswith` functions into a simple `util` module, because 1. they never really belonged in the CangJie class, and 2. we can reuse them elsewhere, which I'll do in the dbbuilder in a further commit.

* a1a6248 Move the dbbuilder sources

This just makes more sense, and makes the next commit much simpler. Without this the Makefile.am would become more complex, and I don't know about you, but I'd rather keep our Autotools stuff as simple as possible. ;)

* d387a66 Ignore empty and commented lines when building the tables

This makes it possible to have empty and commented lines in the table sources, which helps us making our own specific additions clearer.

I'm reusing the `startswith` function from the new `util` module here.

* 664dc55 Add some Hong Kong-specific characters

And this actually adds 3 characters to the TC-only tables.

I took the input code from the other tables, where these characters already exist.

-----

This should make lives of Hong Kong users significantly better.

Of course, we might still be missing many region-specific characters, but we'll add them when someone reports them to be missing.