Kaydet (Commit) 68ef83db authored tarafından Bjoern Michaelsen's avatar Bjoern Michaelsen

fix buildbreakers in oox, revert token changes for now

üst b7882741
...@@ -36,7 +36,6 @@ $(eval $(call gb_Library_set_include,oox,\ ...@@ -36,7 +36,6 @@ $(eval $(call gb_Library_set_include,oox,\
-I$(OUTDIR)/inc \ -I$(OUTDIR)/inc \
-I$(OUTDIR)/inc/offuh \ -I$(OUTDIR)/inc/offuh \
-I$(realpath $(SRCDIR)/oox/inc) \ -I$(realpath $(SRCDIR)/oox/inc) \
$(if $(filter YES,$(SYSTEM_OPENSSL)),$(filter -I%,$(OPENSSL_CFLAGS))) \
)) ))
$(eval $(call gb_Library_add_defs,oox,\ $(eval $(call gb_Library_add_defs,oox,\
...@@ -62,11 +61,7 @@ $(eval $(call gb_Library_add_linked_libs,oox,\ ...@@ -62,11 +61,7 @@ $(eval $(call gb_Library_add_linked_libs,oox,\
$(gb_STDLIBS) \ $(gb_STDLIBS) \
)) ))
$(call gb_Library_use_external,oox,openssl) $(eval $(call gb_Library_use_external,oox,openssl))
$(eval $(call gb_Library_add_ldflags,oox,\
$(if $(filter YES,$(SYSTEM_OPENSSL)),$(OPENSSL_LIBS)) \
))
$(eval $(call gb_Library_set_componentfile,oox,oox/util/oox)) $(eval $(call gb_Library_set_componentfile,oox,oox/util/oox))
......
oox oox : cppu cppuhelper comphelper filter sal offapi sax basegfx svx xmlscript tools vcl unotools BOOST:boost OPENSSL:openssl LIBXSLT:libxslt NULL oox oox : cppu cppuhelper comphelper filter sal offapi sax basegfx svx xmlscript tools vcl unotools BOOST:boost OPENSSL:openssl LIBXSLT:libxslt NULL
oox oox usr1 - all oox_mkout NULL
oox oox\prj nmake - all oox_prj NULL oox oox\prj nmake - all oox_prj NULL
..\source\token\tokens.txt %_DEST%\inc\oox\token\tokens.txt
\ No newline at end of file
...@@ -37,7 +37,7 @@ NamespaceMap::NamespaceMap() ...@@ -37,7 +37,7 @@ NamespaceMap::NamespaceMap()
static const struct NamespaceUrl { sal_Int32 mnId; const sal_Char* mpcUrl; } spNamespaceUrls[] = static const struct NamespaceUrl { sal_Int32 mnId; const sal_Char* mpcUrl; } spNamespaceUrls[] =
{ {
// include auto-generated C array with namespace URLs as C strings // include auto-generated C array with namespace URLs as C strings
#include <token/namespacenames.inc> #include "namespacenames.inc"
{ -1, "" } { -1, "" }
}; };
......
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
$ARGV0 = shift @ARGV;
$ARGV1 = shift @ARGV;
$ARGV2 = shift @ARGV;
$ARGV3 = shift @ARGV;
# parse input file
open( INFILE, $ARGV0 ) or die "cannot open input file: $!";
my %namespaces;
while( <INFILE> )
{
# trim newline
chomp( $_ );
# trim leading/trailing whitespace
$_ =~ s/^\s*//g;
$_ =~ s/\s*$//g;
# trim comments
$_ =~ s/^#.*//;
# skip empty lines
if( $_ )
{
# check for valid characters
$_ =~ /^([a-zA-Z]+)\s+([a-zA-Z0-9-.:\/]+)\s*$/ or die "Error: invalid character in input data";
$namespaces{$1} = $2;
}
}
close( INFILE );
# generate output files
open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!";
open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!";
open( TXTFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!";
# number of bits to shift the namespace identifier
$shift = 16;
print ( IDFILE "const size_t NMSP_SHIFT = $shift;\n" );
$i = 1;
foreach( keys( %namespaces ) )
{
print( IDFILE "const sal_Int32 NMSP_$_ = $i << NMSP_SHIFT;\n" );
$id = $i << $shift;
print( NAMEFILE "{ $id, \"$namespaces{$_}\" },\n" );
print( TXTFILE "$id $_ $namespaces{$_}\n" );
++$i;
}
close( IDFILE );
close( nameFILE );
close( TXTFILE );
...@@ -25,33 +25,43 @@ ...@@ -25,33 +25,43 @@
# #
#************************************************************************* #*************************************************************************
# operation mode (1 = identifiers, 2 = names) $ARGV0 = shift @ARGV;
$op = shift @ARGV; $ARGV1 = shift @ARGV;
die "Error: invalid operation" unless( $op >= 1 && $op <= 2); $ARGV2 = shift @ARGV;
$i = 0; # parse input file
while( <> ) {
open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!";
my %props;
while( <INFILE> )
{
# trim newline # trim newline
chomp( $_ ); chomp( $_ );
# trim leading/trailing whitespace # trim leading/trailing whitespace
$_ =~ s/^\s*//g; $_ =~ s/^\s*//g;
$_ =~ s/\s*$//g; $_ =~ s/\s*$//g;
# skip empty lines
if( $_ ) {
# check for valid characters # check for valid characters
$_ =~ /^[A-Z][a-zA-Z0-9]+$/ or die "Error: invalid entry: '$_'"; $_ =~ /^[A-Z][a-zA-Z0-9]*$/ or die "Error: invalid character in property '$_'";
# generate output $id = "PROP_$_";
if( $op == 1 ) { $props{$_} = $id;
print( "const sal_Int32 PROP_$_ = $i;\n" );
} elsif( $op == 2 ) {
print( "/* $i */ \"$_\",\n" );
}
++$i;
}
} }
close( INFILE );
# generate output files
open( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!";
open( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!";
if( $op == 1 ) { $i = 0;
print( "const sal_Int32 PROP_COUNT = $i;\nconst sal_Int32 PROP_INVALID = -1;\n" ); foreach( sort( keys( %props ) ) )
} elsif( $op == 2 ) { {
print( " \"\"\n" ); print( IDFILE "const sal_Int32 $props{$_} = $i;\n" );
print( NAMEFILE "/* $i */ \"$_\",\n" );
++$i;
} }
print( IDFILE "const sal_Int32 PROP_COUNT = $i;\n" );
print( IDFILE "const sal_Int32 PROP_INVALID = -1;\n" );
close( IDFILE );
close( NAMEFILE );
...@@ -37,7 +37,8 @@ PropertyNameVector::PropertyNameVector() ...@@ -37,7 +37,8 @@ PropertyNameVector::PropertyNameVector()
static const sal_Char* sppcPropertyNames[] = static const sal_Char* sppcPropertyNames[] =
{ {
// include auto-generated C array with property names as C strings // include auto-generated C array with property names as C strings
#include <token/propertynames.inc> #include "propertynames.inc"
""
}; };
size_t nArraySize = (sizeof( sppcPropertyNames ) / sizeof( *sppcPropertyNames )) - 1; size_t nArraySize = (sizeof( sppcPropertyNames ) / sizeof( *sppcPropertyNames )) - 1;
......
...@@ -43,10 +43,8 @@ using ::rtl::OUString; ...@@ -43,10 +43,8 @@ using ::rtl::OUString;
// ============================================================================ // ============================================================================
namespace { namespace {
// include auto-generated Perfect_Hash
// include auto-generated Perfect_Hash class #include "tokenhash.inc"
#include <token/tokenhash.inc>
} // namespace } // namespace
// ============================================================================ // ============================================================================
...@@ -57,7 +55,7 @@ TokenMap::TokenMap() : ...@@ -57,7 +55,7 @@ TokenMap::TokenMap() :
static const sal_Char* sppcTokenNames[] = static const sal_Char* sppcTokenNames[] =
{ {
// include auto-generated C array with token names as C strings // include auto-generated C array with token names as C strings
#include <token/tokennames.inc> #include "tokennames.inc"
"" ""
}; };
...@@ -70,14 +68,14 @@ TokenMap::TokenMap() : ...@@ -70,14 +68,14 @@ TokenMap::TokenMap() :
} }
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
// check that the Perfect_Hash is in sync with the token name list // check that the perfect_hash is in sync with the token name list
bool bOk = true; bool bOk = true;
for( sal_Int32 nToken = 0; bOk && (nToken < XML_TOKEN_COUNT); ++nToken ) for( sal_Int32 nToken = 0; bOk && (nToken < XML_TOKEN_COUNT); ++nToken )
{ {
// check that the getIdentifier <-> getToken roundtrip works // check that the getIdentifier <-> getToken roundtrip works
OString aUtf8Name = OUStringToOString( maTokenNames[ nToken ].maUniName, RTL_TEXTENCODING_UTF8 ); OString aUtf8Name = OUStringToOString( maTokenNames[ nToken ].maUniName, RTL_TEXTENCODING_UTF8 );
const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( aUtf8Name.getStr(), aUtf8Name.getLength() ); struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() );
bOk = pTokenInfo && (pTokenInfo->mnToken == nToken); bOk = pToken && (pToken->nToken == nToken);
OSL_ENSURE( bOk, ::rtl::OStringBuffer( "TokenMap::TokenMap - token list broken, #" ). OSL_ENSURE( bOk, ::rtl::OStringBuffer( "TokenMap::TokenMap - token list broken, #" ).
append( nToken ).append( ", '" ).append( aUtf8Name ).append( '\'' ).getStr() ); append( nToken ).append( ", '" ).append( aUtf8Name ).append( '\'' ).getStr() );
} }
...@@ -98,8 +96,8 @@ OUString TokenMap::getUnicodeTokenName( sal_Int32 nToken ) const ...@@ -98,8 +96,8 @@ OUString TokenMap::getUnicodeTokenName( sal_Int32 nToken ) const
sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const sal_Int32 TokenMap::getTokenFromUnicode( const OUString& rUnicodeName ) const
{ {
OString aUtf8Name = OUStringToOString( rUnicodeName, RTL_TEXTENCODING_UTF8 ); OString aUtf8Name = OUStringToOString( rUnicodeName, RTL_TEXTENCODING_UTF8 );
const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( aUtf8Name.getStr(), aUtf8Name.getLength() ); struct xmltoken* pToken = Perfect_Hash::in_word_set( aUtf8Name.getStr(), aUtf8Name.getLength() );
return pTokenInfo ? pTokenInfo->mnToken : XML_TOKEN_INVALID; return pToken ? pToken->nToken : XML_TOKEN_INVALID;
} }
Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const
...@@ -111,9 +109,9 @@ Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const ...@@ -111,9 +109,9 @@ Sequence< sal_Int8 > TokenMap::getUtf8TokenName( sal_Int32 nToken ) const
sal_Int32 TokenMap::getTokenFromUtf8( const Sequence< sal_Int8 >& rUtf8Name ) const sal_Int32 TokenMap::getTokenFromUtf8( const Sequence< sal_Int8 >& rUtf8Name ) const
{ {
const XMLTokenInfo* pTokenInfo = Perfect_Hash::getTokenInfo( struct xmltoken* pToken = Perfect_Hash::in_word_set(
reinterpret_cast< const char* >( rUtf8Name.getConstArray() ), rUtf8Name.getLength() ); reinterpret_cast< const char* >( rUtf8Name.getConstArray() ), rUtf8Name.getLength() );
return pTokenInfo ? pTokenInfo->mnToken : XML_TOKEN_INVALID; return pToken ? pToken->nToken : XML_TOKEN_INVALID;
} }
// ============================================================================ // ============================================================================
......
...@@ -25,55 +25,56 @@ ...@@ -25,55 +25,56 @@
# #
#************************************************************************* #*************************************************************************
# operation mode (1 = identifiers, 2 = names, 3 = gperf) $ARGV0 = shift @ARGV;
$op = shift @ARGV; $ARGV1 = shift @ARGV;
die "Error: invalid operation" unless( $op >= 1 && $op <= 3); $ARGV2 = shift @ARGV;
$ARGV3 = shift @ARGV;
if( $op == 3 ) { open( INFILE, $ARGV0 ) or die "Error: cannot open input file: $!";
print( "%language=C++\n" ); my %tokens;
print( "%define slot-name mpcName\n" ); while ( <INFILE> )
print( "%define initializer-suffix ,0\n" );
print( "%define lookup-function-name getTokenInfo\n" );
print( "%compare-strncmp\n" );
print( "%readonly-tables\n" );
print( "%enum\n" );
print( "%null-strings\n" );
print( "%struct-type\n" );
print( "struct XMLTokenInfo {\n" );
print( " const sal_Char* mpcName;\n" );
print( " sal_Int32 mnToken;\n" );
print( "};\n" );
print( "%%\n" );
}
$i = 0;
while( <> )
{ {
# trim newline # trim newline
chomp( $_ ); chomp( $_ );
# trim leading/trailing whitespace # trim leading/trailing whitespace
$_ =~ s/^\s*//g; $_ =~ s/^\s*//g;
$_ =~ s/\s*$//g; $_ =~ s/\s*$//g;
# skip empty lines
if( $_ ) {
# check for valid characters # check for valid characters
$_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid entry: '$_'"; $_ =~ /^[a-zA-Z0-9-_]+$/ or die "Error: invalid character in token '$_'";
# generate output
$id = "XML_$_"; $id = "XML_$_";
$id =~ s/-/_/g; $id =~ s/-/_/g;
if( $op == 1 ) { $tokens{$_} = $id;
print( "const sal_Int32 $id = $i;\n" );
} elsif( $op == 2 ) {
print( "\"$_\",\n" );
} elsif( $op == 3 ) {
print( "$_,$id\n" );
}
++$i;
}
} }
close ( INFILE );
# generate output files
open ( IDFILE, ">$ARGV1" ) or die "Error: cannot open output file: $!";
open ( NAMEFILE, ">$ARGV2" ) or die "Error: cannot open output file: $!";
open ( GPERFFILE, ">$ARGV3" ) or die "Error: cannot open output file: $!";
if( $op == 1 ) { print( GPERFFILE "%language=C++\n" );
print( "const sal_Int32 XML_TOKEN_COUNT = $i;\n" ); print( GPERFFILE "%global-table\n" );
} elsif( $op == 3 ) { print( GPERFFILE "%null-strings\n" );
print( "%%\n" ); print( GPERFFILE "%struct-type\n" );
print( GPERFFILE "struct xmltoken {\n" );
print( GPERFFILE " const sal_Char *name;\n" );
print( GPERFFILE " sal_Int32 nToken;\n" );
print( GPERFFILE "};\n" );
print( GPERFFILE "%%\n" );
$i = 0;
foreach( sort( keys( %tokens ) ) )
{
print( IDFILE "const sal_Int32 $tokens{$_} = $i;\n" );
print( NAMEFILE "\"$_\",\n" );
print( GPERFFILE "$_,$tokens{$_}\n" );
++$i;
} }
print( IDFILE "const sal_Int32 XML_TOKEN_COUNT = $i;\n" );
print( GPERFFILE "%%\n" );
close( IDFILE );
close( NAMEFILE );
close( GPERFFILE );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment