ICU-6631 multi-icu (support for provider)
X-SVN-Rev: 26647
This commit is contained in:
parent
30ef01e564
commit
b02877f0e0
6
.gitattributes
vendored
6
.gitattributes
vendored
@ -330,6 +330,12 @@ icu4j/tools/build/icu4j42.api.gz -text
|
||||
icu4j/tools/build/icu4j421.api.gz -text
|
||||
icu4j/tools/build/manifest.stub -text
|
||||
icu4j/tools/misc/manifest.stub -text
|
||||
tools/multi/c/Makefile-c.inc -text
|
||||
tools/multi/c/patch/3_0 -text
|
||||
tools/multi/c/patch/3_2 -text
|
||||
tools/multi/c/patch/3_4_1 -text
|
||||
tools/multi/common/Makefile-multi.inc -text
|
||||
tools/multi/j/Makefile-j.inc -text
|
||||
tools/release/java/.classpath -text
|
||||
tools/release/java/.project -text
|
||||
tools/release/java/Makefile -text
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -782,6 +782,10 @@ icu4j/main/tests/translit/out
|
||||
icu4j/out
|
||||
icu4j/tools/build/out
|
||||
icu4j/tools/misc/out
|
||||
tools/multi/packages/*.jar
|
||||
tools/multi/packages/*.tgz
|
||||
tools/multi/proj/chello/out
|
||||
tools/multi/tmp
|
||||
tools/release/java/APIChangeReport.html
|
||||
tools/release/java/Makefile.local
|
||||
tools/release/java/classes
|
||||
|
81
tools/multi/c/Makefile
Normal file
81
tools/multi/c/Makefile
Normal file
@ -0,0 +1,81 @@
|
||||
# Copyright (c) 2009 IBM Corp. and Others. All Rights Reserved
|
||||
# multicu/c makefile
|
||||
|
||||
all:
|
||||
@echo To build all ICUs: $(MAKE) all-icus
|
||||
@echo "Using the -k option may be a good idea if some are not building properly."
|
||||
@echo ICUVERS: $(ICUVERS)
|
||||
|
||||
info:
|
||||
|
||||
#ICUCONF=sh ./configure
|
||||
ICUCONF=$(MULTICU_ROOT)/c/superconf.sh
|
||||
DOT=$(shell pwd)
|
||||
MULTICU_ROOT=$(DOT)/..
|
||||
include $(MULTICU_ROOT)/common/Makefile-multi.inc
|
||||
-include Makefile.local
|
||||
|
||||
ICUVERS:=$(shell cd $(ICUS); ls icu4c*.tgz | cut -d- -f2 | sort | uniq | fgrep -v -f $(MULTICU_ROOT)/c/old-icu.txt)
|
||||
ICU4JVERS:=$(shell cd $(ICUS); ls icu4j*.jar | cut -d- -f2 | cut -d. -f1 | sort | uniq | fgrep -v -f $(MULTICU_ROOT)/j/old-icu4j.txt)
|
||||
|
||||
BLD=$(C_BLD)
|
||||
INS=$(C_INS)
|
||||
SRC=$(C_SRC)
|
||||
|
||||
ALLICUS=$(ICUVERS:%=$(BLD)/%/$(S_BLD))
|
||||
IICUS=$(ICUVERS:%=$(INS)/%/$(S_INS))
|
||||
|
||||
APRECIOUS=$(ICUVERS:%=$(BLD)/%/$(S_SRC)) $(ICUVERS:%=$(BLD)/%/$(S_BLD)) $(ICUVERS:%=$(INS)/%/$(S_INS))
|
||||
|
||||
.PRECIOUS: $(APRECIOUS)
|
||||
|
||||
tehprecious:
|
||||
echo $(APRECIOUS)
|
||||
|
||||
$(M_TMP):
|
||||
-mkdir $(M_TMP)
|
||||
|
||||
$(M_TMP) $(BLD) $(INS):
|
||||
mkdir $(M_TMP)
|
||||
mkdir $(BLD) $(SRC) $(INS)
|
||||
|
||||
$(INS)/%/$(S_INS): $(BLD)/%/$(S_BLD)
|
||||
@if [ -f $(BLD)/$*/build.err ]; then echo '###' Error for $* stored in $(BLD)/$*/build.err - remove if you want me to retry; false; fi
|
||||
( make $(MAKE_OPTS) -C $(BLD)/$*/icu/source 2>&1 all install | tee $(BLD)/$*/build.log ) || ( mv $(BLD)/$*/build.log $(BLD)/$*/build.err ; false )
|
||||
touch -c $@
|
||||
|
||||
$(BLD)/%/$(S_SRC): $(ICUS)/icu4c-%-src.tgz
|
||||
-mv $(BLD)/$* $(BLD)/$*.old
|
||||
-( rm -rf ./$(BLD)/$*.old& )
|
||||
mkdir -p $(BLD)/$*
|
||||
( cd $(BLD)/$* ; gunzip -d < $^ | tar xfp - )
|
||||
([ -f $(DOT)/patch/$* ] && patch -d $(BLD)/$* -p1 < $(DOT)/patch/$*) || true
|
||||
touch -c $@
|
||||
|
||||
$(BLD)/%/$(S_BLD): $(BLD)/%/$(S_SRC)
|
||||
-mkdir -p $(INS)
|
||||
-chmod a+rx $(BLD)/$*/icu/source/configure $(BLD)/$*/icu/source/runConfigureICU
|
||||
( cd $(BLD)/$*/icu/source ; `ICU_VER="$*" $(ICUCONF)` --disable-renaming --enable-shared --disable-static --enable-release --disable-debug --prefix=$(INS)/$* )
|
||||
touch -c $@
|
||||
|
||||
$(INS)/%/bin/$(TARGET): $(INS)/%/$(S_INS) $(SRCS)
|
||||
-rm -rf ./$(BLD)/$*/tmp
|
||||
mkdir ./$(BLD)/$*/tmp
|
||||
@for file in $(OBJECTS); \
|
||||
do \
|
||||
what=`basename $$file .o` ; \
|
||||
echo compiling $*/$$what ; \
|
||||
$(CXX) -c -o ./$(BLD)/$*/tmp/$$what.o $$what.cpp -I $(INS)/$*/include -I $(BLD)/$*/icu/source/tools/toolutil ; \
|
||||
done
|
||||
$(CXX) -o $@ $(OBJECTS:%.o=./$(BLD)/$*/tmp/%.o) -licudata -licuuc -licutu -licui18n -L$(INS)/$*/lib
|
||||
|
||||
foo:
|
||||
echo $(ALLICUS)
|
||||
|
||||
allicus: $(BLD) $(ALLICUS)
|
||||
|
||||
|
||||
all-icus: iicus
|
||||
|
||||
iicus: $(BLD) $(IICUS)
|
||||
|
40
tools/multi/c/Makefile-c.inc
Normal file
40
tools/multi/c/Makefile-c.inc
Normal file
@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2008-2009 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) | cut -d/ -f1))
|
||||
|
||||
|
||||
C_CLEAN_TARGET=$(C_GOOD:%=$(C_INS)/%/bin/$(TARGET))
|
||||
|
||||
SOURCES=$(C_SOURCES) $(CXX_SOURCES)
|
||||
C_OBJECTS=$(C_SOURCES:%.c=%.o)
|
||||
CXX_OBJECTS=$(CXX_SOURCES:%.cpp=%.o)
|
||||
OBJECTS=$(C_OBJECTS) $(CXX_OBJECTS)
|
||||
DEBUGOPT=-g
|
||||
|
||||
$(C_INS)/%/bin/$(TARGET): $(SOURCES) $(HEADERS)
|
||||
-rm -rf $(C_INS)/$*/tmp
|
||||
mkdir $(C_INS)/$*/tmp
|
||||
ifneq (,$(CXX_OBJECTS))
|
||||
@for file in $(CXX_OBJECTS); \
|
||||
do \
|
||||
what=`basename $$file .o` ; \
|
||||
echo compiling '(C++)' $*/$$what ; \
|
||||
`$(C_INS)/$*/bin/icu-config --cxx` `$(C_INS)/$*/bin/icu-config --cxxflags` $(DEBUGOPT) -c -o $(C_INS)/$*/tmp/$$what.o $$what.cpp -I $(C_INS)/$*/include -I $(C_BLD)/$*/icu/source/tools/toolutil || \
|
||||
$(CXX) $(DEBUGOPT) -c -o $(C_INS)/$*/tmp/$$what.o $${what}.cpp -I $(C_INS)/$*/include -I $(C_BLD)/$*/icu/source/tools/toolutil ; \
|
||||
done
|
||||
endif
|
||||
ifneq (,$(C_OBJECTS))
|
||||
@for file in $(C_OBJECTS); \
|
||||
do \
|
||||
what=`basename $$file .o` ; \
|
||||
echo compiling '(C )' $*/$$what ; \
|
||||
$(CC) $(DEBUGOPT) -c -o $(C_INS)/$*/tmp/$$what.o $${what}.c -I $(C_INS)/$*/include -I $(C_BLD)/$*/icu/source/tools/toolutil ; \
|
||||
done
|
||||
endif
|
||||
@echo linking $*/$$what
|
||||
@`$(C_INS)/$*/bin/icu-config --cxx` `$(C_INS)/$*/bin/icu-config --ldflags ` $(DEBUGOPT) -o $@ $(OBJECTS:%.o=$(C_INS)/$*/tmp/%.o) -licudata -licuuc -licutu -licui18n -licuio -L$(C_INS)/$*/lib || \
|
||||
$(CXX) $(DEBUGOPT) -o $@ $(OBJECTS:%.o=$(C_INS)/$*/tmp/%.o) -licudata -licuuc -licutu -licui18n -licuio -L$(C_INS)/$*/lib
|
||||
|
||||
|
2
tools/multi/c/old-icu.txt
Normal file
2
tools/multi/c/old-icu.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# Copyright (c) 2009 IBM Corp. and Others. All Rights Reserved
|
||||
# a list of ICU4Cs too old to build with the current patchset.
|
12775
tools/multi/c/patch/3_0
Normal file
12775
tools/multi/c/patch/3_0
Normal file
File diff suppressed because it is too large
Load Diff
12384
tools/multi/c/patch/3_2
Normal file
12384
tools/multi/c/patch/3_2
Normal file
File diff suppressed because it is too large
Load Diff
17
tools/multi/c/patch/3_4_1
Normal file
17
tools/multi/c/patch/3_4_1
Normal file
@ -0,0 +1,17 @@
|
||||
# Copyright (c) 2008-2009 IBM Corp. and Others. All Rights Reserved
|
||||
Only in 3_0/icu/source: bin
|
||||
Only in 3_0.orig/icu/source: confdefs.h
|
||||
diff -ru 3_0.orig/icu/source/config/mh-darwin 3_0/icu/source/config/mh-darwin
|
||||
--- 3_0.orig/icu/source/config/mh-darwin 2008-10-20 14:57:52.000000000 -0700
|
||||
+++ 3_0/icu/source/config/mh-darwin 2008-10-20 15:57:28.000000000 -0700
|
||||
@@ -15,6 +15,8 @@
|
||||
## Commands to generate dependency files
|
||||
GEN_DEPS.c= $(CC) -E -MMD $(DEFS) $(CPPFLAGS)
|
||||
GEN_DEPS.cc= $(CXX) -E -MMD $(DEFS) $(CPPFLAGS)
|
||||
+GEN_DEPS.c= echo
|
||||
+GEN_DEPS.cc= echo
|
||||
|
||||
## Commands to compile
|
||||
COMPILE.c= $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -fno-common -c
|
||||
Only in 3_0.orig/icu/source: config.cache
|
||||
Only in 3_0.orig/icu/source: config.log
|
64
tools/multi/c/superconf.sh
Executable file
64
tools/multi/c/superconf.sh
Executable file
@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
# Copyright (c) 2009 IBM Corp. and Others. All Rights Reserved
|
||||
#
|
||||
# Sample "super configure"
|
||||
# this script is responsible for configuring ICU.
|
||||
|
||||
# input variables;
|
||||
# $ICU_VER - the ICU version in underscore format (4_2_0_1)
|
||||
|
||||
|
||||
U_HOST=`hostname`
|
||||
U_SYS=`uname || echo unknown`
|
||||
#echo $HOST
|
||||
|
||||
export rcs=none
|
||||
|
||||
case $U_SYS in
|
||||
AIX)
|
||||
# the preferred 'AIX' type to use
|
||||
AIX=AIX
|
||||
case $ICU_VER in
|
||||
4*)
|
||||
#AIX=AIX4.3VA
|
||||
AIX=AIX
|
||||
;;
|
||||
*)
|
||||
AIX=AIX4.3VA
|
||||
;;
|
||||
1*|2*|3_0*|3_1*)
|
||||
AIX=AIX4.3xlC
|
||||
PATH=/usr/vacpp/bin/:$PATH
|
||||
;;
|
||||
esac
|
||||
rcs=${AIX}
|
||||
;;
|
||||
*)
|
||||
rcs=none
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
case $HOST in
|
||||
sys98*)
|
||||
rcs=$AIX
|
||||
;;
|
||||
hp*)
|
||||
rcs='HP-UX/ACC'
|
||||
;;
|
||||
merill*|redhat*|sunlight*)
|
||||
rcs='LinuxRedHat'
|
||||
;;
|
||||
*)
|
||||
echo sh ./configure
|
||||
#echo Unknown host $HOST, edit $0
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
echo sh ./runConfigureICU "${rcs}"
|
||||
|
||||
|
||||
|
||||
|
20
tools/multi/common/Makefile-multi.inc
Normal file
20
tools/multi/common/Makefile-multi.inc
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright (c) 2008-2009 IBM Corp. and Others. All Rights Reserved
|
||||
|
||||
C_ROOT=$(MULTICU_ROOT)/c
|
||||
J_ROOT=$(MULTICU_ROOT)/j
|
||||
M_TMP=$(MULTICU_ROOT)/tmp
|
||||
C_INS=$(M_TMP)/ins
|
||||
C_BLD=$(M_TMP)/build
|
||||
C_SRC=$(M_TMP)/src
|
||||
|
||||
# C defs
|
||||
S_INS=include/unicode/utypes.h
|
||||
S_BLD=icu/source/config.status
|
||||
S_SRC=icu/source/configure
|
||||
|
||||
-include $(MULTICU_ROOT)/common/Makefile-local.inc
|
||||
|
||||
ICUS=$(MULTICU_ROOT)/packages
|
||||
|
||||
|
||||
# J defs
|
8
tools/multi/j/Makefile-j.inc
Normal file
8
tools/multi/j/Makefile-j.inc
Normal file
@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2008-2009 IBM Corp. and Others. All Rights Reserved
|
||||
|
||||
include $(MULTICU_ROOT)/Makefile-multi.inc
|
||||
ICUS=$(MULTICU_ROOT)/icus
|
||||
J_GOOD:=$(shell [ -d $(ICUS) ] && (cd $(ICUS) ; ls -d icu4j-*.jar | cut -d- -f2 | cut -d. -f1))
|
||||
#J_GOOD=$(ICU4JVERS:%=$(ICUS)/icu4j-%.jar)
|
||||
|
||||
|
2
tools/multi/j/old-icu4j.txt
Normal file
2
tools/multi/j/old-icu4j.txt
Normal file
@ -0,0 +1,2 @@
|
||||
# Copyright (c) 2009 IBM Corp. and Others. All Rights Reserved
|
||||
# a list of ICU4Cs too old to build with the current patchset.
|
51
tools/multi/proj/chello/Makefile
Normal file
51
tools/multi/proj/chello/Makefile
Normal file
@ -0,0 +1,51 @@
|
||||
# Copyright (c) 2008-2009 IBM Corp. and Others. All Rights Reserved
|
||||
# Makefile for multicu/sample/chello
|
||||
# C/C++ hello
|
||||
|
||||
## Name of the app
|
||||
TARGET=chello
|
||||
|
||||
## Sources list (C and C++ just to be difficult)
|
||||
C_SOURCES=date.c
|
||||
CXX_SOURCES=uprint.cpp
|
||||
SRCS=$(C_SOURCES) $(CXX_SOURCES)
|
||||
HEADERS=uprint.h
|
||||
|
||||
all:
|
||||
@echo To build and list "'" $(OUTFILES) "'" in "'" $(C_GOOD) "'" use "$(MAKE) check"
|
||||
|
||||
## Setup multicu
|
||||
MULTICU_ROOT=../../
|
||||
include $(MULTICU_ROOT)/c/Makefile-c.inc
|
||||
|
||||
OUT=out
|
||||
|
||||
$(OUT):
|
||||
mkdir $(OUT)
|
||||
|
||||
## The output files. Will result in: out/3_8.txt out/4_0.txt etc.
|
||||
OUTFILES=$(C_GOOD:%=$(OUT)/%.txt)
|
||||
|
||||
.PRECIOUS: $(C_CLEAN_TARGET)
|
||||
|
||||
## Generate a file
|
||||
$(OUT)/%.txt: $(OUT) $(C_INS)/%/bin/$(TARGET)
|
||||
$(shell $(C_INS)/$*/bin/icu-config --invoke) $(C_INS)/$*/bin/$(TARGET) > $@
|
||||
|
||||
## clean
|
||||
clean:
|
||||
-rm -f $(C_CLEAN_TARGET)
|
||||
-rm -f ./$(OUT)/*
|
||||
-rmdir $(OUT)
|
||||
|
||||
## Just generate
|
||||
outfiles: $(OUTFILES)
|
||||
|
||||
## Test: generate out files, and print them.
|
||||
check: $(OUTFILES)
|
||||
@for file in $(OUTFILES); \
|
||||
do \
|
||||
echo; \
|
||||
sed -e "s%^%$$file: %g" < $$file; \
|
||||
done
|
||||
|
204
tools/multi/proj/chello/date.c
Normal file
204
tools/multi/proj/chello/date.c
Normal file
@ -0,0 +1,204 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1998-2009, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
* File date.c
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 06/11/99 stephen Creation.
|
||||
* 06/16/99 stephen Modified to use uprint.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/ustring.h"
|
||||
#include "unicode/uclean.h"
|
||||
|
||||
#include "unicode/ucnv.h"
|
||||
#include "unicode/udat.h"
|
||||
#include "unicode/ucal.h"
|
||||
|
||||
#include "uprint.h"
|
||||
|
||||
int main(int argc, char **argv);
|
||||
|
||||
#if UCONFIG_NO_FORMATTING
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
printf("%s: Sorry, UCONFIG_NO_FORMATTING was turned on (see uconfig.h). No formatting can be done. \n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
/* Protos */
|
||||
static void usage(void);
|
||||
static void version(void);
|
||||
static void date(const UChar *tz, UDateFormatStyle style, char *format, UErrorCode *status);
|
||||
|
||||
|
||||
/* The version of date */
|
||||
#define DATE_VERSION "1.0"
|
||||
|
||||
/* "GMT" */
|
||||
static const UChar GMT_ID [] = { 0x0047, 0x004d, 0x0054, 0x0000 };
|
||||
|
||||
|
||||
int
|
||||
main(int argc,
|
||||
char **argv)
|
||||
{
|
||||
int printUsage = 0;
|
||||
int printVersion = 0;
|
||||
int optind = 1;
|
||||
char *arg;
|
||||
const UChar *tz = 0;
|
||||
UDateFormatStyle style = UDAT_DEFAULT;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
char *format = NULL;
|
||||
|
||||
|
||||
/* parse the options */
|
||||
for(optind = 1; optind < argc; ++optind) {
|
||||
arg = argv[optind];
|
||||
|
||||
/* version info */
|
||||
if(strcmp(arg, "-v") == 0 || strcmp(arg, "--version") == 0) {
|
||||
printVersion = 1;
|
||||
}
|
||||
/* usage info */
|
||||
else if(strcmp(arg, "-h") == 0 || strcmp(arg, "--help") == 0) {
|
||||
printUsage = 1;
|
||||
}
|
||||
/* display date in gmt */
|
||||
else if(strcmp(arg, "-u") == 0 || strcmp(arg, "--gmt") == 0) {
|
||||
tz = GMT_ID;
|
||||
}
|
||||
/* display date in gmt */
|
||||
else if(strcmp(arg, "-f") == 0 || strcmp(arg, "--full") == 0) {
|
||||
style = UDAT_FULL;
|
||||
}
|
||||
/* display date in long format */
|
||||
else if(strcmp(arg, "-l") == 0 || strcmp(arg, "--long") == 0) {
|
||||
style = UDAT_LONG;
|
||||
}
|
||||
/* display date in medium format */
|
||||
else if(strcmp(arg, "-m") == 0 || strcmp(arg, "--medium") == 0) {
|
||||
style = UDAT_MEDIUM;
|
||||
}
|
||||
/* display date in short format */
|
||||
else if(strcmp(arg, "-s") == 0 || strcmp(arg, "--short") == 0) {
|
||||
style = UDAT_SHORT;
|
||||
}
|
||||
else if(strcmp(arg, "-F") == 0 || strcmp(arg, "--format") == 0) {
|
||||
if ( optind + 1 < argc ) {
|
||||
optind++;
|
||||
format = argv[optind];
|
||||
}
|
||||
}
|
||||
/* POSIX.1 says all arguments after -- are not options */
|
||||
else if(strcmp(arg, "--") == 0) {
|
||||
/* skip the -- */
|
||||
++optind;
|
||||
break;
|
||||
}
|
||||
/* unrecognized option */
|
||||
else if(strncmp(arg, "-", strlen("-")) == 0) {
|
||||
printf("icudate: invalid option -- %s\n", arg+1);
|
||||
printUsage = 1;
|
||||
}
|
||||
/* done with options, display date */
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* print usage info */
|
||||
if(printUsage) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* print version info */
|
||||
if(printVersion) {
|
||||
version();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* print the date */
|
||||
date(tz, style, format, &status);
|
||||
|
||||
u_cleanup();
|
||||
return (U_FAILURE(status) ? 1 : 0);
|
||||
}
|
||||
|
||||
/* Usage information */
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
puts("Usage: icudate [OPTIONS]");
|
||||
puts("Options:");
|
||||
puts(" -h, --help Print this message and exit.");
|
||||
puts(" -v, --version Print the version number of date and exit.");
|
||||
puts(" -u, --gmt Display the date in Greenwich Mean Time.");
|
||||
puts(" -f, --full Use full display format.");
|
||||
puts(" -l, --long Use long display format.");
|
||||
puts(" -m, --medium Use medium display format.");
|
||||
puts(" -s, --short Use short display format.");
|
||||
}
|
||||
|
||||
/* Version information */
|
||||
static void
|
||||
version()
|
||||
{
|
||||
printf("icudate version %s (ICU version %s), created by Stephen F. Booth.\n",
|
||||
DATE_VERSION, U_ICU_VERSION);
|
||||
puts(U_COPYRIGHT_STRING);
|
||||
}
|
||||
|
||||
/* Format the date */
|
||||
static void
|
||||
date(const UChar *tz,
|
||||
UDateFormatStyle style,
|
||||
char *format,
|
||||
UErrorCode *status)
|
||||
{
|
||||
UChar *s = 0;
|
||||
int32_t len = 0;
|
||||
UDateFormat *fmt;
|
||||
UChar uFormat[100];
|
||||
|
||||
fmt = udat_open(style, style, 0, tz, -1,NULL,0, status);
|
||||
if ( format != NULL ) {
|
||||
u_charsToUChars(format,uFormat,strlen(format)),
|
||||
udat_applyPattern(fmt,FALSE,uFormat,strlen(format));
|
||||
}
|
||||
len = udat_format(fmt, ucal_getNow(), 0, len, 0, status);
|
||||
if(*status == U_BUFFER_OVERFLOW_ERROR) {
|
||||
*status = U_ZERO_ERROR;
|
||||
s = (UChar*) malloc(sizeof(UChar) * (len+1));
|
||||
if(s == 0) goto finish;
|
||||
udat_format(fmt, ucal_getNow(), s, len + 1, 0, status);
|
||||
if(U_FAILURE(*status)) goto finish;
|
||||
}
|
||||
|
||||
/* print the date string */
|
||||
uprint(s, stdout, status);
|
||||
|
||||
/* print a trailing newline */
|
||||
printf(" @ ICU " U_ICU_VERSION "\n");
|
||||
|
||||
finish:
|
||||
udat_close(fmt);
|
||||
free(s);
|
||||
}
|
||||
#endif
|
76
tools/multi/proj/chello/uprint.cpp
Normal file
76
tools/multi/proj/chello/uprint.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1998-2009, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
* File uprint.cpp
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 06/14/99 stephen Creation.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include "uprint.h"
|
||||
|
||||
#include "unicode/ucnv.h"
|
||||
#include "unicode/ustring.h"
|
||||
|
||||
#define BUF_SIZE 128
|
||||
|
||||
/* Print a ustring to the specified FILE* in the default codepage */
|
||||
U_CAPI void
|
||||
uprint(const UChar *s,
|
||||
FILE *f,
|
||||
UErrorCode *status)
|
||||
{
|
||||
/* converter */
|
||||
UConverter *converter;
|
||||
char buf [BUF_SIZE];
|
||||
int32_t sourceLen;
|
||||
const UChar *mySource;
|
||||
const UChar *mySourceEnd;
|
||||
char *myTarget;
|
||||
int32_t arraySize;
|
||||
|
||||
if(s == 0) return;
|
||||
|
||||
/* set up the conversion parameters */
|
||||
sourceLen = u_strlen(s);
|
||||
mySource = s;
|
||||
mySourceEnd = mySource + sourceLen;
|
||||
myTarget = buf;
|
||||
arraySize = BUF_SIZE;
|
||||
|
||||
/* open a default converter */
|
||||
converter = ucnv_open(0, status);
|
||||
|
||||
/* if we failed, clean up and exit */
|
||||
if(U_FAILURE(*status)) goto finish;
|
||||
|
||||
/* perform the conversion */
|
||||
do {
|
||||
/* reset the error code */
|
||||
*status = U_ZERO_ERROR;
|
||||
|
||||
/* perform the conversion */
|
||||
ucnv_fromUnicode(converter, &myTarget, myTarget + arraySize,
|
||||
&mySource, mySourceEnd, NULL,
|
||||
TRUE, status);
|
||||
|
||||
/* Write the converted data to the FILE* */
|
||||
fwrite(buf, sizeof(char), myTarget - buf, f);
|
||||
|
||||
/* update the conversion parameters*/
|
||||
myTarget = buf;
|
||||
arraySize = BUF_SIZE;
|
||||
}
|
||||
while(*status == U_BUFFER_OVERFLOW_ERROR);
|
||||
|
||||
finish:
|
||||
|
||||
/* close the converter */
|
||||
ucnv_close(converter);
|
||||
}
|
26
tools/multi/proj/chello/uprint.h
Normal file
26
tools/multi/proj/chello/uprint.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1998-2009, International Business Machines Corporation
|
||||
* and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
* File uprint.h
|
||||
*
|
||||
* Modification History:
|
||||
*
|
||||
* Date Name Description
|
||||
* 06/14/99 stephen Creation.
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef UPRINT_H
|
||||
#define UPRINT_H 1
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
/* Print a ustring to the specified FILE* in the default codepage */
|
||||
U_CFUNC void uprint(const UChar *s, FILE *f, UErrorCode *status);
|
||||
|
||||
#endif /* ! UPRINT_H */
|
31
tools/multi/readme.txt
Normal file
31
tools/multi/readme.txt
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/cat
|
||||
# Copyright (c) 2009 IBM Corp. and Others. All Rights Reserved
|
||||
#
|
||||
|
||||
This directory contains pieces of the 'MultiIcu' feature, which contains
|
||||
scripts for building multiple versions of ICU at the same time, and running
|
||||
various pieces of code against it.
|
||||
|
||||
Note, if you copy one of these projects outside the multi/ directory,
|
||||
you must ensure that the 'MULTIICU_ROOT' variable in build scripts points
|
||||
to the top level directory here, 'multi/'.
|
||||
|
||||
multi/ ( You are Here )
|
||||
multi/packages/ .tgz and .jar files for C and J respectively
|
||||
(see the readme in that directory)
|
||||
multi/c/ Scripts for building against ICU4C
|
||||
multi/c/patch/ Patches for building old ICU versions
|
||||
|
||||
multi/common/ Common makefiles
|
||||
|
||||
multi/j/ Scripts for building against ICU4J
|
||||
|
||||
multi/tmp/ Temporary directory, contains intermediate builds
|
||||
multi/tmp/src/ Unpacked and patched source
|
||||
multi/tmp/build/ Built ICUs
|
||||
multi/tmp/inst/ Installed ICUs
|
||||
|
||||
multi/proj/ Contains various projects which make use of multi-icu.
|
||||
(See individual readmes under each project.)
|
||||
multi/proj/chello/ C "hello world" against multiple ICUs
|
||||
multi/proj/jhello/ J "hello world" against multiple ICUs
|
Loading…
Reference in New Issue
Block a user