Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
26ed2553
Kaydet (Commit)
26ed2553
authored
Agu 07, 2014
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New files missing from prev commit
Change-Id: I9889e97a7f9e70d8b2d82e26d9e0f971a943d007
üst
1579d8ed
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
238 additions
and
0 deletions
+238
-0
rtti.cxx
bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
+201
-0
rtti.hxx
bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.hxx
+37
-0
No files found.
bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.cxx
0 → 100644
Dosyayı görüntüle @
26ed2553
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 .
*/
#include <sal/config.h>
#include <cassert>
#include <typeinfo>
#include <utility>
#include <dlfcn.h>
#include <boost/unordered_map.hpp>
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustring.hxx>
#include <typelib/typedescription.h>
#include <rtti.hxx>
#include <share.hxx>
namespace
{
class
RTTI
{
typedef
boost
::
unordered_map
<
OUString
,
std
::
type_info
*
,
OUStringHash
>
t_rtti_map
;
osl
::
Mutex
m_mutex
;
t_rtti_map
m_rttis
;
t_rtti_map
m_generatedRttis
;
void
*
m_hApp
;
public
:
RTTI
();
~
RTTI
();
std
::
type_info
*
getRTTI
(
typelib_TypeDescription
const
&
);
};
RTTI
::
RTTI
()
#if defined(FREEBSD) && __FreeBSD_version < 702104
:
m_hApp
(
dlopen
(
0
,
RTLD_NOW
|
RTLD_GLOBAL
)
)
#else
:
m_hApp
(
dlopen
(
0
,
RTLD_LAZY
)
)
#endif
{
}
RTTI
::~
RTTI
()
{
dlclose
(
m_hApp
);
}
std
::
type_info
*
RTTI
::
getRTTI
(
typelib_TypeDescription
const
&
pTypeDescr
)
{
std
::
type_info
*
rtti
;
OUString
const
&
unoName
=
*
(
OUString
const
*
)
&
pTypeDescr
.
pTypeName
;
osl
::
MutexGuard
guard
(
m_mutex
);
t_rtti_map
::
const_iterator
iFind
(
m_rttis
.
find
(
unoName
)
);
if
(
iFind
==
m_rttis
.
end
())
{
// RTTI symbol
OStringBuffer
buf
(
64
);
buf
.
append
(
"_ZTIN"
);
sal_Int32
index
=
0
;
do
{
OUString
token
(
unoName
.
getToken
(
0
,
'.'
,
index
)
);
buf
.
append
(
token
.
getLength
()
);
OString
c_token
(
OUStringToOString
(
token
,
RTL_TEXTENCODING_ASCII_US
)
);
buf
.
append
(
c_token
);
}
while
(
index
>=
0
);
buf
.
append
(
'E'
);
OString
symName
(
buf
.
makeStringAndClear
()
);
#if defined(FREEBSD) && __FreeBSD_version < 702104
/* #i22253# */
rtti
=
(
std
::
type_info
*
)
dlsym
(
RTLD_DEFAULT
,
symName
.
getStr
()
);
#else
rtti
=
(
std
::
type_info
*
)
dlsym
(
m_hApp
,
symName
.
getStr
()
);
#endif
if
(
rtti
)
{
std
::
pair
<
t_rtti_map
::
iterator
,
bool
>
insertion
(
m_rttis
.
insert
(
t_rtti_map
::
value_type
(
unoName
,
rtti
)
)
);
SAL_WARN_IF
(
!
insertion
.
second
,
"bridges"
,
"key "
<<
unoName
<<
" already in rtti map"
);
}
else
{
// try to lookup the symbol in the generated rtti map
t_rtti_map
::
const_iterator
iFind2
(
m_generatedRttis
.
find
(
unoName
)
);
if
(
iFind2
==
m_generatedRttis
.
end
())
{
// we must generate it !
// symbol and rtti-name is nearly identical,
// the symbol is prefixed with _ZTI
char
const
*
rttiName
=
symName
.
getStr
()
+
4
;
#if OSL_DEBUG_LEVEL > 1
fprintf
(
stderr
,
"generated rtti for %s
\n
"
,
rttiName
);
#endif
switch
(
pTypeDescr
.
eTypeClass
)
{
case
typelib_TypeClass_EXCEPTION
:
{
typelib_CompoundTypeDescription
const
&
ctd
=
reinterpret_cast
<
typelib_CompoundTypeDescription
const
&>
(
pTypeDescr
);
if
(
ctd
.
pBaseTypeDescription
)
{
// ensure availability of base
std
::
type_info
*
base_rtti
=
getRTTI
(
ctd
.
pBaseTypeDescription
->
aBase
);
rtti
=
new
__cxxabiv1
::
__si_class_type_info
(
strdup
(
rttiName
),
(
__cxxabiv1
::
__class_type_info
*
)
base_rtti
);
}
else
{
// this class has no base class
rtti
=
new
__cxxabiv1
::
__class_type_info
(
strdup
(
rttiName
)
);
}
break
;
}
case
typelib_TypeClass_INTERFACE
:
{
typelib_InterfaceTypeDescription
const
&
itd
=
reinterpret_cast
<
typelib_InterfaceTypeDescription
const
&>
(
pTypeDescr
);
std
::
vector
<
std
::
type_info
*>
bases
;
for
(
sal_Int32
i
=
0
;
i
!=
itd
.
nBaseTypes
;
++
i
)
{
bases
.
push_back
(
getRTTI
(
itd
.
ppBaseTypes
[
i
]
->
aBase
));
}
switch
(
itd
.
nBaseTypes
)
{
case
0
:
rtti
=
new
__cxxabiv1
::
__class_type_info
(
strdup
(
rttiName
));
break
;
case
1
:
rtti
=
new
__cxxabiv1
::
__si_class_type_info
(
strdup
(
rttiName
),
static_cast
<
__cxxabiv1
::
__class_type_info
*>
(
bases
[
0
]));
break
;
case
2
:
//TODO
break
;
}
break
;
}
default
:
assert
(
false
);
// cannot happen
}
if
(
rtti
!=
0
)
{
std
::
pair
<
t_rtti_map
::
iterator
,
bool
>
insertion
(
m_generatedRttis
.
insert
(
t_rtti_map
::
value_type
(
unoName
,
rtti
)
)
);
SAL_WARN_IF
(
!
insertion
.
second
,
"bridges"
,
"key "
<<
unoName
<<
" already in generated rtti map"
);
}
}
else
// taking already generated rtti
{
rtti
=
iFind2
->
second
;
}
}
}
else
{
rtti
=
iFind
->
second
;
}
return
rtti
;
}
struct
theRttiFactory
:
public
rtl
::
Static
<
RTTI
,
theRttiFactory
>
{};
}
std
::
type_info
*
x86_64
::
getRtti
(
typelib_TypeDescription
const
&
type
)
{
return
theRttiFactory
::
get
().
getRTTI
(
type
);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bridges/source/cpp_uno/gcc3_linux_x86-64/rtti.hxx
0 → 100644
Dosyayı görüntüle @
26ed2553
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* 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 .
*/
#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_GCC3_LINUX_X86_64_RTTI_HXX
#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_GCC3_LINUX_X86_64_RTTI_HXX
#include <sal/config.h>
#include <typeinfo>
#include <typelib/typedescription.h>
namespace
x86_64
{
std
::
type_info
*
getRtti
(
typelib_TypeDescription
const
&
type
);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment