diff options
Diffstat (limited to 'tools/bootstrp')
-rw-r--r-- | tools/bootstrp/addexes/makefile.mk | 47 | ||||
-rw-r--r-- | tools/bootstrp/addexes/replace.cxx | 2 | ||||
-rw-r--r-- | tools/bootstrp/addexes2/makefile.mk | 56 | ||||
-rw-r--r-- | tools/bootstrp/addexes2/mkfilt.cxx | 24 | ||||
-rw-r--r-- | tools/bootstrp/command.cxx | 639 | ||||
-rw-r--r-- | tools/bootstrp/cppdep.cxx | 20 | ||||
-rw-r--r-- | tools/bootstrp/cppdep.hxx | 6 | ||||
-rw-r--r-- | tools/bootstrp/inimgr.cxx | 10 | ||||
-rw-r--r-- | tools/bootstrp/makefile.mk | 106 | ||||
-rw-r--r-- | tools/bootstrp/mkcreate.cxx | 98 | ||||
-rw-r--r-- | tools/bootstrp/prj.cxx | 1408 | ||||
-rw-r--r-- | tools/bootstrp/rscdep.cxx | 8 | ||||
-rw-r--r-- | tools/bootstrp/sstring.cxx | 216 |
13 files changed, 95 insertions, 2545 deletions
diff --git a/tools/bootstrp/addexes/makefile.mk b/tools/bootstrp/addexes/makefile.mk deleted file mode 100644 index 45ba1470a060..000000000000 --- a/tools/bootstrp/addexes/makefile.mk +++ /dev/null @@ -1,47 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=tools -TARGET=addexes -TARGETTYPE=CUI - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -APP1TARGET= txtrepl -APP1OBJS= $(OBJ)$/replace.obj -APP1STDLIBS=$(TOOLSLIB) - -DEPOBJFILES = $(APP1OBJS) -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/tools/bootstrp/addexes/replace.cxx b/tools/bootstrp/addexes/replace.cxx index 761d260a03b5..07f8be79ab71 100644 --- a/tools/bootstrp/addexes/replace.cxx +++ b/tools/bootstrp/addexes/replace.cxx @@ -61,7 +61,7 @@ int _cdecl main( int argc, char *argv[] ) aUpperText.ToUpperAscii(); - ULONG nIndex; + sal_uIntPtr nIndex; aSearch.ToUpperAscii(); nIndex = aUpperText.Search( aSearch.GetBuffer(), 0); diff --git a/tools/bootstrp/addexes2/makefile.mk b/tools/bootstrp/addexes2/makefile.mk deleted file mode 100644 index 8014fdb8eded..000000000000 --- a/tools/bootstrp/addexes2/makefile.mk +++ /dev/null @@ -1,56 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=..$/.. - -PRJNAME=tools -TARGET=addexes2 -TARGETTYPE=CUI - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- Files -------------------------------------------------------- - -APP1TARGET= mkunroll -APP1OBJS= $(OBJ)$/mkfilt.obj -APP1STDLIBS= $(SALLIB) $(TOOLSLIB) -.IF "$(OS)"=="LINUX" -APP1STDLIBS+=-lpthread -.ENDIF -.IF "$(OS)"=="NETBSD" -APP1STDLIBS+=-lpthread -.ENDIF -APP1LIBS= $(LB)$/btstrp.lib $(LB)$/bootstrp2.lib -APP1DEPN= $(LB)$/atools.lib $(LB)$/btstrp.lib $(LB)$/bootstrp2.lib - - -DEPOBJFILES = $(APP1OBJS) -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/tools/bootstrp/addexes2/mkfilt.cxx b/tools/bootstrp/addexes2/mkfilt.cxx index 56e4a276b819..b454f901de5b 100644 --- a/tools/bootstrp/addexes2/mkfilt.cxx +++ b/tools/bootstrp/addexes2/mkfilt.cxx @@ -90,16 +90,16 @@ class MkLine public: ByteString aLine; ByteStringList* pPrivateTnrLst; - BOOL bOut; - BOOL bHier; + sal_Bool bOut; + sal_Bool bHier; MkLine(); }; MkLine::MkLine() { - bOut = FALSE; - bHier = FALSE; + bOut = sal_False; + bHier = sal_False; pPrivateTnrLst = NULL; } @@ -165,32 +165,32 @@ void MkFilter::Filter() MkLine *pMkLine = new MkLine(); ByteString *pStr = new ByteString( aLineBuf ); pMkLine->aLine = *pStr; - pMkLine->bOut = FALSE; + pMkLine->bOut = sal_False; pLst->push_back( pMkLine ); } else if ( nState == 1 ) { - BOOL bInTnrList = TRUE; + sal_Bool bInTnrList = sal_True; fprintf( stderr, ":" ); MkLine *pMkLine = new MkLine(); if ( aLine.Search("unroll end") != STRING_NOTFOUND ) { fprintf( stderr, ";\nunroll end\n" ); MkLine *p_MkLine = new MkLine(); - p_MkLine->bHier = TRUE; + p_MkLine->bHier = sal_True; ByteString *pByteString = new ByteString("# do not delete this line === mkfilter3i\n"); p_MkLine->aLine = *pByteString; - p_MkLine->bOut = FALSE; + p_MkLine->bOut = sal_False; p_MkLine->pPrivateTnrLst = pTnrLst; pTnrLst = new ByteStringList(); pLst->push_back( p_MkLine ); nState = 0; - bInTnrList = FALSE; + bInTnrList = sal_False; } ByteString *pStr = new ByteString( aLineBuf ); pMkLine->aLine = *pStr; - pMkLine->bOut = FALSE; + pMkLine->bOut = sal_False; if ( bInTnrList ) pTnrLst->push_back( pMkLine ); @@ -209,14 +209,14 @@ void MkFilter::Filter() if ( pLine->bHier ) { // die List n - Mal abarbeiten - for ( USHORT n=1; n<11; n++) + for ( sal_uInt16 n=1; n<11; n++) { size_t nCount = pLine->pPrivateTnrLst->size(); for ( size_t i=0; i<nCount; i++ ) { MkLine *pMkLine = (*pLine->pPrivateTnrLst)[ i ]; ByteString aLine = pMkLine->aLine; - while( aLine.SearchAndReplace( aTnr, ByteString::CreateFromInt32( n )) != (USHORT)-1 ) ; + while( aLine.SearchAndReplace( aTnr, ByteString::CreateFromInt32( n )) != (sal_uInt16)-1 ) ; fputs( aLine.GetBuffer(), pOut ); fprintf( stderr, "o" ); } diff --git a/tools/bootstrp/command.cxx b/tools/bootstrp/command.cxx deleted file mode 100644 index 51fd7ea4e98a..000000000000 --- a/tools/bootstrp/command.cxx +++ /dev/null @@ -1,639 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#ifdef PRECOMPILED -#include "first.hxx" -#endif - -#include <tools/fsys.hxx> -#include <tools/stream.hxx> -#include "bootstrp/command.hxx" -#include <tools/debug.hxx> -#include "bootstrp/appdef.hxx" - -#ifdef _MSC_VER -#pragma warning (push,1) -#endif - -#include <iostream> -#include <string.h> -#include <stdlib.h> -#include <stdio.h> -#include <ctype.h> -#include <errno.h> - -#ifdef _MSC_VER -#pragma warning (pop) -#endif - -#if defined(WNT) || defined(OS2) -#ifdef _MSC_VER -#pragma warning (push,1) -#endif -#include <process.h> // for _SPAWN -#ifdef _MSC_VER -#pragma warning (pop) -#endif -#endif -#ifdef UNX -#include <sys/types.h> -#include <unistd.h> -#if ( defined NETBSD ) || defined (FREEBSD) || defined (AIX) \ - || defined (MACOSX) || defined (OPENBSD) \ - || defined(DRAGONFLY) -#include <sys/wait.h> -#else -#include <wait.h> -#endif -#define P_WAIT 1 // erstmal einen dummz -#endif - -#if defined WNT -#include <tools/svwin.h> -#endif - -#if defined(WNT) || defined(OS2) -#define cPathSeperator ';' -#endif -#ifdef UNX -#define cPathSeperator ':' -#endif - -/*****************************************************************************/ -CommandLine::CommandLine(BOOL bWrite) -/*****************************************************************************/ - : bTmpWrite(bWrite) -{ - CommandBuffer = new char [1]; - if (CommandBuffer == NULL) { - exit(0); - } - CommandBuffer[0] = '\0'; - nArgc = 0; - ppArgv = new char * [1]; - ppArgv[0] = NULL; - - ComShell = new char [128]; - char* pTemp = getenv("COMMAND_SHELL"); - if(!pTemp) - strcpy(ComShell,COMMAND_SHELL); - else - strcpy(ComShell,pTemp); - - strcpy(&ComShell[strlen(ComShell)]," -C "); -} - -/*****************************************************************************/ -CommandLine::CommandLine(const char *CommandString, BOOL bWrite) -/*****************************************************************************/ - : bTmpWrite(bWrite) -{ - CommandBuffer = new char [1]; - if (CommandBuffer == NULL) { - exit(0); - } - nArgc = 0; - ppArgv = new char * [1]; - ppArgv[0] = NULL; - - ComShell = new char [128]; - char* pTemp = getenv("COMMAND_SHELL"); - if(!pTemp) - strcpy(ComShell,COMMAND_SHELL); - else - strcpy(ComShell,pTemp); - - strcpy(&ComShell[strlen(ComShell)]," -C "); - - BuildCommand(CommandString); -} - -/*****************************************************************************/ -CommandLine::CommandLine(const CommandLine& CCommandLine, BOOL bWrite) -/*****************************************************************************/ - : bTmpWrite(bWrite) -{ - CommandBuffer = new char [1]; - if (CommandBuffer == NULL) { - exit(0); - } - nArgc = 0; - ppArgv = new char * [1]; - ppArgv[0] = NULL; - - ComShell = new char [128]; - char* pTemp = getenv("COMMAND_SHELL"); - if(!pTemp) - strcpy(ComShell,COMMAND_SHELL); - else - strcpy(ComShell,pTemp); - - strcpy(&ComShell[strlen(ComShell)]," -C "); - - BuildCommand(CCommandLine.CommandBuffer); -} - -/*****************************************************************************/ -CommandLine::~CommandLine() -/*****************************************************************************/ -{ - delete [] CommandBuffer; - delete [] ComShell; - for (int i = 0; ppArgv[i] != 0; i++) { - delete [] ppArgv[i]; - } - delete [] ppArgv; - -} - -/*****************************************************************************/ -CommandLine& CommandLine::operator=(const CommandLine& CCommandLine) -/*****************************************************************************/ -{ - strcpy (CommandBuffer, CCommandLine.CommandBuffer); - for (int i = 0; i != nArgc; i++) { - delete [] ppArgv[i]; - } - delete [] ppArgv; - ppArgv = new char * [1]; - ppArgv[0] = NULL; - BuildCommand(CommandBuffer); - return *this; -} - -/*****************************************************************************/ -CommandLine& CommandLine::operator=(const char *CommandString) -/*****************************************************************************/ -{ - strcpy (CommandBuffer, CommandString); - for (int i = 0; i != nArgc; i++) { - delete [] ppArgv[i]; - } - delete [] ppArgv; - ppArgv = new char * [1]; - ppArgv[0] = NULL; - BuildCommand(CommandBuffer); - - return *this; -} - -/*****************************************************************************/ -void CommandLine::Print() -/*****************************************************************************/ -{ -} - -/*****************************************************************************/ -void CommandLine::BuildCommand(const char *CommandString) -/*****************************************************************************/ -{ - int index = 0, pos=0; - char buffer[1024]; - char WorkString[1024]; - - strcpy(WorkString,CommandString); - - //falls LogWindow -> in tmpfile schreiben - if(bTmpWrite) - { - strcpy(&WorkString[strlen(WorkString)]," >&"); - strcpy(&WorkString[strlen(WorkString)],getenv("TMP")); - strcpy(&WorkString[strlen(WorkString)],TMPNAME); - } - - // delete old memory and get some new memory for CommandBuffer - delete [] CommandBuffer; - CommandBuffer = new char [strlen(ComShell)+strlen(WorkString)+1]; - if (CommandBuffer == NULL) { - exit(0); - } - strcpy (CommandBuffer, ComShell); - strcpy (&CommandBuffer[strlen(ComShell)], WorkString); - - CommandString = CommandBuffer; - - // get the number of tokens - Strtokens(CommandString); - - // delete the space for the old CommandLine - for (int i = 0; ppArgv[i] != 0; i++) { - delete [] ppArgv[i]; - } - delete [] ppArgv; - - /* get space for the new command line */ - ppArgv = (char **) new char * [nArgc+1]; - if (ppArgv == NULL) { - exit(0); - } - - // flush the white space - while ( isspace(*CommandString) ) - CommandString++; - - index = 0; - - // start the loop to build all the individual tokens - while (*CommandString != '\0') { - pos = 0; - - // copy the token until white space is found - while ( !isspace(*CommandString) && *CommandString != '\0') { - buffer[pos++] = *CommandString++; - } - - buffer[pos] = '\0'; - - // get space for the individual tokens - ppArgv[index] = (char *) new char [strlen(buffer)+1]; - if (ppArgv[index] == NULL) { - //cout << "Error: nospace" << endl; - exit(0); - } - - // copy the token - strcpy (ppArgv[index++], buffer); - - // flush while space - while ( isspace(*CommandString) ) - CommandString++; - } - - // finish by setting the las pointer to NULL - ppArgv[nArgc]= NULL; - -} - -/*****************************************************************************/ -void CommandLine::Strtokens(const char *CommandString) -/*****************************************************************************/ -{ - int count = 0; - const char *temp; - - temp = CommandString; - - /* bypass white space */ - while (isspace(*temp)) temp++; - - for (count=0; *temp != '\0'; count++) { - /* continue until white space of string terminator is found */ - while ((!isspace(*temp)) && (*temp != '\0')) temp++; - - /* bypass white space */ - while (isspace(*temp)) temp++; - - } - nArgc = count; -} - -/*****************************************************************************/ -CCommand::CCommand( ByteString &rString ) -/*****************************************************************************/ -{ - rString.SearchAndReplace( '\t', ' ' ); - aCommand = rString.GetToken( 0, ' ' ); - aCommandLine = Search( "PATH" ); -#ifndef UNX - aCommandLine += " /c "; -#else - aCommandLine += " -c "; -#endif - - ByteString sCmd( rString.GetToken( 0, ' ' )); - ByteString sParam( rString.Copy( sCmd.Len())); - - aCommandLine += Search( "PATH", sCmd ); - aCommandLine += sParam; - - ImplInit(); -} - -/*****************************************************************************/ -CCommand::CCommand( const char *pChar ) -/*****************************************************************************/ -{ - ByteString aString = pChar; - aString.SearchAndReplace( '\t', ' ' ); - aCommand = aString.GetToken( 0, ' ' ); - - aCommandLine = Search( "PATH" ); -#ifndef UNX - aCommandLine += " /c "; -#else - aCommandLine += " -c "; -#endif - ByteString rString( pChar ); - - ByteString sCmd( rString.GetToken( 0, ' ' )); - ByteString sParam( rString.Copy( sCmd.Len())); - - aCommandLine += Search( "PATH", sCmd ); - aCommandLine += sParam; - - ImplInit(); -} - -/*****************************************************************************/ -void CCommand::ImplInit() -/*****************************************************************************/ -{ - char pTmpStr[255]; - size_t *pPtr; - char *pChar; - int nVoid = sizeof( size_t * ); - nArgc = aCommandLine.GetTokenCount(' '); - ULONG nLen = aCommandLine.Len(); - - ppArgv = (char **) new char[ (ULONG)(nLen + nVoid * (nArgc +2) + nArgc ) ]; - pChar = (char *) ppArgv + ( (1+nArgc) * nVoid ); - pPtr = (size_t *) ppArgv; - for ( xub_StrLen i=0; i<nArgc; i++ ) - { - (void) strcpy( pTmpStr, aCommandLine.GetToken(i, ' ' ).GetBuffer() ); - size_t nStrLen = strlen( pTmpStr ) + 1; - strcpy( pChar, pTmpStr ); - *pPtr = (sal_uIntPtr) pChar; - pChar += nStrLen; - pPtr += 1; -#ifdef UNX - if ( i == 1 ) - { - USHORT nWo = aCommandLine.Search("csh -c "); - if (nWo != STRING_NOTFOUND) - aCommandLine.Erase(0, nWo + 7); - else - aCommandLine.Erase(0, 16); - i = nArgc; - strcpy( pChar, aCommandLine.GetBuffer() ); - *pPtr = (sal_uIntPtr) pChar; - pPtr += 1; - } -#endif - } - *pPtr = 0; -} - -/*****************************************************************************/ -CCommand::operator int() -/*****************************************************************************/ -{ - int nRet; -#if defined WNT - nRet = _spawnv( P_WAIT, ppArgv[0], (const char **) ppArgv ); -#elif defined OS2 - nRet = _spawnv( P_WAIT, ppArgv[0], ppArgv ); -#elif defined UNX - pid_t pid; - - if (( pid = fork()) < 0 ) - DBG_ASSERT( FALSE, "fork error" ); - else if ( pid == 0 ) - if ( execv( ppArgv[0], (char * const *) ppArgv ) < 0 ) - DBG_ASSERT( FALSE, "execv failed" ); - if ( (nRet = waitpid( pid, NULL, 0 ) < 0) ) - DBG_ASSERT( FALSE, "wait error" ); -#endif - - switch ( errno ) - { - case E2BIG : - nError = COMMAND_TOOBIG; - break; - case EINVAL : - nError = COMMAND_INVALID; - break; - case ENOENT: - nError = COMMAND_NOTFOUND; - break; - case ENOEXEC : - nError = COMMAND_NOEXEC; - break; - case ENOMEM : - nError = COMMAND_NOMEM; - break; - default: - nError = COMMAND_UNKNOWN; - } - - if ( nRet ) - fprintf( stderr, "Program returned with errros\n"); - return nRet; -} - -/*****************************************************************************/ -ByteString CCommand::Search(ByteString aEnv, ByteString sItem) -/*****************************************************************************/ -{ - // default wird eine Shell im Path gesucht, - // wenn aber compsec gestzt ist holen wir uns die - // Shell von dort - if ( sItem.Equals( COMMAND_SHELL )) - { - ByteString aComspec = GetEnv( "COMSPEC" ); - if ( !aComspec.Equals("")) - return aComspec; - } - - DirEntry aItem( String( sItem, RTL_TEXTENCODING_ASCII_US )); - if ( aItem.Exists()) - return sItem; - - ByteString aEntry, sReturn; - ByteString sEnv( aEnv ); - ByteString sEnvironment = GetEnv( sEnv.GetBuffer()); - xub_StrLen nCount = sEnvironment.GetTokenCount( cPathSeperator ); - - BOOL bFound = FALSE; - - for ( xub_StrLen i=0; i<nCount && !bFound; i++ ) - { - aEntry = sEnvironment.GetToken(i, cPathSeperator ); -#ifndef UNX - aEntry += '\\'; -#else - aEntry += '/'; -#endif - aEntry += sItem; - - String sEntry( aEntry, RTL_TEXTENCODING_ASCII_US ); - DirEntry aDirEntry( sEntry ); - aDirEntry.ToAbs(); - if ( aDirEntry.Exists()) { - sReturn = aEntry; - bFound = TRUE; - } - } - if ( !bFound ) - { - sEnv = sEnv.ToUpperAscii(); - ByteString sEnvironment2 = GetEnv(sEnv.GetBuffer() ); - xub_StrLen nCount2 = sEnvironment2.GetTokenCount( cPathSeperator ); - for ( xub_StrLen i=0; i<nCount2 && !bFound; i++ ) - { - aEntry = sEnvironment2.GetToken(i, cPathSeperator ); -#ifndef UNX - aEntry += '\\'; -#else - aEntry += '/'; -#endif - aEntry += sItem; - - String sEntry( aEntry, RTL_TEXTENCODING_ASCII_US ); - DirEntry aDirEntry( sEntry ); - aDirEntry.ToAbs(); - if ( aDirEntry.Exists()) { - sReturn = aEntry; - bFound = TRUE; - } - } - } - - if ( sReturn.Equals( "" )) - sReturn = sItem; - - return sReturn; -} - -/*****************************************************************************/ -CCommandd::CCommandd( ByteString &rString, CommandBits nBits ) -/*****************************************************************************/ - : CCommand( rString ), - nFlag( nBits ) -{ -} - - -/*****************************************************************************/ -CCommandd::CCommandd( const char *pChar, CommandBits nBits ) -/*****************************************************************************/ - : CCommand( pChar ), - nFlag( nBits ) -{ -} - -/*****************************************************************************/ -CCommandd::operator int() -/*****************************************************************************/ -{ - int nRet = 0; - -#ifdef WNT - LPCTSTR lpApplicationName = NULL; - LPTSTR lpCommandLine = (char *) GetCommandLine_().GetBuffer(); - LPSECURITY_ATTRIBUTES lpProcessAttributes = NULL; - LPSECURITY_ATTRIBUTES lpThreadAttributes = NULL; - BOOL bInheritHandles = TRUE; - - // wie wuenschen wir denn gestartet zu werden ?? - DWORD dwCreationFlags; - - if ( nFlag & COMMAND_EXECUTE_START ) - dwCreationFlags = DETACHED_PROCESS; - else - dwCreationFlags = CREATE_NEW_CONSOLE; - - // wir erben vom Vaterprozess - LPVOID lpEnvironment = NULL; - - // das exe im Pfad suchen - LPCTSTR lpCurrentDirectory = NULL; - - // in dieser Struktur bekommen wir die erzeugte Processinfo - // zurueck - PROCESS_INFORMATION aProcessInformation; - - // weiteres Startupinfo anlegen - STARTUPINFO aStartupInfo; - - aStartupInfo.cb = sizeof( STARTUPINFO ); - aStartupInfo.lpReserved = NULL; - aStartupInfo.lpDesktop = NULL; - - // das Fenster bekommt den Namen des Exes - aStartupInfo.lpTitle = NULL; - aStartupInfo.dwX = 100; - aStartupInfo.dwY = 100; - aStartupInfo.dwXCountChars = 40; - aStartupInfo.dwYCountChars = 40; - - // Farben setzen - aStartupInfo.dwFillAttribute = FOREGROUND_RED | BACKGROUND_RED | - BACKGROUND_BLUE | BACKGROUND_GREEN; - - aStartupInfo.wShowWindow = SW_SHOWNOACTIVATE; - aStartupInfo.cbReserved2 = NULL; - aStartupInfo.lpReserved2 = NULL; - - if ( nFlag & COMMAND_EXECUTE_HIDDEN ) - { - aStartupInfo.wShowWindow = SW_HIDE; - aStartupInfo.dwFlags = aStartupInfo.dwFlags | STARTF_USESHOWWINDOW; - } - - bool bProcess = CreateProcess( lpApplicationName, - lpCommandLine, lpProcessAttributes, - lpThreadAttributes, bInheritHandles, - dwCreationFlags, lpEnvironment, lpCurrentDirectory, - &aStartupInfo, &aProcessInformation ); - - LPVOID lpMsgBuf; - - if ( bProcess ) - { - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language - (LPTSTR) &lpMsgBuf, - 0, - NULL ); - - ByteString aErrorString = (char *) lpMsgBuf; - - if ( nFlag & COMMAND_EXECUTE_WAIT ) - { - DWORD aProcessState = STILL_ACTIVE; - while(aProcessState == STILL_ACTIVE) - { - GetExitCodeProcess(aProcessInformation.hProcess,&aProcessState); - } - } - } - else - fprintf( stderr, "Can not start Process !" ); - -#endif - return nRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/cppdep.cxx b/tools/bootstrp/cppdep.cxx index 7ad18a494531..ad5bb80eaffc 100644 --- a/tools/bootstrp/cppdep.cxx +++ b/tools/bootstrp/cppdep.cxx @@ -81,26 +81,26 @@ void CppDep::Execute() } } -BOOL CppDep::AddSearchPath( const char* aPath ) +sal_Bool CppDep::AddSearchPath( const char* aPath ) { ByteString *pStr = new ByteString( aPath ); pSearchPath->push_back( pStr ); - return FALSE; + return sal_False; } -BOOL CppDep::AddSource( const char* aSource ) +sal_Bool CppDep::AddSource( const char* aSource ) { ByteString *pStr = new ByteString( aSource ); pSources->push_back( pStr ); - return FALSE; + return sal_False; } -BOOL CppDep::Search( ByteString aFileName ) +sal_Bool CppDep::Search( ByteString aFileName ) { #ifdef DEBUG_VERBOSE fprintf( stderr, "SEARCH : %s\n", aFileName.GetBuffer()); #endif - BOOL bRet = FALSE; + sal_Bool bRet = sal_False; SvFileStream aFile; ByteString aReadLine; @@ -110,7 +110,7 @@ BOOL CppDep::Search( ByteString aFileName ) aFile.Open( suFileName, STREAM_READ ); while ( aFile.ReadLine( aReadLine )) { - USHORT nPos = aReadLine.Search( "include" ); + sal_uInt16 nPos = aReadLine.Search( "include" ); if ( nPos != STRING_NOTFOUND ) { #ifdef DEBUG_VERBOSE @@ -125,13 +125,13 @@ BOOL CppDep::Search( ByteString aFileName ) if ( aResult !="") if ( (aNewFile = Exists( aResult )) != "" ) { - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; size_t nCount = pFileList->size(); for ( size_t i = 0; i < nCount; i++ ) { ByteString *pStr = (*pFileList)[ i ]; if ( *pStr == aNewFile ) - bFound = TRUE; + bFound = sal_True; } #ifdef DEBUG_VERBOSE fprintf( stderr, "not in list : %d %s\n", nPos, aReadLine.GetBuffer() ); @@ -227,7 +227,7 @@ ByteString CppDep::IsIncludeStatement( ByteString aLine ) if ( aTmpStr.Equals("#include") ) { aTmpStr = aLine.Erase( 0, 8 ); - USHORT nLen = aLine.Len(); + sal_uInt16 nLen = aLine.Len(); aLine.Erase( nLen-1, 1 ); aLine.Erase( 0, 1 ); #ifdef DEBUG_VERBOSE diff --git a/tools/bootstrp/cppdep.hxx b/tools/bootstrp/cppdep.hxx index d180bd8b115a..d1e4397f0476 100644 --- a/tools/bootstrp/cppdep.hxx +++ b/tools/bootstrp/cppdep.hxx @@ -42,7 +42,7 @@ protected: ByteStringList *pFileList; ByteStringList *pSources; - BOOL Search( ByteString aFileName ); + sal_Bool Search( ByteString aFileName ); ByteString Exists( ByteString aFileName ); ByteString IsIncludeStatement( ByteString aLine ); @@ -53,8 +53,8 @@ public: virtual void Execute(); ByteStringList* GetDepList(){return pFileList;} - BOOL AddSearchPath( const char* aPath ); - BOOL AddSource( const char * aSource ); + sal_Bool AddSearchPath( const char* aPath ); + sal_Bool AddSource( const char * aSource ); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/inimgr.cxx b/tools/bootstrp/inimgr.cxx index ebebcd692e9b..3d9d818e1a38 100644 --- a/tools/bootstrp/inimgr.cxx +++ b/tools/bootstrp/inimgr.cxx @@ -43,7 +43,7 @@ /****************************************************************************/ IniManager::IniManager( ByteString &rDir, ByteString &rLocalDir ) /****************************************************************************/ - : bUpdate( TRUE ) + : bUpdate( sal_True ) { sLocalPath = ByteString( getenv( "LOCALINI" )); if ( !sLocalPath.Len()) @@ -60,7 +60,7 @@ IniManager::IniManager( ByteString &rDir, ByteString &rLocalDir ) /****************************************************************************/ IniManager::IniManager( ByteString &rDir ) /****************************************************************************/ - : bUpdate( TRUE ) + : bUpdate( sal_True ) { sLocalPath = GetLocalIni(); sGlobalDir = rDir; @@ -74,7 +74,7 @@ IniManager::IniManager( ByteString &rDir ) /****************************************************************************/ IniManager::IniManager() /****************************************************************************/ - : bUpdate( TRUE ) + : bUpdate( sal_True ) { sLocalPath = GetLocalIni(); @@ -170,7 +170,7 @@ void IniManager::ForceUpdate() sLocalPath += "/"; #endif - for ( USHORT i=0; i < aDir.Count(); i++ ) { + for ( sal_uInt16 i=0; i < aDir.Count(); i++ ) { ByteString sEntry( aDir[i].GetName(), gsl_getSystemTextEncoding()); if (( sEntry != "." ) && ( sEntry != ".." )) @@ -206,7 +206,7 @@ void IniManager::Update() if ( bUpdate ) { ForceUpdate(); - bUpdate = FALSE; + bUpdate = sal_False; } } diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk deleted file mode 100644 index b4508e1aa21f..000000000000 --- a/tools/bootstrp/makefile.mk +++ /dev/null @@ -1,106 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ=.. - -PRJNAME=tools -TARGET=btstrp -TARGET1=bootstrp2 -TARGETTYPE=CUI -LIBTARGET=NO -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(HAVE_GETOPT)" == "YES" -CDEFS += -DHAVE_GETOPT -.ENDIF - -# --- Files -------------------------------------------------------- - -OBJFILES= \ - $(OBJ)$/appdef.obj \ - $(OBJ)$/command.obj \ - $(OBJ)$/cppdep.obj\ - $(OBJ)$/inimgr.obj\ - $(OBJ)$/mkcreate.obj \ - $(OBJ)$/sstring.obj \ - $(OBJ)$/prj.obj - -SLOFILES= \ - $(SLO)$/appdef.obj \ - $(SLO)$/command.obj \ - $(SLO)$/cppdep.obj \ - $(SLO)$/inimgr.obj \ - $(SLO)$/mkcreate.obj \ - $(SLO)$/sstring.obj \ - $(SLO)$/prj.obj - - -LIB1TARGET= $(LB)$/$(TARGET).lib -LIB1ARCHIV= $(LB)$/lib$(TARGET).a -LIB1OBJFILES=\ - $(OBJ)$/appdef.obj \ - $(OBJ)$/command.obj \ - $(OBJ)$/cppdep.obj \ - $(OBJ)$/inimgr.obj \ - $(OBJ)$/mkcreate.obj \ - $(OBJ)$/sstring.obj - -LIB2TARGET= $(LB)$/$(TARGET1).lib -LIB2ARCHIV= $(LB)$/lib$(TARGET1).a -LIB2OBJFILES=\ - $(OBJ)$/prj.obj - -APP1TARGET= sspretty -APP1OBJS= $(OBJ)$/sspretty.obj -APP1LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib -APP1STDLIBS=$(SALLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) $(I18NISOLANGLIB) - -APP2TARGET= rscdep -APP2OBJS= $(OBJ)$/rscdep.obj -APP2LIBS= $(LB)$/$(TARGET).lib $(LB)$/$(TARGET1).lib -APP2STDLIBS= $(SALLIB) $(TOOLSLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) -.IF "$(HAVE_GETOPT)" != "YES" -.IF "$(OS)"=="WNT" -APP2STDLIBS+=gnu_getopt.lib -.ENDIF -.ENDIF -APP2RPATH= NONE -APP2RPATH= NONE -APP2RPATH= NONE - -APP3TARGET= so_checksum -APP3OBJS= $(OBJ)$/md5.obj \ - $(OBJ)$/so_checksum.obj -APP3STDLIBS= $(TOOLSLIB) $(SALLIB) $(BASEGFXLIB) $(UCBHELPERLIB) $(CPPULIB) $(COMPHELPERLIB) $(I18NISOLANGLIB) $(CPPUHELPERLIB) $(SALHELPERLIB) - -DEPOBJFILES = $(APP1OBJS) $(APP2OBJS) $(APP3OBJS) - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/tools/bootstrp/mkcreate.cxx b/tools/bootstrp/mkcreate.cxx index 2c02bd894d3c..f151464772a1 100644 --- a/tools/bootstrp/mkcreate.cxx +++ b/tools/bootstrp/mkcreate.cxx @@ -60,7 +60,7 @@ char const *LimitedPath[] = { /*****************************************************************************/ SourceDirectory::SourceDirectory( const ByteString &rDirectoryName, - USHORT nOperatingSystem, SourceDirectory *pParentDirectory ) + sal_uInt16 nOperatingSystem, SourceDirectory *pParentDirectory ) /*****************************************************************************/ : ByteString( rDirectoryName ), pParent( pParentDirectory ), @@ -88,7 +88,7 @@ SourceDirectory::~SourceDirectory() /*****************************************************************************/ CodedDependency *SourceDirectory::AddCodedDependency( - const ByteString &rCodedIdentifier, USHORT nOperatingSystems ) + const ByteString &rCodedIdentifier, sal_uInt16 nOperatingSystems ) /*****************************************************************************/ { CodedDependency *pReturn = NULL; @@ -115,7 +115,7 @@ CodedDependency *SourceDirectory::AddCodedDependency( /*****************************************************************************/ CodedDependency *SourceDirectory::AddCodedIdentifier( - const ByteString &rCodedIdentifier, USHORT nOperatingSystems ) + const ByteString &rCodedIdentifier, sal_uInt16 nOperatingSystems ) /*****************************************************************************/ { CodedDependency *pReturn = NULL; @@ -169,22 +169,22 @@ SourceDirectory *SourceDirectory::GetRootDirectory() /*****************************************************************************/ SourceDirectory *SourceDirectory::GetSubDirectory( - const ByteString &rDirectoryPath, USHORT nOperatingSystem ) + const ByteString &rDirectoryPath, sal_uInt16 nOperatingSystem ) /*****************************************************************************/ { ByteString sSearch; - BOOL bSubs = TRUE; - ULONG nIndex = 0; + sal_Bool bSubs = sal_True; + sal_uIntPtr nIndex = 0; while ( bSubs && ByteString( LimitedPath[ nIndex ]) != "EndOf_LimitedPath" ) { SourceDirectory *pActDir = this; ByteString sLimitation( LimitedPath[ nIndex ]); - BOOL bBreak = FALSE; - for ( ULONG i = sLimitation.GetTokenCount( '\\' ); i > 0 && !bBreak; i-- ) { - if (( !pActDir ) || ( *pActDir != sLimitation.GetToken(( USHORT )( i - 1 ), '\\' ))) - bBreak = TRUE; + sal_Bool bBreak = sal_False; + for ( sal_uIntPtr i = sLimitation.GetTokenCount( '\\' ); i > 0 && !bBreak; i-- ) { + if (( !pActDir ) || ( *pActDir != sLimitation.GetToken(( sal_uInt16 )( i - 1 ), '\\' ))) + bBreak = sal_True; else pActDir = pActDir->pParent; } @@ -220,7 +220,7 @@ SourceDirectory *SourceDirectory::GetSubDirectory( /*****************************************************************************/ SourceDirectory *SourceDirectory::GetDirectory( - const ByteString &rDirectoryName, USHORT nOperatingSystem ) + const ByteString &rDirectoryName, sal_uInt16 nOperatingSystem ) /*****************************************************************************/ { ByteString sDirectoryName( rDirectoryName ); @@ -246,7 +246,7 @@ SourceDirectory *SourceDirectory::GetDirectory( /*****************************************************************************/ SourceDirectory *SourceDirectory::Insert( const ByteString &rDirectoryName, - USHORT nOperatingSystem ) + sal_uInt16 nOperatingSystem ) /*****************************************************************************/ { SourceDirectory *pSubDirectory = NULL; @@ -271,7 +271,7 @@ Dependency *SourceDirectory::ResolvesDependency( size_t nPos = pCodedIdentifier->IsString( pCodedDependency ); if ( nPos != NOT_THERE ) { CodedDependency *pIdentifier = ( CodedDependency* )(*pCodedIdentifier)[ nPos ]; - USHORT nResult = + sal_uInt16 nResult = pIdentifier->GetOperatingSystem() & pCodedDependency->GetOperatingSystem(); Dependency *pReturn = new Dependency( *this, nResult ); @@ -352,10 +352,10 @@ ByteString SourceDirectory::GetTarget() return sReturn; } - BOOL bDependsOnPlatform = FALSE; + sal_Bool bDependsOnPlatform = sal_False; for ( size_t i = 0; i < pDependencies->size(); i++ ) { if ( ((Dependency*)(*pDependencies)[ i ])->GetOperatingSystem() != OS_ALL ) { - bDependsOnPlatform = TRUE; + bDependsOnPlatform = sal_True; break; } } @@ -376,17 +376,17 @@ ByteString SourceDirectory::GetTarget() ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" ); sUNX += sTarget; sUNX += " :"; - BOOL bUNX = FALSE; + sal_Bool bUNX = sal_False; ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" ); sWNT += sTarget; sWNT += " :"; - BOOL bWNT = FALSE; + sal_Bool bWNT = sal_False; ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" ); sOS2 += sTarget; sOS2 += " :"; - BOOL bOS2 = FALSE; + sal_Bool bOS2 = sal_False; for ( size_t i = 0; i < pDependencies->size(); i++ ) { Dependency *pDependency = (Dependency*)(*pDependencies)[ i ]; @@ -396,17 +396,17 @@ ByteString SourceDirectory::GetTarget() if ( pDependency->GetOperatingSystem() & OS_UNX ) { sUNX += " "; sUNX += sDependency; - bUNX = TRUE; + bUNX = sal_True; } if ( pDependency->GetOperatingSystem() & OS_WIN32 ) { sWNT += " "; sWNT += sDependency; - bWNT = TRUE; + bWNT = sal_True; } if ( pDependency->GetOperatingSystem() & OS_OS2 ) { sOS2 += " "; sOS2 += sDependency; - bOS2 = TRUE; + bOS2 = sal_True; } } @@ -434,10 +434,10 @@ ByteString SourceDirectory::GetSubDirsTarget() ByteString sReturn; if ( pSubDirectories ) { - BOOL bDependsOnPlatform = FALSE; + sal_Bool bDependsOnPlatform = sal_False; for ( size_t i = 0; i < pSubDirectories->size(); i++ ) { if ( ((SourceDirectory*)(*pSubDirectories)[ i ])->GetOperatingSystems() != OS_ALL ) { - bDependsOnPlatform = TRUE; + bDependsOnPlatform = sal_True; } } @@ -455,15 +455,15 @@ ByteString SourceDirectory::GetSubDirsTarget() else { ByteString sUNX( ".IF \"$(GUI)\" == \"UNX\"\n" ); sUNX += "RC_SUBDIRS = "; - BOOL bUNX = FALSE; + sal_Bool bUNX = sal_False; ByteString sWNT( ".IF \"$(GUI)\" == \"WNT\"\n" ); sWNT += "RC_SUBDIRS = "; - BOOL bWNT = FALSE; + sal_Bool bWNT = sal_False; ByteString sOS2( ".IF \"$(GUI)\" == \"OS2\"\n" ); sOS2 += "RC_SUBDIRS = "; - BOOL bOS2 = FALSE; + sal_Bool bOS2 = sal_False; for ( size_t i = 0; i < pSubDirectories->size(); i++ ) { SourceDirectory *pDirectory = (SourceDirectory*)(*pSubDirectories)[ i ]; @@ -473,17 +473,17 @@ ByteString SourceDirectory::GetSubDirsTarget() if ( pDirectory->GetOperatingSystems() & OS_UNX ) { sUNX += " \\\n\t"; sUNX += sDirectory; - bUNX = TRUE; + bUNX = sal_True; } if ( pDirectory->GetOperatingSystems() & OS_WIN32 ) { sWNT += " \\\n\t"; sWNT += sDirectory; - bWNT = TRUE; + bWNT = sal_True; } if ( pDirectory->GetOperatingSystems() & OS_OS2 ) { sOS2 += " \\\n\t"; sOS2 += sDirectory; - bOS2 = TRUE; + bOS2 = sal_True; } } if ( bUNX ) { @@ -504,10 +504,10 @@ ByteString SourceDirectory::GetSubDirsTarget() } /*****************************************************************************/ -USHORT SourceDirectory::GetOSType( const ByteString &sDependExt ) +sal_uInt16 SourceDirectory::GetOSType( const ByteString &sDependExt ) /*****************************************************************************/ { - USHORT nOSType = 0; + sal_uInt16 nOSType = 0; if ( sDependExt == "" ) nOSType |= OS_ALL; else if ( sDependExt == "N" || sDependExt == "W" ) @@ -521,7 +521,7 @@ USHORT SourceDirectory::GetOSType( const ByteString &sDependExt ) /*****************************************************************************/ SourceDirectory *SourceDirectory::CreateRootDirectory( - const ByteString &rRoot, const ByteString &rVersion, BOOL bAll ) + const ByteString &rRoot, const ByteString &rVersion, sal_Bool bAll ) /*****************************************************************************/ { IniManager aIniManager; @@ -534,15 +534,15 @@ SourceDirectory *SourceDirectory::CreateRootDirectory( GenericInformationList *pVerList = aParser.Execute( s ); ByteString sVersion( rVersion ); - Star aStar( pVerList, sVersion, TRUE, rRoot.GetBuffer()); + Star aStar( pVerList, sVersion, sal_True, rRoot.GetBuffer()); SourceDirectory *pSourceRoot = new SourceDirectory( rRoot, OS_ALL ); - for ( ULONG i = 0; i < aStar.Count(); i++ ) { + for ( sal_uIntPtr i = 0; i < aStar.Count(); i++ ) { Prj *pPrj = aStar.GetObject( i ); - BOOL bBuildable = TRUE; - ULONG nIndex = 0; + sal_Bool bBuildable = sal_True; + sal_uIntPtr nIndex = 0; while ( bBuildable && ByteString( NoBuildProject[ nIndex ]) != "EndOf_NoBuildProject" ) { bBuildable = ( ByteString( NoBuildProject[ nIndex ]) != pPrj->GetProjectName()); @@ -552,14 +552,14 @@ SourceDirectory *SourceDirectory::CreateRootDirectory( if ( bBuildable ) { SourceDirectory *pProject = pSourceRoot->Insert( pPrj->GetProjectName(), OS_ALL ); - SByteStringList *pPrjDependencies = pPrj->GetDependencies( FALSE ); + SByteStringList *pPrjDependencies = pPrj->GetDependencies( sal_False ); if ( pPrjDependencies ) for ( size_t x = 0; x < pPrjDependencies->size(); x++ ) pProject->AddCodedDependency( *(*pPrjDependencies)[ x ], OS_ALL ); pProject->AddCodedIdentifier( pPrj->GetProjectName(), OS_ALL ); - for ( ULONG j = 0; j < pPrj->Count(); j++ ) { + for ( sal_uIntPtr j = 0; j < pPrj->Count(); j++ ) { CommandData *pData = pPrj->GetObject( j ); if ( bAll || ( pData->GetCommandType() == COMMAND_NMAKE )) { ByteString sDirPath( rRoot ); @@ -590,11 +590,11 @@ SourceDirectory *SourceDirectory::CreateRootDirectory( } /*****************************************************************************/ -BOOL SourceDirectory::RemoveDirectoryTreeAndAllDependencies() +sal_Bool SourceDirectory::RemoveDirectoryTreeAndAllDependencies() /*****************************************************************************/ { if ( !pParent ) - return FALSE; + return sal_False; SourceDirectoryList *pParentContent = pParent->pSubDirectories; size_t i = 0; @@ -613,15 +613,15 @@ BOOL SourceDirectory::RemoveDirectoryTreeAndAllDependencies() } } delete this; - return TRUE; + return sal_True; } /*****************************************************************************/ -BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds ) +sal_Bool SourceDirectory::CreateRecursiveMakefile( sal_Bool bAllChilds ) /*****************************************************************************/ { if ( !pSubDirectories ) - return TRUE; + return sal_True; fprintf( stdout, "%s", GetFullPath().GetBuffer()); @@ -629,7 +629,7 @@ BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds ) DirEntry aEntry( aTmpStr ); if ( !aEntry.Exists()) { fprintf( stdout, " ... no directory!\n" ); - return FALSE; + return sal_False; } size_t j = 0; @@ -653,20 +653,20 @@ BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds ) DirEntry aMKEntry( aEntry ); aMKEntry += aMKFile; - BOOL bMakefileMk = FALSE; + sal_Bool bMakefileMk = sal_False; if ( aMKEntry.Exists()) { if ( nDepth == 1 && *this == ByteString( "api" )) fprintf( stdout, " ... makefile.mk exists, ignoring (hack: prj == api)!" ); else { fprintf( stdout, " ... makefile.mk exists, including!" ); - bMakefileMk = TRUE; + bMakefileMk = sal_True; } } SvFileStream aMakefile( aRCEntry.GetFull(), STREAM_STD_WRITE | STREAM_TRUNC ); if ( !aMakefile.IsOpen()) { fprintf( stdout, " ... failed!\n" ); - return FALSE; + return sal_False; } ByteString sHeader( @@ -869,11 +869,11 @@ BOOL SourceDirectory::CreateRecursiveMakefile( BOOL bAllChilds ) fprintf( stdout, "\n" ); - BOOL bSuccess = TRUE; + sal_Bool bSuccess = sal_True; if ( bAllChilds ) { for ( size_t k = 0; k < pSubDirectories->size(); k++ ) { if ( !((SourceDirectory*)(*pSubDirectories)[ k ])->CreateRecursiveMakefile( TRUE ) ) { - bSuccess = FALSE; + bSuccess = sal_False; break; } } diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index dabd11a9b243..c519d337464c 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -30,7 +30,7 @@ #include "precompiled_tools.hxx" #include <stdlib.h> #include <stdio.h> -#include "bootstrp/sstring.hxx" +//#include "bootstrp/sstring.hxx" #include <osl/mutex.hxx> #include <tools/stream.hxx> @@ -38,6 +38,8 @@ #include "bootstrp/prj.hxx" #include "bootstrp/inimgr.hxx" +DECLARE_LIST( UniStringList, UniString* ) + #if defined(WNT) || defined(OS2) #define LIST_DELIMETER ';' #define PATH_DELIMETER '\\' @@ -46,7 +48,7 @@ #define PATH_DELIMETER '/' #endif -Link Star::aDBNotFoundHdl; +//Link Star::aDBNotFoundHdl; // // class SimpleConfig @@ -110,9 +112,9 @@ ByteString SimpleConfig::GetNextLine() aTmpStr = aTmpStr.EraseTrailingChars(); while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ) ; int nLength = aTmpStr.Len(); - BOOL bFound = FALSE; + sal_Bool bFound = sal_False; ByteString aEraseString; - for ( USHORT i = 0; i<= nLength; i++) + for ( sal_uInt16 i = 0; i<= nLength; i++) { if ( aTmpStr.GetChar( i ) == 0x20 && !bFound ) aTmpStr.SetChar( i, 0x09 ); @@ -121,7 +123,7 @@ ByteString SimpleConfig::GetNextLine() } /*****************************************************************************/ -ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) +ByteString SimpleConfig::GetCleanedNextLine( sal_Bool bReadComments ) /*****************************************************************************/ { @@ -141,8 +143,8 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) aTmpStr = aTmpStr.EraseTrailingChars(); int nLength = aTmpStr.Len(); ByteString aEraseString; - BOOL bFirstTab = TRUE; - for ( USHORT i = 0; i<= nLength; i++) + sal_Bool bFirstTab = sal_True; + for ( sal_uInt16 i = 0; i<= nLength; i++) { if ( aTmpStr.GetChar( i ) == 0x20 ) aTmpStr.SetChar( i, 0x09 ); @@ -150,14 +152,14 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) if ( aTmpStr.GetChar( i ) == 0x09 ) { if ( bFirstTab ) - bFirstTab = FALSE; + bFirstTab = sal_False; else { aTmpStr.SetChar( i, 0x20 ); } } else - bFirstTab = TRUE; + bFirstTab = sal_True; } aTmpStr.EraseAllChars(' '); @@ -165,1391 +167,3 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) } - -// -// class CommandData -// - -/*****************************************************************************/ -CommandData::CommandData() -/*****************************************************************************/ -{ - nOSType = 0; - nCommand = 0; - pDepList = 0; -} - -/*****************************************************************************/ -CommandData::~CommandData() -/*****************************************************************************/ -{ - if ( pDepList ) - { - for ( size_t i = 0, n = pDepList->size(); i < n; ++i ) { - delete (*pDepList)[ i ]; - } - delete pDepList; - - pDepList = NULL; - } -} - -/*****************************************************************************/ -ByteString CommandData::GetOSTypeString() -/*****************************************************************************/ -{ - ByteString aRetStr; - - switch (nOSType) - { - case OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX : - aRetStr = "all"; - break; - case OS_WIN32 | OS_WIN16 : - aRetStr = "w"; - break; - case OS_OS2 : - aRetStr = "p"; - break; - case OS_UNX : - aRetStr = "u"; - break; - case OS_WIN16 : - aRetStr = "d"; - break; - case OS_WIN32 : - aRetStr = "n"; - break; - default : - aRetStr = "none"; - } - - return aRetStr; -} - -/*****************************************************************************/ -ByteString CommandData::GetCommandTypeString() -/*****************************************************************************/ -{ - ByteString aRetStr; - - switch (nCommand) - { - case COMMAND_NMAKE : - aRetStr = "nmake"; - break; - case COMMAND_GET : - aRetStr = "get"; - break; - default : - aRetStr = "usr"; - aRetStr += ByteString::CreateFromInt64( nCommand + 1 - COMMAND_USER_START ); - - } - - return aRetStr; -} - -/*****************************************************************************/ -CommandData* Prj::GetDirectoryList ( USHORT, USHORT ) -/*****************************************************************************/ -{ - return (CommandData *)NULL; -} - -/*****************************************************************************/ -CommandData* Prj::GetDirectoryData( ByteString aLogFileName ) -/*****************************************************************************/ -{ - CommandData *pData = NULL; - ULONG nObjCount = Count(); - for ( ULONG i=0; i<nObjCount; i++ ) - { - pData = GetObject(i); - if ( pData->GetLogFile() == aLogFileName ) - return pData; - } - return NULL; -} - -// -// class Prj -// - -/*****************************************************************************/ -Prj::Prj() : - bVisited( FALSE ), - pPrjInitialDepList(0), - pPrjDepList(0), - bHardDependencies( FALSE ), - bSorted( FALSE ) -/*****************************************************************************/ -{ -} - -/*****************************************************************************/ -Prj::Prj( ByteString aName ) : - bVisited( FALSE ), - aProjectName( aName ), - pPrjInitialDepList(0), - pPrjDepList(0), - bHardDependencies( FALSE ), - bSorted( FALSE ) -/*****************************************************************************/ -{ -} - -/*****************************************************************************/ -Prj::~Prj() -/*****************************************************************************/ -{ - if ( pPrjDepList ) - { - for ( size_t i = 0, n = maList.size(); i < n; ++i ) - delete maList[ i ]; - maList.clear(); - - for ( size_t i = 0, n = pPrjDepList->size(); i < n; ++i ) - delete (*pPrjDepList)[ i ]; - delete pPrjDepList; - pPrjDepList = NULL; - } - - if ( pPrjInitialDepList ) - { - for ( size_t i = 0, n = pPrjInitialDepList->size(); i < n; ++i ) - delete (*pPrjInitialDepList)[ i ]; - delete pPrjInitialDepList; - pPrjInitialDepList = NULL; - } -} - -/*****************************************************************************/ -void Prj::AddDependencies( ByteString aStr ) -/*****************************************************************************/ -{ - - // needs dirty flag - not expanded - if ( !pPrjDepList ) - pPrjDepList = new SByteStringList; - - pPrjDepList->PutString( new ByteString(aStr) ); - - if ( !pPrjInitialDepList ) - pPrjInitialDepList = new SByteStringList; - - pPrjInitialDepList->PutString( new ByteString(aStr) ); -} - -/*****************************************************************************/ -SByteStringList* Prj::GetDependencies( BOOL bExpanded ) -/*****************************************************************************/ -{ - if ( bExpanded ) - return pPrjDepList; - else - return pPrjInitialDepList; -} - - - -/*****************************************************************************/ -BOOL Prj::InsertDirectory ( ByteString aDirName, USHORT aWhat, - USHORT aWhatOS, ByteString aLogFileName, - const ByteString &rClientRestriction ) -/*****************************************************************************/ -{ - CommandData* pData = new CommandData(); - - pData->SetPath( aDirName ); - pData->SetCommandType( aWhat ); - pData->SetOSType( aWhatOS ); - pData->SetLogFile( aLogFileName ); - pData->SetClientRestriction( rClientRestriction ); - - maList.push_back( pData ); - - return FALSE; -} - -/*****************************************************************************/ -// -// removes directory and existing dependencies on it -// -CommandData* Prj::RemoveDirectory ( ByteString aLogFileName ) -/*****************************************************************************/ -{ - size_t nCountMember = maList.size(); - CommandData* pData; - CommandData* pDataFound = NULL; - SByteStringList* pDataDeps; - - for ( size_t i = 0; i < nCountMember; i++ ) - { - pData = maList[ i ]; - if ( pData->GetLogFile() == aLogFileName ) - pDataFound = pData; - else - { - pDataDeps = pData->GetDependencies(); - if ( pDataDeps ) - { - ByteString* pString; - size_t nDataDepsCount = pDataDeps->size(); - for ( size_t j = nDataDepsCount; j > 0; ) - { - pString = (*pDataDeps)[ --j ]; - if ( pString->GetToken( 0, '.') == aLogFileName ) - pDataDeps->erase( j ); - } - } - } - } - - Remove( pDataFound ); - - return pDataFound; -} - -// -// class Star -// - -/*****************************************************************************/ -Star::Star() -/*****************************************************************************/ -{ - // this ctor is only used by StarWriter -} - -/*****************************************************************************/ -Star::Star(String aFileName, USHORT nMode ) -/*****************************************************************************/ - : nStarMode( nMode ) -{ - Read( aFileName ); -} - -/*****************************************************************************/ -Star::Star( SolarFileList *pSolarFiles ) -/*****************************************************************************/ - : nStarMode( STAR_MODE_MULTIPLE_PARSE ) -{ - // this ctor is used by StarBuilder to get the information for the whole workspace - Read( pSolarFiles ); -} - -/*****************************************************************************/ -Star::Star( GenericInformationList *pStandLst, ByteString &rVersion, - BOOL bLocal, const char *pSourceRoot ) -/*****************************************************************************/ -{ - ByteString sPath( rVersion ); - String sSrcRoot; - if ( pSourceRoot ) - sSrcRoot = String::CreateFromAscii( pSourceRoot ); - -#ifdef UNX - sPath += "/settings/UNXSOLARLIST"; -#else - sPath += "/settings/SOLARLIST"; -#endif - GenericInformation *pInfo = pStandLst->GetInfo( sPath, TRUE ); - - if( pInfo && pInfo->GetValue().Len()) { - ByteString sFile( pInfo->GetValue()); - if ( bLocal ) { - IniManager aIniManager; - aIniManager.ToLocal( sFile ); - } - String sFileName( sFile, RTL_TEXTENCODING_ASCII_US ); - nStarMode = STAR_MODE_SINGLE_PARSE; - Read( sFileName ); - } - else { - SolarFileList *pFileList = new SolarFileList(); - - sPath = rVersion; - sPath += "/drives"; - - GenericInformation *pInfo2 = pStandLst->GetInfo( sPath, TRUE ); - if ( pInfo2 && pInfo2->GetSubList()) { - GenericInformationList *pDrives = pInfo2->GetSubList(); - for ( size_t i = 0; i < pDrives->size(); i++ ) { - GenericInformation *pDrive = (*pDrives)[ i ]; - if ( pDrive ) { - DirEntry aEntry; - BOOL bOk = FALSE; - if ( sSrcRoot.Len()) { - aEntry = DirEntry( sSrcRoot ); - bOk = TRUE; - } - else { -#ifdef UNX - sPath = "UnixVolume"; - GenericInformation *pUnixVolume = pDrive->GetSubInfo( sPath ); - if ( pUnixVolume ) { - String sRoot( pUnixVolume->GetValue(), RTL_TEXTENCODING_ASCII_US ); - aEntry = DirEntry( sRoot ); - bOk = TRUE; - } -#else - bOk = TRUE; - String sRoot( *pDrive, RTL_TEXTENCODING_ASCII_US ); - sRoot += String::CreateFromAscii( "\\" ); - aEntry = DirEntry( sRoot ); -#endif - } - if ( bOk ) { - sPath = "projects"; - GenericInformation *pProjectsKey = pDrive->GetSubInfo( sPath, TRUE ); - if ( pProjectsKey ) { - if ( !sSrcRoot.Len()) { - sPath = rVersion; - sPath += "/settings/PATH"; - GenericInformation *pPath = pStandLst->GetInfo( sPath, TRUE ); - if( pPath ) { - ByteString sAddPath( pPath->GetValue()); -#ifdef UNX - sAddPath.SearchAndReplaceAll( "\\", "/" ); -#else - sAddPath.SearchAndReplaceAll( "/", "\\" ); -#endif - String ssAddPath( sAddPath, RTL_TEXTENCODING_ASCII_US ); - aEntry += DirEntry( ssAddPath ); - } - } - GenericInformationList *pProjects = pProjectsKey->GetSubList(); - if ( pProjects ) { - String sPrjDir( String::CreateFromAscii( "prj" )); - String sSolarFile( String::CreateFromAscii( "build.lst" )); - - for ( size_t j = 0; j < pProjects->size(); j++ ) { - ByteString sProject( *(*pProjects)[ j ] ); - String ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); - - DirEntry aPrjEntry( aEntry ); - - aPrjEntry += DirEntry( ssProject ); - aPrjEntry += DirEntry( sPrjDir ); - aPrjEntry += DirEntry( sSolarFile ); - - pFileList->push_back( new String( aPrjEntry.GetFull()) ); - - ByteString sFile( aPrjEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - } - } - } - } - } - } - } - Read( pFileList ); - } -} - -/*****************************************************************************/ -Star::~Star() -/*****************************************************************************/ -{ - for ( size_t i = 0, n = maStarList.size(); i < n; ++i ) - delete maStarList[ i ]; - maStarList.clear(); -} - -/*****************************************************************************/ -void Star::Read( String &rFileName ) -/*****************************************************************************/ -{ - ByteString aString; - aFileList.push_back( new String( rFileName )); - - DirEntry aEntry( rFileName ); - aEntry.ToAbs(); - aEntry = aEntry.GetPath().GetPath().GetPath(); - sSourceRoot = aEntry.GetFull(); - - while ( !aFileList.empty() ) - { - StarFile *pFile = new StarFile( *aFileList.front() ); - if ( pFile->Exists()) - { - SimpleConfig aSolarConfig( *aFileList.front() ); - while (( aString = aSolarConfig.GetNext()) != "" ) - InsertToken (( char * ) aString.GetBuffer()); - } - delete pFile; - delete aFileList.front(); - aFileList.erase( aFileList.begin() ); - } - // resolve all dependencies recursive - Expand_Impl(); -} - -/*****************************************************************************/ -void Star::Read( SolarFileList *pSolarFiles ) -/*****************************************************************************/ -{ - while ( !pSolarFiles->empty() ) - { - ByteString aString; - - StarFile *pFile = new StarFile( *pSolarFiles->front() ); - if ( pFile->Exists()) - { - SimpleConfig aSolarConfig( *pSolarFiles->front() ); - while (( aString = aSolarConfig.GetNext()) != "" ) - InsertToken (( char * ) aString.GetBuffer()); - } - delete pFile; - delete pSolarFiles->front(); - aFileList.erase( aFileList.begin() ); - } - delete pSolarFiles; - - Expand_Impl(); -} - -/*****************************************************************************/ -String Star::CreateFileName( String sProject ) -/*****************************************************************************/ -{ - // this method is used to find solarlist parts of nabours (other projects) - String sPrjDir( String::CreateFromAscii( "prj" )); - String sSolarFile( String::CreateFromAscii( "build.lst" )); - - DirEntry aEntry( sSourceRoot ); - aEntry += DirEntry( sProject ); - aEntry += DirEntry( sPrjDir ); - aEntry += DirEntry( sSolarFile ); - - if ( !aEntry.Exists() && aDBNotFoundHdl.IsSet()) - aDBNotFoundHdl.Call( &sProject ); - - return aEntry.GetFull(); -} - -/*****************************************************************************/ -void Star::InsertSolarList( String sProject ) -/*****************************************************************************/ -{ - // inserts a new solarlist part of another project - String sFileName( CreateFileName( sProject )); - - for ( SolarFileList::iterator it = aFileList.begin(); it != aFileList.end(); ++it ) - if ( *(*it) == sFileName ) - return; - - ByteString ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); - if ( HasProject( ssProject )) - return; - - aFileList.push_back( new String( sFileName ) ); -} - -/*****************************************************************************/ -void Star::ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj ) -/*****************************************************************************/ -{ - if ( pDepPrj->bVisited ) - return; - - pDepPrj->bVisited = TRUE; - - SByteStringList* pPrjLst = pPrj->GetDependencies(); - SByteStringList* pDepLst = NULL; - ByteString* pDepend; - ByteString* pPutStr; - Prj *pNextPrj = NULL; - size_t i, nRetPos; - - if ( pPrjLst ) { - pDepLst = pDepPrj->GetDependencies(); - if ( pDepLst ) { - for ( i = 0; i < pDepLst->size(); i++ ) { - pDepend = (*pDepLst)[ i ]; - pPutStr = new ByteString( *pDepend ); - nRetPos = pPrjLst->PutString( pPutStr ); - if( nRetPos == NOT_THERE ) - delete pPutStr; - pNextPrj = GetPrj( *pDepend ); - if ( pNextPrj ) { - ExpandPrj_Impl( pPrj, pNextPrj ); - } - } - } - } -} - -/*****************************************************************************/ -void Star::Expand_Impl() -/*****************************************************************************/ -{ - for ( ULONG i = 0; i < Count(); i++ ) { - for ( ULONG j = 0; j < Count(); j++ ) - GetObject( j )->bVisited = FALSE; - - Prj* pPrj = GetObject( i ); - ExpandPrj_Impl( pPrj, pPrj ); - } -} - -/*****************************************************************************/ -void Star::InsertToken ( char *yytext ) -/*****************************************************************************/ -{ - static int i = 0; - static ByteString aDirName, aWhat, aWhatOS, - sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara; - static BOOL bPrjDep = FALSE; - static BOOL bHardDep = FALSE; - static USHORT nCommandType, nOSType; - CommandData* pCmdData; - static SByteStringList *pStaticDepList; - Prj* pPrj; - - switch (i) - { - case 0: - aPrefix = yytext; - pStaticDepList = 0; - break; - case 1: - aDirName = yytext; - break; - case 2: - if ( !strcmp( yytext, ":" )) - { - bPrjDep = TRUE; - bHardDep = FALSE; - i = 9; - } - else if ( !strcmp( yytext, "::" )) - { - bPrjDep = TRUE; - bHardDep = TRUE; - i = 9; - } - else - { - bPrjDep = FALSE; - bHardDep = FALSE; - - aWhat = yytext; - if ( aWhat == "nmake" ) - nCommandType = COMMAND_NMAKE; - else if ( aWhat == "get" ) - nCommandType = COMMAND_GET; - else { - ULONG nOffset = aWhat.Copy( 3 ).ToInt32(); - nCommandType = sal::static_int_cast< USHORT >( - COMMAND_USER_START + nOffset - 1); - } - } - break; - case 3: - if ( !bPrjDep ) - { - aWhat = yytext; - if ( aWhat == "-" ) - { - aCommandPara = ByteString(); - } - else - aCommandPara = aWhat; - } - break; - case 4: - if ( !bPrjDep ) - { - aWhatOS = yytext; - if ( aWhatOS.GetTokenCount( ',' ) > 1 ) { - sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 ); - aWhatOS = aWhatOS.GetToken( 0, ',' ); - } - if ( aWhatOS == "all" ) - nOSType = ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX ); - else if ( aWhatOS == "w" ) - nOSType = ( OS_WIN16 | OS_WIN32 ); - else if ( aWhatOS == "p" ) - nOSType = OS_OS2; - else if ( aWhatOS == "u" ) - nOSType = OS_UNX; - else if ( aWhatOS == "d" ) - nOSType = OS_WIN16; - else if ( aWhatOS == "n" ) - nOSType = OS_WIN32; - else - nOSType = OS_NONE; - } - break; - case 5: - if ( !bPrjDep ) - { - aLogFileName = yytext; - } - break; - default: - if ( !bPrjDep ) - { - ByteString aItem = yytext; - if ( aItem == "NULL" ) - { - // Liste zu Ende - i = -1; - } - else - { - // ggfs. Dependency liste anlegen und ergaenzen - if ( !pStaticDepList ) - pStaticDepList = new SByteStringList; - pStaticDepList->PutString( new ByteString( aItem )); - } - } - else - { - ByteString aItem = yytext; - if ( aItem == "NULL" ) - { - // Liste zu Ende - i = -1; - bPrjDep= FALSE; - } - else - { - aProjectName = aDirName.GetToken ( 0, '\\'); - if ( HasProject( aProjectName )) - { - pPrj = GetPrj( aProjectName ); - // Projekt exist. schon, neue Eintraege anhaengen - } - else - { - // neues Project anlegen - pPrj = new Prj ( aProjectName ); - pPrj->SetPreFix( aPrefix ); - Insert(pPrj,LIST_APPEND); - } - pPrj->AddDependencies( aItem ); - pPrj->HasHardDependencies( bHardDep ); - - if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) { - String sItem( aItem, RTL_TEXTENCODING_ASCII_US ); - InsertSolarList( sItem ); - } - } - } - break; - } - /* Wenn dieses Project noch nicht vertreten ist, in die Liste - der Solar-Projekte einfuegen */ - if ( i == -1 ) - { - aProjectName = aDirName.GetToken ( 0, '\\'); - if ( HasProject( aProjectName )) - { - pPrj = GetPrj( aProjectName ); - // Projekt exist. schon, neue Eintraege anhaengen - } - else - { - // neues Project anlegen - pPrj = new Prj ( aProjectName ); - pPrj->SetPreFix( aPrefix ); - Insert(pPrj,LIST_APPEND); - } - - pCmdData = new CommandData; - pCmdData->SetPath( aDirName ); - pCmdData->SetCommandType( nCommandType ); - pCmdData->SetCommandPara( aCommandPara ); - pCmdData->SetOSType( nOSType ); - pCmdData->SetLogFile( aLogFileName ); - pCmdData->SetClientRestriction( sClientRestriction ); - if ( pStaticDepList ) - pCmdData->SetDependencies( pStaticDepList ); - - pStaticDepList = 0; - pPrj->Insert ( pCmdData, LIST_APPEND ); - aDirName =""; - aWhat =""; - aWhatOS = ""; - sClientRestriction = ""; - aLogFileName = ""; - nCommandType = 0; - nOSType = 0; - } - i++; - - // und wer raeumt die depLst wieder ab ? -} - -/*****************************************************************************/ -BOOL Star::HasProject ( ByteString aProjectName ) -/*****************************************************************************/ -{ - Prj *pPrj; - int nCountMember; - - nCountMember = Count(); - - for ( int i=0; i<nCountMember; i++) - { - pPrj = GetObject(i); - if ( pPrj->GetProjectName().EqualsIgnoreCaseAscii(aProjectName) ) - return TRUE; - } - return FALSE; -} - -/*****************************************************************************/ -Prj* Star::GetPrj ( ByteString aProjectName ) -/*****************************************************************************/ -{ - Prj* pPrj; - int nCountMember = Count(); - for ( int i=0;i<nCountMember;i++) - { - pPrj = GetObject(i); - if ( pPrj->GetProjectName().EqualsIgnoreCaseAscii(aProjectName) ) - return pPrj; - } - return 0L ; -} - -/*****************************************************************************/ -ByteString Star::GetPrjName( DirEntry &aPath ) -/*****************************************************************************/ -{ - ByteString aRetPrj, aDirName; - ByteString aFullPathName = ByteString( aPath.GetFull(), gsl_getSystemTextEncoding()); - - xub_StrLen nToken = aFullPathName.GetTokenCount(PATH_DELIMETER); - for ( xub_StrLen i=0; i< nToken; i++ ) - { - aDirName = aFullPathName.GetToken( i, PATH_DELIMETER ); - if ( HasProject( aDirName )) - { - aRetPrj = aDirName; - break; - } - } - - return aRetPrj; -} - - -// -// class StarWriter -// - -/*****************************************************************************/ -StarWriter::StarWriter( String aFileName, BOOL bReadComments, USHORT nMode ) -/*****************************************************************************/ -{ - Read ( aFileName, bReadComments, nMode ); -} - -/*****************************************************************************/ -StarWriter::StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments ) -/*****************************************************************************/ -{ - Read( pSolarFiles, bReadComments ); -} - -/*****************************************************************************/ -StarWriter::StarWriter( GenericInformationList *pStandLst, ByteString &rVersion, - BOOL bLocal, const char *pSourceRoot ) -/*****************************************************************************/ -{ - ByteString sPath( rVersion ); - String sSrcRoot; - if ( pSourceRoot ) - sSrcRoot = String::CreateFromAscii( pSourceRoot ); - -#ifdef UNX - sPath += "/settings/UNXSOLARLIST"; -#else - sPath += "/settings/SOLARLIST"; -#endif - GenericInformation *pInfo = pStandLst->GetInfo( sPath, TRUE ); - - if( pInfo && pInfo->GetValue().Len()) { - ByteString sFile( pInfo->GetValue()); - if ( bLocal ) { - IniManager aIniManager; - aIniManager.ToLocal( sFile ); - } - String sFileName( sFile, RTL_TEXTENCODING_ASCII_US ); - nStarMode = STAR_MODE_SINGLE_PARSE; - Read( sFileName ); - } - else { - SolarFileList *pFileList = new SolarFileList(); - - sPath = rVersion; - sPath += "/drives"; - - GenericInformation *pInfo2 = pStandLst->GetInfo( sPath, TRUE ); - if ( pInfo2 && pInfo2->GetSubList()) { - GenericInformationList *pDrives = pInfo2->GetSubList(); - for ( size_t i = 0; i < pDrives->size(); i++ ) { - GenericInformation *pDrive = (*pDrives)[ i ]; - if ( pDrive ) { - DirEntry aEntry; - BOOL bOk = FALSE; - if ( sSrcRoot.Len()) { - aEntry = DirEntry( sSrcRoot ); - bOk = TRUE; - } - else { -#ifdef UNX - sPath = "UnixVolume"; - GenericInformation *pUnixVolume = pDrive->GetSubInfo( sPath ); - if ( pUnixVolume ) { - String sRoot( pUnixVolume->GetValue(), RTL_TEXTENCODING_ASCII_US ); - aEntry = DirEntry( sRoot ); - bOk = TRUE; - } -#else - bOk = TRUE; - String sRoot( *pDrive, RTL_TEXTENCODING_ASCII_US ); - sRoot += String::CreateFromAscii( "\\" ); - aEntry = DirEntry( sRoot ); -#endif - } - if ( bOk ) { - sPath = "projects"; - GenericInformation *pProjectsKey = pDrive->GetSubInfo( sPath, TRUE ); - if ( pProjectsKey ) { - if ( !sSrcRoot.Len()) { - sPath = rVersion; - sPath += "/settings/PATH"; - GenericInformation *pPath = pStandLst->GetInfo( sPath, TRUE ); - if( pPath ) { - ByteString sAddPath( pPath->GetValue()); -#ifdef UNX - sAddPath.SearchAndReplaceAll( "\\", "/" ); -#else - sAddPath.SearchAndReplaceAll( "/", "\\" ); -#endif - String ssAddPath( sAddPath, RTL_TEXTENCODING_ASCII_US ); - aEntry += DirEntry( ssAddPath ); - } - } - GenericInformationList *pProjects = pProjectsKey->GetSubList(); - if ( pProjects ) { - String sPrjDir( String::CreateFromAscii( "prj" )); - String sSolarFile( String::CreateFromAscii( "build.lst" )); - - for ( size_t j = 0; j < pProjects->size(); j++ ) { - ByteString sProject( *(*pProjects)[ j ] ); - String ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); - - DirEntry aPrjEntry( aEntry ); - - aPrjEntry += DirEntry( ssProject ); - aPrjEntry += DirEntry( sPrjDir ); - aPrjEntry += DirEntry( sSolarFile ); - - pFileList->push_back( new String( aPrjEntry.GetFull()) ); - - ByteString sFile( aPrjEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - fprintf( stdout, "%s\n", sFile.GetBuffer()); - } - } - } - } - } - } - } - Read( pFileList ); - } -} - -/*****************************************************************************/ -void StarWriter::CleanUp() -/*****************************************************************************/ -{ - Expand_Impl(); -} - -/*****************************************************************************/ -USHORT StarWriter::Read( String aFileName, BOOL bReadComments, USHORT nMode ) -/*****************************************************************************/ -{ - nStarMode = nMode; - - ByteString aString; - aFileList.push_back( new String( aFileName ) ); - - DirEntry aEntry( aFileName ); - aEntry.ToAbs(); - aEntry = aEntry.GetPath().GetPath().GetPath(); - sSourceRoot = aEntry.GetFull(); - - while ( !aFileList.empty() ) - { - StarFile *pFile = new StarFile( *aFileList.front() ); - if ( pFile->Exists()) { - SimpleConfig aSolarConfig( *aFileList.front() ); - while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) - InsertTokenLine ( aString ); - } - delete pFile; - delete aFileList.front(); - aFileList.erase( aFileList.begin() ); - } - // resolve all dependencies recursive - Expand_Impl(); - - // Die gefundenen Abhaengigkeiten rekursiv aufloesen - Expand_Impl(); - return 0; -} - -/*****************************************************************************/ -USHORT StarWriter::Read( SolarFileList *pSolarFiles, BOOL bReadComments ) -/*****************************************************************************/ -{ - nStarMode = STAR_MODE_MULTIPLE_PARSE; - - // this ctor is used by StarBuilder to get the information for the whole workspace - while ( !pSolarFiles->empty() ) - { - ByteString aString; - StarFile *pFile = new StarFile( *pSolarFiles->front() ); - if ( pFile->Exists()) { - SimpleConfig aSolarConfig( *pSolarFiles->front() ); - while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) - InsertTokenLine ( aString ); - } - delete pFile; - delete pSolarFiles->front(); - pSolarFiles->erase( pSolarFiles->begin() ); - } - delete pSolarFiles; - - Expand_Impl(); - return 0; -} - -/*****************************************************************************/ -USHORT StarWriter::WritePrj( Prj *pPrj, SvFileStream& rStream ) -/*****************************************************************************/ -{ - ByteString aDataString; - ByteString aTab('\t'); - ByteString aSpace(' '); - ByteString aEmptyString(""); - SByteStringList* pCmdDepList; - - CommandData* pCmdData = NULL; - if ( pPrj->Count() > 0 ) - { - pCmdData = pPrj->First(); - SByteStringList* pPrjDepList = pPrj->GetDependencies( FALSE ); - if ( pPrjDepList != 0 ) - { - aDataString = pPrj->GetPreFix(); - aDataString += aTab; - aDataString += pPrj->GetProjectName(); - aDataString += aTab; - if ( pPrj->HasHardDependencies()) - aDataString+= ByteString("::"); - else - aDataString+= ByteString(":"); - aDataString += aTab; - for ( size_t i = 0; i< pPrjDepList->size(); i++ ) { - aDataString += *(*pPrjDepList)[ i ]; - aDataString += aSpace; - } - aDataString+= "NULL"; - - rStream.WriteLine( aDataString ); - - pCmdData = pPrj->Next(); - } - if ( pCmdData ) { - do - { - if (( aDataString = pCmdData->GetComment()) == aEmptyString ) - { - aDataString = pPrj->GetPreFix(); - aDataString += aTab; - - aDataString+= pCmdData->GetPath(); - aDataString += aTab; - USHORT nPathLen = pCmdData->GetPath().Len(); - if ( nPathLen < 40 ) - for ( int i = 0; i < 9 - pCmdData->GetPath().Len() / 4 ; i++ ) - aDataString += aTab; - else - for ( int i = 0; i < 12 - pCmdData->GetPath().Len() / 4 ; i++ ) - aDataString += aTab; - aDataString += pCmdData->GetCommandTypeString(); - aDataString += aTab; - if ( pCmdData->GetCommandType() == COMMAND_GET ) - aDataString += aTab; - if ( pCmdData->GetCommandPara() == aEmptyString ) - aDataString+= ByteString("-"); - else - aDataString+= pCmdData->GetCommandPara(); - aDataString += aTab; - aDataString+= pCmdData->GetOSTypeString(); - if ( pCmdData->GetClientRestriction().Len()) { - aDataString += ByteString( "," ); - aDataString += pCmdData->GetClientRestriction(); - } - aDataString += aTab; - aDataString += pCmdData->GetLogFile(); - aDataString += aSpace; - - pCmdDepList = pCmdData->GetDependencies(); - if ( pCmdDepList ) - for ( size_t i = 0; i< pCmdDepList->size(); i++ ) { - aDataString += *(*pCmdDepList)[ i ]; - aDataString += aSpace; - } - aDataString += "NULL"; - } - - rStream.WriteLine( aDataString ); - - pCmdData = pPrj->Next(); - } while ( pCmdData ); - } - } - return 0; -} - -/*****************************************************************************/ -USHORT StarWriter::Write( String aFileName ) -/*****************************************************************************/ -{ - SvFileStream aFileStream; - - aFileStream.Open( aFileName, STREAM_WRITE | STREAM_TRUNC); - - if ( Count() > 0 ) - { - Prj* pPrj = First(); - do - { - WritePrj( pPrj, aFileStream ); - pPrj = Next(); - } while ( pPrj ); - } - - aFileStream.Close(); - - return 0; -} - -/*****************************************************************************/ -USHORT StarWriter::WriteMultiple( String rSourceRoot ) -/*****************************************************************************/ -{ - if ( Count() > 0 ) - { - String sPrjDir( String::CreateFromAscii( "prj" )); - String sSolarFile( String::CreateFromAscii( "build.lst" )); - - Prj* pPrj = First(); - do - { - String sName( pPrj->GetProjectName(), RTL_TEXTENCODING_ASCII_US ); - - DirEntry aEntry( rSourceRoot ); - aEntry += DirEntry( sName ); - aEntry += DirEntry( sPrjDir ); - aEntry += DirEntry( sSolarFile ); - - SvFileStream aFileStream; - aFileStream.Open( aEntry.GetFull(), STREAM_WRITE | STREAM_TRUNC); - - WritePrj( pPrj, aFileStream ); - - aFileStream.Close(); - - pPrj = Next(); - } while ( pPrj ); - } - - return 0; -} - -/*****************************************************************************/ -void StarWriter::InsertTokenLine ( ByteString& rString ) -/*****************************************************************************/ -{ - int i = 0; - ByteString aWhat, aWhatOS, - sClientRestriction, aLogFileName, aProjectName, aPrefix, aCommandPara; - static ByteString aDirName; - BOOL bPrjDep = FALSE; - BOOL bHardDep = FALSE; - USHORT nCommandType = 0; - USHORT nOSType = 0; - CommandData* pCmdData; - SByteStringList *pDepList2 = NULL; - Prj* pPrj; - - ByteString aEmptyString; - ByteString aToken = rString.GetToken( 0, '\t' ); - ByteString aCommentString; - - const char* yytext = aToken.GetBuffer(); - - while ( !( aToken == aEmptyString ) ) - { - switch (i) - { - case 0: - if ( rString.Search( "#" ) == 0 ) - { - i = -1; - aCommentString = rString; - rString = aEmptyString; - if ( Count() == 0 ) - aDirName = "null_entry" ; //comments at begin of file - break; - } - aPrefix = yytext; - pDepList2 = NULL; - break; - case 1: - aDirName = yytext; - break; - case 2: - if ( !strcmp( yytext, ":" )) - { - bPrjDep = TRUE; - bHardDep = FALSE; - i = 9; - } - else if ( !strcmp( yytext, "::" )) - { - bPrjDep = TRUE; - bHardDep = TRUE; - i = 9; - } - else - { - bPrjDep = FALSE; - bHardDep = FALSE; - - aWhat = yytext; - if ( aWhat == "nmake" ) - nCommandType = COMMAND_NMAKE; - else if ( aWhat == "get" ) - nCommandType = COMMAND_GET; - else { - ULONG nOffset = aWhat.Copy( 3 ).ToInt32(); - nCommandType = sal::static_int_cast< USHORT >( - COMMAND_USER_START + nOffset - 1); - } - } - break; - case 3: - if ( !bPrjDep ) - { - aWhat = yytext; - if ( aWhat == "-" ) - { - aCommandPara = ByteString(); - } - else - aCommandPara = aWhat; - } - break; - case 4: - if ( !bPrjDep ) - { - aWhatOS = yytext; - if ( aWhatOS.GetTokenCount( ',' ) > 1 ) { - sClientRestriction = aWhatOS.Copy( aWhatOS.GetToken( 0, ',' ).Len() + 1 ); - aWhatOS = aWhatOS.GetToken( 0, ',' ); - } - aWhatOS = aWhatOS.GetToken( 0, ',' ); - if ( aWhatOS == "all" ) - nOSType = ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX ); - else if ( aWhatOS == "w" ) - nOSType = ( OS_WIN16 | OS_WIN32 ); - else if ( aWhatOS == "p" ) - nOSType = OS_OS2; - else if ( aWhatOS == "u" ) - nOSType = OS_UNX; - else if ( aWhatOS == "d" ) - nOSType = OS_WIN16; - else if ( aWhatOS == "n" ) - nOSType = OS_WIN32; - else - nOSType = OS_NONE; - } - break; - case 5: - if ( !bPrjDep ) - { - aLogFileName = yytext; - } - break; - default: - if ( !bPrjDep ) - { - ByteString aItem = yytext; - if ( aItem == "NULL" ) - { - // Liste zu Ende - i = -1; - } - else - { - // ggfs. Dependency liste anlegen und ergaenzen - if ( !pDepList2 ) - pDepList2 = new SByteStringList; - pDepList2->PutString( new ByteString( aItem )); - } - } - else - { - ByteString aItem = yytext; - if ( aItem == "NULL" ) - { - // Liste zu Ende - i = -1; - bPrjDep= FALSE; - } - else - { - aProjectName = aDirName.GetToken ( 0, '\\'); - if ( HasProject( aProjectName )) - { - pPrj = GetPrj( aProjectName ); - // Projekt exist. schon, neue Eintraege anhaengen - } - else - { - // neues Project anlegen - pPrj = new Prj ( aProjectName ); - pPrj->SetPreFix( aPrefix ); - Insert(pPrj,LIST_APPEND); - } - pPrj->AddDependencies( aItem ); - pPrj->HasHardDependencies( bHardDep ); - - if ( nStarMode == STAR_MODE_RECURSIVE_PARSE ) { - String sItem( aItem, RTL_TEXTENCODING_ASCII_US ); - InsertSolarList( sItem ); - } - } - - } - break; - } - /* Wenn dieses Project noch nicht vertreten ist, in die Liste - der Solar-Projekte einfuegen */ - if ( i == -1 ) - { - aProjectName = aDirName.GetToken ( 0, '\\'); - if ( HasProject( aProjectName )) - { - pPrj = GetPrj( aProjectName ); - // Projekt exist. schon, neue Eintraege anhaengen - } - else - { - // neues Project anlegen - pPrj = new Prj ( aProjectName ); - pPrj->SetPreFix( aPrefix ); - Insert(pPrj,LIST_APPEND); - } - - pCmdData = new CommandData; - pCmdData->SetPath( aDirName ); - pCmdData->SetCommandType( nCommandType ); - pCmdData->SetCommandPara( aCommandPara ); - pCmdData->SetOSType( nOSType ); - pCmdData->SetLogFile( aLogFileName ); - pCmdData->SetComment( aCommentString ); - pCmdData->SetClientRestriction( sClientRestriction ); - if ( pDepList2 ) - pCmdData->SetDependencies( pDepList2 ); - - pPrj->Insert ( pCmdData, LIST_APPEND ); - - } - i++; - - rString.Erase(0, aToken.Len()+1); - aToken = rString.GetToken( 0, '\t' ); - yytext = aToken.GetBuffer(); - - } - // und wer raeumt die depLst wieder ab ? -} - -/*****************************************************************************/ -BOOL StarWriter::InsertProject ( Prj* ) -/*****************************************************************************/ -{ - return FALSE; -} - -/*****************************************************************************/ -Prj* StarWriter::RemoveProject ( ByteString aProjectName ) -/*****************************************************************************/ -{ - size_t nCountMember = Count(); - Prj* pPrj; - Prj* pPrjFound = NULL; - SByteStringList* pPrjDeps; - - for ( size_t i = 0; i < nCountMember; i++ ) - { - pPrj = GetObject( i ); - if ( pPrj->GetProjectName() == aProjectName ) - pPrjFound = pPrj; - else - { - pPrjDeps = pPrj->GetDependencies( FALSE ); - if ( pPrjDeps ) - { - ByteString* pString; - size_t nPrjDepsCount = pPrjDeps->size(); - for ( ULONG j = nPrjDepsCount; j > 0; ) - { - pString = (*pPrjDeps)[ --j ]; - if ( pString->GetToken( 0, '.') == aProjectName ) - pPrjDeps->erase( j ); - } - } - } - } - - Remove( pPrjFound ); - - return pPrjFound; -} - -// -// class StarFile -// - -/*****************************************************************************/ -StarFile::StarFile( const String &rFile ) -/*****************************************************************************/ - : aFileName( rFile ) -{ - DirEntry aEntry( aFileName ); - if ( aEntry.Exists()) { - bExists = TRUE; - FileStat aStat( aEntry ); - aDate = aStat.DateModified(); - aTime = aStat.TimeModified(); - } - else - bExists = FALSE; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 650f4ade4b58..1ebd9e85ac9a 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -78,7 +78,7 @@ void RscHrcDep::Execute() CppDep::Execute(); } -SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) +int main( int argc, char** argv ) { int c; char aBuf[255]; @@ -86,7 +86,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) char pOutputFileName[255]; char pSrsFileName[255]; String aSrsBaseName; - BOOL bSource = FALSE; + sal_Bool bSource = sal_False; ByteString aRespArg; // who needs anything but '/' ? // String aDelim = String(DirEntry::GetAccessDelimiter()); @@ -160,7 +160,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) pDep->AddSource( &aBuf2[0] ); aRespArg += " "; aRespArg += &aBuf2[0]; - bSource = TRUE; + bSource = sal_True; } } } @@ -193,7 +193,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv ) case 'h' : case 'H' : case '?' : - printf("RscDep 1.0 (c)2000 StarOffice\n"); + printf("RscDep 1.0\n"); break; default: diff --git a/tools/bootstrp/sstring.cxx b/tools/bootstrp/sstring.cxx deleted file mode 100644 index 9d96508deb88..000000000000 --- a/tools/bootstrp/sstring.cxx +++ /dev/null @@ -1,216 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#define ENABLE_BYTESTRING_STREAM_OPERATORS -#include <tools/stream.hxx> -#include "bootstrp/sstring.hxx" - -SByteStringList::SByteStringList() -{ -} - -SByteStringList::~SByteStringList() -{ - CleanUp(); -} - -size_t SByteStringList::size() const { - return maList.size(); -} - -ByteString* SByteStringList::erase( size_t i ) { - ByteString* result = NULL; - if ( i < maList.size() ) { - ByteStringList::iterator it = maList.begin(); - ::std::advance( it, i ); - result = *it; - maList.erase( it ); - } - return result; -} - - -ByteString* SByteStringList::operator[]( size_t i ) const { - return ( i < maList.size() ) ? maList[ i ] : NULL; -} - -ByteString* SByteStringList::at( size_t i ) const { - return ( i < maList.size() ) ? maList[ i ] : NULL; -} - -size_t SByteStringList::IsString( ByteString* pStr ) -{ - size_t nRet = NOT_THERE; - if ( (nRet = GetPrevString( pStr )) != 0 ) - { - ByteString* pString = maList[ nRet ]; - if ( *pString == *pStr ) - return nRet; - else - return NOT_THERE; - } - else - { - ByteString* pString = maList.empty() ? NULL : maList[ 0 ]; - if ( pString && (*pString == *pStr) ) - return 0; - else - return NOT_THERE; - } -} - -size_t SByteStringList::GetPrevString( ByteString* pStr ) -{ - size_t nRet = 0; - BOOL bFound = FALSE; - size_t nCountMember = maList.size(); - size_t nUpper = nCountMember; - size_t nLower = 0; - size_t nCurrent = nUpper / 2; - size_t nRem = 0; - ByteString* pString; - - do - { - if ( (nCurrent == nLower) || (nCurrent == nUpper) ) - return nLower; - pString = maList[ nCurrent ]; - StringCompare nResult = pStr->CompareTo( *pString ); - if ( nResult == COMPARE_LESS ) - { - nUpper = nCurrent; - nCurrent = (nCurrent + nLower) /2; - } - else if ( nResult == COMPARE_GREATER ) - { - nLower = nCurrent; - nCurrent = (nUpper + nCurrent) /2; - } - else if ( nResult == COMPARE_EQUAL ) - return nCurrent; - if ( nRem == nCurrent ) - return nCurrent; - nRem = nCurrent; - } - while ( !bFound ); - return nRet; -} - -/************************************************************************** -* -* Sortiert einen ByteString in die Liste ein und gibt die Position, -* an der einsortiert wurde, zurueck -* -**************************************************************************/ - -size_t SByteStringList::PutString( ByteString* pStr ) -{ - size_t nPos = GetPrevString ( pStr ); - if ( maList.size() ) - { - ByteString* pString = NULL; - pString = maList[ 0 ]; - if ( pString->CompareTo( *pStr ) == COMPARE_GREATER ) - { - maList.insert( maList.begin(), pStr ); - return 0; - } - pString = maList[ nPos ]; - if ( *pStr != *pString ) - { - if ( ++nPos < maList.size() ) { - ByteStringList::iterator it = maList.begin(); - ::std::advance( it, nPos ); - maList.insert( it, pStr ); - return nPos; - } else { - maList.push_back( pStr ); - return maList.size() - 1; - } - } - } - else - { - maList.push_back( pStr ); - return 0; - } - - return NOT_THERE; -} - -ByteString* SByteStringList::RemoveString( const ByteString& rName ) -{ - ByteString* pReturn = NULL; - - for ( ByteStringList::iterator it = maList.begin(); it < maList.end(); ++it ) - { - if ( rName == *(*it) ) - { - pReturn = *it; - maList.erase( it ); - return pReturn; - } - } - - return pReturn; -} - -void SByteStringList::CleanUp() -{ - for ( size_t i = 0, n = maList.size(); i < n; ++i ) { - delete maList[ i ]; - } - maList.clear(); -} - -SByteStringList& SByteStringList::operator<< ( SvStream& rStream ) -{ - sal_uInt32 nListCount; - rStream >> nListCount; - for ( sal_uInt32 i = 0; i < nListCount; i++ ) { - ByteString* pByteString = new ByteString(); - rStream >> *pByteString; - maList.push_back( pByteString ); - } - return *this; -} - -SByteStringList& SByteStringList::operator>> ( SvStream& rStream ) -{ - sal_uInt32 nListCount = maList.size(); - rStream << nListCount; - for ( size_t i = 0; i < nListCount; ++i ) { - rStream << *( maList[ i ] ); - } - return *this; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |