Lines Matching refs:bstring
2 * This source file is part of the bstring string library. This code was
11 * This file is the core module for implementing the bstring functions.
91 /* int balloc (bstring b, int len)
93 * Increase the size of the memory backing the bstring b to at least len.
95 int balloc (bstring b, int olen) {
151 /* int ballocmin (bstring b, int len)
153 * Set the size of the memory backing the bstring b to len or b->slen+1,
157 int ballocmin (bstring b, int len) {
178 /* bstring bfromcstr (const char * str)
180 * Create a bstring which contains the contents of the '\0' terminated char *
183 bstring bfromcstr (const char * str) {
184 bstring b;
193 b = (bstring) bstr__alloc (sizeof (struct tagbstring));
205 /* bstring bfromcstralloc (int mlen, const char * str)
207 * Create a bstring which contains the contents of the '\0' terminated char *
211 bstring bfromcstralloc (int mlen, const char * str) {
212 bstring b;
221 b = (bstring) bstr__alloc (sizeof (struct tagbstring));
235 /* bstring blk2bstr (const void * blk, int len)
237 * Create a bstring which contains the content of the block blk of length
240 bstring blk2bstr (const void * blk, int len) {
241 bstring b;
245 b = (bstring) bstr__alloc (sizeof (struct tagbstring));
269 * the bstring s, except that any contained '\0' characters are converted
310 /* int bconcat (bstring b0, const_bstring b1)
312 * Concatenate the bstring b1 to the bstring b0.
314 int bconcat (bstring b0, const_bstring b1) {
316 bstring aux = (bstring) b1;
342 /* int bconchar (bstring b, char c)
344 * Concatenate the single character c to the bstring b.
346 int bconchar (bstring b, char c) {
358 /* int bcatcstr (bstring b, const char * s)
360 * Concatenate a char * string to a bstring.
362 int bcatcstr (bstring b, const char * s) {
384 /* int bcatblk (bstring b, const void * s, int len)
386 * Concatenate a fixed length buffer to a bstring.
388 int bcatblk (bstring b, const void * s, int len) {
403 /* bstring bstrcpy (const_bstring b)
405 * Create a copy of the bstring b.
407 bstring bstrcpy (const_bstring b) {
408 bstring b0;
414 b0 = (bstring) bstr__alloc (sizeof (struct tagbstring));
443 /* int bassign (bstring a, const_bstring b)
447 int bassign (bstring a, const_bstring b) {
463 /* int bassignmidstr (bstring a, const_bstring b, int left, int len)
469 int bassignmidstr (bstring a, const_bstring b, int left, int len) {
495 /* int bassigncstr (bstring a, const char * str)
498 * the bstring a must be a well defined and writable bstring. If an error
501 int bassigncstr (bstring a, const char * str) {
524 /* int bassignblk (bstring a, const void * s, int len)
527 * the bstring a must be a well defined and writable bstring. If an error
530 int bassignblk (bstring a, const void * s, int len) {
541 /* int btrunc (bstring b, int n)
543 * Truncate the bstring to at most n characters.
545 int btrunc (bstring b, int n) {
559 /* int btoupper (bstring b)
561 * Convert contents of bstring to upper case.
563 int btoupper (bstring b) {
573 /* int btolower (bstring b)
575 * Convert contents of bstring to lower case.
577 int btolower (bstring b) {
714 * int bltrimws (bstring b)
718 int bltrimws (bstring b) {
736 * int brtrimws (bstring b)
740 int brtrimws (bstring b) {
760 * int btrimws (bstring b)
764 int btrimws (bstring b) {
823 * Compare the bstring b and char * string s. The C string s must be '\0'
824 * terminated at exactly the length of the bstring b, and the contents
825 * between the two must be identical with the bstring b with no '\0'
843 * Compare the bstring b and char * string s. The C string s must be '\0'
844 * terminated at exactly the length of the bstring b, and the contents
845 * between the two must be identical except for case with the bstring b with
932 /* bstring bmidstr (const_bstring b, int left, int len)
934 * Create a bstring which is the substring of b starting from position left
935 * and running for a length len (clamped by the end of the bstring b.) If
939 bstring bmidstr (const_bstring b, int left, int len) {
954 /* int bdelete (bstring b, int pos, int len)
957 * the bstring starting from pos+len to pos. len must be positive for this
959 * len) is clamped to boundaries of the bstring b.
961 int bdelete (bstring b, int pos, int len) {
962 /* Clamp to left side of bstring */
985 /* int bdestroy (bstring b)
987 * Free up the bstring. Note that if b is detectably invalid or not writable
992 int bdestroy (bstring b) {
1012 * Search for the bstring b2 in b1 starting from position pos, and searching
1099 * Search for the bstring b2 in b1 starting from position pos, and searching
1146 * Search for the bstring b2 in b1 starting from position pos, and searching
1194 * Search for the bstring b2 in b1 starting from position pos, and searching
1291 /* Convert a bstring to charField */
1389 /* int bsetstr (bstring b0, int pos, bstring b1, unsigned char fill)
1396 int bsetstr (bstring b0, int pos, const_bstring b1, unsigned char fill) {
1399 bstring aux = (bstring) b1;
1444 /* int binsert (bstring b1, int pos, bstring b2, unsigned char fill)
1451 int binsert (bstring b1, int pos, const_bstring b2, unsigned char fill) {
1454 bstring aux = (bstring) b2;
1492 /* int breplace (bstring b1, int pos, int len, bstring b2,
1498 int breplace (bstring b1, int pos, int len, const_bstring b2,
1502 bstring aux = (bstring) b2;
1539 /* int bfindreplace (bstring b, const_bstring find, const_bstring repl,
1543 * given point in a bstring.
1548 static int findreplaceengine (bstring b, const_bstring find, const_bstring repl, int pos, instr_fnptr instr) {
1553 bstring auxf = (bstring) find;
1554 bstring auxr = (bstring) repl;
1675 /* int bfindreplace (bstring b, const_bstring find, const_bstring repl,
1679 * given point in a bstring.
1681 int bfindreplace (bstring b, const_bstring find, const_bstring repl, int pos) {
1685 /* int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl,
1689 * string after a given point in a bstring.
1691 int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl, int pos) {
1695 /* int binsertch (bstring b, int pos, int len, unsigned char fill)
1702 int binsertch (bstring b, int pos, int len, unsigned char fill) {
1732 /* int bpattern (bstring b, int len)
1734 * Replicate the bstring, b in place, end to end repeatedly until it
1739 int bpattern (bstring b, int len) {
1755 /* int breada (bstring b, bNread readPtr, void * parm)
1758 * bstring b the entire contents of file-like source data in a roughly
1761 int breada (bstring b, bNread readPtr, void * parm) {
1780 /* bstring bread (bNread readPtr, void * parm)
1782 * Use a finite buffer fread-like function readPtr to create a bstring
1786 bstring bread (bNread readPtr, void * parm) {
1787 bstring buff;
1796 /* int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator)
1800 * bstring b. The stream read is terminated by the passed in terminator
1809 int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator) {
1834 /* int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator)
1838 * bstring b. The stream read is terminated by the passed in terminator
1847 int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator) {
1872 /* bstring bgetstream (bNgetc getcPtr, void * parm, char terminator)
1875 * obtain a sequence of characters which are concatenated into a bstring.
1883 bstring bgetstream (bNgetc getcPtr, void * parm, char terminator) {
1884 bstring buff;
1894 bstring buff; /* Buffer for over-reads */
1904 * pointer and stream handle) into an open bStream suitable for the bstring
1957 /* int bsreadlna (bstring r, struct bStream * s, char terminator)
1959 * Read a bstring terminated by the terminator character or the end of the
1964 int bsreadlna (bstring r, struct bStream * s, char terminator) {
2021 /* int bsreadlnsa (bstring r, struct bStream * s, bstring term)
2023 * Read a bstring terminated by any character in the term string or the end
2028 int bsreadlnsa (bstring r, struct bStream * s, const_bstring term) {
2091 /* int bsreada (bstring r, struct bStream * s, int n)
2093 * Read a bstring of length n (or, if it is fewer, as many bytes as is
2099 int bsreada (bstring r, struct bStream * s, int n) {
2156 /* int bsreadln (bstring r, struct bStream * s, char terminator)
2158 * Read a bstring terminated by the terminator character or the end of the
2163 int bsreadln (bstring r, struct bStream * s, char terminator) {
2171 /* int bsreadlns (bstring r, struct bStream * s, bstring term)
2173 * Read a bstring terminated by any character in the term string or the end
2178 int bsreadlns (bstring r, struct bStream * s, const_bstring term) {
2188 /* int bsread (bstring r, struct bStream * s, int n)
2190 * Read a bstring of length n (or, if it is fewer, as many bytes as is
2196 int bsread (bstring r, struct bStream * s, int n) {
2206 * Insert a bstring into the bStream at the current position. These
2215 /* int bspeek (bstring r, const struct bStream * s)
2220 int bspeek (bstring r, const struct bStream * s) {
2225 /* bstring bjoin (const struct bstrList * bl, const_bstring sep);
2227 * Join the entries of a bstrList into one bstring by sequentially
2229 * NULL is returned, otherwise a bstring with the correct result is returned.
2231 bstring bjoin (const struct bstrList * bl, const_bstring sep) {
2232 bstring b;
2247 b = (bstring) bstr__alloc (sizeof (struct tagbstring));
2293 bstring buff;
2358 bstring buff;
2408 sl->entry = (bstring *) bstr__alloc (1*sizeof (bstring));
2447 bstring * l;
2453 nsz = ((size_t) smsz) * sizeof (bstring);
2455 l = (bstring *) bstr__realloc (sl->entry, nsz);
2458 nsz = ((size_t) smsz) * sizeof (bstring);
2459 l = (bstring *) bstr__realloc (sl->entry, nsz);
2473 bstring * l;
2478 nsz = ((size_t) msz) * sizeof (bstring);
2480 l = (bstring *) bstr__realloc (sl->entry, nsz);
2609 bstring b;
2617 bstring * tbl;
2624 tbl = (bstring *) bstr__realloc (g->bl->entry, sizeof (bstring) * mlen);
2649 g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring));
2655 g.b = (bstring) str;
2677 g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring));
2683 g.b = (bstring) str;
2692 /* struct bstrList * bsplits (const_bstring str, bstring splitStr)
2708 g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring));
2713 g.b = (bstring) str;
2763 /* int bformata (bstring b, const char * fmt, ...)
2767 * a bstring which contains what would have been output. Note that if there
2768 * is an early generation of a '\0' character, the bstring will be truncated
2771 int bformata (bstring b, const char * fmt, ...) {
2773 bstring buff;
2812 /* int bassignformat (bstring b, const char * fmt, ...)
2816 * the bstring parameter b. Note that if there is an early generation of a
2817 * '\0' character, the bstring will be truncated to this end point.
2819 int bassignformat (bstring b, const char * fmt, ...) {
2821 bstring buff;
2860 /* bstring bformat (const char * fmt, ...)
2863 * to stdio, it forms a bstring which contains what would have been output.
2865 * bstring will be truncated to this end point.
2867 bstring bformat (const char * fmt, ...) {
2869 bstring buff;
2905 /* int bvcformata (bstring b, int count, const char * fmt, va_list arglist)
2922 * is an early generation of a '\0' character, the bstring will be truncated
2925 int bvcformata (bstring b, int count, const char * fmt, va_list arg) {