]>
git.saurik.com Git - apple/icu.git/blob - icuSources/tools/toolutil/writesrc.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
6 * Copyright (C) 2005-2012, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 *******************************************************************************
10 * file name: writesrc.h
12 * tab size: 8 (not used)
15 * created on: 2005apr23
16 * created by: Markus W. Scherer
18 * Helper functions for writing source code for data.
21 #ifndef __WRITESRC_H__
22 #define __WRITESRC_H__
25 #include "unicode/utypes.h"
26 #include "unicode/ucptrie.h"
30 * Creates a source text file and writes a header comment with the ICU copyright.
31 * Writes a C/Java-style comment with the generator name.
33 U_CAPI
FILE * U_EXPORT2
34 usrc_create(const char *path
, const char *filename
, int32_t copyrightYear
, const char *generator
);
37 * Creates a source text file and writes a header comment with the ICU copyright.
38 * Writes the comment with # lines, as used in scripts and text data.
40 U_CAPI
FILE * U_EXPORT2
41 usrc_createTextData(const char *path
, const char *filename
, const char *generator
);
44 * Writes the contents of an array of 8/16/32-bit words.
45 * The prefix and postfix are optional (can be NULL) and are written first/last.
46 * The prefix may contain a %ld or similar field for the array length.
47 * The {} and declaration etc. need to be included in prefix/postfix or
48 * printed before and after the array contents.
51 usrc_writeArray(FILE *f
,
53 const void *p
, int32_t width
, int32_t length
,
57 * Calls usrc_writeArray() for the index and data arrays of a frozen UTrie2.
58 * Only the index array is written for a 16-bit UTrie2. In this case, dataPrefix
59 * is ignored and can be NULL.
62 usrc_writeUTrie2Arrays(FILE *f
,
63 const char *indexPrefix
, const char *dataPrefix
,
68 * Writes the UTrie2 struct values.
69 * The {} and declaration etc. need to be included in prefix/postfix or
70 * printed before and after the array contents.
73 usrc_writeUTrie2Struct(FILE *f
,
76 const char *indexName
, const char *dataName
,
80 * Calls usrc_writeArray() for the index and data arrays of a UCPTrie.
83 usrc_writeUCPTrieArrays(FILE *f
,
84 const char *indexPrefix
, const char *dataPrefix
,
89 * Writes the UCPTrie struct values.
90 * The {} and declaration etc. need to be included in prefix/postfix or
91 * printed before and after the array contents.
94 usrc_writeUCPTrieStruct(FILE *f
,
97 const char *indexName
, const char *dataName
,
101 * Writes the UCPTrie arrays and struct values.
103 U_CAPI
void U_EXPORT2
104 usrc_writeUCPTrie(FILE *f
, const char *name
, const UCPTrie
*pTrie
);
107 * Writes the contents of an array of mostly invariant characters.
108 * Characters 0..0x1f are printed as numbers,
109 * others as characters with single quotes: '%c'.
111 * The prefix and postfix are optional (can be NULL) and are written first/last.
112 * The prefix may contain a %ld or similar field for the array length.
113 * The {} and declaration etc. need to be included in prefix/postfix or
114 * printed before and after the array contents.
116 U_CAPI
void U_EXPORT2
117 usrc_writeArrayOfMostlyInvChars(FILE *f
,
119 const char *p
, int32_t length
,
120 const char *postfix
);