22 Commits

Author SHA1 Message Date
David Herrmann
2b5b7d3736 shl: move kmscon_array_* to shl_array_*
This moves all array code into the SHL library and fixes all users.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-16 09:10:36 +02:00
David Herrmann
719ac16607 unicode: move KMSCON_UCS4_MAXLEN to TSM_UCS4_MAXLEN
We want to get rid of all non-static kmscon dependencies in TSM so move
this constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:31:18 +02:00
David Herrmann
81a9a30040 unicode: remove KMSCON_UCS4_MAX
We have TSM_UCS4_MAX so use it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:29:07 +02:00
David Herrmann
61e0d9d098 unicode: move kmscon_symbol* to tsm_symbol*
All the unicode helpers are move to TSM so move the symbols, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:26:43 +02:00
David Herrmann
fa31942c02 unicode: inline locking helpers
There is really no need to use these helper functions. Just directly call
the pthread locks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:21:37 +02:00
David Herrmann
601592a866 unicode: update comments
Update all the introduction and documentation comments. Also remove an old
TODO item regarding glib.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:19:15 +02:00
David Herrmann
e9f39be3e8 unicode: add description of UTF8-state-machine
A short comment on how the UTF8 state machine works and why it does not do
any sophisticated error recovery.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:01:34 +02:00
David Herrmann
468e265138 unicode: add UCS4 constants
Four helpers that define maximum UCS4 values, invalid values and a
replacement character for unknown values.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 18:00:59 +02:00
David Herrmann
c1075fba18 unicode: rename kmscon_utf8_* to tsm_utf8_*
All terminal-emulation code is moved into a new library called "TSM -
Terminal State Machine". So we rename everything to have a separate
namespace.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-14 17:18:51 +02:00
David Herrmann
d0672030ff unicode: implement ucs4 to utf8 encoding
This is the last glib dependency so add a short conversion helper and we
can finally drop glib. Anyway, the pango libs still depend on glib so
there is currently still a glib dependency, but it is no longer direct and
we can always choose the freetype font renderer to drop it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 16:29:34 +02:00
David Herrmann
a97c580afd unicode: use kmscon_array instead of GArray
Replace the glib dependency with the new in-house dynamic-array
implementation. Now there is only one utf8 glib dependency left that we
need to convert so we can drop glib-dependency.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-15 14:45:19 +02:00
David Herrmann
485b6b352c unicode: replace glib types with native types
There is really no need to use these glib types here. They are relicts
from the time when we used the glib hashtable so we can safely replace
them now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 19:35:16 +02:00
David Herrmann
25b81425ef misc: change hashtable compare function to return bool
It really doesn't make sense to expect an integer here as memcmp() and
friends use an integer, too, but in reversed logic. So use bool to avoid
confusion.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-07-01 19:29:33 +02:00
David Herrmann
f1326b2728 static: move statically linked subsystems to static_*
Small stuff that is not worth putting into a separate library is no moved
into the "static" library which is statically linked into all our
subsystems.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-06-24 20:35:22 +02:00
David Herrmann
277edee2dc unicode: introduce kmscon_utf8_mach_reset()
Sometimes we need to reset the UTF8 state-machine, for instance when
resetting the VTE. This function simply resets the internal state to
KMSCON_UTF8_START so we start all over on the next input character.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-05-29 11:13:49 +02:00
David Herrmann
f091b2b763 misc: replace all GHashTable with kmscon_hashtable
We use a new wrapper to move all glib deps to central points so we can
replace them easily.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-30 18:49:04 +02:00
David Herrmann
c9ea08d9b5 unicode: use static global symbol table
A symbol table should never be created twice therefore we can make it
static and global. We add locks so it is totally thread-safe, too.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-29 16:17:55 +02:00
David Herrmann
a31455a10b unicode: fix logging messages
Use new logging style in unicode layer.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-28 17:20:13 +02:00
David Herrmann
046d397987 unicode: add utf8 state machine
The state machine is used to convert a stream of UTF8 data into UCS4
characters. It is slightly based on the machine found in the
wayland-compositor demos.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-29 14:19:49 +01:00
David Herrmann
bd09f38a4d log: move log_warning to log_warn
log_warn is much shorter and we already use log_err instead of log_error
so this is more consistent now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-24 15:29:55 +01:00
David Herrmann
4eca3ef714 unicode: provide utf8 converter
Allow converting a ucs4 string into a utf8 string. Also export the default
symbol so other subsystems may use it.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01 17:42:57 +01:00
David Herrmann
39f90a4536 Add faster kmscon_char replacement
Instead of allocating big buffers with kmscon_char's for every character we now
reduce a single character to an integer. This integer is either the Unicode
codepoint or an ID to an internally allocated string.

The so called kmscon_symbol_t integer can now be used as if it were a classic
"char" value without bothering with combining marks etc.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-01 16:47:06 +01:00