OSSP CVS Repository

ossp - Difference in ossp-pkg/xds/xds.h.in versions 1.10 and 1.11
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/xds/xds.h.in 1.10 -> 1.11

--- xds.h.in     2001/08/02 17:24:49     1.10
+++ xds.h.in     2001/08/08 19:29:26     1.11
@@ -1,59 +1,58 @@
 /*
-   XDS - OSSP Extensible Data Serialization Library
-   Copyright (c) 2001 The OSSP Project (http://www.ossp.org/)
-   Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/)
-
-   This file is part of OSSP XDS, an extensible data serialization
-   library which can be found at http://www.ossp.com/pkg/xds/.
-
-   Permission to use, copy, modify, and distribute this software for
-   any purpose with or without fee is hereby granted, provided that
-   the above copyright notice and this permission notice appear in all
-   copies.
-
-   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-   IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-   SUCH DAMAGE.
-
-   xds.h: C API
+**  XDS - OSSP Extensible Data Serialization Library
+**  Copyright (c) 2001 The OSSP Project (http://www.ossp.org/)
+**  Copyright (c) 2001 Cable & Wireless Deutschland (http://www.cw.com/de/)
+**
+**  This file is part of OSSP XDS, an extensible data serialization
+**  library which can be found at http://www.ossp.com/pkg/xds/.
+**
+**  Permission to use, copy, modify, and distribute this software for
+**  any purpose with or without fee is hereby granted, provided that
+**  the above copyright notice and this permission notice appear in all
+**  copies.
+**
+**  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+**  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+**  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+**  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+**  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+**  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+**  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+**  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+**  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+**  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+**  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+**  SUCH DAMAGE.
+**
+**  xds.h: C API
 */
 
-#ifndef __LIBXDS_H__
-#define __LIBXDS_H__
+#ifndef __XDS_H__
+#define __XDS_H__
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <sys/types.h>
 #include <assert.h>
 
-#define XDS_TRUE (1==1)
+#define XDS_TRUE  (1==1)
 #define XDS_FALSE (1!=1)
 
 @have_64_bit_support@
 
-typedef @xds_uint8_t@ xds_uint8_t;
-typedef @xds_int8_t@ xds_int8_t;
+typedef @xds_uint8_t@  xds_uint8_t;
+typedef @xds_int8_t@   xds_int8_t;
 typedef @xds_uint16_t@ xds_uint16_t;
-typedef @xds_int16_t@ xds_int16_t;
+typedef @xds_int16_t@  xds_int16_t;
 typedef @xds_uint32_t@ xds_uint32_t;
-typedef @xds_int32_t@ xds_int32_t;
+typedef @xds_int32_t@  xds_int32_t;
 #ifdef XDS_HAVE_64_BIT_SUPPORT
 typedef @xds_uint64_t@ xds_uint64_t;
-typedef @xds_int64_t@ xds_int64_t;
+typedef @xds_int64_t@  xds_int64_t;
 #endif
-typedef double xds_double_t;
+typedef double         xds_double_t;
 
-enum
-    {
+enum {
     XDS_OK                 =  0,
     XDS_ERR_NO_MEM         = -1,
     XDS_ERR_OVERFLOW       = -2,
@@ -63,69 +62,62 @@
     XDS_ERR_INVALID_MODE   = -6,
     XDS_ERR_UNDERFLOW      = -7,
     XDS_ERR_UNKNOWN        = -8
-    };
+};
+
 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, size_t* used_buffer_size,
-                            va_list* args);
-
-xds_t* xds_init(xds_mode_t);
-void xds_destroy(xds_t* xds);
-
-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_setbuffer(xds_t* xds, xds_scope_t flag, void* buffer, size_t buffer_len);
-int xds_getbuffer(xds_t* xds, xds_scope_t flag, void** buffer, size_t* buffer_len);
-
-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);
-
-#define xds_check_parameter(condition)                                          \
-    do                                                                          \
-    {                                                                           \
-    assert(condition);                                                          \
-    if (!(condition))                                                           \
-        return XDS_ERR_INVALID_ARG;                                             \
+typedef int (*xds_engine_t)(xds_t *xds, void *engine_context,
+                            void *buffer, size_t buffer_size, size_t *used_buffer_size,
+                            va_list *args);
+
+xds_t *xds_init      (xds_mode_t);
+void   xds_destroy   (xds_t *xds);
+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_setbuffer (xds_t *xds, xds_scope_t flag, void *buffer, size_t buffer_len);
+int    xds_getbuffer (xds_t *xds, xds_scope_t flag, void **buffer, size_t *buffer_len);
+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);
+
+#define xds_check_parameter(condition) \
+    do { \
+        assert(condition); \
+        if (!(condition)) \
+            return XDS_ERR_INVALID_ARG; \
     } while(XDS_FALSE)
 
-#define xds_init_encoding_engine(size)                                          \
-    do                                                                          \
-    {                                                                           \
-    xds_check_parameter(xds != NULL);                                           \
-    xds_check_parameter(buffer != NULL);                                        \
-    xds_check_parameter(buffer_size != 0);                                      \
-    xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0);    \
-    xds_check_parameter(args != NULL);                                          \
-    *used_buffer_size = size;                                                   \
-    if (buffer_size < size)                                                     \
-        return XDS_ERR_OVERFLOW;                                                \
+#define xds_init_encoding_engine(size) \
+    do { \
+        xds_check_parameter(xds != NULL); \
+        xds_check_parameter(buffer != NULL); \
+        xds_check_parameter(buffer_size != 0); \
+        xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0); \
+        xds_check_parameter(args != NULL); \
+        *used_buffer_size = size; \
+        if (buffer_size < size) \
+            return XDS_ERR_OVERFLOW; \
     } while(XDS_FALSE)
 
-#define xds_init_decoding_engine(size)                                          \
-    do                                                                          \
-    {                                                                           \
-    xds_check_parameter(xds != NULL);                                           \
-    xds_check_parameter(buffer != NULL);                                        \
-    xds_check_parameter(buffer_size != 0);                                      \
-    xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0);    \
-    xds_check_parameter(args != NULL);                                          \
-    *used_buffer_size = size;                                                   \
-    if (buffer_size < size)                                                     \
-        return XDS_ERR_UNDERFLOW;                                               \
+#define xds_init_decoding_engine(size) \
+    do { \
+        xds_check_parameter(xds != NULL); \
+        xds_check_parameter(buffer != NULL); \
+        xds_check_parameter(buffer_size != 0); \
+        xds_check_parameter(used_buffer_size != NULL && *used_buffer_size == 0); \
+        xds_check_parameter(args != NULL); \
+        *used_buffer_size = size; \
+        if (buffer_size < size) \
+            return XDS_ERR_UNDERFLOW; \
     } while(XDS_FALSE)
 
-#define xds_declare_formatting_engine(x)                                        \
-    int x(xds_t* xds, void* engine_context,                                     \
-          void* buffer, size_t buffer_size, size_t* used_buffer_size,           \
-          va_list* args)
+#define xds_declare_formatting_engine(func) \
+    int func(xds_t *, void *, void *, size_t, size_t *, va_list *)
 
 xds_declare_formatting_engine(xdr_encode_uint32);
 xds_declare_formatting_engine(xdr_decode_uint32);
@@ -164,9 +156,11 @@
 xds_declare_formatting_engine(xml_decode_octetstream);
 xds_declare_formatting_engine(xml_encode_string);
 xds_declare_formatting_engine(xml_decode_string);
+
 extern const char xds_xml_begin_text[];
 extern const char xds_xml_end_text[];
 extern const char xds_base64[];
 extern const char xds_pad64;
 
-#endif /* !defined(__LIBXDS_H__) */
+#endif /* __XDS_H__ */
+

CVSTrac 2.0.1