intl/icu/source/tools/toolutil/writesrc.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu/source/tools/toolutil/writesrc.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,92 @@
     1.4 +/*
     1.5 +*******************************************************************************
     1.6 +*
     1.7 +*   Copyright (C) 2005-2012, International Business Machines
     1.8 +*   Corporation and others.  All Rights Reserved.
     1.9 +*
    1.10 +*******************************************************************************
    1.11 +*   file name:  writesrc.h
    1.12 +*   encoding:   US-ASCII
    1.13 +*   tab size:   8 (not used)
    1.14 +*   indentation:4
    1.15 +*
    1.16 +*   created on: 2005apr23
    1.17 +*   created by: Markus W. Scherer
    1.18 +*
    1.19 +*   Helper functions for writing source code for data.
    1.20 +*/
    1.21 +
    1.22 +#ifndef __WRITESRC_H__
    1.23 +#define __WRITESRC_H__
    1.24 +
    1.25 +#include <stdio.h>
    1.26 +#include "unicode/utypes.h"
    1.27 +#include "utrie2.h"
    1.28 +
    1.29 +/**
    1.30 + * Creates a source text file and writes a header comment with the ICU copyright.
    1.31 + * Writes a C/Java-style comment with the generator name.
    1.32 + */
    1.33 +U_CAPI FILE * U_EXPORT2
    1.34 +usrc_create(const char *path, const char *filename, const char *generator);
    1.35 +
    1.36 +/**
    1.37 + * Creates a source text file and writes a header comment with the ICU copyright.
    1.38 + * Writes the comment with # lines, as used in scripts and text data.
    1.39 + */
    1.40 +U_CAPI FILE * U_EXPORT2
    1.41 +usrc_createTextData(const char *path, const char *filename, const char *generator);
    1.42 +
    1.43 +/**
    1.44 + * Writes the contents of an array of 8/16/32-bit words.
    1.45 + * The prefix and postfix are optional (can be NULL) and are written first/last.
    1.46 + * The prefix may contain a %ld or similar field for the array length.
    1.47 + * The {} and declaration etc. need to be included in prefix/postfix or
    1.48 + * printed before and after the array contents.
    1.49 + */
    1.50 +U_CAPI void U_EXPORT2
    1.51 +usrc_writeArray(FILE *f,
    1.52 +                const char *prefix,
    1.53 +                const void *p, int32_t width, int32_t length,
    1.54 +                const char *postfix);
    1.55 +
    1.56 +/**
    1.57 + * Calls usrc_writeArray() for the index and data arrays of a frozen UTrie2.
    1.58 + * Only the index array is written for a 16-bit UTrie2. In this case, dataPrefix
    1.59 + * is ignored and can be NULL.
    1.60 + */
    1.61 +U_CAPI void U_EXPORT2
    1.62 +usrc_writeUTrie2Arrays(FILE *f,
    1.63 +                       const char *indexPrefix, const char *dataPrefix,
    1.64 +                       const UTrie2 *pTrie,
    1.65 +                       const char *postfix);
    1.66 +
    1.67 +/**
    1.68 + * Writes the UTrie2 struct values.
    1.69 + * The {} and declaration etc. need to be included in prefix/postfix or
    1.70 + * printed before and after the array contents.
    1.71 + */
    1.72 +U_CAPI void U_EXPORT2
    1.73 +usrc_writeUTrie2Struct(FILE *f,
    1.74 +                       const char *prefix,
    1.75 +                       const UTrie2 *pTrie,
    1.76 +                       const char *indexName, const char *dataName,
    1.77 +                       const char *postfix);
    1.78 +
    1.79 +/**
    1.80 + * Writes the contents of an array of mostly invariant characters.
    1.81 + * Characters 0..0x1f are printed as numbers,
    1.82 + * others as characters with single quotes: '%c'.
    1.83 + *
    1.84 + * The prefix and postfix are optional (can be NULL) and are written first/last.
    1.85 + * The prefix may contain a %ld or similar field for the array length.
    1.86 + * The {} and declaration etc. need to be included in prefix/postfix or
    1.87 + * printed before and after the array contents.
    1.88 + */
    1.89 +U_CAPI void U_EXPORT2
    1.90 +usrc_writeArrayOfMostlyInvChars(FILE *f,
    1.91 +                                const char *prefix,
    1.92 +                                const char *p, int32_t length,
    1.93 +                                const char *postfix);
    1.94 +
    1.95 +#endif

mercurial