Skip to content
Browse files

This commit was manufactured by cvs2svn to create tag 'API_0_9_4'.

git-svn-id: https://svn.apache.org/repos/asf/apr/apr-iconv/tags/API_0_9_4@57723 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent d790bba commit 9d4587d6012adc80ce86bea89e0723e0c94079df No Author committed Sep 26, 2003
Showing with 333 additions and 81 deletions.
  1. +6 −0 CHANGES
  2. +13 −36 Makefile.in
  3. +2 −0 build/.cvsignore
  4. +2 −0 build/BaseAddr.ref
  5. +5 −2 buildconf
  6. +13 −15 configure.in
  7. +144 −0 include/api_version.h
  8. +1 −0 lib/.cvsignore
  9. +26 −1 lib/Makefile.in
  10. +75 −0 lib/api_version.c
  11. +46 −27 util/iconv.c
View
6 CHANGES
@@ -1,5 +1,11 @@
Changes with APR-ICONV 0.9.4
+ *) Add -v option to iconv program. [Justin Erenkrantz]
+
+ *) Add api_version.h. [Justin Erenkrantz]
+
+ *) A fourth pass at a build system. [Justin Erenkrantz]
+
*) A third pass at a build system. [Justin Erenkrantz]
Changes with APR-ICONV 0.9.3
View
49 Makefile.in
@@ -1,20 +1,19 @@
#
# Top-level Makefile for APRICONV
#
-abs_srcdir=@abs_srcdir@
-abs_builddir=@abs_builddir@
+abs_srcdir=@api_srcdir@
+abs_builddir=@api_builddir@
VPATH = @srcdir@
# bring in rules.mk for standard functionality
@INCLUDE_RULES@
-SUBDIRS = lib ccs ces
-CLEAN_SUBDIRS = . lib ccs ces
+SUBDIRS = lib ccs ces util
+CLEAN_SUBDIRS = . lib ccs ces util
-TARGET_LIB = lib/libapriconv.la
+TARGET_LIB = libapriconv.la
-CLEAN_TARGETS = $(TARGET_EXPORTS)
-DISTCLEAN_TARGETS = config.cache config.log config.status export_vars.sh
+DISTCLEAN_TARGETS = config.cache config.log config.status
EXTRACLEAN_TARGETS = configure libtool aclocal.m4
### install location
@@ -26,26 +25,17 @@ includedir=@includedir@
MKINSTALLDIRS=$(abs_srcdir)/build/mkdir.sh
-delete-lib:
- @if test -f $(TARGET_LIB); then \
- objects="`find $(SUBDIRS) -name '*.lo' -a -newer $(TARGET_LIB)`" ; \
- if test -n "$$objects"; then \
- echo Found newer objects. Will relink $(TARGET_LIB). ; \
- echo $(RM) -f $(TARGET_LIB) ; \
- $(RM) -f $(TARGET_LIB) ; \
- fi \
- fi
-
-install: $(TARGET_LIB)
+install:
if [ ! -d $(includedir) ]; then \
$(MKINSTALLDIRS) $(includedir); \
fi; \
+ cp -p $(abs_srcdir)/include/*.h $(includedir); \
cp -p $(abs_srcdir)/lib/*.h $(includedir); \
cp -p $(abs_builddir)/lib/*.h $(includedir); \
if [ ! -d $(lib_prefix) ]; then \
$(MKINSTALLDIRS) $(lib_prefix); \
- fi; \
- $(LIBTOOL) --mode=install cp $(TARGET_LIB) $(lib_prefix)
+ fi;
+ (cd lib; $(LIBTOOL) --mode=install cp $(TARGET_LIB) $(lib_prefix))
if [ ! -d $(libdir) ]; then \
$(MKINSTALLDIRS) $(libdir); \
fi; \
@@ -54,23 +44,10 @@ install: $(TARGET_LIB)
if [ ! -d $(exec_prefix) ]; then \
$(MKINSTALLDIRS) $(exec_prefix); \
fi; \
- (cd util/.libs; $(LIBTOOL) --mode=install cp iconv $(exec_prefix))
-
-delete-exports:
- @if test -f $(TARGET_EXPORTS); then \
- headers="`find lib/*.h -newer $(TARGET_EXPORTS)`" ; \
- if test -n "$$headers"; then \
- echo Found newer headers. Will rebuild $(TARGET_EXPORTS). ; \
- echo $(RM) -f $(TARGET_EXPORTS) ; \
- $(RM) -f $(TARGET_EXPORTS) ; \
- fi \
- fi
-
-$(TARGET_EXPORTS):
- $(AWK) -f @APR_SOURCE_DIR@/build/make_export.awk lib/*.h > $@ ;
+ (cd util; $(LIBTOOL) --mode=install cp iconv $(exec_prefix))
docs:
mkdir ./docs
- perl @APR_SOURCE_DIR@/build/scandoc.pl -i./build/default.pl -p./docs/ ./lib/*.h
+ perl $(abs_srcdir)/build/scandoc.pl -i./build/default.pl -p./docs/ ./lib/*.h
-.PHONY: delete-lib delete-exports
+.PHONY: delete-lib
View
2 build/.cvsignore
@@ -4,3 +4,5 @@ config.sub
find_apr.m4
install.sh
mkdir.sh
+make_exports.awk
+make_var_export.awk
View
2 build/BaseAddr.ref
@@ -223,3 +223,5 @@ windows-1255.so 0x6e030000 0x00010000
windows-1256.so 0x6e020000 0x00010000
windows-1257.so 0x6e010000 0x00010000
windows-1258.so 0x6e000000 0x00010000
+osd_ebcdic_df04_1.so 0x6dff0000 0x00010000
+osd_ebcdic_df04_15.so 0x6dfe0000 0x00010000
View
7 buildconf
@@ -35,10 +35,13 @@ fi
# Remove some files, then copy them from apr source tree
rm -f build/apr_common.m4 build/find_apr.m4 build/install.sh \
- build/config.guess build/config.sub build/mkdir.sh
+ build/config.guess build/config.sub build/mkdir.sh \
+ build/make_exports.awk build/make_var_export.awk
cp $apr_src_dir/build/apr_common.m4 $apr_src_dir/build/find_apr.m4 \
$apr_src_dir/build/install.sh $apr_src_dir/build/config.guess \
- $apr_src_dir/build/config.sub $apr_src_dir/build/mkdir.sh build
+ $apr_src_dir/build/config.sub $apr_src_dir/build/mkdir.sh \
+ $apr_src_dir/build/make_exports.awk $apr_src_dir/build/make_var_export.awk \
+ build
# Remove aclocal.m4 as it'll break some builds...
rm -rf aclocal.m4 autom4te*.cache
View
28 configure.in
@@ -17,33 +17,31 @@ dnl This is required by autoconf!
AC_PROG_AWK
dnl compute the top directory of the build
-abs_srcdir=`(cd $srcdir && pwd)`
-abs_builddir=`pwd`
-top_builddir="$abs_builddir"
+# Absolute source/build directory
+api_srcdir=`(cd $srcdir && pwd)`
+api_builddir=`pwd`
+AC_SUBST(api_srcdir)
+AC_SUBST(api_builddir)
-AC_SUBST(abs_srcdir)
-AC_SUBST(abs_builddir)
-AC_SUBST(top_builddir)
-
-if test "$abs_builddir" != "$abs_srcdir"; then
+if test "$api_builddir" != "$api_srcdir"; then
USE_VPATH=1
fi
dnl check for APR
API_FIND_APR
dnl copy apr's rules.mk into our build directory.
-if test ! -d $abs_builddir/build ; then
- mkdir $abs_builddir/build
+if test ! -d $api_builddir/build ; then
+ mkdir $api_builddir/build
fi
-cp $APR_BUILD_DIR/apr_rules.mk $abs_builddir/build/rules.mk
+cp $APR_BUILD_DIR/apr_rules.mk $api_builddir/build/rules.mk
dnl
dnl set up the compilation flags and stuff
dnl
-API_INCLUDES="-I$abs_builddir/lib -I$abs_builddir/include"
+API_INCLUDES="-I$api_builddir/lib -I$api_builddir/include"
if test -n "$USE_VPATH"; then
- API_INCLUDES="$API_INCLUDES -I$abs_srcdir/lib -I$abs_srcdir/include"
+ API_INCLUDES="$API_INCLUDES -I$api_srcdir/lib -I$api_srcdir/include"
fi
AC_SUBST(API_INCLUDES)
@@ -61,10 +59,10 @@ dnl BSD/OS (BSDi) needs to use a different include syntax in the Makefiles
dnl
case "$host_alias" in
*bsdi*)
- INCLUDE_RULES=".include \"$abs_builddir/build/rules.mk\""
+ INCLUDE_RULES=".include \"$api_builddir/build/rules.mk\""
;;
*)
- INCLUDE_RULES="include $abs_builddir/build/rules.mk"
+ INCLUDE_RULES="include $api_builddir/build/rules.mk"
;;
esac
AC_SUBST(INCLUDE_RULES)
View
144 include/api_version.h
@@ -0,0 +1,144 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * 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 APACHE SOFTWARE FOUNDATION OR
+ * ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+#ifndef API_VERSION_H
+#define API_VERSION_H
+
+#include "apr.h"
+#include "apr_version.h"
+
+#include "apr_iconv.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file api_version.h
+ * @brief
+ *
+ * APR-iconv's Version
+ *
+ * There are several different mechanisms for accessing the version. There
+ * is a string form, and a set of numbers; in addition, there are constants
+ * which can be compiled into your application, and you can query the library
+ * being used for its actual version.
+ *
+ * Note that it is possible for an application to detect that it has been
+ * compiled against a different version of API by use of the compile-time
+ * constants and the use of the run-time query function.
+ *
+ * API version numbering follows the guidelines specified in:
+ *
+ * http://apr.apache.org/versioning.html
+ */
+
+/* The numeric compile-time version constants. These constants are the
+ * authoritative version numbers for API.
+ */
+
+/** major version
+ * Major API changes that could cause compatibility problems for older
+ * programs such as structure size changes. No binary compatibility is
+ * possible across a change in the major version.
+ */
+#define API_MAJOR_VERSION 0
+
+/**
+ * Minor API changes that do not cause binary compatibility problems.
+ * Should be reset to 0 when upgrading API_MAJOR_VERSION
+ */
+#define API_MINOR_VERSION 9
+
+/** patch level */
+#define API_PATCH_VERSION 4
+
+/**
+ * This symbol is defined for internal, "development" copies of API. This
+ * symbol will be #undef'd for releases.
+ */
+/* #undef API_IS_DEV_VERSION */
+
+
+/** The formatted string of API's version */
+#define API_VERSION_STRING \
+ APR_STRINGIFY(API_MAJOR_VERSION) "." \
+ APR_STRINGIFY(API_MINOR_VERSION) "." \
+ APR_STRINGIFY(API_PATCH_VERSION) \
+ API_IS_DEV_STRING
+
+/**
+ * Return APR-util's version information information in a numeric form.
+ *
+ * @param pvsn Pointer to a version structure for returning the version
+ * information.
+ */
+API_DECLARE(void) api_version(apr_version_t *pvsn);
+
+/** Return API's version information as a string. */
+API_DECLARE(const char *) api_version_string(void);
+
+
+/** Internal: string form of the "is dev" flag */
+#ifdef API_IS_DEV_VERSION
+#define API_IS_DEV_STRING "-dev"
+#else
+#define API_IS_DEV_STRING ""
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* API_VERSION_H */
View
1 lib/.cvsignore
@@ -3,5 +3,6 @@
*.lo
*.slo
apriconv.exports
+exports.c
apr_iconv_private.h.in
apr_iconv_private.h
View
27 lib/Makefile.in
@@ -1,14 +1,26 @@
# Generated automatically from Makefile.in by configure.
+abs_srcdir=@api_srcdir@
+abs_builddir=@api_builddir@
VPATH = @srcdir@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+
INCLUDES = @API_INCLUDES@ @APR_INCLUDES@
TARGET_LIB = libapriconv.la
SUBDIRS = .
+EXPORT_FILES = $(abs_srcdir)/include/*.h $(abs_srcdir)/lib/*.h
+TARGET_EXPORTS = apriconv.exports
+
+CLEAN_TARGETS = exports.c
+
# May need to do something for apriconv.exports
TARGETS = iconv_module.lo iconv.lo iconv_int.lo iconv_uc.lo \
- iconv_ces.lo iconv_ces_euc.lo iconv_ces_iso2022.lo $(TARGET_LIB)
+ iconv_ces.lo iconv_ces_euc.lo iconv_ces_iso2022.lo api_version.lo \
+ exports.lo $(TARGET_LIB)
#OBJECTS=
@@ -20,3 +32,16 @@ $(TARGET_LIB):
tmpcmd="$(LINK) @APR_LIB_TARGET@"; \
echo $$tmpcmd; \
$$tmpcmd && touch $@
+
+exports.c:
+ $(AWK) -f $(abs_srcdir)/build/make_exports.awk $(EXPORT_FILES) > $@
+
+export_vars.h:
+ $(AWK) -f $(abs_srcdir)/build/make_var_export.awk $(EXPORT_FILES) > $@
+
+$(TARGET_EXPORTS): exports.c export_vars.h
+ @echo "#! lib@APR_LIBNAME@.so" > $@
+ @echo "* This file was AUTOGENERATED at build time." >> $@
+ @echo "* Please do not edit by hand." >> $@
+ $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@
+ $(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.h | sed -e 's/^\#[^!]*//' | sed -e '/^$$/d' >> $@
View
75 lib/api_version.c
@@ -0,0 +1,75 @@
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2000-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * 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 APACHE SOFTWARE FOUNDATION OR
+ * ITS 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+#include "apr_general.h" /* for APR_STRINGIFY */
+
+#include "apr_iconv.h"
+#include "api_version.h"
+
+API_DECLARE(void) api_version(apr_version_t *pvsn)
+{
+ pvsn->major = API_MAJOR_VERSION;
+ pvsn->minor = API_MINOR_VERSION;
+ pvsn->patch = API_PATCH_VERSION;
+#ifdef API_IS_DEV_VERSION
+ pvsn->is_dev = 1;
+#else
+ pvsn->is_dev = 0;
+#endif
+}
+
+API_DECLARE(const char *) api_version_string(void)
+{
+ return API_VERSION_STRING;
+}
View
73 util/iconv.c
@@ -31,6 +31,9 @@
*/
#include "apr.h"
+#include "apr_getopt.h"
+
+#include "api_version.h"
#include <stdarg.h> /* va_end, va_list, va_start */
#include <stdio.h> /* FILE, fclose, ferror, fopen, fread, stdin,
@@ -79,31 +82,55 @@ static void closeapr(void)
}
int
-main(int argc, char * const *argv)
+main(int argc, const char **argv)
{
apr_iconv_t cd;
iconv_stream *is;
- char *from = NULL, *to = NULL, *input = NULL;
- int opt;
+ const char *from = NULL, *to = NULL, *input = NULL;
+ char opt;
apr_pool_t *ctx;
apr_status_t status;
+ apr_getopt_t *options;
+ const char *opt_arg;
- while ((opt = getopt(argc, argv, "f:s:t:")) > 0) {
- switch (opt) {
- case 'f':
- from = optarg;
- break;
- case 't':
- to = optarg;
- break;
- case 's':
- input = optarg;
- break;
- default:
- fprintf(stderr, "Usage: iconv -f <name> -t <name> [-s <input>]\n");
- exit(3);
- }
- }
+ /* Initialize APR */
+ apr_initialize();
+ atexit(closeapr);
+ if (apr_pool_create(&ctx, NULL) != APR_SUCCESS) {
+ fprintf(stderr, "Couldn't allocate context.\n");
+ exit(-1);
+ }
+
+ apr_getopt_init(&options, ctx, argc, argv);
+
+ status = apr_getopt(options, "f:s:t:v", &opt, &opt_arg);
+
+ while (status == APR_SUCCESS) {
+ switch (opt) {
+ case 'f':
+ from = opt_arg;
+ break;
+ case 't':
+ to = opt_arg;
+ break;
+ case 's':
+ input = opt_arg;
+ break;
+ case 'v':
+ fprintf(stderr, "APR-iconv version " API_VERSION_STRING "\n");
+ exit(0);
+ default:
+ fprintf(stderr, "Usage: iconv -f <name> -t <name> [-s <input>]\n");
+ exit(3);
+ }
+
+ status = apr_getopt(options, "f:s:t:v",&opt, &opt_arg);
+ }
+
+ if (status == APR_BADCH || status == APR_BADARG) {
+ fprintf(stderr, "Usage: iconv -f <name> -t <name> [-s <input>]\n");
+ exit(3);
+ }
if (from == NULL) {
fprintf(stderr, "missing source charset (-f <name>)\n");
exit(4);
@@ -113,14 +140,6 @@ main(int argc, char * const *argv)
exit(5);
}
- /* Initialize APR */
- apr_initialize();
- atexit(closeapr);
- if (apr_pool_create(&ctx, NULL) != APR_SUCCESS) {
- fprintf(stderr, "Couldn't allocate context.\n");
- exit(-1);
- }
-
/* Use it */
status = apr_iconv_open(to, from, ctx, &cd);
if (status) {

0 comments on commit 9d4587d

Please sign in to comment.
Something went wrong with that request. Please try again.