-# Copyright (c) 2008-2010 IBM Corp. and Others. All Rights Reserved
+# Copyright (c) 2008-2012 IBM Corp. and Others. All Rights Reserved
include $(MULTICU_ROOT)/common/Makefile-multi.inc
C_GOOD:=$(shell [ -d $(C_INS) ] && (cd $(C_INS) ; ls -d */$(S_INS) 2>/dev/null | cut -d/ -f1))
+C_REL:=$(shell [ -d $(C_INS) ] && (cd $(C_INS) ; ls -d r*/$(S_INS) 2>/dev/null | cut -d/ -f1))
C_CLEAN_TARGET=$(C_GOOD:%=$(C_INS)/%/bin/$(TARGET))
C_OBJECTS=$(C_SOURCES:%.c=%.o)
CXX_OBJECTS=$(CXX_SOURCES:%.cpp=%.o)
OBJECTS=$(C_OBJECTS) $(CXX_OBJECTS)
-DEBUGOPT=-g
+#DEBUGOPT=-g
# list of ICUs to be built
ICU_TARBALLS=$(shell cd $(ICUS) ; ls icu4c-*-src.tgz)
/*
*******************************************************************************
*
-* Copyright (C) 2009-2011, International Business Machines
+* Copyright (C) 2009-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
UErrorCode status = U_ZERO_ERROR;
int diffs = 0;
int gbaddiffs =0;
+ UDateFormatStyle styles[] = { UDAT_FULL, UDAT_SHORT };
setup(status);
if(U_FAILURE(status)) return 1;
int expected = PROVIDER_COUNT;
- for(int l=0;l<LOCALE_COUNT;l++) {
+ for(int s=0;s<sizeof(styles)/sizeof(styles[0]);s++) {
+ for(int l=0;l<LOCALE_COUNT;l++) {
printf("\n");
UChar oldChars[200];
int32_t oldLen = -1;
for(int v=0;v<=expected;v++) {
-
- // Construct the locale ID
- char locID[200];
- strcpy(locID, locale[l]);
- if((v!=expected)) { // -1 = no version
- strcat(locID, "@sp=icu");
- strcat(locID, provider_version[v]);
- }
-
- printf("%18s : ", locID);
-
- UErrorCode subStatus = U_ZERO_ERROR;
- UChar outchars[200];
-
- UDateFormat *dat = udat_open(UDAT_FULL, UDAT_FULL, locID, NULL, -1, NULL, 0, &subStatus);
-
- if(U_FAILURE(subStatus)) {
- printf("ERR: %s\n", u_errorName(subStatus));
- continue;
- }
-
- int32_t len = udat_format(dat, stuff, outchars, 200, NULL, &subStatus);
-
- //printf("\n");
- char utf8[200];
- u_strToUTF8(utf8, 200, NULL, outchars, len, &subStatus);
- if(oldLen!=len || memcmp(outchars,oldChars,len*sizeof(outchars[0]))) {
- putchar ('!');
- diffs++;
- } else {
- putchar ('=');
- }
- printf(" %s ", utf8);
-
- // for(int i=0;i<len;i++) {
- // if((i<oldLen)&&(outchars[i]!=oldChars[i])) {
- // diffs++;
- // printf("*", oldChars[i]);
- // } else {
- // printf(" ");
- // }
- // // printf("U+%04X", (outchars[i]));
- // }
- putchar('\n');
- udat_close(dat);
-
- oldLen = len;
- memcpy(oldChars, outchars, len*sizeof(oldChars[0]));
+
+ // Construct the locale ID
+ char locID[200];
+ strcpy(locID, locale[l]);
+ if((v!=expected)) { // -1 = no version
+ strcat(locID, "@sp=icu");
+ strcat(locID, provider_version[v]);
+ }
+
+ printf("%18s : ", locID);
+
+ UErrorCode subStatus = U_ZERO_ERROR;
+ UChar outchars[200];
+
+ UDateFormat *dat = udat_open(styles[s],styles[s], locID, NULL, -1, NULL, 0, &subStatus);
+
+ if(U_FAILURE(subStatus)) {
+ printf("ERR: %s\n", u_errorName(subStatus));
+ continue;
+ }
+
+ int32_t len = udat_format(dat, stuff, outchars, 200, NULL, &subStatus);
+
+ //printf("\n");
+ char utf8[200];
+ u_strToUTF8(utf8, 200, NULL, outchars, len, &subStatus);
+ if(oldLen!=len || memcmp(outchars,oldChars,len*sizeof(outchars[0]))) {
+ putchar ('!');
+ diffs++;
+ } else {
+ putchar ('=');
+ }
+ printf(" %s ", utf8);
+
+ // for(int i=0;i<len;i++) {
+ // if((i<oldLen)&&(outchars[i]!=oldChars[i])) {
+ // diffs++;
+ // printf("*", oldChars[i]);
+ // } else {
+ // printf(" ");
+ // }
+ // // printf("U+%04X", (outchars[i]));
+ // }
+ putchar('\n');
+ udat_close(dat);
+
+ oldLen = len;
+ memcpy(oldChars, outchars, len*sizeof(oldChars[0]));
}
+ }
}
-
+
if(diffs==0) {
printf("ERROR: 0 differences found between platforms.. are the platforms installed? Try 'icuinfo -L'\n");
return 1;
/*
*******************************************************************************
*
-* Copyright (C) 2009-2011, International Business Machines
+* Copyright (C) 2009-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
#endif
#define GLUE_VER(x) class GLUE_SYM_V( DateFormat, x ) : public DateFormat { \
- public: static DateFormat *create(const Locale &loc, const char *ver); \
+ public: static DateFormat *create(UDateFormatStyle timeStyle, \
+ UDateFormatStyle dateStyle, \
+ const char *locale, \
+ const UChar *tzID, \
+ int32_t tzIDLength, \
+ const UChar *pattern, \
+ int32_t patternLength, \
+ UErrorCode *status, const Locale &loc, const char *ver); \
private: UDateFormat *_this; GLUE_SYM_V( DateFormat, x ) ( UDateFormat* tn ); \
virtual ~ GLUE_SYM_V ( DateFormat, x) (); \
public: \
}
DateFormat *
-GLUE_SYM ( DateFormat ) :: create(const Locale &loc, const char */*ver*/) {
- // TODO: save 'ver' off.
- UErrorCode status = U_ZERO_ERROR;
- char locBuf[200];
- char kwvBuf[200];
- // int32_t len = loc.getKeywordValue("collation", kwvBuf, 200, status);
- //strcpy(locBuf,loc.getBaseName());
- // if(len>0) {
- // strcat(locBuf,"@collator=");
- // strcat(locBuf,kwvBuf);
- // }
- UDateFormat * uc = OICU_udat_open( UDAT_FULL, UDAT_FULL, loc.getName(),
- NULL,
- -1,
- NULL,
- -1,
- &status);
- if(U_FAILURE(status)) return NULL; // TODO: ERR?
+GLUE_SYM ( DateFormat ) :: create(UDateFormatStyle timeStyle,
+ UDateFormatStyle dateStyle,
+ const char *locale,
+ const UChar *tzID,
+ int32_t tzIDLength,
+ const UChar *pattern,
+ int32_t patternLength,
+ UErrorCode *status,
+ const Locale &loc, const char */*ver*/) {
+ // TODO: save version
+ char locBuf[200];
+ char kwvBuf[200];
+ UDateFormat * uc = OICU_udat_open( timeStyle, dateStyle, locale,
+ tzID,
+ tzIDLength,
+ pattern,
+ patternLength,
+ status);
+ if(U_FAILURE(*status)) return NULL; // TODO: ERR?
DateFormat *c = new GLUE_SYM( DateFormat ) ( uc );
#if DATE_FE_DEBUG
fprintf(stderr, "VCF " ICUGLUE_VER_STR " udat_open=%s ->> %p\n", loc.getName(), (void*)c);
class VersionDateFormatFactory : public UObject {
public:
- virtual DateFormat *createFormat(const Locale &loc);
+ virtual DateFormat *createFormat(UDateFormatStyle timeStyle,
+ UDateFormatStyle dateStyle,
+ const char *locale,
+ const UChar *tzID,
+ int32_t tzIDLength,
+ const UChar *pattern,
+ int32_t patternLength,
+ UErrorCode *status);
virtual const UnicodeString *getSupportedIDs(int32_t &count, UErrorCode &status);
virtual void* getDynamicClassID() const;
static void* getStaticClassID() ;
UOBJECT_DEFINE_RTTI_IMPLEMENTATION( VersionDateFormatFactory )
-DateFormat *VersionDateFormatFactory::createFormat(const Locale &loc) {
+DateFormat *VersionDateFormatFactory::createFormat(UDateFormatStyle timeStyle,
+ UDateFormatStyle dateStyle,
+ const char *locale,
+ const UChar *tzID,
+ int32_t tzIDLength,
+ const UChar *pattern,
+ int32_t patternLength,
+ UErrorCode *status) {
+ Locale loc(locale);
// pull off provider #
char provider[200];
- UErrorCode status = U_ZERO_ERROR;
#if DATE_FE_DEBUG
fprintf(stderr, "VCF:CC %s\n", loc.getName());
#endif
- int32_t len = loc.getKeywordValue("sp", provider, 200, status);
- if(U_FAILURE(status)||len==0) return NULL;
+ int32_t len = loc.getKeywordValue("sp", provider, 200, *status);
+ if(U_FAILURE(*status)||len==0) return NULL;
#if DATE_FE_DEBUG
- fprintf(stderr, "VCF:KWV> %s/%d\n", u_errorName(status), len);
+ fprintf(stderr, "VCF:KWV> %s/%d\n", u_errorName(*status), len);
#endif
provider[len]=0;
#if DATE_FE_DEBUG
#if defined(GLUE_VER)
#undef GLUE_VER
#endif
-#define GLUE_VER(x) /*printf("%c/%c|%c/%c\n", icuver[0],(#x)[0],icuver[1],(#x)[2]);*/ if(icuver[0]== (#x)[0] && icuver[1]==(#x)[2]) { DateFormat *c = glue ## DateFormat ## x :: create(loc, icuver); /*fprintf(stderr, "VCF::CC %s -> %p\n", loc.getName(), c);*/ return c; }
+#define GLUE_VER(x) /*printf("%c/%c|%c/%c\n", icuver[0],(#x)[0],icuver[1],(#x)[2]);*/ if(icuver[0]== (#x)[0] && icuver[1]==(#x)[2]) { DateFormat *c = glue ## DateFormat ## x :: create(timeStyle,dateStyle,locale,tzID,tzIDLength,pattern,patternLength,status,loc,icuver); /*fprintf(stderr, "VCF::CC %s -> %p\n", loc.getName(), c);*/ return c; }
#include "icuglue/glver.h"
#if DATE_FE_DEBUG
fprintf(stderr, "VCF:CC %s failed\n", loc.getName());
const UChar *pattern,
int32_t patternLength,
UErrorCode *status) {
- Locale loc(locale);
- DateFormat *df = vdf.createFormat(loc);
+ DateFormat *df = vdf.createFormat(timeStyle,dateStyle,locale,tzID,tzIDLength,pattern,patternLength,status);
// printf("Hey! I got: %s -> %p\n", locale, df);
return (UDateFormat*)df;
}
#!/bin/cat
-# Copyright (c) 2009-2011 IBM Corp. and Others. All Rights Reserved
+# Copyright (c) 2009-2012 IBM Corp. and Others. All Rights Reserved
# ICU Provider Feature. - $Id$
+* Note, as of ICU49 this is a technology preview.
+
BUILDING:
1a. Download the ICU source (.tgz) you wish to TARGET (i.e. link your
this writing.
1b. Download one or more ICUs (.tgz) you wish to have AVAILABLE (via
-the provider interface). As of this writing, 49, 4.6.x, 4.4.x, 4.2.0.1, 3.8.1, 3.6, 3.4.1, and 3.2.1 have been tested.
+the provider interface). As of this writing, 49, 4.8.1.1, 4.6.x, 4.4.x, 4.2.0.1, 3.8.1, 3.6, 3.4.1, and 3.2.1 have been tested.
Note that the MAJOR+MINOR version numbers must not conflict between the TARGET and AVAILABLE ICUs. Only one ICU of each major+minor is allowed.
So, only one 4.4.X, one 3.8.X, etc. This is due to ICU binary compatibility rules.
format, but only through 'udat_open'.
+
+