Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

vbuf.c File Reference

#include <ctype.h>
#include <errno.h>
#include <iconv.h>
#include <limits.h>
#include <malloc.h>
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "define.h"
#include "vbuf.h"

Go to the source code of this file.

Defines

#define STUPID_CR   "\r\n"
#define ASSERT(x,)   { if( !(x) ) DIE(( __VA_ARGS__)); }

Functions

int skip_nl (char *s)
int find_nl (vstr *vs)
void unicode_init ()
void unicode_close ()
int utf16_is_terminated (char *str, int length)
int vb_utf16to8 (vbuf *dest, char *buf, int len)
int utf8to16 (char *inbuf_o, int iblen, char *outbuf_o, int oblen)
int vb_utf8to16T (vbuf *bout, char *cin, int inlen)
void cheap_uni2ascii (char *src, char *dest, int l)
void cheap_ascii2uni (char *src, char *dest, int l)
vbufvballoc (size_t len)
void vbcheck (vbuf *vb)
void vbfree (vbuf *vb)
void vbclear (struct varbuf *vb)
void vbresize (struct varbuf *vb, size_t len)
size_t vbavail (vbuf *vb)
void vbgrow (struct varbuf *vb, size_t len)
void vbset (vbuf *vb, void *b, size_t len)
void vsskipws (vstr *vs)
void vbappend (struct varbuf *vb, void *b, size_t len)
void vbskip (struct varbuf *vb, size_t skip)
void vboverwrite (struct varbuf *vbdest, struct varbuf *vbsrc)
vstrvsalloc (size_t len)
char * vsstr (vstr *vs)
size_t vslen (vstr *vs)
void vsfree (vstr *vs)
void vscharcat (vstr *vb, int ch)
void vsnprepend (vstr *vb, char *str, size_t len)
void vsskip (vstr *vs, size_t len)
int vsskipline (vstr *vs)
int vscatprintf (vstr *vs, char *fmt,...)
int vslast (vstr *vs)
void vs_printf (vstr *vs, char *fmt,...)
void vs_printfa (vstr *vs, char *fmt,...)
void vshexdump (vstr *vs, char *b, size_t start, size_t stop, int ascii)
void vsset (vstr *vs, char *s)
void vsnset (vstr *vs, char *s, size_t n)
void vsgrow (vstr *vs, size_t len)
size_t vsavail (vstr *vs)
void vsnset16 (vstr *vs, char *s, size_t len)
void vscat (vstr *vs, char *str)
int vscmp (vstr *vs, char *str)
void vsncat (vstr *vs, char *str, size_t len)
void vstrunc (vstr *v, size_t off)

Variables

char * wwbuf = NULL
size_t nwwbuf = 0
int unicode_up = 0
iconv_t i16to8
iconv_t i8to16
iconv_t i8859_1to8
iconv_t i8toi8859_1


Define Documentation

#define ASSERT  )     { if( !(x) ) DIE(( __VA_ARGS__)); }
 

Definition at line 21 of file vbuf.c.

#define STUPID_CR   "\r\n"
 

Definition at line 20 of file vbuf.c.


Function Documentation

void cheap_ascii2uni char *  src,
char *  dest,
int  l
 

Definition at line 265 of file vbuf.c.

void cheap_uni2ascii char *  src,
char *  dest,
int  l
 

Definition at line 252 of file vbuf.c.

int find_nl vstr vs  ) 
 

Definition at line 36 of file vbuf.c.

References varstr::b, varstr::dlen, and vstr.

Referenced by vsskipline().

int skip_nl char *  s  ) 
 

Definition at line 24 of file vbuf.c.

Referenced by vsskipline().

void unicode_close  ) 
 

Definition at line 101 of file vbuf.c.

References i16to8, i8859_1to8, i8to16, i8toi8859_1, and unicode_up.

Referenced by unicode_init().

void unicode_init  ) 
 

Definition at line 66 of file vbuf.c.

References ASSERT, i16to8, i8859_1to8, i8to16, i8toi8859_1, unicode_close(), unicode_up, and utf8to16().

Referenced by pst_open(), vb_utf16to8(), and vb_utf8to16T().

int utf16_is_terminated char *  str,
int  length
 

Definition at line 111 of file vbuf.c.

References vshexdump(), VSTR_STATIC, and WARN.

Referenced by vb_utf16to8().

int utf8to16 char *  inbuf_o,
int  iblen,
char *  outbuf_o,
int  oblen
 

Definition at line 191 of file vbuf.c.

References ASSERT, DIE, and i8to16.

Referenced by unicode_init().

int vb_utf16to8 vbuf dest,
char *  buf,
int  len
 

Definition at line 131 of file vbuf.c.

References ASSERT, varbuf::b, varbuf::blen, DIE, varbuf::dlen, i16to8, unicode_init(), unicode_up, utf16_is_terminated(), vb_utf8to16T(), vbgrow(), vbresize(), vbuf, and VBUF_STATIC.

Referenced by pst_parse_block().

int vb_utf8to16T vbuf bout,
char *  cin,
int  inlen
 

Definition at line 217 of file vbuf.c.

References varbuf::b, varbuf::blen, varbuf::dlen, i8to16, unicode_init(), vbgrow(), vbresize(), vbuf, and WARN.

Referenced by vb_utf16to8().

vbuf* vballoc size_t  len  ) 
 

Definition at line 275 of file vbuf.c.

References varbuf::blen, varbuf::buf, DIE, varbuf::dlen, vbresize(), and vbuf.

Referenced by pst_parse_block(), and vsalloc().

void vbappend struct varbuf vb,
void *  b,
size_t  len
 

Definition at line 398 of file vbuf.c.

References varbuf::b, varbuf::dlen, vbgrow(), and vbset().

size_t vbavail vbuf vb  ) 
 

Definition at line 326 of file vbuf.c.

References varbuf::b, varbuf::blen, varbuf::buf, varbuf::dlen, and vbuf.

Referenced by vbgrow(), and vsavail().

void vbcheck vbuf vb  ) 
 

Definition at line 289 of file vbuf.c.

References ASSERT, varbuf::b, varbuf::blen, varbuf::buf, varbuf::dlen, and vbuf.

void vbclear struct varbuf vb  ) 
 

Definition at line 305 of file vbuf.c.

References vbresize().

void vbfree vbuf vb  ) 
 

Definition at line 298 of file vbuf.c.

References varbuf::buf, and vbuf.

Referenced by vsfree().

void vbgrow struct varbuf vb,
size_t  len
 

Definition at line 346 of file vbuf.c.

References ASSERT, varbuf::b, varbuf::blen, varbuf::buf, DIE, varbuf::dlen, vbavail(), and vbresize().

void vboverwrite struct varbuf vbdest,
struct varbuf vbsrc
 

Definition at line 420 of file vbuf.c.

References varbuf::b, varbuf::blen, varbuf::dlen, and vbresize().

void vbresize struct varbuf vb,
size_t  len
 

Definition at line 311 of file vbuf.c.

References varbuf::b, varbuf::blen, varbuf::buf, and varbuf::dlen.

void vbset vbuf vb,
void *  b,
size_t  len
 

Definition at line 378 of file vbuf.c.

References varbuf::b, varbuf::dlen, vbresize(), and vbuf.

Referenced by pst_parse_block(), and vbappend().

void vbskip struct varbuf vb,
size_t  skip
 

Definition at line 411 of file vbuf.c.

References ASSERT, varbuf::b, and varbuf::dlen.

void vs_printf vstr vs,
char *  fmt,
  ...
 

Definition at line 556 of file vbuf.c.

References varbuf::b, varbuf::blen, varbuf::dlen, vbresize(), vbuf, and vstr.

void vs_printfa vstr vs,
char *  fmt,
  ...
 

Definition at line 585 of file vbuf.c.

References varbuf::b, varstr::blen, varbuf::blen, varstr::dlen, varbuf::dlen, vbgrow(), vbuf, and vstr.

Referenced by vshexdump().

vstr* vsalloc size_t  len  ) 
 

Definition at line 429 of file vbuf.c.

References vballoc(), vsset(), and vstr.

size_t vsavail vstr vs  ) 
 

Definition at line 665 of file vbuf.c.

References vbavail(), vbuf, and vstr.

void vscat vstr vs,
char *  str
 

Definition at line 682 of file vbuf.c.

References vsncat(), and vstr.

int vscatprintf vstr vs,
char *  fmt,
  ...
 

Definition at line 511 of file vbuf.c.

References varstr::b, varstr::blen, varbuf::blen, varstr::dlen, vbgrow(), vbuf, vsset(), and vstr.

void vscharcat vstr vb,
int  ch
 

Definition at line 455 of file vbuf.c.

References varbuf::b, varbuf::dlen, vbgrow(), vbuf, and vstr.

int vscmp vstr vs,
char *  str
 

Definition at line 688 of file vbuf.c.

References varstr::b, and vstr.

void vsfree vstr vs  ) 
 

Definition at line 449 of file vbuf.c.

References vbfree(), vbuf, and vstr.

void vsgrow vstr vs,
size_t  len
 

Definition at line 659 of file vbuf.c.

References vbgrow(), vbuf, and vstr.

void vshexdump vstr vs,
char *  b,
size_t  start,
size_t  stop,
int  ascii
 

Definition at line 613 of file vbuf.c.

References vs_printfa(), and vstr.

Referenced by utf16_is_terminated().

int vslast vstr vs  ) 
 

Definition at line 543 of file vbuf.c.

References varstr::b, varstr::dlen, and vstr.

size_t vslen vstr vs  ) 
 

Definition at line 443 of file vbuf.c.

References vsstr(), and vstr.

void vsncat vstr vs,
char *  str,
size_t  len
 

Definition at line 694 of file vbuf.c.

References ASSERT, varstr::b, varbuf::b, varstr::dlen, varbuf::dlen, vbgrow(), vbuf, and vstr.

Referenced by vscat().

void vsnprepend vstr vb,
char *  str,
size_t  len
 

Definition at line 465 of file vbuf.c.

References ASSERT, varstr::b, varbuf::b, varstr::dlen, varbuf::dlen, vbgrow(), vbuf, and vstr.

void vsnset vstr vs,
char *  s,
size_t  n
 

Definition at line 650 of file vbuf.c.

References varbuf::b, varbuf::dlen, vbresize(), vbuf, and vstr.

Referenced by vsset().

void vsnset16 vstr vs,
char *  s,
size_t  len
 

Definition at line 671 of file vbuf.c.

References varbuf::b, varbuf::dlen, vbresize(), vbuf, and vstr.

void vsset vstr vs,
char *  s
 

Definition at line 644 of file vbuf.c.

References vsnset(), and vstr.

Referenced by vsalloc(), and vscatprintf().

void vsskip vstr vs,
size_t  len
 

Definition at line 479 of file vbuf.c.

References ASSERT, vbskip(), vbuf, and vstr.

int vsskipline vstr vs  ) 
 

Definition at line 487 of file vbuf.c.

References varstr::b, varstr::dlen, find_nl(), skip_nl(), and vstr.

void vsskipws vstr vs  ) 
 

Definition at line 387 of file vbuf.c.

References varstr::b, varbuf::b, varstr::dlen, vbskip(), vbuf, and vstr.

char* vsstr vstr vs  ) 
 

Definition at line 437 of file vbuf.c.

References varstr::b, and vstr.

Referenced by vslen().

void vstrunc vstr v,
size_t  off
 

Definition at line 707 of file vbuf.c.

References varstr::b, varstr::dlen, and vstr.


Variable Documentation

iconv_t i16to8
 

Definition at line 63 of file vbuf.c.

Referenced by unicode_close(), unicode_init(), and vb_utf16to8().

iconv_t i8859_1to8
 

Definition at line 63 of file vbuf.c.

Referenced by unicode_close(), and unicode_init().

iconv_t i8to16
 

Definition at line 63 of file vbuf.c.

Referenced by unicode_close(), unicode_init(), utf8to16(), and vb_utf8to16T().

iconv_t i8toi8859_1
 

Definition at line 63 of file vbuf.c.

Referenced by unicode_close(), and unicode_init().

size_t nwwbuf = 0
 

Definition at line 61 of file vbuf.c.

int unicode_up = 0 [static]
 

Definition at line 62 of file vbuf.c.

Referenced by unicode_close(), unicode_init(), and vb_utf16to8().

char* wwbuf = NULL
 

Definition at line 60 of file vbuf.c.


Generated on Tue Aug 5 12:06:14 2008 for 'LibPst' by  doxygen 1.3.9.1