]>
git.saurik.com Git - apple/icu.git/blob - icuSources/tools/genrb/reslist.h
2 *******************************************************************************
4 * Copyright (C) 2000-2014, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
11 * Modification History:
13 * Date Name Description
14 * 02/21/00 weiv Creation.
15 *******************************************************************************
21 #define KEY_SPACE_SIZE 65536
22 #define RESLIST_MAX_INT_VECTOR 2048
24 #include "unicode/utypes.h"
25 #include "unicode/ures.h"
26 #include "unicode/ustring.h"
35 typedef struct KeyMapEntry
{
36 int32_t oldpos
, newpos
;
39 /* Resource bundle root table */
41 struct SResource
*fRoot
;
44 int32_t fMaxTableLength
;
45 UBool noFallback
; /* see URES_ATT_NO_FALLBACK */
46 int8_t fStringsForm
; /* default STRINGS_UTF16_V1 */
51 int32_t fKeysBottom
, fKeysTop
;
52 int32_t fKeysCapacity
;
54 int32_t fLocalKeyLimit
; /* key offset < limit fits into URES_TABLE */
56 uint16_t *f16BitUnits
;
57 int32_t f16BitUnitsCapacity
;
58 int32_t f16BitUnitsLength
;
60 const char *fPoolBundleKeys
;
61 int32_t fPoolBundleKeysLength
;
62 int32_t fPoolBundleKeysCount
;
63 int32_t fPoolChecksum
;
66 struct SRBRoot
*bundle_open(const struct UString
* comment
, UBool isPoolBundle
, UErrorCode
*status
);
67 void bundle_write(struct SRBRoot
*bundle
, const char *outputDir
, const char *outputPkg
, char *writtenFilename
, int writtenFilenameLen
, UErrorCode
*status
);
69 /* write a java resource file */
70 void bundle_write_java(struct SRBRoot
*bundle
, const char *outputDir
, const char* outputEnc
, char *writtenFilename
,
71 int writtenFilenameLen
, const char* packageName
, const char* bundleName
, UErrorCode
*status
);
73 /* write a xml resource file */
74 /* commented by Jing*/
75 /* void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outputEnc,
76 char *writtenFilename, int writtenFilenameLen,UErrorCode *status); */
79 void bundle_write_xml(struct SRBRoot
*bundle
, const char *outputDir
,const char* outputEnc
, const char* rbname
,
80 char *writtenFilename
, int writtenFilenameLen
, const char* language
, const char* package
, UErrorCode
*status
);
82 void bundle_close(struct SRBRoot
*bundle
, UErrorCode
*status
);
83 void bundle_setlocale(struct SRBRoot
*bundle
, UChar
*locale
, UErrorCode
*status
);
84 int32_t bundle_addtag(struct SRBRoot
*bundle
, const char *tag
, UErrorCode
*status
);
87 bundle_getKeyBytes(struct SRBRoot
*bundle
, int32_t *pLength
);
90 bundle_addKeyBytes(struct SRBRoot
*bundle
, const char *keyBytes
, int32_t length
, UErrorCode
*status
);
93 bundle_compactKeys(struct SRBRoot
*bundle
, UErrorCode
*status
);
95 /* Various resource types */
98 * Return a unique pointer to a dummy object,
99 * for use in non-error cases when no resource is to be added to the bundle.
100 * (NULL is used in error cases.)
102 struct SResource
* res_none(void);
106 int8_t fType
; /* determined by table_write16() for table_preWrite() & table_write() */
107 struct SResource
*fFirst
;
108 struct SRBRoot
*fRoot
;
111 struct SResource
* table_open(struct SRBRoot
*bundle
, const char *tag
, const struct UString
* comment
, UErrorCode
*status
);
112 void table_add(struct SResource
*table
, struct SResource
*res
, int linenumber
, UErrorCode
*status
);
116 struct SResource
*fFirst
;
117 struct SResource
*fLast
;
120 struct SResource
* array_open(struct SRBRoot
*bundle
, const char *tag
, const struct UString
* comment
, UErrorCode
*status
);
121 void array_add(struct SResource
*array
, struct SResource
*res
, UErrorCode
*status
);
124 struct SResource
*fSame
; /* used for duplicates */
127 int32_t fSuffixOffset
; /* this string is a suffix of fSame at this offset */
128 int8_t fNumCharsForLength
;
131 struct SResource
*string_open(struct SRBRoot
*bundle
, const char *tag
, const UChar
*value
, int32_t len
, const struct UString
* comment
, UErrorCode
*status
);
133 struct SResource
*alias_open(struct SRBRoot
*bundle
, const char *tag
, UChar
*value
, int32_t len
, const struct UString
* comment
, UErrorCode
*status
);
135 struct SResIntVector
{
140 struct SResource
* intvector_open(struct SRBRoot
*bundle
, const char *tag
, const struct UString
* comment
, UErrorCode
*status
);
141 void intvector_add(struct SResource
*intvector
, int32_t value
, UErrorCode
*status
);
147 struct SResource
*int_open(struct SRBRoot
*bundle
, const char *tag
, int32_t value
, const struct UString
* comment
, UErrorCode
*status
);
152 char* fFileName
; /* file name for binary or import binary tags if any */
155 struct SResource
*bin_open(struct SRBRoot
*bundle
, const char *tag
, uint32_t length
, uint8_t *data
, const char* fileName
, const struct UString
* comment
, UErrorCode
*status
);
157 /* Resource place holder */
160 int8_t fType
; /* nominal type: fRes (when != 0xffffffff) may use subtype */
161 UBool fWritten
; /* res_write() can exit early */
162 uint32_t fRes
; /* resource item word; 0xffffffff if not known yet */
163 int32_t fKey
; /* Index into bundle->fKeys; -1 if no key. */
164 int line
; /* used internally to report duplicate keys in tables */
165 struct SResource
*fNext
; /*This is for internal chaining while building*/
166 struct UString fComment
;
168 struct SResTable fTable
;
169 struct SResArray fArray
;
170 struct SResString fString
;
171 struct SResIntVector fIntVector
;
172 struct SResInt fIntValue
;
173 struct SResBinary fBinaryValue
;
178 res_getKeyString(const struct SRBRoot
*bundle
, const struct SResource
*res
, char temp
[8]);
180 void res_close(struct SResource
*res
);
182 void setIncludeCopyright(UBool val
);
183 UBool
getIncludeCopyright(void);
185 void setFormatVersion(int32_t formatVersion
);
187 void setUsePoolBundle(UBool use
);
190 uint32_t computeCRC(char *ptr
, uint32_t len
, uint32_t lastcrc
);
193 #endif /* #ifndef RESLIST_H */