/*
*******************************************************************************
*
-* Copyright (C) 2000-2008, International Business Machines
+* Copyright (C) 2000-2012, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
#include "unicode/ucnv.h"
#include "genrb.h"
#include "rle.h"
-#include "ucol_tok.h"
#include "uhash.h"
#include "uresimp.h"
#include "unicode/ustring.h"
" return contents;\n"
" }\n\n"
" private static Object[][] contents = {\n";
-static const char* javaClassICU= " extends ListResourceBundle {\n\n"
+/*static const char* javaClassICU= " extends ListResourceBundle {\n\n"
" public %s () {\n"
" super.contents = data;\n"
" }\n"
- " static final Object[][] data = new Object[][] { \n";
+ " static final Object[][] data = new Object[][] { \n";*/
static int tabCount = 3;
static FileStream* out=NULL;
static struct SRBRoot* srBundle ;
-static const char* outDir = NULL;
+/*static const char* outDir = NULL;*/
static const char* bName=NULL;
static const char* pName=NULL;
add = columnCount-(tabCount*4)-5/* for ", +\n */;
current = buf +len;
if (add < (bufLen-len)) {
- uint32_t index = strrch(current,add,'\\');
- if (index > add) {
- index = add;
+ uint32_t idx = strrch(current,add,'\\');
+ if (idx > add) {
+ idx = add;
} else {
- int32_t num =index-1;
+ int32_t num =idx-1;
uint32_t seqLen;
while(num>0){
if(current[num]=='\\'){
break;
}
}
- if ((index-num)%2==0) {
- index--;
+ if ((idx-num)%2==0) {
+ idx--;
}
- seqLen = (current[index+1]=='u') ? 6 : 2;
- if ((add-index) < seqLen) {
- add = index + seqLen;
+ seqLen = (current[idx+1]=='u') ? 6 : 2;
+ if ((add-idx) < seqLen) {
+ add = idx + seqLen;
}
}
}
/* Writing Functions */
static void
string_write_java(struct SResource *res,UErrorCode *status) {
+ char resKeyBuffer[8];
+ const char *resname = res_getKeyString(srBundle, res, resKeyBuffer);
str_write_java(res->u.fString.fChars,res->u.fString.fLength,TRUE,status);
- if(res->fKey > 0 && uprv_strcmp(srBundle->fKeys+res->fKey,"Rule")==0)
+ if(resname != NULL && uprv_strcmp(resname,"Rule")==0)
{
UChar* buf = (UChar*) uprv_malloc(sizeof(UChar)*res->u.fString.fLength);
uprv_memcpy(buf,res->u.fString.fChars,res->u.fString.fLength);
uint32_t i = 0;
const char* arr ="new String[] { \n";
struct SResource *current = NULL;
- struct SResource *first =NULL;
- UBool decrementTabs = FALSE;
UBool allStrings = TRUE;
if (U_FAILURE(*status)) {
write_tabs(out);
T_FileStream_write(out, object, (int32_t)uprv_strlen(object));
tabCount++;
- decrementTabs = TRUE;
}else{
write_tabs(out);
T_FileStream_write(out, arr, (int32_t)uprv_strlen(arr));
tabCount++;
}
- first=current;
while (current != NULL) {
/*if(current->fType==URES_STRING){
write_tabs(out);
const char* intArr = "new int[] {\n";
/* const char* intC = "new Integer("; */
const char* stringArr = "new String[]{\n";
+ char resKeyBuffer[8];
+ const char *resname = res_getKeyString(srBundle, res, resKeyBuffer);
char buf[100];
int len =0;
buf[0]=0;
write_tabs(out);
- if(res->fKey > 0 && uprv_strcmp(srBundle->fKeys+res->fKey,"DateTimeElements")==0){
+ if(resname != NULL && uprv_strcmp(resname,"DateTimeElements")==0){
T_FileStream_write(out, stringArr, (int32_t)uprv_strlen(stringArr));
tabCount++;
for(i = 0; i<res->u.fIntVector.fCount; i++) {
static void
table_write_java(struct SResource *res, UErrorCode *status) {
uint32_t i = 0;
- UBool allStrings =TRUE;
struct SResource *current = NULL;
- struct SResource *save = NULL;
const char* obj = "new Object[][]{\n";
if (U_FAILURE(*status)) {
tabCount++;
}
start = FALSE;
- save = current = res->u.fTable.fFirst;
+ current = res->u.fTable.fFirst;
i = 0;
while (current != NULL) {
+ char currentKeyBuffer[8];
+ const char *currentKeyString = res_getKeyString(srBundle, current, currentKeyBuffer);
+
assert(i < res->u.fTable.fCount);
write_tabs(out);
tabCount++;
- allStrings=FALSE;
write_tabs(out);
- if(current->fKey > 0){
+ if(currentKeyString != NULL) {
T_FileStream_write(out, "\"", 1);
- T_FileStream_write(out, srBundle->fKeys+current->fKey,
- (int32_t)uprv_strlen(srBundle->fKeys+current->fKey));
+ T_FileStream_write(out, currentKeyString,
+ (int32_t)uprv_strlen(currentKeyString));
T_FileStream_write(out, "\",\n", 2);
T_FileStream_write(out, "\n", 1);
string_write_java (res, status);
return;
case URES_ALIAS:
- printf("Encountered unsupported resource type of alias\n", res->fType);
+ printf("Encountered unsupported resource type %d of alias\n", res->fType);
*status = U_UNSUPPORTED_ERROR;
return;
case URES_INT_VECTOR:
array_write_java (res, status);
return;
case URES_TABLE:
- case URES_TABLE32:
table_write_java (res, status);
return;
default:
char fileName[256] = {'\0'};
char className[256]={'\0'};
- char constructor[1000] = { 0 };
- UBool j1 =FALSE;
- outDir = outputDir;
+ /*char constructor[1000] = { 0 };*/
+ /*UBool j1 =FALSE;*/
+ /*outDir = outputDir;*/
start = TRUE; /* Reset the start indictor*/