diff options
Diffstat (limited to 'zap/include')
-rw-r--r-- | zap/include/zap/bs.h | 139 | ||||
-rw-r--r-- | zap/include/zap/mem.h | 27 |
2 files changed, 131 insertions, 35 deletions
diff --git a/zap/include/zap/bs.h b/zap/include/zap/bs.h index 04a3d16..0b7a770 100644 --- a/zap/include/zap/bs.h +++ b/zap/include/zap/bs.h @@ -51,48 +51,141 @@ zap_priv_cdecl -#define zap_ver ((unsigned long)+0x16u) +#define zap_ver ((unsigned long)+0x17u) -#define zap_bytesz ((zap_sz)+0x8u) +#define zap_bytelen ((zap_sz)+0x8u) +#define zap_nopos zap_maxval_sz -#define zap_false ((zap_bool)+0x0u) -#define zap_true ((zap_bool)-0x1) +#define zap_nullptr ((void *)0x0) -#define zap_nopos ((zap_sz)-0x1) +#define zap_minval_uc ((unsigned char) +0x0u) +#define zap_minval_us ((unsigned short) +0x0u) +#define zap_minval_ui ((unsigned int) +0x0u) +#define zap_minval_ul ((unsigned long) +0x0u) +#define zap_minval_ull ((unsigned long long)+0x0) +#define zap_minval_sc ((signed char) -0x80) +#define zap_minval_s ((short) -0x8000) +#define zap_minval_ll ((long long) -0x8000000000000000) -#define zap_nullptr ((void *)0x0u) +#define zap_maxval_uc ((unsigned char) +0xFFu) +#define zap_maxval_us ((unsigned short) +0xFFFFu) +#define zap_maxval_ull ((unsigned long long)+0xFFFFFFFFFFFFFFFFu) +#define zap_maxval_sc ((signed char) +0x7F) +#define zap_maxval_s ((short) +0x7FFF) +#define zap_maxval_ll ((long long) +0x7FFFFFFFFFFFFFFF) + +typedef unsigned char zap_i8; +typedef unsigned short zap_i01; + +typedef signed char zap_i8s; +typedef short zap_i01s; + +#define zap_minval_i8 zap_minval_uc +#define zap_minval_i01 zap_minval_us +#define zap_minval_i8s zap_minval_sc +#define zap_minval_i01s zap_minval_s + +#define zap_maxval_i8 zap_maxval_uc +#define zap_maxval_i01 zap_maxval_us +#define zap_maxval_i8s zap_maxval_sc +#define zap_maxval_i01s zap_maxval_s -typedef unsigned char zap_i8; -typedef unsigned short zap_i01; -typedef unsigned int zap_i02; #if \ - csys_arch_arm \ - || csys_arch_ia32 \ - || (csys_os_win && csys_arch_amd64) -typedef unsigned long long zap_i04; + csys_arch_arm \ + || csys_arch_arm64 +#define zap_minval_c zap_minval_uc +#define zap_maxval_c zap_maxval_uc #else -typedef unsigned long zap_i04; +#define zap_minval_c zap_minval_sc +#define zap_maxval_c zap_maxval_sc #endif -typedef signed char zap_i8s; -typedef short zap_i01s; -typedef int zap_i02s; -typedef long zap_i04s; +#if \ + csys_arch_amd64 \ + || csys_arch_arm64 \ + || csys_arch_arm \ + || csys_arch_ia32 +/* int: 32 */ +#define zap_minval_i ((int) -0x80000000) + +#define zap_maxval_ui ((unsigned int)+0xFFFFFFFFu) +#define zap_maxval_i ((int) +0x7FFFFFFF) + +typedef unsigned int zap_i02; +typedef int zap_i02s; + +#define zap_minval_i02 zap_minval_ui +#define zap_minval_i02s zap_minval_i + +#define zap_maxval_i02 zap_maxval_ui +#define zap_maxval_i02s zap_maxval_i +#else +/* int: 16 */ +#define zap_minval_i ((int) -0x8000) -typedef zap_i8 zap_chr8; -typedef zap_i01 zap_chr01; -typedef zap_i02 zap_chr02; +#define zap_maxval_ui ((unsigned int)+0xFFFFu) +#define zap_maxval_i ((int) +0x7FFF) -typedef zap_i8 zap_bool; +typedef unsigned long zap_i02; +typedef long zap_i02s; -typedef zap_i8 zap_byte; +#define zap_minval_i02 zap_minval_ul +#define zap_minval_i02s zap_minval_l + +#define zap_maxval_i02 zap_maxval_ul +#define zap_maxval_i02s zap_maxval_l +#endif + +#if \ + csys_arch_amd64 \ + || csys_arch_arm64 +/* long: 64 */ +#define zap_minval_l ((long) -0x8000000000000000) + +#define zap_maxval_ul ((unsigned long)+0xFFFFFFFFFFFFFFFFu) +#define zap_maxval_l ((long) +0x7FFFFFFFFFFFFFFF) + +typedef unsigned long zap_i04; +typedef long zap_i04s; + +#define zap_minval_i04 zap_minval_ul +#define zap_minval_i04s zap_minval_l + +#define zap_maxval_i04 zap_maxval_ul +#define zap_maxval_i04s zap_maxval_l +#else +/* long: 32 */ +#define zap_minval_l ((long) -0x80000000) + +#define zap_maxval_ul ((unsigned long)+0xFFFFFFFFu) +#define zap_maxval_l ((long) +0x7FFFFFFF) + +typedef unsigned long long zap_i04; +typedef long long zap_i04s; + +#define zap_minval_i04 zap_minval_ull +#define zap_minval_i04s zap_minval_ll + +#define zap_maxval_i04 zap_maxval_ull +#define zap_maxval_i04s zap_maxval_ll +#endif #if \ csys_arch_arm \ || csys_arch_ia32 +#define zap_minval_ptr zap_minval_i02 +#define zap_minval_sz zap_minval_i02 +#define zap_maxval_ptr zap_maxval_i02 +#define zap_maxval_sz zap_maxval_i02 + typedef zap_i02 zap_ptr; typedef zap_i02 zap_sz; #else +#define zap_minval_ptr zap_minval_i04 +#define zap_minval_sz zap_minval_i04 +#define zap_maxval_ptr zap_maxval_i04 +#define zap_maxval_sz zap_maxval_i04 + typedef zap_i04 zap_ptr; typedef zap_i04 zap_sz; #endif diff --git a/zap/include/zap/mem.h b/zap/include/zap/mem.h index c1544d0..8110a85 100644 --- a/zap/include/zap/mem.h +++ b/zap/include/zap/mem.h @@ -11,18 +11,21 @@ zap_priv_cdecl -void zap_cp( void * zap_priv_restr dest,void const * zap_priv_restr src, zap_sz num); -zap_bool zap_eq( void const * lbuf,void const * rbuf,zap_sz num); -void zap_fill(void * dest,zap_byte val, zap_sz num); -void * zap_srch(void const * buf, zap_byte val, zap_sz num); - -zap_sz zap_utf8declen(zap_chr8 const * buf); -zap_sz zap_utf8enclen(zap_chr02 const * buf); - -void zap_utf8dec( zap_chr02 * zap_priv_restr dest,zap_chr8 const * zap_priv_restr src); -void zap_utf8enc( zap_chr8 * zap_priv_restr dest,zap_chr02 const * zap_priv_restr src); -void zap_win1252dec(zap_chr02 * zap_priv_restr dest,zap_chr8 const * zap_priv_restr src); -void zap_win1252enc(zap_chr8 * zap_priv_restr dest,zap_chr02 const * zap_priv_restr src); +void zap_cp( void * zap_priv_restr dest,void const * zap_priv_restr src, zap_sz num); +zap_i8 zap_eq( void const * lbuf,void const * rbuf,zap_sz num); +void zap_fill(void * dest,zap_i8 val, zap_sz num); +void * zap_srch(void const * buf, zap_i8 val, zap_sz num); + +zap_i8 zap_streq( char const * lstr,char const * rstr); +zap_sz zap_strlen(char const * str); + +zap_sz zap_utf8declen(zap_i8 const * buf); +zap_sz zap_utf8enclen(zap_i02 const * buf); + +void zap_utf8dec( zap_i02 * zap_priv_restr dest,zap_i8 const * zap_priv_restr src); +void zap_utf8enc( zap_i8 * zap_priv_restr dest,zap_i02 const * zap_priv_restr src); +void zap_win1252dec(zap_i02 * zap_priv_restr dest,zap_i8 const * zap_priv_restr src); +void zap_win1252enc(zap_i8 * zap_priv_restr dest,zap_i02 const * zap_priv_restr src); zap_priv_cdeclend |