diff --git a/icu4c/source/common/Makefile.in b/icu4c/source/common/Makefile.in
index 28ea001c201..11da50c2340 100644
--- a/icu4c/source/common/Makefile.in
+++ b/icu4c/source/common/Makefile.in
@@ -64,7 +64,7 @@ uchar.o uprops.o propname.o ubidi.o ubidiwrt.o ubidiln.o ushape.o unames.o \
ucln_cmn.o uscript.o usc_impl.o umemstrm.o ucmp8.o uvector.o uvectr32.o digitlst.o \
brkiter.o brkdict.o ubrk.o dbbi.o dbbi_tbl.o \
rbbi.o rbbidata.o rbbinode.o rbbirb.o rbbiscan.o rbbisetb.o rbbistbl.o rbbitblb.o \
-convert.o utrie.o uset.o cmemory.o caniter.o \
+utrie.o uset.o cmemory.o caniter.o \
unifilt.o unifunct.o uniset.o usetiter.o util.o uenum.o \
icuserv.o iculserv.o icunotif.o ustrenum.o
diff --git a/icu4c/source/common/common.dsp b/icu4c/source/common/common.dsp
index cd35a60b361..5e10453bdfa 100644
--- a/icu4c/source/common/common.dsp
+++ b/icu4c/source/common/common.dsp
@@ -1102,57 +1102,6 @@ InputPath=.\unicode\uversion.h
# PROP Default_Filter ""
# Begin Source File
-SOURCE=.\convert.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\unicode\convert.h
-
-!IF "$(CFG)" == "common - Win32 Release"
-
-# Begin Custom Build
-InputPath=.\unicode\convert.h
-
-"..\..\include\unicode\convert.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) ..\..\include\unicode
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "common - Win32 Debug"
-
-# Begin Custom Build
-InputPath=.\unicode\convert.h
-
-"..\..\include\unicode\convert.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) ..\..\include\unicode
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "common - Win64 Release"
-
-# Begin Custom Build
-InputPath=.\unicode\convert.h
-
-"..\..\include\unicode\convert.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) ..\..\include\unicode
-
-# End Custom Build
-
-!ELSEIF "$(CFG)" == "common - Win64 Debug"
-
-# Begin Custom Build
-InputPath=.\unicode\convert.h
-
-"..\..\include\unicode\convert.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- copy $(InputPath) ..\..\include\unicode
-
-# End Custom Build
-
-!ENDIF
-
-# End Source File
-# Begin Source File
-
SOURCE=.\ucnv.c
# End Source File
# Begin Source File
diff --git a/icu4c/source/common/convert.cpp b/icu4c/source/common/convert.cpp
deleted file mode 100644
index b150c26b650..00000000000
--- a/icu4c/source/common/convert.cpp
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
-**********************************************************************
-* Copyright (C) 1998-2001, International Business Machines
-* Corporation and others. All Rights Reserved.
-**********************************************************************
-*/
-/* C++ wrappers for the ICUs Codeset Conversion Routines*/
-
-#include "unicode/utypes.h"
-
-#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
-U_NAMESPACE_BEGIN
-
-class Locale;
-class UnicodeString;
-class Mutex;
-
-U_NAMESPACE_END
-
-#include "unicode/resbund.h"
-#include "cmemory.h"
-#include "mutex.h"
-#include "ucnv_io.h"
-#include "unicode/ucnv_err.h"
-#include "ucnv_bld.h"
-#include "unicode/ucnv.h"
-#include "unicode/convert.h"
-#include "ucln_cmn.h"
-
-
-/* list of converter and alias names */
-static const char **availableConverterNames=NULL;
-static int32_t availableConverterNamesCount=0;
-
-UBool UnicodeConverter_cleanup()
-{
- if (availableConverterNames)
- {
- uprv_free(availableConverterNames);
- availableConverterNames = NULL;
- }
- availableConverterNamesCount = 0;
- return TRUE;
-}
-
-U_NAMESPACE_BEGIN
-
-const char UnicodeConverter::fgClassID=0;
-
-UnicodeConverter::UnicodeConverter()
- : UObject()
-{
- UErrorCode err = U_ZERO_ERROR;
- myUnicodeConverter = ucnv_open(NULL, &err);
-}
-UnicodeConverter::UnicodeConverter(const char* name, UErrorCode& err)
- : UObject()
-{
- myUnicodeConverter = ucnv_open(name, &err);
-}
-
-UnicodeConverter::UnicodeConverter(const UnicodeString& name, UErrorCode& err)
- : UObject()
-{
- char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
- name.extract(myName, sizeof(myName), 0, err);
- myUnicodeConverter = ucnv_open(myName, &err);
-}
-
-
-UnicodeConverter::UnicodeConverter(int32_t codepageNumber,
- UConverterPlatform platform,
- UErrorCode& err)
- : UObject()
-{
- myUnicodeConverter = ucnv_openCCSID(codepageNumber,
- platform,
- &err);
-}
-
-UnicodeConverter& UnicodeConverter::operator=(const UnicodeConverter& that)
-{
- {
- /*Decrements the overwritten converter's ref count
- *Increments the assigner converter's ref count
- */
- Mutex updateReferenceCounters;
- if (myUnicodeConverter->sharedData->referenceCounter != 0 && myUnicodeConverter->sharedData->referenceCounter != (uint32_t) ~0) {
- myUnicodeConverter->sharedData->referenceCounter--;
- }
- if (that.myUnicodeConverter->sharedData->referenceCounter != (uint32_t) ~0) {
- that.myUnicodeConverter->sharedData->referenceCounter++;
- }
- }
-
- *myUnicodeConverter = *(that.myUnicodeConverter);
- return *this;
-}
-
-UBool UnicodeConverter::operator==(const UnicodeConverter& that) const
-{
- return
- (myUnicodeConverter->sharedData == that.myUnicodeConverter->sharedData) &&
- (myUnicodeConverter->fromCharErrorBehaviour == that.myUnicodeConverter->fromCharErrorBehaviour) &&
- (myUnicodeConverter->toUContext == that.myUnicodeConverter->toUContext) &&
- (myUnicodeConverter->toUnicodeStatus == that.myUnicodeConverter->toUnicodeStatus) &&
- (myUnicodeConverter->subChar1 == that.myUnicodeConverter->subChar1) &&
- (myUnicodeConverter->subCharLen == that.myUnicodeConverter->subCharLen) &&
- (uprv_memcmp(myUnicodeConverter->subChar, that.myUnicodeConverter->subChar, myUnicodeConverter->subCharLen) == 0) &&
- (myUnicodeConverter->UCharErrorBufferLength == that.myUnicodeConverter->UCharErrorBufferLength) &&
- (myUnicodeConverter->charErrorBufferLength == that.myUnicodeConverter->charErrorBufferLength) &&
- (uprv_memcmp(myUnicodeConverter->UCharErrorBuffer, that.myUnicodeConverter->UCharErrorBuffer, myUnicodeConverter->UCharErrorBufferLength) == 0) &&
- (uprv_memcmp(myUnicodeConverter->charErrorBuffer, that.myUnicodeConverter->charErrorBuffer, myUnicodeConverter->charErrorBufferLength) == 0) &&
- (myUnicodeConverter->fromUCharErrorBehaviour == that.myUnicodeConverter->fromUCharErrorBehaviour) &&
- (myUnicodeConverter->fromUContext == that.myUnicodeConverter->fromUContext);
-}
-
-UBool UnicodeConverter::operator!=(const UnicodeConverter& that) const
-{
- return !(*this == that);
-}
-
-UnicodeConverter::UnicodeConverter(const UnicodeConverter& that)
- : UObject(that)
-{
- /*increments the referenceCounter to let the static table know
- *it has one more client
- */
- myUnicodeConverter = (UConverter *)uprv_malloc(sizeof(UConverter)); //new UConverter;
- {
- Mutex updateReferenceCounter;
- if (that.myUnicodeConverter->sharedData->referenceCounter != (uint32_t) ~0) {
- that.myUnicodeConverter->sharedData->referenceCounter++;
- }
- }
- *myUnicodeConverter = *(that.myUnicodeConverter);
-}
-
-
-UnicodeConverter::~UnicodeConverter()
-{
- ucnv_close(myUnicodeConverter);
-}
-
- void
-UnicodeConverter::fromUnicodeString(char* target,
- int32_t& targetSize,
- const UnicodeString& source,
- UErrorCode& err) const
-{
- const UChar* mySource = NULL;
- int32_t mySourceLength = 0;
- UConverter myConverter;
- char *myTarget = NULL;
-
- if (U_FAILURE(err))
- return;
-
- if ((myUnicodeConverter == NULL) || source.isBogus() || (targetSize <= 0))
- {
- err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /*makes a local copy of the UnicodeConverter*/
- myConverter = *myUnicodeConverter;
-
- /*Removes all state info on the UnicodeConverter*/
- ucnv_reset(&myConverter);
-
-
- mySourceLength = source.length();
- mySource = source.getArrayStart();
- myTarget = target;
- ucnv_fromUnicode(&myConverter,
- &myTarget,
- target + targetSize,
- &mySource,
- mySource + mySourceLength,
- NULL,
- TRUE,
- &err);
- targetSize = myTarget - target;
-}
-
- void
-UnicodeConverter::toUnicodeString(UnicodeString& target,
- const char* source,
- int32_t sourceSize,
- UErrorCode& err) const
-{
- const char* mySource = source;
- const char* mySourceLimit = source + sourceSize;
- UChar* myTargetUChars = NULL;
- UChar* myTargetUCharsAlias = NULL;
- int32_t myTargetUCharsLength = 0;
- UConverter myConverter;
-
- if (U_FAILURE(err))
- return;
- if ((myUnicodeConverter == NULL) || target.isBogus() || (sourceSize <= 0))
- {
- err = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
-
- /*makes a local bitwise copy of the UnicodeConverter*/
- myConverter = *myUnicodeConverter;
-
- /*Removes all state info on the UnicodeConverter*/
- ucnv_reset(&myConverter);
- /*Allocates the theoritically (Not counting added bytes from the error functions) max buffer
- *on a "normal" call, only one iteration will be necessary.
- */
- myTargetUChars =
- (UChar*)uprv_malloc(sizeof(UChar)*(myTargetUCharsLength = (sourceSize/(int32_t)getMinBytesPerChar())));
-
- if (myTargetUChars == NULL)
- {
- err = U_MEMORY_ALLOCATION_ERROR;
- return;
- }
- /*renders the target clean*/
- target.remove();
-
- /*Will loop until (re-use the same buffer) until no more memory is requested
- *or an error (other than INDEX_OUTOF_BOUNDS) is encountered
- */
- do
- {
- err = U_ZERO_ERROR;
- myTargetUCharsAlias = myTargetUChars;
- ucnv_toUnicode(&myConverter,
- &myTargetUCharsAlias,
- myTargetUChars + myTargetUCharsLength,
- &mySource,
- mySourceLimit,
- NULL,
- TRUE,
- &err);
-
- /*appends what we got thus far to the UnicodeString*/
- target.replace((int32_t)target.length(),
- myTargetUCharsAlias - myTargetUChars,
- myTargetUChars,
- myTargetUCharsAlias - myTargetUChars);
- /*Checks for the integrity of target (UnicodeString) as it adds data to it*/
- if (target.isBogus())
- err = U_MEMORY_ALLOCATION_ERROR;
- } while (err == U_BUFFER_OVERFLOW_ERROR);
-
-
- uprv_free(myTargetUChars);
-}
-
-
-
-void
-UnicodeConverter::fromUnicode(char*& target,
- const char* targetLimit,
- const UChar*& source,
- const UChar* sourceLimit,
- int32_t *offsets,
- UBool flush,
- UErrorCode& err)
-{
- ucnv_fromUnicode(myUnicodeConverter,
- &target,
- targetLimit,
- &source,
- sourceLimit,
- offsets,
- flush,
- &err);
-}
-
-
-
-void
-UnicodeConverter::toUnicode(UChar*& target,
- const UChar* targetLimit,
- const char*& source,
- const char* sourceLimit,
- int32_t* offsets,
- UBool flush,
- UErrorCode& err)
-{
- ucnv_toUnicode(myUnicodeConverter,
- &target,
- targetLimit,
- &source,
- sourceLimit,
- offsets,
- flush,
- &err);
-}
-
-const char*
-UnicodeConverter::getName(UErrorCode& err) const
-{
- return ucnv_getName(myUnicodeConverter, &err);
-}
-
- int8_t
-UnicodeConverter::getMaxBytesPerChar() const
-{
- return ucnv_getMaxCharSize(myUnicodeConverter);
-}
-
-int8_t
-UnicodeConverter::getMinBytesPerChar() const
-{
- return ucnv_getMinCharSize(myUnicodeConverter);
-}
-
-void
-UnicodeConverter::getSubstitutionChars(char* subChars,
- int8_t& len,
- UErrorCode& err) const
-{
- ucnv_getSubstChars(myUnicodeConverter,
- subChars,
- &len,
- &err);
-}
-
-void
-UnicodeConverter::setSubstitutionChars(const char* subChars,
- int8_t len,
- UErrorCode& err)
-{
- ucnv_setSubstChars(myUnicodeConverter,
- subChars,
- len,
- &err);
-}
-
-
-void
-UnicodeConverter::resetState()
-{
- ucnv_reset(myUnicodeConverter);
-}
-
-
-int32_t
-UnicodeConverter::getCodepage(UErrorCode& err) const
-{
- return ucnv_getCCSID(myUnicodeConverter, &err);
-}
-
-void
-UnicodeConverter::getMissingCharAction(UConverterToUCallback *action,
- const void **context) const
-{
- ucnv_getToUCallBack(myUnicodeConverter, action, context);
-}
-
-void
-UnicodeConverter::getMissingUnicodeAction(UConverterFromUCallback *action,
- const void **context) const
-{
- ucnv_getFromUCallBack(myUnicodeConverter, action, context);
-}
-
-
-void
-UnicodeConverter::setMissingCharAction(UConverterToUCallback newAction,
- const void *newContext,
- UConverterToUCallback *oldAction,
- const void **oldContext,
- UErrorCode& err)
-{
- ucnv_setToUCallBack(myUnicodeConverter, newAction, newContext, oldAction, oldContext, &err);
-}
-
-void
-UnicodeConverter::setMissingUnicodeAction(UConverterFromUCallback newAction,
- const void* newContext,
- UConverterFromUCallback *oldAction,
- const void** oldContext,
- UErrorCode& err)
-{
- ucnv_setFromUCallBack(myUnicodeConverter, newAction, newContext, oldAction, oldContext, &err);
-}
-
-
-void
-UnicodeConverter::getDisplayName(const Locale& displayLocale,
- UnicodeString& displayName) const
-{
- UErrorCode err = U_ZERO_ERROR;
- UChar name[UCNV_MAX_CONVERTER_NAME_LENGTH];
- int32_t length = ucnv_getDisplayName(myUnicodeConverter,
- displayLocale.getName(),
- name,
- UCNV_MAX_CONVERTER_NAME_LENGTH,
- &err);
- if (U_SUCCESS(err))
- {
- displayName.replace(0, 0x7fffffff, name, length);
- }
- else
- {
- /*Error While creating the resource bundle use the internal name instead*/
- displayName.remove();
- displayName = getName(err); /*Get the raw ASCII name*/
- }
-}
-
-
-UConverterPlatform
-UnicodeConverter::getCodepagePlatform(UErrorCode &err) const
-{
- return ucnv_getPlatform(myUnicodeConverter, &err);
-}
-
-UConverterType UnicodeConverter::getType() const
-{
- return ucnv_getType(myUnicodeConverter);
-}
-
-void UnicodeConverter::getStarters(UBool starters[256],
- UErrorCode& err) const
-{
- ucnv_getStarters(myUnicodeConverter,
- starters,
- &err);
-}
-
-const char* const*
-UnicodeConverter::getAvailableNames(int32_t& num, UErrorCode& err)
-{
- if(U_FAILURE(err)) {
- num = 0;
- return NULL;
- }
- if (availableConverterNames==NULL) {
- int32_t count = ucnv_io_countAvailableConverters(&err);
- if (count > 0) {
- const char **names = (const char **) uprv_malloc( sizeof(const char*) * count );
- if (names != NULL) {
- ucnv_io_fillAvailableConverters(names, &err);
-
- /* in the mutex block, set the data for this process */
- umtx_lock(0);
- if (availableConverterNames == NULL) {
- availableConverterNamesCount = count;
- availableConverterNames = names;
- names = 0;
- }
- umtx_unlock(0);
-
- /* if a different thread set it first, then delete the extra data */
- if (names != 0) {
- uprv_free(names);
- }
- } else {
- num = 0;
- err = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
- }
- }
- }
- num = availableConverterNamesCount;
- return availableConverterNames;
-}
-
-int32_t UnicodeConverter::flushCache()
-{
- return ucnv_flushCache();
-}
-
-/* TODO: To be cleaned up. The usage of UChar* and UnicodeString in
-the C++ APIs need to be revisited. */
-void UnicodeConverter::fixFileSeparator(UnicodeString& source) const {
- if(this==NULL || &source==NULL || source.length()<=0) {
- return;
- }
-
- ucnv_fixFileSeparator(myUnicodeConverter, source.getArrayStart(), source.length());
-}
-
-UBool UnicodeConverter::isAmbiguous(void) const
-{
- return ucnv_isAmbiguous(myUnicodeConverter);
-}
-
-U_NAMESPACE_END
-#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
diff --git a/icu4c/source/common/unicode/convert.h b/icu4c/source/common/unicode/convert.h
deleted file mode 100644
index 56b109a72b6..00000000000
--- a/icu4c/source/common/unicode/convert.h
+++ /dev/null
@@ -1,484 +0,0 @@
-/*****************************************************************************
- *
- * Copyright (C) 1998-2001, International Business Machines
- * Corporation and others. All Rights Reserved.
- *
- *
- * Change history:
- *
- * 06/29/2000 helena Major rewrite of the callback APIs.
- *****************************************************************************/
-
-#ifndef CONVERT_H
-#define CONVERT_H
-
-#include "unicode/utypes.h"
-
-#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
-#include "unicode/uobject.h"
-#include "unicode/unistr.h"
-#include "unicode/ucnv.h"
-
-U_NAMESPACE_BEGIN
-/**
- * This class is obsolete and will be removed.
- * Use the more powerful C conversion API with the UConverter type and ucnv_... functions.
- *
- * There are also two new functions in ICU 2.0 that convert a UnicodeString
- * and extract a UnicodeString using a UConverter (search unistr.h for UConverter).
- * They replace the fromUnicodeString() and toUnicodeString() functions here.
- * All other UnicodeConverter functions are basically aliases of C API functions.
- *
- * Old documentation:
- *
- * UnicodeConverter is a C++ wrapper class for UConverter.
- * You need one UnicodeConverter object in place of one UConverter object.
- * For details on the API and implementation of the
- * codepage converter interface see ucnv.h.
- *
- * @see UConverter
- * @obsolete ICU 2.4. Use the C API with UConverter and ucnv_... functions instead since this API will be removed in that release.
- */
-class U_COMMON_API UnicodeConverter : public UObject {
- private:
- /*Internal Data representation of the Converter*/
- UConverter* myUnicodeConverter;
- /*Debug method*/
- void printRef(void) const;
-
- public:
-
-//Constructors and a destructor
-
- /**
- * Creates Unicode Conversion Object will default to LATIN1 <-> encoding
- * @return the created Unicode converter object
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- UnicodeConverter();
-
-/**
- * Creates Unicode Conversion Object by specifying the codepage name. The name
- * string is in ASCII format.
- * @param name the pointer to a char[] object containing a codepage name. (I)
- * @param err Error status (I/O) IILLEGAL_ARGUMENT_ERROR will be returned if the string is empty.
- * If the internal program does not work correctly, for example, if there's no such codepage,
- * U_INTERNAL_PROGRAM_ERROR will be returned.
- * @return the created Unicode converter object
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- UnicodeConverter(const char* name,
- UErrorCode& err);
-
- /**
- *Creates a UnicodeConverter object with the names specified as unicode strings. The name should be limited to
- *the ASCII-7 alphanumerics. Dash and underscore characters are allowed for readability, but are ignored in the
- *search.
- *@param name name of the uconv table in Unicode string (I)
- *@param err error status (I/O) IILLEGAL_ARGUMENT_ERROR will be returned if the string is empty. If the internal
- *program does not work correctly, for example, if there's no such codepage, U_INTERNAL_PROGRAM_ERROR will be
- *returned.
- *@return the created Unicode converter object
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- UnicodeConverter(const UnicodeString& name,
- UErrorCode& err);
-
- /**
- * Creates Unicode Conversion Object using the codepage ID number.
- * @param codepageNumber a codepage # (I)
- * @param platform Enum for specifying which platform a converter ID refers to.
- * @UErrorCode err Error status (I/O) IILLEGAL_ARGUMENT_ERROR will be returned if the string is empty.
- * If the internal program does not work correctly, for example, if there's no such codepage,
- * U_INTERNAL_PROGRAM_ERROR will be returned.
- * @return the Unicode converter object
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- UnicodeConverter(int32_t codepageNumber,
- UConverterPlatform platform,
- UErrorCode& err);
-
- ~UnicodeConverter();
-
-
- /**
- * Transcodes the source UnicodeString to the target string in a codepage encoding
- * with the specified Unicode converter. For example, if a Unicode to/from JIS
- * converter is specified, the source string in Unicode will be transcoded to JIS
- * encoding. The result will be stored in JIS encoding.
- *
- * @param target The target string in codepage encoding
- * @param targetSize Input the number of bytes available in the "target" buffer, Output the number of bytes copied to it
- * @param source the source Unicode string
- * @param err the error status code. U_MEMORY_ALLOCATION_ERROR will be returned if the
- * the internal process buffer cannot be allocated for transcoding. U_ILLEGAL_ARGUMENT_ERROR
- * is returned if the converter is null or the source or target string is empty.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void fromUnicodeString(char* target,
- int32_t& targetSize,
- const UnicodeString& source,
- UErrorCode& err) const;
-
-/**
- * Transcode the source string in codepage encoding to the target string in
- * Unicode encoding. For example, if a Unicode to/from JIS
- * converter is specified, the source string in JIS encoding will be transcoded
- * to Unicode encoding. The result will be stored in Unicode encoding.
- * @param target the target string in Unicode encoding
- * @param source the source string in codepage encoding
- * @param sourceSize : I/O parameter, Input size buffer, Output # of bytes copied to it
- * @param err the error status code U_MEMORY_ALLOCATION_ERROR will be returned if the
- * the internal process buffer cannot be allocated for transcoding. U_ILLEGAL_ARGUMENT_ERROR
- * is returned if the converter is null or the source or target string is empty.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void toUnicodeString(UnicodeString& target,
- const char* source,
- int32_t sourceSize,
- UErrorCode& err) const;
-
-/**
- * Transcodes an array of unicode characters to an array of codepage characters.
- * The source pointer is an I/O parameter, it starts out pointing at the place
- * to begin translating, and ends up pointing after the first sequence of the bytes
- * that it encounters that are semantically invalid.
- * if T_UnicodeConverter_setMissingCharAction is called with an action other than STOP
- * before a call is made to this API, consumed and source should point to the same place
- * (unless target ends with an imcomplete sequence of bytes and flush is FALSE).
- * @param target : I/O parameter. Input : Points to the beginning of the buffer to copy
- * codepage characters to. Output : points to after the last codepage character copied
- * to target.
- * @param targetLimit the pointer to the end of the target array
- * @param source the source Unicode character array
- * @param sourceLimit the pointer to the end of the source array
- * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
- * of allocated cells as target. Will fill in offsets from target to source pointer
- * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6]
- * For output data carried across calls, and other data without a specific source character
- * (such as from escape sequences or callbacks) -1 will be placed for offsets.
- * @param flush set to TRUE if the current source buffer is the last available
- * chunk of the source, FALSE otherwise. Note that if a failing status is returned,
- * this function may have to be called multiple times wiht flush set to TRUE until
- * the source buffer is consumed.
- * @param flush TRUE if the buffer is the last buffer and the conversion will finish
- * in this call, FALSE otherwise. (future feature pending)
- * @param UErrorCode the error status. U_ILLEGAL_ARGUMENT_ERROR will be returned if the
- * converter is null.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void fromUnicode(char*& target,
- const char* targetLimit,
- const UChar*& source,
- const UChar* sourceLimit,
- int32_t * offsets,
- UBool flush,
- UErrorCode& err);
-
-
-/**
- * Converts an array of codepage characters into an array of unicode characters.
- * The source pointer is an I/O parameter, it starts out pointing at the place
- * to begin translating, and ends up pointing after the first sequence of the bytes
- * that it encounters that are semantically invalid.
- * if T_UnicodeConverter_setMissingUnicodeAction is called with an action other than STOP
- * before a call is made to this API, consumed and source should point to the same place
- * (unless target ends with an imcomplete sequence of bytes and flush is FALSE).
- * @param target : I/O parameter. Input : Points to the beginning of the buffer to copy
- * Unicode characters to. Output : points to after the last UChar copied to target.
- * @param targetLimit the pointer to the end of the target array
- * @param source the source codepage character array
- * @param sourceLimit the pointer to the end of the source array
- * @param offsets if NULL is passed, nothing will happen to it, otherwise it needs to have the same number
- * of allocated cells as target. Will fill in offsets from target to source pointer
- * e.g: offsets[3] is equal to 6, it means that the target[3] was a result of transcoding source[6]
- * For output data carried across calls, and other data without a specific source character
- * (such as from escape sequences or callbacks) -1 will be placed for offsets.
- * @param flush set to TRUE if the current source buffer is the last available
- * chunk of the source, FALSE otherwise. Note that if a failing status is returned,
- * this function may have to be called multiple times wiht flush set to TRUE until
- * the source buffer is consumed.
- * @param flush TRUE if the buffer is the last buffer and the conversion will finish
- * in this call, FALSE otherwise. (future feature pending)
- * @param err the error code status U_ILLEGAL_ARGUMENT_ERROR will be returned if the
- * converter is null, targetLimit < target, sourceLimit < source
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- void toUnicode(UChar*& target,
- const UChar* targetLimit,
- const char*& source,
- const char* sourceLimit,
- int32_t * offsets,
- UBool flush,
- UErrorCode& err);
-
-
-/**
- * Returns the maximum length of bytes used by a character. This varies between 1 and 4
- * @return the max number of bytes per codepage character * converter is null, targetLimit < target, sourceLimit < source
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-int8_t getMaxBytesPerChar(void) const;
-
-/**
-* Returns the minimum byte length for characters in this codepage. This is either
-* 1 or 2 for all supported codepages.
-* @return the minimum number of byte per codepage character
-* @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
-*/
-int8_t getMinBytesPerChar(void) const;
-
-/**
- *Gets the type of conversion associated with the converter
- * e.g. SBCS, MBCS, DBCS, UTF8, UTF16_BE, UTF16_LE, ISO_2022, EBCDIC_STATEFUL, LATIN_1
- * @return the type of the converter
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-UConverterType getType(void) const;
-
-/**
- *Gets the "starter" bytes for the converters of type MBCS
- *will fill in an U_ILLEGAL_ARGUMENT_ERROR if converter passed in
- *is not MBCS.
- *fills in an array of boolean, with the value of the byte as offset to the array.
- *At return, if TRUE is found in at offset 0x20, it means that the byte 0x20 is a starter byte
- *in this converter.
- * @param starters: an array of size 256 to be filled in
- * @param err: an array of size 256 to be filled in
- * @see ucnv_getType
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- void getStarters(UBool starters[256],
- UErrorCode& err) const;
- /**
- * Fills in the output parameter, subChars, with the substitution characters
- * as multiple bytes.
- * @param subChars the subsitution characters
- * @param len the number of bytes of the substitution character array
- * @param err the error status code. U_ILLEGAL_ARGUMENT_ERROR will be returned if
- * the converter is null. If the substitution character array is too small, an
- * U_INDEX_OUTOFBOUNDS_ERROR will be returned.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void getSubstitutionChars(char* subChars,
- int8_t& len,
- UErrorCode& err) const;
-/**
- * Sets the substitution chars when converting from unicode to a codepage. The
- * substitution is specified as a string of 1-4 bytes, and may contain null byte.
- * The fill-in parameter err will get the error status on return.
- * @param subchars the substitution character array to be set with
- * @param len the number of bytes of the substitution character array and upon return will contain the
- * number of bytes copied to that buffer
- * @param err the error status code. U_ILLEGAL_ARGUMENT_ERROR if the converter is
- * null. or if the number of bytes provided are not in the codepage's range (e.g length 1 for ucs-2)
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void setSubstitutionChars(const char* subChars,
- int8_t len,
- UErrorCode& err);
-
-/**
- * Resets the state of stateful conversion to the default state. This is used
- * in the case of error to restart a conversion from a known default state.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void resetState(void);
-
-/**
- * Gets the name of the converter (zero-terminated).
- * the name will be the internal name of the converter
- * @param err the error status code. U_INDEX_OUTOFBOUNDS_ERROR in the converterNameLen is too
- * small to contain the name.
- * @return the name of the converter.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-const char* getName( UErrorCode& err) const;
-
-
-/**
- * Gets a codepage number associated with the converter. This is not guaranteed
- * to be the one used to create the converter. Some converters do not represent
- * IBM registered codepages and return zero for the codepage number.
- * The error code fill-in parameter indicates if the codepage number is available.
- * @param err the error status code. U_ILLEGAL_ARGUMENT_ERROR will returned if
- * the converter is null or if converter's data table is null.
- * @return the converter's codepage number. If any error occurrs, null will be returned.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- int32_t getCodepage(UErrorCode& err) const;
-
- /**
- * Returns the current setting action taken when a character from a codepage
- * is missing or a byte sequence is illegal etc.
- * @param action the callback function pointer
- * @param context the callback function state
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- void getMissingCharAction(UConverterToUCallback *action,
- const void **context) const;
-
-/**
- * Return the current setting action taken when a unicode character is missing
- * or there is an unpaired surrogate etc.
- * @param action the callback function pointer
- * @param context the callback function state
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- void getMissingUnicodeAction(UConverterFromUCallback *action,
- const void **context) const;
-
- /**
- * Sets the current setting action taken when a character from a codepage is
- * missing. (Currently STOP or SUBSTITUTE).
- * @param newAction the action constant if an equivalent codepage character is missing
- * @param newContext the new toUnicode callback function state
- * @param oldAction the original action constant, saved for later restoration.
- * @param oldContext the old toUnicode callback function state
- * @param err the error status code
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- void setMissingCharAction(UConverterToUCallback newAction,
- const void* newContext,
- UConverterToUCallback *oldAction,
- const void** oldContext,
- UErrorCode& err);
-
-/**
- * Sets the current setting action taken when a unicode character is missing.
- * (currently T_UnicodeConverter_MissingUnicodeAction is either STOP or SUBSTITUTE,
- * SKIP, CLOSEST_MATCH, ESCAPE_SEQ may be added in the future).
- * @param newAction the action constant if an equivalent Unicode character is missing
- * @param newContext the new fromUnicode callback function state
- * @param oldAction the original action constant, saved for later restoration.
- * @param oldContext the old fromUnicode callback function state
- * @param err the error status code
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- void setMissingUnicodeAction(UConverterFromUCallback newAction,
- const void* newContext,
- UConverterFromUCallback *oldAction,
- const void** oldContext,
- UErrorCode& err);
-/**
- * Returns the localized name of the UnicodeConverter, if for any reason it is
- * available, the internal name will be returned instead.
- * @param displayLocale the valid Locale, from which we want to localize
- * @param displayName a UnicodeString that is going to be filled in.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void getDisplayName(const Locale& displayLocale,
- UnicodeString& displayName) const;
-
-/**
- * Returns the T_UnicodeConverter_platform (ICU defined enum) of a UnicodeConverter
- * available, the internal name will be returned instead.
- * @param err the error code status
- * @return the codepages platform
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-UConverterPlatform getCodepagePlatform(UErrorCode& err) const;
-
- /**
- * Assignment operator.
- * @param that object to be copied
- * @return the newly created Unicode Converter.
- */
- UnicodeConverter& operator=(const UnicodeConverter& that);
-
- /**
- * Returns true when both UnicodeConveters refer to the same
- * character in the same character-storage object.
- * @param that The UnicodeConverter to be compared for equality
- * @return true when both UnicodeConverters refer to the same
- * character in the same character-storage object
- * @stable ICU 2.0
- */
- UBool operator==(const UnicodeConverter& that) const;
-
- /**
- * Returns true when the UnicodeConverters refer to different
- * text-storage objects, or to different characters in the
- * same text-storage object.
- * @param that The UnicodeConverter to be compared for inequality
- * @Returns true when the iterators refer to different
- * text-storage objects, or to different characters in the
- * same text-storage object
- * @stable ICU 2.0
- */
- UBool operator!=(const UnicodeConverter& that) const;
-
- /* copy constructor
- * @param that The UnicodeConverter to be copied.
- * @return the newly created Unicode Converter.
- * */
- UnicodeConverter(const UnicodeConverter& that);
-
-/**
- * Returns the available names. Lazy evaluated, Library owns the storage
- * @param num the number of available converters
- * @param err the error code status
- * @return the name array
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-static const char* const* getAvailableNames(int32_t& num,
- UErrorCode& err);
-
-/**
- * Iterates through every cached converter and frees all the unused ones
- * @return the number of cached converters successfully deleted
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-static int32_t flushCache(void);
-/**
- * Fixes the backslash character mismapping. For example, in SJIS, the backslash
- * character in the ASCII portion is also used to represent the yen currency sign.
- * When mapping from Unicode character 0x005C, it's unclear whether to map the
- * character back to yen or backslash in SJIS. This function will take the input
- * buffer and replace all the yen sign characters with backslash. This is necessary
- * when the user tries to open a file with the input buffer on Windows.
- * @param source the input buffer to be fixed
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-void fixFileSeparator(UnicodeString& source) const;
-
-/**
- * Determines if the converter contains ambiguous mappings of the same
- * character or not.
- * @return TRUE if the converter contains ambiguous mapping of the same
- * character, FALSE otherwise.
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
-UBool isAmbiguous(void) const;
-
- /**
- * ICU "poor man's RTTI", returns a UClassID for the actual class.
- *
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- virtual inline UClassID getDynamicClassID() const { return getStaticClassID(); }
-
- /**
- * ICU "poor man's RTTI", returns a UClassID for this class.
- *
- * @obsolete ICU 2.4. Use the parallel ucnv_ C API instead since this API will be removed in that release.
- */
- static inline UClassID getStaticClassID() { return (UClassID)&fgClassID; }
-
-private:
-
- /**
- * The address of this static class variable serves as this class's ID
- * for ICU "poor man's RTTI".
- */
- static const char fgClassID;
-};
-
-U_NAMESPACE_END
-#else
-
-#error "The unicode/convert.h header is obsolete. Please use the converter C API in unicode/ucnv.h instead."
-
-#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
-
-#endif
diff --git a/icu4c/source/test/intltest/Makefile.in b/icu4c/source/test/intltest/Makefile.in
index 0fb1417bf8a..299ffad7efd 100644
--- a/icu4c/source/test/intltest/Makefile.in
+++ b/icu4c/source/test/intltest/Makefile.in
@@ -27,7 +27,7 @@ DEFS += -D'U_TOPSRCDIR="$(top_srcdir)/"' -D'U_TOPBUILDDIR="$(BUILDDIR)"'
LIBS = $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M)
OBJECTS = allcoll.o apicoll.o callimts.o calregts.o caltest.o \
-caltztst.o canittst.o citrtest.o cntabcol.o cppcnvt.o cputilst.o currcoll.o dacoll.o \
+caltztst.o canittst.o citrtest.o cntabcol.o cputilst.o currcoll.o dacoll.o \
dadrcoll.o dcfmapts.o decoll.o dtfmapts.o dtfmrgts.o dtfmtrtts.o dtfmttst.o \
encoll.o escoll.o ficoll.o frcoll.o g7coll.o intltest.o itconv.o \
itercoll.o itformat.o itmajor.o itutil.o jacoll.o lcukocol.o \
@@ -35,7 +35,7 @@ loctest.o miscdtfm.o mnkytst.o msfmrgts.o nmfmapts.o nmfmtrt.o \
numfmtst.o numrgts.o pptest.o regcoll.o restest.o restsnew.o sdtfmtts.o tchcfmt.o \
tfsmalls.o tmsgfmt.o trcoll.o tscoll.o tsdate.o tsdcfmsy.o tsdtfmsy.o \
tsmthred.o tsmutex.o tsnmfmt.o tsputil.o tstnorm.o tzbdtest.o \
-tzregts.o tztest.o usettest.o ustrtest.o strcase.o transtst.o strtest.o thcoll.o \
+tzregts.o tztest.o ucdtest.o usettest.o ustrtest.o strcase.o transtst.o strtest.o thcoll.o \
itrbbi.o rbbiapts.o rbbitst.o ittrans.o transapi.o cpdtrtst.o unhxtrts.o hxuntrts.o \
ufltlgts.o testutil.o transrt.o trnserr.o normconf.o sfwdchit.o \
jamotest.o srchtest.o reptest.o regextst.o \
diff --git a/icu4c/source/test/intltest/cppcnvt.cpp b/icu4c/source/test/intltest/cppcnvt.cpp
deleted file mode 100644
index 8420f984f39..00000000000
--- a/icu4c/source/test/intltest/cppcnvt.cpp
+++ /dev/null
@@ -1,751 +0,0 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 2001, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-#include "cppcnvt.h"
-
-#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
-#include "unicode/locid.h"
-#include "unicode/unistr.h"
-#include "unicode/ucnv_err.h"
-#include "cstring.h"
-#include
-
-#define NUM_CODEPAGE 1
-#define MAX_FILE_LEN 1024*20
-#define UCS_FILE_NAME_SIZE 512
-
-/*writes and entire UnicodeString along with a BOM to a file*/
-void WriteToFile(const UnicodeString *a, FILE *myfile);
-/*Case insensitive compare*/
-int32_t strCaseIcmp(const char* a1,const char * a2);
-/*returns an action other than the one provided*/
-UConverterFromUCallback otherUnicodeAction(UConverterFromUCallback MIA);
-UConverterToUCallback otherCharAction(UConverterToUCallback MIA);
-/*Asciifies the UErrorCodes*/
-#define myErrorName(errorCode) u_errorName(errorCode)
-
-void ConvertTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
-{
- if (exec) logln("TestSuite ConvertTest: ");
- switch (index) {
- case 0: name = "TestConvert"; if (exec) TestConvert(); break;
- case 1: name = "TestAmbiguous"; if (exec) TestAmbiguous(); break;
- default: name = ""; break; //needed to end loop
- }
-}
-
-/* Test is also located in ccapitst.c */
-void ConvertTest::TestConvert()
-{
- char myptr[4];
- char save[4];
- int32_t testLong1;
- int16_t rest = 0;
- int32_t x = 0;
- FILE* ucs_file_in = NULL;
- UChar BOM = 0x0000;
- UChar myUChar = 0x0000;
- char* mytarget = new char[MAX_FILE_LEN];
- char* mytarget_1 = mytarget;
- char* mytarget_use = mytarget;
- char* consumed = NULL;
- char* output_cp_buffer = new char[MAX_FILE_LEN];
- UChar* ucs_file_buffer = new UChar[MAX_FILE_LEN];
- UChar* ucs_file_buffer_use = ucs_file_buffer;
- UChar* my_ucs_file_buffer = new UChar[MAX_FILE_LEN];
- UChar* my_ucs_file_buffer_1 = my_ucs_file_buffer;
- int32_t i = 0;
- int8_t ii = 0;
- uint16_t codepage_index = 0;
- int32_t cp = 0;
- UErrorCode err = U_ZERO_ERROR;
- const char* const* available_conv = NULL;
- char ucs_file_name[UCS_FILE_NAME_SIZE];
- UConverterFromUCallback MIA1, MIA1_2;
- UConverterToUCallback MIA2, MIA2_2;
- const void *MIA1Context, *MIA1Context2, *MIA2Context, *MIA2Context2;
- UnicodeConverter* someConverters[5];
- /******************************************************************
- Checking Unicode -> ksc
- ******************************************************************/
-
- const char* CodePagesToTest[NUM_CODEPAGE] =
- {
- "IBM-949"
- };
-
- const uint16_t CodePageNumberToTest[NUM_CODEPAGE] =
- {
- 949
- };
-
-/* const int32_t CodePagesAsciiControls[NUM_CODEPAGE] =
- {
- 0xFFFFFFFF
- };
-
- const int32_t CodePagesOtherControls[NUM_CODEPAGE] =
- {
- 0x00000005
- };*/
-
- const int8_t CodePagesMinChars[NUM_CODEPAGE] =
- {
- 1
- };
-
- const int8_t CodePagesMaxChars[NUM_CODEPAGE] =
- {
- 2
- };
-
- const int16_t CodePagesSubstitutionChars[NUM_CODEPAGE] =
- {
- (int16_t)0xAFFEu
- };
-
- const char* CodePagesTestFiles[NUM_CODEPAGE] =
- {
- "uni-text.bin"
- };
-
- const UConverterPlatform CodePagesPlatform[NUM_CODEPAGE] =
- {
- UCNV_IBM
- };
-
-/* const UConverterToUCallback CodePagesMissingCharAction[NUM_CODEPAGE] =
- {
- UCNV_TO_U_CALLBACK_SUBSTITUTE
- };
-
- const UConverterFromUCallback CodePagesMissingUnicodeAction[NUM_CODEPAGE] =
- {
- UCNV_FROM_U_CALLBACK_SUBSTITUTE
- };*/
-
- const Locale CodePagesLocale[NUM_CODEPAGE] =
- {
- Locale::getKorean()
- };
-
- UConverterFromUCallback fromUAction = NULL;
- const void* fromUContext = NULL;
- UConverterToUCallback toUAction = NULL;
- const void* toUContext = NULL;
-
- /*Calling all the UnicodeConverter API and checking functionality*/
-
- /*Tests UnicodeConverter::getAvailableNames*/
- logln("\n---Testing UnicodeConverter::getAvailableNames...");
- available_conv = UnicodeConverter::getAvailableNames(testLong1, err);
-
- if (U_FAILURE(err))
- {
- errln("Error getting Available names!");
- return;
- }
- logln("Number of available Codepages:%d\t", testLong1);
- while (testLong1--)
- logln("\t\t[%s]", available_conv[testLong1]);
-
- ucnv_flushCache();
-
- /* Do some tests w/ UnicodeConverter, some w/ UnicodeConverter */
-
- someConverters[0] = new UnicodeConverter("ibm-1123",err);
- if (U_FAILURE(err)) {
- errln ((UnicodeString)"FAILURE a! " + myErrorName(err));
- return;
- }
- someConverters[1] = new UnicodeConverter("ibm-1123",err);
- if (U_FAILURE(err)) {
- errln ((UnicodeString)"FAILURE b! " + myErrorName(err));
- return;
- }
- someConverters[2] = new UnicodeConverter("ibm-1123",err);
- if (U_FAILURE(err)) {
- errln ((UnicodeString)"FAILURE c! " + myErrorName(err));
- return;
- }
-
- someConverters[3] = new UnicodeConverter("ibm-1383", err);
- if (U_FAILURE(err)) {
- errln ((UnicodeString)"FAILURE d! " + myErrorName(err));
- return;
- }
- someConverters[4] = new UnicodeConverter("ibm-949", err);
- if (U_FAILURE(err)) {
- errln ((UnicodeString)"FAILURE e! " + myErrorName(err));
- return;
- }
-
- logln("\n---Testing UnicodeConverter::flushCache...");
- if (UnicodeConverter::flushCache()==0)
- logln("Flush cache ok");
- else
- errln("Flush Cache failed");
-
- delete someConverters[0];
- delete someConverters[1];
- delete someConverters[2];
- delete someConverters[3];
- if (UnicodeConverter::flushCache()==2)
- logln("Flush cache ok");
- else
- errln("Flush Cache failed");
-
- delete someConverters[4];
- if (UnicodeConverter::flushCache()==1)
- logln("Flush cache ok");
- else
- errln("Flush Cache failed");
-
- logln("\n---Testing UnicodeConverter::UnicodeConverter()...");
- someConverters[0] = new UnicodeConverter;
- someConverters[1] = new UnicodeConverter;
- someConverters[2] = new UnicodeConverter("utf8", err);
- if (U_FAILURE(err)) {
- errln ((UnicodeString)"FAILURE! " + myErrorName(err));
- return;
- }
-
- logln("\n---Testing getName...");
-
- someConverters[1]->getName(err);
- if(U_FAILURE(err)) {
- errln("getName for Converters[1] failed!!!");
- } else {
- logln(UnicodeString("Result of Converters[1]->getName() was ") + UnicodeString(someConverters[1]->getName(err)));
- }
-
- someConverters[0]->getName(err);
- if(U_FAILURE(err)) {
- errln("getName for Converters[0] failed!!!");
- } else {
- logln(UnicodeString("Result of Converters[0]->getName() was ") + UnicodeString(someConverters[0]->getName(err)));
- }
-
- logln("\n---Testing UnicodeConverter::operator==...");
- if (((*someConverters[1] == *someConverters[0])==TRUE)&&
- (*someConverters[1] == *someConverters[2])==FALSE)
- logln("Equality test ok");
- else {
- if(!((*someConverters[1] == *someConverters[0])==TRUE)) {
- errln("Equality test failed line " + UnicodeString() + 244);
- }
- if(!((*someConverters[1] == *someConverters[2])==FALSE)) {
- errln("Equality test failed line " + UnicodeString() + 247);
- }
- }
-
- logln("\n---Testing UnicodeConverter::operator!=...");
- if (((*someConverters[1] != *someConverters[0])==FALSE)&&
- (*someConverters[1] != *someConverters[2])==TRUE)
- logln("Not Equal test ok");
- else
- errln("Not Equal test failed");
-
- logln("\n---Testing UnicodeConverter::operator=...");
- someConverters[3] = new UnicodeConverter;
- *someConverters[3] = *someConverters[2];
- if ((*someConverters[2] == *someConverters[3]))
- logln("Equality test ok");
- else
- errln("Equality test failed line " + UnicodeString() + 262);
-
- delete someConverters[0];
- delete someConverters[1];
- delete someConverters[2];
- delete someConverters[3];
-
- for (codepage_index=0; codepage_index < NUM_CODEPAGE; codepage_index++)
- {
- err = U_ZERO_ERROR;
- i = 0;
- char* index = 0;
- strcpy(ucs_file_name, IntlTest::loadTestData(err));
-
- index=strrchr(ucs_file_name,(char)U_FILE_SEP_CHAR);
-
- if((unsigned int)(index-ucs_file_name) != (strlen(ucs_file_name)-1)){
- *(index+1)=0;
- }
-
- strcat(ucs_file_name,".."U_FILE_SEP_STRING);
- if(U_FAILURE(err)){
- char errmsg[UCS_FILE_NAME_SIZE + 128];
- sprintf(errmsg, "Couldn't open the testdata... Exiting...Error:%s \n", u_errorName(err));
- }
- strcat(ucs_file_name, CodePagesTestFiles[codepage_index]);
-
- ucs_file_in = fopen(ucs_file_name, "rb");
- if (!ucs_file_in)
- {
- char errmsg[UCS_FILE_NAME_SIZE + 128];
- sprintf(errmsg, "Couldn't open the Unicode file [%s]... Exiting...\n", ucs_file_name);
- errln(errmsg);
- return;
- }
-
- /*Creates a converter*/
-
- UnicodeConverter* myConverter = new UnicodeConverter(CodePageNumberToTest[codepage_index],UCNV_IBM, err);
-
- if (!myConverter || U_FAILURE(err))
- {
- errln("Error Creating the converter from %s codepage.\nMake sure you ran the makeconv tool to create %s.cnv\nFailed with err=%s (%d)",
- CodePagesToTest[codepage_index],
- CodePagesToTest[codepage_index],
- u_errorName(err), err);
- return;
- }
-
-
- /*Tests getMaxBytesPerChar and getMinBytesPerChar*/
- logln("\n---Testing UnicodeConverter::getMaxBytesPerChar...");
- if (myConverter->getMaxBytesPerChar()==CodePagesMaxChars[codepage_index])
- logln("Max byte per character OK");
- else
- errln("Max byte per character failed");
-
- logln("\n---Testing UnicodeConverter::getMinBytesPerChar...");
- if (myConverter->getMinBytesPerChar()==CodePagesMinChars[codepage_index])
- logln("Min byte per character OK");
- else
- errln("Min byte per character failed");
-
-
- /*getSubstitutions char*/
- logln("\n---Testing UnicodeConverter::getSubstitutionChars...");
- ii=4;
- myConverter->getSubstitutionChars(myptr,ii,err);
-
- for(x=0;xsetSubstitutionChars(myptr, ii, err);
- if (U_FAILURE(err))
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
- myConverter->getSubstitutionChars(save, ii, err);
- if (U_FAILURE(err))
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
- if (strncmp(save, myptr, ii))
- errln("Saved substitution character failed");
- else
- logln("Saved substitution character ok");
-
- /*resetState*/
- logln("\n---Testing UnicodeConverter::resetState...");
- myConverter->resetState();
-
-
- /*getName*/
- UnicodeString* testUnistr = new UnicodeString();
- logln("\n---Testing UnicodeConverter::getName...");
- if (strCaseIcmp(myConverter->getName(err), CodePagesToTest[codepage_index]))
- errln("getName failed");
- else
- logln("getName ok");
-
- /*getDisplayName*/
- testUnistr->remove();
- logln("\n---Testing UnicodeConverter::getDisplayName...");
- myConverter->getDisplayName(CodePagesLocale[codepage_index],*testUnistr);
-
- /*printUChar(T_UnicodeString_getUChars(testUnistr));
- logln("\nAbove is DisplayName!!");*/
-
-
- /*getMissingUnicodeAction*/
- /* logln("\n---Testing UnicodeConverter::getMissingUnicodeAction...");
- if ((MIA1 = myConverter->getMissingUnicodeAction()) != CodePagesMissingUnicodeAction[codepage_index]) errln("Missing action failed");
- else logln("Missing action ok");*/
-
-
-
- /*getMissingCharAction*/
- /* logln("\n---Testing UnicodeConverter::getMissingCharAction...");
- if ((MIA2 = myConverter->getMissingCharAction()) != CodePagesMissingCharAction[codepage_index]) errln("Missing action failed");
- else logln("Missing action ok");*/
-
- myConverter->getMissingUnicodeAction(&MIA1, &MIA1Context);
- myConverter->getMissingCharAction(&MIA2, &MIA2Context);
-
- /*setMissingUnicodeAction*/
- logln("\n---Testing UnicodeConverter::setMissingUnicodeAction...");
- myConverter->setMissingUnicodeAction(otherUnicodeAction(MIA1), &BOM, &fromUAction, &fromUContext, err);
- if (U_FAILURE(err) || fromUAction != MIA1 || fromUContext != MIA1Context)
- {
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
- }
- myConverter->getMissingUnicodeAction(&MIA1_2, &MIA1Context2);
- if (MIA1_2 != otherUnicodeAction(MIA1) || MIA1Context2 != &BOM)
- {
- errln("Missing action failed");
- }
- else
- {
- logln("Missing action ok");
- }
-
-
- logln("\n---Testing UnicodeConverter::setMissingUnicodeAction Roundtrip...");
- myConverter->setMissingUnicodeAction(MIA1, MIA1Context, &fromUAction, &fromUContext, err);
- if (U_FAILURE(err) || fromUAction != otherUnicodeAction(MIA1) || fromUContext != &BOM)
- {
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
- }
- myConverter->getMissingUnicodeAction(&MIA1_2, &MIA1Context2);
- if (MIA1_2 != MIA1 || MIA1Context2 != MIA1Context)
- {
- errln("Missing action failed");
- }
- else
- {
- logln("Missing action ok");
- }
-
- /*setMissingCharAction*/
- logln("\n---Testing UnicodeConverter::setMissingCharAction...");
- myConverter->setMissingCharAction(otherCharAction(MIA2), &BOM, &toUAction, &toUContext, err);
- if (U_FAILURE(err) || toUAction != MIA2 || toUContext != MIA2Context)
- {
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
- }
- myConverter->getMissingCharAction(&MIA2_2, &MIA2Context2);
- if (MIA2_2 != otherCharAction(MIA2) || MIA2Context2 != &BOM)
- {
- errln("Missing action failed");
- }
- else
- {
- logln("Missing action ok");
- }
-
- logln("\n---Testing UnicodeConverter::setMissingCharAction Roundtrip...");
- myConverter->setMissingCharAction(MIA2, MIA2Context, &toUAction, &toUContext, err);
- if (U_FAILURE(err) || toUAction != otherCharAction(MIA2) || toUContext != &BOM)
- {
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
- }
- myConverter->getMissingCharAction(&MIA2_2, &MIA2Context2);
- if (MIA2_2 != MIA2 || MIA2Context2 != MIA2Context)
- {
- errln("Missing action failed");
- }
- else
- {
- logln("Missing action ok");
- }
-
-
- /*getCodepage*/
- logln("\n---Testing UnicodeConverter::getCodepage...");
- cp = myConverter->getCodepage(err);
- if (U_FAILURE(err)) errln ("FAILURE! " + (UnicodeString)myErrorName(err));
- if (cp != CodePageNumberToTest[codepage_index])
- errln("Codepage number test failed");
- else
- logln("Codepage number test OK");
-
-
- /*getCodepagePlatform*/
- logln("\n---Testing UnicodeConverter::getCodepagePlatform ...");
- if (CodePagesPlatform[codepage_index]!=myConverter->getCodepagePlatform(err))
- errln("Platform codepage test failed");
- else
- logln("Platform codepage test ok");
- if (U_FAILURE(err))
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
-
-
- /*Reads the BOM*/
- fread(&BOM, sizeof(UChar), 1, ucs_file_in);
- if (BOM!=0xFEFF && BOM!=0xFFFE)
- {
- errln("File Missing BOM...Bailing!");
- return;
- }
-
-
- /*Reads in the file*/
- while(!feof(ucs_file_in)&&(i+=fread(ucs_file_buffer+i, sizeof(UChar), 1, ucs_file_in)))
- {
- myUChar = ucs_file_buffer[i-1];
-
- ucs_file_buffer[i-1] = (UChar)((BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8))); /*adjust if BIG_ENDIAN*/
- }
-
- myUChar = ucs_file_buffer[i-1];
- ucs_file_buffer[i-1] = (UChar)((BOM==0xFEFF)?myUChar:((myUChar >> 8) | (myUChar << 8))); /*adjust if BIG_ENDIAN Corner Case*/
-
- UnicodeString* uniString = new UnicodeString(ucs_file_buffer,i);
- UnicodeString* uniString3 = new UnicodeString(ucs_file_buffer,i);
- UnicodeString* uniString2 = new UnicodeString();
-
-
- /*Calls the Conversion Routine*/
-
- testLong1 = MAX_FILE_LEN;
-
- logln("\n---Testing UnicodeConverter::fromUnicodeString");
- myConverter->fromUnicodeString(output_cp_buffer, testLong1, *uniString, err);
- if (U_FAILURE(err)) logln("\nFAILURE...");
-
-
-
-
- /******************************************************************
- Checking ksc -> Unicode
- ******************************************************************/
-
- /*Clean up re-usable vars*/
-
-
- /*Calls the Conversion Routine*/
- /*Uni1 ----ToUnicodeString----> Cp1 ----FromUnicodeString---->Uni2*/
-
- logln("\n---Testing UnicodeConverter::toUnicodeString");
- myConverter->toUnicodeString(*uniString2 , output_cp_buffer, testLong1, err);
-
- if (U_FAILURE(err))
- logln ("FAILURE! " + (UnicodeString)myErrorName(err));
-
-
-
- logln("\n---Testing UnicodeString RoundTrip ...");
-
- /*check if Uni1 == Uni2*/
- if (uniString->compare(*uniString2))
- errln("Equality check test failed");
- else
- logln("Equality check test ok");
-
- /*AIX Compiler hacks*/
- const UChar* tmp_ucs_buf = ucs_file_buffer_use;
- //const UChar* tmp_consumedUni = NULL;
-
- myConverter->fromUnicode(mytarget_1,
- mytarget + MAX_FILE_LEN,
- tmp_ucs_buf,
- ucs_file_buffer_use+i,
- NULL,
- TRUE,
- err);
- // consumedUni = (UChar*)tmp_consumedUni;
-
- if (U_FAILURE(err))
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
-
- /*Uni1 ----ToUnicode----> Cp2 ----FromUnicode---->Uni3*/
-
- /*AIX Compiler hacks*/
- const char* tmp_mytarget_use = mytarget_use;
- const char* tmp_consumed = consumed;
- myConverter->toUnicode(my_ucs_file_buffer_1,
- my_ucs_file_buffer + MAX_FILE_LEN,
- tmp_mytarget_use,
- mytarget_use+strlen((char*)mytarget_use),
- NULL,
- FALSE,
- err);
- consumed = (char*)tmp_consumed;
- if (U_FAILURE(err))
- errln ("FAILURE! " + (UnicodeString)myErrorName(err));
-
-
- logln("\n---Testing UChar* RoundTrip ...");
- //uniString3->remove();
- uniString3->replace(0, uniString3->length(), my_ucs_file_buffer, i);
- //uniString3 = new UnicodeString(my_ucs_file_buffer,i);
-
- /*checks if Uni1 == Uni3*/
- if (uniString->compare(*uniString3))
- errln("Equality test failed line " + UnicodeString() + 500);
- else
- logln("Equality test ok");
-
- /*checks if Uni2 == Uni3 This is a sanity check for the consistency of the
- UnicodeString and Unicode Convters*/
- logln("\n---Testing Consistency between UChar* and UnicodeString Conversion...");
- if (uniString2->compare(*uniString3))
- errln("Equality test failed line " + UnicodeString() + 506);
- else
- logln("Equality test ok");
-
- logln("\n---Testing Regression 1100057 ...");
- const uint8_t mySJIS[12] = {0xFA, 0X51, 0XB8, 0XDB, 0XBD, 0XCB, 0XDB, 0XCC, 0XDE, 0XD0 , 0XFA, 0X50};
-
-
- UnicodeConverter SJIS(943, UCNV_IBM, err);
- UnicodeString myString;
-
-
- SJIS.toUnicodeString(myString, (const char *)mySJIS, 12, err);
- if (U_FAILURE(err)||(myString.length()!=10))
- errln("toUnicodeString test failed");
- else
- logln("toUnicodeString test ok");
-
- fclose(ucs_file_in);
- delete myConverter;
- delete uniString;
- delete uniString2;
- delete uniString3;
- delete testUnistr;
-
- }
- /******* testing for Bug 778 *******************/
- {
- logln("\n---Testing Jitterbug 778 ...");
- UErrorCode err = U_ZERO_ERROR;
- UBool passed = TRUE;
- UnicodeString unicode_string((UChar)0x592a);
- UErrorCode error = U_ZERO_ERROR;
- UnicodeConverter cnv( "iso-2022-jp-2", error );
- if( U_FAILURE(err) ) {
- errln(UnicodeString("Error Creating iso-2022-jp-2 converter. Reason: ") + myErrorName(error));
- }
- char dest[256];
- int32_t dest_bytes_used = 256;
- cnv.fromUnicodeString( dest, dest_bytes_used, unicode_string, error );
- if( U_FAILURE(err) ) {
- errln( UnicodeString("Error converting to iso-2022-jp-2 stream:" )+ myErrorName(error) );
- }
- const char* expected ="\x1b\x24\x42\x42\x40";
- char* got = &dest[0];
- while(*expected!='\0'){
- if(*got!=*expected){
- errln(UnicodeString("Error while testing jitterbug 778. Expected: ") + (char) *expected + " got: " + (char) *got);
- passed =FALSE;
- }
- got++;
- expected++;
- }
- if(passed){
- logln("jitterbug 778 test ok");
- }
- }
- delete []mytarget;
- delete []output_cp_buffer;
- delete []ucs_file_buffer;
- delete []my_ucs_file_buffer;
-}
-
-void WriteToFile(const UnicodeString *a, FILE *myfile)
-{
- uint32_t size = a->length();
- uint16_t i = 0;
- UChar b = 0xFEFF;
-
- /*Writes the BOM*/
- fwrite(&b, sizeof(UChar), 1, myfile);
- for (i=0; i< size; i++)
- {
- b = (*a)[i];
- fwrite(&b, sizeof(UChar), 1, myfile);
- }
-}
-
-int32_t strCaseIcmp(const char* a1, const char * a2)
-{
- int32_t i=0, ret=0;
- while(a1[i]&&a2[i])
- {
- ret += tolower(a1[i])-tolower(a2[i]);
- i++;
- }
- return ret;
-}
-
-UConverterFromUCallback otherUnicodeAction(UConverterFromUCallback MIA)
-{
- return (MIA==(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP)?(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_SUBSTITUTE:(UConverterFromUCallback)UCNV_FROM_U_CALLBACK_STOP;
-}
-
-UConverterToUCallback otherCharAction(UConverterToUCallback MIA)
-{
- return (MIA==(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP)?(UConverterToUCallback)UCNV_TO_U_CALLBACK_SUBSTITUTE:(UConverterToUCallback)UCNV_TO_U_CALLBACK_STOP;
-}
-
-/* Test is also located in nucnvtst.c */
-void ConvertTest::TestAmbiguous()
-{
- UErrorCode status = U_ZERO_ERROR;
- UnicodeConverter *ascii_cnv = 0, *sjis_cnv = 0;
- const char target[] = {
- /* "\\usr\\local\\share\\data\\icutest.txt" */
- 0x5c, 0x75, 0x73, 0x72,
- 0x5c, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x5c, 0x73, 0x68, 0x61, 0x72, 0x65,
- 0x5c, 0x64, 0x61, 0x74, 0x61,
- 0x5c, 0x69, 0x63, 0x75, 0x74, 0x65, 0x73, 0x74, 0x2e, 0x74, 0x78, 0x74,
- 0
- };
- UnicodeString asciiResult, sjisResult;
-
- sjis_cnv = new UnicodeConverter("ibm-943", status);
- if (U_FAILURE(status))
- {
- errln("Failed to create a SJIS converter\n");
- return;
- }
- ascii_cnv = new UnicodeConverter("LATIN-1", status);
- if (U_FAILURE(status))
- {
- errln("Failed to create a SJIS converter\n");
- delete sjis_cnv;
- return;
- }
- /* convert target from SJIS to Unicode */
- sjis_cnv->toUnicodeString(sjisResult, target, (int32_t)uprv_strlen(target), status);
- if (U_FAILURE(status))
- {
- errln("Failed to convert the SJIS string.\n");
- delete sjis_cnv;
- delete ascii_cnv;
- return;
- }
-
- /* convert target from Latin-1 to Unicode */
- ascii_cnv->toUnicodeString(asciiResult, target, (int32_t)uprv_strlen(target), status);
- if (U_FAILURE(status))
- {
- errln("Failed to convert the Latin-1 string.\n");
- delete sjis_cnv;
- delete ascii_cnv;
- return;
- }
-
- if (!sjis_cnv->isAmbiguous())
- {
- errln("SJIS converter should contain ambiguous character mappings.\n");
- delete sjis_cnv;
- delete ascii_cnv;
- return;
- }
- if (sjisResult == asciiResult)
- {
- errln("File separators for SJIS don't need to be fixed.\n");
- }
- sjis_cnv->fixFileSeparator(sjisResult);
- if (sjisResult != asciiResult)
- {
- errln("Fixing file separator for SJIS failed.\n");
- }
- delete sjis_cnv;
- delete ascii_cnv;
-
-}
-#endif
diff --git a/icu4c/source/test/intltest/cppcnvt.h b/icu4c/source/test/intltest/cppcnvt.h
deleted file mode 100644
index 04eb4ec3285..00000000000
--- a/icu4c/source/test/intltest/cppcnvt.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-#include "intltest.h"
-
-#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
-#include "unicode/convert.h"
-
-/**
- * Test for APIs of CPPUnicodeConverter
- **/
-class ConvertTest: public IntlTest {
-public:
- ConvertTest() {};
- virtual ~ConvertTest() {};
-
- void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
-
- /**
- * Test everything
- **/
- void TestConvert(void);
- void TestAmbiguous(void);
-};
-#endif
-
-
-
diff --git a/icu4c/source/test/intltest/intltest.dsp b/icu4c/source/test/intltest/intltest.dsp
index 891beb872cf..b032b393659 100644
--- a/icu4c/source/test/intltest/intltest.dsp
+++ b/icu4c/source/test/intltest/intltest.dsp
@@ -402,26 +402,6 @@ SOURCE=.\tsputil.cpp
SOURCE=.\tsputil.h
# End Source File
# End Group
-# Begin Group "conversion"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\cppcnvt.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\cppcnvt.h
-# End Source File
-# Begin Source File
-
-SOURCE=.\itconv.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\itconv.h
-# End Source File
-# End Group
# Begin Group "data & memory"
# PROP Default_Filter ""
@@ -799,6 +779,14 @@ SOURCE=.\tstnorm.h
# PROP Default_Filter ""
# Begin Source File
+SOURCE=.\ucdtest.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ucdtest.h
+# End Source File
+# Begin Source File
+
SOURCE=.\usettest.cpp
# End Source File
# Begin Source File
diff --git a/icu4c/source/test/intltest/itconv.cpp b/icu4c/source/test/intltest/itconv.cpp
deleted file mode 100644
index d94db0b3ac3..00000000000
--- a/icu4c/source/test/intltest/itconv.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-
-/**
- * IntlTestConvert is the medium level test class for everything in the directory "utility".
- */
-
-#include "unicode/utypes.h"
-#include "itconv.h"
-#include "cppcnvt.h"
-
-#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
-void IntlTestConvert::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
-{
- if (exec) logln("TestSuite Convert: ");
- switch (index) {
- case 0:
- name = "TestConvert";
- if (exec) {
- logln("TestConvert---"); logln("");
- ConvertTest test;
- callTest( test, par );
- }
- break;
-
- case 1:
- name = "TestAmbiguous";
- if (exec) {
- logln("TestAmbiguous---"); logln("");
- ConvertTest test;
- callTest( test, par );
- }
- break;
-
- default: name = ""; break; //needed to end loop
- }
-}
-
-#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
diff --git a/icu4c/source/test/intltest/itconv.h b/icu4c/source/test/intltest/itconv.h
deleted file mode 100644
index 2b070d6e0ee..00000000000
--- a/icu4c/source/test/intltest/itconv.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/********************************************************************
- * COPYRIGHT:
- * Copyright (c) 1997-2001, International Business Machines Corporation and
- * others. All Rights Reserved.
- ********************************************************************/
-
-/**
- * MajorTestLevel is the top level test class for everything in the directory "IntlWork".
- */
-
-#ifndef _INTLTESTCONVERT
-#define _INTLTESTCONVERT
-
-
-#include "cppcnvt.h"
-#include "intltest.h"
-
-
-#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
-class IntlTestConvert: public IntlTest {
-public:
-virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL );
-};
-#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
-
-
-#endif
diff --git a/icu4c/source/test/intltest/itmajor.cpp b/icu4c/source/test/intltest/itmajor.cpp
index eb9b2e1d7c2..eca4ae63951 100644
--- a/icu4c/source/test/intltest/itmajor.cpp
+++ b/icu4c/source/test/intltest/itmajor.cpp
@@ -20,7 +20,7 @@
#include "itutil.h"
#include "tscoll.h"
#include "itformat.h"
-#include "itconv.h"
+//%#include "itconv.h"
#include "ittrans.h"
#include "itrbbi.h"
#include "itrbnf.h"
@@ -127,18 +127,19 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
#endif
break;
- case 9: name = "convert";
-/* Only the C API exists */
-#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
- if (exec) {
- logln("TestSuite Convert---"); logln();
- IntlTestConvert test;
- callTest( test, par );
- }
-#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
- break;
+//% case 9: name = "convert";
+//%/* Only the C API exists */
+//%#ifdef ICU_UNICODECONVERTER_USE_DEPRECATES
+//% if (exec) {
+//% logln("TestSuite Convert---"); logln();
+//% IntlTestConvert test;
+//% callTest( test, par );
+//% }
+//%#endif /* ICU_UNICODECONVERTER_USE_DEPRECATES */
+//% break;
- case 10: name = "icuserv";
+//% case 10: name = "icuserv";
+ case 9: name = "icuserv";
#if !UCONFIG_NO_SERVICE
if (exec) {
logln("TestSuite ICUService---"); logln();
diff --git a/icu4c/source/test/intltest/itutil.cpp b/icu4c/source/test/intltest/itutil.cpp
index 83abc890667..334050d95fa 100644
--- a/icu4c/source/test/intltest/itutil.cpp
+++ b/icu4c/source/test/intltest/itutil.cpp
@@ -15,6 +15,7 @@
#include "loctest.h"
#include "citrtest.h"
#include "ustrtest.h"
+#include "ucdtest.h"
#include "restest.h"
#include "restsnew.h"
#include "tsmutex.h"
@@ -86,6 +87,15 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
break;
case 6:
+ name = "UnicodeTest";
+ if (exec) {
+ logln("UnicodeTest---"); logln("");
+ UnicodeTest test;
+ callTest( test, par );
+ }
+ break;
+
+ case 7:
name = "ResourceBundleTest";
if (exec) {
logln("ResourceBundleTest---"); logln("");
@@ -93,7 +103,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
callTest( test, par );
}
break;
- case 7:
+ case 8:
name = "NewResourceBundleTest";
if (exec) {
logln("NewResourceBundleTest---"); logln("");
@@ -102,7 +112,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
}
break;
- case 8:
+ case 9:
name = "PUtilTest";
if (exec) {
logln("PUtilTest---"); logln("");
@@ -111,7 +121,7 @@ void IntlTestUtilities::runIndexedTest( int32_t index, UBool exec, const char* &
}
break;
- case 9:
+ case 10:
name = "UObjectTest";
if(exec) {
logln ("UObjectTest---"); logln("");
diff --git a/icu4c/source/test/intltest/ucdtest.cpp b/icu4c/source/test/intltest/ucdtest.cpp
new file mode 100644
index 00000000000..9047dc6822f
--- /dev/null
+++ b/icu4c/source/test/intltest/ucdtest.cpp
@@ -0,0 +1,212 @@
+/********************************************************************
+ * COPYRIGHT:
+ * Copyright (c) 1997-2001, International Business Machines Corporation and
+ * others. All Rights Reserved.
+ ********************************************************************/
+
+#include "unicode/ustring.h"
+#include "unicode/uchar.h"
+#include "unicode/uniset.h"
+#include "cstring.h"
+#include "uparse.h"
+#include "ucdtest.h"
+
+#define LENGTHOF(array) (sizeof(array)/sizeof(array[0]))
+
+UnicodeTest::UnicodeTest()
+{
+}
+
+UnicodeTest::~UnicodeTest()
+{
+}
+
+void UnicodeTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
+{
+ if (exec) logln("TestSuite UnicodeTest: ");
+ switch (index) {
+ case 0: name = "TestAdditionalProperties"; if(exec) TestAdditionalProperties(); break;
+ default: name = ""; break; //needed to end loop
+ }
+}
+
+//====================================================
+// private data used by the tests
+//====================================================
+
+// test DerivedCoreProperties.txt -------------------------------------------
+
+// copied from genprops.c
+static int32_t
+getTokenIndex(const char *const tokens[], int32_t countTokens, const char *s) {
+ const char *t, *z;
+ int32_t i, j;
+
+ s=u_skipWhitespace(s);
+ for(i=0; ierrln("UnicodeTest: syntax error in DerivedCoreProperties.txt field 0 at %s\n", fields[0][0]);
+ return;
+ }
+
+ /* parse derived binary property name, ignore unknown names */
+ i=getTokenIndex(derivedCorePropsNames, LENGTHOF(derivedCorePropsNames), fields[1][0]);
+ if(i<0) {
+ me->errln("UnicodeTest warning: unknown property name '%s' in \n", fields[1][0]);
+ return;
+ }
+
+ me->derivedCoreProps[i].add(start, end);
+}
+
+void UnicodeTest::TestAdditionalProperties() {
+ // test DerivedCoreProperties.txt
+ if(LENGTHOF(derivedCoreProps)=4 && uprv_strcmp(newPath+length-4, "out" U_FILE_SEP_STRING)==0) {
+ newPath[length-4]=0;
+ }
+
+ strcat(newPath, "unidata" U_FILE_SEP_STRING "DerivedCoreProperties.txt");
+
+ // As a fallback, try to guess where the source data was located
+ // at the time ICU was built, and look there.
+# ifdef U_TOPSRCDIR
+ strcpy(backupPath, U_TOPSRCDIR U_FILE_SEP_STRING "data");
+# else
+ strcpy(backupPath, loadTestData(errorCode));
+ strcat(backupPath, U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING "data");
+# endif
+ strcat(backupPath, U_FILE_SEP_STRING);
+ strcat(backupPath, "unidata" U_FILE_SEP_STRING "DerivedCoreProperties.txt");
+
+ u_parseDelimitedFile(newPath, ';', fields, 2, derivedCorePropsLineFn, this, &errorCode);
+
+ if(errorCode==U_FILE_ACCESS_ERROR) {
+ errorCode=U_ZERO_ERROR;
+ u_parseDelimitedFile(backupPath, ';', fields, 2, derivedCorePropsLineFn, this, &errorCode);
+ }
+ if(U_FAILURE(errorCode)) {
+ errln("error parsing DerivedCoreProperties.txt: %s\n", u_errorName(errorCode));
+ return;
+ }
+
+ // now we have all derived core properties in the UnicodeSets
+ // run them all through the API
+ int32_t rangeCount, range;
+ uint32_t i;
+ UChar32 start, end;
+
+ // test all TRUE properties
+ for(i=0; i