diff options
author | Juergen Schmidt <jsc@openoffice.org> | 2001-08-17 12:15:48 +0000 |
---|---|---|
committer | Juergen Schmidt <jsc@openoffice.org> | 2001-08-17 12:15:48 +0000 |
commit | 289a31e4aa9a051f487e1051534b1becd3096f78 (patch) | |
tree | 2b5dba42e39d9de816c2713cdde428a6e633e04d | |
parent | 0e88bdfd89ecb42c8fa5393233f43f023e712181 (diff) |
#91088# convert registry path to URL
-rw-r--r-- | codemaker/source/bonobowrappermaker/corbamaker.cxx | 21 | ||||
-rw-r--r-- | codemaker/source/bonobowrappermaker/corbatype.cxx | 91 | ||||
-rw-r--r-- | codemaker/source/bonobowrappermaker/makefile.mk | 26 | ||||
-rw-r--r-- | codemaker/source/codemaker/global.cxx | 137 | ||||
-rw-r--r-- | codemaker/source/codemaker/typemanager.cxx | 12 | ||||
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 172 | ||||
-rw-r--r-- | codemaker/source/cppumaker/makefile.mk | 20 | ||||
-rw-r--r-- | codemaker/source/cunomaker/cunomaker.cxx | 15 | ||||
-rw-r--r-- | codemaker/source/cunomaker/cunotype.cxx | 179 | ||||
-rw-r--r-- | codemaker/source/cunomaker/makefile.mk | 26 | ||||
-rw-r--r-- | codemaker/source/idlmaker/idlmaker.cxx | 15 | ||||
-rw-r--r-- | codemaker/source/idlmaker/idltype.cxx | 183 | ||||
-rw-r--r-- | codemaker/source/idlmaker/makefile.mk | 21 | ||||
-rw-r--r-- | codemaker/source/javamaker/makefile.mk | 25 |
14 files changed, 508 insertions, 435 deletions
diff --git a/codemaker/source/bonobowrappermaker/corbamaker.cxx b/codemaker/source/bonobowrappermaker/corbamaker.cxx index ed193fdfda2d..69f605885c3a 100644 --- a/codemaker/source/bonobowrappermaker/corbamaker.cxx +++ b/codemaker/source/bonobowrappermaker/corbamaker.cxx @@ -3,9 +3,9 @@ * * $RCSfile: corbamaker.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: ts $ $Date: 2000-12-11 14:20:04 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -166,7 +166,7 @@ int _cdecl main( int argc, char * argv[] ) if (options.isValid("-O")) outPath = options.getOption("-O"); - cppFile.openFile(outPath); + cppFile.open(outPath); if(!cppFile.isValid()) { @@ -181,24 +181,25 @@ int _cdecl main( int argc, char * argv[] ) cppFile << "#include <" << corbaHeader - << ">" << endl << endl; + << ">\n\n"; CorbaType::dumpDefaultHxxIncludes(cppFile); - cppFile << endl; + cppFile << "\n"; } 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++) + sal_Int32 nIndex = 0; + do { - typeName = tOption.getToken(i, ';'); + typeName = tOption.getToken(0, ';', nIndex); - tmpName = typeName.getToken(typeName.getTokenCount('.') - 1, '.'); + sal_Int32 nPos = typeName.lastIndexOf( '.' ); + tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 ); if (tmpName == "*") { // produce this type and his scope, but the scope is not recursively generated. @@ -227,7 +228,7 @@ int _cdecl main( int argc, char * argv[] ) OString("cannot dump Type '" + typeName + "'").getStr()); exit(99); } - } + } while( nIndex != -1 ); } else { // produce all types diff --git a/codemaker/source/bonobowrappermaker/corbatype.cxx b/codemaker/source/bonobowrappermaker/corbatype.cxx index 1ee9611317f0..6280b7f954a0 100644 --- a/codemaker/source/bonobowrappermaker/corbatype.cxx +++ b/codemaker/source/bonobowrappermaker/corbatype.cxx @@ -2,9 +2,9 @@ * * $RCSfile: corbatype.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jsc $ $Date: 2001-04-11 07:27:38 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:47 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,12 +92,13 @@ CorbaType::CorbaType(TypeReader& typeReader, : 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) { + sal_Int32 i = typeName.lastIndexOf('/'); + m_name = typeName.copy( i != -1 ? i+1 : 0 ); } CorbaType::~CorbaType() @@ -262,7 +263,7 @@ void CorbaType::dumpInclude(FileStream& o, TypeSet* allreadyDumped, const OStrin tmpBuf.append(prefix); tmpBuf.append('_'); - OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toUpperCase()); + OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase()); length = 1 + typeName.getLength() + strlen(prefix); if (bExtended) @@ -321,7 +322,7 @@ void CorbaType::dumpInclude(FileStream& o, TypeSet* allreadyDumped, const OStrin RegistryKey key = m_typeMgr.getTypeKey(realTypeName); RegistryKeyNames nestedTypeNames; key.getKeyNames(OUString(), nestedTypeNames); - for (sal_Int32 i = 0; i < nestedTypeNames.getLength(); i++) + for (sal_uInt32 i = 0; i < nestedTypeNames.getLength(); i++) { OString nTypeName(OUStringToOString(nestedTypeNames.getElement(i), RTL_TEXTENCODING_UTF8)); @@ -357,7 +358,7 @@ void CorbaType::dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const OS TypeUsingSet::const_iterator iter = usingSet.begin(); - OString sPrefix(OString(prefix).toUpperCase()); + OString sPrefix(OString(prefix).toAsciiUpperCase()); sal_Bool bSequenceDumped = sal_False; sal_Bool bInterfaceDumped = sal_False; sal_uInt32 index = 0; @@ -396,7 +397,7 @@ void CorbaType::dumpDepIncludes(FileStream& o, TypeSet* allreadyDumped, const OS if (!((*iter).m_use & TYPEUSE_SUPER)) { - o << endl; + o << "\n"; dumpNameSpace(o, sal_True, sal_False, relType); o << "\nclass " << scopedName(m_typeName, relType, sal_True) << ";\n"; dumpNameSpace(o, sal_False, sal_False, relType); @@ -428,33 +429,37 @@ void CorbaType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, con if (typeName == "/") return; - sal_uInt32 count = typeName.getTokenCount('/'); - - if (count == 1 && !bFull) + if (typeName.indexOf( '/' ) == -1 && !bFull) return; - if (!bFull) count--; + if (!bFull) + typeName = typeName.copy( 0, typeName.lastIndexOf( '/' ) ); if (bOpen) { - for (int i=0; i < count; i++) + sal_Int32 nIndex = 0; + do { - o << "namespace " << typeName.getToken(i, '/'); + o << "namespace " << typeName.getToken(0, '/', nIndex); if (bOneLine) o << " { "; else o << "\n{\n"; - } + } while( nIndex != -1 ); } else { - for (int i=count-1; i >= 0; i--) + sal_Int32 nPos = 0; + do { + nPos = typeName.lastIndexOf( '/' ); o << "}"; - if (bOneLine) + if( bOneLine ) o << " "; else - o << " // " << typeName.getToken(i, '/') << "\n"; - } + o << " // " << typeName.copy( nPos+1 ) << "\n"; + if( nPos != -1 ) + typeName = typeName.copy( 0, nPos ); + } while( nPos != -1 ); } } @@ -620,7 +625,7 @@ OString CorbaType::printUnoType(const OString& type, sal_Bool bConst, sal_Bool b if (bConst) ret.append("const "); - int i; + sal_uInt32 i; for (i=0; i < seqNum; i++) { ret.append("::com::sun::star::uno::Sequence< "); @@ -698,7 +703,7 @@ OString CorbaType::printCorbaType(const OString& type, sal_Bool bConst, sal_Bool if (bConst) ret.append("const "); - int i; + sal_uInt32 i; for (i=0; i < seqNum; i++) { ret.append("CORBA_sequence_"); @@ -1018,8 +1023,9 @@ void CorbaType::dumpTypeInit(FileStream& o, const OString& typeName) if ( reader.isValid() ) { + sal_Int32 nPos = type.lastIndexOf( '/' ); o << "(" << shortScopedName("", type, sal_False) - << "::" << type.getToken(type.getTokenCount('/') - 1, '/') + << "::" << type.copy( nPos != -1 ? nPos+1 : 0 ) << "_" << reader.getFieldName(0) << ")"; return; } @@ -1185,7 +1191,7 @@ OString CorbaType::indent() { OStringBuffer tmp(m_indentLength); - for (int i=0; i < m_indentLength; i++) + for (sal_uInt32 i=0; i < m_indentLength; i++) { tmp.append(' '); } @@ -1196,7 +1202,7 @@ OString CorbaType::indent(sal_uInt32 num) { OStringBuffer tmp(m_indentLength + num); - for (int i=0; i < m_indentLength + num; i++) + for (sal_uInt32 i=0; i < m_indentLength + num; i++) { tmp.append(' '); } @@ -2317,7 +2323,7 @@ sal_Bool StructureType::dumpSuperMember(FileStream& o, const OString& superType, RTFieldAccess access = RT_ACCESS_INVALID; OString fieldName; OString fieldType; - for (sal_Int16 i=0; i < fieldCount; i++) + for (sal_uInt16 i=0; i < fieldCount; i++) { access = aSuperReader.getFieldAccess(i); @@ -2758,21 +2764,20 @@ sal_Bool produceType(const OString& typeName, OString scopedName(const OString& scope, const OString& type, sal_Bool bNoNameSpace) { - sal_uInt32 count = type.getTokenCount('/'); - sal_uInt32 offset = 0; - - if (count == 1) + sal_Int32 nPos = type.lastIndexOf( '/' ); + if (nPos == -1) return type; if (bNoNameSpace) - return type.getToken(count - 1, '/'); + return type.copy(nPos+1); - OStringBuffer tmpBuf(type.getLength() + count); - for (int i=0; i < count; i++) + OStringBuffer tmpBuf(type.getLength()*2); + nPos = 0; + do { tmpBuf.append("::"); - tmpBuf.append(type.getToken(i, '/')); - } + tmpBuf.append(type.getToken(0, '/', nPos)); + } while( nPos != -1 ); return tmpBuf.makeStringAndClear(); } @@ -2783,12 +2788,8 @@ OString scopedName(const OString& scope, const OString& type, 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 + sal_Int32 nPos = type.lastIndexOf( '/' ); + if( nPos == -1 ) return OString(); if (bNoNameSpace) @@ -2798,19 +2799,21 @@ OString shortScopedName(const OString& scope, const OString& type, if (scope.lastIndexOf('/') > 0) { OString tmpScp(scope.copy(0, scope.lastIndexOf('/'))); - OString tmpScp2(type.copy(0, type.lastIndexOf('/'))); + OString tmpScp2(type.copy(0, nPos)); if (tmpScp == tmpScp2) return OString(); } - OStringBuffer tmpBuf(type.lastIndexOf('/') + offset); + OString aScope( type.copy( 0, nPos ) ); + OStringBuffer tmpBuf(aScope.getLength()*2); - for (int i=0; i < count - 1; i++) + nPos = 0; + do { tmpBuf.append("::"); - tmpBuf.append(type.getToken(i, '/')); - } + tmpBuf.append(aScope.getToken(0, '/', nPos)); + } while( nPos != -1 ); return tmpBuf.makeStringAndClear(); } diff --git a/codemaker/source/bonobowrappermaker/makefile.mk b/codemaker/source/bonobowrappermaker/makefile.mk index 6caf077b5ae6..6d779ca54e04 100644 --- a/codemaker/source/bonobowrappermaker/makefile.mk +++ b/codemaker/source/bonobowrappermaker/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: jsc $ $Date: 2001-03-13 12:04:23 $ +# last change: $Author: jsc $ $Date: 2001-08-17 13:15:47 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -78,28 +78,22 @@ ENABLE_EXCEPTIONS=TRUE CXXFILES= corbamaker.cxx \ - corbaoptions.cxx \ - corbatype.cxx + corbaoptions.cxx \ + corbatype.cxx APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/corbamaker.obj \ - $(OBJ)$/corbaoptions.obj \ - $(OBJ)$/corbatype.obj +APP1OBJS= $(OBJ)$/corbamaker.obj \ + $(OBJ)$/corbaoptions.obj \ + $(OBJ)$/corbatype.obj -APP1STDLIBS=\ +APP1STDLIBS= \ $(SALLIB) \ $(SALHELPERLIB) \ - $(REGLIB) \ - $(STDLIBCPP) - -.IF "$(GUI)"=="WNT" -APP1STDLIBS+= \ - $(LIBCIMT) $(LIBCMT) -.ENDIF + $(REGLIB) APP1LIBS= \ - $(LB)$/codemaker.lib + $(LB)$/codemaker.lib .INCLUDE : target.mk diff --git a/codemaker/source/codemaker/global.cxx b/codemaker/source/codemaker/global.cxx index f1285684b204..c273c6efacf8 100644 --- a/codemaker/source/codemaker/global.cxx +++ b/codemaker/source/codemaker/global.cxx @@ -2,9 +2,9 @@ * * $RCSfile: global.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: jsc $ $Date: 2001-06-20 15:25:24 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,13 @@ #include <rtl/ustring.hxx> #endif +#ifndef _OSL_THREAD_H_ +#include <osl/thread.h> +#endif +#ifndef _OSL_FILE_HXX_ +#include <osl/file.hxx> +#endif + #include <stdlib.h> #include <stdio.h> #if defined(SAL_W32) || defined(SAL_OS2) @@ -86,7 +93,14 @@ #include <codemaker/global.hxx> #endif -using namespace rtl; +#ifdef SAL_UNX +#define SEPARATOR '/' +#else +#define SEPARATOR '\\' +#endif + +using namespace ::rtl; +using namespace ::osl; OString makeTempName(sal_Char* prefix) { @@ -316,6 +330,35 @@ const OString inGlobalSet(const OUString & rValue) return *(aGlobalMap.insert( sValue ).first); } +static sal_Bool isFileUrl(const OString& fileName) +{ + if (fileName.indexOf("file://") == 0 ) + return sal_True; + return sal_False; +} + +OUString convertToFileUrl(const OString& fileName) +{ + if ( isFileUrl(fileName) ) + { + return OStringToOUString(fileName, osl_getThreadTextEncoding()); + } + + OUString uUrlFileName; + OUString uFileName(fileName.getStr(), fileName.getLength(), osl_getThreadTextEncoding()); + if ( fileName.indexOf('.') == 0 || fileName.indexOf(SEPARATOR) < 0 ) + { + OUString uWorkingDir; + OSL_VERIFY( osl_getProcessWorkingDir(&uWorkingDir.pData) == osl_Process_E_None ); + OSL_VERIFY( FileBase::getAbsoluteFileURL(uWorkingDir, uFileName, uUrlFileName) == FileBase::E_None ); + } else + { + OSL_VERIFY( FileBase::getFileURLFromSystemPath(uFileName, uUrlFileName) == FileBase::E_None ); + } + + return uUrlFileName; +} + //************************************************************************* // FileStream @@ -324,59 +367,85 @@ FileStream::FileStream() { } -FileStream::FileStream(const OString& name, sal_Int32 nMode) - : ofstream(name, nMode) - , m_name(name) +FileStream::FileStream(const OString& name, FileAccessMode mode) + : m_pFile(NULL) { + if ( name.getLength() > 0 ) + { + m_name = name; + m_pFile = fopen(m_name, checkAccessMode(mode)); + } } FileStream::~FileStream() { - flush(); - close(); + if ( isValid() ) + { + fflush(m_pFile); + fclose(m_pFile); + } } sal_Bool FileStream::isValid() { -#if defined(SAL_UNX) || defined(SAL_OS2) || !defined(__STL_NO_NEW_IOSTREAMS) -#if STLPORT_VERSION < 400 - if(rdbuf()->fd() < 0) -#else - if( !is_open() ) -#endif -#else - if(fd() < 0) -#endif - { - return sal_False; - } + if ( m_pFile ) + return sal_True; - return sal_True; + return sal_False; } -void FileStream::openFile(const OString& name, sal_Int32 nMode) +void FileStream::open(const OString& name, FileAccessMode mode) { if ( name.getLength() > 0 ) + { m_name = name; - - if ( m_name.getLength() > 0 ) - open(m_name, nMode); + m_pFile = fopen(m_name, checkAccessMode(mode)); + } } -void FileStream::closeFile() +void FileStream::close() { - flush(); - close(); + if ( isValid() ) + { + fflush(m_pFile); + fclose(m_pFile); + m_pFile = NULL; + m_name = OString(); + } } sal_Int32 FileStream::getSize() { - flush(); - - FILE* f = fopen(m_name, "r"); + sal_Int32 pos = 0; sal_Int32 size = 0; - if (!fseek(f, 0, SEEK_END)) - size = ftell(f); - fclose(f); + if ( isValid() ) + { + fflush(m_pFile); + pos = ftell(m_pFile); + if (!fseek(m_pFile, 0, SEEK_END)) + size = ftell(m_pFile); + fseek(m_pFile, pos, SEEK_SET); + } return size; } + +const sal_Char* FileStream::checkAccessMode(FileAccessMode mode) +{ + switch( mode ) + { + case FAM_READ: + return "r"; + case FAM_WRITE: + return "w"; + case FAM_APPEND: + return "a"; + case FAM_READWRITE_EXIST: + return "r+"; + case FAM_READWRITE: + return "w+"; + case FAM_READAPPEND: + return "a+"; + } + return "w+"; +} + diff --git a/codemaker/source/codemaker/typemanager.cxx b/codemaker/source/codemaker/typemanager.cxx index ea343c7d412c..353845a9255b 100644 --- a/codemaker/source/codemaker/typemanager.cxx +++ b/codemaker/source/codemaker/typemanager.cxx @@ -2,9 +2,9 @@ * * $RCSfile: typemanager.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jsc $ $Date: 2001-04-11 07:27:04 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,7 +189,7 @@ sal_Bool RegistryTypeManager::init(sal_Bool bMerged, const StringVector& regFile Registry tmpReg(loader); while (iter != regFiles.end()) { - if (!tmpReg.open( OStringToOUString(*iter, RTL_TEXTENCODING_UTF8), REG_READONLY)) + if (!tmpReg.open( convertToFileUrl(*iter), REG_READONLY)) m_pImpl->m_registries.push_back(new Registry(tmpReg)); else { @@ -204,7 +204,7 @@ sal_Bool RegistryTypeManager::init(sal_Bool bMerged, const StringVector& regFile Registry *pTmpReg = new Registry(loader); OString tmpName(makeTempName(NULL)); - if (!pTmpReg->create( OStringToOUString(tmpName, RTL_TEXTENCODING_UTF8) ) ) + if (!pTmpReg->create( convertToFileUrl(tmpName) ) ) { RegistryKey rootKey; RegError ret = REG_NO_ERROR; @@ -214,7 +214,7 @@ sal_Bool RegistryTypeManager::init(sal_Bool bMerged, const StringVector& regFile while (iter != regFiles.end()) { - if ( ret = pTmpReg->mergeKey(rootKey, aRoot, OUString::createFromAscii( *iter )) ) + if ( ret = pTmpReg->mergeKey(rootKey, aRoot, convertToFileUrl( *iter )) ) { if (ret != REG_MERGE_CONFLICT) { @@ -353,4 +353,4 @@ RegistryKey RegistryTypeManager::searchTypeKey(const OString& name) return key; } -
\ No newline at end of file + diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 6e9cf1424873..ac52c42fff22 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cpputype.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: jsc $ $Date: 2001-05-17 13:51:27 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -191,9 +191,9 @@ sal_Bool CppuType::dump(CppuOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -204,7 +204,7 @@ sal_Bool CppuType::dump(CppuOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -232,9 +232,9 @@ sal_Bool CppuType::dump(CppuOptions* pOptions) FileStream hxxFile; if ( bFileCheck ) - hxxFile.openFile(tmpFileName); + hxxFile.open(tmpFileName); else - hxxFile.openFile(hxxFileName); + hxxFile.open(hxxFileName); if(!hxxFile.isValid()) { @@ -245,7 +245,7 @@ sal_Bool CppuType::dump(CppuOptions* pOptions) ret = dumpHxxFile(hxxFile); - hxxFile.closeFile(); + hxxFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hxxFileName, tmpFileName); @@ -317,7 +317,7 @@ OString CppuType::dumpHeaderDefine(FileStream& o, sal_Char* prefix, sal_Bool bEx OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase()); - o << "#ifndef " << tmp << "\n#define " << tmp << endl; + o << "#ifndef " << tmp << "\n#define " << tmp << "\n"; return tmp; } @@ -466,7 +466,7 @@ void CppuType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* iLastS = outerNamespace.lastIndexOf('/'); OString outerClass(outerNamespace.copy(iLastS+1)); - o << endl; + o << "\n"; dumpNameSpace(o, sal_True, sal_False, outerNamespace); o << "\nclass " << outerClass << "::" << innerClass << ";\n"; dumpNameSpace(o, sal_False, sal_False, outerNamespace); @@ -474,7 +474,7 @@ void CppuType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* } else { - o << endl; + o << "\n"; dumpNameSpace(o, sal_True, sal_False, relType); o << "\nclass " << scopedName(m_typeName, relType, sal_True) << ";\n"; dumpNameSpace(o, sal_False, sal_False, relType); @@ -536,7 +536,7 @@ void CppuType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); dumpDepIncludes(o, nestedName, prefix); } @@ -721,7 +721,7 @@ void CppuType::dumpGetCppuType(FileStream& o) o << indent() << "aMemberRefs[" << i << "] = rMemberType_" << modFieldType/*i*/ << ".getTypeLibType();\n"; } - o << endl; + o << "\n"; } o << indent() << "typelib_static_compound_type_init( &s_pType_" << typeName << ", " @@ -1501,12 +1501,12 @@ sal_Bool InterfaceType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpNameSpace(o); dumpDeclaration(o); dumpNameSpace(o, sal_False); @@ -1529,7 +1529,7 @@ sal_Bool InterfaceType::dumpHFile(FileStream& o) { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); nestedName = checkRealBaseType(nestedName.copy(5)); @@ -1547,7 +1547,7 @@ sal_Bool InterfaceType::dumpHFile(FileStream& o) } } - o << "#endif // "<< headerDefine << endl; + o << "#endif // "<< headerDefine << "\n"; return sal_True; } @@ -1570,7 +1570,7 @@ sal_Bool InterfaceType::dumpDeclaration(FileStream& o) { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); nestedName = nestedName.copy(5); @@ -1635,16 +1635,16 @@ sal_Bool InterfaceType::dumpHxxFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HPP")); - o << endl; + o << "\n"; dumpInclude(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpDefaultHxxIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hpp"); - o << endl; + o << "\n"; dumpGetCppuType(o); @@ -1655,7 +1655,7 @@ sal_Bool InterfaceType::dumpHxxFile(FileStream& o) { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); nestedName = nestedName.copy(5); @@ -1704,7 +1704,7 @@ sal_Bool InterfaceType::dumpHxxFile(FileStream& o) } } - o << "\n#endif // "<< headerDefine << endl; + o << "\n#endif // "<< headerDefine << "\n"; return sal_True; } @@ -2037,7 +2037,7 @@ void InterfaceType::dumpCGetCppuType(FileStream& o) // if (superType.getLength() > 0) // o << indent() << "typelib_typedescription_release( pSuperTD );\n\n"; // else -// o << endl; +// o << "\n"; o << "#if ! ((defined(__SUNPRO_CC) && (__SUNPRO_CC == 0x500)) || (defined(__GNUC__) && defined(__APPLE__)))\n"; o << indent() << "static ::com::sun::star::uno::Type aType_" << typeName << "( " @@ -2491,9 +2491,9 @@ sal_Bool ModuleType::dump(CppuOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -2504,7 +2504,7 @@ sal_Bool ModuleType::dump(CppuOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -2533,9 +2533,9 @@ sal_Bool ModuleType::dump(CppuOptions* pOptions) FileStream hxxFile; if ( bFileCheck ) - hxxFile.openFile(tmpFileName); + hxxFile.open(tmpFileName); else - hxxFile.openFile(hxxFileName); + hxxFile.open(hxxFileName); if(!hxxFile.isValid()) { @@ -2546,7 +2546,7 @@ sal_Bool ModuleType::dump(CppuOptions* pOptions) ret = dumpHxxFile(hxxFile); - hxxFile.closeFile(); + hxxFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hxxFileName, tmpFileName); @@ -2567,21 +2567,21 @@ sal_Bool ModuleType::dumpHFile(FileStream& o) } OString headerDefine(dumpHeaderDefine(o, "HDL", bSpecialDefine)); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpNameSpace(o, sal_True, sal_True); - o << endl; + o << "\n"; dumpDeclaration(o); - o << endl; + o << "\n"; dumpNameSpace(o, sal_False, sal_True); - o << "\n#endif // "<< headerDefine << endl; + o << "\n#endif // "<< headerDefine << "\n"; return sal_True; } @@ -2640,11 +2640,11 @@ sal_Bool ModuleType::dumpHxxFile(FileStream& o) } OString headerDefine(dumpHeaderDefine(o, "HPP", bSpecialDefine)); - o << endl; + o << "\n"; dumpInclude(o, m_typeName, "hdl", bSpecialDefine); - o << "\n#endif // "<< headerDefine << endl; + o << "\n#endif // "<< headerDefine << "\n"; return sal_True; } @@ -2700,9 +2700,9 @@ sal_Bool ConstantsType::dump(CppuOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -2713,7 +2713,7 @@ sal_Bool ConstantsType::dump(CppuOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -2741,9 +2741,9 @@ sal_Bool ConstantsType::dump(CppuOptions* pOptions) FileStream hxxFile; if ( bFileCheck ) - hxxFile.openFile(tmpFileName); + hxxFile.open(tmpFileName); else - hxxFile.openFile(hxxFileName); + hxxFile.open(hxxFileName); if(!hxxFile.isValid()) { @@ -2754,7 +2754,7 @@ sal_Bool ConstantsType::dump(CppuOptions* pOptions) ret = dumpHxxFile(hxxFile); - hxxFile.closeFile(); + hxxFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hxxFileName, tmpFileName); @@ -2784,12 +2784,12 @@ sal_Bool StructureType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -2808,7 +2808,7 @@ sal_Bool StructureType::dumpHFile(FileStream& o) dumpType(o, m_typeName, sal_True, sal_False); o << "* ) SAL_THROW( () );\n\n"; - o << "#endif // "<< headerDefine << endl; + o << "#endif // "<< headerDefine << "\n"; return sal_True; } @@ -2895,19 +2895,19 @@ sal_Bool StructureType::dumpHxxFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HPP")); - o << endl; + o << "\n"; dumpInclude(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpDefaultHxxIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hpp"); - o << endl; + o << "\n"; dumpNameSpace(o); - o << endl; + o << "\n"; o << "inline " << m_name << "::" << m_name << "() SAL_THROW( () )\n"; inc(); @@ -2944,7 +2944,7 @@ sal_Bool StructureType::dumpHxxFile(FileStream& o) o << fieldName; dumpTypeInit(o, fieldType); - o << endl; + o << "\n"; } dec(); o << "{\n}\n\n"; @@ -3010,10 +3010,10 @@ sal_Bool StructureType::dumpHxxFile(FileStream& o) dumpNameSpace(o, sal_False); - o << endl; + o << "\n"; dumpGetCppuType(o); - o << "\n#endif // "<< headerDefine << endl; + o << "\n#endif // "<< headerDefine << "\n"; return sal_True; } @@ -3135,12 +3135,12 @@ sal_Bool ExceptionType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -3159,7 +3159,7 @@ sal_Bool ExceptionType::dumpHFile(FileStream& o) dumpType(o, m_typeName, sal_True, sal_False); o << "* ) SAL_THROW( () );\n\n"; - o << "#endif // "<< headerDefine << endl; + o << "#endif // "<< headerDefine << "\n"; return sal_True; } @@ -3236,19 +3236,19 @@ sal_Bool ExceptionType::dumpHxxFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HPP")); - o << endl; + o << "\n"; dumpInclude(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpDefaultHxxIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hpp"); - o << endl; + o << "\n"; dumpNameSpace(o); - o << endl; + o << "\n"; o << "inline " << m_name << "::" << m_name << "() SAL_THROW( () )\n"; inc(); @@ -3285,7 +3285,7 @@ sal_Bool ExceptionType::dumpHxxFile(FileStream& o) o << fieldName; dumpTypeInit(o, fieldType); - o << endl; + o << "\n"; } dec(); if ( !m_cppuTypeDynamic ) @@ -3371,10 +3371,10 @@ sal_Bool ExceptionType::dumpHxxFile(FileStream& o) dumpNameSpace(o, sal_False); - o << endl; + o << "\n"; dumpGetCppuType(o); - o << "\n#endif // "<< headerDefine << endl; + o << "\n#endif // "<< headerDefine << "\n"; return sal_True; } @@ -3495,10 +3495,10 @@ sal_Bool EnumType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -3517,7 +3517,7 @@ sal_Bool EnumType::dumpHFile(FileStream& o) dumpType(o, m_typeName, sal_True, sal_False); o << "* ) SAL_THROW( () );\n\n"; - o << "#endif // "<< headerDefine << endl; + o << "#endif // "<< headerDefine << "\n"; return sal_True; } @@ -3563,17 +3563,17 @@ sal_Bool EnumType::dumpHxxFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HPP")); - o << endl; + o << "\n"; dumpInclude(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpDefaultHxxIncludes(o); - o << endl; + o << "\n"; dumpGetCppuType(o); - o << "\n#endif // "<< headerDefine << endl; + o << "\n#endif // "<< headerDefine << "\n"; return sal_True; } @@ -3744,12 +3744,12 @@ sal_Bool TypeDefType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -3762,7 +3762,7 @@ sal_Bool TypeDefType::dumpHFile(FileStream& o) // o << "inline const ::com::sun::star::uno::Type& SAL_CALL get_" << m_typeName.replace('/', '_') // << "_Type( ) SAL_THROW( () );\n\n"; - o << "#endif // "<< headerDefine << endl; + o << "#endif // "<< headerDefine << "\n"; return sal_True; } @@ -3781,18 +3781,18 @@ sal_Bool TypeDefType::dumpHxxFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "HPP")); - o << endl; + o << "\n"; dumpInclude(o, m_typeName, "hdl"); - o << endl; + o << "\n"; dumpDefaultHxxIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "hpp"); - o << endl; + o << "\n"; dumpGetCppuType(o); - o << "\n#endif // "<< headerDefine << endl; + o << "\n#endif // "<< headerDefine << "\n"; return sal_True; } diff --git a/codemaker/source/cppumaker/makefile.mk b/codemaker/source/cppumaker/makefile.mk index cb5745a4f16d..af7c75f9fb95 100644 --- a/codemaker/source/cppumaker/makefile.mk +++ b/codemaker/source/cppumaker/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.4 $ +# $Revision: 1.5 $ # -# last change: $Author: hjs $ $Date: 2001-07-18 16:34:15 $ +# last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -79,7 +79,7 @@ CFLAGSNOOPT+=-Ob0 .ENDIF OBJFILES= $(OBJ)$/cppumaker.obj \ - $(OBJ)$/cppuoptions.obj \ + $(OBJ)$/cppuoptions.obj \ $(OBJ)$/cpputype.obj NOOPTFILES= \ @@ -88,17 +88,13 @@ NOOPTFILES= \ APP1TARGET= $(TARGET) APP1OBJS= $(OBJFILES) -APP1STDLIBS=\ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(REGLIB) -.IF "$(GUI)"=="WNT" -APP1STDLIBS+= \ - $(LIBCIMT) $(LIBCMT) -.ENDIF +APP1STDLIBS= \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(REGLIB) APP1LIBS= \ - $(LB)$/codemaker.lib + $(LB)$/codemaker.lib .INCLUDE : target.mk diff --git a/codemaker/source/cunomaker/cunomaker.cxx b/codemaker/source/cunomaker/cunomaker.cxx index f4d515d6ff05..75a0652dd5cf 100644 --- a/codemaker/source/cunomaker/cunomaker.cxx +++ b/codemaker/source/cunomaker/cunomaker.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cunomaker.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: jsc $ $Date: 2001-04-17 16:15:48 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,15 +158,16 @@ int _cdecl main( int argc, char * argv[] ) 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++) + sal_Int32 nIndex = 0; + do { - typeName = tOption.getToken(i, ';'); + typeName = tOption.getToken(0, ';', nIndex); - tmpName = typeName.getToken(typeName.getTokenCount('.') - 1, '.'); + sal_Int32 nPos = typeName.lastIndexOf( '.' ); + tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 ); if (tmpName == "*") { // produce this type and his scope, but the scope is not recursively generated. @@ -195,7 +196,7 @@ int _cdecl main( int argc, char * argv[] ) OString("cannot dump Type '" + typeName + "'").getStr()); exit(99); } - } + } while( nIndex != -1 ); } else { // produce all types diff --git a/codemaker/source/cunomaker/cunotype.cxx b/codemaker/source/cunomaker/cunotype.cxx index c21ed890f0c6..e31162e0ddad 100644 --- a/codemaker/source/cunomaker/cunotype.cxx +++ b/codemaker/source/cunomaker/cunotype.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cunotype.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: jsc $ $Date: 2001-04-23 13:07:54 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,9 +189,9 @@ sal_Bool CunoType::dump(CunoOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -202,7 +202,7 @@ sal_Bool CunoType::dump(CunoOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -238,9 +238,9 @@ sal_Bool CunoType::dump(CunoOptions* pOptions) FileStream cFile; if ( bFileCheck ) - cFile.openFile(tmpFileName); + cFile.open(tmpFileName); else - cFile.openFile(cFileName); + cFile.open(cFileName); if(!cFile.isValid()) { @@ -251,7 +251,7 @@ sal_Bool CunoType::dump(CunoOptions* pOptions) ret = dumpCFile(cFile); - cFile.closeFile(); + cFile.close(); if (ret && bFileCheck) { ret = checkFileContent(cFileName, tmpFileName); @@ -321,9 +321,9 @@ OString CunoType::dumpHeaderDefine(FileStream& o, sal_Char* prefix, sal_Bool bEx tmpBuf.append(prefix); tmpBuf.append('_'); - OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toUpperCase()); + OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase()); - o << "#ifndef " << tmp << "\n#define " << tmp << endl; + o << "#ifndef " << tmp << "\n#define " << tmp << "\n"; return tmp; } @@ -371,7 +371,7 @@ void CunoType::dumpInclude(FileStream& o, const OString& typeName, sal_Char* pre tmpBuf.append(prefix); tmpBuf.append('_'); - OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toUpperCase()); + OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase()); length = 1 + typeName.getLength() + strlen(prefix); if (bExtended) @@ -404,7 +404,7 @@ void CunoType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* TypeUsingSet::const_iterator iter = usingSet.begin(); - OString sPrefix(OString(prefix).toUpperCase()); + OString sPrefix(OString(prefix).toAsciiUpperCase()); sal_Bool bSequenceDumped = sal_False; sal_uInt32 index = 0; sal_uInt32 seqNum = 0; @@ -432,7 +432,7 @@ void CunoType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* { bSequenceDumped = sal_True; o << "#ifndef _UNO_SEQUENCE2_" << defPrefix - << "_\n#include <uno/sequence2." << defPrefix.toLowerCase() + << "_\n#include <uno/sequence2." << defPrefix.toAsciiLowerCase() << ">\n#endif\n"; } @@ -454,7 +454,7 @@ void CunoType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* iLastS = outerNamespace.lastIndexOf('/'); OString outerClass(outerNamespace.copy(iLastS+1)); -// o << endl; +// o << "\n"; // dumpNameSpace(o, sal_True, sal_False, outerNamespace); // o << "\nclass " << outerClass << "::" << innerClass << ";\n"; // dumpNameSpace(o, sal_False, sal_False, outerNamespace); @@ -464,8 +464,8 @@ void CunoType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* { // dumpInclude(o, relType, prefix); OString type(relType.replace('/', '_')); - o << "\n#ifndef " << type.toUpperCase() << "\n"; - o << "#define " << type.toUpperCase() << "\n"; + o << "\n#ifndef " << type.toAsciiUpperCase() << "\n"; + o << "#define " << type.toAsciiUpperCase() << "\n"; o << "struct _" << type << ";\n" << "typedef struct _" << type << "_ftab * " << type << ";\n"; o << "#endif\n\n"; @@ -526,7 +526,7 @@ void CunoType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); dumpDepIncludes(o, nestedName, prefix); } @@ -680,7 +680,7 @@ void CunoType::dumpGetCunoType(FileStream& o) o << " , \"" << fieldType.replace('/', '.') << "\" );\n"; } } - o << endl; + o << "\n"; } o << indent() << "typelib_static_compound_type_init( &s_pType_" << typeName << ", " @@ -1247,8 +1247,9 @@ void CunoType::dumpTypeInit(FileStream& o, const OString& typeName) if ( reader.isValid() ) { + sal_Int32 i = type.lastIndexOf('/'); o << "(" << shortScopedName("", type, sal_False) - << "::" << type.getToken(type.getTokenCount('/') - 1, '/') + << "::" << type.copy( i != -1 ? i+1 :0 ) << "_" << reader.getFieldName(0) << ")"; return; } @@ -1544,16 +1545,16 @@ sal_Bool InterfaceType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "H")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpOpenExternC(o); - o << "#ifndef " << m_name.toUpperCase() << "\n"; - o << "#define " << m_name.toUpperCase() << "\n"; + o << "#ifndef " << m_name.toAsciiUpperCase() << "\n"; + o << "#define " << m_name.toAsciiUpperCase() << "\n"; o << "struct _" << m_name << "_ftab;\n" << "typedef struct _" << m_name << "_ftab * " << m_name << ";\n"; o << "#endif\n\n"; @@ -1575,7 +1576,7 @@ sal_Bool InterfaceType::dumpHFile(FileStream& o) { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); nestedName = checkRealBaseType(nestedName.copy(5)); @@ -1626,7 +1627,7 @@ sal_Bool InterfaceType::dumpDeclaration(FileStream& o) { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); nestedName = nestedName.copy(5); @@ -1689,11 +1690,11 @@ sal_Bool InterfaceType::dumpCFile(FileStream& o) throw( CannotDumpException ) { dumpInclude(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpDefaultCIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpGetCunoType(o); /* if (getNestedTypeNames().getLength() > 0) @@ -1703,7 +1704,7 @@ sal_Bool InterfaceType::dumpCFile(FileStream& o) { OUString s(getNestedTypeNames().getElement(i)); - OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_DONTKNOW); + OString nestedName(s.getStr(), s.getLength(), RTL_TEXTENCODING_UTF8); nestedName = nestedName.copy(5); @@ -2073,7 +2074,7 @@ void InterfaceType::dumpCGetCunoType(FileStream& o) if (superType.getLength() > 0) o << indent() << "typelib_typedescription_release( pSuperType );\n\n"; else - o << endl; + o << "\n"; o << indent() << "typelib_typedescriptionreference_new( &s_pType_ " << typeName << "typelib_TypeClass_INTERFACE, (typelib_TypeDescription*)pTD);\n\n"; @@ -2560,7 +2561,8 @@ sal_Bool ModuleType::dump(CunoOptions* pOptions) if (tmpName.equals("/")) tmpName = "global"; else - tmpName += "/" + m_typeName.getToken(m_typeName.getTokenCount('/') - 1, '/'); +// tmpName += "/" + m_typeName.getToken(m_typeName.getTokenCount('/') - 1, '/'); + tmpName += "/" + m_name; OString tmpFileName; OString hFileName = createFileNameFromType(outPath, tmpName, ".hdl"); @@ -2585,9 +2587,9 @@ sal_Bool ModuleType::dump(CunoOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -2598,7 +2600,7 @@ sal_Bool ModuleType::dump(CunoOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -2627,9 +2629,9 @@ sal_Bool ModuleType::dump(CunoOptions* pOptions) FileStream hxxFile; if ( bFileCheck ) - cFile.openFile(tmpFileName); + cFile.open(tmpFileName); else - cFile.openFile(cFileName); + cFile.open(cFileName); if(!cFile.isValid()) { @@ -2640,7 +2642,7 @@ sal_Bool ModuleType::dump(CunoOptions* pOptions) ret = dumpCFile(cFile); - cFile.closeFile(); + cFile.close(); if (ret && bFileCheck) { ret = checkFileContent(cFileName, tmpFileName); @@ -2661,16 +2663,16 @@ sal_Bool ModuleType::dumpHFile(FileStream& o) } OString headerDefine(dumpHeaderDefine(o, "H", bSpecialDefine)); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpOpenExternC(o); dumpDeclaration(o); - o << endl; + o << "\n"; dumpCloseExternC(o); o << "\n#endif /* "<< headerDefine << " */\n"; @@ -2778,9 +2780,9 @@ sal_Bool ConstantsType::dump(CunoOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -2791,7 +2793,7 @@ sal_Bool ConstantsType::dump(CunoOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -2819,9 +2821,9 @@ sal_Bool ConstantsType::dump(CunoOptions* pOptions) FileStream cFile; if ( bFileCheck ) - cFile.openFile(tmpFileName); + cFile.open(tmpFileName); else - cFile.openFile(cFileName); + cFile.open(cFileName); if(!cFile.isValid()) { @@ -2832,7 +2834,7 @@ sal_Bool ConstantsType::dump(CunoOptions* pOptions) ret = dumpCFile(cFile); - cFile.closeFile(); + cFile.close(); if (ret && bFileCheck) { ret = checkFileContent(cFileName, tmpFileName); @@ -2862,12 +2864,12 @@ sal_Bool StructureType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "H")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpOpenExternC(o); @@ -2941,11 +2943,11 @@ sal_Bool StructureType::dumpCFile(FileStream& o) throw( CannotDumpException ) { dumpInclude(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpDefaultCIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpGetCunoType(o); @@ -2972,12 +2974,12 @@ sal_Bool ExceptionType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "H")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpOpenExternC(o); @@ -3051,11 +3053,11 @@ sal_Bool ExceptionType::dumpCFile(FileStream& o) throw( CannotDumpException ) { dumpInclude(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpDefaultCIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpGetCunoType(o); @@ -3083,10 +3085,10 @@ sal_Bool EnumType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "H")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpOpenExternC(o); dumpDeclaration(o); @@ -3146,9 +3148,9 @@ sal_Bool EnumType::dumpCFile(FileStream& o) throw( CannotDumpException ) { dumpInclude(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpDefaultCIncludes(o); - o << endl; + o << "\n"; dumpGetCunoType(o); return sal_True; } @@ -3311,12 +3313,12 @@ sal_Bool TypeDefType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "H")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpOpenExternC(o); @@ -3350,11 +3352,11 @@ sal_Bool TypeDefType::dumpCFile(FileStream& o) throw( CannotDumpException ) { dumpInclude(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpDefaultCIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "h"); - o << endl; + o << "\n"; dumpGetCunoType(o); return sal_True; } @@ -3495,21 +3497,20 @@ sal_Bool produceType(const OString& typeName, OString scopedName(const OString& scope, const OString& type, sal_Bool bNoNameSpace) { - sal_uInt32 count = type.getTokenCount('/'); - sal_uInt32 offset = 0; - - if (count == 1) + sal_Int32 nPos = type.lastIndexOf( '/' ); + if (nPos == -1) return type; if (bNoNameSpace) - return type.getToken(count - 1, '/'); + return type.copy(nPos+1); - OStringBuffer tmpBuf(type.getLength() + count); - for (sal_uInt32 i=0; i < count; i++) + OStringBuffer tmpBuf(type.getLength()*2); + nPos = 0; + do { tmpBuf.append("::"); - tmpBuf.append(type.getToken(i, '/')); - } + tmpBuf.append(type.getToken(0, '/', nPos)); + } while( nPos != -1 ); return tmpBuf.makeStringAndClear(); } @@ -3520,12 +3521,8 @@ OString scopedName(const OString& scope, const OString& type, 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 + sal_Int32 nPos = type.lastIndexOf( '/' ); + if( nPos == -1 ) return OString(); if (bNoNameSpace) @@ -3535,19 +3532,21 @@ OString shortScopedName(const OString& scope, const OString& type, if (scope.lastIndexOf('/') > 0) { OString tmpScp(scope.copy(0, scope.lastIndexOf('/'))); - OString tmpScp2(type.copy(0, type.lastIndexOf('/'))); + OString tmpScp2(type.copy(0, nPos)); if (tmpScp == tmpScp2) return OString(); } - OStringBuffer tmpBuf(type.lastIndexOf('/') + offset); + OString aScope( type.copy( 0, nPos ) ); + OStringBuffer tmpBuf(aScope.getLength()*2); - for (sal_uInt32 i=0; i < count - 1; i++) + nPos = 0; + do { tmpBuf.append("::"); - tmpBuf.append(type.getToken(i, '/')); - } + tmpBuf.append(aScope.getToken(0, '/', nPos)); + } while( nPos != -1 ); return tmpBuf.makeStringAndClear(); } diff --git a/codemaker/source/cunomaker/makefile.mk b/codemaker/source/cunomaker/makefile.mk index f17b75163445..30ed55e13f60 100644 --- a/codemaker/source/cunomaker/makefile.mk +++ b/codemaker/source/cunomaker/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: jsc $ $Date: 2001-04-17 16:15:48 $ +# last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -76,29 +76,23 @@ ENABLE_EXCEPTIONS=TRUE # --- Files -------------------------------------------------------- -CXXFILES= cunomaker.cxx \ - cunooptions.cxx \ +CXXFILES= cunomaker.cxx \ + cunooptions.cxx \ cunotype.cxx APP1TARGET= $(TARGET) APP1OBJS= $(OBJ)$/cunomaker.obj \ - $(OBJ)$/cunooptions.obj \ + $(OBJ)$/cunooptions.obj \ $(OBJ)$/cunotype.obj -APP1STDLIBS=\ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(REGLIB) \ - $(STDLIBCPP) - -.IF "$(GUI)"=="WNT" -APP1STDLIBS+= \ - $(LIBCIMT) $(LIBCMT) -.ENDIF +APP1STDLIBS= \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(REGLIB) \ APP1LIBS= \ - $(LB)$/codemaker.lib + $(LB)$/codemaker.lib .INCLUDE : target.mk diff --git a/codemaker/source/idlmaker/idlmaker.cxx b/codemaker/source/idlmaker/idlmaker.cxx index aed4a8c01b2e..76e6fdde5b2e 100644 --- a/codemaker/source/idlmaker/idlmaker.cxx +++ b/codemaker/source/idlmaker/idlmaker.cxx @@ -2,9 +2,9 @@ * * $RCSfile: idlmaker.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mm $ $Date: 2000-09-21 07:43:11 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,15 +158,16 @@ int _cdecl main( int argc, char * argv[] ) 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++) + sal_Int32 nIndex = 0; + do { - typeName = tOption.getToken(i, ';'); + typeName = tOption.getToken(0, ';', nIndex); - tmpName = typeName.getToken(typeName.getTokenCount('.') - 1, '.'); + sal_Int32 nPos = typeName.lastIndexOf( '.' ); + tmpName = typeName.copy( nPos != -1 ? nPos+1 : 0 ); if (tmpName == "*") { // produce this type and his scope, but the scope is not recursively generated. @@ -195,7 +196,7 @@ int _cdecl main( int argc, char * argv[] ) OString("cannot dump Type '" + typeName + "'").getStr()); exit(99); } - } + } while( nIndex != -1 ); } else { // produce all types diff --git a/codemaker/source/idlmaker/idltype.cxx b/codemaker/source/idlmaker/idltype.cxx index b8475ab1b94b..b5c297d914e6 100644 --- a/codemaker/source/idlmaker/idltype.cxx +++ b/codemaker/source/idlmaker/idltype.cxx @@ -2,9 +2,9 @@ * * $RCSfile: idltype.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: jsc $ $Date: 2001-04-11 07:28:34 $ + * last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -87,11 +87,12 @@ IdlType::IdlType(TypeReader& typeReader, : 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) { + sal_Int32 i = typeName.lastIndexOf('/'); + m_name = typeName.copy( i != -1 ? i+1 : 0 ); } IdlType::~IdlType() @@ -131,9 +132,9 @@ sal_Bool IdlType::dump(IdlOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -144,7 +145,7 @@ sal_Bool IdlType::dump(IdlOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -205,9 +206,9 @@ OString IdlType::dumpHeaderDefine(FileStream& o, sal_Char* prefix ) tmpBuf.append(prefix); tmpBuf.append('_'); - OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toUpperCase()); + OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase()); - o << "#ifndef " << tmp << "\n#define " << tmp << endl; + o << "#ifndef " << tmp << "\n#define " << tmp << "\n"; return tmp; } @@ -228,7 +229,7 @@ void IdlType::dumpInclude(FileStream& o, const OString& genTypeName, const OStri tmpBuf.append(prefix); tmpBuf.append('_'); - OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toUpperCase()); + OString tmp(tmpBuf.makeStringAndClear().replace('/', '_').toAsciiUpperCase()); length = 1 + typeName.getLength() + strlen(prefix); @@ -240,10 +241,16 @@ void IdlType::dumpInclude(FileStream& o, const OString& genTypeName, const OStri o << "#ifndef " << tmp << "\n#include <"; tmp = tmpBuf.makeStringAndClear(); - sal_Int32 nSlashes = genTypeName.getTokenCount( '/'); - for( sal_Int32 i = 1; i < nSlashes; i++ ) - o << "../"; - //o << "c:/temp/"; + sal_Int32 nIndex = 0; + do + { + genTypeName.getToken(0, '/', nIndex); + o << "../"; + } while( nIndex != -1 ); + +// sal_Int32 nSlashes = genTypeName.getTokenCount( '/'); +// for( sal_Int32 i = 1; i < nSlashes; i++ ) +// o << "../"; o << tmp; o << ">\n#endif\n"; } @@ -254,7 +261,7 @@ void IdlType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* TypeUsingSet::const_iterator iter = usingSet.begin(); - OString sPrefix(OString(prefix).toUpperCase()); + OString sPrefix(OString(prefix).toAsciiUpperCase()); sal_uInt32 index = 0; sal_uInt32 seqNum = 0; OString relType; @@ -277,7 +284,7 @@ void IdlType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* { if (!((*iter).m_use & TYPEUSE_SUPER)) { - o << endl; + o << "\n"; dumpNameSpace(o, sal_True, sal_False, relType); o << "\ninterface " << scopedName(m_typeName, relType, sal_True) << ";\n"; dumpNameSpace(o, sal_False, sal_False, relType); @@ -299,7 +306,7 @@ void IdlType::dumpDepIncludes(FileStream& o, const OString& typeName, sal_Char* OString aST = relType; OString aScope; dumpNameSpace( o, sal_True, sal_False, relType ); - for( sal_Int32 i = 0; i < seqNum; i++ ) + for( sal_uInt32 i = 0; i < seqNum; i++ ) { o << "typedef sequence< " << scopedName("", aST) << " > "; @@ -330,33 +337,37 @@ void IdlType::dumpNameSpace(FileStream& o, sal_Bool bOpen, sal_Bool bFull, const if (typeName == "/") return; - sal_uInt32 count = typeName.getTokenCount('/'); - - if (count == 1 && !bFull) + if (typeName.indexOf( '/' ) == -1 && !bFull) return; - if (!bFull) count--; + if (!bFull) + typeName = typeName.copy( 0, typeName.lastIndexOf( '/' ) ); if (bOpen) { - for (int i=0; i < count; i++) + sal_Int32 nIndex = 0; + do { - o << "module " << typeName.getToken(i, '/'); + o << "module " << typeName.getToken(0, '/', nIndex); if (bOneLine) o << " { "; else o << "\n{\n"; - } + } while( nIndex != -1 ); } else { - for (int i=count-1; i >= 0; i--) + sal_Int32 nPos = 0; + do { + nPos = typeName.lastIndexOf( '/' ); o << "};"; - if (bOneLine) + if( bOneLine ) o << " "; else - o << " /* " << typeName.getToken(i, '/') << "*/\n"; - } + o << " /* " << typeName.copy( nPos+1 ) << " */\n"; + if( nPos != -1 ) + typeName = typeName.copy( 0, nPos ); + } while( nPos != -1 ); } } @@ -438,7 +449,7 @@ void IdlType::dumpType(FileStream& o, const OString& type ) RTTypeClass typeClass = m_typeMgr.getTypeClass(relType); - int i; + sal_uInt32 i; /* for (i=0; i < seqNum; i++) { @@ -739,7 +750,7 @@ OString IdlType::indent() { OStringBuffer tmp(m_indentLength); - for (int i=0; i < m_indentLength; i++) + for (sal_uInt32 i=0; i < m_indentLength; i++) { tmp.append(' '); } @@ -750,7 +761,7 @@ OString IdlType::indent(sal_uInt32 num) { OStringBuffer tmp(m_indentLength + num); - for (int i=0; i < m_indentLength + num; i++) + for (sal_uInt32 i=0; i < m_indentLength + num; i++) { tmp.append(' '); } @@ -780,12 +791,12 @@ sal_Bool InterfaceType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "IDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "idl"); - o << endl; + o << "\n"; dumpNameSpace(o); // write documentation @@ -812,7 +823,7 @@ sal_Bool InterfaceType::dumpHFile(FileStream& o) // o << "\nnamespace com { namespace sun { namespace star { namespace uno {\n" // << "class Type;\n} } } }\n\n"; - o << "#endif /* "<< headerDefine << "*/" << endl; + o << "#endif /* "<< headerDefine << "*/" << "\n"; return sal_True; } @@ -868,7 +879,7 @@ void InterfaceType::dumpMethods(FileStream& o) sal_Bool bConst = sal_False; sal_Bool bWithRunTimeExcp = sal_True; - for (sal_uInt16 i=0; i < methodCount; i++) + for (sal_Int16 i=0; i < methodCount; i++) { methodName = m_reader.getMethodName(i); returnType = m_reader.getMethodReturnType(i); @@ -1063,7 +1074,8 @@ sal_Bool ModuleType::dump(IdlOptions* pOptions) if (tmpName.equals("/")) tmpName = "global"; else - tmpName += "/" + m_typeName.getToken(m_typeName.getTokenCount('/') - 1, '/'); +// tmpName += "/" + m_typeName.getToken(m_typeName.getTokenCount('/') - 1, '/'); + tmpName += "/" + m_name; OString tmpFileName; OString hFileName = createFileNameFromType(outPath, tmpName, ".idl"); @@ -1088,9 +1100,9 @@ sal_Bool ModuleType::dump(IdlOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -1101,7 +1113,7 @@ sal_Bool ModuleType::dump(IdlOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -1115,15 +1127,15 @@ sal_Bool ModuleType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "IDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "idl"); - o << endl; + o << "\n"; dumpNameSpace(o, sal_True, sal_True); - o << endl; + o << "\n"; sal_uInt32 fieldCount = m_reader.getFieldCount(); RTFieldAccess access = RT_ACCESS_INVALID; @@ -1146,9 +1158,9 @@ sal_Bool ModuleType::dumpHFile(FileStream& o) } } - o << endl; + o << "\n"; dumpNameSpace(o, sal_False, sal_True); - o << "\n#endif /* "<< headerDefine << "*/" << endl; + o << "\n#endif /* "<< headerDefine << "*/" << "\n"; return sal_True; } @@ -1217,9 +1229,9 @@ sal_Bool ConstantsType::dump(IdlOptions* pOptions) FileStream hFile; if ( bFileCheck ) - hFile.openFile(tmpFileName); + hFile.open(tmpFileName); else - hFile.openFile(hFileName); + hFile.open(hFileName); if(!hFile.isValid()) { @@ -1230,7 +1242,7 @@ sal_Bool ConstantsType::dump(IdlOptions* pOptions) ret = dumpHFile(hFile); - hFile.closeFile(); + hFile.close(); if (ret && bFileCheck) { ret = checkFileContent(hFileName, tmpFileName); @@ -1260,12 +1272,12 @@ sal_Bool StructureType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "IDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "idl"); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -1313,7 +1325,7 @@ sal_Bool StructureType::dumpHFile(FileStream& o) dumpNameSpace(o, sal_False); - o << "#endif /* "<< headerDefine << "*/" << endl; + o << "#endif /* "<< headerDefine << "*/" << "\n"; return sal_True; } @@ -1332,7 +1344,7 @@ void StructureType::dumpSuperMember(FileStream& o, const OString& superType) RTFieldAccess access = RT_ACCESS_INVALID; OString fieldName; OString fieldType; - for (sal_Int16 i=0; i < fieldCount; i++) + for (sal_uInt16 i=0; i < fieldCount; i++) { access = aSuperReader.getFieldAccess(i); @@ -1376,12 +1388,12 @@ sal_Bool ExceptionType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "IDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "idl"); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -1433,7 +1445,7 @@ sal_Bool ExceptionType::dumpHFile(FileStream& o) dumpNameSpace(o, sal_False); - o << "#endif /* "<< headerDefine << "*/" << endl; + o << "#endif /* "<< headerDefine << "*/" << "\n"; return sal_True; } @@ -1496,10 +1508,10 @@ sal_Bool EnumType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "IDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -1547,7 +1559,7 @@ sal_Bool EnumType::dumpHFile(FileStream& o) dumpNameSpace(o, sal_False); - o << "#endif /* "<< headerDefine << "*/" << endl; + o << "#endif /* "<< headerDefine << "*/" << "\n"; return sal_True; } @@ -1573,12 +1585,12 @@ sal_Bool TypeDefType::dumpHFile(FileStream& o) throw( CannotDumpException ) { OString headerDefine(dumpHeaderDefine(o, "IDL")); - o << endl; + o << "\n"; dumpDefaultHIncludes(o); - o << endl; + o << "\n"; dumpDepIncludes(o, m_typeName, "idl"); - o << endl; + o << "\n"; dumpNameSpace(o); @@ -1588,7 +1600,7 @@ sal_Bool TypeDefType::dumpHFile(FileStream& o) dumpNameSpace(o, sal_False); - o << "#endif /* "<< headerDefine << "*/" << endl; + o << "#endif /* "<< headerDefine << "*/" << "\n"; return sal_True; } @@ -1708,21 +1720,20 @@ sal_Bool produceType(const OString& typeName, OString scopedName(const OString& scope, const OString& type, sal_Bool bNoNameSpace) { - sal_uInt32 count = type.getTokenCount('/'); - sal_uInt32 offset = 0; - - if (count == 1) + sal_Int32 nPos = type.lastIndexOf( '/' ); + if (nPos == -1) return type; if (bNoNameSpace) - return type.getToken(count - 1, '/'); + return type.copy(nPos+1); - OStringBuffer tmpBuf(type.getLength() + count); - for (int i=0; i < count; i++) + OStringBuffer tmpBuf(type.getLength()*2); + nPos = 0; + do { tmpBuf.append("::"); - tmpBuf.append(type.getToken(i, '/')); - } + tmpBuf.append(type.getToken(0, '/', nPos)); + } while( nPos != -1 ); return tmpBuf.makeStringAndClear(); } @@ -1732,16 +1743,30 @@ OString scopedName(const OString& scope, const OString& type, //************************************************************************* OString scope(const OString& scope, const OString& type ) { - sal_uInt32 count = type.getTokenCount('/'); - sal_uInt32 offset = 0; + sal_Int32 nPos = type.lastIndexOf( '/' ); + if( nPos == -1 ) + return OString(); - OStringBuffer tmpBuf(type.getLength() + count); - for (int i=0; i < count -1; i++) + // scoped name only if the namespace is not equal + if (scope.lastIndexOf('/') > 0) { - tmpBuf.append("::"); - tmpBuf.append(type.getToken(i, '/')); + OString tmpScp(scope.copy(0, scope.lastIndexOf('/'))); + OString tmpScp2(type.copy(0, nPos)); + + if (tmpScp == tmpScp2) + return OString(); } + OString aScope( type.copy( 0, nPos ) ); + OStringBuffer tmpBuf(aScope.getLength()*2); + + nPos = 0; + do + { + tmpBuf.append("::"); + tmpBuf.append(aScope.getToken(0, '/', nPos)); + } while( nPos != -1 ); + return tmpBuf.makeStringAndClear(); } diff --git a/codemaker/source/idlmaker/makefile.mk b/codemaker/source/idlmaker/makefile.mk index 6a9b4702b953..b1f4b104bc33 100644 --- a/codemaker/source/idlmaker/makefile.mk +++ b/codemaker/source/idlmaker/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: jsc $ $Date: 2001-03-13 12:04:26 $ +# last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -87,18 +87,13 @@ APP1OBJS= $(OBJ)$/idlmaker.obj \ $(OBJ)$/idloptions.obj \ $(OBJ)$/idltype.obj -APP1STDLIBS=\ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(REGLIB) \ - $(STDLIBCPP) - -.IF "$(GUI)"=="WNT" -APP1STDLIBS+= \ - $(LIBCIMT) $(LIBCMT) -.ENDIF +APP1STDLIBS= \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(REGLIB) \ + $(STDLIBCPP) APP1LIBS= \ - $(LB)$/codemaker.lib + $(LB)$/codemaker.lib .INCLUDE : target.mk diff --git a/codemaker/source/javamaker/makefile.mk b/codemaker/source/javamaker/makefile.mk index 7e8f62523128..7d36d3a1a0fe 100644 --- a/codemaker/source/javamaker/makefile.mk +++ b/codemaker/source/javamaker/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.6 $ +# $Revision: 1.7 $ # -# last change: $Author: hjs $ $Date: 2001-07-18 16:45:23 $ +# last change: $Author: jsc $ $Date: 2001-08-17 13:15:48 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -89,22 +89,17 @@ NOOPTFILES= \ APP1TARGET= $(TARGET) -APP1OBJS= $(OBJ)$/javamaker.obj \ - $(OBJ)$/javaoptions.obj \ - $(OBJ)$/javatype.obj - -APP1STDLIBS=\ - $(SALLIB) \ - $(SALHELPERLIB) \ - $(REGLIB) +APP1OBJS= $(OBJ)$/javamaker.obj \ + $(OBJ)$/javaoptions.obj \ + $(OBJ)$/javatype.obj -.IF "$(GUI)"=="WNT" -APP1STDLIBS+= \ - $(LIBCIMT) $(LIBCMT) -.ENDIF +APP1STDLIBS= \ + $(SALLIB) \ + $(SALHELPERLIB) \ + $(REGLIB) APP1LIBS= \ - $(LB)$/codemaker.lib + $(LB)$/codemaker.lib .INCLUDE : target.mk |