aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-01 13:19:51 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-01 13:19:51 +0000
commit5891046a8615390bd96fb3cf1c4663bf00d12e47 (patch)
tree9bf6842ab437a66a259d909737ab6c1d8ad8b478
parentf9f219d99a5b3b29af184bff9afe70aa9ed427a1 (diff)
downloadglibc-5891046a8615390bd96fb3cf1c4663bf00d12e47.tar
glibc-5891046a8615390bd96fb3cf1c4663bf00d12e47.tar.gz
glibc-5891046a8615390bd96fb3cf1c4663bf00d12e47.tar.bz2
glibc-5891046a8615390bd96fb3cf1c4663bf00d12e47.zip
Update.
* iconv/gconv_conf.c (builtin_aliases): New variable. (__gconv_read_conf): Add builtin aliases. * iconv/gconv_builtin.c (builtin_map): Define BUILTIN?ALIAS as an noop macro before including gconv_builtin.h. * iconv/gconv_builtin.h: Add alias names.
-rw-r--r--ChangeLog6
-rw-r--r--iconv/gconv_builtin.c3
-rw-r--r--iconv/gconv_builtin.h7
-rw-r--r--iconv/gconv_conf.c25
4 files changed, 37 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 4a906502fd..f1fe222842 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
1998-04-01 Ulrich Drepper <drepper@cygnus.com>
+ * iconv/gconv_conf.c (builtin_aliases): New variable.
+ (__gconv_read_conf): Add builtin aliases.
+ * iconv/gconv_builtin.c (builtin_map): Define BUILTIN?ALIAS as an
+ noop macro before including gconv_builtin.h.
+ * iconv/gconv_builtin.h: Add alias names.
+
* iconv/gconv_simple.c (__gconv_transform_ucs4_utf8): Compute
number of converted bytes correctly.
diff --git a/iconv/gconv_builtin.c b/iconv/gconv_builtin.c
index 4193822e16..786a3c1e26 100644
--- a/iconv/gconv_builtin.c
+++ b/iconv/gconv_builtin.c
@@ -1,5 +1,5 @@
/* Table for builtin transformation mapping.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -41,6 +41,7 @@ static struct builtin_map
init: Init, \
end: End, \
},
+#define BUILTIN_ALIAS(From, To)
#include <gconv_builtin.h>
};
diff --git a/iconv/gconv_builtin.h b/iconv/gconv_builtin.h
index 8dcc3aaaa2..3990b2cdb3 100644
--- a/iconv/gconv_builtin.h
+++ b/iconv/gconv_builtin.h
@@ -1,5 +1,5 @@
/* Builtin transformations.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -18,13 +18,16 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+BUILTIN_ALIAS ("UTF8//", "ISO-10646/UTF8/")
+BUILTIN_ALIAS ("UTF-8//", "ISO-10646/UTF8/")
+
BUILTIN_TRANSFORMATION ("([^/]+)/UCS4/([^/]*)", NULL, 0,
"\\1/UTF8/\\2", 1, "=ucs4->utf8",
__gconv_transform_ucs4_utf8,
__gconv_transform_init_rstate,
__gconv_transform_end_rstate)
-BUILTIN_TRANSFORMATION ("([^/]+)/UTF8/([^/]*)", NULL, 0,
+BUILTIN_TRANSFORMATION ("([^/]+)/UTF-?8/([^/]*)", NULL, 0,
"\\1/UCS4/\\2", 1, "=utf8->ucs4",
__gconv_transform_utf8_ucs4,
__gconv_transform_init_rstate,
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index fb03372def..0c5ceef9e2 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -1,5 +1,5 @@
/* Handle configuration data.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -56,6 +56,20 @@ static struct gconv_module builtin_modules[] =
cost: Cost, \
module_name: Name \
},
+#define BUILTIN_ALIAS(From, To)
+
+#include "gconv_builtin.h"
+};
+
+#undef BUILTIN_TRANSFORMATION
+#undef BUILTIN_ALIAS
+
+static const char *
+builtin_aliases[] =
+{
+#define BUILTIN_TRANSFORMATION(From, ConstPfx, ConstLen, To, Cost, Name, \
+ Fct, Init, End)
+#define BUILTIN_ALIAS(From, To) From " " To,
#include "gconv_builtin.h"
};
@@ -362,6 +376,7 @@ __gconv_read_conf (void)
void *modules = NULL;
size_t nmodules = 0;
int save_errno = errno;
+ size_t cnt;
if (user_path == NULL)
/* No user-defined path. Make a modifiable copy of the default path. */
@@ -428,6 +443,14 @@ __gconv_read_conf (void)
}
}
+ /* Add aliases for builtin conversions. */
+ cnt = sizeof (builtin_aliases) / sizeof (builtin_aliases[0]);
+ while (cnt > 0)
+ {
+ char *copy = strdupa (builtin_aliases[--cnt]);
+ add_alias (copy);
+ }
+
/* Restore the error number. */
__set_errno (save_errno);
}