ICU-8972 machine-generated file with generator name rather than date (deterministic output)

X-SVN-Rev: 31140
This commit is contained in:
Markus Scherer 2011-12-17 04:58:41 +00:00
parent 318d676827
commit de830ac709
4 changed files with 40 additions and 11 deletions

View File

@ -4,7 +4,7 @@
*
* file name: uchar_props_data.h
*
* machine-generated on: 2011-12-05
* machine-generated by: icu/tools/src/unicode/c/genprops/corepropswriter.cpp
*/
#ifndef INCLUDED_FROM_UCHAR_C

View File

@ -103,6 +103,9 @@ public:
*/
LineType readLine(UErrorCode &errorCode);
/** Returns the number of the line read by readLine(). */
int32_t getLineNumber() const { return lineNumber; }
/** Returns the line's next field, or NULL. */
const char *nextField();

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2005-2010, International Business Machines
* Copyright (C) 2005-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -25,7 +25,8 @@
#include "writesrc.h"
static FILE *
usrc_createWithHeader(const char *path, const char *filename, const char *header) {
usrc_createWithHeader(const char *path, const char *filename,
const char *generator, const char *header) {
char buffer[1024];
const char *p;
char *q;
@ -54,8 +55,12 @@ usrc_createWithHeader(const char *path, const char *filename, const char *header
time(&t);
lt=localtime(&t);
strftime(year, sizeof(year), "%Y", lt);
if(generator==NULL) {
strftime(buffer, sizeof(buffer), "%Y-%m-%d", lt);
fprintf(f, header, year, filename, buffer);
} else {
fprintf(f, header, year, filename, generator);
}
} else {
fprintf(
stderr,
@ -76,7 +81,21 @@ usrc_create(const char *path, const char *filename) {
" *\n"
" * machine-generated on: %s\n"
" */\n\n";
return usrc_createWithHeader(path, filename, header);
return usrc_createWithHeader(path, filename, NULL, header);
}
U_CAPI FILE * U_EXPORT2
usrc_createFromGenerator(const char *path, const char *filename, const char *generator) {
const char *header=
"/*\n"
" * Copyright (C) 1999-%s, International Business Machines\n"
" * Corporation and others. All Rights Reserved.\n"
" *\n"
" * file name: %s\n"
" *\n"
" * machine-generated by: %s\n"
" */\n\n";
return usrc_createWithHeader(path, filename, generator, header);
}
U_CAPI FILE * U_EXPORT2
@ -89,7 +108,7 @@ usrc_createTextData(const char *path, const char *filename) {
"#\n"
"# machine-generated on: %s\n"
"#\n\n";
return usrc_createWithHeader(path, filename, header);
return usrc_createWithHeader(path, filename, NULL, header);
}
U_CAPI void U_EXPORT2

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2005-2010, International Business Machines
* Copyright (C) 2005-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -24,14 +24,21 @@
#include "utrie2.h"
/**
* Creates a source text file and write a header comment with the ICU copyright.
* Writes a C/Java-style comment.
* Creates a source text file and writes a header comment with the ICU copyright.
* Writes a C/Java-style comment with the generation date.
*/
U_CAPI FILE * U_EXPORT2
usrc_create(const char *path, const char *filename);
/**
* Creates a source text file and write a header comment with the ICU copyright.
* 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
usrc_createFromGenerator(const char *path, const char *filename, const char *generator);
/**
* Creates a source text file and writes a header comment with the ICU copyright.
* Writes the comment with # lines, as used in scripts and text data.
*/
U_CAPI FILE * U_EXPORT2