Mercurial > libpst
comparison src/vbuf.h @ 172:6954d315aaa8
move version-info into main configure.in, and set it properly.
prefix all external symbols in the shared library with pst_ to avoid symbol clashes with other shared libraries.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sat, 04 Apr 2009 16:00:48 -0700 |
parents | cda7c812ec01 |
children | ac6e22c8a9cf |
comparison
equal
deleted
inserted
replaced
171:6c1e75bc4cac | 172:6954d315aaa8 |
---|---|
37 | 37 |
38 | 38 |
39 typedef struct varbuf vbuf; | 39 typedef struct varbuf vbuf; |
40 typedef struct varstr vstr; | 40 typedef struct varstr vstr; |
41 | 41 |
42 #define VBUF_STATIC(x,y) static vbuf *x = NULL; if(!x) x = vballoc(y); | 42 #define VBUF_STATIC(x,y) static vbuf *x = NULL; if(!x) x = pst_vballoc(y); |
43 #define VSTR_STATIC(x,y) static vstr *x = NULL; if(!x) x = vsalloc(y); | 43 #define VSTR_STATIC(x,y) static vstr *x = NULL; if(!x) x = pst_vsalloc(y); |
44 | 44 |
45 int skip_nl( char *s ); // returns the width of the newline at s[0] | 45 int pst_skip_nl( char *s ); // returns the width of the newline at s[0] |
46 int find_nl( vstr *vs ); // find newline of type type in b | 46 int pst_find_nl( vstr *vs ); // find newline of type type in b |
47 | 47 |
48 // vbuf functions | 48 // vbuf functions |
49 struct varbuf *vballoc( size_t len ); | 49 vbuf *pst_vballoc( size_t len ); |
50 void vbfree( vbuf *vb ); | 50 void pst_vbfree( vbuf *vb ); |
51 void vbclear( vbuf *vb ); //ditch the data, keep the buffer | 51 void pst_vbclear( vbuf *vb ); //ditch the data, keep the buffer |
52 void vbresize( vbuf *vb, size_t len ); | 52 void pst_vbresize( vbuf *vb, size_t len ); |
53 size_t vbavail( vbuf *vb ); | 53 size_t pst_vbavail( vbuf *vb ); |
54 void vbdump( vbuf *vb ); | 54 void pst_vbdump( vbuf *vb ); |
55 void vbgrow( vbuf *vb, size_t len ); // grow buffer by len bytes, data are preserved | 55 void pst_vbgrow( vbuf *vb, size_t len ); // grow buffer by len bytes, data are preserved |
56 void vbset( vbuf *vb, void *data, size_t len ); | 56 void pst_vbset( vbuf *vb, void *data, size_t len ); |
57 void vbskipws( vbuf *vb ); | 57 void pst_vbskipws( vbuf *vb ); |
58 void vbappend( vbuf *vb, void *data, size_t length ); | 58 void pst_vbappend( vbuf *vb, void *data, size_t length ); |
59 void vbskip( vbuf *vb, size_t skip ); | 59 void pst_vbskip( vbuf *vb, size_t skip ); |
60 void vboverwrite( vbuf *vbdest, vbuf *vbsrc ); | 60 void pst_vboverwrite( vbuf *vbdest, vbuf *vbsrc ); |
61 | 61 |
62 // vstr functions | 62 // vstr functions |
63 vstr *vsalloc( size_t len ); | 63 vstr *pst_vsalloc( size_t len ); |
64 char *vsb( vstr *vs ); | 64 char *pst_vsb( vstr *vs ); |
65 size_t vslen( vstr *vs ); //strlen | 65 size_t pst_vslen( vstr *vs ); //strlen |
66 void vsfree( vstr *vs ); | 66 void pst_vsfree( vstr *vs ); |
67 void vsset( vstr *vs, char *s ); // Store string s in vb | 67 void pst_vsset( vstr *vs, char *s ); // Store string s in vb |
68 void vsnset( vstr *vs, char *s, size_t n ); // Store string s in vb | 68 void pst_vsnset( vstr *vs, char *s, size_t n ); // Store string s in vb |
69 void vsgrow( vstr *vs, size_t len ); // grow buffer by len bytes, data are preserved | 69 void pst_vsgrow( vstr *vs, size_t len ); // grow buffer by len bytes, data are preserved |
70 size_t vsavail( vstr *vs ); | 70 size_t pst_vsavail( vstr *vs ); |
71 void vscat( vstr *vs, char *str ); | 71 void pst_vscat( vstr *vs, char *str ); |
72 void vsncat( vstr *vs, char *str, size_t len ); | 72 void pst_vsncat( vstr *vs, char *str, size_t len ); |
73 void vsnprepend( vstr *vs, char *str, size_t len ) ; | 73 void pst_vsnprepend( vstr *vs, char *str, size_t len ) ; |
74 void vsskip( vstr *vs, size_t len ); | 74 void pst_vsskip( vstr *vs, size_t len ); |
75 int vscmp( vstr *vs, char *str ); | 75 int pst_vscmp( vstr *vs, char *str ); |
76 void vsskipws( vstr *vs ); | 76 void pst_vsskipws( vstr *vs ); |
77 void vs_printf( vstr *vs, char *fmt, ... ); | 77 void pst_vs_printf( vstr *vs, char *fmt, ... ); |
78 void vs_printfa( vstr *vs, char *fmt, ... ); | 78 void pst_vs_printfa( vstr *vs, char *fmt, ... ); |
79 void vshexdump( vstr *vs, const char *b, size_t start, size_t stop, int ascii ); | 79 void pst_vshexdump( vstr *vs, const char *b, size_t start, size_t stop, int ascii ); |
80 int vscatprintf( vstr *vs, char *fmt, ... ); | 80 int pst_vscatprintf( vstr *vs, char *fmt, ... ); |
81 void vsvprintf( vstr *vs, char *fmt, va_list ap ); | 81 void pst_vsvprintf( vstr *vs, char *fmt, va_list ap ); |
82 void vstrunc( vstr *vs, size_t off ); // Drop chars [off..dlen] | 82 void pst_vstrunc( vstr *vs, size_t off ); // Drop chars [off..dlen] |
83 int vslast( vstr *vs ); // returns the last character stored in a vstr string | 83 int pst_vslast( vstr *vs ); // returns the last character stored in a vstr string |
84 void vscharcat( vstr *vs, int ch ); | 84 void pst_vscharcat( vstr *vs, int ch ); |
85 | 85 |
86 | 86 |
87 void unicode_init(); | 87 void pst_unicode_init(); |
88 void unicode_close(); | 88 void pst_unicode_close(); |
89 size_t vb_utf16to8(vbuf *dest, const char *inbuf, int iblen); | 89 size_t pst_vb_utf16to8(vbuf *dest, const char *inbuf, int iblen); |
90 size_t vb_utf8to8bit(vbuf *dest, const char *inbuf, int iblen, const char* charset); | 90 size_t pst_vb_utf8to8bit(vbuf *dest, const char *inbuf, int iblen, const char* charset); |
91 size_t vb_8bit2utf8(vbuf *dest, const char *inbuf, int iblen, const char* charset); | 91 size_t pst_vb_8bit2utf8(vbuf *dest, const char *inbuf, int iblen, const char* charset); |
92 | 92 |
93 int vb_skipline( struct varbuf *vb ); // in: vb->b == "stuff\nmore_stuff"; out: vb->b == "more_stuff" | 93 int pst_vb_skipline( struct varbuf *vb ); // in: vb->b == "stuff\nmore_stuff"; out: vb->b == "more_stuff" |
94 | 94 |
95 | 95 |
96 #endif // VBUF_H | 96 #endif // VBUF_H |