X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=charset%2Fcharconv.c;h=fcd8680c438af7d7b847089149db4cf82657737b;hb=8c48090e240d68564c79eb29ac9004cc911bb5d0;hp=67e84555f76d862f5fb84acd8fd546d3f9e61a6d;hpb=0212c89995aff7120ccb04b77241e31d831e2ba6;p=libucw.git diff --git a/charset/charconv.c b/charset/charconv.c index 67e84555..fcd8680c 100644 --- a/charset/charconv.c +++ b/charset/charconv.c @@ -412,3 +412,18 @@ conv_x_count(void) { return sizeof(x_to_uni) / sizeof(x_to_uni[0]); } + +int +conv_in_to_ucs(struct conv_context *c, unsigned int y) +{ + return x_to_uni[c->in_to_x[y]]; +} + +int conv_ucs_to_out(struct conv_context *c, unsigned int ucs) +{ + uns x = uni_to_x[ucs >> 8U][ucs & 0xff]; + if (x == 256 || c->x_to_out[x] >= 256) + return -1; + else + return c->x_to_out[x]; +}