|
#define | zAssert(func, expr) |
|
#define | _zMax(x, y) ( (x)>=(y) ? (x) : (y) ) |
|
#define | _zMin(x, y) ( (x)<=(y) ? (x) : (y) ) |
|
#define | _zLimit(x, l, u) ( (x)<=(l) ? (l) : ( (x)>=(u) ? (u) : (x) ) ) |
|
#define | zSwap(type, a, b) |
| swap values of two data a and b. type the data type of a and b. More...
|
|
#define | zAlloc(t, n) ( (n) == 0 ? NULL : (t *)calloc( (n), sizeof(t) ) ) |
|
#define | zAllocZero(t, n) ( (n) == 0 ? NULL : (t *)calloc( (n), sizeof(t) ) ) |
|
#define | zFree(m) do{ if( (m) ){ free( m ); (m) = NULL; } } while(0) |
|
#define | zCopy(t, s, d) ( (t *)memcpy( d, s, sizeof(t) ) ) |
|
#define | zRealloc(m, t, n) (t *)realloc( (void *)m, sizeof(t)*(n) ) |
|
#define | eprintf(fmt, ...) fprintf( stderr, fmt, ##__VA_ARGS__ ) |
| formatted output to stderr. More...
|
|
#define | zEchoOn() ( __zeda_echo = true ) |
|
#define | zEchoOff() ( __zeda_echo = false ) |
|
#define | ZECHO(msg, ...) ( __zeda_echo ? eprintf( msg " (%s).\n", ##__VA_ARGS__, __FUNCTION__ ) : 0 ) |
|
#define | ZRUNERROR(msg, ...) ZECHO( "run-time error: " msg, ##__VA_ARGS__ ) |
|
#define | ZRUNWARN(msg, ...) ZECHO( "warning: " msg, ##__VA_ARGS__ ) |
|
#define | ZOPENERROR(m) ZRUNERROR( "cannot open file: %s", (m) ) |
|
#define | ZALLOCERROR() ZRUNERROR( "cannot allocate memory" ) |
|
#define | itoa_zerofill(v, s, b) itoa_fill( (v), (s), '0', (b) ) |
| convert an integer to a string with blank filled by a charactor-zero. More...
|
|
|
double | zMax (double x, double y) |
|
double | zMin (double x, double y) |
|
double | zLimit (double x, double l, double u) |
|
double | zBound (double x, double b1, double b2) |
| return a saturated value of x with two boundaries b1 and b2, where the magnitude relation between b1 and b2 does not matter. More...
|
|
void * | zClone (void *src, size_t size) |
| clone a memory space. More...
|
|
size_t | zFileSize (FILE *fp) |
| count the size of a file. More...
|
|
int | fpeek (FILE *fp) |
| peek charactor. More...
|
|
int | atox_c (char c) |
| convert a hexadecimal note to a value. More...
|
|
int | atox (char *str) |
| convert hexadecimal string to value. More...
|
|
char * | itoa (int val, char *buf) |
| convert an integer to a string. More...
|
|
char * | ftoa (double val, char *buf) |
| convert a d-float value to a string. More...
|
|
char * | itoa_fill (int val, int size, char pat, char *buf) |
| convert an integer to a string with a blank filled by a charactor. More...
|
|
char * | itoa_ordinal (int val, char *buf, size_t size) |
| convert an integer number to a string that represents an ordinal. More...
|
|