diff options
author | ts <ts@openoffice.org> | 2000-12-11 13:20:04 +0000 |
---|---|---|
committer | ts <ts@openoffice.org> | 2000-12-11 13:20:04 +0000 |
commit | 6d0bf579a8e693ecf0f6cd8291d407aeb784e78e (patch) | |
tree | cda52c0ff00520876ab4ce8d6beddc1adbab6b37 /codemaker | |
parent | 446179683f739d6a694f1501c583fb057d41bcbe (diff) |
nitial revision
Diffstat (limited to 'codemaker')
-rw-r--r-- | codemaker/source/bonobowrappermaker/corbamaker.cxx | 275 | ||||
-rw-r--r-- | codemaker/source/bonobowrappermaker/corbaoptions.cxx | 287 | ||||
-rw-r--r-- | codemaker/source/bonobowrappermaker/corbaoptions.hxx | 85 | ||||
-rw-r--r-- | codemaker/source/bonobowrappermaker/corbatype.cxx | 2819 | ||||
-rw-r--r-- | codemaker/source/bonobowrappermaker/corbatype.hxx | 349 | ||||
-rw-r--r-- | codemaker/source/bonobowrappermaker/makefile.mk | 105 |
6 files changed, 3920 insertions, 0 deletions
diff --git a/codemaker/source/bonobowrappermaker/corbamaker.cxx b/codemaker/source/bonobowrappermaker/corbamaker.cxx new file mode 100644 index 000000000000..ed193fdfda2d --- /dev/null +++ b/codemaker/source/bonobowrappermaker/corbamaker.cxx @@ -0,0 +1,275 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * $RCSfile: corbamaker.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: ts $ $Date: 2000-12-11 14:20:04 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> + +#ifndef _CODEMAKER_TYPEMANAGER_HXX_ +#include <codemaker/typemanager.hxx> +#endif +#ifndef _CODEMAKER_DEPENDENCY_HXX_ +#include <codemaker/dependency.hxx> +#endif + +#include "corbaoptions.hxx" +#include "corbatype.hxx" + +using namespace rtl; + +sal_Bool produceAllTypes(const OString& typeName, + TypeManager& typeMgr, + TypeDependency& typeDependencies, + CorbaOptions* pOptions, + sal_Bool bFullScope, + FileStream& o, + TypeSet* pAllreadyDumped, + TypeSet* generatedConversion) + + throw( CannotDumpException ) +{ + if (!produceType(typeName, typeMgr, typeDependencies, pOptions, o, pAllreadyDumped, generatedConversion)) + { + fprintf(stderr, "%s ERROR: %s\n", + pOptions->getProgramName().getStr(), + OString("cannot dump Type '" + typeName + "'").getStr()); + exit(99); + } + + RegistryKey typeKey = typeMgr.getTypeKey(typeName); + RegistryKeyNames subKeys; + + if (typeKey.getKeyNames(OUString(), subKeys)) + return sal_False; + + OString tmpName; + for (sal_uInt32 i=0; i < subKeys.getLength(); i++) + { + tmpName = OUStringToOString(subKeys.getElement(i), RTL_TEXTENCODING_UTF8); + + if (pOptions->isValid("-B")) + tmpName = tmpName.copy(tmpName.indexOf('/', 1) + 1); + else + tmpName = tmpName.copy(1); + + if (bFullScope) + { + if (!produceAllTypes(tmpName, typeMgr, typeDependencies, pOptions, sal_True, o, pAllreadyDumped, generatedConversion)) + return sal_False; + } else + { + if (!produceType(tmpName, typeMgr, typeDependencies, pOptions, o, pAllreadyDumped, generatedConversion)) + return sal_False; + } + } + + return sal_True; +} + +#if (defined UNX) || (defined OS2) +int main( int argc, char * argv[] ) +#else +int _cdecl main( int argc, char * argv[] ) +#endif +{ + CorbaOptions options; + + try + { + if (!options.initOptions(argc, argv)) + { + exit(1); + } + } + catch( IllegalArgument& e) + { + fprintf(stderr, "Illegal option: %s\n", e.m_message.getStr()); + exit(99); + } + + RegistryTypeManager typeMgr; + TypeDependency typeDependencies; + + if (!typeMgr.init(!options.isValid("-T"), options.getInputFiles())) + { + fprintf(stderr, "%s : init registries failed, check your registry files.\n", options.getProgramName().getStr()); + exit(99); + } + + if (options.isValid("-B")) + { + typeMgr.setBase(options.getOption("-B")); + } + + try + { + TypeSet generatedConversion; + FileStream cppFile; + OString outPath; + if (options.isValid("-O")) + outPath = options.getOption("-O"); + + cppFile.openFile(outPath); + + if(!cppFile.isValid()) + { + OString message("cannot open "); + message += outPath + " for writing"; + throw CannotDumpException(message); + } + + if (options.isValid("-H")) + { + OString corbaHeader = options.getOption("-H"); + + cppFile << "#include <" + << corbaHeader + << ">" << endl << endl; + + CorbaType::dumpDefaultHxxIncludes(cppFile); + cppFile << endl; + } + + if (options.isValid("-T")) + { + OString tOption(options.getOption("-T")); + sal_uInt32 count = tOption.getTokenCount(';'); + + OString typeName, tmpName; + sal_Bool ret = sal_False; + for (sal_uInt32 i = 0; i < count; i++) + { + typeName = tOption.getToken(i, ';'); + + tmpName = typeName.getToken(typeName.getTokenCount('.') - 1, '.'); + if (tmpName == "*") + { + // produce this type and his scope, but the scope is not recursively generated. + if (typeName.equals("*")) + { + tmpName = "/"; + } else + { + tmpName = typeName.copy(0, typeName.lastIndexOf('.')).replace('.', '/'); + if (tmpName.getLength() == 0) + tmpName = "/"; + else + tmpName.replace('.', '/'); + } + ret = produceAllTypes(tmpName, typeMgr, typeDependencies, &options, sal_False, cppFile, NULL, &generatedConversion); + } else + { + // produce only this type + ret = produceType(typeName.replace('.', '/'), typeMgr, typeDependencies, &options, cppFile, NULL, &generatedConversion); + } + + if (!ret) + { + fprintf(stderr, "%s ERROR: %s\n", + options.getProgramName().getStr(), + OString("cannot dump Type '" + typeName + "'").getStr()); + exit(99); + } + } + } else + { + // produce all types + if (!produceAllTypes("/", typeMgr, typeDependencies, &options, sal_True, cppFile, NULL, &generatedConversion)) + { + fprintf(stderr, "%s ERROR: %s\n", + options.getProgramName().getStr(), + "an error occurs while dumping all types."); + exit(99); + } + } + + cppFile << "namespace bonobobridge {\n" + << "const ConversionInfo* get_conversion_functions() {\n" + << " static ConversionInfo allFunctions[" << generatedConversion.size()+1<< "] = {\n"; + + for (TypeSet::iterator iter = generatedConversion.begin(); iter != generatedConversion.end(); iter++) + { + cppFile << " {\"" << (*iter).getStr() << "\"" + << ", &TC_" << (*iter).replace('/','_').getStr() << "_struct" + << ", sizeof(" << (*iter).replace('/','_').getStr() << ")" + << ", convert_b2u_" << (*iter).replace('/','_').getStr() + << ", convert_u2b_" << (*iter).replace('/','_').getStr() + << " },\n"; + } + + cppFile << " {NULL, NULL, 0 , NULL, NULL} };\n" + << " return allFunctions;\n" + << "}\n" + << "}; // namespace bonobobridge\n"; + + cppFile.close(); + } + catch( CannotDumpException& e) + { + fprintf(stderr, "%s ERROR: %s\n", + options.getProgramName().getStr(), + e.m_message.getStr()); + exit(99); + } + + return 0; +} + + diff --git a/codemaker/source/bonobowrappermaker/corbaoptions.cxx b/codemaker/source/bonobowrappermaker/corbaoptions.cxx new file mode 100644 index 000000000000..88b62f1dd4e6 --- /dev/null +++ b/codemaker/source/bonobowrappermaker/corbaoptions.cxx @@ -0,0 +1,287 @@ +/************************************************************************* + * + * $RCSfile: corbaoptions.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: ts $ $Date: 2000-12-11 14:20:04 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#include <stdio.h> + +#include "corbaoptions.hxx" + +using namespace rtl; + +sal_Bool CorbaOptions::initOptions(int ac, char* av[], sal_Bool bCmdFile) + throw( IllegalArgument ) +{ + sal_Bool ret = sal_True; + sal_uInt16 i=0; + + if (!bCmdFile) + { + bCmdFile = sal_True; + + m_program = av[0]; + + if (ac < 2) + { + fprintf(stderr, "%s", prepareHelp().getStr()); + ret = sal_False; + } + + i = 1; + } else + { + i = 0; + } + + char *s=NULL; + for (i; i < ac; i++) + { + if (av[i][0] == '-') + { + switch (av[i][1]) + { + case 'O': + if (av[i][2] == '\0') + { + if (i < ac - 1 && av[i+1][0] != '-') + { + i++; + s = av[i]; + } else + { + OString tmp("'-O', please check"); + if (i <= ac - 1) + { + tmp += " your input '" + OString(av[i+1]) + "'"; + } + + throw IllegalArgument(tmp); + } + } else + { + s = av[i] + 2; + } + + m_options["-O"] = OString(s); + break; + case 'H': + if (av[i][2] == '\0') + { + if (i < ac - 1 && av[i+1][0] != '-') + { + i++; + s = av[i]; + } else + { + OString tmp("'-H', please check"); + if (i <= ac - 1) + { + tmp += " your input '" + OString(av[i+1]) + "'"; + } + + throw IllegalArgument(tmp); + } + } else + { + s = av[i] + 2; + } + + m_options["-H"] = OString(s); + break; + case 'B': + if (av[i][2] == '\0') + { + if (i < ac - 1 && av[i+1][0] != '-') + { + i++; + s = av[i]; + } else + { + OString tmp("'-B', please check"); + if (i <= ac - 1) + { + tmp += " your input '" + OString(av[i+1]) + "'"; + } + + throw IllegalArgument(tmp); + } + } else + { + s = av[i] + 2; + } + + m_options["-B"] = OString(s); + break; + case 'T': + if (av[i][2] == '\0') + { + if (i < ac - 1 && av[i+1][0] != '-') + { + i++; + s = av[i]; + } else + { + OString tmp("'-T', please check"); + if (i <= ac - 1) + { + tmp += " your input '" + OString(av[i+1]) + "'"; + } + + throw IllegalArgument(tmp); + } + } else + { + s = av[i] + 2; + } + + if (m_options.count("-T") > 0) + { + OString tmp(m_options["-T"]); + tmp = tmp + ";" + s; + m_options["-T"] = tmp; + } else + { + m_options["-T"] = OString(s); + } + break; + case 'G': + if (av[i][2] != '\0') + { + OString tmp("'-G', please check"); + if (i <= ac - 1) + { + tmp += " your input '" + OString(av[i]) + "'"; + } + + throw IllegalArgument(tmp); + } + + m_options["-G"] = OString(""); + break; + default: + throw IllegalArgument("the option is unknown" + OString(av[i])); + break; + } + } else + { + if (av[i][0] == '@') + { + FILE* cmdFile = fopen(av[i]+1, "r"); + if( cmdFile == NULL ) + { + fprintf(stderr, "%s", prepareHelp().getStr()); + ret = sal_False; + } else + { + int rargc=0; + char* rargv[512]; + char buffer[512]; + + while ( fscanf(cmdFile, "%s", buffer) != EOF ) + { + rargv[rargc]= strdup(buffer); + rargc++; + } + fclose(cmdFile); + + ret = initOptions(rargc, rargv, bCmdFile); + + for (long i=0; i < rargc; i++) + { + free(rargv[i]); + } + } + } else + { + m_inputFiles.push_back(av[i]); + } + } + } + printf("-T: %s\n", m_options["-T"].getStr()); + + return ret; +} + +OString CorbaOptions::prepareHelp() +{ + OString help("\nusing: "); + help += m_program + " [-options] file_1 ... file_n\nOptions:\n"; + help += " -O<file> = file name for the generated output.\n"; + help += " The output directory tree is generated under this directory.\n"; + help += " -T<name> = name specifies a type or a list of types. The output for this\n"; + help += " [t1;...] type is generated. If no '-T' option is specified,\n"; + help += " then output for all types is generated.\n"; + help += " Example: 'com.sun.star.uno.XInterface' is a valid type.\n"; + help += " -B<name> = name specifies the base node. All types are searched under this\n"; + help += " node. Default is the root '/' of the registry files.\n"; + help += " -G = generate only target files which does not exists.\n"; + help += " -H<header> = include CORBA generated <header>.\n"; + help += prepareVersion(); + + return help; +} + +OString CorbaOptions::prepareVersion() +{ + OString version("\nSun Microsystems (R) "); + version += m_program + " Version 2.0\n\n"; + + return version; +} + + diff --git a/codemaker/source/bonobowrappermaker/corbaoptions.hxx b/codemaker/source/bonobowrappermaker/corbaoptions.hxx new file mode 100644 index 000000000000..0576192160a4 --- /dev/null +++ b/codemaker/source/bonobowrappermaker/corbaoptions.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * $RCSfile: corbaoptions.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: ts $ $Date: 2000-12-11 14:20:04 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CORBAMAKER_CPPUOPTIONS_HXX_ +#define _CORBAMAKER_CPPUOPTIONS_HXX_ + +#include <codemaker/options.hxx> + +class CorbaOptions : public Options +{ +public: + CorbaOptions() + : Options() {} + + ~CorbaOptions() {} + + sal_Bool initOptions(int ac, char* av[], sal_Bool bCmdFile=sal_False) + throw( IllegalArgument ); + + ::rtl::OString prepareHelp(); + + ::rtl::OString prepareVersion(); + +protected: +}; + +#endif // _CORBAMAKER_CPPUOPTIONS_HXX_ diff --git a/codemaker/source/bonobowrappermaker/corbatype.cxx b/codemaker/source/bonobowrappermaker/corbatype.cxx new file mode 100644 index 000000000000..f51b3000cb14 --- /dev/null +++ b/codemaker/source/bonobowrappermaker/corbatype.cxx @@ -0,0 +1,2819 @@ +/************************************************************************* + * + * $RCSfile: corbatype.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: ts $ $Date: 2000-12-11 14:20:04 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <stdio.h> +#ifndef _RTL_ALLOC_H_ +#include <rtl/alloc.h> +#endif + +#ifndef _RTL_USTRING_HXX_ +#include <rtl/ustring.hxx> +#endif + +#ifndef _RTL_STRBUF_HXX_ +#include <rtl/strbuf.hxx> +#endif + +#include "corbatype.hxx" +#include "corbaoptions.hxx" + +#include <hash_set> +#include <list> + +using namespace rtl; + + +//************************************************************************* +// CorbaType +//************************************************************************* +CorbaType::CorbaType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : m_inheritedMemberCount(0) + , m_indentLength(0) + , m_typeName(typeName) + , m_name(typeName.getToken(typeName.getTokenCount('/') - 1, '/')) + , m_reader(typeReader) + , m_typeMgr((TypeManager&)typeMgr) + , m_dependencies(typeDependencies) + , m_generatedConversions(generatedConversions) +{ +} + +CorbaType::~CorbaType() +{ + +} + +sal_Bool CorbaType::isNestedTypeByName(const ::rtl::OString& type) +{ + sal_Bool ret = sal_False; + + sal_Int32 i = type.lastIndexOf('/'); + + if (i >= 0) + { + OString outerTypeName(type.copy(0, i)); + ret = (m_typeMgr.getTypeClass(outerTypeName) == RT_TYPE_INTERFACE); + } + + return ret; +} + +sal_Bool CorbaType::dump(CorbaOptions* pOptions, FileStream& o, TypeSet* allreadyDumped) + throw( CannotDumpException ) +{ + sal_Bool ret = sal_False; + + ret = dumpConversionFunctions(o, allreadyDumped); + + return ret; +} + +sal_Bool CorbaType::dumpDependedTypes(CorbaOptions* pOptions, FileStream& o, TypeSet* allreadyDumped) + throw( CannotDumpException ) +{ + sal_Bool ret = sal_True; + + TypeUsingSet usingSet(m_dependencies.getDependencies(m_typeName)); + + TypeUsingSet::const_iterator iter = usingSet.begin(); + OString typeName; + sal_uInt32 index = 0; + while (iter != usingSet.end()) + { + typeName = (*iter).m_type; + if ((index = typeName.lastIndexOf(']')) > 0) + typeName = typeName.copy(index + 1); + + if (getUnoBaseType(typeName).getLength() == 0) + { + if (!produceType(typeName, + m_typeMgr, + m_dependencies, + pOptions, + o, allreadyDumped, m_generatedConversions)) + { + fprintf(stderr, "%s ERROR: %s\n", + pOptions->getProgramName().getStr(), + OString("cannot dump Type '" + typeName + "'").getStr()); + exit(99); + } + } + iter++; + } + + return ret; +} + +sal_Bool CorbaType::dumpConversionFunctions(FileStream& o, TypeSet* allreadyDumped) + throw( CannotDumpException ) +{ + if (m_typeName.lastIndexOf(']') < 0) + { + dumpInclude(o, allreadyDumped, m_typeName, "hpp", sal_False); + dumpDepIncludes(o, allreadyDumped, m_typeName, "hpp"); + + dumpFunctions(o); + } + + return sal_True; +} + + +void CorbaType::dumpDefaultHxxIncludes(FileStream& o) +{ + o << "#ifndef _OSL_MUTEX_HXX_\n" + << "#include <osl/mutex.hxx>\n" + << "#endif\n\n"; + + o << "#ifndef _RTL_USTRING_HXX_\n" + << "#include <rtl/ustring.hxx>\n" + << "#endif\n\n"; + + o << "#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_\n" + << "#include <com/sun/star/uno/Type.hxx>\n" + << "#endif\n"; + + o << "#ifndef _COM_SUN_STAR_UNO_ANY_HXX_\n" + << "#include <com/sun/star/uno/Any.hxx>\n" + << "#endif\n"; + + o << "#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_\n" + << "#include <com/sun/star/uno/Reference.hxx>\n" + << "#endif\n"; + + o << "#ifndef _COM_SUN_STAR_UNO_XINTERFACE_HPP_\n" + << "#include <com/sun/star/uno/XInterface.hpp>\n" + << "#endif\n"; + + o << "#ifndef _BONOBO_NULLINTERFACE_HPP_\n" + << "#include <Bonobo/NullInterface.hpp>\n" + << "#endif\n"; + + o << "#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_\n" + << "#include <com/sun/star/uno/Exception.hpp>\n" + << "#endif\n"; + + o << "#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_\n" + << "#include <com/sun/star/uno/RuntimeException.hpp>\n" + << "#endif\n"; + + o << "#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_\n" + << "#include <com/sun/star/uno/Sequence.hxx>\n" + << "#endif\n"; +} + + +void CorbaType::dumpInclude(FileStream& o, TypeSet* allreadyDumped, const OString& typeName, sal_Char* prefix, sal_Bool bExtended, sal_Bool bCaseSensitive) +{ + OString realTypeName = checkRealBaseType( typeName ); + + if (!isNestedTypeByName(typeName) && + (BT_INVALID == isBaseType(realTypeName)) && + !realTypeName.equals("Bonobo/NullInterface") && + !realTypeName.equals("com/sun/star/uno/XInterface") && + !realTypeName.equals("com/sun/star/uno/TypeClass") && + !realTypeName.equals("com/sun/star/uno/Type") && + !realTypeName.equals("com/sun/star/uno/Exception") && + !realTypeName.equals("com/sun/star/uno/RuntimeException")) + { + TypeSet::const_iterator iter = allreadyDumped->find(realTypeName); + + if (iter == allreadyDumped->end()) + { + allreadyDumped->insert(realTypeName); + + sal_uInt32 length = 3+ m_typeName.getLength() + strlen(prefix); + + if (bExtended) + length += m_name.getLength() + 1; + + OStringBuffer tmpBuf(length); + + tmpBuf.append('_'); + tmpBuf.append(typeName); + tmpBuf.append('_'); + if (bExtended) + { + tmpBuf.append(m_name); + tmpBuf.append('_'); + } + tmpBuf.append(prefix); + tmpBuf.append('_'); + + OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toUpperCase()); + + length = 1 + typeName.getLength() + strlen(prefix); + if (bExtended) + length += m_name.getLength() + 1; + + tmpBuf.ensureCapacity(length); + tmpBuf.append(typeName); + if (bExtended) + { + tmpBuf.append('/'); + tmpBuf.append(m_name); + } + tmpBuf.append('.'); + tmpBuf.append(prefix); + + o << "#ifndef " << tmp << "\n#include <"; + if (bCaseSensitive) + { + o << tmpBuf.makeStringAndClear(); + } else + { + o << tmpBuf.makeStringAndClear(); + } + + o << ">\n"; + o << "#endif\n"; + + o << "namespace bonobobridge {\n\n"; + + std::list<OString> nestedTypes; + + do + { + if ((realTypeName.lastIndexOf(']') < 0) && + (BT_INVALID == isBaseType(realTypeName)) && + !realTypeName.equals("Bonobo/NullInterface") && + !realTypeName.equals("com/sun/star/uno/XInterface") && + !realTypeName.equals("com/sun/star/uno/TypeClass") && + !realTypeName.equals("com/sun/star/uno/Type") && + !realTypeName.equals("com/sun/star/uno/Exception") && + !realTypeName.equals("com/sun/star/uno/RuntimeException") && + !realTypeName.equals("com/sun/star/uno/TypeClass")) + { + o << "inline sal_Bool cpp_convert_b2u("; + dumpUnoType(o, realTypeName, sal_False, sal_True); + o << " u, "; + dumpCorbaType(o, realTypeName, sal_True, sal_True); + o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge);\n"; + o << "inline sal_Bool cpp_convert_u2b("; + dumpCorbaType(o, realTypeName, sal_False, sal_True); + o << " b, "; + dumpUnoType(o, realTypeName, sal_True, sal_True); + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge);\n"; + } + + RegistryKey key = m_typeMgr.getTypeKey(realTypeName); + RegistryKeyNames nestedTypeNames; + key.getKeyNames(OUString(), nestedTypeNames); + for (sal_Int32 i = 0; i < nestedTypeNames.getLength(); i++) + { + OString nTypeName(OUStringToOString(nestedTypeNames.getElement(i), RTL_TEXTENCODING_UTF8)); + + nTypeName = checkRealBaseType(nTypeName.copy(5)); + + if (BT_INVALID == isBaseType(nTypeName)) + { + allreadyDumped->insert(nTypeName); + nestedTypes.push_back(nTypeName); + } + } + + if (nestedTypes.size() > 0) + { + realTypeName = nestedTypes.front(); + nestedTypes.pop_front(); + } + else + { + realTypeName = ""; + } + } + while (realTypeName.getLength() > 0); + + o << "}; // namespace bonobobridge\n"; + } + } +} + +void CorbaType::dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const OString& typeName, sal_Char* prefix) +{ + TypeUsingSet usingSet(m_dependencies.getDependencies(typeName)); + + TypeUsingSet::const_iterator iter = usingSet.begin(); + + OString sPrefix(OString(prefix).toUpperCase()); + sal_Bool bSequenceDumped = sal_False; + sal_Bool bInterfaceDumped = sal_False; + sal_uInt32 index = 0; + sal_uInt32 seqNum = 0; + OString relType; + while (iter != usingSet.end()) + { + index = (*iter).m_type.lastIndexOf(']'); + seqNum = (index > 0 ? ((index+1) / 2) : 0); + + relType = (*iter).m_type; + if (index > 0) + relType = relType.copy(index+1); + + if (!isNestedTypeByName(relType)) + { + OString defPrefix("HXX"); + if (sPrefix.equals("HDL")) + defPrefix = "H"; + + if (seqNum > 0 && !bSequenceDumped) + { + bSequenceDumped = sal_True; + } + + if (getUnoBaseType(relType).getLength() == 0 && + m_typeName != relType) + { + if (m_typeMgr.getTypeClass(relType) == RT_TYPE_INTERFACE + && sPrefix.equals("HDL")) + { + if (!bInterfaceDumped) + { + bInterfaceDumped = sal_True; + } + + if (!((*iter).m_use & TYPEUSE_SUPER)) + { + o << endl; + dumpNameSpace(o, sal_True, sal_False, relType); + o << "\nclass " << scopedName(m_typeName, relType, sal_True) << ";\n"; + dumpNameSpace(o, sal_False, sal_False, relType); + o << "\n\n"; + } else + { + dumpInclude(o, allreadyDumped, relType, prefix); + } + } else + { + dumpInclude(o, allreadyDumped, relType, prefix); + } + } + } + + iter++; + } +} + +void CorbaType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, const OString& type) +{ + OString typeName(type); + sal_Bool bOneLine = sal_True; + if (typeName.getLength() == 0) + { + typeName = m_typeName; + bOneLine = sal_False; + } + + if (typeName == "/") + return; + + sal_uInt32 count = typeName.getTokenCount('/'); + + if (count == 1 && !bFull) + return; + + if (!bFull) count--; + + if (bOpen) + { + for (int i=0; i < count; i++) + { + o << "namespace " << typeName.getToken(i, '/'); + if (bOneLine) + o << " { "; + else + o << "\n{\n"; + } + } else + { + for (int i=count-1; i >= 0; i--) + { + o << "}"; + if (bOneLine) + o << " "; + else + o << " // " << typeName.getToken(i, '/') << "\n"; + } + } +} + + +sal_uInt32 CorbaType::getMemberCount() +{ + sal_uInt32 count = m_reader.getMethodCount(); + + sal_uInt32 fieldCount = m_reader.getFieldCount(); + RTFieldAccess access = RT_ACCESS_INVALID; + for (sal_uInt16 i=0; i < fieldCount; i++) + { + access = m_reader.getFieldAccess(i); + + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) + count++; + } + return count; +} + +sal_uInt32 CorbaType::checkInheritedMemberCount(const TypeReader* pReader) +{ + sal_Bool bSelfCheck = sal_True; + if (!pReader) + { + bSelfCheck = sal_False; + pReader = &m_reader; + } + + sal_uInt32 count = 0; + OString superType(pReader->getSuperTypeName()); + if (superType.getLength() > 0) + { + TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); + if ( aSuperReader.isValid() ) + { + count = checkInheritedMemberCount(&aSuperReader); + } + } + + if (bSelfCheck) + { + count += pReader->getMethodCount(); + sal_uInt32 fieldCount = pReader->getFieldCount(); + RTFieldAccess access = RT_ACCESS_INVALID; + for (sal_uInt16 i=0; i < fieldCount; i++) + { + access = pReader->getFieldAccess(i); + + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) + count++; + } + } + + return count; +} + +sal_uInt32 CorbaType::getInheritedMemberCount() +{ + if (m_inheritedMemberCount == 0) + { + m_inheritedMemberCount = checkInheritedMemberCount(0); + } + + return m_inheritedMemberCount; +} + +OString CorbaType::getTypeClass(const OString& type, sal_Bool bCStyle) +{ + OString typeName = (type.getLength() > 0 ? type : m_typeName); + RTTypeClass rtTypeClass = RT_TYPE_INVALID; + + if (type.getLength() > 0) + { + typeName = type; + rtTypeClass = m_typeMgr.getTypeClass(typeName); + } else + { + typeName = m_typeName; + rtTypeClass = m_reader.getTypeClass(); + } + + if (typeName.lastIndexOf(']') > 0) + return bCStyle ? "typelib_TypeClass_SEQUENCE" : "::com::sun::star::uno::TypeClass_SEQUENCE"; + + switch (rtTypeClass) + { + case RT_TYPE_INTERFACE: + return bCStyle ? "typelib_TypeClass_INTERFACE" : "::com::sun::star::uno::TypeClass_INTERFACE"; + break; + case RT_TYPE_MODULE: + return bCStyle ? "typelib_TypeClass_MODULE" : "::com::sun::star::uno::TypeClass_MODULE"; + break; + case RT_TYPE_STRUCT: + return bCStyle ? "typelib_TypeClass_STRUCT" : "::com::sun::star::uno::TypeClass_STRUCT"; + break; + case RT_TYPE_ENUM: + return bCStyle ? "typelib_TypeClass_ENUM" : "::com::sun::star::uno::TypeClass_ENUM"; + break; + case RT_TYPE_EXCEPTION: + return bCStyle ? "typelib_TypeClass_EXCEPTION" : "::com::sun::star::uno::TypeClass_EXCEPTION"; + break; + case RT_TYPE_TYPEDEF: + { + OString realType = checkRealBaseType( typeName ); + return getTypeClass( realType, bCStyle ); + } +// return bCStyle ? "typelib_TypeClass_TYPEDEF" : "::com::sun::star::uno::TypeClass_TYPEDEF"; + break; + case RT_TYPE_SERVICE: + return bCStyle ? "typelib_TypeClass_SERVICE" : "::com::sun::star::uno::TypeClass_SERVICE"; + break; + case RT_TYPE_INVALID: + { + if (type.equals("long")) + return bCStyle ? "typelib_TypeClass_LONG" : "::com::sun::star::uno::TypeClass_LONG"; + if (type.equals("short")) + return bCStyle ? "typelib_TypeClass_SHORT" : "::com::sun::star::uno::TypeClass_SHORT"; + if (type.equals("hyper")) + return bCStyle ? "typelib_TypeClass_HYPER" : "::com::sun::star::uno::TypeClass_HYPER"; + if (type.equals("string")) + return bCStyle ? "typelib_TypeClass_STRING" : "::com::sun::star::uno::TypeClass_STRING"; + if (type.equals("boolean")) + return bCStyle ? "typelib_TypeClass_BOOLEAN" : "::com::sun::star::uno::TypeClass_BOOLEAN"; + if (type.equals("char")) + return bCStyle ? "typelib_TypeClass_CHAR" : "::com::sun::star::uno::TypeClass_CHAR"; + if (type.equals("byte")) + return bCStyle ? "typelib_TypeClass_BYTE" : "::com::sun::star::uno::TypeClass_BYTE"; + if (type.equals("any")) + return bCStyle ? "typelib_TypeClass_ANY" : "::com::sun::star::uno::TypeClass_ANY"; + if (type.equals("type")) + return bCStyle ? "typelib_TypeClass_TYPE" : "::com::sun::star::uno::TypeClass_TYPE"; + if (type.equals("float")) + return bCStyle ? "typelib_TypeClass_FLOAT" : "::com::sun::star::uno::TypeClass_FLOAT"; + if (type.equals("double")) + return bCStyle ? "typelib_TypeClass_DOUBLE" : "::com::sun::star::uno::TypeClass_DOUBLE"; + if (type.equals("void")) + return bCStyle ? "typelib_TypeClass_VOID" : "::com::sun::star::uno::TypeClass_VOID"; + if (type.equals("unsigned long")) + return bCStyle ? "typelib_TypeClass_UNSIGNED_LONG" : "::com::sun::star::uno::TypeClass_UNSIGNED_LONG"; + if (type.equals("unsigned short")) + return bCStyle ? "typelib_TypeClass_UNSIGNED_SHORT" : "::com::sun::star::uno::TypeClass_UNSIGNED_SHORT"; + if (type.equals("unsigned hyper")) + return bCStyle ? "typelib_TypeClass_UNSIGNED_HYPER" : "::com::sun::star::uno::TypeClass_UNSIGNED_HYPER"; + } + break; + } + + return bCStyle ? "typelib_TypeClass_UNKNOWN" : "::com::sun::star::uno::TypeClass_UNKNOWN"; +} + +OString CorbaType::printUnoType(const OString& type, sal_Bool bConst, sal_Bool bRef, sal_Bool bNative) + throw( CannotDumpException ) +{ + OStringBuffer ret(1024); + OString sType(checkRealBaseType(type, sal_True)); + sal_uInt32 index = sType.lastIndexOf(']'); + sal_uInt32 seqNum = (index > 0 ? ((index+1) / 2) : 0); + + OString relType = (index > 0 ? (sType).copy(index+1) : type); + + RTTypeClass typeClass = m_typeMgr.getTypeClass(relType); + + if (bConst) ret.append("const "); + + int i; + for (i=0; i < seqNum; i++) + { + ret.append("::com::sun::star::uno::Sequence< "); + } + + switch (typeClass) + { + case RT_TYPE_INTERFACE: + if (bNative) + ret.append(scopedName(m_typeName, relType)); + else + ret.append("::com::sun::star::uno::Reference< ").append(scopedName(m_typeName, relType)).append(" >"); + break; + case RT_TYPE_INVALID: + { + OString tmp(getUnoBaseType(relType)); + if (tmp.getLength() > 0) + { + ret.append(getUnoBaseType(relType)); + } else + throw CannotDumpException("Unknown type '" + relType + "', incomplete type library. ("+type+")"); + } + break; + case RT_TYPE_STRUCT: + case RT_TYPE_ENUM: + case RT_TYPE_TYPEDEF: + case RT_TYPE_EXCEPTION: + ret.append(scopedName(m_typeName, relType)); + break; + } + + for (i=0; i < seqNum; i++) + { + ret.append(" >"); + } + + if (bRef) ret.append("&"); + return ret.makeStringAndClear(); +} + +void CorbaType::dumpUnoType(FileStream& o, const OString& type, + sal_Bool bConst, sal_Bool bRef, sal_Bool bNative) + throw( CannotDumpException ) +{ + OString ret = printUnoType(type, bConst, bRef, bNative); + o << ret; +} + +OString CorbaType::printCorbaType(const OString& type, sal_Bool bConst, sal_Bool bRef) + throw( CannotDumpException ) +{ + OStringBuffer ret(1024); + + OString sType(type); + + sal_uInt32 index = sType.lastIndexOf(']'); + sal_uInt32 seqNum = (index > 0 ? ((index+1) / 2) : 0); + + OString relType = (index > 0 ? (sType).copy(index+1) : type); + + RTTypeClass typeClass = m_typeMgr.getTypeClass(relType); + + if (relType.equals("com/sun/star/uno/XInterface")) + relType = "Bonobo/Unknown"; + + if (relType.equals("com/sun/star/uno/TypeClass")) + relType = "CORBA_TypeCode"; + + if (relType.equals("com/sun/star/uno/RuntimeException")) + relType = "CORBA_SystemException"; + + if (relType.equals("com/sun/star/uno/Exception")) + relType = "CORBA_any"; + + if (bConst) ret.append("const "); + + + int i; + for (i=0; i < seqNum; i++) + { + ret.append("CORBA_sequence_"); + } + + switch (typeClass) + { + case RT_TYPE_INTERFACE: + ret.append(relType.replace('/', '_')); + break; + case RT_TYPE_INVALID: + { + OString tmp(getUnoBaseType(relType)); + if (tmp.getLength() > 0) + ret.append(getCorbaBaseType(relType)); + else + throw CannotDumpException("Unknown type '" + relType + "', incomplete type library. ("+type+")"); + } + break; + case RT_TYPE_STRUCT: + case RT_TYPE_ENUM: + case RT_TYPE_TYPEDEF: + case RT_TYPE_EXCEPTION: + ret.append(relType.replace('/', '_')); + break; + } + + if (bRef) ret.append("&"); + + return ret.makeStringAndClear(); +} + +sal_Bool CorbaType::isPassedAsPointer(const OString& type) +{ + sal_Bool ret = sal_False; + + OString sType(checkSpecialCorbaType(type)); + + sal_Int32 index = sType.lastIndexOf(']'); + sal_Int32 seqNum = (index > 0 ? ((index+1) / 2) : 0); + + OString relType = (index > 0 ? (sType).copy(index+1) : type); + + if (index > 0) + { + OString fakeTest; + + sal_Int32 j = type.lastIndexOf('/'); + if (j >= 0) + fakeTest = type.copy(0, j+1)+"_faked_array_"+type.copy(j+1); + else + fakeTest = "_faked_array_"+sType; + + TypeReader fakeTestReader = m_typeMgr.getTypeReader(fakeTest); + + if (fakeTestReader.isValid()) + ret = sal_False; + else + ret = sal_True; + } + else + { + RTTypeClass typeClass = m_typeMgr.getTypeClass(sType); + + switch (typeClass) + { + case RT_TYPE_STRUCT: + case RT_TYPE_EXCEPTION: + ret = sal_True; + break; + + case RT_TYPE_INTERFACE: + case RT_TYPE_ENUM: + case RT_TYPE_INVALID: + if (sType.equals("any")) + ret = sal_True; + else + ret = sal_False; + break; + } + } + + return ret; +} + +sal_Bool CorbaType::isDerivedFromUnknown(const ::rtl::OString& typeName) +{ + sal_Bool ret = sal_True; + if (typeName.getLength() == 0) + ret = sal_False; + else if (typeName.equals("Bonobo/NullInterface")) + ret = sal_False; + else if (typeName.equals("com/sun/star/uno/XInterface")) + ret = sal_True; + else + { + TypeReader reader(m_typeMgr.getTypeReader(typeName)); + if (reader.isValid()) + ret = isDerivedFromUnknown(reader.getSuperTypeName()); + else + ret = sal_False; + } + return ret; +} + + +sal_Bool CorbaType::isArray(const OString& type) +{ + sal_Bool ret = sal_False; + + OString sType(checkSpecialCorbaType(type)); + + sal_Int32 index = sType.lastIndexOf(']'); + sal_Int32 seqNum = (index > 0 ? ((index+1) / 2) : 0); + + OString relType = (index > 0 ? (sType).copy(index+1) : type); + + if (index > 0) + { + OString fakeTest; + + sal_Int32 j = type.lastIndexOf('/'); + if (j >= 0) + fakeTest = type.copy(0, j+1)+"_faked_array_"+type.copy(j+1); + else + fakeTest = "_faked_array_"+sType; + + TypeReader fakeTestReader = m_typeMgr.getTypeReader(fakeTest); + + if (fakeTestReader.isValid()) + ret = sal_True; + } + + return ret; +} + +OString CorbaType::printCorbaParameter(const OString& type, sal_Bool bOut) + throw( CannotDumpException ) +{ + OStringBuffer ret(1024); + + OString sType(type); + sal_Int32 index = sType.lastIndexOf(']'); + sal_Int32 seqNum = (index > 0 ? ((index+1) / 2) : 0); + + OString relType = (index > 0 ? (sType).copy(index+1) : type); + + RTTypeClass typeClass = m_typeMgr.getTypeClass(relType); + + if (relType.equals("Bonobo/NullInterface")) + relType = "CORBA_Object"; + + if (relType.equals("com/sun/star/uno/XInterface")) + relType = "Bonobo/Unknown"; + + if (relType.equals("com/sun/star/uno/TypeClass")) + relType = "CORBA_TypeCode"; + + if (relType.equals("com/sun/star/uno/RuntimeException")) + relType = "CORBA_SystemException"; + + if (relType.equals("com/sun/star/uno/Exception")) + relType = "CORBA_any"; + + int i; + for (i=0; i < seqNum; i++) + { + ret.append("CORBA_sequence_"); + } + + switch (typeClass) + { + case RT_TYPE_INTERFACE: + ret.append(relType.replace('/', '_')); + break; + case RT_TYPE_INVALID: + { + OString tmp(getUnoBaseType(relType)); + if (tmp.getLength() > 0) + { + ret.append(getCorbaBaseType(relType)); + } else + throw CannotDumpException("Unknown type '" + relType + "', incomplete type library. ("+type+")"); + } + break; + case RT_TYPE_STRUCT: + case RT_TYPE_EXCEPTION: + case RT_TYPE_ENUM: + case RT_TYPE_TYPEDEF: + ret.append(relType.replace('/', '_')); + break; + } + + return ret.makeStringAndClear(); +} + +void CorbaType::dumpCorbaType(FileStream& o, const OString& type, + sal_Bool bConst, sal_Bool bRef) + throw( CannotDumpException ) +{ + OString ret = printCorbaType(type, bConst, bRef); + o << ret; +} + +OString CorbaType::getUnoBaseType(const OString& type) +{ + if (type.equals("long")) + return "sal_Int32"; + if (type.equals("short")) + return "sal_Int16"; + if (type.equals("hyper")) + return "sal_Int64"; + if (type.equals("string")) + return "::rtl::OUString"; + if (type.equals("boolean")) + return "sal_Bool"; + if (type.equals("char")) + return "sal_Unicode"; + if (type.equals("byte")) + return "sal_Int8"; + if (type.equals("any")) + return "::com::sun::star::uno::Any"; + if (type.equals("type")) + return "::com::sun::star::uno::Type"; + if (type.equals("float")) + return "float"; + if (type.equals("double")) + return "double"; + if (type.equals("octet")) + return "sal_Int8"; + if (type.equals("void")) + return type; + if (type.equals("unsigned long")) + return "sal_uInt32"; + if (type.equals("unsigned short")) + return "sal_uInt16"; + if (type.equals("unsigned hyper")) + return "sal_uInt64"; + + return OString(); +} + +OString CorbaType::getCorbaBaseType(const OString& type) +{ + if (type.equals("long")) + return "CORBA_long"; + if (type.equals("short")) + return "CORBA_short"; + if (type.equals("hyper")) + return "CORBA_long_long"; + if (type.equals("string")) + return "CORBA_char*"; + if (type.equals("boolean")) + return "CORBA_boolean"; + if (type.equals("char")) + return "CORBA_char"; + if (type.equals("byte")) + return "CORBA_octet"; + if (type.equals("any")) + return "CORBA_any"; + if (type.equals("type")) + return "CORBA_TypeCode"; + if (type.equals("float")) + return "CORBA_float"; + if (type.equals("double")) + return "CORBA_double"; + if (type.equals("octet")) + return "CORBA_octet"; + if (type.equals("void")) + return type; + if (type.equals("unsigned long")) + return "CORBA_unsigned_long"; + if (type.equals("unsigned short")) + return "CORBA_unsigned_short"; + if (type.equals("unsigned hyper")) + return "CORBA_unsigned_long_long"; + + return OString(); +} + + +void CorbaType::dumpTypeInit(FileStream& o, const OString& typeName) +{ + OString type(checkSpecialCorbaType(typeName)); + + BASETYPE baseType = isBaseType(type); + + switch (baseType) + { + case BT_BOOLEAN: + o << "(sal_False)"; + return; + break; + case BT_ANY: + case BT_STRING: + o << "()"; + return; + break; + case BT_INVALID: + break; + default: + o << "(("; + dumpUnoType(o, type); + o << ")" << "0)"; + return; + } + + RTTypeClass typeClass = m_typeMgr.getTypeClass(type); + + if (typeClass == RT_TYPE_ENUM) + { + RegistryTypeReaderLoader aReaderLoader; + + if (aReaderLoader.isLoaded()) + { + TypeReader reader(m_typeMgr.getTypeReader(type)); + + if ( reader.isValid() ) + { + o << "(" << shortScopedName("", type, sal_False) + << "::" << type.getToken(type.getTokenCount('/') - 1, '/') + << "_" << reader.getFieldName(0) << ")"; + return; + } + } + } + + o << "()"; +} + +BASETYPE CorbaType::isBaseType(const OString& type) +{ + if (type.equals("long")) + return BT_LONG; + if (type.equals("short")) + return BT_SHORT; + if (type.equals("hyper")) + return BT_HYPER; + if (type.equals("string")) + return BT_STRING; + if (type.equals("boolean")) + return BT_BOOLEAN; + if (type.equals("char")) + return BT_CHAR; + if (type.equals("byte")) + return BT_BYTE; + if (type.equals("any")) + return BT_ANY; + if (type.equals("float")) + return BT_FLOAT; + if (type.equals("double")) + return BT_DOUBLE; + if (type.equals("void")) + return BT_VOID; + if (type.equals("unsigned long")) + return BT_UNSIGNED_LONG; + if (type.equals("unsigned short")) + return BT_UNSIGNED_SHORT; + if (type.equals("unsigned hyper")) + return BT_UNSIGNED_HYPER; + + return BT_INVALID; +} + +OString CorbaType::typeToIdentifier(const OString& type) +{ + sal_uInt32 index = type.lastIndexOf(']'); + sal_uInt32 seqNum = (index > 0 ? ((index+1) / 2) : 0); + + OString relType = (index > 0 ? ((OString)type).copy(index+1) : type); + OString sIdentifier; + + while( seqNum > 0 ) + { + sIdentifier += OString("seq"); + + if ( --seqNum == 0 ) + { + sIdentifier += OString("_"); + } + } + + if ( isBaseType(relType) ) + { + sIdentifier += relType.replace(' ', '_'); + } else + { + sIdentifier += relType.replace('/', '_'); + } + + + return sIdentifier; +} + +OString CorbaType::checkSpecialCorbaType(const OString& type) +{ + OString baseType(type); + + RegistryTypeReaderLoader & rReaderLoader = getRegistryTypeReaderLoader(); + + RegistryKey key; + sal_uInt8* pBuffer=NULL; + RTTypeClass typeClass; + sal_Bool isTypeDef = (m_typeMgr.getTypeClass(baseType) == RT_TYPE_TYPEDEF); + TypeReader reader; + + while (isTypeDef) + { + reader = m_typeMgr.getTypeReader(baseType); + + if (reader.isValid()) + { + typeClass = reader.getTypeClass(); + + if (typeClass == RT_TYPE_TYPEDEF) + baseType = reader.getSuperTypeName(); + else + isTypeDef = sal_False; + } else + break; + } + + return baseType; +} + +OString CorbaType::checkRealBaseType(const OString& type, sal_Bool bResolveTypeOnly) +{ + sal_uInt32 index = type.lastIndexOf(']'); + OString baseType = (index > 0 ? ((OString)type).copy(index+1) : type); + OString seqPrefix = (index > 0 ? ((OString)type).copy(0, index+1) : OString()); + + RegistryTypeReaderLoader & rReaderLoader = getRegistryTypeReaderLoader(); + + RegistryKey key; + sal_uInt8* pBuffer=NULL; + RTTypeClass typeClass; + sal_Bool mustBeChecked = (m_typeMgr.getTypeClass(baseType) == RT_TYPE_TYPEDEF); + TypeReader reader; + + while (mustBeChecked) + { + reader = m_typeMgr.getTypeReader(baseType); + + if (reader.isValid()) + { + typeClass = reader.getTypeClass(); + + if (typeClass == RT_TYPE_TYPEDEF) + { + baseType = reader.getSuperTypeName(); + index = baseType.lastIndexOf(']'); + if (index > 0) + { + seqPrefix += baseType.copy(0, index+1); + baseType = baseType.copy(index+1); + } + } else + mustBeChecked = sal_False; + } else + break; + } + + if ( bResolveTypeOnly ) + baseType = seqPrefix + baseType; + + return baseType; +} + + +void CorbaType::inc(sal_uInt32 num) +{ + m_indentLength += num; +} + +void CorbaType::dec(sal_uInt32 num) +{ + if (m_indentLength - num < 0) + m_indentLength = 0; + else + m_indentLength -= num; +} + +OString CorbaType::indent() +{ + OStringBuffer tmp(m_indentLength); + + for (int i=0; i < m_indentLength; i++) + { + tmp.append(' '); + } + return tmp.makeStringAndClear(); +} + +OString CorbaType::indent(sal_uInt32 num) +{ + OStringBuffer tmp(m_indentLength + num); + + for (int i=0; i < m_indentLength + num; i++) + { + tmp.append(' '); + } + return tmp.makeStringAndClear(); +} + +//************************************************************************* +// InterfaceType +//************************************************************************* +InterfaceType::InterfaceType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) +{ + m_inheritedMemberCount = 0; + m_hasAttributes = sal_False; + m_hasMethods = sal_False; +} + +InterfaceType::~InterfaceType() +{ + +} + + +void InterfaceType::dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool bDelegateToSuper) +{ + OString superName(m_reader.getSuperTypeName()); + if (bDeclOnly && + !superName.equals("Bonobo/NullInterface") && + !superName.equals("com/sun/star/uno/XInterface")) + { + TypeReader reader(m_typeMgr.getTypeReader(superName)); + InterfaceType iType(reader, superName, m_typeMgr, TypeDependency(), m_generatedConversions); + iType.inc(); + iType.dumpUnoMethods(o, bDeclOnly, sal_True); + } + + sal_uInt32 methodCount = m_reader.getMethodCount(); + sal_Bool first=sal_True; + + OString methodName, returnType, paramType, paramName; + sal_uInt32 paramCount = 0; + sal_uInt32 excCount = 0; + RTMethodMode methodMode = RT_MODE_INVALID; + RTParamMode paramMode = RT_PARAM_INVALID; + + sal_Bool bRef = sal_False; + sal_Bool bConst = sal_False; + sal_Bool bWithRunTimeExcp = sal_True; + + for (sal_uInt16 i=0; i < methodCount; i++) + { + methodName = m_reader.getMethodName(i); + returnType = m_reader.getMethodReturnType(i); + paramCount = m_reader.getMethodParamCount(i); + excCount = m_reader.getMethodExcCount(i); + methodMode = m_reader.getMethodMode(i); + + if ( methodName.equals("acquire") || methodName.equals("release") ) + bWithRunTimeExcp = sal_False; + + if (first) + { + first = sal_False; + o << "\n" << indent() << "// Methods\n"; + } + + o << indent(); + if (bDeclOnly) + o << "virtual "; + dumpUnoType(o, returnType); + o << " SAL_CALL "; + if (!bDeclOnly) + { + o << "bonobobridge::BonoboWrapper_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "::"; + } + + o << methodName << "( "; + + sal_uInt16 j; + for (j=0; j < paramCount; j++) + { + paramName = m_reader.getMethodParamName(i, j); + paramType = m_reader.getMethodParamType(i, j); + paramMode = m_reader.getMethodParamMode(i, j); + + switch (paramMode) + { + case RT_PARAM_IN: + { + OString relType = checkSpecialCorbaType(paramType); + if (m_typeMgr.getTypeClass(relType) == RT_TYPE_ENUM || + (isBaseType(relType) && !relType.equals("string") && !relType.equals("any"))) + { + bConst = sal_False; + bRef = sal_False; + } else + { + bConst = sal_True; + bRef = sal_True; + } + break; + } + case RT_PARAM_OUT: + case RT_PARAM_INOUT: + bConst = sal_False; + bRef = sal_True; + break; + } + + dumpUnoType(o, paramType, bConst, bRef); + o << " " << paramName; + + if (j+1 < paramCount) o << ", "; + } + o << " )"; + + o << " throw("; + OString excpName; + for (j=0; j < excCount; j++) + { + excpName = m_reader.getMethodExcType(i, j); + if (excpName != "com/sun/star/uno/RuntimeException") + o << scopedName(m_typeName, excpName); + if (bWithRunTimeExcp) + o << ", "; + } + + if ( bWithRunTimeExcp ) + { + o << " ::com::sun::star::uno::RuntimeException"; + } + + if (bDeclOnly && bDelegateToSuper) + { + o << " ) {\n"; + if (returnType.equals("void")) + o << indent() << " "; + else + o << indent() << " return "; + o << "BonoboWrapper_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "::" << methodName << "( "; + for (j = 0; j < paramCount; j++) + { + paramName = m_reader.getMethodParamName(i, j); + o << paramName; + if (j < (paramCount-1)) + o << ", "; + } + o << " );\n" + << indent() << "}\n"; + } + else if (!bDeclOnly) + { + o << " ) {\n"; + + OStringBuffer preBuffer(1024); + OStringBuffer callBuffer(1024); + OStringBuffer postBuffer(1024); + + callBuffer.append(" "); + + if (!returnType.equals("void")) + { + preBuffer.append(" "); + preBuffer.append(printCorbaParameter(returnType)); + if (isPassedAsPointer(returnType)) + preBuffer.append("*"); + preBuffer.append(" _b_ret;\n"); + preBuffer.append(" "); + preBuffer.append(printUnoType(returnType, sal_False, sal_False)); + preBuffer.append(" _u_ret;\n"); + + callBuffer.append("_b_ret = "); + } + + callBuffer.append(printCorbaType(m_typeName, sal_False, sal_False)); + callBuffer.append("_"); + if (methodName.indexOf("_reserved_identifier_") == 0) + callBuffer.append(methodName.copy(OString("_reserved_identifier_").getLength())); + else + callBuffer.append(methodName); + + callBuffer.append("( m_corbaObject"); + + for (j=0; j < paramCount; j++) + { + paramName = m_reader.getMethodParamName(i, j); + paramType = m_reader.getMethodParamType(i, j); + paramMode = m_reader.getMethodParamMode(i, j); + + preBuffer.append(" "); + preBuffer.append(printCorbaParameter(paramType)); + if (isPassedAsPointer(paramType) && (paramMode == RT_PARAM_OUT)) + { + preBuffer.append("* _b_"); + preBuffer.append(paramName); + preBuffer.append(";\n"); + } + else + { + preBuffer.append(" _b_"); + preBuffer.append(paramName); + preBuffer.append(";\n"); + } + + switch (paramMode) { + case RT_PARAM_IN: + + if (isArray(paramType)) + preBuffer.append(" // fix me: conversion of array types!\n"); + else + { + preBuffer.append(" cpp_convert_u2b("); + preBuffer.append("_b_"); + preBuffer.append(paramName); + preBuffer.append(", "); + preBuffer.append(paramName); + preBuffer.append(", m_bridge);\n"); + } + + if (isPassedAsPointer(paramType)) + callBuffer.append(", &_b_"); + else + callBuffer.append(", _b_"); + break; + case RT_PARAM_INOUT: + + if (isArray(paramType)) + preBuffer.append(" // fix me: conversion of array types!\n"); + else + { + preBuffer.append(" cpp_convert_u2b("); + if (isPassedAsPointer(paramType)) + preBuffer.append("_b_"); + else + preBuffer.append("_b_"); + preBuffer.append(paramName); + preBuffer.append(", "); + preBuffer.append(paramName); + preBuffer.append(", m_bridge);\n"); + } + + callBuffer.append(", &_b_"); + + if (isArray(paramType)) + postBuffer.append(" // fix me: conversion of array types!\n"); + else + { + postBuffer.append(" cpp_convert_b2u("); + postBuffer.append(paramName); + postBuffer.append(", _b_"); + postBuffer.append(paramName); + postBuffer.append(", m_bridge);\n"); + } + + break; + case RT_PARAM_OUT: + + callBuffer.append(", &_b_"); + + if (isArray(paramType)) + postBuffer.append(" // fix me: conversion of array types!\n"); + else + { + postBuffer.append(" cpp_convert_b2u("); + postBuffer.append(paramName); + if (isPassedAsPointer(paramType)) + postBuffer.append(", *_b_"); + else + postBuffer.append(", _b_"); + postBuffer.append(paramName); + postBuffer.append(", m_bridge);\n"); + } + + break; + } + + + callBuffer.append(paramName); + } + + callBuffer.append(", &_ev );\n"); + + if (!returnType.equals("void")) + { + if (isArray(returnType)) + { + postBuffer.append(" // fix me: conversion of array types!\n"); + } + else + { + if (isPassedAsPointer(returnType)) + postBuffer.append(" cpp_convert_b2u(_u_ret, *_b_ret, m_bridge);\n"); + else + postBuffer.append(" cpp_convert_b2u(_u_ret, _b_ret, m_bridge);\n"); + } + postBuffer.append(" return _u_ret;\n"); + } + + o << " ::vos::OGuard guard(m_bridge->getORBLock());\n" + << " CORBA_Environment _ev;\n" + << " CORBA_exception_init (&_ev);\n"; + + o << preBuffer; + o << callBuffer; + + o << " if (_ev._major != CORBA_NO_EXCEPTION) {\n" + << " ::com::sun::star::uno::RuntimeException _ex(::rtl::OUString::createFromAscii(\"exception raised in bonobobridge\"), NULL);\n" + << " CORBA_exception_free (&_ev);\n" + << " throw _ex;\n" + << " }\n" + << " CORBA_exception_free (&_ev);\n"; + + o << postBuffer; + + o << indent() << "}\n"; + } + else + o << " );\n"; + } +} + +void InterfaceType::dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly) +{ + OString superName(m_reader.getSuperTypeName()); + + sal_uInt32 methodCount = m_reader.getMethodCount(); + + OString methodName, returnType, paramType, paramName; + sal_uInt32 paramCount = 0; + sal_uInt32 excCount = 0; + RTMethodMode methodMode = RT_MODE_INVALID; + RTParamMode paramMode = RT_PARAM_INVALID; + + sal_Bool bRef = sal_False; + sal_Bool bConst = sal_False; + sal_Bool bWithRunTimeExcp = sal_True; + + for (sal_uInt16 i=0; i < methodCount; i++) + { + methodName = m_reader.getMethodName(i); + returnType = m_reader.getMethodReturnType(i); + paramCount = m_reader.getMethodParamCount(i); + excCount = m_reader.getMethodExcCount(i); + methodMode = m_reader.getMethodMode(i); + + o << indent() + << "extern \"C\" " + << printCorbaParameter(returnType); + + if (isPassedAsPointer(returnType)) + o << "*"; + + o << " bonobobridge_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "_" << methodName << "( PortableServer_Servant _servant, "; + + sal_uInt16 j; + for (j=0; j < paramCount; j++) + { + paramName = m_reader.getMethodParamName(i, j); + paramType = m_reader.getMethodParamType(i, j); + paramMode = m_reader.getMethodParamMode(i, j); + + if ((isPassedAsPointer(paramType) || paramType.equals("string") || isArray(paramType)) && + (paramMode == RT_PARAM_IN)) + o << "const "; + + o << printCorbaParameter(paramType); + + if (isPassedAsPointer(paramType)) + { + if (paramMode == RT_PARAM_OUT) + o << "**"; + else + o << "*"; + } + else + { + if (paramMode != RT_PARAM_IN) + o << "*"; + } + + + o << " " << paramName << ", "; + } + + o << "CORBA_Environment * _ev)"; + + if (bDeclOnly) + o << ";\n"; + else + { + o << " {\n"; + OStringBuffer preBuffer(1024); + OStringBuffer callBuffer(1024); + OStringBuffer postBuffer(1024); + + callBuffer.append(" "); + + preBuffer.append(" "); + preBuffer.append(printUnoType(m_typeName, sal_False, sal_False)); + preBuffer.append(" rThis(("); + preBuffer.append(printUnoType(m_typeName, sal_False, sal_False, sal_True)); + preBuffer.append(" *)((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getUnoObject());\n"); + + if (!returnType.equals("void")) + { + preBuffer.append(" "); + preBuffer.append(printCorbaParameter(returnType)); + if (isPassedAsPointer(returnType)) + { + preBuffer.append("* _b_ret = "); + preBuffer.append(printCorbaType(returnType, sal_False, sal_False)); + preBuffer.append("__alloc();\n"); + + } + else + { + preBuffer.append(" _b_ret;\n"); + } + preBuffer.append(" "); + preBuffer.append(printUnoType(returnType, sal_False, sal_False)); + preBuffer.append(" _u_ret;\n"); + + callBuffer.append("_u_ret = "); + } + + callBuffer.append("rThis->"); + callBuffer.append(methodName); + callBuffer.append("( "); + + for (j=0; j < paramCount; j++) + { + paramName = m_reader.getMethodParamName(i, j); + paramType = m_reader.getMethodParamType(i, j); + paramMode = m_reader.getMethodParamMode(i, j); + + preBuffer.append(" "); + preBuffer.append(printUnoType(paramType, sal_False, sal_False)); + preBuffer.append(" _u_"); + preBuffer.append(paramName); + preBuffer.append(";\n"); + + callBuffer.append("_u_"); + callBuffer.append(paramName); + + if (j < (paramCount-1)) + callBuffer.append(", "); + + switch (paramMode) { + case RT_PARAM_IN: + + if (isArray(paramType)) + preBuffer.append(" // fix me: conversion of array types!\n"); + else + { + preBuffer.append(" cpp_convert_b2u("); + preBuffer.append("_u_"); + preBuffer.append(paramName); + preBuffer.append(", "); + if (isPassedAsPointer(paramType)) + preBuffer.append("*"); + preBuffer.append(paramName); + preBuffer.append(", ((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getBridge());\n"); + } + break; + case RT_PARAM_INOUT: + + if (isArray(paramType)) + { + preBuffer.append(" // fix me: conversion of array types!\n"); + postBuffer.append(" // fix me: conversion of array types!\n"); + } + else + { + preBuffer.append(" cpp_convert_b2u("); + preBuffer.append("_u_"); + preBuffer.append(paramName); + preBuffer.append(", "); + if (isPassedAsPointer(paramType)) + preBuffer.append("*"); + preBuffer.append(paramName); + preBuffer.append(", ((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getBridge());\n"); + + postBuffer.append(" cpp_convert_u2b("); + if (isPassedAsPointer(paramType)) + postBuffer.append("*"); + postBuffer.append(paramName); + postBuffer.append(", _u_"); + postBuffer.append(paramName); + postBuffer.append(", ((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getBridge());\n"); + } + break; + case RT_PARAM_OUT: + + if (isArray(paramType)) + preBuffer.append(" // fix me: conversion of array types!\n"); + else + { + postBuffer.append(" cpp_convert_u2b("); + if (isPassedAsPointer(paramType)) + postBuffer.append("**"); + else + postBuffer.append("*"); + postBuffer.append(paramName); + postBuffer.append(", _u_"); + postBuffer.append(paramName); + postBuffer.append(", ((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getBridge());\n"); + } + break; + } + } + + callBuffer.append(" );\n"); + + if (!returnType.equals("void")) + { + if (isArray(returnType)) + postBuffer.append(" // fix me: conversion of array types!\n"); + else + { + if (isPassedAsPointer(returnType)) + postBuffer.append(" cpp_convert_u2b(*_b_ret, _u_ret, ((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getBridge());\n"); + else + postBuffer.append(" cpp_convert_u2b(_b_ret, _u_ret, ((bonobobridge::UNO_POA_com_sun_star_uno_XInterface*)_servant)->pThis->getBridge());\n"); + } + + postBuffer.append(" return _b_ret;\n"); + } + + o << preBuffer; + o << callBuffer; + o << postBuffer; + + o << "}\n"; + } + } +} + +void InterfaceType::dumpFunctions(FileStream& o) +{ + if (m_typeName.equals("com/sun/star/uno/XInterface") || + m_typeName.equals("Bonobo/NullInterface")) + return; + + m_generatedConversions->insert(m_typeName); + + o << "namespace bonobobridge {\n\n"; + + /* bonobo implementation class */ + o << "class BonoboWrapper_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + + OString superName(m_reader.getSuperTypeName()); + o << " : public BonoboWrapper< BonoboWrapper_"; + dumpCorbaType(o, superName, sal_False, sal_False); + o << ", "; + dumpUnoType(o, m_typeName, sal_False, sal_False, sal_True); + o << " > {\n"; + + o << "public: \n" + << " BonoboWrapper_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "("; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << " corbaObject," + << "const vos::ORef<bonobobridge::Bridge>& bridge)\n"; + + o << " : BonoboWrapper< " + << "BonoboWrapper_"; + dumpCorbaType(o, superName, sal_False, sal_False); + o << ", "; + dumpUnoType(o, m_typeName, sal_False, sal_False, sal_True); + o << " >(corbaObject, bridge) {\n"; + + if (isDerivedFromUnknown(m_typeName)) + { + o << " m_bridge->registerObjectWrapper(::getCppuType(("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*)NULL), m_corbaObject, ("; + dumpUnoType(o, m_typeName, sal_False, sal_False, sal_True); + o << "*)this);\n"; + } + + o << " }\n"; + + o << " virtual ~BonoboWrapper_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "() {\n"; + if (isDerivedFromUnknown(m_typeName)) + { + o << " m_bridge->unregisterObjectWrapper(::getCppuType(("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*)NULL), m_corbaObject, ("; + dumpUnoType(o, m_typeName, sal_False, sal_False, sal_True); + o << "*)this);\n"; + } + o << " }\n"; + inc(); + dumpUnoMethods(o, sal_True, sal_False); + dec(); + + o << "};\n\n"; + + o << "}; // namespace bonobobridge\n"; + + dumpUnoMethods(o, sal_False, sal_False); + + /* convert function bonobo to uno */ + o << "static sal_Bool convert_b2u_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " sal_Bool ret = sal_True;\n "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "& _u = *("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pOut;\n const "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "& _b = *(const "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n\n" + << " _u = new bonobobridge::BonoboWrapper_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "(_b, bridge);\n" + << " return ret;\n"; + + o << "}\n\n"; + + /* POA implementation class */ + dumpCorbaMethods(o, sal_True); + o << "static POA_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "__epv bonobobridge_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "_epv = {\n"; + sal_uInt32 methodCount = m_reader.getMethodCount(); + OString methodName; + + o << " NULL,\n"; + + for (sal_uInt16 i=0; i < methodCount; i++) + { + methodName = m_reader.getMethodName(i); + o << " bonobobridge_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "_" << methodName; + + if (i < (methodCount-1)) + o << ",\n"; + else + o << "\n};\n"; + } + + OStringBuffer initBuffer(1024); + + initBuffer.insert(0, OString("&bonobobridge_") + printCorbaType(m_typeName, sal_False, sal_False) + OString("_epv")); + + while(superName.getLength() != 0) + { + if (superName.equals("Bonobo/NullInterface")) + { + superName = ""; + } + else + { + if (superName.equals("com/sun/star/uno/XInterface")) + { + initBuffer.insert(0, OString("&bonobobridge_com_sun_star_uno_XInterface_epv, ")); + } + else + { + initBuffer.insert(0, OString("&bonobobridge_") + printCorbaType(superName, sal_False, sal_False) + OString("_epv, ")); + } + TypeReader reader(m_typeMgr.getTypeReader(superName)); + superName = reader.getSuperTypeName(); + } + } + + initBuffer.insert(0, OString("NULL, ")); + + o << "static POA_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "__vepv bonobobridge_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "__vepv = {"; + o << initBuffer.makeStringAndClear(); + o << " };\n"; + + superName = m_reader.getSuperTypeName(); + + o << "namespace bonobobridge {\n\n"; + + o << "class UnoServant_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << " : public UnoServant_com_sun_star_uno_XInterface {\n"; + + o << "public:\n" + << " UnoServant_"; + + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "("; + dumpUnoType(o, m_typeName, sal_False, sal_False, sal_True); + o << "* unoObject," + << " const ::vos::ORef<bonobobridge::Bridge>& bridge," + << " CORBA_Environment *ev," + << " sal_Bool bInitPoa)\n" + << " : UnoServant_com_sun_star_uno_XInterface(unoObject, bridge, ev, sal_False) {\n" + << " if (bInitPoa) {\n" + << " memset(&m_POAUnknown, 0, sizeof(m_POAUnknown));\n" + << " POA_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "__init((PortableServer_Servant) &(m_POAUnknown.poa), ev);\n" + << " m_POAUnknown.pThis = (UnoServant_com_sun_star_uno_XInterface*)this;\n" + << " m_POAUnknown.poa.vepv = (POA_Bonobo_Unknown__vepv*)&bonobobridge_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "__vepv;\n" + << " }\n" + << " }\n" + << "};\n" + << "}; // namespace bonobobridge\n"; + + dumpCorbaMethods(o, sal_False); + + /* convert function uno to bonobo */ + o << "static sal_Bool convert_u2b_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n"; + o << " sal_Bool ret = sal_True;\n const "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "& _u = *(const "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "& _b = *("; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pOut;\n\n" + << " if (_u.is()) {\n" + << " bonobobridge::UnoServant_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << " *uno_servant;\n" + << " POA_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << " *poa;\n" + << " CORBA_Environment ev;\n" + << " CORBA_exception_init (&ev);\n" + << " uno_servant = new bonobobridge::UnoServant_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "(_u.get(), bridge, &ev, sal_True);\n" + << " poa = (POA_"; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*)uno_servant->getPOA();\n" + << " if (ev._major != CORBA_NO_EXCEPTION) {\n" + << " delete uno_servant;\n" + << " CORBA_exception_free (&ev);\n" + << " _b = CORBA_OBJECT_NIL;\n" + << " ret = sal_False;\n" + << " }\n" + << " else {\n" + << " CORBA_free(PortableServer_POA_activate_object(bridge->getPOA(), poa, &ev));\n" + << " _b = PortableServer_POA_servant_to_reference (bridge->getPOA(), poa, &ev);\n" + << " uno_servant->corbaObjectRegistered(_b, getCppuType(("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*)NULL)"; + + if (!isDerivedFromUnknown(m_typeName)) + o << ", sal_False"; + + o << ");\n" + << " }\n" + << " CORBA_exception_free (&ev);\n" + << " }\n" + << " return ret;\n" + << "}\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_b2u("; + dumpUnoType(o, m_typeName, sal_False, sal_True); + o << " u, "; + dumpCorbaType(o, m_typeName, sal_True, sal_True); + o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return bridge->convertB2U(&u, &b, ::getCppuType(&u));\n" + << "};\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_u2b("; + dumpCorbaType(o, m_typeName, sal_False, sal_True); + o << " b, "; + dumpUnoType(o, m_typeName, sal_True, sal_True); + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return bridge->convertU2B(&b, &u, ::getCppuType(&u));\n" + << "};\n\n"; + + return; +} + + + + +sal_uInt32 InterfaceType::getMemberCount() +{ + sal_uInt32 count = m_reader.getMethodCount(); + + if (count) + m_hasMethods = sal_True; + + sal_uInt32 fieldCount = m_reader.getFieldCount(); + RTFieldAccess access = RT_ACCESS_INVALID; + for (sal_uInt16 i=0; i < fieldCount; i++) + { + access = m_reader.getFieldAccess(i); + + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) + { + m_hasAttributes = sal_True; + count++; + } + } + return count; +} + +sal_uInt32 InterfaceType::checkInheritedMemberCount(const TypeReader* pReader) +{ + sal_uInt32 cout = 0; + sal_Bool bSelfCheck = sal_True; + if (!pReader) + { + bSelfCheck = sal_False; + pReader = &m_reader; + } + + sal_uInt32 count = 0; + OString superType(pReader->getSuperTypeName()); + if (superType.getLength() > 0) + { + TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); + if (aSuperReader.isValid()) + { + count = checkInheritedMemberCount(&aSuperReader); + } + } + + if (bSelfCheck) + { + count += pReader->getMethodCount(); + sal_uInt32 fieldCount = pReader->getFieldCount(); + RTFieldAccess access = RT_ACCESS_INVALID; + for (sal_uInt16 i=0; i < fieldCount; i++) + { + access = pReader->getFieldAccess(i); + + if (access != RT_ACCESS_CONST && access != RT_ACCESS_INVALID) + count++; + } + } + + return count; +} + +sal_uInt32 InterfaceType::getInheritedMemberCount() +{ + if (m_inheritedMemberCount == 0) + { + m_inheritedMemberCount = checkInheritedMemberCount(0); + } + + return m_inheritedMemberCount; +} + + + + +//************************************************************************* +// ModuleType +//************************************************************************* +ModuleType::ModuleType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) +{ +} + +ModuleType::~ModuleType() +{ + +} + + +sal_Bool ModuleType::hasConstants() +{ + sal_uInt32 fieldCount = m_reader.getFieldCount(); + RTFieldAccess access = RT_ACCESS_INVALID; + + for (sal_uInt16 i=0; i < fieldCount; i++) + { + access = m_reader.getFieldAccess(i); + + if (access == RT_ACCESS_CONST) + return sal_True; + } + + return sal_False; +} + +void ModuleType::dumpFunctions(FileStream& o) +{ +}; + +sal_Bool ModuleType::dumpConversionFunctions(FileStream& o, TypeSet* allreadyDumped) + throw( CannotDumpException ) +{ + sal_Bool bSpecialDefine = sal_True; + + if (m_reader.getTypeClass() == RT_TYPE_CONSTANTS) + { + bSpecialDefine = sal_False; + } + + dumpInclude(o, allreadyDumped, m_typeName, "hpp", bSpecialDefine); + + return sal_True; +} + +//************************************************************************* +// ConstantsType +//************************************************************************* +ConstantsType::ConstantsType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : ModuleType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) +{ +} + +ConstantsType::~ConstantsType() +{ + +} + +void ConstantsType::dumpFunctions(FileStream& o) +{ +}; + +//************************************************************************* +// StructureType +//************************************************************************* +StructureType::StructureType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) +{ +} + +StructureType::~StructureType() +{ + +} + +void StructureType::dumpFunctions(FileStream& o) +{ + m_generatedConversions->insert(m_typeName); + + OString superType(m_reader.getSuperTypeName()); + + o << "static sal_Bool convert_b2u_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " sal_Bool ret = sal_True;\n "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "& _u = *("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pOut;\n const "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "& _b = *(const "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n\n"; + + sal_uInt32 fieldCount = m_reader.getFieldCount(); + OString fieldName; + OString fieldType; + sal_uInt16 i=0; + sal_Int32 cIndex; + OString corbaFieldName; + + sal_Bool bIsUnion = sal_False; + + for (i=0; !bIsUnion && (i < fieldCount); i++) + bIsUnion = OString("_union_fake_tag").equals(m_reader.getFieldName(i)); + + if (bIsUnion) + { + o << " // fix me: union !!!!\n ret = sal_False;\n"; + } + else + { + if (superType.getLength() > 0) + { + o << " ret = bonobobridge::cpp_convert_b2u(("; + dumpUnoType(o, superType, sal_False, sal_False); + o << "&) _u, (const "; + dumpCorbaType(o, superType, sal_False, sal_False); + o << "&) _b, bridge);\n"; + } + + for (i=0; i < fieldCount; i++) + { + fieldName = m_reader.getFieldName(i); + fieldType = m_reader.getFieldType(i); + cIndex = fieldName.indexOf("_reserved_identifier_"); + + if (cIndex == 0) + corbaFieldName = fieldName.copy(OString("_reserved_identifier_").getLength()); + else + corbaFieldName = fieldName; + + if (isArray(fieldType)) + o << " // fix me: no conversion of array types!\n"; + else + o << " if (ret)\n" + << " ret = bonobobridge::cpp_convert_b2u(" + << "_u." << fieldName.getStr() + << " , _b." << corbaFieldName.getStr() + << ", bridge);\n"; + } + } + o << " return ret;\n" + << "}\n\n" + << "static sal_Bool convert_u2b_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " sal_Bool ret = sal_True;\n const "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "& _u = *(const "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "& _b = *("; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pOut;\n\n"; + + if (bIsUnion) + o << " // fix me: union !!!!\n ret = sal_False;\n"; + else + { + if (superType.getLength() > 0) + { + o << " ret = bonobobridge::cpp_convert_u2b(("; + dumpCorbaType(o, superType, sal_False, sal_False); + o << "&) _u, (const "; + dumpUnoType(o, superType, sal_False, sal_False); + o << "&) _b, bridge);\n"; + } + + for (i=0; i < fieldCount; i++) + { + fieldName = m_reader.getFieldName(i); + fieldType = m_reader.getFieldType(i); + + cIndex = fieldName.indexOf("_reserved_identifier_"); + + if (cIndex == 0) + corbaFieldName = fieldName.copy(OString("_reserved_identifier_").getLength()); + else + corbaFieldName = fieldName; + + if (isArray(fieldType)) + o << " // fix me: no conversion of array types!\n"; + else + o << " if (ret)\n" + << " ret = bonobobridge::cpp_convert_u2b(" + << "_b." << corbaFieldName.getStr() + << ", _u." << fieldName.getStr() + << ", bridge);\n"; + } + } + + o << " return ret;\n" + << "}\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_b2u("; + dumpUnoType(o, m_typeName, sal_False, sal_True); + o << " u , "; + dumpCorbaType(o, m_typeName, sal_True, sal_True); + o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_b2u_" << m_typeName.replace('/', '_') + << "(&u, &b, ::getCppuType(&u), bridge);\n" + << "};\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_u2b("; + dumpCorbaType(o, m_typeName, sal_False, sal_True); + o << " b, "; + dumpUnoType(o, m_typeName, sal_True, sal_True); + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_u2b_" << m_typeName.replace('/', '_') + << "(&b, &u, ::getCppuType(&u), bridge);\n" + << "};\n\n"; +} + +sal_Bool StructureType::dumpSuperMember(FileStream& o, const OString& superType, sal_Bool bWithType) +{ + sal_Bool hasMember = sal_False; + + if (superType.getLength() > 0) + { + TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); + + if (aSuperReader.isValid()) + { + hasMember = dumpSuperMember(o, aSuperReader.getSuperTypeName(), bWithType); + + sal_uInt32 fieldCount = aSuperReader.getFieldCount(); + RTFieldAccess access = RT_ACCESS_INVALID; + OString fieldName; + OString fieldType; + for (sal_Int16 i=0; i < fieldCount; i++) + { + access = aSuperReader.getFieldAccess(i); + + if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID) + continue; + + fieldName = aSuperReader.getFieldName(i); + fieldType = aSuperReader.getFieldType(i); + + if (hasMember) + { + o << ", "; + } else + { + hasMember = (fieldCount > 0); + } + + if (bWithType) + { + dumpUnoType(o, fieldType, sal_True, sal_True); + o << " "; + } + o << "__" << fieldName; + } + } + } + + return hasMember; +} + +//************************************************************************* +// ExceptionType +//************************************************************************* +ExceptionType::ExceptionType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) +{ +} + +ExceptionType::~ExceptionType() +{ + +} + +void ExceptionType::dumpFunctions(FileStream& o) +{ + if (m_typeName.equals("com/sun/star/uno/Exception")) + return; + + if (m_typeName.equals("com/sun/star/uno/RuntimeException")) + return; + + m_generatedConversions->insert(m_typeName); + + OString superType(m_reader.getSuperTypeName()); + + o << "static sal_Bool convert_b2u_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " sal_Bool ret = sal_True;\n"; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "& _u = *("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pOut;\n const "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "& _b = *(const "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n\n"; + + sal_uInt32 fieldCount = m_reader.getFieldCount(); + OString fieldName; + OString fieldType; + sal_uInt16 i=0; + sal_Int32 cIndex; + OString corbaFieldName; + + if (superType.getLength() > 0) + { + o << " ret = bonobobridge::cpp_convert_b2u(("; + dumpUnoType(o, superType, sal_False, sal_False); + o << "&) _u, (const "; + dumpCorbaType(o, superType, sal_False, sal_False); + o << "&) _b, bridge);\n"; + } + + for (i=0; i < fieldCount; i++) + { + fieldName = m_reader.getFieldName(i); + fieldType = m_reader.getFieldType(i); + cIndex = fieldName.indexOf("_reserved_identifier_"); + + if (cIndex == 0) + corbaFieldName = fieldName.copy(OString("_reserved_identifier_").getLength()); + else + corbaFieldName = fieldName; + + if (isArray(fieldType)) + o << " // fix me: no conversion of array types!\n"; + else + o << " if (ret)\n" + << " ret = bonobobridge::cpp_convert_b2u(" + << "_u." << fieldName.getStr() + << ", _b." << corbaFieldName.getStr() + << ", bridge);\n"; + } + o << " return ret;\n" + << "}\n\n"; + + + o << "static sal_Bool convert_u2b_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " sal_Bool ret = sal_True;\n const "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "& _u = *(const "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "& _b = *("; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pOut;\n\n"; + + if (superType.getLength() > 0) + { + o << " ret = bonobobridge::cpp_convert_u2b(("; + dumpCorbaType(o, superType, sal_False, sal_False); + o << "&) _u, (const "; + dumpUnoType(o, superType, sal_False, sal_False); + o << "&) _b, bridge);\n"; + } + + for (i=0; i < fieldCount; i++) + { + fieldName = m_reader.getFieldName(i); + fieldType = m_reader.getFieldType(i); + + cIndex = fieldName.indexOf("_reserved_identifier_"); + + if (cIndex == 0) + corbaFieldName = fieldName.copy(OString("_reserved_identifier_").getLength()); + else + corbaFieldName = fieldName; + + if (isArray(fieldType)) + o << " // fix me: no conversion of array types!\n"; + else + o << " if (ret)\n" + << " ret = bonobobridge::cpp_convert_u2b(" + << "_b." << corbaFieldName.getStr() + << ", _u." << fieldName.getStr() + << ", bridge);\n"; + } + + o << " return ret;\n" + << "}\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_b2u("; + dumpUnoType(o, m_typeName, sal_False, sal_True); + o << " u , "; + dumpCorbaType(o, m_typeName, sal_True, sal_True); + o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_b2u_" << m_typeName.replace('/', '_') + << "(&u, &b, ::getCppuType(&u), bridge);\n" + << "};\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_u2b("; + dumpCorbaType(o, m_typeName, sal_False, sal_True); + o << " b, "; + dumpUnoType(o, m_typeName, sal_True, sal_True); + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_u2b_" << m_typeName.replace('/', '_') + << "(&b, &u, ::getCppuType(&u), bridge);\n" + << "};\n\n"; +} + + + +sal_Bool ExceptionType::dumpSuperMember(FileStream& o, const OString& superType, sal_Bool bWithType) +{ + sal_Bool hasMember = sal_False; + + if (superType.getLength() > 0) + { + TypeReader aSuperReader(m_typeMgr.getTypeReader(superType)); + + if (aSuperReader.isValid()) + { + hasMember = dumpSuperMember(o, aSuperReader.getSuperTypeName(), bWithType); + + sal_uInt32 fieldCount = aSuperReader.getFieldCount(); + RTFieldAccess access = RT_ACCESS_INVALID; + OString fieldName; + OString fieldType; + for (sal_uInt16 i=0; i < fieldCount; i++) + { + access = aSuperReader.getFieldAccess(i); + + if (access == RT_ACCESS_CONST || access == RT_ACCESS_INVALID) + continue; + + fieldName = aSuperReader.getFieldName(i); + fieldType = aSuperReader.getFieldType(i); + + if (hasMember) + { + o << ", "; + } else + { + hasMember = (fieldCount > 0); + } + + if (bWithType) + { + dumpUnoType(o, fieldType, sal_True, sal_True); + o << " "; + } + o << "__" << fieldName; + } + } + } + + return hasMember; +} + +//************************************************************************* +// EnumType +//************************************************************************* +EnumType::EnumType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) +{ +} + +EnumType::~EnumType() +{ + +} + +void EnumType::dumpFunctions(FileStream& o) +{ + if (m_typeName.equals("com/sun/star/uno/TypeClass")) + return; + + m_generatedConversions->insert(m_typeName); + + o << "static sal_Bool convert_b2u_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " *("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pOut = ("; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << ") *(const "; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n\n" + << " return sal_True;\n" + << "}\n\n"; + + o << "static sal_Bool convert_u2b_" << m_typeName.replace('/', '_') + << "(void* pOut, const void* pIn, const ::com::sun::star::uno::Type& type, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " *("; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << "*) pOut = ("; + dumpCorbaType(o, m_typeName, sal_False, sal_False); + o << ") *(const "; + dumpUnoType(o, m_typeName, sal_False, sal_False); + o << "*) pIn;\n\n" + << " return sal_True;\n" + << "}\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_b2u("; + dumpUnoType(o, m_typeName, sal_False, sal_True); + o << " u , "; + dumpCorbaType(o, m_typeName, sal_True, sal_True); + o << " b, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_b2u_" << m_typeName.replace('/', '_') + << "(&u, &b, ::getCppuType(&u), bridge);\n" + << "};\n\n"; + + o << "inline sal_Bool bonobobridge::cpp_convert_u2b("; + dumpCorbaType(o, m_typeName, sal_False, sal_True); + o << " b, "; + dumpUnoType(o, m_typeName, sal_True, sal_True); + o << " u, const ::vos::ORef< ::bonobobridge::Bridge >& bridge) {\n" + << " return convert_u2b_" << m_typeName.replace('/', '_') + << "(&b, &u, ::getCppuType(&u), bridge);\n" + << "};\n\n"; + + return; +} + + +//************************************************************************* +// TypeDefType +//************************************************************************* +TypeDefType::TypeDefType(TypeReader& typeReader, + const OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions) + : CorbaType(typeReader, typeName, typeMgr, typeDependencies, generatedConversions) +{ +} + +TypeDefType::~TypeDefType() +{ + +} + +void TypeDefType::dumpFunctions(FileStream& o) +{ +} + + + +//************************************************************************* +// produceType +//************************************************************************* +sal_Bool produceType(const OString& typeName, + TypeManager& typeMgr, + TypeDependency& typeDependencies, + CorbaOptions* pOptions, + FileStream& o, TypeSet* allreadyDumped, + TypeSet* generatedConversions) + throw( CannotDumpException ) +{ + sal_Bool bNewTypeSet = (allreadyDumped == NULL); + sal_Bool ret = sal_True; + + if (bNewTypeSet) + allreadyDumped = new TypeSet(); + + + if (!typeDependencies.isGenerated(typeName)) + { + TypeReader reader(typeMgr.getTypeReader(typeName)); + + if (!reader.isValid() && !typeName.equals("/")) + ret = sal_False; + + if( ret && !checkTypeDependencies(typeMgr, typeDependencies, typeName)) + ret = sal_False; + + if (ret) + { + RTTypeClass typeClass = reader.getTypeClass(); + + switch (typeClass) + { + case RT_TYPE_INTERFACE: + { + InterfaceType iType(reader, typeName, typeMgr, typeDependencies, generatedConversions); + ret = iType.dump(pOptions, o, allreadyDumped); + if (ret) typeDependencies.setGenerated(typeName); + ret = iType.dumpDependedTypes(pOptions, o, allreadyDumped); + } + break; + case RT_TYPE_MODULE: + { + ModuleType mType(reader, typeName, typeMgr, typeDependencies, generatedConversions); + if (mType.hasConstants()) + { + ret = mType.dump(pOptions, o, allreadyDumped); + if (ret) typeDependencies.setGenerated(typeName); + } else + { + typeDependencies.setGenerated(typeName); + ret = sal_True; + } + } + break; + case RT_TYPE_STRUCT: + { + StructureType sType(reader, typeName, typeMgr, typeDependencies, generatedConversions); + ret = sType.dump(pOptions, o, allreadyDumped); + if (ret) typeDependencies.setGenerated(typeName); + ret = sType.dumpDependedTypes(pOptions, o, allreadyDumped); + } + break; + case RT_TYPE_ENUM: + { + EnumType enType(reader, typeName, typeMgr, typeDependencies, generatedConversions); + ret = enType.dump(pOptions, o, allreadyDumped); + if (ret) typeDependencies.setGenerated(typeName); + ret = enType.dumpDependedTypes(pOptions, o, allreadyDumped); + } + break; + case RT_TYPE_EXCEPTION: + { + ExceptionType eType(reader, typeName, typeMgr, typeDependencies, generatedConversions); + ret = eType.dump(pOptions, o, allreadyDumped); + if (ret) typeDependencies.setGenerated(typeName); + ret = eType.dumpDependedTypes(pOptions, o, allreadyDumped); + } + break; + case RT_TYPE_TYPEDEF: + { + TypeDefType tdType(reader, typeName, typeMgr, typeDependencies, generatedConversions); + ret = tdType.dump(pOptions, o, allreadyDumped); + if (ret) typeDependencies.setGenerated(typeName); + ret = tdType.dumpDependedTypes(pOptions, o, allreadyDumped); + } + break; + case RT_TYPE_CONSTANTS: + { + ConstantsType cType(reader, typeName, typeMgr, typeDependencies, generatedConversions); + if (cType.hasConstants()) + { + ret = cType.dump(pOptions, o, allreadyDumped); + if (ret) typeDependencies.setGenerated(typeName); + } else + { + typeDependencies.setGenerated(typeName); + ret = sal_True; + } + } + break; + case RT_TYPE_SERVICE: + case RT_TYPE_OBJECT: + ret = sal_True; + break; + } + } + } + + if (bNewTypeSet) + delete allreadyDumped; + + return ret; +} + +//************************************************************************* +// scopedName +//************************************************************************* +OString scopedName(const OString& scope, const OString& type, + sal_Bool bNoNameSpace) +{ + sal_uInt32 count = type.getTokenCount('/'); + sal_uInt32 offset = 0; + + if (count == 1) + return type; + + if (bNoNameSpace) + return type.getToken(count - 1, '/'); + + OStringBuffer tmpBuf(type.getLength() + count); + for (int i=0; i < count; i++) + { + tmpBuf.append("::"); + tmpBuf.append(type.getToken(i, '/')); + } + + return tmpBuf.makeStringAndClear(); +} + +//************************************************************************* +// shortScopedName +//************************************************************************* +OString shortScopedName(const OString& scope, const OString& type, + sal_Bool bNoNameSpace) +{ + sal_uInt32 count = type.getTokenCount('/'); + sal_uInt32 offset = 0; + + if (count > 1) + offset = count - 1; + else + return OString(); + + if (bNoNameSpace) + return OString(); + + // scoped name only if the namespace is not equal + if (scope.lastIndexOf('/') > 0) + { + OString tmpScp(scope.copy(0, scope.lastIndexOf('/'))); + OString tmpScp2(type.copy(0, type.lastIndexOf('/'))); + + if (tmpScp == tmpScp2) + return OString(); + } + + OStringBuffer tmpBuf(type.lastIndexOf('/') + offset); + + for (int i=0; i < count - 1; i++) + { + tmpBuf.append("::"); + tmpBuf.append(type.getToken(i, '/')); + } + + return tmpBuf.makeStringAndClear(); +} + + diff --git a/codemaker/source/bonobowrappermaker/corbatype.hxx b/codemaker/source/bonobowrappermaker/corbatype.hxx new file mode 100644 index 000000000000..09308f7ef5f4 --- /dev/null +++ b/codemaker/source/bonobowrappermaker/corbatype.hxx @@ -0,0 +1,349 @@ +/************************************************************************* + * + * $RCSfile: corbatype.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: ts $ $Date: 2000-12-11 14:20:04 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (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.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _CORBAMAKER_CPPUTYPE_HXX_ +#define _CORBAMAKER_CPPUTYPE_HXX_ + +#ifndef _CODEMAKER_TYPEMANAGER_HXX_ +#include <codemaker/typemanager.hxx> +#endif + +#ifndef _CODEMAKER_DEPENDENCY_HXX_ +#include <codemaker/dependency.hxx> +#endif + +#include <hash_set> + +enum BASETYPE +{ + BT_INVALID, + BT_VOID, + BT_ANY, + BT_TYPE, + BT_BOOLEAN, + BT_CHAR, + BT_STRING, + BT_FLOAT, + BT_DOUBLE, + BT_OCTET, + BT_BYTE, + BT_SHORT, + BT_LONG, + BT_HYPER, + BT_UNSIGNED_SHORT, + BT_UNSIGNED_LONG, + BT_UNSIGNED_HYPER +}; + + +class CorbaOptions; +class FileStream; + +struct OStringEqual +{ + sal_Bool operator() (const ::rtl::OString& lhs, const ::rtl::OString& rhs) const + { return lhs.equals( rhs );} +}; + +struct OStringHash : public std::unary_function< const ::rtl::OString &, size_t > +{ + size_t operator()( const ::rtl::OString & rStr ) const + { return rStr.hashCode(); } +}; + +typedef std::hash_set< ::rtl::OString, OStringHash, OStringEqual > TypeSet; + +class CorbaType +{ +public: + CorbaType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversion); + + virtual ~CorbaType(); + + virtual sal_Bool dump(CorbaOptions* pOptions, FileStream& o, TypeSet* allreadyDumped) throw( CannotDumpException ); + virtual sal_Bool dumpDependedTypes(CorbaOptions* pOptions, FileStream& o, TypeSet* allreadyDumped) throw( CannotDumpException ); + virtual sal_Bool dumpConversionFunctions(FileStream& o, TypeSet* allreadyDumped) throw( CannotDumpException ); + + static void dumpDefaultHxxIncludes(FileStream& o); + + virtual void dumpInclude(FileStream& o, TypeSet* allreadyDumped, const ::rtl::OString& typeName, sal_Char* prefix, sal_Bool bExtended=sal_False, sal_Bool bCaseSensitive=sal_False); + virtual void dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const ::rtl::OString& typeName, sal_Char* prefix); + + virtual void dumpNameSpace(FileStream& o, sal_Bool bOpen = sal_True, sal_Bool bFull = sal_False, const ::rtl::OString& type=""); + virtual void dumpFunctions(FileStream& o) = 0; + + virtual ::rtl::OString printUnoType( const ::rtl::OString& type, + sal_Bool bConst=sal_False, + sal_Bool bRef=sal_False, + sal_Bool bNative=sal_False) + throw( CannotDumpException ); + + virtual void dumpUnoType(FileStream& o, + const ::rtl::OString& type, + sal_Bool bConst=sal_False, + sal_Bool bRef=sal_False, + sal_Bool bNative=sal_False) + throw( CannotDumpException ); + + virtual ::rtl::OString printCorbaType(const ::rtl::OString& type, + sal_Bool bConst, + sal_Bool bRef) + throw( CannotDumpException ); + + virtual void dumpCorbaType(FileStream& o, + const ::rtl::OString& type, + sal_Bool bConst=sal_False, + sal_Bool bRef=sal_False) + throw( CannotDumpException ); + + sal_Bool isPassedAsPointer(const ::rtl::OString& type); + sal_Bool isArray(const ::rtl::OString& type); + + sal_Bool isDerivedFromUnknown(const ::rtl::OString& typeName); + + + ::rtl::OString printCorbaParameter(const ::rtl::OString& type, + sal_Bool bOut = sal_False) + throw( CannotDumpException ); + + ::rtl::OString getTypeClass(const ::rtl::OString& type="", + sal_Bool bCStyle=sal_False); + ::rtl::OString getUnoBaseType(const ::rtl::OString& type); + ::rtl::OString getCorbaBaseType(const ::rtl::OString& type); + + void dumpTypeInit(FileStream& o, const ::rtl::OString& type); + BASETYPE isBaseType(const ::rtl::OString& type); + + ::rtl::OString typeToIdentifier(const ::rtl::OString& type); + + virtual sal_uInt32 getMemberCount(); + virtual sal_uInt32 getInheritedMemberCount(); + + sal_Bool isNestedTypeByName(const ::rtl::OString& type); + + void inc(sal_uInt32 num=4); + void dec(sal_uInt32 num=4); + ::rtl::OString indent(); + ::rtl::OString indent(sal_uInt32 num); +protected: + virtual sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader); + + ::rtl::OString checkSpecialCorbaType(const ::rtl::OString& type); + ::rtl::OString checkRealBaseType(const ::rtl::OString& type, sal_Bool bResolveTypeOnly = sal_False); + +protected: + sal_uInt32 m_inheritedMemberCount; + sal_uInt32 m_indentLength; + ::rtl::OString m_typeName; + ::rtl::OString m_name; + TypeReader m_reader; + TypeManager& m_typeMgr; + TypeDependency m_dependencies; + TypeSet* m_generatedConversions; +}; + +class InterfaceType : public CorbaType +{ +public: + InterfaceType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversion); + + virtual ~InterfaceType(); + + void dumpFunctions(FileStream& o); + + void dumpUnoMethods(FileStream& o, sal_Bool bDeclOnly, sal_Bool bDelegateToSuper); + void dumpCorbaMethods(FileStream& o, sal_Bool bDeclOnly); + + sal_uInt32 getMemberCount(); + sal_uInt32 getInheritedMemberCount(); + +protected: + sal_uInt32 checkInheritedMemberCount(const TypeReader* pReader); + +protected: + sal_uInt32 m_inheritedMemberCount; + sal_Bool m_hasAttributes; + sal_Bool m_hasMethods; +}; + +class ModuleType : public CorbaType +{ +public: + ModuleType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversion); + + virtual ~ModuleType(); + + sal_Bool dumpConversionFunctions(FileStream& o, TypeSet* allreadyDumped) throw( CannotDumpException ); + void dumpFunctions(FileStream& o); + sal_Bool hasConstants(); +}; + +class ConstantsType : public ModuleType +{ +public: + ConstantsType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversion); + + virtual ~ConstantsType(); + + void dumpFunctions(FileStream& o); +}; + +class StructureType : public CorbaType +{ +public: + StructureType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversion); + + virtual ~StructureType(); + + void dumpFunctions(FileStream& o); + + sal_Bool dumpSuperMember(FileStream& o, const ::rtl::OString& super, sal_Bool bWithType); +}; + +class ExceptionType : public CorbaType +{ +public: + ExceptionType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversions); + + virtual ~ExceptionType(); + + void dumpFunctions(FileStream& o); + + sal_Bool dumpSuperMember(FileStream& o, const ::rtl::OString& super, sal_Bool bWithType); +}; + +class EnumType : public CorbaType +{ +public: + EnumType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversion); + + virtual ~EnumType(); + + void dumpFunctions(FileStream& o); +}; + +class TypeDefType : public CorbaType +{ +public: + TypeDefType(TypeReader& typeReader, + const ::rtl::OString& typeName, + const TypeManager& typeMgr, + const TypeDependency& typeDependencies, + TypeSet* generatedConversion); + + virtual ~TypeDefType(); + + void dumpFunctions(FileStream& o); +}; + + +sal_Bool produceType(const ::rtl::OString& typeName, + TypeManager& typeMgr, + TypeDependency& typeDependencies, + CorbaOptions* pOptions, + FileStream& o, TypeSet* allreadyDumped, + TypeSet* generatedConversions) + throw( CannotDumpException ); + +/** + * This function returns a C++ scoped name, represents the namespace + * scoping of this type, e.g. com:.sun::star::uno::XInterface. If the scope of + * the type is equal scope, the relativ name will be used. + */ +::rtl::OString scopedName(const ::rtl::OString& scope, + const ::rtl::OString& type, + sal_Bool bNoNameSpace=sal_False); + +::rtl::OString shortScopedName(const ::rtl::OString& scope, + const ::rtl::OString& type, + sal_Bool bNoNameSpace=sal_False); + + +#endif // _CORBAMAKER_CPPUTYPE_HXX_ + diff --git a/codemaker/source/bonobowrappermaker/makefile.mk b/codemaker/source/bonobowrappermaker/makefile.mk new file mode 100644 index 000000000000..126e44feb83e --- /dev/null +++ b/codemaker/source/bonobowrappermaker/makefile.mk @@ -0,0 +1,105 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.1 $ +# +# last change: $Author: ts $ $Date: 2000-12-11 14:20:04 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library 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 for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (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.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* + +PRJ=..$/.. + +PRJNAME=codemaker +TARGET=bonobowrappermaker +TARGETTYPE=CUI +LIBTARGET=NO + +ENABLE_EXCEPTIONS=TRUE + +# --- Settings ----------------------------------------------------- +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk + +# --- Files -------------------------------------------------------- + + +CXXFILES= corbamaker.cxx \ + corbaoptions.cxx \ + corbatype.cxx + + +APP1TARGET= $(TARGET) + +APP1OBJS= $(OBJ)$/corbamaker.obj \ + $(OBJ)$/corbaoptions.obj \ + $(OBJ)$/corbatype.obj + +APP1STDLIBS=\ + $(SALLIB) \ + $(VOSLIB) \ + $(REGLIB) \ + $(STDLIBCPP) + +.IF "$(GUI)"=="WNT" +APP1STDLIBS+= \ + $(LIBCIMT) $(LIBCMT) +.ENDIF + +APP1LIBS= \ + $(LB)$/codemaker.lib + +.INCLUDE : target.mk |