]> git.saurik.com Git - apple/icu.git/blame - icuSources/tools/toolutil/writesrc.h
ICU-8.11.tar.gz
[apple/icu.git] / icuSources / tools / toolutil / writesrc.h
CommitLineData
73c04bcf
A
1/*
2*******************************************************************************
3*
4* Copyright (C) 2005, International Business Machines
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"
24#include "utrie.h"
25
26/**
27 * Create a source text file and write a header comment with the ICU copyright.
28 */
29U_CAPI FILE * U_EXPORT2
30usrc_create(const char *path, const char *filename);
31
32/**
33 * Write the contents of an array of 8/16/32-bit words.
34 * The prefix and postfix are optional (can be NULL) and are written first/last.
35 * The prefix may contain a %ld or similar field for the array length.
36 * The {} and declaration etc. need to be included in prefix/postfix or
37 * printed before and after the array contents.
38 */
39U_CAPI void U_EXPORT2
40usrc_writeArray(FILE *f,
41 const char *prefix,
42 const void *p, int32_t width, int32_t length,
43 const char *postfix);
44
45/**
46 * Calls usrc_writeArray() for the index and data arrays of a runtime UTrie.
47 * Only the index array is written for a 16-bit UTrie. In this case, dataPrefix
48 * is ignored and can be NULL.
49 */
50U_CAPI void U_EXPORT2
51usrc_writeUTrieArrays(FILE *f,
52 const char *indexPrefix, const char *dataPrefix,
53 const UTrie *pTrie,
54 const char *postfix);
55
56/**
57 * Writes the UTrie struct values.
58 * The {} and declaration etc. need to be included in prefix/postfix or
59 * printed before and after the array contents.
60 * If getFoldingOffsetName==NULL then "utrie_defaultGetFoldingOffset" is printed.
61 */
62U_CAPI void U_EXPORT2
63usrc_writeUTrieStruct(FILE *f,
64 const char *prefix,
65 const UTrie *pTrie,
66 const char *indexName, const char *dataName,
67 const char *getFoldingOffsetName,
68 const char *postfix);
69
70#endif