#include <stdarg.h>
#include <string.h>
#include <limits.h>
Go to the source code of this file.
Classes | |
struct | bstrList |
struct | tagbstring |
Defines | |
#define | bchar(b, p) bchare ((b), (p), '\0') |
#define | bchare(b, p, e) ((((unsigned)(p)) < (unsigned)blength(b)) ? ((b)->data[(p)]) : (e)) |
#define | bdata(b) (bdataofs (b, 0)) |
#define | bdatae(b, e) (bdataofse (b, 0, e)) |
#define | bdataofs(b, o) (bdataofse ((b), (o), (void *)0)) |
#define | bdataofse(b, o, e) (((b) == (void *)0 || (b)->data == (void*)0) ? (unsigned char *)(e) : ((b)->data) + (o)) |
#define | biswriteprotected(t) ((t).mlen <= 0) |
#define | blength(b) (blengthe ((b), 0)) |
#define | blengthe(b, e) (((b) == (void *)0 || (b)->slen < 0) ? (int)(e) : ((b)->slen)) |
#define | blk2tbstr(t, s, l) |
#define | bmid2tbstr(t, b, p, l) |
#define | bsStatic(q) {-__LINE__, (int) sizeof(q)-1, (unsigned char *) ("" q "")} |
#define | bsStaticBlkParms(q) ((void *)("" q "")), ((int) sizeof(q)-1) |
#define | BSTR_BS_BUFF_LENGTH_GET (0) |
#define | BSTR_ERR (-1) |
#define | BSTR_OK (0) |
#define | bstrchr(b, c) bstrchrp ((b), (c), 0) |
#define | bstrrchr(b, c) bstrrchrp ((b), (c), blength(b)-1) |
#define | btfromcstr(t, s) |
#define | bwriteallow(t) { if ((t).mlen == -1) (t).mlen = (t).slen + ((t).slen == 0); } |
#define | bwriteprotect(t) { if ((t).mlen >= 0) (t).mlen = -1; } |
#define | cstr2bstr bfromcstr |
#define | cstr2tbstr btfromcstr |
Typedefs | |
typedef int(*) | bNgetc (void *parm) |
typedef size_t(*) | bNread (void *buff, size_t elsize, size_t nelem, void *parm) |
typedef tagbstring * | bstring |
Functions | |
int | balloc (bstring s, int len) |
int | bassign (bstring a, const bstring b) |
int | bassignformat (bstring b, const char *fmt,...) |
int | bassigngets (bstring b, bNgetc getcPtr, void *parm, char terminator) |
int | bassignmidstr (bstring a, const bstring b, int left, int len) |
int | bcatblk (bstring b, const unsigned char *s, int len) |
int | bcatcstr (bstring b, const char *s) |
int | bconcat (bstring b0, const bstring b1) |
int | bconchar (bstring b0, char c) |
int | bcstrfree (char *s) |
int | bdelete (bstring s1, int pos, int len) |
int | bdestroy (bstring b) |
int | bfindreplace (bstring b, const bstring find, const bstring repl, int pos) |
int | bfindreplacecaseless (bstring b, const bstring find, const bstring repl, int pos) |
bstring | bformat (const char *fmt,...) |
int | bformata (bstring b, const char *fmt,...) |
bstring | bfromcstr (const char *str) |
bstring | bfromcstralloc (int mlen, const char *str) |
bstring | bgets (bNgetc getcPtr, void *parm, char terminator) |
int | bgetsa (bstring b, bNgetc getcPtr, void *parm, char terminator) |
int | binchr (const bstring b0, int pos, const bstring b1) |
int | binchrr (const bstring b0, int pos, const bstring b1) |
int | binsert (bstring s1, int pos, const bstring s2, unsigned char fill) |
int | binsertch (bstring s1, int pos, int len, unsigned char fill) |
int | binstr (const bstring s1, int pos, const bstring s2) |
int | binstrcaseless (const bstring s1, int pos, const bstring s2) |
int | binstrr (const bstring s1, int pos, const bstring s2) |
int | binstrrcaseless (const bstring s1, int pos, const bstring s2) |
int | biseq (const bstring b0, const bstring b1) |
int | biseqcaseless (const bstring b0, const bstring b1) |
int | biseqcstr (const bstring b, const char *s) |
int | biseqcstrcaseless (const bstring b, const char *s) |
int | bisstemeqblk (const bstring b0, const void *blk, int len) |
int | bisstemeqcaselessblk (const bstring b0, const void *blk, int len) |
bstring | bjoin (const struct bstrList *bl, const bstring sep) |
bstring | blk2bstr (const void *blk, int len) |
int | bltrimws (bstring b) |
bstring | bmidstr (const bstring b, int left, int len) |
int | bninchr (const bstring b0, int pos, const bstring b1) |
int | bninchrr (const bstring b0, int pos, const bstring b1) |
int | bpattern (bstring b, int len) |
bstring | bread (bNread readPtr, void *parm) |
int | breada (bstring b, bNread readPtr, void *parm) |
int | breplace (bstring b1, int pos, int len, const bstring b2, unsigned char fill) |
int | brtrimws (bstring b) |
int | bsbufflength (struct bStream *s, int sz) |
void * | bsclose (struct bStream *s) |
int | bseof (const struct bStream *s) |
int | bsetstr (bstring b0, int pos, const bstring b1, unsigned char fill) |
bStream * | bsopen (bNread readPtr, void *parm) |
int | bspeek (bstring r, const struct bStream *s) |
bstrList * | bsplit (const bstring str, unsigned char splitChar) |
int | bsplitcb (const bstring str, unsigned char splitChar, int pos, int(*cb)(void *parm, int ofs, int len), void *parm) |
bstrList * | bsplits (const bstring str, const bstring splitStr) |
int | bsplitscb (const bstring str, const bstring splitStr, int pos, int(*cb)(void *parm, int ofs, int len), void *parm) |
int | bsread (bstring b, struct bStream *s, int n) |
int | bsreada (bstring b, struct bStream *s, int n) |
int | bsreadln (bstring b, struct bStream *s, char terminator) |
int | bsreadlna (bstring b, struct bStream *s, char terminator) |
int | bsreadlns (bstring r, struct bStream *s, const bstring term) |
int | bsreadlnsa (bstring r, struct bStream *s, const bstring term) |
int | bssplitscb (struct bStream *s, const bstring splitStr, int(*cb)(void *parm, int ofs, const bstring entry), void *parm) |
char * | bstr2cstr (const bstring s, char z) |
int | bstrchrp (const bstring b, int c, int pos) |
int | bstrcmp (const bstring b0, const bstring b1) |
bstring | bstrcpy (const bstring b1) |
int | bstricmp (const bstring b0, const bstring b1) |
int | bstrListDestroy (struct bstrList *sl) |
int | bstrncmp (const bstring b0, const bstring b1, int n) |
int | bstrnicmp (const bstring b0, const bstring b1, int n) |
int | bstrrchrp (const bstring b, int c, int pos) |
int | bsunread (struct bStream *s, const bstring b) |
int | btolower (bstring b) |
int | btoupper (bstring b) |
int | btrimws (bstring b) |
int | btrunc (bstring b, int n) |
#define bchar | ( | b, | |||
p | ) | bchare ((b), (p), '\0') |
#define bchare | ( | b, | |||
p, | |||||
e | ) | ((((unsigned)(p)) < (unsigned)blength(b)) ? ((b)->data[(p)]) : (e)) |
#define bdata | ( | b | ) | (bdataofs (b, 0)) |
#define bdatae | ( | b, | |||
e | ) | (bdataofse (b, 0, e)) |
#define bdataofs | ( | b, | |||
o | ) | (bdataofse ((b), (o), (void *)0)) |
#define bdataofse | ( | b, | |||
o, | |||||
e | ) | (((b) == (void *)0 || (b)->data == (void*)0) ? (unsigned char *)(e) : ((b)->data) + (o)) |
#define biswriteprotected | ( | t | ) | ((t).mlen <= 0) |
#define blength | ( | b | ) | (blengthe ((b), 0)) |
#define blengthe | ( | b, | |||
e | ) | (((b) == (void *)0 || (b)->slen < 0) ? (int)(e) : ((b)->slen)) |
#define blk2tbstr | ( | t, | |||
s, | |||||
l | ) |
Value:
{ \ (t).slen = l; \ (t).mlen = -1; \ (t).data = (unsigned char *) (s); \ }
#define bmid2tbstr | ( | t, | |||
b, | |||||
p, | |||||
l | ) |
Value:
{ \ bstring bstrtmp_s = (b); \ if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \ int bstrtmp_left = (p); \ int bstrtmp_len = (l); \ if (bstrtmp_left < 0) { \ bstrtmp_len += bstrtmp_left; \ bstrtmp_left = 0; \ } \ if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) \ bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \ if (bstrtmp_len <= 0) { \ (t).data = (unsigned char *)""; \ (t).slen = 0; \ } else { \ (t).data = bstrtmp_s->data + bstrtmp_left; \ (t).slen = bstrtmp_len; \ } \ } else { \ (t).data = (unsigned char *)""; \ (t).slen = 0; \ } \ (t).mlen = -__LINE__; \ }
#define bsStatic | ( | q | ) | {-__LINE__, (int) sizeof(q)-1, (unsigned char *) ("" q "")} |
#define bsStaticBlkParms | ( | q | ) | ((void *)("" q "")), ((int) sizeof(q)-1) |
#define BSTR_BS_BUFF_LENGTH_GET (0) |
#define BSTR_ERR (-1) |
#define BSTR_OK (0) |
#define bstrchr | ( | b, | |||
c | ) | bstrchrp ((b), (c), 0) |
#define bstrrchr | ( | b, | |||
c | ) | bstrrchrp ((b), (c), blength(b)-1) |
#define btfromcstr | ( | t, | |||
s | ) |
Value:
{ \ (t).data = (unsigned char *) (s); \ (t).slen = ((t).data) ? ((int) (strlen) ((char *)(t).data)) : 0; \ (t).mlen = -1; \ }
#define bwriteallow | ( | t | ) | { if ((t).mlen == -1) (t).mlen = (t).slen + ((t).slen == 0); } |
#define bwriteprotect | ( | t | ) | { if ((t).mlen >= 0) (t).mlen = -1; } |
#define cstr2bstr bfromcstr |
#define cstr2tbstr btfromcstr |
typedef int(*) bNgetc(void *parm) |
typedef size_t(* ) bNread(void *buff, size_t elsize, size_t nelem, void *parm) |
typedef struct tagbstring* bstring |
int balloc | ( | bstring | s, | |
int | len | |||
) |
int bassignformat | ( | bstring | b, | |
const char * | fmt, | |||
... | ||||
) |
int bcatblk | ( | bstring | b, | |
const unsigned char * | s, | |||
int | len | |||
) |
int bcatcstr | ( | bstring | b, | |
const char * | s | |||
) |
int bconchar | ( | bstring | b0, | |
char | c | |||
) |
int bcstrfree | ( | char * | s | ) |
int bdelete | ( | bstring | s1, | |
int | pos, | |||
int | len | |||
) |
int bdestroy | ( | bstring | b | ) |
bstring bformat | ( | const char * | fmt, | |
... | ||||
) |
int bformata | ( | bstring | b, | |
const char * | fmt, | |||
... | ||||
) |
bstring bfromcstr | ( | const char * | str | ) |
bstring bfromcstralloc | ( | int | mlen, | |
const char * | str | |||
) |
int binsertch | ( | bstring | s1, | |
int | pos, | |||
int | len, | |||
unsigned char | fill | |||
) |
int biseqcstr | ( | const bstring | b, | |
const char * | s | |||
) |
int biseqcstrcaseless | ( | const bstring | b, | |
const char * | s | |||
) |
int bisstemeqblk | ( | const bstring | b0, | |
const void * | blk, | |||
int | len | |||
) |
int bisstemeqcaselessblk | ( | const bstring | b0, | |
const void * | blk, | |||
int | len | |||
) |
bstring blk2bstr | ( | const void * | blk, | |
int | len | |||
) |
int bltrimws | ( | bstring | b | ) |
int bpattern | ( | bstring | b, | |
int | len | |||
) |
int brtrimws | ( | bstring | b | ) |
int bsbufflength | ( | struct bStream * | s, | |
int | sz | |||
) |
void* bsclose | ( | struct bStream * | s | ) |
int bseof | ( | const struct bStream * | s | ) |
int bsplitcb | ( | const bstring | str, | |
unsigned char | splitChar, | |||
int | pos, | |||
int(*)(void *parm, int ofs, int len) | cb, | |||
void * | parm | |||
) |
int bsplitscb | ( | const bstring | str, | |
const bstring | splitStr, | |||
int | pos, | |||
int(*)(void *parm, int ofs, int len) | cb, | |||
void * | parm | |||
) |
int bssplitscb | ( | struct bStream * | s, | |
const bstring | splitStr, | |||
int(*)(void *parm, int ofs, const bstring entry) | cb, | |||
void * | parm | |||
) |
char* bstr2cstr | ( | const bstring | s, | |
char | z | |||
) |
int bstrchrp | ( | const bstring | b, | |
int | c, | |||
int | pos | |||
) |
int bstrListDestroy | ( | struct bstrList * | sl | ) |
int bstrrchrp | ( | const bstring | b, | |
int | c, | |||
int | pos | |||
) |
int btolower | ( | bstring | b | ) |
int btoupper | ( | bstring | b | ) |
int btrimws | ( | bstring | b | ) |
int btrunc | ( | bstring | b, | |
int | n | |||
) |