]>
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"
29 * Creates a source text file and writes a header comment with the ICU copyright.
30 * Writes a C/Java-style comment with the generator name.
32 U_CAPI
FILE * U_EXPORT2
33 usrc_create(const char *path
, const char *filename
, const char *generator
);
36 * Creates a source text file and writes a header comment with the ICU copyright.
37 * Writes the comment with # lines, as used in scripts and text data.
39 U_CAPI
FILE * U_EXPORT2
40 usrc_createTextData(const char *path
, const char *filename
, const char *generator
);
43 * Writes the contents of an array of 8/16/32-bit words.
44 * The prefix and postfix are optional (can be NULL) and are written first/last.
45 * The prefix may contain a %ld or similar field for the array length.
46 * The {} and declaration etc. need to be included in prefix/postfix or
47 * printed before and after the array contents.
50 usrc_writeArray(FILE *f
,
52 const void *p
, int32_t width
, int32_t length
,
56 * Calls usrc_writeArray() for the index and data arrays of a frozen UTrie2.
57 * Only the index array is written for a 16-bit UTrie2. In this case, dataPrefix
58 * is ignored and can be NULL.
61 usrc_writeUTrie2Arrays(FILE *f
,
62 const char *indexPrefix
, const char *dataPrefix
,
67 * Writes the UTrie2 struct values.
68 * The {} and declaration etc. need to be included in prefix/postfix or
69 * printed before and after the array contents.
72 usrc_writeUTrie2Struct(FILE *f
,
75 const char *indexName
, const char *dataName
,
79 * Writes the contents of an array of mostly invariant characters.
80 * Characters 0..0x1f are printed as numbers,
81 * others as characters with single quotes: '%c'.
83 * The prefix and postfix are optional (can be NULL) and are written first/last.
84 * The prefix may contain a %ld or similar field for the array length.
85 * The {} and declaration etc. need to be included in prefix/postfix or
86 * printed before and after the array contents.
89 usrc_writeArrayOfMostlyInvChars(FILE *f
,
91 const char *p
, int32_t length
,