]> mj.ucw.cz Git - libucw.git/commitdiff
Libucw: Documentation of more fastbuf headers.
authorMichal Vaner <vorner@ucw.cz>
Sun, 3 Aug 2008 09:00:14 +0000 (11:00 +0200)
committerMartin Mares <mj@ucw.cz>
Mon, 25 Aug 2008 21:39:02 +0000 (23:39 +0200)
ucw/doc/fastbuf.txt
ucw/fb-socket.h
ucw/ff-unicode.h

index 71e9dc07dd1418cc9ef123cf29562f30d593acbe..754acd3e85bf023ed9e4eb5c0800b9a552b99884 100644 (file)
@@ -12,3 +12,24 @@ ucw/fastbuf.h
 -------------
 
 !!ucw/fastbuf.h
+
+ucw/fb-socket.h
+---------------
+
+Fastbufs on network sockets with timeouts.
+
+!!ucw/fb-socket.h
+
+ucw/ff-unicode.h
+----------------
+
+Reading and writing of unicode characters.
+
+Invalid codes are replaced by +UNI_REPLACEMENT+ when reading.
+
+!!ucw/ff-unicode.h
+
+ucw/ff-binary.h
+---------------
+
+Reading and writing of binary values.
index b80086048acd24c835d8d32b14c078d94fcec7d3..c9f6806bf05df792aa7b21de57a52a2121ea1ce4 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "ucw/fastbuf.h"
 
-struct fbsock_params {
+struct fbsock_params { /** Configuration of socket fastbuf. **/
   int fd;
   uns bufsize;
   uns timeout_ms;
@@ -20,12 +20,16 @@ struct fbsock_params {
   void *data;                  // Passed to the err callback
 };
 
-enum fbsock_err_flags {
+enum fbsock_err_flags {        /** Description of a socket error **/
   FBSOCK_READ = 1,             // Happened during read
   FBSOCK_WRITE = 2,            // Happened during write
   FBSOCK_TIMEOUT = 4,          // The error is a timeout
 };
 
+/**
+ * Create a new socket fastbuf.
+ * All information is passed by @par.
+ **/
 struct fastbuf *fbsock_create(struct fbsock_params *par);
 
 #endif
index 58c75d8581e135168264648cebc7be9f98ad22f1..c3d2300c3dd93b04d36a28a09675810f0b0b79a7 100644 (file)
@@ -15,7 +15,7 @@
 #include "ucw/fastbuf.h"
 #include "ucw/unicode.h"
 
-/*** UTF-8 ***/
+/* ** UTF-8 ** */
 
 int bget_utf8_slow(struct fastbuf *b, uns repl);
 int bget_utf8_32_slow(struct fastbuf *b, uns repl);
@@ -48,20 +48,17 @@ bget_utf8_32_repl(struct fastbuf *b, uns repl)
     return bget_utf8_32_slow(b, repl);
 }
 
-static inline int
-bget_utf8(struct fastbuf *b)
+static inline int bget_utf8(struct fastbuf *b) /** Read a single utf8 character from range [0, 0xffff]. **/
 {
   return bget_utf8_repl(b, UNI_REPLACEMENT);
 }
 
-static inline int
-bget_utf8_32(struct fastbuf *b)
+static inline int bget_utf8_32(struct fastbuf *b) /** Read a single utf8 character (from the whole unicode range). **/
 {
   return bget_utf8_32_repl(b, UNI_REPLACEMENT);
 }
 
-static inline void
-bput_utf8(struct fastbuf *b, uns u)
+static inline void bput_utf8(struct fastbuf *b, uns u) /** Write a single utf8 character from range [0, 0xffff]. **/
 {
   if (bavailw(b) >= 3)
     b->bptr = utf8_put(b->bptr, u);
@@ -69,8 +66,7 @@ bput_utf8(struct fastbuf *b, uns u)
     bput_utf8_slow(b, u);
 }
 
-static inline void
-bput_utf8_32(struct fastbuf *b, uns u)
+static inline void bput_utf8_32(struct fastbuf *b, uns u) /** Write a single utf8 character (from the whole unicode range). **/
 {
   if (bavailw(b) >= 6)
     b->bptr = utf8_32_put(b->bptr, u);
@@ -78,7 +74,7 @@ bput_utf8_32(struct fastbuf *b, uns u)
     bput_utf8_32_slow(b, u);
 }
 
-/*** UTF-16 ***/
+/* ** UTF-16 ** */
 
 int bget_utf16_be_slow(struct fastbuf *b, uns repl);
 int bget_utf16_le_slow(struct fastbuf *b, uns repl);
@@ -111,20 +107,29 @@ bget_utf16_le_repl(struct fastbuf *b, uns repl)
     return bget_utf16_le_slow(b, repl);
 }
 
-static inline int
-bget_utf16_be(struct fastbuf *b)
+/**
+ * Read an utf16 character from fastbuf.
+ * Big endian version.
+ **/
+static inline int bget_utf16_be(struct fastbuf *b)
 {
   return bget_utf16_be_repl(b, UNI_REPLACEMENT);
 }
 
-static inline int
-bget_utf16_le(struct fastbuf *b)
+/**
+ * Read an utf16 character from fastbuf.
+ * Little endian version.
+ **/
+static inline int bget_utf16_le(struct fastbuf *b)
 {
   return bget_utf16_le_repl(b, UNI_REPLACEMENT);
 }
 
-static inline void
-bput_utf16_be(struct fastbuf *b, uns u)
+/**
+ * Write an utf16 character to fastbuf.
+ * Big endian version.
+ **/
+static inline void bput_utf16_be(struct fastbuf *b, uns u)
 {
   if (bavailw(b) >= 4)
     b->bptr = utf16_be_put(b->bptr, u);
@@ -132,8 +137,11 @@ bput_utf16_be(struct fastbuf *b, uns u)
     bput_utf16_be_slow(b, u);
 }
 
-static inline void
-bput_utf16_lbe(struct fastbuf *b, uns u)
+/**
+ * Write an utf16 character to fastbuf.
+ * Little endian version.
+ **/
+static inline void bput_utf16_lbe(struct fastbuf *b, uns u)
 {
   if (bavailw(b) >= 4)
     b->bptr = utf16_le_put(b->bptr, u);