ICU-720 expose ucnv_aliasNameCmp() (instead of the private

charsetNameCmp(), and use the new function where needed.

X-SVN-Rev: 2930
This commit is contained in:
Yves Arrouye 2000-11-17 05:02:31 +00:00
parent 06d579d8b1
commit 59ce3d1187
8 changed files with 50 additions and 28 deletions

1
.gitignore vendored
View file

@ -27,6 +27,7 @@ icu4c/debian/icu.prerm
icu4c/debian/libicu-dev
icu4c/debian/libicu16
icu4c/debian/libicu16.prerm
icu4c/debian/tmp
icu4c/source/Makefile
icu4c/source/README
icu4c/source/common/*.ao

View file

@ -8,6 +8,7 @@ icu
icu-locales
icu-data
icu-i18ndata
tmp
icu.postinst
icu.prerm
libicu16.prerm

View file

@ -1,3 +1,9 @@
icu (1.6.0.1-20001113-2) unstable; urgency=low
* New snapshot with better ISO-2022.
-- Yves Arrouye <yves@debian.org> Mon, 13 Nov 2000 21:05:00 -0800
icu (1.6.0.1-20001027-1) unstable; urgency=low
* Move architecture-dependent files into /usr/lib, instead of

View file

@ -10,11 +10,13 @@
# This is the debhelper compatability version to use.
export DH_COMPAT=2
firstdir := $(shell sed -n 's/Package: \(.*\)/\1/p' debian/control | head -1)
#firstdir := $(shell sed -n 's/Package: \(.*\)/\1/p' debian/control | head -1)
# Where the source for ICU is, where to build
srcdir = source
builddir = build
builddir = debian/build
# How to get to $(srcdir) from $(builddir)
builddir_relative_srcdir = ../../$(srcdir)
# ICU installation directories, w/o the initial slash
pkgdatadir = usr/share/icu
@ -54,7 +56,7 @@ $(builddir)/configure-stamp:
dh_testdir
# Add here commands to configure the package.
test -d $(builddir) || mkdir $(builddir)
cd build; CFLAGS='$(CFLAGS)' CXXFLAGS='$(CFLAGS)' INSTALL_PROGRAM='$(INSTALL_PROGRAM)' ../$(srcdir)/configure --srcdir=../$(srcdir) --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --with-data-packaging=files --disable-rpath --enable-shared --enable-static --disable-samples
cd $(builddir); CFLAGS='$(CFLAGS)' CXXFLAGS='$(CFLAGS)' INSTALL_PROGRAM='$(INSTALL_PROGRAM)' $(builddir_relative_srcdir)/configure --srcdir=$(builddir_relative_srcdir) --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --with-data-packaging=files --disable-rpath --enable-shared --enable-static --disable-samples
touch $@
build: $(builddir)/configure-stamp $(builddir)/build-stamp
@ -87,8 +89,8 @@ install: build
dh_clean -k
dh_installdirs
# Add here commands to install the package into debian/$(firstdir).
$(MAKE) -C $(builddir) install DESTDIR=`pwd`/debian/$(firstdir)
# Add here commands to install the package into debian/tmp
$(MAKE) -C $(builddir) install DESTDIR=`pwd`/debian/tmp
# Build architecture-independent files here.
@ -107,11 +109,11 @@ binary-arch: build install $(addprefix debian/,$(DEBIAN_FILES))
# dh_testversion
dh_testdir
dh_testroot
rm debian/$(firstdir)/usr/sbin/gentest
rm debian/tmp/usr/sbin/gentest
#
# build libicu${major} package by moving files from icu-dev
#
dh_movefiles --sourcedir=debian/$(firstdir) -plibicu$(major) \
dh_movefiles -plibicu$(major) \
usr/lib/libicuuc.so.* \
usr/lib/libicui18n.so.* \
usr/lib/libicutoolutil.so.* \
@ -119,7 +121,7 @@ binary-arch: build install $(addprefix debian/,$(DEBIAN_FILES))
#
# build icu package by moving files from icu-dev
#
dh_movefiles --sourcedir=debian/$(firstdir) -picu \
dh_movefiles -picu \
etc \
usr/sbin \
$(icudatadir)/README \
@ -127,12 +129,12 @@ binary-arch: build install $(addprefix debian/,$(DEBIAN_FILES))
$(iculibdir)/u*.dat \
$(iculibdir)/tz.dat \
usr/share/man
rm debian/$(firstdir)/$(pkglibdir)/current
rm debian/$(firstdir)/$(iculibdir)/cnvalias.dat
rm debian/tmp/$(pkglibdir)/current
rm debian/tmp/$(iculibdir)/cnvalias.dat
#
# build icu-locales package by moving files from icu-dev
#
dh_movefiles --sourcedir=debian/$(firstdir) -picu-locales \
dh_movefiles -picu-locales \
$(iculibdir)/*.res \
$(iculibdir)/*.brk
#
@ -159,10 +161,15 @@ binary-arch: build install $(addprefix debian/,$(DEBIAN_FILES))
cd debian/icu-i18ndata/$(datasrcdir) && \
$(RM) convrtrs.txt UnicodeData*.txt ucname.txt
#
# move the rest of the development files
# in their package
#
dh_movefiles usr
#
# do a bit of cleanup
#
rm -rf debian/$(firstdir)/etc debian/$(firstdir)/usr/sbin \
debian/$(firstdir)/usr/share/man
rm -rf debian/tmp/etc debian/tmp/usr/sbin \
debian/tmp/usr/share/man
#
# continue to prepare packages
#
@ -183,8 +190,6 @@ binary-arch: build install $(addprefix debian/,$(DEBIAN_FILES))
dh_strip
dh_compress
dh_fixperms
# CVS fixup
if test -d CVS; then find debian/$(firstdir) -name CVS -print | xargs rm -r; fi
# You may want to make some executables suid here.
dh_suidregister
dh_makeshlibs

View file

@ -207,8 +207,8 @@ static int16_t getTagNumber(const char *tagname) {
* lexically precedes name2, or a positive value if the name1
* lexically follows name2.
*/
U_CFUNC int
charsetNameCmp(const char *name1, const char *name2) {
U_CAPI int U_EXPORT2
ucnv_aliasNameCmp(const char *name1, const char *name2) {
int rc;
unsigned char c1, c2;
@ -261,7 +261,7 @@ findAlias(const char *alias) {
start=0;
while(start<limit-1) {
i=(uint16_t)((start+limit)/2);
if(charsetNameCmp(name, (const char *)aliasTable+p[i])<0) {
if(ucnv_aliasNameCmp(name, (const char *)aliasTable+p[i])<0) {
limit=i;
} else {
start=i;
@ -269,7 +269,7 @@ findAlias(const char *alias) {
}
/* did we really find it? */
if(charsetNameCmp(name, (const char *)aliasTable+p[start])==0) {
if(ucnv_aliasNameCmp(name, (const char *)aliasTable+p[start])==0) {
limit=*(p-1); /* aliasCount */
p+=limit; /* advance to the second column of the alias table */
i=p[start]; /* converter index */

View file

@ -99,13 +99,6 @@ ucnv_io_getDefaultConverterName(void);
U_CFUNC void
ucnv_io_setDefaultConverterName(const char *name);
/**
* Lexically compare two converter names/aliases, ignoring case and
* the delimiters '-', '_', and ' '.
*/
U_CFUNC int
charsetNameCmp(const char *name1, const char *name2);
#endif /* _UCNV_IO */
/*

View file

@ -123,6 +123,22 @@ U_CDECL_END
*/
#define UCNV_LOCALE_OPTION_STRING ",locale="
/**
* Do a fuzzy compare of a two converter/alias names. The comparison
* is case-insensitive. It also ignores the characters '-', '_', and
* ' ' (dash, underscore, and space). Thus the strings "UTF-8",
* "utf_8", and "Utf 8" are exactly equivalent.
*
* @param name1 a converter name or alias, zero-terminated
* @param name2 a converter name or alias, zero-terminated
* @return 0 if the names match, or a negative value if the name1
* lexically precedes name2, or a positive value if the name1
* lexically follows name2.
*/
U_CAPI int U_EXPORT2
ucnv_aliasNameCmp(const char *name1, const char *name2);
/**
* Creates a UConverter object with the names specified as a C string.
* The actual name will be resolved with the alias file

View file

@ -26,9 +26,9 @@
#include <stdlib.h>
#include <ctype.h>
#include "unicode/utypes.h"
#include "unicode/ucnv.h" /* ucnv_aliasNameCmp() */
#include "cmemory.h"
#include "cstring.h"
#include "ucnv_io.h" /* charsetNameCmp */
#include "filestrm.h"
#include "unewdata.h"
#include "uoptions.h"
@ -488,7 +488,7 @@ allocString(StringBlock *block, uint32_t length) {
static int
compareAliases(const void *alias1, const void *alias2) {
return charsetNameCmp(((Alias*)alias1)->alias, ((Alias*)alias2)->alias);
return ucnv_aliasNameCmp(((Alias*)alias1)->alias, ((Alias*)alias2)->alias);
}
/*