1 # This file is part of the LibreOffice project.
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # This file incorporates work covered by the following license notice:
9 # Licensed to the Apache Software Foundation (ASF) under one or more
10 # contributor license agreements. See the NOTICE file distributed
11 # with this work for additional information regarding copyright
12 # ownership. The ASF licenses this file to you under the Apache
13 # License, Version 2.0 (the "License"); you may not use this file
14 # except in compliance with the License. You may obtain a copy of
15 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 infile_name
= sys
.argv
[1]
21 id_out_name
= sys
.argv
[2]
22 name_out_name
= sys
.argv
[3]
27 with
open(infile_name
) as infile
:
30 # check for valid characters
31 if not re
.match(r
'[A-Z][a-zA-Z0-9]*$', line
):
32 sys
.exit("Error: invalid character in property '{}'".format(line
))
33 props
[line
] = "PROP_" + line
35 # generate output files
37 idfile
= open(id_out_name
, 'w')
38 namefile
= open(name_out_name
, 'w')
41 for token
in sorted(props
.keys()):
42 idfile
.write("const sal_Int32 {} = {};\n".format(props
[token
], i
))
43 namefile
.write("/* {} */ \"{}\",\n".format(i
, token
))
46 idfile
.write("const sal_Int32 PROP_COUNT = {};\n".format(i
))
47 idfile
.write("const sal_Int32 PROP_INVALID = -1;\n" )