1 /* 2 ******************************************************************************* 3 * 4 * Copyright (C) 2005-2008, 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 "utrie2.h" 25 26 /** 27 * Create a source text file and write a header comment with the ICU copyright. 28 */ 29 U_CAPI FILE * U_EXPORT2 30 usrc_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 */ 39 U_CAPI void U_EXPORT2 40 usrc_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 frozen UTrie2. 47 * Only the index array is written for a 16-bit UTrie2. In this case, dataPrefix 48 * is ignored and can be NULL. 49 */ 50 U_CAPI void U_EXPORT2 51 usrc_writeUTrie2Arrays(FILE *f, 52 const char *indexPrefix, const char *dataPrefix, 53 const UTrie2 *pTrie, 54 const char *postfix); 55 56 /** 57 * Writes the UTrie2 struct values. 58 * The {} and declaration etc. need to be included in prefix/postfix or 59 * printed before and after the array contents. 60 */ 61 U_CAPI void U_EXPORT2 62 usrc_writeUTrie2Struct(FILE *f, 63 const char *prefix, 64 const UTrie2 *pTrie, 65 const char *indexName, const char *dataName, 66 const char *postfix); 67 68 #endif 69