michael@0: /* michael@0: ******************************************************************************* michael@0: * michael@0: * Copyright (C) 2005-2012, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: * michael@0: ******************************************************************************* michael@0: * file name: writesrc.h michael@0: * encoding: US-ASCII michael@0: * tab size: 8 (not used) michael@0: * indentation:4 michael@0: * michael@0: * created on: 2005apr23 michael@0: * created by: Markus W. Scherer michael@0: * michael@0: * Helper functions for writing source code for data. michael@0: */ michael@0: michael@0: #ifndef __WRITESRC_H__ michael@0: #define __WRITESRC_H__ michael@0: michael@0: #include michael@0: #include "unicode/utypes.h" michael@0: #include "utrie2.h" michael@0: michael@0: /** michael@0: * Creates a source text file and writes a header comment with the ICU copyright. michael@0: * Writes a C/Java-style comment with the generator name. michael@0: */ michael@0: U_CAPI FILE * U_EXPORT2 michael@0: usrc_create(const char *path, const char *filename, const char *generator); michael@0: michael@0: /** michael@0: * Creates a source text file and writes a header comment with the ICU copyright. michael@0: * Writes the comment with # lines, as used in scripts and text data. michael@0: */ michael@0: U_CAPI FILE * U_EXPORT2 michael@0: usrc_createTextData(const char *path, const char *filename, const char *generator); michael@0: michael@0: /** michael@0: * Writes the contents of an array of 8/16/32-bit words. michael@0: * The prefix and postfix are optional (can be NULL) and are written first/last. michael@0: * The prefix may contain a %ld or similar field for the array length. michael@0: * The {} and declaration etc. need to be included in prefix/postfix or michael@0: * printed before and after the array contents. michael@0: */ michael@0: U_CAPI void U_EXPORT2 michael@0: usrc_writeArray(FILE *f, michael@0: const char *prefix, michael@0: const void *p, int32_t width, int32_t length, michael@0: const char *postfix); michael@0: michael@0: /** michael@0: * Calls usrc_writeArray() for the index and data arrays of a frozen UTrie2. michael@0: * Only the index array is written for a 16-bit UTrie2. In this case, dataPrefix michael@0: * is ignored and can be NULL. michael@0: */ michael@0: U_CAPI void U_EXPORT2 michael@0: usrc_writeUTrie2Arrays(FILE *f, michael@0: const char *indexPrefix, const char *dataPrefix, michael@0: const UTrie2 *pTrie, michael@0: const char *postfix); michael@0: michael@0: /** michael@0: * Writes the UTrie2 struct values. michael@0: * The {} and declaration etc. need to be included in prefix/postfix or michael@0: * printed before and after the array contents. michael@0: */ michael@0: U_CAPI void U_EXPORT2 michael@0: usrc_writeUTrie2Struct(FILE *f, michael@0: const char *prefix, michael@0: const UTrie2 *pTrie, michael@0: const char *indexName, const char *dataName, michael@0: const char *postfix); michael@0: michael@0: /** michael@0: * Writes the contents of an array of mostly invariant characters. michael@0: * Characters 0..0x1f are printed as numbers, michael@0: * others as characters with single quotes: '%c'. michael@0: * michael@0: * The prefix and postfix are optional (can be NULL) and are written first/last. michael@0: * The prefix may contain a %ld or similar field for the array length. michael@0: * The {} and declaration etc. need to be included in prefix/postfix or michael@0: * printed before and after the array contents. michael@0: */ michael@0: U_CAPI void U_EXPORT2 michael@0: usrc_writeArrayOfMostlyInvChars(FILE *f, michael@0: const char *prefix, michael@0: const char *p, int32_t length, michael@0: const char *postfix); michael@0: michael@0: #endif