--- l2_p.h 2001/09/03 13:43:33 1.9
+++ l2_p.h 2001/09/04 13:52:59 1.10
@@ -57,7 +57,7 @@
typedef struct {
l2_formatter_t cb;
void *ctx;
- char *name;
+ char id;
} l2_formatter_entry_t;
struct l2_stream_st {
@@ -86,5 +86,46 @@
#define _va_type_cast_voidptr void *
#define va_get(ap,type) (_va_type_cast_##type)va_arg((ap),_va_type_recv_##type)
+struct l2_util_format_st {
+
+ /* the output buffer */
+ char *curpos; /* start of output buffer (first pos) */
+ char *endpos; /* end of output buffer (last pos) */
+
+ /* callback for flushing the output buffer */
+ int (*flush)(
+ struct l2_util_format_st *spec /* this l2_util_format_t specification */
+ );
+
+ /* callback for formatting unknown %-constructs */
+ void (*format)(
+ struct l2_util_format_st *spec, /* this l2_util_format_t specification */
+ char *prefix_char, /* output arg: prefix character */
+ char *pad_char, /* output arg: padding character */
+ char **s_buf, /* output arg: string buffer */
+ size_t *s_len, /* output arg: string len */
+ char *num_buf, /* input arg: temporary buffer */
+ int num_buf_size, /* input arg: temporary buffer len */
+ char *extinfo, /* input arg: extension information */
+ char fmt_char, /* input arg: current formatting character */
+ va_list *ap /* in/out arg: variable argument pointer */
+ );
+
+ /* arbitrary passed-through application data */
+ union {
+ int i;
+ long l;
+ double d;
+ void *vp;
+ } data[6];
+};
+typedef struct l2_util_format_st l2_util_format_t;
+
+int l2_util_format (l2_util_format_t *vbuff, const char *fmt, va_list ap);
+int l2_util_vsprintf (char *s, size_t n, const char *fmt, va_list ap);
+char *l2_util_vasprintf (const char *fmt, va_list ap);
+int l2_util_sprintf (char *s, size_t n, const char *fmt, ...);
+char *l2_util_asprintf (const char *fmt, ...);
+
#endif /* __L2_P_H__ */
|