diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sw/inc/poolfmt.awk | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/inc/poolfmt.awk')
-rw-r--r-- | sw/inc/poolfmt.awk | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/sw/inc/poolfmt.awk b/sw/inc/poolfmt.awk new file mode 100644 index 000000000..58f758c94 --- /dev/null +++ b/sw/inc/poolfmt.awk @@ -0,0 +1,75 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +# This awk-script generates a cxx-file, that dumps all PoolIDs of the template. +# It is needed for HelpPI. +# Usage: awk -f poolid.awk poolfmt.hxx > poolid.cxx +# cl poolid.cxx +# poolid.exe > ???.hrc +# + +function Header() { + print "// This is an outputfile of an awk-script: $Workfile: poolfmt.awk $" + print "#include <solar.h> " + print + print "#include <stdio.h>" + print "#include <stdlib.h>" + print + print "#pragma hdrstop" + print + print "#include <iostream.hxx> " + print "#include \"poolfmt.hxx\"" + print +} + +function Main() { + print + print "void main( int , char *[] ) {" + sStr = "#define" + print " int nSize = (sizeof(ppPoolIds) / sizeof(PoolFormatIds)) - 1;" + print " for( int n = 0; n < nSize; n++ )" + print " printf( \"" sStr " %s\\t%8d\\n\", ppPoolIds[ n ].pStr, ppPoolIds[ n ].nId );" + print "}" +} + +function TableHead() { + print + print "struct PoolFormatIds { int nId; const char* pStr; };" + print "static PoolFormatIds ppPoolIds[] = {" +} + +function TableTail() { + print " 0, \"\" };" + print +} + +BEGIN { + Header(); + TableHead(); +} + +/^[ \t]*RES_/ && !index( $1, "_BEGIN" ) && !index( $1, "_END" ) && !index( $1, "_POOL_" ) { + sStr = $1; + split( $1, sStr, "," ); + print " " sStr[1] ", \"" sStr[1] "\"," +} + +END { + TableTail(); + Main(); +} + |