xref: /aoo42x/main/oox/source/token/properties.pl (revision b63233d8)
17e90fac2SAndrew Rist#**************************************************************
27e90fac2SAndrew Rist#
37e90fac2SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
47e90fac2SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
57e90fac2SAndrew Rist#  distributed with this work for additional information
67e90fac2SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
77e90fac2SAndrew Rist#  to you under the Apache License, Version 2.0 (the
87e90fac2SAndrew Rist#  "License"); you may not use this file except in compliance
97e90fac2SAndrew Rist#  with the License.  You may obtain a copy of the License at
107e90fac2SAndrew Rist#
117e90fac2SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
127e90fac2SAndrew Rist#
137e90fac2SAndrew Rist#  Unless required by applicable law or agreed to in writing,
147e90fac2SAndrew Rist#  software distributed under the License is distributed on an
157e90fac2SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
167e90fac2SAndrew Rist#  KIND, either express or implied.  See the License for the
177e90fac2SAndrew Rist#  specific language governing permissions and limitations
187e90fac2SAndrew Rist#  under the License.
197e90fac2SAndrew Rist#
207e90fac2SAndrew Rist#**************************************************************
217e90fac2SAndrew Rist
227e90fac2SAndrew Rist
23cdf0e10cSrcweir
24*b63233d8Sdamjan# operation mode (1 = identifiers, 2 = names)
25*b63233d8Sdamjan$op = shift @ARGV;
26*b63233d8Sdamjandie "Error: invalid operation" unless( $op >= 1 && $op <= 2);
27cdf0e10cSrcweir
28*b63233d8Sdamjan$i = 0;
29*b63233d8Sdamjanwhile( <> ) {
30cdf0e10cSrcweir    # trim newline
31cdf0e10cSrcweir    chomp( $_ );
32cdf0e10cSrcweir    # trim leading/trailing whitespace
33cdf0e10cSrcweir    $_ =~ s/^\s*//g;
34cdf0e10cSrcweir    $_ =~ s/\s*$//g;
35*b63233d8Sdamjan    # skip empty lines
36*b63233d8Sdamjan    if( $_ ) {
37*b63233d8Sdamjan        # check for valid characters
38*b63233d8Sdamjan        $_ =~ /^[A-Z][a-zA-Z0-9]+$/ or die "Error: invalid entry: '$_'";
39*b63233d8Sdamjan        # generate output
40*b63233d8Sdamjan        if( $op == 1 ) {
41*b63233d8Sdamjan            print( "const sal_Int32 PROP_$_ = $i;\n" );
42*b63233d8Sdamjan        } elsif( $op == 2 ) {
43*b63233d8Sdamjan            print( "/* $i */ \"$_\",\n" );
44*b63233d8Sdamjan        }
45*b63233d8Sdamjan        ++$i;
46*b63233d8Sdamjan    }
47cdf0e10cSrcweir}
48cdf0e10cSrcweir
49*b63233d8Sdamjanif( $op == 1 ) {
50*b63233d8Sdamjan    print( "const sal_Int32 PROP_COUNT = $i;\nconst sal_Int32 PROP_INVALID = -1;\n" );
51*b63233d8Sdamjan} elsif( $op == 2 ) {
52*b63233d8Sdamjan    print( "    \"\"\n" );
53cdf0e10cSrcweir}
54