summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2013-02-15 22:27:38 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2013-02-15 22:43:09 +0100
commit18d37cf9fb21dd809ec79135ce93f9a55512c9b3 (patch)
treec92a9e472fb2fa258b1f2edba35b88a560c6f1db /tools
parent507f51b093a1dfcd2866785cd700d5c390ee28f6 (diff)
rscdep is dead and gone ... and there was much rejoicing
Change-Id: Id411a6caceaac92d3044fe6a2385d8b1c2f16133
Diffstat (limited to 'tools')
-rw-r--r--tools/Executable_rscdep.mk43
-rw-r--r--tools/Module_tools.mk1
-rw-r--r--tools/bootstrp/cppdep.cxx217
-rw-r--r--tools/bootstrp/cppdep.hxx46
-rw-r--r--tools/bootstrp/prj.cxx58
-rw-r--r--tools/bootstrp/rscdep.cxx264
6 files changed, 0 insertions, 629 deletions
diff --git a/tools/Executable_rscdep.mk b/tools/Executable_rscdep.mk
deleted file mode 100644
index d00cba5c46eb..000000000000
--- a/tools/Executable_rscdep.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-$(eval $(call gb_Executable_Executable,rscdep))
-
-$(eval $(call gb_Executable_set_include,rscdep,\
- -I$(SRCDIR)/tools/bootstrp \
- -I$(SRCDIR)/tools/inc \
- $$(INCLUDE) \
-))
-
-$(eval $(call gb_Executable_use_libraries,rscdep,\
- comphelper \
- sal \
- tl \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_Executable_use_sdk_api,rscdep))
-
-$(eval $(call gb_Executable_add_exception_objects,rscdep,\
- tools/bootstrp/rscdep \
- tools/bootstrp/cppdep \
- tools/bootstrp/prj \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk
index b6fe5f61ecfa..f49c48922fcb 100644
--- a/tools/Module_tools.mk
+++ b/tools/Module_tools.mk
@@ -34,7 +34,6 @@ $(eval $(call gb_Module_add_check_targets,tools,\
ifneq ($(CROSS_COMPILING),YES)
$(eval $(call gb_Module_add_targets,tools,\
Executable_bestreversemap \
- Executable_rscdep \
))
endif
diff --git a/tools/bootstrp/cppdep.cxx b/tools/bootstrp/cppdep.cxx
deleted file mode 100644
index c006e8a9e38c..000000000000
--- a/tools/bootstrp/cppdep.cxx
+++ /dev/null
@@ -1,217 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/stat.h>
-#include <tools/stream.hxx>
-#include <rtl/strbuf.hxx>
-#include "cppdep.hxx"
-
-CppDep::CppDep()
-{
-}
-
-CppDep::~CppDep()
-{
-}
-
-void CppDep::Execute()
-{
- size_t nCount = m_aSources.size();
- for ( size_t n = 0; n < nCount; ++n )
- {
- const rtl::OString &rStr = m_aSources[n];
- Search(rStr);
- }
-}
-
-sal_Bool CppDep::AddSearchPath( const char* pPath )
-{
- m_aSearchPath.push_back( rtl::OString(pPath) );
- return sal_False;
-}
-
-sal_Bool CppDep::AddSource( const char* pSource )
-{
- m_aSources.push_back( rtl::OString(pSource) );
- return sal_False;
-}
-
-sal_Bool CppDep::Search(const rtl::OString &rFileName)
-{
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "SEARCH : %s\n", rFileName.getStr());
-#endif
- sal_Bool bRet = sal_False;
-
- SvFileStream aFile;
- rtl::OString aReadLine;
-
- rtl::OUString suFileName(rtl::OStringToOUString(rFileName, osl_getThreadTextEncoding()));
-
- aFile.Open( suFileName, STREAM_READ );
- while ( aFile.ReadLine( aReadLine ))
- {
- sal_Int32 nPos = aReadLine.indexOfL(
- RTL_CONSTASCII_STRINGPARAM("include"));
- if ( nPos != -1 )
- {
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "found : %d %s\n", nPos, aReadLine.getStr() );
-#endif
- rtl::OString aResult = IsIncludeStatement( aReadLine );
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "Result : %s\n", aResult.getStr() );
-#endif
-
- rtl::OString aNewFile;
- if (!aResult.isEmpty())
- if ( !(aNewFile = Exists( aResult )).isEmpty() )
- {
- sal_Bool bFound = sal_False;
- size_t nCount = m_aFileList.size();
- for ( size_t i = 0; i < nCount; ++i )
- {
- const rtl::OString &rStr = m_aFileList[i];
- if ( rStr == aNewFile )
- bFound = sal_True;
- }
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "not in list : %d %s\n", nPos, aReadLine.getStr() );
-#endif
- if ( !bFound )
- {
- m_aFileList.push_back(aNewFile);
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, " CppDep %s\\\n", aNewFile.getStr() );
-#endif
- Search(aNewFile);
- }
- }
- }
- }
- aFile.Close();
-
- return bRet;
-}
-
-rtl::OString CppDep::Exists(const rtl::OString &rFileName)
-{
- char pFullName[1023];
-
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "Searching %s \n", rFileName.getStr() );
-#endif
-
- size_t nCount = m_aSearchPath.size();
- for ( size_t n = 0; n < nCount; ++n )
- {
- struct stat aBuf;
- const rtl::OString &rPathName = m_aSearchPath[n];
-
- strcpy( pFullName, rPathName.getStr());
- strcat( pFullName, DIR_SEP );
- strcat( pFullName, rFileName.getStr());
-
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "looking for %s\t ", pFullName );
-#endif
- if ( stat( pFullName, &aBuf ) == 0 )
- {
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "Got Dependency %s \\\n", pFullName );
-#endif
- return rtl::OString(pFullName);
- }
- }
- return rtl::OString();
-}
-
-rtl::OString CppDep::IsIncludeStatement(rtl::OString aLine)
-{
- sal_Int32 nIndex;
-
- nIndex = aLine.indexOf("/*");
- if ( nIndex != -1 )
- {
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "found starting C comment : %s\n", aLine.getStr() );
-#endif
- aLine = aLine.copy(0, nIndex);
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "cleaned string : %s\n", aLine.getStr() );
-#endif
- }
-
- nIndex = aLine.indexOf("//");
- if ( nIndex != -1 )
- {
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "found C++ comment : %s\n", aLine.getStr() );
-#endif
- aLine = aLine.copy(0, nIndex);
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "cleaned string : %s\n", aLine.getStr() );
-#endif
- }
- // WhiteSpacesfressen
- aLine = aLine.replaceAll(rtl::OString(' '), rtl::OString()).
- replaceAll(rtl::OString('\t'), rtl::OString());
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "now : %s\n", aLine.getStr() );
-#endif
- // ist der erste Teil ein #include ?
- rtl::OString aRetStr;
- if (
- aLine.getLength() >= 10 &&
- aLine.match(rtl::OString(RTL_CONSTASCII_STRINGPARAM("#include")))
- )
- {
- //#include<foo> or #include"foo"
- aLine = aLine.copy(9, aLine.getLength()-10);
-#ifdef DEBUG_VERBOSE
- fprintf( stderr, "Gotcha : %s\n", aLine.getStr() );
-#endif
- aRetStr = aLine;
- }
- return aRetStr;
-}
-
-#ifdef TEST
-
-int main( int argc, char **argv )
-{
- CppDep *pDep = new CppDep();
- pDep->AddSearchPath(".");
- pDep->AddSearchPath("/usr/include");
- pDep->AddSearchPath("/usr/local/include");
- pDep->AddSearchPath("/usr/include/sys");
- pDep->AddSearchPath("/usr/include/X11");
- pDep->Execute();
- delete pDep;
- return 0;
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/bootstrp/cppdep.hxx b/tools/bootstrp/cppdep.hxx
deleted file mode 100644
index 842fa9672898..000000000000
--- a/tools/bootstrp/cppdep.hxx
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <vector>
-#define PATH_SEP ":"
-#define DIR_SEP "/"
-
-class CppDep
-{
- std::vector<rtl::OString> m_aSearchPath;
-
-protected:
- std::vector<rtl::OString> m_aFileList;
- std::vector<rtl::OString> m_aSources;
-
- sal_Bool Search(const rtl::OString& rFileName);
- rtl::OString Exists(const rtl::OString& rFileName);
-
- rtl::OString IsIncludeStatement(rtl::OString aLine);
-public:
- CppDep();
- virtual ~CppDep();
- virtual void Execute();
-
- std::vector<rtl::OString>& GetDepList() { return m_aFileList; }
- sal_Bool AddSearchPath( const char* aPath );
- sal_Bool AddSource( const char * aSource );
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
deleted file mode 100644
index 66763321ad20..000000000000
--- a/tools/bootstrp/prj.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "bootstrp/prj.hxx"
-#include <comphelper/string.hxx>
-
-SimpleConfig::SimpleConfig(const String &rSimpleConfigFileName)
-{
- aFileStream.Open(rSimpleConfigFileName, STREAM_READ);
-}
-
-SimpleConfig::~SimpleConfig()
-{
- aFileStream.Close ();
-}
-
-rtl::OString SimpleConfig::getNext()
-{
- if (aStringBuffer.isEmpty())
- while ((aStringBuffer = GetNextLine()) == "\t") ; //solange bis != "\t"
- if (aStringBuffer.isEmpty())
- return rtl::OString();
-
- rtl::OString aString = comphelper::string::getToken(aStringBuffer, 0, '\t');
-
- aStringBuffer = aStringBuffer.copy(aString.getLength()+1);
-
- aStringBuffer = comphelper::string::stripStart(aStringBuffer, '\t');
-
- return aString;
-}
-
-rtl::OString SimpleConfig::GetNextLine()
-{
- rtl::OString aTmpStr;
- aFileStream.ReadLine(aTmpStr);
- if (aTmpStr[0] == '#')
- return rtl::OString('\t');
- return aTmpStr.trim().replace(' ', '\t');
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx
deleted file mode 100644
index 04ae7a1f5051..000000000000
--- a/tools/bootstrp/rscdep.cxx
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifdef UNX
-#include <unistd.h>
-#endif
-
-#include <sys/stat.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "bootstrp/prj.hxx"
-
-#include <rtl/strbuf.hxx>
-#include <tools/string.hxx>
-#include <tools/fsys.hxx>
-#include <tools/stream.hxx>
-
-#include "cppdep.hxx"
-
-class RscHrcDep : public CppDep
-{
-public:
- RscHrcDep();
- virtual ~RscHrcDep();
-
- virtual void Execute();
-};
-
-RscHrcDep::RscHrcDep() :
- CppDep()
-{
-}
-
-RscHrcDep::~RscHrcDep()
-{
-}
-
-void RscHrcDep::Execute()
-{
- CppDep::Execute();
-}
-
-int main( int argc, char** argv )
-{
- char aBuf[255];
- char pFileNamePrefix[255];
- char pOutputFileName[255];
- char pSrsFileName[255];
- String aSrsBaseName;
- sal_Bool bSource = sal_False;
- rtl::OStringBuffer aRespArg;
-// who needs anything but '/' ?
- sal_Char cDelim = '/';
-
- RscHrcDep *pDep = new RscHrcDep;
-
- // When the options are processed, the non-option arguments are
- // collected at the head of the argv array.
- // nLastNonOption points to the last of them.
- int nLastNonOption (-1);
-
- pOutputFileName[0] = 0;
- pSrsFileName[0] = 0;
-
- for ( int i=1; i<argc; i++)
- {
- strncpy( aBuf, (const char *)argv[i], sizeof(aBuf) );
- const sal_Int32 nLength (strlen(aBuf));
-
-#ifdef DEBUG
- printf("option %d is [%s] and has length %d\n", i, aBuf, (int)nLength);
-#endif
-
- if (nLength == 0) // Is this even possible?
- continue;
-
- if (aBuf[0] == '-' && nLength > 0)
- {
- bool bIsKnownOption = true;
- // Make a switch on the first character after the - for a
- // preselection of the option.
- // This is faster then multiple ifs and improves readability.
- switch (aBuf[1])
- {
- case 'p':
- if (nLength > 1 && aBuf[2] == '=' )
- strcpy(pFileNamePrefix, &aBuf[3]);
- else
- bIsKnownOption = false;
- break;
- case 'f':
- if (nLength > 2 && aBuf[2] == 'o' && aBuf[3] == '=' )
- strcpy(pOutputFileName, &aBuf[4]);
- else if (nLength>2 && aBuf[2] == 'p' && aBuf[3] == '=' )
- {
- strcpy(pSrsFileName, &aBuf[4]);
- String aName( pSrsFileName, osl_getThreadTextEncoding());
- DirEntry aDest( aName );
- aSrsBaseName = aDest.GetBase();
- }
- else
- bIsKnownOption = false;
- break;
- case 'i':
- case 'I':
-#ifdef DEBUG_VERBOSE
- printf("Include : %s\n", &aBuf[2] );
-#endif
- pDep->AddSearchPath( &aBuf[2] );
- break;
- case 'h' :
- case 'H' :
- case '?' :
- printf("RscDep 1.0\n");
- break;
- case 'a' :
-#ifdef DEBUG_VERBOSE
- printf("option a\n");
-#endif
- break;
-
- case 'l' :
-#ifdef DEBUG_VERBOSE
- printf("option l with Value %s\n", &aBuf[2] );
-#endif
- pDep->AddSource(&aBuf[2]);
- break;
-
- default:
- bIsKnownOption = false;
- break;
- }
-#ifdef DEBUG_VERBOSE
- if ( ! bIsKnownOption)
- printf("Unknown option error [%s]\n", aBuf);
-#else
- (void)bIsKnownOption;
-#endif
- }
- else if (aBuf[0] == '@' )
- {
- rtl::OString aToken;
- String aRespName( &aBuf[1], osl_getThreadTextEncoding());
- SimpleConfig aConfig( aRespName );
- while (!(aToken = aConfig.getNext()).isEmpty())
- {
- char aBuf2[255];
- strcpy( aBuf2, aToken.getStr());
- if ( aBuf[0] == '-' && aBuf[1] == 'p' && aBuf[2] == '=' )
- {
- strcpy(pFileNamePrefix, &aBuf[3]);
- }
- if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'o' )
- {
- strcpy(pOutputFileName, &aBuf2[3]);
- }
- if ( aBuf2[0] == '-' && aBuf2[1] == 'f' && aBuf2[2] == 'p' )
- {
- strcpy(pSrsFileName, &aBuf2[3]);
- String aName( pSrsFileName, osl_getThreadTextEncoding());
- DirEntry aDest( aName );
- aSrsBaseName = aDest.GetBase();
- }
- if (aBuf2[0] == '-' && aBuf2[1] == 'i' )
- {
- pDep->AddSearchPath( &aBuf2[2] );
- }
- if (aBuf2[0] == '-' && aBuf2[1] == 'I' )
- {
- pDep->AddSearchPath( &aBuf2[2] );
- }
- if (( aBuf2[0] != '-' ) && ( aBuf2[0] != '@' ))
- {
- pDep->AddSource( &aBuf2[0] );
- aRespArg.append(' ').append(&aBuf2[0]);
- bSource = sal_True;
- }
- }
- }
- else
- {
- // Collect all non-options at the head of argv.
- if (++nLastNonOption < i)
- argv[nLastNonOption] = argv[i];
- }
- }
-
- String aCwd(pFileNamePrefix, osl_getThreadTextEncoding());
- SvFileStream aOutStream;
- String aOutputFileName( pOutputFileName, osl_getThreadTextEncoding());
- DirEntry aOutEntry( aOutputFileName );
- String aOutPath = aOutEntry.GetPath().GetFull();
-
- String aFileName( aOutPath );
- aFileName += cDelim;
- aFileName += aCwd;
- aFileName += String(".", osl_getThreadTextEncoding());
- aFileName += aSrsBaseName;
- aFileName += String(".dprr", osl_getThreadTextEncoding());
- aOutStream.Open( aFileName, STREAM_WRITE );
-
- // Process the yet unhandled non-options. These are supposed to
- // be names of files on which the target depends.
- rtl::OStringBuffer aString;
- if ( nLastNonOption >= 0 )
- {
-#ifdef DEBUG_VERBOSE
- printf("further arguments : ");
-#endif
- aString.append(rtl::OString(pSrsFileName).replace('\\', cDelim));
- aString.append(RTL_CONSTASCII_STRINGPARAM(" : " ));
-
- for (sal_Int32 nIndex=0; nIndex<=nLastNonOption; ++nIndex)
- {
-#ifdef DEBUG
- printf("option at %d is [%s]\n", (int)nIndex, argv[nIndex]);
-#endif
- if (!bSource )
- {
- aString.append(' ');
- aString.append(argv[nIndex]);
- pDep->AddSource(argv[nIndex]);
- }
- }
- }
- aString.append(aRespArg.makeStringAndClear());
- pDep->Execute();
- std::vector<rtl::OString>& rLst = pDep->GetDepList();
- size_t nCount = rLst.size();
- if ( nCount != 0 )
- aString.append('\\');
- aOutStream.WriteLine( aString.makeStringAndClear() );
-
- for ( size_t j = 0; j < nCount; ++j )
- {
- rtl::OStringBuffer aStr(rLst[j].replace('\\', cDelim));
- if ( j != (nCount-1) )
- aStr.append('\\');
- aOutStream.WriteLine(aStr.makeStringAndClear());
- }
- delete pDep;
- aOutStream.Close();
-
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */