]>
Commit | Line | Data |
---|---|---|
73c04bcf A |
1 | /* |
2 | ******************************************************************************* | |
3 | * | |
4388f060 | 4 | * Copyright (C) 2005-2012, International Business Machines |
73c04bcf A |
5 | * Corporation and others. All Rights Reserved. |
6 | * | |
7 | ******************************************************************************* | |
8 | * file name: writesrc.h | |
9 | * encoding: US-ASCII | |
10 | * tab size: 8 (not used) | |
11 | * indentation:4 | |
12 | * | |
13 | * created on: 2005apr23 | |
14 | * created by: Markus W. Scherer | |
15 | * | |
16 | * Helper functions for writing source code for data. | |
17 | */ | |
18 | ||
19 | #ifndef __WRITESRC_H__ | |
20 | #define __WRITESRC_H__ | |
21 | ||
22 | #include <stdio.h> | |
23 | #include "unicode/utypes.h" | |
729e4ab9 | 24 | #include "utrie2.h" |
73c04bcf A |
25 | |
26 | /** | |
4388f060 A |
27 | * Creates a source text file and writes a header comment with the ICU copyright. |
28 | * Writes a C/Java-style comment with the generator name. | |
73c04bcf A |
29 | */ |
30 | U_CAPI FILE * U_EXPORT2 | |
4388f060 | 31 | usrc_create(const char *path, const char *filename, const char *generator); |
73c04bcf | 32 | |
729e4ab9 | 33 | /** |
4388f060 | 34 | * Creates a source text file and writes a header comment with the ICU copyright. |
729e4ab9 A |
35 | * Writes the comment with # lines, as used in scripts and text data. |
36 | */ | |
37 | U_CAPI FILE * U_EXPORT2 | |
4388f060 | 38 | usrc_createTextData(const char *path, const char *filename, const char *generator); |
729e4ab9 | 39 | |
73c04bcf | 40 | /** |
4388f060 | 41 | * Writes the contents of an array of 8/16/32-bit words. |
73c04bcf A |
42 | * The prefix and postfix are optional (can be NULL) and are written first/last. |
43 | * The prefix may contain a %ld or similar field for the array length. | |
44 | * The {} and declaration etc. need to be included in prefix/postfix or | |
45 | * printed before and after the array contents. | |
46 | */ | |
47 | U_CAPI void U_EXPORT2 | |
48 | usrc_writeArray(FILE *f, | |
49 | const char *prefix, | |
50 | const void *p, int32_t width, int32_t length, | |
51 | const char *postfix); | |
52 | ||
53 | /** | |
729e4ab9 A |
54 | * Calls usrc_writeArray() for the index and data arrays of a frozen UTrie2. |
55 | * Only the index array is written for a 16-bit UTrie2. In this case, dataPrefix | |
73c04bcf A |
56 | * is ignored and can be NULL. |
57 | */ | |
58 | U_CAPI void U_EXPORT2 | |
729e4ab9 A |
59 | usrc_writeUTrie2Arrays(FILE *f, |
60 | const char *indexPrefix, const char *dataPrefix, | |
61 | const UTrie2 *pTrie, | |
62 | const char *postfix); | |
73c04bcf A |
63 | |
64 | /** | |
729e4ab9 | 65 | * Writes the UTrie2 struct values. |
73c04bcf A |
66 | * The {} and declaration etc. need to be included in prefix/postfix or |
67 | * printed before and after the array contents. | |
73c04bcf A |
68 | */ |
69 | U_CAPI void U_EXPORT2 | |
729e4ab9 A |
70 | usrc_writeUTrie2Struct(FILE *f, |
71 | const char *prefix, | |
72 | const UTrie2 *pTrie, | |
73 | const char *indexName, const char *dataName, | |
74 | const char *postfix); | |
73c04bcf | 75 | |
4388f060 A |
76 | /** |
77 | * Writes the contents of an array of mostly invariant characters. | |
78 | * Characters 0..0x1f are printed as numbers, | |
79 | * others as characters with single quotes: '%c'. | |
80 | * | |
81 | * The prefix and postfix are optional (can be NULL) and are written first/last. | |
82 | * The prefix may contain a %ld or similar field for the array length. | |
83 | * The {} and declaration etc. need to be included in prefix/postfix or | |
84 | * printed before and after the array contents. | |
85 | */ | |
86 | U_CAPI void U_EXPORT2 | |
87 | usrc_writeArrayOfMostlyInvChars(FILE *f, | |
88 | const char *prefix, | |
89 | const char *p, int32_t length, | |
90 | const char *postfix); | |
91 | ||
73c04bcf | 92 | #endif |