- Look at libenca API documentation in devel-docs/html.
- Look into enca source how it uses libenca. Note enca is quite a simple
application (practically all libenca interaction is in
src/enca.c). It's single-threaded and uses one language and one analyser all the time. Provided each thread has its own analyser, libenca should be thread-safe (untested). - Take names starting with
ENCA,Enca,enca,_ENCA,_Enca, and_encaas reserved. - pkgconfig is supported, you can use
PKG_CHECK_MODULESto check for libenca in your configure scripts
(optional steps are marked [optional]):
iconvcap.c:- Add a new test (even if you are 100% sure iconv will never support it),
please see top of
iconvcap.cfor some documentation how it works.
- Add a new test (even if you are 100% sure iconv will never support it),
please see top of
tools/encodings.dat:- Add a new entry.
- Use
@ICONV_NAME_<name>@(as it will appear in iconvcap output) for iconv names.
tools/iconvenc.null:- Add it (with NULL)
Specifically, for regular 8bit (language dependent) charsets:
lib/unicodemap.c:- Add a new map to Unicode (UCS-2)
unicode_map_...[]. - Add a new
UNICODE_MAP[]entry.
- Add a new map to Unicode (UCS-2)
lib/filters.c: [optional]- Create a new filter or make an alias of an existing filter.
lib/lang_??.c:- Add the new encoding to some existing language(s).
- Add appropriate filters or hooks [optional].
data/maps/??.map:- Add a new map to Unicode (UCS-2)
Specifically, for multibyte encodings:
lib/multibyte.c:- Create a new check function.
- Put it into appropriate ascii/8bit/binary test group
ENCA_MULTIBYTE_TESTS_ASCII[],ENCA_MULTIBYTE_TESTS_8BIT[],ENCA_MULTIBYTE_TESTS_BINARY[]. - Put strict tests (i.e. test which may fail) first, looks-like tests last.
- Try to ask the author what to do, since this may be complicated, or
- Hack, basically it must be added to
lib/enca.hEncaSurface enum, tolib/encnames.cSURFACE_INFO[]a detection method must be added tolib/guess.cand now the most complicated part: this new method must be used in the right places inlib/guess.cmake_guess().
- Create a new language file:
- Create new
lib/lang_....cfiles by copying some existing (use locale code for names) - Fill all encoding and occurence data, create filters and hooks (see
filters.ctoo). You can do it manually, but look how it's done for existing languages indata/*and readdata/README.
- Create new
lib/internal.h:- Add new
ENCA_LANGUAGE_....
- Add new
src/lang.c:- Add a new
LANGUAGE_LIST[]entry pointing to theENCA_LANGUAGE_....
- Add a new
If you run ./autogen.sh and it finishes OK, you are lucky and can expect
things to work.
You have to give --enable-maintainer-mode to ./configure (or ./autogen)
to build dists and/or the strange stuff in tools/, data/, tests/, and
devel-docs/.
The git repository is located at GitHub:
http://github.com/nijel/enca
There is also continuous integration on Travis:
https://travis-ci.org/nijel/enca