Branch libreoffice-5-0-4
[LibreOffice.git] / sw / inc / poolfmt.awk
blob58f758c9464095f3d882674a3286519224f3f6b6
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 # This awk-script generates a cxx-file, that dumps all PoolIDs of the template.
19 # It is needed for HelpPI.
20 # Usage: awk -f poolid.awk poolfmt.hxx > poolid.cxx
21 # cl poolid.cxx
22 # poolid.exe > ???.hrc
25 function Header() {
26 print "// This is an outputfile of an awk-script: $Workfile: poolfmt.awk $"
27 print "#include <solar.h> "
28 print
29 print "#include <stdio.h>"
30 print "#include <stdlib.h>"
31 print
32 print "#pragma hdrstop"
33 print
34 print "#include <iostream.hxx> "
35 print "#include \"poolfmt.hxx\""
36 print
39 function Main() {
40 print
41 print "void main( int , char *[] ) {"
42 sStr = "#define"
43 print " int nSize = (sizeof(ppPoolIds) / sizeof(PoolFormatIds)) - 1;"
44 print " for( int n = 0; n < nSize; n++ )"
45 print " printf( \"" sStr " %s\\t%8d\\n\", ppPoolIds[ n ].pStr, ppPoolIds[ n ].nId );"
46 print "}"
49 function TableHead() {
50 print
51 print "struct PoolFormatIds { int nId; const char* pStr; };"
52 print "static PoolFormatIds ppPoolIds[] = {"
55 function TableTail() {
56 print " 0, \"\" };"
57 print
60 BEGIN {
61 Header();
62 TableHead();
65 /^[ \t]*RES_/ && !index( $1, "_BEGIN" ) && !index( $1, "_END" ) && !index( $1, "_POOL_" ) {
66 sStr = $1;
67 split( $1, sStr, "," );
68 print " " sStr[1] ", \"" sStr[1] "\","
71 END {
72 TableTail();
73 Main();