mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-315 more S/390 changes
X-SVN-Rev: 1021
This commit is contained in:
parent
5a0029437c
commit
3c0e9c341f
4 changed files with 35 additions and 55 deletions
|
@ -42,19 +42,6 @@
|
|||
# define DEFAULT_CODEPAGE "LATIN_1"
|
||||
#endif
|
||||
|
||||
int prv_stricmp(const char* string1, const char* string2)
|
||||
{
|
||||
int32_t ch;
|
||||
for(;;) {
|
||||
ch = (int32_t)tolower(*string1) - (int32_t)tolower(*string2);
|
||||
if(ch != 0 || *string1 == 0) {
|
||||
return ch;
|
||||
}
|
||||
++string1;
|
||||
++string2;
|
||||
}
|
||||
}
|
||||
|
||||
/*writes and entire UChar* (string) along with a BOM to a file*/
|
||||
void WriteToFile(const UChar *a, FILE *myfile);
|
||||
/*Case insensitive compare*/
|
||||
|
@ -338,20 +325,20 @@ void TestConvert()
|
|||
if (U_FAILURE(err)){ log_err("FAILURE! %s\n", myErrorName(err));}
|
||||
|
||||
/* Testing ucnv_getName()*/
|
||||
/*default code page */
|
||||
if ((prv_stricmp(ucnv_getName(someConverters[0], &err), DEFAULT_CODEPAGE)==0)&&
|
||||
(prv_stricmp(ucnv_getName(someConverters[1], &err), DEFAULT_CODEPAGE)==0))
|
||||
/*default code page */
|
||||
if ((uprv_stricmp(ucnv_getName(someConverters[0], &err), DEFAULT_CODEPAGE)==0)&&
|
||||
(uprv_stricmp(ucnv_getName(someConverters[1], &err), DEFAULT_CODEPAGE)==0))
|
||||
log_verbose("getName ok\n");
|
||||
else
|
||||
log_err("getName failed\n");
|
||||
|
||||
/*Testing ucnv_getDefaultName() and ucnv_setDefaultNAme()*/
|
||||
if(prv_stricmp(ucnv_getDefaultName(), DEFAULT_CODEPAGE)==0)
|
||||
if(uprv_stricmp(ucnv_getDefaultName(), DEFAULT_CODEPAGE)==0)
|
||||
log_verbose("getDefaultName o.k.\n");
|
||||
else
|
||||
log_err("getDefaultName failed \n");
|
||||
|
||||
/*change the default name by setting it */
|
||||
/*change the default name by setting it */
|
||||
ucnv_setDefaultName("changed");
|
||||
if(strcmp(ucnv_getDefaultName(), "changed")==0)
|
||||
log_verbose("setDefaultName o.k");
|
||||
|
@ -389,9 +376,9 @@ void TestConvert()
|
|||
|
||||
/*Creates a converter and testing ucnv_openCCSID(u_int code_page, platform, errstatus*/
|
||||
|
||||
/* myConverter =ucnv_openCCSID(CodePageNumberToTest[codepage_index],UCNV_IBM, &err); */
|
||||
/* ucnv_flushCache(); */
|
||||
myConverter =ucnv_open( "ibm-949", &err);
|
||||
/* myConverter =ucnv_openCCSID(CodePageNumberToTest[codepage_index],UCNV_IBM, &err); */
|
||||
/* ucnv_flushCache(); */
|
||||
myConverter =ucnv_open( "ibm-949", &err);
|
||||
if (!myConverter || U_FAILURE(err))
|
||||
{
|
||||
log_err("Error creating the convertor \n");
|
||||
|
@ -612,18 +599,18 @@ void TestConvert()
|
|||
/*call it first time for trapping the targetcapacity and size needed to allocate memory for the buffer uchar2 */
|
||||
targetcapacity2=0;
|
||||
targetsize = ucnv_toUChars(myConverter,
|
||||
NULL,
|
||||
targetcapacity2,
|
||||
output_cp_buffer,
|
||||
strlen(output_cp_buffer),
|
||||
&err);
|
||||
NULL,
|
||||
targetcapacity2,
|
||||
output_cp_buffer,
|
||||
strlen(output_cp_buffer),
|
||||
&err);
|
||||
/*if there is an buffer overflow then trap the values and pass them and make the actual call*/
|
||||
|
||||
if(err==U_BUFFER_OVERFLOW_ERROR)
|
||||
{
|
||||
err=U_ZERO_ERROR;
|
||||
uchar2=(UChar*)malloc((targetsize) * sizeof(UChar));
|
||||
targetsize = ucnv_toUChars(myConverter,
|
||||
targetsize = ucnv_toUChars(myConverter,
|
||||
uchar2,
|
||||
targetsize,
|
||||
output_cp_buffer,
|
||||
|
@ -635,13 +622,13 @@ void TestConvert()
|
|||
else
|
||||
log_verbose(" ucnv_toUChars() o.k.\n");
|
||||
|
||||
if(u_strcmp(uchar1,uchar2)!=0)
|
||||
log_err("equality test failed with convertion routine\n");
|
||||
if(u_strcmp(uchar1,uchar2)!=0)
|
||||
log_err("equality test failed with convertion routine\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
log_err("ERR: calling toUChars: Didn't get U_BUFFER_OVERFLOW .. expected it.\n");
|
||||
}
|
||||
{
|
||||
log_err("ERR: calling toUChars: Didn't get U_BUFFER_OVERFLOW .. expected it.\n");
|
||||
}
|
||||
|
||||
/*testing for ucnv_fromUnicode() and ucnv_toUnicode() */
|
||||
/*Clean up re-usable vars*/
|
||||
|
@ -695,14 +682,14 @@ void TestConvert()
|
|||
/*sanity compare */
|
||||
if(uchar2 == NULL)
|
||||
{
|
||||
log_err("uchar2 was NULL (ccapitst.c line %d), couldn't do sanity check\n", __LINE__);
|
||||
log_err("uchar2 was NULL (ccapitst.c line %d), couldn't do sanity check\n", __LINE__);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(u_strcmp(uchar2, uchar3)==0)
|
||||
log_verbose("Equality test o.k.\n");
|
||||
else
|
||||
log_err("Equality test failed\n");
|
||||
if(u_strcmp(uchar2, uchar3)==0)
|
||||
log_verbose("Equality test o.k.\n");
|
||||
else
|
||||
log_err("Equality test failed\n");
|
||||
}
|
||||
|
||||
fclose(ucs_file_in);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "unicode/ucnv_err.h"
|
||||
#include <iostream.h>
|
||||
#include "cppcnvt.h"
|
||||
#include "cstring.h"
|
||||
|
||||
#define NUM_CODEPAGE 1
|
||||
#define MAX_FILE_LEN 1024*20
|
||||
|
@ -31,19 +32,6 @@
|
|||
# define DEFAULT_CODEPAGE "LATIN_1"
|
||||
#endif
|
||||
|
||||
int prv_stricmp(const char* string1, const char* string2)
|
||||
{
|
||||
int32_t ch;
|
||||
for(;;) {
|
||||
ch = (int32_t)tolower(*string1) - (int32_t)tolower(*string2);
|
||||
if(ch != 0 || *string1 == 0) {
|
||||
return ch;
|
||||
}
|
||||
++string1;
|
||||
++string2;
|
||||
}
|
||||
}
|
||||
|
||||
/*writes and entire UnicodeString along with a BOM to a file*/
|
||||
void WriteToFile(const UnicodeString *a, FILE *myfile);
|
||||
/*Case insensitive compare*/
|
||||
|
@ -244,8 +232,8 @@ void ConvertTest::TestConvert()
|
|||
someConverters[2] = new UnicodeConverterCPP("utf8", err);
|
||||
if (U_FAILURE(err)) errln ((UnicodeString)"FAILURE! " + err);
|
||||
|
||||
if ((prv_stricmp(someConverters[1]->getName(err),DEFAULT_CODEPAGE)==0)&&
|
||||
(prv_stricmp(someConverters[0]->getName(err),DEFAULT_CODEPAGE)==0))
|
||||
if ((uprv_stricmp(someConverters[1]->getName(err),DEFAULT_CODEPAGE)==0)&&
|
||||
(uprv_stricmp(someConverters[0]->getName(err),DEFAULT_CODEPAGE)==0))
|
||||
logln("getName ok");
|
||||
else errln("getName failed");
|
||||
logln(someConverters[1]->getName(err));
|
||||
|
@ -595,13 +583,13 @@ void ConvertTest::TestAmbiguous()
|
|||
sjis_cnv = new UnicodeConverterCPP("SJIS", status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
errln("Failed to create a SJIS converter\n");
|
||||
errln("Failed to create a SJIS converter\n");
|
||||
return;
|
||||
}
|
||||
ascii_cnv = new UnicodeConverterCPP("LATIN-1", status);
|
||||
if (U_FAILURE(status))
|
||||
{
|
||||
errln("Failed to create a SJIS converter\n");
|
||||
errln("Failed to create a SJIS converter\n");
|
||||
delete sjis_cnv;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,11 @@
|
|||
#ifndef _INTLTEST
|
||||
#define _INTLTEST
|
||||
|
||||
#ifdef OS390
|
||||
// avoid collision with math.h/log()
|
||||
#pragma map(IntlTest::log( const UnicodeString &message ),"logos390")
|
||||
#endif
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/unistr.h"
|
||||
#include "unicode/coll.h"
|
||||
|
|
|
@ -53,7 +53,7 @@ CFLAGS = @CFLAGS@
|
|||
CXXFLAGS = @CXXFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ \
|
||||
$(LD_RPATH)$(LD_RPATH_PRE)$(libdir)@ld_rpath_suf@$(LD_RPATH_PRE)$(top_builddir)/common@ld_rpath_suf@$(LD_RPATH_PRE)$(top_builddir)/i18n@ld_rpath_suf@$(LD_RPATH_PRE)$(top_builddir)/tools/toolutil@ld_rpath_suf@$(LD_RPATH_PRE)$(top_builddir)/extra/ustdio
|
||||
LIBS = $(LIBICU-UC) $(LIBICU-I18N) @LIBS@ @LIB_M@ $(LIBICU-TOOLUTIL) -L$(top_builddir)/extra/ustdio -lustdio
|
||||
LIBS = $(LIBICU-UC) $(LIBICU-I18N) @LIBS@ @LIB_M@ $(LIBICU-TOOLUTIL) $(LIBUSTDIO)
|
||||
|
||||
OBJECTS = error.o genrb.o ustr.o parse.o read.o write.o list.o \
|
||||
rblist.o util.o
|
||||
|
|
Loading…
Add table
Reference in a new issue