# vbuf.h

Go to the documentation of this file.

    00001
    00002 #ifndef __PST_VBUF_H
    00003 #define __PST_VBUF_H
    00004
    00005 #include "common.h"
    00006
    00007
    00008 // Variable-length buffers
    00009 struct pst_varbuf {
    00010     size_t dlen;    //length of data stored in buffer
    00011     size_t blen;    //length of buffer
    00012     char *buf;      //buffer
    00013     char *b;        //start of stored data
    00014 };
    00015
    00016
    00017 typedef struct pst_varbuf pst_vbuf;
    00018
    00019 pst_vbuf  *pst_vballoc(size_t len);
    00020 void       pst_vbgrow(pst_vbuf *vb, size_t len);    // grow buffer by len bytes, data are preserved
    00021 void       pst_vbset(pst_vbuf *vb, void *data, size_t len);
    00022 void       pst_vbappend(pst_vbuf *vb, void *data, size_t length);
    00023 void       pst_unicode_init();
    00024 size_t     pst_vb_utf16to8(pst_vbuf *dest, const char *inbuf, int iblen);
    00025 size_t     pst_vb_utf8to8bit(pst_vbuf *dest, const char *inbuf, int iblen, const char* charset);
    00026 size_t     pst_vb_8bit2utf8(pst_vbuf *dest, const char *inbuf, int iblen, const char* charset);
    00027
    00028
    00029 #endif