1 # from oox/source/token - should really put this into solenv
7 open ( TOKENS
, $ARGV0 ) || die "can't open token file: $!";
10 while ( defined ($line = <TOKENS
>) )
12 if( !($line =~ /^#/) )
15 @token = split(/\s+/,$line);
16 if ( not defined ($token[1]) )
18 $token[1] = "XML_".$token[0];
19 $token[1] =~ tr/\-\.\:/___/;
20 $token[1] =~ s/\+/PLUS/g;
21 $token[1] =~ s/\-/MINUS/g;
24 $tokens{$token[0]} = uc($token[1]);
29 open ( HXX
, ">$ARGV1" ) || die "can't open tokens.hxx file: $!";
30 open ( GPERF
, ">$ARGV2" ) || die "can't open tokens.gperf file: $!";
32 print ( GPERF
"%language=C++\n" );
33 print ( GPERF
"%global-table\n" );
34 print ( GPERF
"%null-strings\n" );
35 print ( GPERF
"%struct-type\n" );
36 print ( GPERF
"struct xmltoken\n" );
37 print ( GPERF
"{\n" );
38 print ( GPERF
" const sal_Char *name; sal_Int32 nToken; \n" );
39 print ( GPERF
"};\n" );
40 print ( GPERF
"%%\n" );
42 print ( HXX
"#ifndef INCLUDED_AUTOGEN_TOKEN_HXX\n" );
43 print ( HXX
"#define INCLUDED_AUTOGEN_TOKEN_HXX\n\n" );
44 print ( HXX
"#include <sal/types.h>\n\n" );
47 foreach( sort(keys(%tokens)) )
49 print( HXX
"const sal_Int32 $tokens{$_} = $i;\n" );
50 print( GPERF
"$_,$tokens{$_}\n" );
53 print ( GPERF
"%%\n" );
54 print ( HXX
"const sal_Int32 XML_TOKEN_COUNT = $i;\n" );
55 print ( HXX
"const sal_Int32 XML_TOKEN_INVALID = -1;\n\n" );
56 print ( HXX
"#endif\n" );