adding wide string and multibyte string conversion
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: Awk.hpp 399 2008-09-29 10:26:26Z baconevi $
|
||||
* $Id: Awk.hpp 430 2008-10-17 11:43:20Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -11,6 +11,7 @@
|
||||
#include <ase/cmn/map.h>
|
||||
#include <ase/cmn/chr.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/////////////////////////////////
|
||||
ASE_BEGIN_NAMESPACE(ASE)
|
||||
@ -323,8 +324,10 @@ public:
|
||||
|
||||
public:
|
||||
// initialization
|
||||
void* operator new (size_t n, awk_t* awk) throw ();
|
||||
void* operator new[] (size_t n, awk_t* awk) throw ();
|
||||
//void* operator new (size_t n, awk_t* awk) throw ();
|
||||
//void* operator new[] (size_t n, awk_t* awk) throw ();
|
||||
void* operator new (::size_t n, awk_t* awk) throw ();
|
||||
void* operator new[] (::size_t n, awk_t* awk) throw ();
|
||||
|
||||
#if !defined(__BORLANDC__)
|
||||
// deletion when initialization fails
|
||||
|
@ -54,17 +54,41 @@ ase_size_t ase_mblen (
|
||||
ase_size_t mblen
|
||||
);
|
||||
|
||||
/****f* ase.cmn.chr/ase_mbtowc
|
||||
* NAME
|
||||
* ase_mbtowc - convert a multibyte sequence to a wide character.
|
||||
*
|
||||
* RETURN
|
||||
* The ase_mbtowc() function returns 0 if an invalid multibyte sequence is
|
||||
* detected, mblen + 1 if the sequence is incomplete. It returns the number
|
||||
* of bytes processed to form a wide character.
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
ase_size_t ase_mbtowc (
|
||||
const ase_mchar_t* mb,
|
||||
ase_size_t mblen,
|
||||
ase_wchar_t* wc
|
||||
);
|
||||
/******/
|
||||
|
||||
/****f* ase.cmn.chr/ase_wctomb
|
||||
* NAME
|
||||
* ase_wctomb - convert a wide character to a multibyte sequence
|
||||
*
|
||||
* RETURN
|
||||
* The ase_wctomb() functions returns 0 if the wide character is illegal,
|
||||
* mblen + 1 if mblen is not large enough to hold the multibyte sequence.
|
||||
* On successful conversion, it returns the number of bytes in the sequence.
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
ase_size_t ase_wctomb (
|
||||
ase_wchar_t wc,
|
||||
ase_mchar_t* mb,
|
||||
ase_size_t mblen
|
||||
);
|
||||
/******/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: str.h 389 2008-09-26 08:01:24Z baconevi $
|
||||
* $Id: str.h 430 2008-10-17 11:43:20Z baconevi $
|
||||
*
|
||||
* {License}
|
||||
*/
|
||||
@ -229,10 +229,6 @@ ase_long_t ase_strxtolong (const ase_char_t* str, ase_size_t len);
|
||||
ase_uint_t ase_strxtouint (const ase_char_t* str, ase_size_t len);
|
||||
ase_ulong_t ase_strxtoulong (const ase_char_t* str, ase_size_t len);
|
||||
|
||||
/*
|
||||
* dynamic string
|
||||
*/
|
||||
|
||||
ase_str_t* ase_str_open (
|
||||
ase_mmgr_t* mmgr,
|
||||
ase_size_t ext,
|
||||
@ -346,16 +342,94 @@ ase_size_t ase_str_setcapa (
|
||||
ase_size_t capa /* a new capacity */
|
||||
);
|
||||
|
||||
void ase_str_clear (ase_str_t* str);
|
||||
void ase_str_swap (ase_str_t* str, ase_str_t* str2);
|
||||
void ase_str_clear (
|
||||
ase_str_t* str
|
||||
);
|
||||
|
||||
ase_size_t ase_str_cpy (ase_str_t* str, const ase_char_t* s);
|
||||
ase_size_t ase_str_ncpy (ase_str_t* str, const ase_char_t* s, ase_size_t len);
|
||||
void ase_str_swap (
|
||||
ase_str_t* str,
|
||||
ase_str_t* str2
|
||||
);
|
||||
|
||||
ase_size_t ase_str_cat (ase_str_t* str, const ase_char_t* s);
|
||||
ase_size_t ase_str_ncat (ase_str_t* str, const ase_char_t* s, ase_size_t len);
|
||||
ase_size_t ase_str_ccat (ase_str_t* str, ase_char_t c);
|
||||
ase_size_t ase_str_nccat (ase_str_t* str, ase_char_t c, ase_size_t len);
|
||||
ase_size_t ase_str_cpy (
|
||||
ase_str_t* str,
|
||||
const ase_char_t* s
|
||||
);
|
||||
|
||||
ase_size_t ase_str_ncpy (
|
||||
ase_str_t* str,
|
||||
const ase_char_t* s,
|
||||
ase_size_t len
|
||||
);
|
||||
|
||||
ase_size_t ase_str_cat (
|
||||
ase_str_t* str,
|
||||
const ase_char_t* s
|
||||
);
|
||||
|
||||
ase_size_t ase_str_ncat (
|
||||
ase_str_t* str,
|
||||
const ase_char_t* s,
|
||||
ase_size_t len
|
||||
);
|
||||
|
||||
ase_size_t ase_str_ccat (
|
||||
ase_str_t* str,
|
||||
ase_char_t c
|
||||
);
|
||||
|
||||
ase_size_t ase_str_nccat (
|
||||
ase_str_t* str,
|
||||
ase_char_t c,
|
||||
ase_size_t len
|
||||
);
|
||||
|
||||
|
||||
ase_size_t ase_mbstowcs (
|
||||
const ase_mchar_t* mbs,
|
||||
ase_wchar_t* wcs,
|
||||
ase_size_t* wcslen
|
||||
);
|
||||
|
||||
/****f* ase.cmn.str/ase_mbsntowcsn
|
||||
* NAME
|
||||
* ase_mbsntowcsn - conver a multibyte string to a wide character string
|
||||
*
|
||||
* RETURN
|
||||
* The ase_mbstowcs() function returns the number of bytes handled.
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
ase_size_t ase_mbsntowcsn (
|
||||
const ase_mchar_t* mbs,
|
||||
ase_size_t mbslen,
|
||||
ase_wchar_t* wcs,
|
||||
ase_size_t* wcslen
|
||||
);
|
||||
/******/
|
||||
|
||||
ase_size_t ase_wcstombs (
|
||||
const ase_wchar_t* wcs,
|
||||
ase_mchar_t* mbs,
|
||||
ase_size_t* mbslen
|
||||
);
|
||||
|
||||
/****f* ase.cmn.str/ase_wcsntombsn
|
||||
* NAME
|
||||
* ase_wcstombs - convert a wide character string to a multibyte string
|
||||
*
|
||||
* RETURN
|
||||
* The ase_wcstombs() function returns the number of wide characters handled.
|
||||
*
|
||||
* SYNOPSIS
|
||||
*/
|
||||
ase_size_t ase_wcsntombsn (
|
||||
const ase_wchar_t* wcs,
|
||||
ase_size_t wcslen,
|
||||
ase_mchar_t* mbs,
|
||||
ase_size_t* mbslen
|
||||
);
|
||||
/******/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ enum
|
||||
ASE_TIO_ENOMEM, /* out of memory */
|
||||
ASE_TIO_ENOSPC, /* no more space */
|
||||
ASE_TIO_EILSEQ, /* illegal sequence */
|
||||
ASE_TIO_EICSEQ, /* incomplete sequence */
|
||||
ASE_TIO_EILCHR, /* illegal character */
|
||||
ASE_TIO_ENOINF, /* no input function attached */
|
||||
ASE_TIO_EINPUT, /* input function returned an error */
|
||||
@ -114,6 +115,19 @@ int ase_tio_fini (
|
||||
ase_tio_t* tio
|
||||
);
|
||||
|
||||
void* ase_tio_getextension (
|
||||
ase_tio_t* tio
|
||||
);
|
||||
|
||||
ase_mmgr_t* ase_tio_getmmgr (
|
||||
ase_tio_t* tio
|
||||
);
|
||||
|
||||
void ase_tio_setmmgr (
|
||||
ase_tio_t* tio,
|
||||
ase_mmgr_t* mmgr
|
||||
);
|
||||
|
||||
/*
|
||||
* FUNCTION: ase_tio_geterrnum
|
||||
* Returns an error code
|
||||
|
@ -87,6 +87,12 @@
|
||||
/* Define to 1 if you have the `mbrtowc' function. */
|
||||
#undef HAVE_MBRTOWC
|
||||
|
||||
/* Define to 1 if you have the `mbsnrtowcs' function. */
|
||||
#undef HAVE_MBSNRTOWCS
|
||||
|
||||
/* Define to 1 if you have the `mbsrtowcs' function. */
|
||||
#undef HAVE_MBSRTOWCS
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
@ -126,6 +132,12 @@
|
||||
/* Define to 1 if you have the `wcrtomb' function. */
|
||||
#undef HAVE_WCRTOMB
|
||||
|
||||
/* Define to 1 if you have the `wcsnrtombs' function. */
|
||||
#undef HAVE_WCSNRTOMBS
|
||||
|
||||
/* Define to 1 if you have the `wcsrtombs' function. */
|
||||
#undef HAVE_WCSRTOMBS
|
||||
|
||||
/* Define to 1 if you have the <wctype.h> header file. */
|
||||
#undef HAVE_WCTYPE_H
|
||||
|
||||
|
Reference in New Issue
Block a user