]> mj.ucw.cz Git - libucw.git/blob - charset/unistream.h
Initial version of SQL gathering utility gsql added.
[libucw.git] / charset / unistream.h
1 /*
2  *      The UniCode Library: Reading and writing of UTF-8 on Fastbuf Streams
3  *
4  *      (c) 2001 Martin Mares <mj@ucw.cz>
5  */
6
7 #ifndef _UNISTREAM_H
8 #define _UNISTREAM_H
9
10 int bget_utf8_slow(struct fastbuf *b);
11 void bput_utf8_slow(struct fastbuf *b, uns u);
12
13 static inline int
14 bget_utf8(struct fastbuf *b)
15 {
16   uns u;
17
18   if (b->bptr + 5 <= b->bufend)
19     {
20       GET_UTF8(b->bptr, u);
21       return u;
22     }
23   else
24     return bget_utf8_slow(b);
25 }
26
27 static inline void
28 bput_utf8(struct fastbuf *b, uns u)
29 {
30   ASSERT(u < 65536);
31   if (b->bptr + 5 <= b->bufend)
32     PUT_UTF8(b->bptr, u);
33   else
34     bput_utf8_slow(b, u);
35 }
36
37 #endif