xref: /aoo41x/main/sw/inc/poolfmt.awk (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28#
29# Dieses awk-script generiert ein cxx-file, das alle PoolIds der Vorlage dumpt.
30# wird fuer den HelpPI gebraucht.
31# Aufruf:  awk -f poolid.awk poolfmt.hxx > poolid.cxx
32#          cl poolid.cxx
33#          poolid.exe > ???.hrc
34#
35
36function Header() {
37    print "// This is an outputfile of an awk-script: $Workfile:   poolfmt.awk  $"
38    print "#include <solar.h> "
39    print
40    print  "#include <stdio.h>"
41    print  "#include <stdlib.h>"
42    print
43    print  "#pragma hdrstop"
44    print
45    print "#include <iostream.hxx> "
46    print "#include \"poolfmt.hxx\""
47    print
48}
49
50function Main() {
51	print
52    print  "void main( int , char *[] ) {"
53    sStr = "#define"
54    print  "    int nSize = (sizeof(ppPoolIds) / sizeof(PoolFmtIds)) - 1;"
55    print  "    for( int n = 0; n < nSize; n++ )"
56    print  "        printf( \"" sStr " %s\\t%8d\\n\", ppPoolIds[ n ].pStr, ppPoolIds[ n ].nId );"
57    print  "}"
58}
59
60function TableHead() {
61	print
62    print "struct PoolFmtIds { int nId; const char* pStr; };"
63    print "static PoolFmtIds ppPoolIds[] = {"
64}
65
66function TableTail() {
67    print  " 0, \"\" };"
68    print
69}
70
71BEGIN {
72    Header();
73    TableHead();
74}
75
76/^[ \t]*RES_/ && !index( $1, "_BEGIN" ) && !index( $1, "_END" ) && !index( $1, "_POOL_" ) {
77    sStr = $1;
78	split( $1, sStr, "," );
79    print  "    " sStr[1] ", \"" sStr[1] "\","
80}
81
82END {
83    TableTail();
84    Main();
85}
86
87