zoslib
z/OS C/C++ Library
Loading...
Searching...
No Matches
Macros | Functions
zos-char-util.h File Reference
#include "zos-macros.h"
#include <_Nascii.h>
#include <sys/types.h>

Go to the source code of this file.

Macros

#define _str_e2a(_str)
 
#define _str_a2e(_str)
 
#define AEWRAP(_rc, _x)
 
#define AEWRAP_VOID(_x)
 

Functions

__Z_EXPORT void * _convert_e2a (void *dst, const void *src, size_t size)
 
__Z_EXPORT void * _convert_a2e (void *dst, const void *src, size_t size)
 
__Z_EXPORT int __guess_fd_ue (int fd, char *errmsg, size_t er_size, int is_new_fd)
 
__Z_EXPORT int __guess_ue (const void *src, size_t size, char *errmsg, size_t er_size)
 
__Z_EXPORT int __guess_ae (const void *src, size_t size)
 
__Z_EXPORT int conv_utf8_utf16 (char *, size_t, const char *, size_t)
 
__Z_EXPORT int conv_utf16_utf8 (char *, size_t, const char *, size_t)
 
__Z_EXPORT void __set_autocvt_on_fd_stream (int fd, unsigned short ccsid, unsigned char txtflag, int on_untagged_only)
 
__Z_EXPORT int __file_needs_conversion (int fd)
 
__Z_EXPORT int __file_needs_conversion_init (const char *name, int fd)
 
__Z_EXPORT void __fd_close (int fd)
 
void *__Z_EXPORT __convert_one_to_one (const void *table, void *dst, size_t size, const void *src)
 
unsigned strlen_ae (const unsigned char *str, int *code_page, int max_len, int *ambiguous)
 
unsigned strlen_e (const unsigned char *str, unsigned size)
 
const unsigned char __ibm1047_iso88591[256] __attribute__ ((aligned(8)))
 

Macro Definition Documentation

◆ _str_a2e

#define _str_a2e (   _str)
Value:
({ \
const char *src = (const char *)(_str); \
int len = strlen(src) + 1; \
char tgt[len]; \
(char *)_convert_a2e(tgt, src, len); \
})
__Z_EXPORT void * _convert_a2e(void *dst, const void *src, size_t size)
Definition zos-char-util.cc:221

◆ _str_e2a

#define _str_e2a (   _str)
Value:
({ \
const char *src = (const char *)(_str); \
int len = strlen(src) + 1; \
char tgt[len]; \
(char *)_convert_e2a(tgt, src, len); \
})
__Z_EXPORT void * _convert_e2a(void *dst, const void *src, size_t size)
Definition zos-char-util.cc:210

◆ AEWRAP

#define AEWRAP (   _rc,
  _x 
)
Value:
(__isASCII() ? ((_rc) = (_x), 0) \
: (__ae_thread_swapmode(__AE_ASCII_MODE), ((_rc) = (_x)), \
__ae_thread_swapmode(__AE_EBCDIC_MODE), 1))

◆ AEWRAP_VOID

#define AEWRAP_VOID (   _x)
Value:
(__isASCII() ? ((_x), 0) \
: (__ae_thread_swapmode(__AE_ASCII_MODE), (_x), \
__ae_thread_swapmode(__AE_EBCDIC_MODE), 1))

Function Documentation

◆ __attribute__()

const unsigned char __ibm1047_iso88591[256] __attribute__ ( (aligned(8))  )

◆ __convert_one_to_one()

void *__Z_EXPORT __convert_one_to_one ( const void *  table,
void *  dst,
size_t  size,
const void *  src 
)
inline

◆ __fd_close()

__Z_EXPORT void __fd_close ( int  fd)

Unsets fd attributes

Parameters
[in]fdfile descriptor

◆ __file_needs_conversion()

__Z_EXPORT int __file_needs_conversion ( int  fd)

Determines if file descriptor needs conversion from EBCDIC to ASCII. Call __file_needs_conversion_init first before calling this function.

Parameters
[in]fdfile descriptor
Returns
returns 1 if file needs conversion, 0 if not.

◆ __file_needs_conversion_init()

__Z_EXPORT int __file_needs_conversion_init ( const char *  name,
int  fd 
)

Determines if file needs conversion from EBCDIC to ASCII.

Parameters
[in]namepath to file
[in]fdfile descriptor
Returns
returns 1 if file needs conversion, 0 if not.

◆ __guess_ae()

__Z_EXPORT int __guess_ae ( const void *  src,
size_t  size 
)

Guess if string is ASCII or EBCDIC.

Parameters
[in]src- character string.
[in]size- number of bytes to analyze.
Returns
guessed CCSID.

◆ __guess_fd_ue()

__Z_EXPORT int __guess_fd_ue ( int  fd,
char *  errmsg,
size_t  er_size,
int  is_new_fd 
)

Guess if string is UTF8 (ASCII) or EBCDIC based on the first CCSID_GUESS_BUF_SIZE_ENVAR of the file associated with the given fd. CCSID_GUESS_BUF_SIZE_ENVAR is default at 4KB.

Parameters
[in]fd- open file descriptor to guess.
Returns
guessed CCSID (819 for UTF8, 1047 for EBCDIC; otherwise 65535 for BINARY and, if not NULL, errmsg will contain details).

◆ __guess_ue()

__Z_EXPORT int __guess_ue ( const void *  src,
size_t  size,
char *  errmsg,
size_t  er_size 
)

Guess if string is UTF8 (ASCII) or EBCDIC.

Parameters
[in]src- character string.
[in]size- number of bytes to analyze.
Returns
guessed CCSID (819 for UTF8, 1047 for EBCDIC; otherwise 65535 for BINARY and, if not NULL, errmsg will contain details).

◆ __set_autocvt_on_fd_stream()

__Z_EXPORT void __set_autocvt_on_fd_stream ( int  fd,
unsigned short  ccsid,
unsigned char  txtflag,
int  on_untagged_only 
)

Sets file descriptor to auto convert.

Parameters
[in]fd- file descriptor.
[in]ccsid- CCSID to auto convert to.
[in]txtflag- Indicates if ccsid is text.
[in]on_untagged_only- applies only to untagged

◆ _convert_a2e()

__Z_EXPORT void * _convert_a2e ( void *  dst,
const void *  src,
size_t  size 
)

Convert from ASCII to EBCDIC

Parameters
[out]dstDestination string (must be pre-allocated).
[in]srcSource string.
[in]sizeNumber of bytes to convert
Returns
returns destination string.

◆ _convert_e2a()

__Z_EXPORT void * _convert_e2a ( void *  dst,
const void *  src,
size_t  size 
)

Convert from EBCDIC to ASCII.

Parameters
[out]dstDestination string (must be pre-allocated).
[in]srcSource string.
[in]sizeNumber of bytes to convert.
Returns
returns destination string.

◆ conv_utf16_utf8()

__Z_EXPORT int conv_utf16_utf8 ( char *  out,
size_t  outsize,
const char *  in,
size_t  insize 
)

Convert string from UTF16 to UTF8.

◆ conv_utf8_utf16()

__Z_EXPORT int conv_utf8_utf16 ( char *  out,
size_t  outsize,
const char *  in,
size_t  insize 
)

Convert string from UTF8 to UTF16

◆ strlen_ae()

unsigned strlen_ae ( const unsigned char *  str,
int *  code_page,
int  max_len,
int *  ambiguous 
)
inline

◆ strlen_e()

unsigned strlen_e ( const unsigned char *  str,
unsigned  size 
)
inline