exported hcl_conv_ucs_to_bcs_with_cmgr() and similar functions

enhanced the sample server program
This commit is contained in:
2018-03-12 16:45:42 +00:00
parent d51ad1cd6a
commit 3ba32a615d
6 changed files with 598 additions and 529 deletions

View File

@ -345,12 +345,55 @@ HCL_EXPORT int hcl_concatoocstrtosbuf (
int id
);
HCL_EXPORT hcl_cmgr_t* hcl_getutf8cmgr (
#if defined(HCL_OOCH_IS_UCH)
# define hcl_conv_oocs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) hcl_conv_ucs_to_bcs_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
# define hcl_conv_oocsn_to_bcsn_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr) hcl_conv_ucsn_to_bcsn_with_cmgr(oocs,oocslen,bcs,bcslen,cmgr)
#else
# define hcl_conv_oocs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) hcl_conv_bcs_to_ucs_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
# define hcl_conv_oocsn_to_ucsn_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr) hcl_conv_bcsn_to_ucsn_with_cmgr(oocs,oocslen,ucs,ucslen,cmgr,0)
#endif
HCL_EXPORT int hcl_conv_bcs_to_ucs_with_cmgr (
const hcl_bch_t* bcs,
hcl_oow_t* bcslen,
hcl_uch_t* ucs,
hcl_oow_t* ucslen,
hcl_cmgr_t* cmgr,
int all
);
HCL_EXPORT int hcl_conv_bcsn_to_ucsn_with_cmgr (
const hcl_bch_t* bcs,
hcl_oow_t* bcslen,
hcl_uch_t* ucs,
hcl_oow_t* ucslen,
hcl_cmgr_t* cmgr,
int all
);
HCL_EXPORT int hcl_conv_ucs_to_bcs_with_cmgr (
const hcl_uch_t* ucs,
hcl_oow_t* ucslen,
hcl_bch_t* bcs,
hcl_oow_t* bcslen,
hcl_cmgr_t* cmgr
);
HCL_EXPORT int hcl_conv_ucsn_to_bcsn_with_cmgr (
const hcl_uch_t* ucs,
hcl_oow_t* ucslen,
hcl_bch_t* bcs,
hcl_oow_t* bcslen,
hcl_cmgr_t* cmgr
);
HCL_EXPORT hcl_cmgr_t* hcl_get_utf8_cmgr (
void
);
/**
* The hcl_convutoutf8chars() function converts a unicode character string \a ucs
* The hcl_conv_uchars_to_utf8() function converts a unicode character string \a ucs
* to a UTF8 string and writes it into the buffer pointed to by \a bcs, but
* not more than \a bcslen bytes including the terminating null.
*
@ -371,14 +414,14 @@ HCL_EXPORT hcl_cmgr_t* hcl_getutf8cmgr (
* hcl_bch_t bcs[10];
* hcl_oow_t ucslen = 5;
* hcl_oow_t bcslen = HCL_COUNTOF(bcs);
* n = hcl_convutoutf8chars (ucs, &ucslen, bcs, &bcslen);
* n = hcl_conv_uchars_to_utf8 (ucs, &ucslen, bcs, &bcslen);
* if (n <= -1)
* {
* // conversion error
* }
* \endcode
*/
HCL_EXPORT int hcl_convutoutf8chars (
HCL_EXPORT int hcl_conv_uchars_to_utf8 (
const hcl_uch_t* ucs,
hcl_oow_t* ucslen,
hcl_bch_t* bcs,
@ -386,7 +429,7 @@ HCL_EXPORT int hcl_convutoutf8chars (
);
/**
* The hcl_convutf8touchars() function converts a UTF8 string to a uncide string.
* The hcl_conv_utf8_to_uchars() function converts a UTF8 string to a uncide string.
*
* It never returns -2 if \a ucs is #HCL_NULL.
*
@ -396,7 +439,7 @@ HCL_EXPORT int hcl_convutoutf8chars (
* hcl_oow_t ucslen = HCL_COUNTOF(buf), n;
* hcl_oow_t bcslen = 11;
* int n;
* n = hcl_convutf8touchars (bcs, &bcslen, ucs, &ucslen);
* n = hcl_conv_utf8_to_uchars (bcs, &bcslen, ucs, &ucslen);
* if (n <= -1) { invalid/incomplenete sequence or buffer to small }
* \endcode
*
@ -409,7 +452,7 @@ HCL_EXPORT int hcl_convutoutf8chars (
* -2 if the wide-character string buffer is too small.
* -3 if \a bcs is not a complete sequence.
*/
HCL_EXPORT int hcl_convutf8touchars (
HCL_EXPORT int hcl_conv_utf8_to_uchars (
const hcl_bch_t* bcs,
hcl_oow_t* bcslen,
hcl_uch_t* ucs,
@ -417,14 +460,14 @@ HCL_EXPORT int hcl_convutf8touchars (
);
HCL_EXPORT int hcl_convutoutf8cstr (
HCL_EXPORT int hcl_conv_ucstr_to_utf8 (
const hcl_uch_t* ucs,
hcl_oow_t* ucslen,
hcl_bch_t* bcs,
hcl_oow_t* bcslen
);
HCL_EXPORT int hcl_convutf8toucstr (
HCL_EXPORT int hcl_conv_utf8_to_ucstr (
const hcl_bch_t* bcs,
hcl_oow_t* bcslen,
hcl_uch_t* ucs,