wrowe 2002/12/02 14:38:47
Modified: include apr_iconv.h
lib iconv.h iconv_ccs.c iconv_ces.c iconv_ces_euc.c
iconv_ces_iso2022.c iconv_module.c iconv_uc.c
Log:
* apr_ Namespace decoratation for all exported symbols so we might begin
to coexist with a true iconv [especially if compiled into the clib.]
* Provide API_DECLARE... wrappers around all exports for Win32.
* Eliminate 'internals' from the public apr_iconv.h header.
Revision Changes Path
1.2 +24 -306 apr-iconv/include/apr_iconv.h
Index: apr_iconv.h
===================================================================
RCS file: /home/cvs/apr-iconv/include/apr_iconv.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- apr_iconv.h 20 Jul 2002 22:28:18 -0000 1.1
+++ apr_iconv.h 2 Dec 2002 22:38:47 -0000 1.2
@@ -47,44 +47,54 @@
/* apr additions */
/**
- * APR_DECLARE_EXPORT is defined when building the APR dynamic library,
- * so that all public symbols are exported.
+ * API_DECLARE_EXPORT is defined when building the libapriconv dynamic
+ * library, so that all public symbols are exported.
*
- * APR_DECLARE_STATIC is defined when including the APR public headers,
+ * API_DECLARE_STATIC is defined when including the apriconv public headers,
* to provide static linkage when the dynamic library may be unavailable.
*
- * APR_DECLARE_STATIC and APR_DECLARE_EXPORT are left undefined when
- * including the APR public headers, to import and link the symbols from the
- * dynamic APR library and assure appropriate indirection and calling
- * conventions at compile time.
+ * API_DECLARE_STATIC and API_DECLARE_EXPORT are left undefined when
+ * including the apr-iconv public headers, to import and link the symbols
+ * from the dynamic libapriconv library and assure appropriate indirection
+ * and calling conventions at compile time.
*/
#if !defined(WIN32)
/**
- * The public APR functions are declared with APR_DECLARE(), so they may
- * use the most appropriate calling convention. Public APR functions with
- * variable arguments must use APR_DECLARE_NONSTD().
+ * The public apr-iconv functions are declared with API_DECLARE(), so they
+ * use the most portable calling convention. Public apr-iconv functions
+ * with variable arguments must use API_DECLARE_NONSTD().
*
- * @deffunc APR_DECLARE(rettype) apr_func(args);
+ * @deffunc API_DECLARE(rettype) apr_func(args);
*/
#define API_DECLARE(type) type
/**
- * The public APR variables are declared with AP_MODULE_DECLARE_DATA.
+ * The private apr-iconv functions are declared with API_DECLARE_NONSTD(),
+ * so they use the most optimal C language calling conventions.
+ *
+ * @deffunc API_DECLARE(rettype) apr_func(args);
+ */
+#define API_DECLARE_NONSTD(type) type
+/**
+ * All exported apr-iconv variables are declared with API_DECLARE_DATA
* This assures the appropriate indirection is invoked at compile time.
*
- * @deffunc APR_DECLARE_DATA type apr_variable;
- * @tip extern APR_DECLARE_DATA type apr_variable; syntax is required for
+ * @deffunc API_DECLARE_DATA type apr_variable;
+ * @tip extern API_DECLARE_DATA type apr_variable; syntax is required for
* declarations within headers to properly import the variable.
*/
#define API_DECLARE_DATA
#elif defined(API_DECLARE_STATIC)
#define API_DECLARE(type) type __stdcall
+#define API_DECLARE_NONSTD(type) type
#define API_DECLARE_DATA
#elif defined(API_DECLARE_EXPORT)
#define API_DECLARE(type) __declspec(dllexport) type __stdcall
+#define API_DECLARE_NONSTD(type) __declspec(dllexport) type
#define API_DECLARE_DATA __declspec(dllexport)
#else
#define API_DECLARE(type) __declspec(dllimport) type __stdcall
+#define API_DECLARE_NONSTD(type) __declspec(dllimport) type
#define API_DECLARE_DATA __declspec(dllimport)
#endif
@@ -100,297 +110,5 @@
API_DECLARE(apr_status_t) apr_iconv_close(iconv_t, apr_pool_t *);
/* __END_DECLS */
-
-
-#ifdef ICONV_INTERNAL
-
-/*
- * iconv module types
- */
-#define ICMOD_ANY 0
-#define ICMOD_LIB 1
-#define ICMOD_UC_CCS 0x100 /* UC - CCS for CES */
-#define ICMOD_UC_CES 0x101 /* UC - CES */
-
-/*
- * iconv module flags
- */
-#define ICMODF_LOADED 0x8000
-
-/*
- * iconv module handler events
- */
-#define ICMODEV_LOAD 1 /* module load. after dependencies
resolved */
-#define ICMODEV_UNLOAD 2 /* module unload */
-#define ICMODEV_DYNDEPS 3 /* load dynamic dependencies */
-
-struct iconv_module_depend {
- int md_type;
- const char * md_name;
- const void * md_data;
-};
-
-struct iconv_module;
-
-/* _tbl_simple.c table_load_ccs() calls iconv_mod_load(...ctx) */
-
-typedef int iconv_mod_event_t(struct iconv_module *, int, apr_pool_t *ctx);
-
-struct iconv_module_desc {
- int imd_type;
- iconv_mod_event_t *imd_event;
- const struct iconv_module_depend *imd_depend;
- const void * imd_data;
-};
-
-#define ICONV_MODULE(type,data) struct iconv_module_desc iconv_module \
- {(type), (data)}
-
-struct iconv_module {
- int im_flags;
- void * im_handle;
- struct iconv_module_desc *im_desc;
- struct iconv_module *im_next;
- struct iconv_module *im_deplist;
- int im_depcnt;
- const void * im_methods;
- void * im_data;
- const void * im_depdata; /* data if module loaded from
dependency */
- const void * im_args;
-};
-
-#define ICONV_MOD_LOAD(mod,ctx) (mod)->im_desc->imd_event(mod,
ICMODEV_LOAD,ctx)
-#define ICONV_MOD_UNLOAD(mod,ctx) (mod)->im_desc->imd_event(mod,
ICMODEV_UNLOAD,ctx)
-#define ICONV_MOD_DYNDEPS(mod,ctx) (mod)->im_desc->imd_event(mod,
ICMODEV_DYNDEPS,ctx)
-
-/*
- * iconv converter definitions.
- */
-typedef int iconv_open_t(const char *, const char *, void **, apr_pool_t *);
-typedef int iconv_close_t(void *, apr_pool_t *);
-typedef apr_status_t iconv_conv_t(void *, const unsigned char **, apr_size_t
*,
- unsigned char **, apr_size_t *, apr_size_t *);
-
-struct iconv_converter_desc {
- iconv_open_t * icd_open;
- iconv_close_t * icd_close;
- iconv_conv_t * icd_conv;
-};
-
-struct iconv_converter {
- struct iconv_converter_desc *ic_desc;
- void * ic_data;
-};
-
-/*
- * internal data types and functions used by charset conversion modules
- */
-
-#define UCS_CHAR_ZERO_WIDTH_NBSP 0xFEFF
-#define UCS_CHAR_INVALID 0xFFFE
-#define UCS_CHAR_NONE 0xFFFF
-
-typedef apr_uint16_t ucs2_t; /* Unicode character [D5] */
-typedef apr_uint32_t ucs4_t; /* Unicode scalar character [D28] */
-#define ucs_t ucs4_t
-
-/*
- * one-level coded character set conversion tables
- */
-typedef struct {
- apr_uint16_t data[128];
-} iconv_ccs_convtable_7bit; /* 7-bit charset to Unicode */
-
-typedef struct {
- apr_uint16_t data[256];
-} iconv_ccs_convtable_8bit; /* 8-bit charset to Unicode */
-
-/*
- * two-level coded character set conversion tables
- */
-typedef struct {
- const iconv_ccs_convtable_7bit *data[128];
-} iconv_ccs_convtable_14bit; /* 14-bit charset to Unicode */
-
-typedef struct {
- const iconv_ccs_convtable_8bit *data[256];
-} iconv_ccs_convtable_16bit; /* 16-bit charset to Unicode;
- * Unicode to any charset */
-
-/*
- * abstract coded character set conversion table
- */
-typedef union {
- iconv_ccs_convtable_7bit _7bit;
- iconv_ccs_convtable_8bit _8bit;
- iconv_ccs_convtable_14bit _14bit;
- iconv_ccs_convtable_16bit _16bit;
-} iconv_ccs_convtable;
-
-/*
- * function for table-driven conversion
- */
-typedef ucs2_t iconv_ccs_converter_t (ucs2_t ch);
-
-/*
- * charset conversion module descriptor
- */
-struct iconv_ccs_desc {
- const char * const * names;
- int nbits;
- const iconv_ccs_convtable * from_ucs;
- const iconv_ccs_convtable * to_ucs;
- iconv_ccs_converter_t * convert_from_ucs;
- iconv_ccs_converter_t * convert_to_ucs;
-};
-
-/*
- * inline functions for use in charset conversion modules
- */
-static APR_INLINE ucs2_t
-iconv_ccs_convert_7bit(const iconv_ccs_convtable *table, ucs2_t ch)
-{
- return ch & 0x80 ? UCS_CHAR_INVALID : table->_7bit.data[ch];
-}
-
-static APR_INLINE ucs2_t
-iconv_ccs_convert_8bit(const iconv_ccs_convtable *table, ucs2_t ch)
-{
- return table->_8bit.data[ch];
-}
-
-static APR_INLINE ucs2_t
-iconv_ccs_convert_14bit(const iconv_ccs_convtable *table, ucs2_t ch)
-{
- const iconv_ccs_convtable_7bit *sub_table;
-
- sub_table = ch & 0x8080 ? NULL : table->_14bit.data[ch >> 8];
- return sub_table ? sub_table->data[ch & 0x7F] : UCS_CHAR_INVALID;
-}
-
-static APR_INLINE ucs2_t
-iconv_ccs_convert_16bit(const iconv_ccs_convtable *table, ucs2_t ch)
-{
- const iconv_ccs_convtable_8bit *sub_table;
-
- sub_table = table->_16bit.data[ch >> 8];
- return sub_table ? sub_table->data[ch & 0xFF] : UCS_CHAR_INVALID;
-}
-
-#define ICONV_CCS_CONVERT_FROM_UCS(ccsd, ch) \
- ((ccsd)->convert_from_ucs(ch))
-#define ICONV_CCS_CONVERT_TO_UCS(ccsd, ch) \
- ((ccsd)->convert_to_ucs(ch))
-
-/*
- * generic character encoding schemes and functions
- */
-struct iconv_ces;
-
-typedef int iconv_ces_open_t(struct iconv_ces *, apr_pool_t *);
-typedef int iconv_ces_close_t(struct iconv_ces *);
-typedef void iconv_ces_reset_t(struct iconv_ces *);
-typedef const char * const *iconv_ces_names_t(struct iconv_ces *);
-typedef int iconv_ces_nbits_t(struct iconv_ces *);
-typedef int iconv_ces_nbytes_t(struct iconv_ces *);
-
-typedef apr_ssize_t iconv_ces_convert_from_ucs_t
- (struct iconv_ces *data, ucs_t in,
- unsigned char **outbuf, apr_size_t *outbytesleft);
-
-typedef ucs_t iconv_ces_convert_to_ucs_t
- (struct iconv_ces *data,
- const unsigned char **inbuf, apr_size_t *inbytesleft);
-
-struct iconv_ces_desc {
- iconv_ces_open_t * open;
- iconv_ces_close_t * close;
- iconv_ces_reset_t * reset;
- iconv_ces_names_t * names;
- iconv_ces_nbits_t * nbits;
- iconv_ces_nbytes_t * nbytes;
- iconv_ces_convert_from_ucs_t * convert_from_ucs;
- iconv_ces_convert_to_ucs_t * convert_to_ucs;
- const void *data;
-};
-
-struct iconv_ces {
- struct iconv_ces_desc * desc;
- void * data;
- struct iconv_module * mod;
-};
-
-int iconv_ces_open(const char *ces_name, struct iconv_ces **cespp,
apr_pool_t *ctx);
-int iconv_ces_close(struct iconv_ces *ces, apr_pool_t *ctx);
-int iconv_ces_open_func(struct iconv_ces *ces);
-int iconv_ces_close_func(struct iconv_ces *ces);
-void iconv_ces_reset_func(struct iconv_ces *ces);
-void iconv_ces_no_func(struct iconv_ces *ces);
-int iconv_ces_nbits7(struct iconv_ces *ces);
-int iconv_ces_nbits8(struct iconv_ces *ces);
-int iconv_ces_zero(struct iconv_ces *ces);
-
-#define iconv_char32bit(ch) ((ch) & 0xFFFF0000)
-
-#define ICONV_CES_OPEN(ces,ctx) (ces)->desc->open(ces,ctx)
-#define ICONV_CES_CLOSE(ces) (ces)->desc->close(ces)
-#define ICONV_CES_RESET(ces) (ces)->desc->reset(ces)
-#define ICONV_CES_CONVERT_FROM_UCS(cesd, in, outbuf, outbytes) \
- ((cesd)->desc->convert_from_ucs((cesd), (in), (outbuf), (outbytes)))
-#define ICONV_CES_CONVERT_TO_UCS(cesd, inbuf, inbytes) \
- ((cesd)->desc->convert_to_ucs((cesd), (inbuf), (inbytes)))
-
-#define ICONV_CES_DRIVER_DECL(name) \
- iconv_ces_open_t iconv_##name##_open; \
- iconv_ces_close_t iconv_##name##_close; \
- iconv_ces_reset_t iconv_##name##_reset; \
- iconv_ces_nbits_t iconv_##name##_nbits; \
- iconv_ces_convert_from_ucs_t iconv_##name##_convert_from_ucs; \
- iconv_ces_convert_to_ucs_t iconv_##name##_convert_to_ucs
-
-/*
- ************************************************
- * EUC character encoding schemes and functions *
- ************************************************
- */
-
-typedef struct iconv_ces_euc_ccs {
- const char *prefix;
- apr_size_t prefixlen;
-} iconv_ces_euc_ccs_t;
-
-ICONV_CES_DRIVER_DECL(euc);
-
-/*
- * ISO-2022 character encoding schemes and functions
- */
-enum { ICONV_SHIFT_SI = 0, ICONV_SHIFT_SO, ICONV_SHIFT_SS2, ICONV_SHIFT_SS3
};
-
-typedef struct iconv_ces_iso2022_ccs {
- int shift;
- const char * designator;
- apr_size_t designatorlen;
-} iconv_ces_iso2022_ccs_t;
-
-typedef struct {
- const int * shift_tab;
- int nccs;
- const struct iconv_ces_iso2022_ccs *ccs;
-} iconv_ces_iso2022_data;
-
-ICONV_CES_DRIVER_DECL(iso2022);
-
-
-int iconv_mod_load(const char *, int, const void *, struct iconv_module **,
apr_pool_t *);
-int iconv_mod_unload(struct iconv_module *,apr_pool_t *ctx);
-iconv_mod_event_t iconv_mod_noevent;
-
-iconv_mod_event_t iconv_ccs_event;
-
-int iconv_malloc(apr_size_t size, void **pp);
-
-extern struct iconv_converter_desc iconv_uc_desc;
-
-#endif /* ICONV_INTERNAL */
#endif /* _ICONV_H_ */
1.11 +57 -29 apr-iconv/lib/iconv.h
Index: iconv.h
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- iconv.h 26 Jul 2001 23:12:59 -0000 1.10
+++ iconv.h 2 Dec 2002 22:38:47 -0000 1.11
@@ -47,44 +47,54 @@
/* apr additions */
/**
- * APR_DECLARE_EXPORT is defined when building the APR dynamic library,
- * so that all public symbols are exported.
+ * API_DECLARE_EXPORT is defined when building the libapriconv dynamic
+ * library, so that all public symbols are exported.
*
- * APR_DECLARE_STATIC is defined when including the APR public headers,
+ * API_DECLARE_STATIC is defined when including the apriconv public headers,
* to provide static linkage when the dynamic library may be unavailable.
*
- * APR_DECLARE_STATIC and APR_DECLARE_EXPORT are left undefined when
- * including the APR public headers, to import and link the symbols from the
- * dynamic APR library and assure appropriate indirection and calling
- * conventions at compile time.
+ * API_DECLARE_STATIC and API_DECLARE_EXPORT are left undefined when
+ * including the apr-iconv public headers, to import and link the symbols
+ * from the dynamic libapriconv library and assure appropriate indirection
+ * and calling conventions at compile time.
*/
#if !defined(WIN32)
/**
- * The public APR functions are declared with APR_DECLARE(), so they may
- * use the most appropriate calling convention. Public APR functions with
- * variable arguments must use APR_DECLARE_NONSTD().
+ * The public apr-iconv functions are declared with API_DECLARE(), so they
+ * use the most portable calling convention. Public apr-iconv functions
+ * with variable arguments must use API_DECLARE_NONSTD().
*
- * @deffunc APR_DECLARE(rettype) apr_func(args);
+ * @deffunc API_DECLARE(rettype) apr_func(args);
*/
#define API_DECLARE(type) type
/**
- * The public APR variables are declared with AP_MODULE_DECLARE_DATA.
+ * The private apr-iconv functions are declared with API_DECLARE_NONSTD(),
+ * so they use the most optimal C language calling conventions.
+ *
+ * @deffunc API_DECLARE(rettype) apr_func(args);
+ */
+#define API_DECLARE_NONSTD(type) type
+/**
+ * All exported apr-iconv variables are declared with API_DECLARE_DATA
* This assures the appropriate indirection is invoked at compile time.
*
- * @deffunc APR_DECLARE_DATA type apr_variable;
- * @tip extern APR_DECLARE_DATA type apr_variable; syntax is required for
+ * @deffunc API_DECLARE_DATA type apr_variable;
+ * @tip extern API_DECLARE_DATA type apr_variable; syntax is required for
* declarations within headers to properly import the variable.
*/
#define API_DECLARE_DATA
#elif defined(API_DECLARE_STATIC)
#define API_DECLARE(type) type __stdcall
+#define API_DECLARE_NONSTD(type) type
#define API_DECLARE_DATA
#elif defined(API_DECLARE_EXPORT)
#define API_DECLARE(type) __declspec(dllexport) type __stdcall
+#define API_DECLARE_NONSTD(type) __declspec(dllexport) type
#define API_DECLARE_DATA __declspec(dllexport)
#else
#define API_DECLARE(type) __declspec(dllimport) type __stdcall
+#define API_DECLARE_NONSTD(type) __declspec(dllimport) type
#define API_DECLARE_DATA __declspec(dllimport)
#endif
@@ -132,7 +142,7 @@
struct iconv_module;
-/* _tbl_simple.c table_load_ccs() calls iconv_mod_load(...ctx) */
+/* _tbl_simple.c table_load_ccs() calls apr_iconv_mod_load(...ctx) */
typedef int iconv_mod_event_t(struct iconv_module *, int, apr_pool_t *ctx);
@@ -143,6 +153,8 @@
const void * imd_data;
};
+#define END_ICONV_MODULE_DEPEND {0, NULL, NULL}
+
#define ICONV_MODULE(type,data) struct iconv_module_desc iconv_module \
{(type), (data)}
@@ -320,15 +332,20 @@
struct iconv_module * mod;
};
-int iconv_ces_open(const char *ces_name, struct iconv_ces **cespp,
apr_pool_t *ctx);
-int iconv_ces_close(struct iconv_ces *ces, apr_pool_t *ctx);
-int iconv_ces_open_func(struct iconv_ces *ces);
-int iconv_ces_close_func(struct iconv_ces *ces);
-void iconv_ces_reset_func(struct iconv_ces *ces);
-void iconv_ces_no_func(struct iconv_ces *ces);
-int iconv_ces_nbits7(struct iconv_ces *ces);
-int iconv_ces_nbits8(struct iconv_ces *ces);
-int iconv_ces_zero(struct iconv_ces *ces);
+API_DECLARE_NONSTD(int) apr_iconv_ces_open(const char *ces_name, struct
iconv_ces **cespp, apr_pool_t *ctx);
+API_DECLARE_NONSTD(int) apr_iconv_ces_close(struct iconv_ces *ces,
apr_pool_t *ctx);
+API_DECLARE_NONSTD(int) apr_iconv_ces_open_func(struct iconv_ces *ces,
apr_pool_t *ctx);
+API_DECLARE_NONSTD(int) apr_iconv_ces_close_func(struct iconv_ces *ces);
+API_DECLARE_NONSTD(void) apr_iconv_ces_reset_func(struct iconv_ces *ces);
+API_DECLARE_NONSTD(void) apr_iconv_ces_no_func(struct iconv_ces *ces);
+API_DECLARE_NONSTD(int) apr_iconv_ces_nbits7(struct iconv_ces *ces);
+API_DECLARE_NONSTD(int) apr_iconv_ces_nbits8(struct iconv_ces *ces);
+API_DECLARE_NONSTD(int) apr_iconv_ces_zero(struct iconv_ces *ces);
+
+/* Safe for _NONSTD APIs since the C caller pops the stack and the
+ * apr_pool_t *cxt arg is simply ignored:
+ */
+#define apr_iconv_ces_open_zero (iconv_ces_open_t*)apr_iconv_ces_zero
#define iconv_char32bit(ch) ((ch) & 0xFFFF0000)
@@ -381,15 +398,26 @@
ICONV_CES_DRIVER_DECL(iso2022);
-int iconv_mod_load(const char *, int, const void *, struct iconv_module **,
apr_pool_t *);
-int iconv_mod_unload(struct iconv_module *,apr_pool_t *ctx);
-iconv_mod_event_t iconv_mod_noevent;
-
-iconv_mod_event_t iconv_ccs_event;
+API_DECLARE_NONSTD(int) apr_iconv_mod_load(const char *, int, const void *,
struct iconv_module **, apr_pool_t *);
+API_DECLARE_NONSTD(int) apr_iconv_mod_unload(struct iconv_module
*,apr_pool_t *ctx);
+API_DECLARE_NONSTD(int) apr_iconv_mod_noevent(struct iconv_module *mod, int
event, apr_pool_t *ctx);
+API_DECLARE_NONSTD(int) apr_iconv_ccs_event(struct iconv_module *mod, int
event, apr_pool_t *ctx);
int iconv_malloc(apr_size_t size, void **pp);
extern struct iconv_converter_desc iconv_uc_desc;
+
+
+API_DECLARE_NONSTD(apr_status_t) apr_iconv_euc_open(struct iconv_ces *ces,
apr_pool_t *ctx);
+API_DECLARE_NONSTD(apr_status_t) apr_iconv_euc_close(struct iconv_ces *ces);
+API_DECLARE_NONSTD(apr_ssize_t) apr_iconv_euc_convert_from_ucs(struct
iconv_ces *ces, ucs_t in, unsigned char **outbuf, apr_size_t *outbytesleft);
+API_DECLARE_NONSTD(ucs_t) apr_iconv_euc_convert_to_ucs(struct iconv_ces
*ces, const unsigned char **inbuf, apr_size_t *inbytesleft);
+
+API_DECLARE_NONSTD(apr_status_t) apr_iconv_iso2022_open(struct iconv_ces
*ces, apr_pool_t *ctx);
+API_DECLARE_NONSTD(int) apr_iconv_iso2022_close(struct iconv_ces *ces);
+API_DECLARE_NONSTD(void) apr_iconv_iso2022_reset(struct iconv_ces *ces);
+API_DECLARE_NONSTD(apr_ssize_t) apr_iconv_iso2022_convert_from_ucs(struct
iconv_ces *ces, ucs_t in, unsigned char **outbuf, apr_size_t *outbytesleft);
+API_DECLARE_NONSTD(ucs_t) apr_iconv_iso2022_convert_to_ucs(struct iconv_ces
*ces, const unsigned char **inbuf, apr_size_t *inbytesleft);
#endif /* ICONV_INTERNAL */
1.6 +4 -4 apr-iconv/lib/iconv_ccs.c
Index: iconv_ccs.c
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv_ccs.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- iconv_ccs.c 28 Jun 2001 05:45:01 -0000 1.5
+++ iconv_ccs.c 2 Dec 2002 22:38:47 -0000 1.6
@@ -33,8 +33,8 @@
#define ICONV_INTERNAL
#include "iconv.h" /* iconv_ccs_desc, iconv_ccs_module */
-apr_status_t
-iconv_ccs_event(struct iconv_module *mod, int event, apr_pool_t *ctx)
+API_DECLARE_NONSTD(int)
+apr_iconv_ccs_event(struct iconv_module *mod, int event, apr_pool_t *ctx)
{
/* struct iconv_ccs_desc *desc =
(struct iconv_ccs_desc *)mod->im_desc->imd_data;*/
@@ -49,7 +49,7 @@
case ICMODEV_UNLOAD:
break;
default:
- return APR_EINVAL;
+ return EINVAL;
}
- return APR_SUCCESS;
+ return 0;
}
1.6 +23 -23 apr-iconv/lib/iconv_ces.c
Index: iconv_ces.c
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv_ces.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- iconv_ces.c 21 Jun 2001 12:24:12 -0000 1.5
+++ iconv_ces.c 2 Dec 2002 22:38:47 -0000 1.6
@@ -37,21 +37,21 @@
#define ICONV_INTERNAL
#include "iconv.h" /* iconv_ccs_desc, iconv_ccs */
-apr_status_t
-iconv_ces_open(const char *cesname, struct iconv_ces **cespp, apr_pool_t
*ctx)
+API_DECLARE_NONSTD(int)
+apr_iconv_ces_open(const char *cesname, struct iconv_ces **cespp, apr_pool_t
*ctx)
{
struct iconv_module *mod;
struct iconv_ces *ces;
apr_status_t error;
- error = iconv_mod_load(cesname, ICMOD_UC_CES, NULL, &mod, ctx);
+ error = apr_iconv_mod_load(cesname, ICMOD_UC_CES, NULL, &mod, ctx);
if (APR_STATUS_IS_EFTYPE(error))
- error = iconv_mod_load("_tbl_simple", ICMOD_UC_CES, cesname,
&mod, ctx);
+ error = apr_iconv_mod_load("_tbl_simple", ICMOD_UC_CES,
cesname, &mod, ctx);
if (error != APR_SUCCESS)
return (APR_STATUS_IS_EFTYPE(error)) ? APR_EINVAL : error;
ces = malloc(sizeof(*ces));
if (ces == NULL) {
- iconv_mod_unload(mod, ctx);
+ apr_iconv_mod_unload(mod, ctx);
return APR_ENOMEM;
}
memset(ces,0, sizeof(*ces));
@@ -61,15 +61,15 @@
error = ICONV_CES_OPEN(ces,ctx);
if (error != APR_SUCCESS) {
free(ces);
- iconv_mod_unload(mod, ctx);
+ apr_iconv_mod_unload(mod, ctx);
return error;
}
*cespp = ces;
return APR_SUCCESS;
}
-int
-iconv_ces_close(struct iconv_ces *ces, apr_pool_t *ctx)
+API_DECLARE_NONSTD(int)
+apr_iconv_ces_close(struct iconv_ces *ces, apr_pool_t *ctx)
{
int res;
@@ -77,50 +77,50 @@
return -1;
res = ICONV_CES_CLOSE(ces);
if (ces->mod != NULL)
- iconv_mod_unload(ces->mod, ctx);
+ apr_iconv_mod_unload(ces->mod, ctx);
free(ces);
return res;
}
-int
-iconv_ces_open_func(struct iconv_ces *ces)
+API_DECLARE_NONSTD(int)
+apr_iconv_ces_open_func(struct iconv_ces *ces, apr_pool_t *ctx)
{
return iconv_malloc(sizeof(int), &ces->data);
}
-int
-iconv_ces_close_func(struct iconv_ces *ces)
+API_DECLARE_NONSTD(int)
+apr_iconv_ces_close_func(struct iconv_ces *ces)
{
free(ces->data);
return 0;
}
-void
-iconv_ces_reset_func(struct iconv_ces *ces)
+API_DECLARE_NONSTD(void)
+apr_iconv_ces_reset_func(struct iconv_ces *ces)
{
memset(ces->data, 0, sizeof(int));
}
/*ARGSUSED*/
-void
-iconv_ces_no_func(struct iconv_ces *ces)
+API_DECLARE_NONSTD(void)
+apr_iconv_ces_no_func(struct iconv_ces *ces)
{
}
-int
-iconv_ces_nbits7(struct iconv_ces *ces)
+API_DECLARE_NONSTD(int)
+apr_iconv_ces_nbits7(struct iconv_ces *ces)
{
return 7;
}
-int
-iconv_ces_nbits8(struct iconv_ces *ces)
+API_DECLARE_NONSTD(int)
+apr_iconv_ces_nbits8(struct iconv_ces *ces)
{
return 8;
}
-int
-iconv_ces_zero(struct iconv_ces *ces)
+API_DECLARE_NONSTD(int)
+apr_iconv_ces_zero(struct iconv_ces *ces)
{
return 0;
}
1.6 +8 -8 apr-iconv/lib/iconv_ces_euc.c
Index: iconv_ces_euc.c
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv_ces_euc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- iconv_ces_euc.c 28 Jun 2001 05:45:01 -0000 1.5
+++ iconv_ces_euc.c 2 Dec 2002 22:38:47 -0000 1.6
@@ -45,8 +45,8 @@
const struct iconv_module *ccs[1];
} iconv_ces_euc_state_t;
-apr_status_t
-iconv_euc_open(struct iconv_ces *ces, apr_pool_t *ctx)
+API_DECLARE_NONSTD(apr_status_t)
+apr_iconv_euc_open(struct iconv_ces *ces, apr_pool_t *ctx)
{
struct iconv_module *depmod = ces->mod->im_deplist;
iconv_ces_euc_state_t *state;
@@ -66,8 +66,8 @@
return APR_SUCCESS;
}
-apr_status_t
-iconv_euc_close(struct iconv_ces *ces)
+API_DECLARE_NONSTD(apr_status_t)
+apr_iconv_euc_close(struct iconv_ces *ces)
{
free(CESTOSTATE(ces));
return APR_SUCCESS;
@@ -76,8 +76,8 @@
#define is_7_14bit(data) ((data)->nbits & 7)
#define is_7bit(data) ((data)->nbits & 1)
-apr_ssize_t
-iconv_euc_convert_from_ucs(struct iconv_ces *ces, ucs_t in,
+API_DECLARE_NONSTD(apr_ssize_t)
+apr_iconv_euc_convert_from_ucs(struct iconv_ces *ces, ucs_t in,
unsigned char **outbuf, apr_size_t *outbytesleft)
{
iconv_ces_euc_state_t *euc_state = CESTOSTATE(ces);
@@ -143,8 +143,8 @@
return ICONV_CCS_CONVERT_TO_UCS(ccs, ch);
}
-ucs_t
-iconv_euc_convert_to_ucs(struct iconv_ces *ces,
+API_DECLARE_NONSTD(ucs_t)
+apr_iconv_euc_convert_to_ucs(struct iconv_ces *ces,
const unsigned char **inbuf, apr_size_t *inbytesleft)
{
iconv_ces_euc_state_t *euc_state = CESTOSTATE(ces);
1.6 +11 -17 apr-iconv/lib/iconv_ces_iso2022.c
Index: iconv_ces_iso2022.c
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv_ces_iso2022.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- iconv_ces_iso2022.c 28 Jun 2001 05:45:02 -0000 1.5
+++ iconv_ces_iso2022.c 2 Dec 2002 22:38:47 -0000 1.6
@@ -66,8 +66,8 @@
const struct iconv_module *ccsmod[1];
} iconv_ces_iso2022_state_t;
-apr_status_t
-iconv_iso2022_open(struct iconv_ces *ces, apr_pool_t *ctx)
+API_DECLARE_NONSTD(apr_status_t)
+apr_iconv_iso2022_open(struct iconv_ces *ces, apr_pool_t *ctx)
{
const iconv_ces_iso2022_ccs_t *ccsattr;
const struct iconv_ccs_desc *ccs;
@@ -86,7 +86,7 @@
ces->data = state;
state->shift_tab = (int*)((char*)state + stsz);
state->org_shift_tab = ces->desc->data;
- iconv_iso2022_reset(ces);
+ apr_iconv_iso2022_reset(ces);
state->nccs = ces->mod->im_depcnt;
depmod = ces->mod->im_deplist;
for (i = ces->mod->im_depcnt; i; i--, depmod = depmod->im_next) {
@@ -101,15 +101,15 @@
return APR_SUCCESS;
}
-int
-iconv_iso2022_close(struct iconv_ces *ces)
+API_DECLARE_NONSTD(int)
+apr_iconv_iso2022_close(struct iconv_ces *ces)
{
free(ces->data);
return 0;
}
-void
-iconv_iso2022_reset(struct iconv_ces *ces)
+API_DECLARE_NONSTD(void)
+apr_iconv_iso2022_reset(struct iconv_ces *ces)
{
struct iconv_ces_iso2022_state *state = CESTOSTATE(ces);
@@ -118,12 +118,6 @@
state->previous_char = UCS_CHAR_NONE;
}
-int
-iconv_iso2022_nbits(struct iconv_ces *ces)
-{
- return 7;
-}
-
static void
update_shift_state(const struct iconv_ces *ces, ucs_t ch)
{
@@ -198,8 +192,8 @@
return 1;
}
-apr_ssize_t
-iconv_iso2022_convert_from_ucs(struct iconv_ces *ces,
+API_DECLARE_NONSTD(apr_ssize_t)
+apr_iconv_iso2022_convert_from_ucs(struct iconv_ces *ces,
ucs_t in, unsigned char **outbuf, apr_size_t *outbytesleft)
{
struct iconv_ces_iso2022_state *iso_state = CESTOSTATE(ces);
@@ -244,8 +238,8 @@
return ICONV_CCS_CONVERT_TO_UCS(ccs, ch);
}
-ucs_t
-iconv_iso2022_convert_to_ucs(struct iconv_ces *ces,
+API_DECLARE_NONSTD(ucs_t)
+apr_iconv_iso2022_convert_to_ucs(struct iconv_ces *ces,
const unsigned char **inbuf, apr_size_t *inbytesleft)
{
struct iconv_ces_iso2022_state *iso_state = CESTOSTATE(ces);
1.8 +9 -9 apr-iconv/lib/iconv_module.c
Index: iconv_module.c
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv_module.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- iconv_module.c 28 Jun 2001 05:45:02 -0000 1.7
+++ iconv_module.c 2 Dec 2002 22:38:47 -0000 1.8
@@ -104,8 +104,8 @@
return EINVAL;
}
-int
-iconv_mod_load(const char *modname, int modtype, const void *args,
+API_DECLARE_NONSTD(int)
+apr_iconv_mod_load(const char *modname, int modtype, const void *args,
struct iconv_module **modpp, apr_pool_t *ctx)
{
struct iconv_module_desc *mdesc;
@@ -137,7 +137,7 @@
depend = mdesc->imd_depend;
if (depend) {
while (depend->md_name) {
- error = iconv_mod_load(depend->md_name,
+ error = apr_iconv_mod_load(depend->md_name,
depend->md_type, NULL, &depmod, ctx);
if (error)
goto bad;
@@ -162,12 +162,12 @@
*modpp = mod;
return 0;
bad:
- iconv_mod_unload(mod,ctx);
+ apr_iconv_mod_unload(mod,ctx);
return error;
}
-int
-iconv_mod_unload(struct iconv_module *mod, apr_pool_t *ctx)
+API_DECLARE_NONSTD(int)
+apr_iconv_mod_unload(struct iconv_module *mod, apr_pool_t *ctx)
{
struct iconv_module *deplist, *tmp;
int error = 0;
@@ -179,7 +179,7 @@
deplist = mod->im_deplist;
while (deplist) {
tmp = deplist->im_next;
- iconv_mod_unload(deplist,ctx);
+ apr_iconv_mod_unload(deplist,ctx);
deplist = tmp;
}
if (mod->im_handle != NULL)
@@ -189,8 +189,8 @@
return error;
}
-int
-iconv_mod_noevent(struct iconv_module *mod, int event, apr_pool_t *ctx)
+API_DECLARE_NONSTD(int)
+apr_iconv_mod_noevent(struct iconv_module *mod, int event, apr_pool_t *ctx)
{
switch (event) {
case ICMODEV_LOAD:
1.6 +4 -4 apr-iconv/lib/iconv_uc.c
Index: iconv_uc.c
===================================================================
RCS file: /home/cvs/apr-iconv/lib/iconv_uc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- iconv_uc.c 28 Jun 2001 05:45:03 -0000 1.5
+++ iconv_uc.c 2 Dec 2002 22:38:47 -0000 1.6
@@ -34,11 +34,11 @@
if (ic == NULL)
return APR_ENOMEM;
memset(ic, 0, sizeof(*ic));
- error = iconv_ces_open(from, &ic->from, ctx);
+ error = apr_iconv_ces_open(from, &ic->from, ctx);
if (error!=APR_SUCCESS) {
goto bad;
}
- error = iconv_ces_open(to, &ic->to, ctx);
+ error = apr_iconv_ces_open(to, &ic->to, ctx);
if (error!=APR_SUCCESS) {
goto bad;
}
@@ -59,9 +59,9 @@
if (ic == NULL)
return APR_EBADF;
if (ic->from)
- iconv_ces_close(ic->from, ctx);
+ apr_iconv_ces_close(ic->from, ctx);
if (ic->to)
- iconv_ces_close(ic->to, ctx);
+ apr_iconv_ces_close(ic->to, ctx);
free(ic);
return APR_SUCCESS;
}