Index: ossp-pkg/xds/xds.h RCS File: /v/ossp/cvs/ossp-pkg/xds/Attic/xds.h,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/xds/Attic/xds.h,v' 2>/dev/null --- xds.h 2001/07/02 12:18:57 1.8 +++ xds.h 2001/07/02 14:03:39 1.9 @@ -21,39 +21,38 @@ #include #include -struct xds_st; -typedef struct xds_st xds_t; - -typedef int (*xds_fmt_cb_t)(xds_t* context, - void* fmt_context, - void* buf, - size_t buf_size, - va_list args); - -typedef enum +enum { - XDS_ENCODE, - XDS_DECODE - } -xds_mode_t; - -typedef enum - { - XDS_LOAN, - XDS_GIFT - } -xds_buf_flag_t; + XDS_OK = 0, + XDS_ERR_NO_MEM = -1, + XDS_ERR_OVERFLOW = -2, + XDS_ERR_INVALID_ARG = -3, + XDS_ERR_TYPE_MISMATCH = -4 + }; +typedef enum { XDS_ENCODE, XDS_DECODE } xds_mode_t; +typedef enum { XDS_LOAN, XDS_GIFT } xds_scope_t; + +struct xds_context; +typedef struct xds_context xds_t; + +typedef int (*xds_engine_t)(xds_t* xds, + void* engine_context, + void* buffer, + size_t buffer_size, + va_list args); xds_t* xds_init(xds_mode_t); -void xds_destroy(xds_t* context); +void xds_destroy(xds_t* xds); -int xds_register(xds_t* context, const char* name, xds_fmt_cb_t callback, void* formatter_context); -int xds_unregister(xds_t* context, const char* name); +int xds_register(xds_t* xds, const char* name, xds_engine_t engine, void* engine_context); +int xds_unregister(xds_t* xds, const char* name); -int xds_set_buffer(xds_t* context, xds_buf_flag_t flag, void* buf, size_t buf_size); -int xds_get_buffer(xds_t* context, xds_buf_flag_t flag, void** buf, size_t* buf_size); +int xds_setbuffer(xds_t* xds, xds_scope_t flag, void* buffer, size_t buffer_size); +int xds_getbuffer(xds_t* xds, xds_scope_t flag, void** buffer, size_t* buffer_size); -int xds_encode(xds_t* context, const char* fmt, ...); -int xds_decode(xds_t* context, const char* fmt, ...); +int xds_encode(xds_t* xds, const char* fmt, ...); +int xds_decode(xds_t* xds, const char* fmt, ...); +int xds_vencode(xds_t* xds, const char* fmt, va_list args); +int xds_vdecode(xds_t* xds, const char* fmt, va_list args); #endif /* !defined(__LIBXDS_H__) */