3 #*******************************************************************************
4 #* Copyright (C) 2004, International Business Machines
5 #* Corporation and others. All Rights Reserved.
6 #*******************************************************************************
8 #* file name: gendraft.pl
10 #* tab size: 8 (not used)
13 #* Created by: Ram Viswanadha
15 #* This tool filters the DraftAPI txt file generated by Doxygen and generates udarft.h
16 #* udeprctd.h and uobslete.h
28 $draftHeaderName = "udraft.h";
29 $draftAppend = "DRAFT_API_DO_NOT_USE";
30 $draftDefine = "U_HIDE_DRAFT_API";
32 $deprecatedHeaderName = "udeprctd.h";
33 $deprecatedAppend = "DEPRECATED_API_DO_NOT_USE";
34 $deprecatedDefine = "U_HIDE_DEPRECATED_API";
36 $obsoleteHeaderName = "uobslete.h";
37 $obsoleteAppend = "OBSOLETE_API_DO_NOT_USE";
38 $obsoleteDefine = "U_HIDE_OBSOLETE_API";
45 #---------------------------------------------------------------------
50 "--draft-file=s" => \
$draftFile,
51 "--deprecated-file=s" => \
$deprecatedFile,
52 "--obsolete-file=s" => \
$obsoleteFile,
53 "--destdir=s" => \
$destDir,
54 "--version=s" => \
$version,
56 usage
() unless defined $draftFile;
57 usage
() unless defined $deprecatedFile;
58 usage
() unless defined $obsoleteFile;
59 usage
() unless defined $destDir;
60 usage
() unless defined $version;
62 $versionAppend = $version;
63 $versionAppend=~ s/\./_/;
65 writeFile
($draftFile, $draftHeaderName, $destDir, $draftAppend, $draftDefine);
66 writeFile
($deprecatedFile, $deprecatedHeaderName, $destDir, $deprecatedAppend, $deprecatedDefine);
67 writeFile
($obsoleteFile, $obsoleteHeaderName, $destDir, $obsoleteAppend, $obsoleteDefine);
70 #-----------------------------------------------------------------------
73 $headerDef = uc($headerName); # this is building the constant for #define
74 $headerDef =~ s/\./_/;
78 #-----------------------------------------------------------------------
80 ($inFileName,$outFileName,$destDir, $symbolAppend, $symbolDef) = @_;
82 $outFN = $destDir."/".$outFileName;
84 $inFH = IO
::File-
>new($inFileName,"r")
85 or die "could not open the file $infile for reading: $! \n";
86 $outFH = IO
::File-
>new($outFN,"w")
87 or die "could not open the file $outfile for writing: $! \n";
89 $headerDef = getHeaderDef
($outFileName);
91 printHeader
($outFH, $outFileName, $headerDef, $symbolDef);
92 parseWriteFile
($inFH, $outFH, $symbolAppend);
93 printFooter
($outFH, $headerDef, $symbolDef);
98 #-----------------------------------------------------------------------
100 ($outFH, $headername, $HEADERDEF, $symbolDef) = @_;
101 #We will print our copyright here + warnings
102 print $outFH <<END_HEADER_COMMENT;
104 *******************************************************************************
105 * Copyright (C) 2004, International Business Machines
106 * Corporation and others. All Rights Reserved.
107 *******************************************************************************
109 * file name: $headername
111 * tab size: 8 (not used)
114 * Created by: gendraft.pl, a perl script written by Ram Viswanadha
116 * Contains data for commenting out APIs.
117 * Gets included by umachine.h
119 * THIS FILE IS MACHINE-GENERATED, DON'T PLAY WITH IT IF YOU DON'T KNOW WHAT
120 * YOU ARE DOING, OTHERWISE VERY BAD THINGS WILL HAPPEN!
131 #-----------------------------------------------------------------------
133 ($inFH, $outFH, $symbolAppend) = @_;
134 while (defined ($line = <$inFH>)){
135 ($a,$b,$c) = split( /\t/, $line);
136 #just process C APIs for now
138 $realSymbol = $b."_".$versionAppend;
139 $nonExSymbol = $b."_".$symbolAppend;
140 print $outFH "#define ".$realSymbol." ".$nonExSymbol."\n";
145 #-----------------------------------------------------------------------
148 ($outFH, $headerDef, $symbolDef ) = @_;
150 print $outFH <<END_FOOTER;
152 #endif /* $symbolDef */
153 #endif /* $headerDef */
157 #-----------------------------------------------------------------------
163 --draft-file
=<path
and name of output file of Doxygen containing draft API symbols
>
164 --deprecated-file
=<path
and name of output file of Doxygen containing deprecated API symbols
>
165 --obsolete-file
=<path
and name of output file of Doxygen containing obsolete API symbols
>
166 --destdir
=<directory
>
167 --version
=<current version of ICU
>
169 e
.g
.: gendraft
.pl
--draft-file
=c
:\blah\DraftAPI
.txt
--deprecated-file
=c
:\blah\DeprecatedAPI
.txt
--obsolete-file
=c
:\blah\ObsoleteFile
.txt
--destdir
=<icu
>/source/common
/unicode
--version
=2.8