diff options
Diffstat (limited to 'salhelper/test')
-rw-r--r-- | salhelper/test/Symbols/loader.cxx | 37 | ||||
-rw-r--r-- | salhelper/test/Symbols/makefile.mk | 97 | ||||
-rw-r--r-- | salhelper/test/Symbols/samplelib.cxx | 37 | ||||
-rw-r--r-- | salhelper/test/Symbols/samplelib.hxx | 22 | ||||
-rw-r--r-- | salhelper/test/dynamicloader/loader.cxx | 37 | ||||
-rw-r--r-- | salhelper/test/dynamicloader/makefile.mk | 117 | ||||
-rw-r--r-- | salhelper/test/dynamicloader/samplelib.cxx | 37 | ||||
-rw-r--r-- | salhelper/test/dynamicloader/samplelib.hxx | 22 | ||||
-rw-r--r-- | salhelper/test/rtti/exports.dxp | 8 | ||||
-rw-r--r-- | salhelper/test/rtti/makefile.mk | 107 | ||||
-rw-r--r-- | salhelper/test/rtti/rttitest.cxx | 29 | ||||
-rw-r--r-- | salhelper/test/rtti/samplelibrtti.cxx | 39 | ||||
-rw-r--r-- | salhelper/test/rtti/samplelibrtti.hxx | 28 | ||||
-rw-r--r-- | salhelper/test/rtti/sols.map | 34 |
14 files changed, 651 insertions, 0 deletions
diff --git a/salhelper/test/Symbols/loader.cxx b/salhelper/test/Symbols/loader.cxx new file mode 100644 index 000000000000..82adeecaea9e --- /dev/null +++ b/salhelper/test/Symbols/loader.cxx @@ -0,0 +1,37 @@ + +#include <salhelper/dynload.hxx> +#include <rtl/ustring> +#include <stdio.h> +#include "samplelib.hxx" + + +using namespace salhelper; +using namespace rtl; + + +class SampleLibLoader + : public ::salhelper::ODynamicLoader<SampleLib_Api> +{ +public: + SampleLibLoader(): + ::salhelper::ODynamicLoader<SampleLib_Api> + (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "samplelib") ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SAMPLELIB_INIT_FUNCTION_NAME) )) + {} + +}; + + +int main( int argc, char *argv[ ], char *envp[ ] ) +{ + SampleLibLoader Loader; + SampleLibLoader Loader2; + Loader= Loader2; + SampleLib_Api *pApi= Loader.getApi(); + + sal_Int32 retint= pApi->funcA( 10); + double retdouble= pApi->funcB( 3.14); + + + return 0; +} diff --git a/salhelper/test/Symbols/makefile.mk b/salhelper/test/Symbols/makefile.mk new file mode 100644 index 000000000000..d6026a3c893b --- /dev/null +++ b/salhelper/test/Symbols/makefile.mk @@ -0,0 +1,97 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/ + +PRJNAME=salhelper +TARGET=dynloader +TARGET1=samplelib +TARGETTYPE=CUI +LIBTARGET=NO + +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS=TRUE + +# --- Settings --- + +.INCLUDE : settings.mk + +# --- Files --- + +#RTTI on +.IF "$(OS)" == "WNT" +CFLAGS+= -GR +.ENDIF + + +#--------------------------------------------------------------------------- +# Build the test library which is loaded by the +# RealDynamicLoader + +SLOFILES= $(SLO)$/samplelib.obj + +LIB1TARGET= $(SLB)$/$(TARGET1).lib +LIB1OBJFILES= $(SLOFILES) + + +SHL1TARGET= $(TARGET1) + +SHL1STDLIBS= \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET1) +SHL1LIBS= $(SLB)$/$(TARGET1).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEFLIB1NAME= $(TARGET1) +DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt + +#DEF1EXPORTFILE= exports.dxp + +# ------------------------------------------------------------------------------ + +OBJFILES= $(OBJ)$/loader.obj + +APP1TARGET= $(TARGET) +APP1OBJS= $(OBJFILES) + +APP1STDLIBS= \ + $(SALHELPERLIB) \ + $(SALLIB) + +APP1DEF= $(MISC)\$(APP1TARGET).def + +# --- Targets --- + +.INCLUDE : target.mk + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo __CT>>$@ diff --git a/salhelper/test/Symbols/samplelib.cxx b/salhelper/test/Symbols/samplelib.cxx new file mode 100644 index 000000000000..f4809f51fd2e --- /dev/null +++ b/salhelper/test/Symbols/samplelib.cxx @@ -0,0 +1,37 @@ +#include "samplelib.hxx" +#include <sal/types.h> +/* + + +*/ + +extern "C" +SampleLib_Api* SAL_CALL initSampleLibApi(void) +{ + static SampleLib_Api aApi= {0,0}; + if (!aApi.funcA) + { + aApi.funcA= &funcA; + aApi.funcB= &funcB; + return (&aApi); + } + else + { + return (&aApi); + } + +} + + +sal_Int32 SAL_CALL funcA( sal_Int32 a) +{ + return a; +} + + +double SAL_CALL funcB( double a) +{ + return a; +} + + diff --git a/salhelper/test/Symbols/samplelib.hxx b/salhelper/test/Symbols/samplelib.hxx new file mode 100644 index 000000000000..d5986ad67c5c --- /dev/null +++ b/salhelper/test/Symbols/samplelib.hxx @@ -0,0 +1,22 @@ +#ifndef __SAMPLELIB_HXX_ +#define __SAMPLELIB_HXX_ + +#include <sal/types.h> + +struct SampleLib_Api +{ + sal_Int32 (SAL_CALL *funcA)( sal_Int32 ); + double (SAL_CALL *funcB)( double ); +}; + + +typedef SampleLib_Api* (SAL_CALL *InitSampleLib_Api)(void); + +#define SAMPLELIB_INIT_FUNCTION_NAME "initSampleLibApi" + + +sal_Int32 SAL_CALL funcA( sal_Int32 a); +double SAL_CALL funcB( double a); + + +#endif diff --git a/salhelper/test/dynamicloader/loader.cxx b/salhelper/test/dynamicloader/loader.cxx new file mode 100644 index 000000000000..82adeecaea9e --- /dev/null +++ b/salhelper/test/dynamicloader/loader.cxx @@ -0,0 +1,37 @@ + +#include <salhelper/dynload.hxx> +#include <rtl/ustring> +#include <stdio.h> +#include "samplelib.hxx" + + +using namespace salhelper; +using namespace rtl; + + +class SampleLibLoader + : public ::salhelper::ODynamicLoader<SampleLib_Api> +{ +public: + SampleLibLoader(): + ::salhelper::ODynamicLoader<SampleLib_Api> + (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SAL_MODULENAME( "samplelib") ) ), + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SAMPLELIB_INIT_FUNCTION_NAME) )) + {} + +}; + + +int main( int argc, char *argv[ ], char *envp[ ] ) +{ + SampleLibLoader Loader; + SampleLibLoader Loader2; + Loader= Loader2; + SampleLib_Api *pApi= Loader.getApi(); + + sal_Int32 retint= pApi->funcA( 10); + double retdouble= pApi->funcB( 3.14); + + + return 0; +} diff --git a/salhelper/test/dynamicloader/makefile.mk b/salhelper/test/dynamicloader/makefile.mk new file mode 100644 index 000000000000..718f9cbe6bbc --- /dev/null +++ b/salhelper/test/dynamicloader/makefile.mk @@ -0,0 +1,117 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* + +PRJ=..$/..$/ + +PRJNAME=salhelper +TARGET=dynloader +TARGET1=samplelib +TARGETTYPE=CUI +LIBTARGET=NO + +NO_BSYMBOLIC= TRUE +ENABLE_EXCEPTIONS=TRUE +BOOTSTRAP_SERVICE=FALSE + +# --- Settings --- + +.INCLUDE : settings.mk + +# --- Files --- + + +#RTTI on +.IF "$(OS)" == "WNT" +CFLAGS+= -GR +.ENDIF + + +# UNOTYPES= com.sun.star.lang.XInitialization \ +#--------------------------------------------------------------------------- +# Build the test library which is loaded by the +# RealDynamicLoader + +SLOFILES= \ + $(SLO)$/samplelib.obj + +LIB1TARGET=$(SLB)$/$(TARGET1).lib +LIB1OBJFILES= \ + $(SLO)$/samplelib.obj + + +SHL1TARGET= $(TARGET1) + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET1) +SHL1LIBS= $(SLB)$/$(TARGET1).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) +DEFLIB1NAME =$(TARGET1) +DEF1DEPN= $(MISC)$/$(SHL1TARGET).flt + +#DEF1EXPORTFILE= exports.dxp + +# ------------------------------------------------------------------------------ + +APP1NOSAL=TRUE + +APP1TARGET= $(TARGET) + +APP1OBJS= $(OBJ)$/loader.obj + +APP1STDLIBS= \ + $(SALLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) + +#APP1LIBS= $(LB)$/isalhelper.lib + +.IF "$(OS)" == "WNT" +APP1STDLIBS+= $(LB)$/isalhelper.lib +.ELSE +APP1STDLIBS+= -lsalhelper$(UDK_MAJOR)$(COM) +.ENDIF + +APP1DEF= $(MISC)\$(APP1TARGET).def + +# --- Targets --- + +.INCLUDE : target.mk + + +$(MISC)$/$(SHL1TARGET).flt: makefile.mk + @echo ------------------------------ + @echo Making: $@ + @echo __CT>>$@ + + diff --git a/salhelper/test/dynamicloader/samplelib.cxx b/salhelper/test/dynamicloader/samplelib.cxx new file mode 100644 index 000000000000..f4809f51fd2e --- /dev/null +++ b/salhelper/test/dynamicloader/samplelib.cxx @@ -0,0 +1,37 @@ +#include "samplelib.hxx" +#include <sal/types.h> +/* + + +*/ + +extern "C" +SampleLib_Api* SAL_CALL initSampleLibApi(void) +{ + static SampleLib_Api aApi= {0,0}; + if (!aApi.funcA) + { + aApi.funcA= &funcA; + aApi.funcB= &funcB; + return (&aApi); + } + else + { + return (&aApi); + } + +} + + +sal_Int32 SAL_CALL funcA( sal_Int32 a) +{ + return a; +} + + +double SAL_CALL funcB( double a) +{ + return a; +} + + diff --git a/salhelper/test/dynamicloader/samplelib.hxx b/salhelper/test/dynamicloader/samplelib.hxx new file mode 100644 index 000000000000..d5986ad67c5c --- /dev/null +++ b/salhelper/test/dynamicloader/samplelib.hxx @@ -0,0 +1,22 @@ +#ifndef __SAMPLELIB_HXX_ +#define __SAMPLELIB_HXX_ + +#include <sal/types.h> + +struct SampleLib_Api +{ + sal_Int32 (SAL_CALL *funcA)( sal_Int32 ); + double (SAL_CALL *funcB)( double ); +}; + + +typedef SampleLib_Api* (SAL_CALL *InitSampleLib_Api)(void); + +#define SAMPLELIB_INIT_FUNCTION_NAME "initSampleLibApi" + + +sal_Int32 SAL_CALL funcA( sal_Int32 a); +double SAL_CALL funcB( double a); + + +#endif diff --git a/salhelper/test/rtti/exports.dxp b/salhelper/test/rtti/exports.dxp new file mode 100644 index 000000000000..41a9804fdbeb --- /dev/null +++ b/salhelper/test/rtti/exports.dxp @@ -0,0 +1,8 @@ +?funcA@MyClassA@@UAEXXZ +?funcB@MyClassA@@UAEXXZ +?funcC@MyClassA@@MAEXXZ +?funcD@MyClassA@@EAEXXZ +?funcA@MyClassB@@UAEXXZ +?funcB@MyClassB@@UAEXXZ +?funcC@MyClassB@@MAEXXZ +?funcD@MyClassB@@EAEXXZ
\ No newline at end of file diff --git a/salhelper/test/rtti/makefile.mk b/salhelper/test/rtti/makefile.mk new file mode 100644 index 000000000000..704454f49851 --- /dev/null +++ b/salhelper/test/rtti/makefile.mk @@ -0,0 +1,107 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME= salhelper +TARGET= rtti +TARGET1=samplelibrtti +LIBTARGET=NO +TARGETTYPE=CUI + + +ENABLE_EXCEPTIONS=TRUE + +USE_DEFFILE= TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk + +# --- Files -------------------------------------------------------- + +#RTTI on +.IF "$(OS)" == "WNT" +CFLAGS+= -GR +.ENDIF + +SLOFILES= \ + $(SLO)$/samplelibrtti.obj + +LIB1TARGET=$(SLB)$/$(TARGET1).lib +LIB1OBJFILES= \ + $(SLO)$/samplelibrtti.obj + +SHL1TARGET= $(TARGET1) + +SHL1STDLIBS= \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) + + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET1) +SHL1LIBS= $(SLB)$/$(TARGET1).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def +DEF1EXPORTFILE= exports.dxp + +DEF1NAME= $(SHL1TARGET) + +.IF "$(OS)$(CPU)"=="SOLARISS" +SHL1VERSIONMAP= sols.map +.ELIF "$(OS)$(CPU)"=="LINUXI" +SHL1VERSIONMAP= lngi.map +.ELIF "$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDIgcc2" +SHL1VERSIONMAP= gcc2_freebsd_intel.map +.ELIF "$(OS)$(CPU)$(COMNAME)" == "GCCFREEBSDIgcc3" +SHL1VERSIONMAP= gcc3_freebsd_intel.map +.ENDIF + + +# ------------------------------------------------------------------ + +APP1NOSAL=TRUE + +APP1TARGET= $(TARGET) + +APP1OBJS= $(OBJ)$/rttitest.obj + +APP1STDLIBS= \ + $(SALLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) + +.IF "$(OS)" == "WNT" +APP1STDLIBS+= $(LB)$/isamplelibrtti.lib +.ELSE +APP1STDLIBS+= -lsamplelibrtti +.ENDIF + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + diff --git a/salhelper/test/rtti/rttitest.cxx b/salhelper/test/rtti/rttitest.cxx new file mode 100644 index 000000000000..ad03f3dc7960 --- /dev/null +++ b/salhelper/test/rtti/rttitest.cxx @@ -0,0 +1,29 @@ +#include <rtl/ustring> +#include <stdio.h> +#include <typeinfo> +#include "samplelibrtti.hxx" + + +//using namespace salhelper; +using namespace rtl; + + + +int main( int argc, char *argv[ ], char *envp[ ] ) +{ + MyClassB b; + MyClassA* pA= &b; + // test the virtual function + pA->funcA(); + +// const type_info& i1= typeid ( b); +// const type_info& i2= typeid( pA); + + if( typeid( b) == typeid( pA)) + printf("\nsame types"); + + + MyClassB* pB= dynamic_cast<MyClassB* >( pA); + pB->funcA(); + return 0; +} diff --git a/salhelper/test/rtti/samplelibrtti.cxx b/salhelper/test/rtti/samplelibrtti.cxx new file mode 100644 index 000000000000..151ed9ae3c0a --- /dev/null +++ b/salhelper/test/rtti/samplelibrtti.cxx @@ -0,0 +1,39 @@ +#include "samplelibrtti.hxx" +#include <stdio.h> + +// MyClassA ============================================================= +void MyClassA::funcA() +{ + printf("MyClassA::funcA \n"); +} + +void MyClassA::funcB() +{ +} + +void MyClassA::funcC() +{ +} + +void MyClassA::funcD() +{ +} + +// MyClassB =============================================================== +void MyClassB::funcA() +{ + + printf("MyClassA::funcB \n"); +} + +void MyClassB::funcB() +{ +} + +void MyClassB::funcC() +{ +} + +void MyClassB::funcD() +{ +} diff --git a/salhelper/test/rtti/samplelibrtti.hxx b/salhelper/test/rtti/samplelibrtti.hxx new file mode 100644 index 000000000000..5f1294dd73af --- /dev/null +++ b/salhelper/test/rtti/samplelibrtti.hxx @@ -0,0 +1,28 @@ +#ifndef __SAMPLELIBRTTI_HXX_ +#define __SAMPLELIBRTTI_HXX_ + +class MyClassA +{ +public: + virtual void funcA(); + virtual void funcB(); +protected: + virtual void funcC(); +private: + virtual void funcD(); +}; + + +class MyClassB: public MyClassA +{ +public: + virtual void funcA(); + virtual void funcB(); +protected: + virtual void funcC(); +private: + virtual void funcD(); + +}; + +#endif diff --git a/salhelper/test/rtti/sols.map b/salhelper/test/rtti/sols.map new file mode 100644 index 000000000000..babf2c901585 --- /dev/null +++ b/salhelper/test/rtti/sols.map @@ -0,0 +1,34 @@ +UDK_3_0_0 { + global: +GetVersionInfo; +_fini; +_init; + +__1cIMyClassAFfuncA6M_v_; +__1cIMyClassAFfuncB6M_v_; +__1cIMyClassAFfuncC6M_v_; +__1cIMyClassAFfuncD6M_v_; +__1cIMyClassAG__vtbl_; +__1cIMyClassBFfuncA6M_v_; +__1cIMyClassBFfuncB6M_v_; +__1cIMyClassBFfuncC6M_v_; +__1cIMyClassBFfuncD6M_v_; +__1cIMyClassBG__vtbl_; +__RTTI__1CpknIMyClassA_; +__RTTI__1CpknIMyClassB_; +__RTTI__1CpnIMyClassA_; +__RTTI__1CpnIMyClassB_; +__RTTI__1nIMyClassA_; +__RTTI__1nIMyClassB_; + +local: + *; +}; + + + + + + + + |