X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=charset%2Fstk-charconv.h;h=154edacfff77ca4898bf374af5da6594ec4db855;hb=4d8858ba28597c458bef262399b553e5da89442a;hp=9f01000440f0e475add4de0fa8a2cb41d1f0c6f9;hpb=ee58c363f2df512f649ac2837ee06c3cdbc75a03;p=libucw.git diff --git a/charset/stk-charconv.h b/charset/stk-charconv.h index 9f010004..154edacf 100644 --- a/charset/stk-charconv.h +++ b/charset/stk-charconv.h @@ -1,5 +1,5 @@ /* - * Sherlock Library -- Character Conversion with Allocation on the Stack + * Sherlock Library -- Character Conversion with Allocation on the Stack * * (c) 2006 Pavel Charvat * @@ -10,21 +10,21 @@ #ifndef _CHARSET_STK_CHARCONV_H #define _CHARSET_STK_CHARCONV_H -#include "charset/charconv.h" +#include #include /* The following macros convert strings between given charsets (CONV_CHARSET_x). */ -#define stk_conv(s, cs_in, cs_out) \ - ({ struct conv_context _c; uns _l=stk_conv_init(&_c, (s), (cs_in), (cs_out)); \ - while (_l) _l=stk_conv_step(&_c, alloca(_l), _l); _c.dest_start; }) +#define stk_strconv(s, cs_in, cs_out) \ + ({ struct conv_context _c; uns _l=stk_strconv_init(&_c, (s), (cs_in), (cs_out)); \ + while (_l) _l=stk_strconv_step(&_c, alloca(_l), _l); _c.dest_start; }) + +#define stk_strconv_to_utf8(s, cs_in) stk_strconv(s, cs_in, CONV_CHARSET_UTF8) +#define stk_strconv_from_utf8(s, cs_out) stk_strconv(s, CONV_CHARSET_UTF8, cs_out) -#define stk_conv_to_utf8(s, cs_in) stk_conv(s, cs_in, CONV_CHARSET_UTF8) -#define stk_conv_from_utf8(s, cs_out) stk_conv(s, CONV_CHARSET_UTF8, cs_out) - /* Internals */ -uns stk_conv_init(struct conv_context *c, byte *s, uns cs_in, uns cs_out); -uns stk_conv_step(struct conv_context *c, byte *buf, uns len); +uns stk_strconv_init(struct conv_context *c, const byte *s, uns cs_in, uns cs_out); +uns stk_strconv_step(struct conv_context *c, byte *buf, uns len); #endif