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