* 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.
This commit is contained in:
Ulrich Drepper 1998-04-01 13:19:51 +00:00
parent f9f219d99a
commit 5891046a86
4 changed files with 37 additions and 4 deletions

View File

@ -1,5 +1,11 @@
1998-04-01 Ulrich Drepper <drepper@cygnus.com> 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 * iconv/gconv_simple.c (__gconv_transform_ucs4_utf8): Compute
number of converted bytes correctly. number of converted bytes correctly.

View File

@ -1,5 +1,5 @@
/* Table for builtin transformation mapping. /* 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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -41,6 +41,7 @@ static struct builtin_map
init: Init, \ init: Init, \
end: End, \ end: End, \
}, },
#define BUILTIN_ALIAS(From, To)
#include <gconv_builtin.h> #include <gconv_builtin.h>
}; };

View File

@ -1,5 +1,5 @@
/* Builtin transformations. /* 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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -18,13 +18,16 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
BUILTIN_ALIAS ("UTF8//", "ISO-10646/UTF8/")
BUILTIN_ALIAS ("UTF-8//", "ISO-10646/UTF8/")
BUILTIN_TRANSFORMATION ("([^/]+)/UCS4/([^/]*)", NULL, 0, BUILTIN_TRANSFORMATION ("([^/]+)/UCS4/([^/]*)", NULL, 0,
"\\1/UTF8/\\2", 1, "=ucs4->utf8", "\\1/UTF8/\\2", 1, "=ucs4->utf8",
__gconv_transform_ucs4_utf8, __gconv_transform_ucs4_utf8,
__gconv_transform_init_rstate, __gconv_transform_init_rstate,
__gconv_transform_end_rstate) __gconv_transform_end_rstate)
BUILTIN_TRANSFORMATION ("([^/]+)/UTF8/([^/]*)", NULL, 0, BUILTIN_TRANSFORMATION ("([^/]+)/UTF-?8/([^/]*)", NULL, 0,
"\\1/UCS4/\\2", 1, "=utf8->ucs4", "\\1/UCS4/\\2", 1, "=utf8->ucs4",
__gconv_transform_utf8_ucs4, __gconv_transform_utf8_ucs4,
__gconv_transform_init_rstate, __gconv_transform_init_rstate,

View File

@ -1,5 +1,5 @@
/* Handle configuration data. /* 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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -56,6 +56,20 @@ static struct gconv_module builtin_modules[] =
cost: Cost, \ cost: Cost, \
module_name: Name \ 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" #include "gconv_builtin.h"
}; };
@ -362,6 +376,7 @@ __gconv_read_conf (void)
void *modules = NULL; void *modules = NULL;
size_t nmodules = 0; size_t nmodules = 0;
int save_errno = errno; int save_errno = errno;
size_t cnt;
if (user_path == NULL) if (user_path == NULL)
/* No user-defined path. Make a modifiable copy of the default path. */ /* 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. */ /* Restore the error number. */
__set_errno (save_errno); __set_errno (save_errno);
} }