1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /**************************************************************************
5 * Copyright (C) 2000-2012, International Business Machines
6 * Corporation and others. All Rights Reserved.
8 ***************************************************************************
10 * encoding: ANSI X3.4 (1968)
11 * tab size: 8 (not used)
14 * created on: 2000may16
15 * created by: Steven \u24C7 Loomis
17 * common types for pkgdata
24 #include "unicode/utypes.h"
30 typedef struct _CharList
33 struct _CharList *next;
39 * write CharList 'l' into stream 's' using deliminter 'delim' (delim can be NULL). quoted: -1 remove, 0 as is, 1 add quotes
41 const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quoted);
44 * Same, but use line breaks. quoted: -1 remove, 0 as is, 1 add quotes
46 const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim, const char *brk, int32_t quoted);
50 * Count items . 0 if null
52 uint32_t pkg_countCharList(CharList *l);
55 * Prepend string to CharList. Str is adopted!
57 CharList *pkg_prependToList(CharList *l, const char *str);
60 * append string to CharList. *end or even end can be null if you don't
64 CharList *pkg_appendToList(CharList *l, CharList** end, const char *str);
67 * strAlias is an alias to a full or relative path to a FILE. This function
68 * will search strAlias for the directory name (with strrchr). Then, it will
69 * determine if that directory is already in list l. If not, it will add it
70 * with strdup(strAlias).
71 * @param l list to append to , or NULL
72 * @param end end pointer-to-pointer. Can point to null, or be null.
73 * @param strAlias alias to full path string
76 CharList *pkg_appendUniqueDirToList(CharList *l, CharList** end, const char *strAlias);
79 * does list contain string? Returns: t/f
81 UBool pkg_listContains(CharList *l, const char *str);
86 void pkg_deleteList(CharList *l);
89 * Mode package function
92 typedef void (UPKGMODE)(struct UPKGOptions_ *, FileStream *s, UErrorCode *status);
95 * Static mode - write the readme file
96 * @param opt UPKGOptions
97 * @param libName Name of the .lib, etc file
98 * @param status ICU error code
100 void pkg_sttc_writeReadme(struct UPKGOptions_ *opt, const char *libName, UErrorCode *status);
103 * Options to be passed throughout the program
106 typedef struct UPKGOptions_
108 CharList *fileListFiles; /* list of files containing files for inclusion in the package */
109 CharList *filePaths; /* All the files, with long paths */
110 CharList *files; /* All the files */
111 CharList *outFiles; /* output files [full paths] */
113 const char *shortName; /* name of what we're building */
114 const char *cShortName; /* name of what we're building as a C identifier */
115 const char *entryName; /* special entrypoint name */
116 const char *targetDir; /* dir for packaged data to go */
117 const char *dataDir; /* parent of dir for package (default: tmpdir) */
120 const char *options; /* Options arg */
121 const char *mode; /* Mode of building */
122 const char *version; /* Library version */
123 const char *comment; /* comment string */
124 const char *install; /* Where to install to (NULL = don't install) */
125 const char *icuroot; /* where does ICU lives */
126 const char *libName; /* name for library (default: shortName) */
130 UBool withoutAssembly;
131 UBool pdsbuild; /* for building PDS in z/OS */
134 char * convertToNativePathSeparators(char *path);
137 /* set up common defines for library naming */
139 #if U_PLATFORM_HAS_WIN32_API
140 # ifndef UDATA_SO_SUFFIX
141 # define UDATA_SO_SUFFIX ".dll"
143 # define LIB_PREFIX ""
144 # define LIB_STATIC_PREFIX ""
145 # define OBJ_SUFFIX ".obj"
146 # define UDATA_LIB_SUFFIX ".lib"
148 #elif U_PLATFORM == U_PF_CYGWIN
149 # define LIB_PREFIX "cyg"
150 # define LIB_STATIC_PREFIX "lib"
151 # define OBJ_SUFFIX ".o"
152 # define UDATA_LIB_SUFFIX ".a"
155 # define LIB_PREFIX "lib"
156 # define LIB_STATIC_PREFIX "lib"
157 # define OBJ_SUFFIX ".o"
158 # define UDATA_LIB_SUFFIX ".a"
161 #define ASM_SUFFIX ".s"
163 /* defines for common file names */
164 #define UDATA_CMN_PREFIX ""
165 #define UDATA_CMN_SUFFIX ".dat"
166 #define UDATA_CMN_INTERMEDIATE_SUFFIX "_dat"
168 #define ICUDATA_RES_FILE "icudata.res"
170 #define PKGDATA_DERIVED_PATH '\t'