diff options
-rw-r--r-- | tools/bootstrp/addexes2/makefile.mk | 2 | ||||
-rw-r--r-- | tools/bootstrp/command.cxx | 690 | ||||
-rw-r--r-- | tools/bootstrp/makefile.mk | 18 | ||||
-rw-r--r-- | tools/bootstrp/prj.cxx | 1438 | ||||
-rw-r--r-- | tools/bootstrp/sstring.cxx | 317 | ||||
-rw-r--r-- | tools/inc/bootstrp/command.hxx | 165 | ||||
-rw-r--r-- | tools/inc/bootstrp/listmacr.hxx | 60 | ||||
-rw-r--r-- | tools/inc/bootstrp/mkcreate.hxx | 4 | ||||
-rw-r--r-- | tools/inc/bootstrp/prj.hxx | 273 | ||||
-rw-r--r-- | tools/inc/bootstrp/sstring.hxx | 105 | ||||
-rw-r--r-- | tools/prj/d.lst | 17 | ||||
-rw-r--r-- | tools/util/makefile.mk | 39 |
12 files changed, 31 insertions, 3097 deletions
diff --git a/tools/bootstrp/addexes2/makefile.mk b/tools/bootstrp/addexes2/makefile.mk index 492d6f3105ed..7e4d3d0da7fa 100644 --- a/tools/bootstrp/addexes2/makefile.mk +++ b/tools/bootstrp/addexes2/makefile.mk @@ -47,7 +47,7 @@ APP1STDLIBS+=-lpthread APP1STDLIBS+=-lpthread .ENDIF APP1LIBS= $(LB)$/btstrp.lib $(LB)$/bootstrp2.lib -APP1DEPN= $(LB)$/atools.lib $(LB)$/btstrp.lib $(LB)$/bootstrp2.lib +APP1DEPN= $(LB)$/btstrp.lib $(LB)$/bootstrp2.lib DEPOBJFILES = $(APP1OBJS) diff --git a/tools/bootstrp/command.cxx b/tools/bootstrp/command.cxx deleted file mode 100644 index 605965339b0e..000000000000 --- a/tools/bootstrp/command.cxx +++ /dev/null @@ -1,690 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#ifdef SCO -#define _IOSTREAM_H -#endif - -#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 - -//#define MH_TEST2 1 // fuers direkte Testen - -#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 (HPUX) || defined (MACOSX) -#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) { - //cout << "Error: nospace" << endl; - 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) { - //cout << "Error: nospace" << endl; - 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) { - //cout << "Error: nospace" << endl; - 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++) { - 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() -/*****************************************************************************/ -{ - //cout << "******* start print *******" << endl; - //cout << "nArgc = " << nArgc << endl; - //cout << "CommandBuffer = " << CommandBuffer << endl; - for (int i = 0; ppArgv[i] != NULL; i++) { - //cout << "ppArgv[" << i << "] = " << ppArgv[i] << endl; - } - //cout << "******** end print ********" << endl; -} - -/*****************************************************************************/ -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) { - //cout << "Error: nospace" << endl; - 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) { - //cout << "Error: no space" << endl; - 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(); -#ifndef UNX - aCommandLine += " /c "; -#else - aCommandLine += " -c "; -#endif - - ByteString sCmd( rString.GetToken( 0, ' ' )); - ByteString sParam( rString.Copy( sCmd.Len())); - - aCommandLine += Search( thePath, sCmd ); - aCommandLine += sParam; - - ImplInit(); -} - -/*****************************************************************************/ -CCommand::CCommand( const char *pChar ) -/*****************************************************************************/ -{ - ByteString aString = pChar; - aString.SearchAndReplace( '\t', ' ' ); - aCommand = aString.GetToken( 0, ' ' ); - - aCommandLine = Search(); -#ifndef UNX - aCommandLine += " /c "; -#else - aCommandLine += " -c "; -#endif - ByteString rString( pChar ); - - ByteString sCmd( rString.GetToken( 0, ' ' )); - ByteString sParam( rString.Copy( sCmd.Len())); - - aCommandLine += Search( thePath, 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 - //fprintf( stderr, "CComand : operator (int) not implemented\n"); - // **** Unix Implementierung *************** - 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" ); - } - } - //fprintf( stderr, "parent: %s %s\n", ppArgv[0] , ppArgv[1] ); - 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.dwXSize = 400; - //aStartupInfo.dwYSize = 400; - aStartupInfo.dwXCountChars = 40; - aStartupInfo.dwYCountChars = 40; - - // Farben setzen - aStartupInfo.dwFillAttribute = FOREGROUND_RED | BACKGROUND_RED | - BACKGROUND_BLUE | BACKGROUND_GREEN; - -// aStartupInfo.dwFlags = STARTF_USESTDHANDLES; - //aStartupInfo.wShowWindow = SW_NORMAL; //SW_SHOWDEFAULT; - //aStartupInfo.wShowWindow = SW_HIDE; //SW_SHOWNOACTIVATE; - aStartupInfo.wShowWindow = SW_SHOWNOACTIVATE; - aStartupInfo.cbReserved2 = NULL; - aStartupInfo.lpReserved2 = NULL; - //aStartupInfo.hStdInput = stdin; - //aStartupInfo.hStdOutput = stdout; - //aStartupInfo.hStdError = stderr; - - 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; -} diff --git a/tools/bootstrp/makefile.mk b/tools/bootstrp/makefile.mk index b592cb900630..1d16ed2aeec2 100644 --- a/tools/bootstrp/makefile.mk +++ b/tools/bootstrp/makefile.mk @@ -42,32 +42,20 @@ CDEFS+=-D_TOOLS_STRINGLIST OBJFILES= \ $(OBJ)$/appdef.obj \ - $(OBJ)$/command.obj \ $(OBJ)$/cppdep.obj\ - $(OBJ)$/inimgr.obj\ - $(OBJ)$/mkcreate.obj \ - $(OBJ)$/sstring.obj \ - $(OBJ)$/prj.obj + $(OBJ)$/inimgr.obj SLOFILES= \ $(SLO)$/appdef.obj \ - $(SLO)$/command.obj \ $(SLO)$/cppdep.obj \ - $(SLO)$/inimgr.obj \ - $(SLO)$/mkcreate.obj \ - $(SLO)$/sstring.obj \ - $(SLO)$/prj.obj - + $(SLO)$/inimgr.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 + $(OBJ)$/inimgr.obj LIB2TARGET= $(LB)$/$(TARGET1).lib LIB2ARCHIV= $(LB)$/lib$(TARGET1).a diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index 4f4d44a33536..e5ed5b2451e9 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -29,7 +29,7 @@ #include "precompiled_tools.hxx" #include <stdlib.h> #include <stdio.h> -#include "bootstrp/sstring.hxx" +//#include "bootstrp/sstring.hxx" #include <vos/mutex.hxx> #include <tools/stream.hxx> @@ -37,6 +37,8 @@ #include "bootstrp/prj.hxx" #include "bootstrp/inimgr.hxx" +DECLARE_LIST( UniStringList, UniString* ) + //#define TEST 1 #if defined(WNT) || defined(OS2) @@ -47,7 +49,7 @@ #define PATH_DELIMETER '/' #endif -Link Star::aDBNotFoundHdl; +//Link Star::aDBNotFoundHdl; // // class SimpleConfig @@ -166,1435 +168,3 @@ ByteString SimpleConfig::GetCleanedNextLine( BOOL bReadComments ) return aTmpStr; } - - -// -// class CommandData -// - -/*****************************************************************************/ -CommandData::CommandData() -/*****************************************************************************/ -{ - nOSType = 0; - nCommand = 0; - pDepList = 0; -} - -/*****************************************************************************/ -CommandData::~CommandData() -/*****************************************************************************/ -{ - if ( pDepList ) - { - ByteString *pString = pDepList->First(); - while ( pString ) - { - delete pString; - pString = pDepList->Next(); - } - 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 ) - { - ByteString *pString = pPrjDepList->First(); - while ( pString ) - { - delete pString; - pString = pPrjDepList->Next(); - } - delete pPrjDepList; - - pPrjDepList = NULL; - } - - if ( pPrjInitialDepList ) - { - ByteString *pString = pPrjInitialDepList->First(); - while ( pString ) - { - delete pString; - pString = pPrjInitialDepList->Next(); - } - 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 ); - - Insert( pData ); - - return FALSE; -} - -/*****************************************************************************/ -// -// removes directory and existing dependencies on it -// -CommandData* Prj::RemoveDirectory ( ByteString aLogFileName ) -/*****************************************************************************/ -{ - ULONG nCountMember = Count(); - CommandData* pData; - CommandData* pDataFound = NULL; - SByteStringList* pDataDeps; - - for ( USHORT i = 0; i < nCountMember; i++ ) - { - pData = GetObject( i ); - if ( pData->GetLogFile() == aLogFileName ) - pDataFound = pData; - else - { - pDataDeps = pData->GetDependencies(); - if ( pDataDeps ) - { - ByteString* pString; - ULONG nDataDepsCount = pDataDeps->Count(); - for ( ULONG j = nDataDepsCount; j > 0; j-- ) - { - pString = pDataDeps->GetObject( j - 1 ); - if ( pString->GetToken( 0, '.') == aLogFileName ) - pDataDeps->Remove( pString ); - } - } - } - } - - 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 ( ULONG i = 0; i < pDrives->Count(); i++ ) { - GenericInformation *pDrive = pDrives->GetObject( 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 ( ULONG j = 0; j < pProjects->Count(); j++ ) { - ByteString sProject( *pProjects->GetObject( j )); - String ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); - - DirEntry aPrjEntry( aEntry ); - - aPrjEntry += DirEntry( ssProject ); - aPrjEntry += DirEntry( sPrjDir ); - aPrjEntry += DirEntry( sSolarFile ); - - pFileList->Insert( new String( aPrjEntry.GetFull()), LIST_APPEND ); - - ByteString sFile( aPrjEntry.GetFull(), RTL_TEXTENCODING_ASCII_US ); - } - } - } - } - } - } - } - Read( pFileList ); - } -} - -/*****************************************************************************/ -Star::~Star() -/*****************************************************************************/ -{ -} - -/*****************************************************************************/ -BOOL Star::NeedsUpdate() -/*****************************************************************************/ -{ - aMutex.acquire(); - for ( ULONG i = 0; i < aLoadedFilesList.Count(); i++ ) - if ( aLoadedFilesList.GetObject( i )->NeedsUpdate()) { - aMutex.release(); - return TRUE; - } - - aMutex.release(); - return FALSE; -} - -/*****************************************************************************/ -void Star::Read( String &rFileName ) -/*****************************************************************************/ -{ - ByteString aString; - aFileList.Insert( new String( rFileName )); - - DirEntry aEntry( rFileName ); - aEntry.ToAbs(); - aEntry = aEntry.GetPath().GetPath().GetPath(); - sSourceRoot = aEntry.GetFull(); - - while( aFileList.Count()) { - StarFile *pFile = new StarFile( *aFileList.GetObject(( ULONG ) 0 )); - if ( pFile->Exists()) { - SimpleConfig aSolarConfig( *aFileList.GetObject(( ULONG ) 0 )); - while (( aString = aSolarConfig.GetNext()) != "" ) - InsertToken (( char * ) aString.GetBuffer()); - } - aMutex.acquire(); - aLoadedFilesList.Insert( pFile, LIST_APPEND ); - aMutex.release(); - aFileList.Remove(( ULONG ) 0 ); - } - // resolve all dependencies recursive - Expand_Impl(); -} - -/*****************************************************************************/ -void Star::Read( SolarFileList *pSolarFiles ) -/*****************************************************************************/ -{ - while( pSolarFiles->Count()) { - ByteString aString; - - StarFile *pFile = new StarFile( *pSolarFiles->GetObject(( ULONG ) 0 )); - if ( pFile->Exists()) { - SimpleConfig aSolarConfig( *pSolarFiles->GetObject(( ULONG ) 0 )); - while (( aString = aSolarConfig.GetNext()) != "" ) - InsertToken (( char * ) aString.GetBuffer()); - } - - aMutex.acquire(); - aLoadedFilesList.Insert( pFile, LIST_APPEND ); - aMutex.release(); - delete pSolarFiles->Remove(( ULONG ) 0 ); - } - 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 ( ULONG i = 0; i < aFileList.Count(); i++ ) { - if (( *aFileList.GetObject( i )) == sFileName ) - return; - } - - ByteString ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); - if ( HasProject( ssProject )) - return; - - aFileList.Insert( new String( sFileName ), LIST_APPEND ); -} - -/*****************************************************************************/ -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; - ULONG i, nRetPos; - - if ( pPrjLst ) { - pDepLst = pDepPrj->GetDependencies(); - if ( pDepLst ) { - for ( i = 0; i < pDepLst->Count(); i++ ) { - pDepend = pDepLst->GetObject( 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 (Prj*)NULL; - 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 ( ULONG i = 0; i < pDrives->Count(); i++ ) { - GenericInformation *pDrive = pDrives->GetObject( 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 ( ULONG j = 0; j < pProjects->Count(); j++ ) { - ByteString sProject( *pProjects->GetObject( j )); - String ssProject( sProject, RTL_TEXTENCODING_ASCII_US ); - - DirEntry aPrjEntry( aEntry ); - - aPrjEntry += DirEntry( ssProject ); - aPrjEntry += DirEntry( sPrjDir ); - aPrjEntry += DirEntry( sSolarFile ); - - pFileList->Insert( new String( aPrjEntry.GetFull()), LIST_APPEND ); - - 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.Insert( new String( aFileName )); - - DirEntry aEntry( aFileName ); - aEntry.ToAbs(); - aEntry = aEntry.GetPath().GetPath().GetPath(); - sSourceRoot = aEntry.GetFull(); - - while( aFileList.Count()) { - - StarFile *pFile = new StarFile( *aFileList.GetObject(( ULONG ) 0 )); - if ( pFile->Exists()) { - SimpleConfig aSolarConfig( *aFileList.GetObject(( ULONG ) 0 )); - while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) - InsertTokenLine ( aString ); - } - - aMutex.acquire(); - aLoadedFilesList.Insert( pFile, LIST_APPEND ); - aMutex.release(); - delete aFileList.Remove(( ULONG ) 0 ); - } - // 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->Count()) { - ByteString aString; - - StarFile *pFile = new StarFile( *pSolarFiles->GetObject(( ULONG ) 0 )); - if ( pFile->Exists()) { - SimpleConfig aSolarConfig( *pSolarFiles->GetObject(( ULONG ) 0 )); - while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) - InsertTokenLine ( aString ); - } - - aMutex.acquire(); - aLoadedFilesList.Insert( pFile, LIST_APPEND ); - aMutex.release(); - delete pSolarFiles->Remove(( ULONG ) 0 ); - } - 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 ( USHORT i = 0; i< pPrjDepList->Count(); i++ ) { - aDataString += *pPrjDepList->GetObject( 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 ( USHORT i = 0; i< pCmdDepList->Count(); i++ ) { - aDataString += *pCmdDepList->GetObject( 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 ) -/*****************************************************************************/ -{ - ULONG nCountMember = Count(); - Prj* pPrj; - Prj* pPrjFound = NULL; - SByteStringList* pPrjDeps; - - for ( USHORT i = 0; i < nCountMember; i++ ) - { - pPrj = GetObject( i ); - if ( pPrj->GetProjectName() == aProjectName ) - pPrjFound = pPrj; - else - { - pPrjDeps = pPrj->GetDependencies( FALSE ); - if ( pPrjDeps ) - { - ByteString* pString; - ULONG nPrjDepsCount = pPrjDeps->Count(); - for ( ULONG j = nPrjDepsCount; j > 0; j-- ) - { - pString = pPrjDeps->GetObject( j - 1 ); - if ( pString->GetToken( 0, '.') == aProjectName ) - pPrjDeps->Remove( pString ); - } - } - } - } - - 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; -} - -/*****************************************************************************/ -BOOL StarFile::NeedsUpdate() -/*****************************************************************************/ -{ - DirEntry aEntry( aFileName ); - if ( aEntry.Exists()) { - if ( !bExists ) { - bExists = TRUE; - return TRUE; - } - FileStat aStat( aEntry ); - if (( aStat.DateModified() > aDate ) || - (( aStat.DateModified() == aDate ) && ( aStat.TimeModified() > aTime ))) - return TRUE; - } - return FALSE; -} - diff --git a/tools/bootstrp/sstring.cxx b/tools/bootstrp/sstring.cxx deleted file mode 100644 index 8c83dedf72ec..000000000000 --- a/tools/bootstrp/sstring.cxx +++ /dev/null @@ -1,317 +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. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#ifndef _TOOLS_STRINGLIST -# define _TOOLS_STRINGLIST -#endif - -#define ENABLE_BYTESTRING_STREAM_OPERATORS -#include <tools/stream.hxx> -#include "bootstrp/sstring.hxx" - -SByteStringList::SByteStringList() -{ -} - -SByteStringList::~SByteStringList() -{ -} - -ULONG SByteStringList::IsString( ByteString* pStr ) -{ - ULONG nRet = NOT_THERE; - if ( (nRet = GetPrevString( pStr )) != 0 ) - { - ByteString* pString = GetObject( nRet ); - if ( *pString == *pStr ) - return nRet; - else - return NOT_THERE; - } - else - { - ByteString* pString = GetObject( 0 ); - if ( pString && (*pString == *pStr) ) - return 0; - else - return NOT_THERE; - } -} - -ULONG SByteStringList::GetPrevString( ByteString* pStr ) -{ - ULONG nRet = 0; - BOOL bFound = FALSE; - ULONG nCountMember = Count(); - ULONG nUpper = nCountMember; - ULONG nLower = 0; - ULONG nCurrent = nUpper / 2; - ULONG nRem = 0; - ByteString* pString; - - do - { - if ( (nCurrent == nLower) || (nCurrent == nUpper) ) - return nLower; - pString = GetObject( 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 -* -**************************************************************************/ - -ULONG SByteStringList::PutString( ByteString* pStr ) -{ - ULONG nPos = GetPrevString ( pStr ); - if ( Count() ) - { - { - ByteString* pString = GetObject( 0 ); - if ( pString->CompareTo( *pStr ) == COMPARE_GREATER ) - { - Insert( pStr, (ULONG)0 ); - return (ULONG)0; - } - } - ByteString* pString = GetObject( nPos ); - if ( *pStr != *pString ) - { - Insert( pStr, nPos+1 ); - return ( nPos +1 ); - } - } - else - { - Insert( pStr ); - return (ULONG)0; - } - - return NOT_THERE; -} - -ByteString* SByteStringList::RemoveString( const ByteString& rName ) -{ - ULONG i; - ByteString* pReturn; - - for( i = 0 ; i < Count(); i++ ) - { - if ( rName == *GetObject( i ) ) - { - pReturn = GetObject(i); - Remove(i); - return pReturn; - } - } - - return NULL; -} - -void SByteStringList::CleanUp() -{ - ByteString* pByteString = First(); - while (pByteString) { - delete pByteString; - pByteString = Next(); - } - Clear(); -} - -SByteStringList& SByteStringList::operator<< ( SvStream& rStream ) -{ - sal_uInt32 nListCount; - rStream >> nListCount; - for ( USHORT i = 0; i < nListCount; i++ ) { - ByteString* pByteString = new ByteString(); - rStream >> *pByteString; - Insert (pByteString, LIST_APPEND); - } - return *this; -} - -SByteStringList& SByteStringList::operator>> ( SvStream& rStream ) -{ - sal_uInt32 nListCount = Count(); - rStream << nListCount; - ByteString* pByteString = First(); - while (pByteString) { - rStream << *pByteString; - pByteString = Next(); - } - return *this; -} - - - - - - - -SUniStringList::SUniStringList() -{ -} - -SUniStringList::~SUniStringList() -{ -} - -ULONG SUniStringList::IsString( UniString* pStr ) -{ - ULONG nRet = NOT_THERE; - if ( (nRet = GetPrevString( pStr )) != 0 ) - { - UniString* pString = GetObject( nRet ); - if ( *pString == *pStr ) - return nRet; - else - return NOT_THERE; - } - else - { - UniString* pString = GetObject( 0 ); - if ( pString && (*pString == *pStr) ) - return 0; - else - return NOT_THERE; - } -} - -ULONG SUniStringList::GetPrevString( UniString* pStr ) -{ - ULONG nRet = 0; - BOOL bFound = FALSE; - ULONG nCountMember = Count(); - ULONG nUpper = nCountMember; - ULONG nLower = 0; - ULONG nCurrent = nUpper / 2; - ULONG nRem = 0; - UniString* pString; - - do - { - if ( (nCurrent == nLower) || (nCurrent == nUpper) ) - return nLower; - pString = GetObject( 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 UniString in die Liste ein und gibt die Position, -* an der einsortiert wurde, zurueck -* -**************************************************************************/ - -ULONG SUniStringList::PutString( UniString* pStr ) -{ - ULONG nPos = GetPrevString ( pStr ); - if ( Count() ) - { - { - UniString* pString = GetObject( 0 ); - if ( pString->CompareTo( *pStr ) == COMPARE_GREATER ) - { - Insert( pStr, (ULONG)0); - return (ULONG)0; - } - } - UniString* pString = GetObject( nPos ); - if ( *pStr != *pString ) - { - Insert( pStr, nPos+1 ); - return ( nPos +1 ); - } - } - else - { - Insert( pStr ); - return (ULONG)0; - } - - return NOT_THERE; -} - -UniString* SUniStringList::RemoveString( const UniString& rName ) -{ - ULONG i; - UniString* pReturn; - - for( i = 0 ; i < Count(); i++ ) - { - if ( rName == *GetObject( i ) ) - { - pReturn = GetObject(i); - Remove(i); - return pReturn; - } - } - - return NULL; -} diff --git a/tools/inc/bootstrp/command.hxx b/tools/inc/bootstrp/command.hxx deleted file mode 100644 index e0d8f1e39aeb..000000000000 --- a/tools/inc/bootstrp/command.hxx +++ /dev/null @@ -1,165 +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. - * - ************************************************************************/ - -#ifndef COMMAND_HXX -#define COMMAND_HXX - -#include <iostream> - -#include <tools/stream.hxx> -#define STRLEN 100 -#ifndef UNX -#define TMPNAME "\\command.tmp" -#else -#define TMPNAME "/tmp/command.tmp" -#endif - -/** Different types of spawnable programs -*/ -enum ExeType -{ - EXE, /// programm is a native executable - BAT, /// programm is a DOS-Batch - BTM /// programm is a 4DOS-Batch -}; - -#define COMMAND_NOTFOUND 0x0001 -#define COMMAND_TOOBIG 0x0002 -#define COMMAND_INVALID 0x0004 -#define COMMAND_NOEXEC 0x0008 -#define COMMAND_NOMEM 0x0010 -#define COMMAND_UNKNOWN 0x0020 - -#ifdef WNT -#define COMMAND_SHELL "4nt.exe" -#endif -#ifdef OS2 -#define COMMAND_SHELL "4os2.exe" -#endif -#ifdef UNX -#define COMMAND_SHELL "csh" -#endif - -class CommandLine; -class LogWindow; - -class CommandLine -{ -friend class ChildProcess; -private: - char *CommandBuffer; - char *ComShell; - char **ppArgv; - BOOL bTmpWrite; - -public: - CommandLine(BOOL bTmpWrite = FALSE); - CommandLine(const char *, BOOL bTmpWrite = FALSE); - CommandLine(const CommandLine&, BOOL bTmpWrite = FALSE); - virtual ~CommandLine(); - - int nArgc; - - CommandLine& operator=(const CommandLine&); - CommandLine& operator=(const char *); - void BuildCommand(const char *); - char** GetCommand(void) { return ppArgv; } - void Strtokens(const char *); - void Print(); -}; - -static ByteString thePath( "PATH" ); - -/** Declares and spawns a child process. - The spawned programm could be a native executable or a schell script. -*/ -class CCommand -{ -private: - ByteString aCommandLine; - ByteString aCommand; - char *pArgv; - char **ppArgv; - ULONG nArgc; - int nError; - -protected: - void ImplInit(); - void Initpp( ULONG nCount, ByteString &rStr ); - -public: - /** Creates the process specified without spawning it - @param rString specifies the programm or shell scrip - */ - CCommand( ByteString &rString ); - - /** Creates the process specified without spawning it - @param pChar specifies the programm or shell scrip - */ - CCommand( const char *pChar ); - - /** Try to find the given programm in specified path - @param sEnv specifies the current search path, defaulted by environment - @param sItem specifies the system shell - @return the Location (when programm was found) - */ - static ByteString Search( ByteString sEnv = thePath, - ByteString sItem = COMMAND_SHELL ); - - /** Spawns the Process - @return 0 when spawned without errors, otherwise a error code - */ - operator int(); - - ByteString GetCommandLine_() { return aCommandLine; } - ByteString GetCommand() { return aCommand; } - - char** GetCommandStr() { return ppArgv; } -}; - -#define COMMAND_EXECUTE_WINDOW 0x0000001 -#define COMMAND_EXECUTE_CONSOLE 0x0000002 -#define COMMAND_EXECUTE_HIDDEN 0x0000004 -#define COMMAND_EXECUTE_START 0x0000008 -#define COMMAND_EXECUTE_WAIT 0x0000010 -#define COMMAND_EXECUTE_REMOTE 0x1000000 - -typedef ULONG CommandBits; - -/** Allowes to spawn programms hidden, waiting etc. - @see CCommand -*/ -class CCommandd : public CCommand -{ - CommandBits nFlag; -public: - CCommandd( ByteString &rString, CommandBits nBits ); - CCommandd( const char *pChar, CommandBits nBits ); - operator int(); -}; - -#endif diff --git a/tools/inc/bootstrp/listmacr.hxx b/tools/inc/bootstrp/listmacr.hxx deleted file mode 100644 index 8c678ff32275..000000000000 --- a/tools/inc/bootstrp/listmacr.hxx +++ /dev/null @@ -1,60 +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. - * - ************************************************************************/ - -#ifndef _LISTMACR_HXX -#define _LISTMACR_HXX - -#define DECL_DEST_LIST( TmpListType, ListType, PointerType ) \ -DECLARE_LIST(TmpListType, PointerType) \ -class ListType : public TmpListType \ -{ \ -public: \ - void ClearAndDelete() \ - { \ - while ( Count()) { \ - PointerType pTmp = GetObject(( ULONG ) 0 ); \ - delete pTmp; \ - Remove(( ULONG ) 0 ); \ - } \ - } \ - ~ListType() \ - { \ - ClearAndDelete(); \ - } \ -}; \ - -#endif - - - - - - - - - - diff --git a/tools/inc/bootstrp/mkcreate.hxx b/tools/inc/bootstrp/mkcreate.hxx index 991b5961a096..5510fb87f7b9 100644 --- a/tools/inc/bootstrp/mkcreate.hxx +++ b/tools/inc/bootstrp/mkcreate.hxx @@ -29,7 +29,9 @@ #define _MK_CREATE_HXX #include <tools/string.hxx> -#include "bootstrp/sstring.hxx" +//#include "bootstrp/sstring.hxx" + +DECLARE_LIST( UniStringList, UniString* ) #include <tools/list.hxx> #include "bootstrp/prj.hxx" diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx index 2d7664b8b69f..4b1ff91feb7b 100644 --- a/tools/inc/bootstrp/prj.hxx +++ b/tools/inc/bootstrp/prj.hxx @@ -30,98 +30,6 @@ #include <tools/fsys.hxx> #include <tools/stream.hxx> -#include "bootstrp/listmacr.hxx" -#include <vos/mutex.hxx> - -#define OS_NONE 0x0000 -#define OS_WIN16 0x0001 -#define OS_WIN32 0x0002 -#define OS_OS2 0x0004 -#define OS_UNX 0x0008 -#define OS_ALL ( OS_WIN16 | OS_WIN32 | OS_OS2 | OS_UNX ) - -#define COMMAND_PROJECTROOT 0x0000 -#define COMMAND_NMAKE 0x0001 -#define COMMAND_GET 0x0002 -#define COMMAND_USER_START 0x0003 -#define COMMAND_USER_END 0xFFFE -#define COMMAND_ALLDIRS 0xFFFF - -class SByteStringList; -class GenericInformationList; - -/* -// Pfade auf Konfigurationsdateien des Build-Servers - -#define REQUEST_DIR \\src\data4\source\b_server\server\newjob -*/ -/********************************************************************* -* -* Die Klasse CommandData haelte alle Informationen, die fuer die -* Abarbeitung eines Kommandos (nmake, get) noetig sind -* -*********************************************************************/ - -class CommandData -{ - ByteString aPrj; - ByteString aLogFileName; - ByteString aInpath; - ByteString aUpd; - ByteString aUpdMinor; - ByteString aProduct; - ByteString aCommand; - ByteString aPath; - ByteString aPrePath; - ByteString aPreFix; - ByteString aCommandPara; - ByteString aComment; - ByteString sClientRestriction; - SByteStringList *pDepList; - USHORT nOSType; - USHORT nCommand; - - ULONG nDepth; // Tiefe der Abhaenigkeit - -public: - CommandData(); - ~CommandData(); - ByteString GetProjectName(){return aPrj;} - void SetProjectName( ByteString aName ){aPrj = aName;} - ByteString GetLogFile(){return aLogFileName;} - void SetLogFile( ByteString aName ){aLogFileName = aName;} - ByteString GetInpath(){return aInpath;} - void SetInpath( ByteString aName ){aInpath = aName;} - ByteString GetUpd(){return aUpd;} - void SetUpd( ByteString aName ){aUpd = aName;} - ByteString GetUpdMinor(){return aUpdMinor;} - void SetUpdMinor( ByteString aName ){aUpdMinor = aName;} - ByteString GetProduct(){return aProduct;} - void SetProduct( ByteString aName ){aProduct = aName;} - ByteString GetCommand(){return aCommand;} - void SetCommand ( ByteString aName ){aCommand = aName;} - ByteString GetCommandPara(){return aCommandPara;} - void SetCommandPara ( ByteString aName ){aCommandPara = aName;} - ByteString GetComment(){return aComment;} - void SetComment ( ByteString aCommentString ){aComment = aCommentString;} - ByteString GetPath(){return aPath;} - void SetPath( ByteString aName ){aPath = aName;} - ByteString GetPrePath(){return aPrePath;} - void SetPrePath( ByteString aName ){aPrePath = aName;} - USHORT GetOSType(){return nOSType;} - ByteString GetOSTypeString(); - void SetOSType( USHORT nType ){nOSType = nType;} - USHORT GetCommandType(){return nCommand;} - ByteString GetCommandTypeString(); - void SetCommandType( USHORT nCommandType ){nCommand = nCommandType;} - SByteStringList* GetDependencies(){return pDepList;} - void SetDependencies( SByteStringList *pList ){pDepList = pList;} - ByteString GetClientRestriction() { return sClientRestriction; } - void SetClientRestriction( ByteString sRestriction ) { sClientRestriction = sRestriction; } - - void AddDepth(){nDepth++;} - ULONG GetDepth(){return nDepth;} -}; /********************************************************************* * @@ -147,185 +55,4 @@ public: ByteString GetCleanedNextLine( BOOL bReadComments = FALSE ); }; -#define ENV_GUI 0x00000000 -#define ENV_OS 0x00000001 -#define ENV_UPD 0x00000002 -#define ENV_UPDMIN 0x00000004 -#define ENV_INPATH 0x00000008 -#define ENV_OUTPATH 0x00000010 -#define ENV_GUIBASE 0x00000020 -#define ENV_CVER 0x00000040 -#define ENV_GVER 0x00000080 -#define ENV_GUIENV 0x00000100 -#define ENV_CPU 0x00000200 -#define ENV_CPUNAME 0x00000400 -#define ENV_DLLSUFF 0x00000800 -#define ENV_COMEX 0x00001000 -#define ENV_COMPATH 0x00002000 -#define ENV_INCLUDE 0x00004000 -#define ENV_LIB 0x00008000 -#define ENV_PATH 0x00010000 -#define ENV_SOLVER 0x00020000 -#define ENV_SOLENV 0x00040000 -#define ENV_SOLROOT 0x00080000 -#define ENV_DEVROOT 0x00100000 -#define ENV_EMERG 0x00200000 -#define ENV_STAND 0x00400000 - -/********************************************************************* -* -* class Prj -* alle Daten eines Projektes werden hier gehalten -* -*********************************************************************/ - -DECL_DEST_LIST ( PrjList_tmp, PrjList, CommandData * ) - -class Star; -class Prj : public PrjList -{ -friend class Star; -private: - BOOL bVisited; - - ByteString aPrjPath; - ByteString aProjectName; - ByteString aProjectPrefix; // max. 2-buchstabige Abk. - SByteStringList* pPrjInitialDepList; - SByteStringList* pPrjDepList; - BOOL bHardDependencies; - BOOL bSorted; - -public: - Prj(); - Prj( ByteString aName ); - ~Prj(); - void SetPreFix( ByteString aPre ){aProjectPrefix = aPre;} - ByteString GetPreFix(){return aProjectPrefix;} - ByteString GetProjectName() - {return aProjectName;} - void SetProjectName(ByteString aName) - {aProjectName = aName;} - BOOL InsertDirectory( ByteString aDirName , USHORT aWhat, - USHORT aWhatOS, ByteString aLogFileName, - const ByteString &rClientRestriction ); - CommandData* RemoveDirectory( ByteString aLogFileName ); - CommandData* GetDirectoryList ( USHORT nWhatOs, USHORT nCommand ); - CommandData* GetDirectoryData( ByteString aLogFileName ); - inline CommandData* GetData( ByteString aLogFileName ) - { return GetDirectoryData( aLogFileName ); }; - - SByteStringList* GetDependencies( BOOL bExpanded = TRUE ); - void AddDependencies( ByteString aStr ); - void HasHardDependencies( BOOL bHard ) { bHardDependencies = bHard; } - BOOL HasHardDependencies() { return bHardDependencies; } -}; - -/********************************************************************* -* -* class Star -* Diese Klasse liest die Projectstruktur aller StarDivision Projekte -* aus \\dev\data1\upenv\data\config\solar.lst aus -* -*********************************************************************/ - -DECL_DEST_LIST ( StarList_tmp, StarList, Prj* ) -DECLARE_LIST ( SolarFileList, String* ) - -class StarFile -{ -private: - String aFileName; - Date aDate; - Time aTime; - - BOOL bExists; - -public: - StarFile( const String &rFile ); - const String &GetName() { return aFileName; } - Date GetDate() { return aDate; } - Time GetTime() { return aTime; } - - BOOL NeedsUpdate(); - BOOL Exists() { return bExists; } -}; - -DECLARE_LIST( StarFileList, StarFile * ) - -#define STAR_MODE_SINGLE_PARSE 0x0000 -#define STAR_MODE_RECURSIVE_PARSE 0x0001 -#define STAR_MODE_MULTIPLE_PARSE 0x0002 - -class Star : public StarList -{ -private: - ByteString aStarName; - - static Link aDBNotFoundHdl; -protected: - NAMESPACE_VOS( OMutex ) aMutex; - - USHORT nStarMode; - SolarFileList aFileList; - StarFileList aLoadedFilesList; - String sSourceRoot; - - void InsertSolarList( String sProject ); - String CreateFileName( String sProject ); - - void Expand_Impl(); - void ExpandPrj_Impl( Prj *pPrj, Prj *pDepPrj ); - -private: - void Read( String &rFileName ); - void Read( SolarFileList *pSOlarFiles ); - -public: - Star(); - Star( String aFileName, USHORT nMode = STAR_MODE_SINGLE_PARSE ); - Star( SolarFileList *pSolarFiles ); - Star( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal = FALSE, - const char *pSourceRoot = NULL ); - - ~Star(); - - static void SetDBNotFoundHdl( const Link &rLink ) { aDBNotFoundHdl = rLink; } - - ByteString GetName(){ return aStarName; }; - - BOOL HasProject( ByteString aProjectName ); - Prj* GetPrj( ByteString aProjectName ); - ByteString GetPrjName( DirEntry &rPath ); - - void InsertToken( char *pChar ); - BOOL NeedsUpdate(); - - USHORT GetMode() { return nStarMode; } -}; - -class StarWriter : public Star -{ -private: - USHORT WritePrj( Prj *pPrj, SvFileStream& rStream ); - -public: - StarWriter( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE ); - StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE ); - StarWriter( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal = FALSE, - const char *pSourceRoot = NULL ); - - void CleanUp(); - - BOOL InsertProject ( Prj* pNewPrj ); - Prj* RemoveProject ( ByteString aProjectName ); - - USHORT Read( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE ); - USHORT Read( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE ); - USHORT Write( String aFileName ); - USHORT WriteMultiple( String rSourceRoot ); - - void InsertTokenLine( ByteString& rString ); -}; - #endif diff --git a/tools/inc/bootstrp/sstring.hxx b/tools/inc/bootstrp/sstring.hxx deleted file mode 100644 index 933770887e37..000000000000 --- a/tools/inc/bootstrp/sstring.hxx +++ /dev/null @@ -1,105 +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. - * - ************************************************************************/ - -#ifndef _SSTRING_HXX -#define _SSTRING_HXX - -#include <tools/string.hxx> -#include <tools/list.hxx> - -#define NOT_THERE LIST_ENTRY_NOTFOUND - -#define SStringList SUniStringList -#define StringList UniStringList - -DECLARE_LIST( ByteStringList, ByteString* ) -DECLARE_LIST( UniStringList, UniString* ) - -class SvStream; - -// --------------------- -// - class SStringList - -// --------------------- - -class SByteStringList : public ByteStringList -{ -public: - SByteStringList(); - ~SByteStringList(); - - // neuen ByteString in Liste einfuegen - ULONG PutString( ByteString* ); - ByteString* RemoveString( const ByteString& rName ); - - // Position des ByteString in Liste, wenn nicht enthalten, dann - // return = NOT_THERE - ULONG IsString( ByteString* ); - - // Vorgaenger ermitteln ( auch wenn selbst noch nicht in - // Liste enthalten - ULONG GetPrevString( ByteString* ); - void CleanUp(); - - SByteStringList& operator<< ( SvStream& rStream ); - SByteStringList& operator>> ( SvStream& rStream ); -}; - -// --------------------- -// - class SUniStringList - -// --------------------- - -class SUniStringList : public UniStringList -{ -public: - SUniStringList(); - ~SUniStringList(); - - // neuen UniString in Liste einfuegen - ULONG PutString( UniString* ); - UniString* RemoveString( const UniString& rName ); - - // Position des UniString in Liste, wenn nicht enthalten, dann - // return = NOT_THERE - ULONG IsString( UniString* ); - - // Vorgaenger ermitteln ( auch wenn selbst noch nicht in - // Liste enthalten - ULONG GetPrevString( UniString* ); -}; - -class Text -{ -protected: - String aString; - -public: - Text( char* pChar ); - Text( String &rStr ) { aString = rStr; } - void Stderr(); -}; - -#endif diff --git a/tools/prj/d.lst b/tools/prj/d.lst index 854a6179739a..1c0b5271071d 100644 --- a/tools/prj/d.lst +++ b/tools/prj/d.lst @@ -1,27 +1,12 @@ -mkdir: %_DEST%\inc%_EXT%\bootstrp +mkdir: %_DEST%\inc%_EXT%\tools ..\%__SRC%\bin\mkunroll* %_DEST%\bin%_EXT% ..\%__SRC%\bin\tl?????.dll %_DEST%\bin%_EXT%\tl?????.dll ..\%__SRC%\bin\tl?????.sym %_DEST%\bin%_EXT%\tl?????.sym -..\%__SRC%\lib\atools.lib %_DEST%\lib%_EXT%\atools.lib -..\%__SRC%\lib\btstrp.lib %_DEST%\lib%_EXT%\btstrp.lib -..\%__SRC%\lib\bootstrp2.lib %_DEST%\lib%_EXT%\bootstrp2.lib ..\%__SRC%\lib\itools.lib %_DEST%\lib%_EXT%\itools.lib -..\%__SRC%\lib\lib*.a %_DEST%\lib%_EXT%\lib*.a -..\%__SRC%\lib\lib*.sl %_DEST%\lib%_EXT%\lib*.sl ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so ..\%__SRC%\lib\lib*.so.* %_DEST%\lib%_EXT%\lib*.so.* ..\%__SRC%\lib\lib*.dylib %_DEST%\lib%_EXT%\lib*.dylib -..\%__SRC%\lib\stdstrm.lib %_DEST%\lib%_EXT%\stdstrm.lib -..\%__SRC%\misc\tl?????.map %_DEST%\bin%_EXT%\tl?????.map -..\%__SRC%\slb\btstrpsh.lib %_DEST%\lib%_EXT%\btstrpsh.lib - -..\inc\bootstrp\command.hxx %_DEST%\inc%_EXT%\bootstrp\command.hxx -..\inc\bootstrp\inimgr.hxx %_DEST%\inc%_EXT%\bootstrp\inimgr.hxx -..\inc\bootstrp\listmacr.hxx %_DEST%\inc%_EXT%\bootstrp\listmacr.hxx -..\inc\bootstrp\mkcreate.hxx %_DEST%\inc%_EXT%\bootstrp\mkcreate.hxx -..\inc\bootstrp\prj.hxx %_DEST%\inc%_EXT%\bootstrp\prj.hxx -..\inc\bootstrp\sstring.hxx %_DEST%\inc%_EXT%\bootstrp\sstring.hxx ..\inc\tools\*.h %_DEST%\inc%_EXT%\tools\*.h ..\inc\tools\*.hxx %_DEST%\inc%_EXT%\tools\*.hxx diff --git a/tools/util/makefile.mk b/tools/util/makefile.mk index 568baaacd8f1..735b5380614d 100644 --- a/tools/util/makefile.mk +++ b/tools/util/makefile.mk @@ -38,26 +38,25 @@ ENABLE_EXCEPTIONS=true # --- Allgemein ---------------------------------------------------- # --- STDSTRM.LIB --- -LIB3TARGET= $(LB)$/stdstrm.lib -LIB3ARCHIV= $(LB)$/libstdstrm.a -LIB3FILES= $(LB)$/stream.lib - -LIB7TARGET= $(LB)$/a$(TARGET).lib -LIB7ARCHIV= $(LB)$/liba$(TARGET).a -LIB7FILES= $(LB)$/gen.lib \ - $(LB)$/str.lib \ - $(LB)$/mtools.lib \ - $(LB)$/datetime.lib \ - $(LB)$/fsys.lib \ - $(LB)$/communi.lib \ - $(LB)$/stream.lib \ - $(LB)$/ref.lib \ - $(LB)$/rc.lib \ - $(LB)$/inet.lib \ - $(LB)$/debug.lib - - -LIB7FILES+= $(LB)$/dll.lib +#LIB3TARGET= $(LB)$/stdstrm.lib +#LIB3ARCHIV= $(LB)$/libstdstrm.a +#LIB3FILES= $(LB)$/stream.lib + +#LIB7TARGET= $(LB)$/a$(TARGET).lib +#LIB7ARCHIV= $(LB)$/liba$(TARGET).a +#LIB7FILES= $(LB)$/gen.lib \ +# $(LB)$/str.lib \ +# $(LB)$/mtools.lib \ +# $(LB)$/datetime.lib \ +# $(LB)$/fsys.lib \ +# $(LB)$/communi.lib \ +# $(LB)$/stream.lib \ +# $(LB)$/ref.lib \ +# $(LB)$/rc.lib \ +# $(LB)$/inet.lib \ +# $(LB)$/debug.lib +# +#LIB7FILES+= $(LB)$/dll.lib # --- TOOLS.LIB --- LIB1TARGET:= $(SLB)$/$(TARGET).lib |