Kaydet (Commit) 07467b0d authored tarafından Matúš Kukan's avatar Matúš Kukan

soltools: remove unused files

Change-Id: I534aab7da0b05dadc3415856e57362ead57380c0
üst 6e2b250c
/* -*- 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 <gen_info.hxx>
#include <gi_list.hxx>
GenericInfo::GenericInfo( const Simstr & i_sKey,
const Simstr & i_sValue,
const Simstr & i_sComment )
: sKey(i_sKey),
sValue(i_sValue),
sComment(i_sComment),
dpSubList(0)
{
}
GenericInfo::GenericInfo( const GenericInfo & i_rInfo )
: sKey(i_rInfo.sKey),
sValue(i_rInfo.sValue),
sComment(i_rInfo.sComment),
dpSubList(0)
{
if ( i_rInfo.HasSubList() )
{
dpSubList = new List_GenericInfo(i_rInfo.SubList());
}
}
GenericInfo::~GenericInfo()
{
if ( dpSubList != 0 )
delete dpSubList;
}
GenericInfo &
GenericInfo::operator=( const GenericInfo & i_rInfo )
{
sKey = i_rInfo.sKey;
sValue = i_rInfo.sValue;
sComment = i_rInfo.sComment;
if ( dpSubList != 0 )
delete dpSubList;
if ( i_rInfo.HasSubList() )
{
dpSubList = new List_GenericInfo(i_rInfo.SubList());
}
else
dpSubList = 0;
return *this;
}
List_GenericInfo &
GenericInfo::CreateMyList() const
{
return * ( const_cast<GenericInfo&>(*this).dpSubList = new List_GenericInfo);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <gi_list.hxx>
#include <gen_info.hxx>
const char C_cKeySeparator = '/';
List_GenericInfo::List_GenericInfo()
{
}
List_GenericInfo::List_GenericInfo( const List_GenericInfo & i_rList )
: aChildren(i_rList.aChildren)
{
}
List_GenericInfo::~List_GenericInfo()
{
}
List_GenericInfo &
List_GenericInfo::operator=( const List_GenericInfo & i_rList )
{
aChildren = i_rList.aChildren;
return *this;
}
const GenericInfo *
List_GenericInfo::operator[]( KeyPath i_sKeyPath ) const
{
return const_cast< List_GenericInfo& >(*this)[i_sKeyPath];
}
GenericInfo *
List_GenericInfo::operator[]( KeyPath i_sKeyPath )
{
bool bExists = false;
const char * sNextPathSegment = 0;
sub_iterator it = lower_bound(bExists, sNextPathSegment, i_sKeyPath);
if ( bExists )
{
if ( sNextPathSegment == 0 )
return (*it);
else
return (*it)->SubList()[sNextPathSegment];
}
else
{
return 0;
}
}
bool
List_GenericInfo::InsertInfo( GenericInfo * let_dpInfo,
bool i_bOverwrite )
{
if ( let_dpInfo == 0 )
return false;
bool bExists = false;
const char * sNextPathSegment = 0;
sub_iterator it = lower_bound(bExists, sNextPathSegment, let_dpInfo->Key() );
if ( ! bExists )
{
aChildren.insert( it, let_dpInfo );
}
else if ( i_bOverwrite )
{
delete (*it);
(*it) = let_dpInfo;
}
else
{
delete let_dpInfo;
return false;
}
return true;
}
bool
List_GenericInfo::InsertInfoByPath( GenericInfo * let_dpInfo,
KeyPath i_sKeyPath,
bool i_bCreatePath,
bool i_bOverwrite )
{
if ( let_dpInfo == 0 )
return false;
if ( i_sKeyPath == 0 ? true : *i_sKeyPath == 0 )
return InsertInfo(let_dpInfo, i_bOverwrite);
bool bExists = false;
const char * sNextPathSegment = 0;
sub_iterator it = lower_bound(bExists, sNextPathSegment, i_sKeyPath);
if ( bExists )
{
return (*it)->SubList().InsertInfoByPath(
let_dpInfo,
sNextPathSegment,
i_bCreatePath,
i_bOverwrite );
}
else if ( i_bCreatePath )
{
Simstr aKey( i_sKeyPath,
0,
(int)(sNextPathSegment -
( *sNextPathSegment == 0 ? 0 : 1)
- i_sKeyPath ));
GenericInfo * pNew = new GenericInfo(aKey);
InsertInfo(pNew,false);
return pNew->SubList().InsertInfoByPath(
let_dpInfo,
sNextPathSegment,
i_bCreatePath,
i_bOverwrite );
}
else
{
delete let_dpInfo;
return false;
}
}
GenericInfo *
List_GenericInfo::ReleaseInfo( KeyPath i_sKeyPath )
{
bool bExists = false;
const char * sNextPathSegment = 0;
sub_iterator it = lower_bound(bExists, sNextPathSegment, i_sKeyPath );
if ( bExists )
{
if ( *sNextPathSegment == 0 )
return (*it);
else
return (*it)->SubList().ReleaseInfo(sNextPathSegment);
}
else
{
return 0;
}
}
void
List_GenericInfo::DeleteInfo( KeyPath i_sKeyPath )
{
bool bExists = false;
const char * sNextPathSegment = 0;
sub_iterator it = lower_bound(bExists, sNextPathSegment, i_sKeyPath );
if ( bExists )
{
if ( *sNextPathSegment == 0 )
{
aChildren.remove(it);
}
else
{
(*it)->SubList().DeleteInfo(sNextPathSegment);
}
}
}
List_GenericInfo::sub_iterator
List_GenericInfo::lower_bound( bool & o_bExists,
const char * & o_sNextPathSegment,
KeyPath i_sKeyPath )
{
o_sNextPathSegment = strchr(i_sKeyPath, '/');
Simstr sKey( i_sKeyPath, (int)(o_sNextPathSegment == 0 ? strlen(i_sKeyPath) : o_sNextPathSegment++ - i_sKeyPath) );
GenericInfo aSearch(sKey);
unsigned low = 0;
unsigned high = aChildren.size();
for ( unsigned cur = high / 2; high > low; cur = (low + high) / 2 )
{
if ( *aChildren[cur] < aSearch )
{
low = cur+1;
}
else
{
high = cur;
}
} // end for
o_bExists = low < aChildren.size()
? !(aSearch < *aChildren[low] )
: false;
return &aChildren[low];
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 <gi_parse.hxx>
#include <stdio.h>
#include <string.h>
#include <fstream>
#include <gilacces.hxx>
using namespace std;
const char * C_sLineEnd = "\r\n";
inline void
WriteStr( ostream & o_rOut, const Simstr & i_rStr )
{
o_rOut.write( i_rStr.str(), i_rStr.l() );
}
inline void
WriteStr( ostream & o_rOut, const char * i_rStr )
{
o_rOut.write( i_rStr, strlen(i_rStr) );
}
inline void
GenericInfo_Parser::SetError( E_Error i_eError )
{
eErrorCode = i_eError;
nErrorLine = nCurLine;
}
GenericInfo_Parser::GenericInfo_Parser()
: sCurParsePosition(""),
nCurLine(0),
nLevel(0),
bGoon(false),
eErrorCode(ok),
nErrorLine(0),
pResult(0),
pResource(0)
{
}
GenericInfo_Parser::~GenericInfo_Parser()
{
}
bool
GenericInfo_Parser::LoadList( GenericInfoList_Builder & o_rResult,
const Simstr & i_sSourceFileName )
{
ifstream aFile( i_sSourceFileName.str() );
if ( aFile.fail() )
{
SetError(cannot_open);
return false;
}
aFile.seekg(0, ios::end);
UINT32 nTextSize = aFile.tellg();
if ( nTextSize == 0 || nTextSize == UINT32(-1) )
return true;
dpBuffer = new char[nTextSize+2];
aFile.seekg(0);
aFile.read( dpBuffer, nTextSize );
aFile.close();
sFilePtr = dpBuffer;
char * sLastChar = dpBuffer + nTextSize - 1;
while ( sFilePtr != sLastChar && *sFilePtr <= 32 )
++sCurParsePosition;
if ( sFilePtr == sLastChar )
{
if ( *sFilePtr <= 32 )
return true;
}
else while ( *sLastChar <= 32 )
{
--sLastChar;
}
*(sLastChar+1) = '\n';
*(sLastChar+2) = '\0';
ResetState(o_rResult);
for ( ReadLine(); bGoon; ReadLine() )
{
bool bOk = InterpretLine();
if ( !bOk)
{
SetError(syntax_error);
break;
}
}
if ( nLevel > 0 && eErrorCode == ok)
{
SetError(unexpected_eof);
}
else if ( nLevel < 0 )
{
SetError(unexpected_list_end);
}
delete [] dpBuffer;
dpBuffer = 0;
sFilePtr = 0;
return eErrorCode == ok;
}
bool
GenericInfo_Parser::SaveList( const Simstr & i_rOutputFile,
GenericInfoList_Browser & io_rListBrowser )
{
ofstream aFile( i_rOutputFile.str() );
if ( aFile.fail() )
{
SetError(cannot_open);
return false;
}
ResetState(io_rListBrowser);
WriteList(aFile);
aFile.close();
return eErrorCode == ok;
}
void
GenericInfo_Parser::ResetState( GenericInfoList_Builder & io_rResult )
{
sCurParsePosition = "";
nCurLine = 0;
nLevel = 0;
bGoon = true;
sCurComment = "";
eErrorCode = ok;
nErrorLine = 0;
pResult = &io_rResult;
pResource = 0;
}
void
GenericInfo_Parser::ResetState( GenericInfoList_Browser & io_rSrc )
{
sCurParsePosition = "";
nCurLine = 0;
nLevel = 0;
bGoon = false;
sCurComment = "";
eErrorCode = ok;
nErrorLine = 0;
pResult = 0;
pResource = &io_rSrc;
}
void
GenericInfo_Parser::ReadLine()
{
if ( *sFilePtr == '\0' ) // See initialising of dpBuffer and sLastChar in LoadList().
{
bGoon = false;
return;
}
sCurParsePosition = sFilePtr;
while ( *sFilePtr != '\n' )
++sFilePtr;
nCurLine++;
// Remove leading and trailing whitespace from line:
while ( sCurParsePosition != sFilePtr && *sCurParsePosition <= 32 )
++sCurParsePosition;
char * sEndOfLine = sFilePtr;
while ( sEndOfLine != sCurParsePosition && *sEndOfLine <= 32 )
--sEndOfLine;
if ( sCurParsePosition != sEndOfLine || *sCurParsePosition > 32 )
++sEndOfLine;
*sEndOfLine = '\0';
++sFilePtr; // Go beyond line end to first character of next line.
}
bool
GenericInfo_Parser::InterpretLine()
{
switch ( ClassifyLine() )
{
case lt_key: ReadKey();
break;
case lt_open_list: PushLevel_Read();
break;
case lt_close_list: PopLevel_Read();
break;
case lt_comment: AddCurLine2CurComment();
break;
case lt_empty: AddCurLine2CurComment();
break;
default:
return false;
}
return true;
}
GenericInfo_Parser::E_LineType
GenericInfo_Parser::ClassifyLine()
{
switch ( *sCurParsePosition )
{
case '{': return lt_open_list;
case '}': return lt_close_list;
case '#': return lt_comment;
case '\0': return lt_empty;
}
return lt_key;
}
void
GenericInfo_Parser::ReadKey()
{
const char * pSearch = sCurParsePosition;
for ( ; *pSearch > 32; ++pSearch ) ;
UINT32 nKeyLength = pSearch - sCurParsePosition;
for ( ; *pSearch <= 32 && *pSearch > '\0'; ++pSearch ) ;
pResult->AddKey( sCurParsePosition, nKeyLength,
pSearch, strlen(pSearch),
sCurComment.str(), sCurComment.l()
);
sCurComment = "";
}
void
GenericInfo_Parser::PushLevel_Read()
{
nLevel++;
pResult->OpenList();
}
void
GenericInfo_Parser::PopLevel_Read()
{
nLevel--;
pResult->CloseList();
}
void
GenericInfo_Parser::AddCurLine2CurComment()
{
sCurComment += sCurParsePosition;
sCurComment += C_sLineEnd;
}
void
GenericInfo_Parser::WriteList( ostream & o_rFile )
{
static char sBuffer[32000];
for ( bGoon = pResource->Start_CurList();
bGoon;
bGoon = pResource->NextOf_CurList() )
{
pResource->Get_CurComment(&sBuffer[0]);
WriteComment(o_rFile,sBuffer);
pResource->Get_CurKey(&sBuffer[0]);
WriteKey(o_rFile,sBuffer);
pResource->Get_CurValue(&sBuffer[0]);
WriteValue(o_rFile,sBuffer);
if ( pResource->HasSubList_CurKey() )
{
PushLevel_Write();
WriteList(o_rFile);
PopLevel_Write();
}
} // end for
}
void
GenericInfo_Parser::PushLevel_Write()
{
nLevel++;
pResource->Push_CurList();
}
void
GenericInfo_Parser::PopLevel_Write()
{
nLevel--;
pResource->Pop_CurList();
}
void
GenericInfo_Parser::WriteComment( ostream & o_rFile,
const char * i_sStr )
{
WriteStr( o_rFile, i_sStr );
if ( i_sStr[ strlen(i_sStr)-1 ] != '\n' )
WriteStr( o_rFile, C_sLineEnd );
}
void
GenericInfo_Parser::WriteKey( ostream & o_rFile,
const char * i_sStr )
{
WriteIndentation(o_rFile);
WriteStr( o_rFile, i_sStr );
}
void
GenericInfo_Parser::WriteValue( ostream & o_rFile,
const char * i_sStr )
{
if ( i_sStr != 0 ? strlen(i_sStr) > 0 : false )
{
WriteStr(o_rFile," ");
WriteStr(o_rFile,i_sStr);
}
WriteStr(o_rFile,C_sLineEnd);
}
void
GenericInfo_Parser::WriteIndentation( ostream & o_rFile )
{
const int nIndentBound = 60;
static const char sIndentation[nIndentBound+1] =
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
"\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
if ( nLevel == 0 )
return;
if ( nLevel <= nIndentBound )
o_rFile.write( sIndentation, nLevel );
else
{
INT16 iLevel = nLevel;
for ( ; iLevel > nIndentBound; iLevel-=nIndentBound )
o_rFile.write( sIndentation, nIndentBound );
o_rFile.write( sIndentation, iLevel );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef GEN_INFO_HXX
#define GEN_INFO_HXX
#include "simstr.hxx"
#include <string.h>
class List_GenericInfo;
/** Holds generic informations in a simple hierarchical format.
*/
class GenericInfo
{
public:
// LIFECFYCLE
GenericInfo(
const Simstr & i_sKey,
const Simstr & i_sValue = Simstr::null_(),
const Simstr & i_sComment = Simstr::null_() );
GenericInfo(
const GenericInfo & i_rInfo );
~GenericInfo();
// OPERATORS
GenericInfo & operator=(
const GenericInfo & i_rInfo );
bool operator<(
const GenericInfo & i_rInfo ) const
#ifdef UNX
{ return strcasecmp(sKey.str(),i_rInfo.sKey.str()) < 0; }
#else
{ return stricmp(sKey.str(),i_rInfo.sKey.str()) < 0; }
#endif
// INFO
const Simstr & Key() const { return sKey; }
const Simstr & Value() const { return sValue; }
const Simstr & Comment() const { return sComment; }
bool HasSubList() const { return dpSubList != 0; }
const List_GenericInfo &
SubList() const { return HasSubList() ? *dpSubList : CreateMyList(); }
// ACCESS
List_GenericInfo &
SubList() { return HasSubList() ? *dpSubList : CreateMyList(); }
private:
/// @precond dpSubList == 0 .
List_GenericInfo & CreateMyList() const;
// DATA
Simstr sKey;
Simstr sValue;
Simstr sComment;
List_GenericInfo * dpSubList; /// Owned by this object.
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef SOLTOOLS_GI_LIST_HXX
#define SOLTOOLS_GI_LIST_HXX
#include "st_list.hxx"
class GenericInfo;
/** Holds set of generic informations in a sorted list.
At different places, methods of this class have a parameter,
whose name includes "path". Those are paths like this:
src370/drives/o:
which are used to access GenericInfo keys in deep search through
the lists and their sublists.
*/
class List_GenericInfo
{
public:
// TYPES
class const_iterator
{
public:
const GenericInfo & operator*() const;
const_iterator & operator++();
bool operator==( const const_iterator & ) const;
bool operator!=( const const_iterator & ) const;
const_iterator();
const_iterator( const DynamicList< GenericInfo >::const_iterator & );
private: DynamicList< GenericInfo >::const_iterator it;
};
class iterator
{ public:
GenericInfo & operator*() const;
iterator & operator++();
bool operator==( const iterator & ) const;
bool operator!=( const iterator & ) const;
iterator();
iterator( const DynamicList< GenericInfo >::iterator & );
private: DynamicList< GenericInfo >::iterator it;
};
typedef const char * KeyPath;
// LIFECYCLE
List_GenericInfo();
List_GenericInfo(
const List_GenericInfo &
i_rList );
~List_GenericInfo();
// OPERATORS
List_GenericInfo & operator=(
const List_GenericInfo &
i_rList );
const GenericInfo * operator[](
KeyPath i_sKeyPath ) const;
GenericInfo * operator[](
KeyPath i_sKeyPath );
// OPERATIONS
bool InsertInfo(
GenericInfo * let_dpInfo, /// Will be owned by this object.
bool i_bOverwrite = true );
bool InsertInfoByPath(
GenericInfo * let_dpInfo, /// Will be owned by this object.
KeyPath i_sKeyPath,
bool i_bCreatePath,
bool i_bOverwrite = true );
GenericInfo * ReleaseInfo( /// Removes the GenericInfo from its parent.
KeyPath i_sKeyPath );
void DeleteInfo(
KeyPath i_sKeyPath );
// INFO
unsigned Size() const;
const_iterator Begin() const;
const_iterator End() const;
// ACCESS
iterator Begin();
iterator End();
private:
typedef DynamicList< GenericInfo >::iterator sub_iterator;
sub_iterator lower_bound(
bool & o_bExists,
const char * & o_sNextPathSegment,
KeyPath i_sKeyPath );
DynamicList< GenericInfo >
aChildren;
};
// IMPLEMENTATION
inline const GenericInfo &
List_GenericInfo::
const_iterator::operator*() const
{ return *(*it); }
inline List_GenericInfo::const_iterator &
List_GenericInfo::
const_iterator::operator++()
{ ++it; return *this; }
inline bool
List_GenericInfo::
const_iterator::operator==( const const_iterator & i_rIter ) const
{ return it == i_rIter.it; }
inline bool
List_GenericInfo::
const_iterator::operator!=( const const_iterator & i_rIter ) const
{ return it != i_rIter.it; }
inline List_GenericInfo::
const_iterator::const_iterator()
: it(0) { }
inline List_GenericInfo::
const_iterator::const_iterator( const DynamicList< GenericInfo >::const_iterator & i_rDynListIter )
: it(i_rDynListIter) { }
inline GenericInfo &
List_GenericInfo::
iterator::operator*() const
{ return *(*it); }
inline List_GenericInfo::iterator &
List_GenericInfo::
iterator::operator++()
{ ++it; return *this; }
inline bool
List_GenericInfo::
iterator::operator==( const iterator & i_rIter ) const
{ return it == i_rIter.it; }
inline bool
List_GenericInfo::
iterator::operator!=( const iterator & i_rIter ) const
{ return it != i_rIter.it; }
inline List_GenericInfo::
iterator::iterator()
: it(0) { }
inline List_GenericInfo::
iterator::iterator( const DynamicList< GenericInfo >::iterator & i_rDynListIter )
: it(i_rDynListIter) { }
inline unsigned
List_GenericInfo::Size() const
{ return aChildren.size(); }
inline List_GenericInfo::const_iterator
List_GenericInfo::Begin() const
{ return aChildren.begin(); }
inline List_GenericInfo::const_iterator
List_GenericInfo::End() const
{ return aChildren.end(); }
inline List_GenericInfo::iterator
List_GenericInfo::Begin()
{ return aChildren.begin(); }
inline List_GenericInfo::iterator
List_GenericInfo::End()
{ return aChildren.end(); }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef SOLTOOLS_GI_PARSE_HXX
#define SOLTOOLS_GI_PARSE_HXX
#include "simstr.hxx"
#include "gilacces.hxx"
#include <fstream>
class GenericInfoList_Builder;
class GenericInfoList_Browser;
/** Reads generic information files into a simple structure in memory.
Information files used by this parser have the following format:
key [value]
{
key [value]
key [value]
{
key [value]
...
...
}
}
key [value]
...
...
*/
class GenericInfo_Parser : public GenericInfoParseTypes
{
public:
typedef unsigned long UINT32;
typedef short INT16;
GenericInfo_Parser();
~GenericInfo_Parser();
/** reads a information file and stores the data in a
List_GenericInfo
*/
bool LoadList(
GenericInfoList_Builder &
o_rResult,
const Simstr & i_sSourceFileName );
/** save the InformationList to rSourceFile
returns false on error
*/
bool SaveList(
const Simstr & i_rOutputFile,
GenericInfoList_Browser &
io_rListBrowser );
E_Error GetLastError(
UINT32 * o_pErrorLine = 0 ) const;
private:
enum E_LineType
{
lt_empty = 0,
lt_key,
lt_open_list,
lt_close_list,
lt_comment
};
void SetError(
E_Error i_eError );
void ResetState(
GenericInfoList_Builder &
io_rResult );
void ResetState(
GenericInfoList_Browser &
io_rSrc );
void ReadLine();
bool InterpretLine();
E_LineType ClassifyLine();
void ReadKey();
void PushLevel_Read(); /// When list is opened by '{':
void PopLevel_Read(); /// When list is closed by '}':
void AddCurLine2CurComment();
void WriteList(
std::ostream & o_rFile );
void PushLevel_Write(); /// When SubList is pushed in pResource
void PopLevel_Write(); /// When SubList is popped in pResource
void WriteComment(
std::ostream & o_rFile,
const char * i_sStr );
void WriteKey(
std::ostream & o_rFile,
const char * i_sStr );
void WriteValue(
std::ostream & o_rFile,
const char * i_sStr );
void WriteIndentation(
std::ostream & o_rFile );
// DATA
const char * sCurParsePosition;
UINT32 nCurLine;
INT16 nLevel;
bool bGoon;
Simstr sCurComment;
E_Error eErrorCode;
UINT32 nErrorLine;
GenericInfoList_Builder *
pResult;
GenericInfoList_Browser *
pResource;
char * dpBuffer;
char * sFilePtr;
};
inline GenericInfo_Parser::E_Error
GenericInfo_Parser::GetLastError( UINT32 * o_pErrorLine ) const
{
if ( o_pErrorLine != 0 )
*o_pErrorLine = nErrorLine;
return eErrorCode;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef SOLTOOLS_GILACCES_HXX
#define SOLTOOLS_GILACCES_HXX
class GenericInfoParseTypes
{
public:
enum E_Error
{
ok = 0,
cannot_open,
unexpected_eof,
syntax_error,
unexpected_list_end
};
};
/** This class is an abstract interface for a service, which
builds a memory structure out of a generic information
structure, read from a file or other stream.
There may be different implementations, which build different kinds
of memory structures.
*/
class GenericInfoList_Builder
{
public:
typedef unsigned long UINT32;
virtual ~GenericInfoList_Builder() {}
virtual void AddKey(
const char * i_sKey,
UINT32 i_nKeyLength,
const char * i_sValue,
UINT32 i_nValueLength,
const char * i_sComment,
UINT32 i_nCommentLength ) = 0;
virtual void OpenList() = 0;
virtual void CloseList() = 0;
};
/** This class is an abstract interface for a service, which
returns the values of a generic information tree out of
a memory structure.
There may be different implementations, which browse different
kinds of memory structures.
*/
class GenericInfoList_Browser
{
public:
virtual ~GenericInfoList_Browser() {}
virtual bool Start_CurList() = 0;
virtual bool NextOf_CurList() = 0;
virtual void Get_CurKey(
char * o_rKey ) const = 0;
virtual void Get_CurValue(
char * o_rValue ) const = 0;
virtual void Get_CurComment(
char * o_rComment ) const = 0;
virtual bool HasSubList_CurKey() const = 0;
virtual void Push_CurList() = 0;
virtual void Pop_CurList() = 0;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef SOLTOOLS_SIMSTR_HXX
#define SOLTOOLS_SIMSTR_HXX
class Simstr /// Simple string class.
{
// INTERFACE
public:
// LIFECYCLE
Simstr(
const char * str = 0);
Simstr( /** Creates Simstr out of a copy of the first
'nrOfBytes' bytes of 'anyBytes'.
Adds a '\0' at the end. */
const char * anybytes,
int nrOfBytes);
Simstr( /** Creates Simstr out of a copy of the described bytes within 'anyBytes'.
Adds a '\0' at the end. */
const char * anybytes,
int firstBytesPos,
int nrOfBytes );
Simstr( /// Creates Simstr of 'anzahl' times 'c'.
char c,
int anzahl);
Simstr(
const Simstr & S);
~Simstr();
// OPERATORS
operator const char*() const;
Simstr & operator=(
const Simstr & S );
Simstr operator+(
const Simstr & S ) const;
Simstr & operator+=(
const Simstr & S );
Simstr & operator+=(
const char * s );
bool operator==(
const Simstr & S ) const;
bool operator!=(
const Simstr & S ) const;
bool operator<(
const Simstr & S ) const;
bool operator>(
const Simstr & S ) const;
bool operator<=(
const Simstr & S ) const;
bool operator>=(
const Simstr & S ) const;
// INFO
static const Simstr &
null_();
const char * str() const;
int l() const; // Length of string without '\0' at end.
char * s(); // ATTENTION !!! // Only to be used, when a function needs a 'char*' but
// nevertheless THAT WILL BE NOT CHANGED!
// Typecasts to 'const char*' are performed automatically.
char get(
int n) const;
char get_front() const;
char get_back() const;
Simstr get(
int startPos,
int anzahl ) const;
Simstr get_front(
int anzahl ) const;
Simstr get_back(
int anzahl ) const;
int pos_first(
char c ) const;
int pos_first_after(
char c,
int startSearchPos ) const;
int pos_last(
char c ) const;
int pos_first(
const Simstr & S ) const;
int pos_last(
const Simstr & S ) const;
int count(
char c ) const;
bool is_empty() const; // Only true if object == "".
bool is_no_text() const; // String may contain spaces or tabs.
Simstr get_first_token(
char c ) const;
Simstr get_last_token(
char c ) const;
// ACCESS
char & ch( /** Reference to sz[n]. Allows change of this char.
!!! No safety, if n is out of the allowed range! */
int n );
// OPERATIONS
void insert(
int pos,
char c );
void push_front(
char c );
void push_back(
char c );
void insert(
int pos,
const Simstr & S );
void push_front(
const Simstr & S );
void push_back(
const Simstr & S );
void remove(
int pos,
int anzahl = 1 );
void remove_trailing_blanks();
void pop_front(
int anzahl = 1 );
void pop_back(
int anzahl = 1 );
void rem_back_from(
int removeStartPos );
void remove_all(
char c );
void remove_all( // Starts search left.
const Simstr & S );
void strip(
char c ); // Removes all characters == c from front and back.
// c == ' ' removes also TABs !!!
void empty(); // Changes object to the value "".
void replace(
int pos,
char c );
void replace(
int startPos,
int anzahl,
const Simstr & S );
void replace_all(
char oldCh,
char newCh );
void replace_all(
const Simstr & oldS,
const Simstr & newS );
void to_lower();
Simstr take_first_token( /// Token is removed from the Simstr.
char c );
Simstr take_last_token( /// Token is removed from the Simstr.
char c );
private:
// DATA
char * sz;
int len;
};
// Simstr - char* / char - concatenations
Simstr operator+(const char * str, const Simstr & S);
Simstr operator+(const Simstr & S, const char * str);
Simstr operator+(char c, const Simstr & S);
Simstr operator+(const Simstr & S, char c);
// Simstr - char* - comparison operators
bool operator==(const Simstr & S, const char * str);
bool operator!=(const Simstr & S, const char * str);
bool operator<(const Simstr & S, const char * str);
bool operator>(const Simstr & S, const char * str);
bool operator<=(const Simstr & S, const char * str);
bool operator>=(const Simstr & S, const char * str);
bool operator==(const char * str, const Simstr & S);
bool operator!=(const char * str, const Simstr & S);
bool operator<(const char * str, const Simstr & S);
bool operator>(const char * str, const Simstr & S);
bool operator<=(const char * str, const Simstr & S);
bool operator>=(const char * str, const Simstr & S);
inline const char *
Simstr::str() const { return sz; }
inline char *
Simstr::s() { return sz; }
inline int
Simstr::l() const { return len; }
inline
Simstr::operator const char*() const { return sz; }
inline bool
Simstr::is_empty() const { return len == 0; }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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 .
*/
#ifndef SOLTOOLS_ST_LIST_HXX
#define SOLTOOLS_ST_LIST_HXX
#include <string.h>
#include <iostream>
#include <stdlib.h>
template <class XX>
class ST_List /// Soltools-List.
{
public :
typedef XX * iterator;
typedef const XX * const_iterator;
// LIFECYCLE
ST_List();
ST_List(
const ST_List<XX> & i_rList );
virtual ~ST_List() { delete[] inhalt; }
// OPERATORS
ST_List<XX> & operator=(
const ST_List<XX> & i_rList );
const XX & operator[](
unsigned n) const
{ return elem(n); }
XX & operator[](
unsigned n)
{ return elem(n); }
// OPERATIONS
void reserve(
unsigned i_nSize )
{ alloc(i_nSize,true); }
void insert(
iterator i_aPos,
const XX & elem_ )
{ Insert((unsigned)(i_aPos-begin()), elem_); }
virtual void Insert(
unsigned pos,
const XX & elem );
void push_back(
const XX & elem_)
{ Insert(size(),elem_); }
void remove(
iterator i_aPos )
{ Remove((int)(i_aPos-begin())); }
virtual void Remove(
unsigned pos );
void pop_back() { Remove(size()-1); }
void erase_all() { while (size()) Remove(size()-1); }
// INQUIRY
const_iterator begin() const { return &inhalt[0]; }
const_iterator end() const { return &inhalt[len]; }
const XX & front() const { return elem(0); }
const XX & back() const { return elem(len-1); }
unsigned size() const { return len; }
unsigned space() const { return allocated; }
bool is_valid_index(
unsigned n) const
{ return n < len; }
// ACCESS
iterator begin() { return &inhalt[0]; }
iterator end() { return &inhalt[len]; }
XX & front() { return elem(0); }
XX & back() { return elem(len-1); }
protected:
void checkSize(
unsigned newLength);
void alloc(
unsigned newSpace,
bool re = false );
const XX & elem(
unsigned n ) const
{ return inhalt[n]; }
XX & elem(
unsigned n )
{ return inhalt[n]; }
// DATA
XX * inhalt;
unsigned len;
unsigned allocated;
};
template <class XY>
class DynamicList : public ST_List< XY* >
{
public:
DynamicList();
DynamicList(
const DynamicList<XY> &
i_rList );
virtual ~DynamicList(); /// Deletes all member pointers
DynamicList<XY> & operator=(
const DynamicList<XY> &
i_rList );
virtual void Insert(
unsigned pos,
XY * const & elem );
virtual void Remove(
unsigned pos );
};
template <class XX>
ST_List<XX>::ST_List()
: inhalt(0),
len(0),
allocated(0)
{
alloc(1);
}
template <class XX>
ST_List<XX>::ST_List( const ST_List<XX> & i_rList )
: inhalt(0),
len(0),
allocated(0)
{
alloc(i_rList.size());
for ( const_iterator it = i_rList.begin();
it != i_rList.end();
++it )
{
push_back(*it);
}
}
template <class XX>
ST_List<XX> &
ST_List<XX>::operator=( const ST_List<XX> & i_rList )
{
for ( const_iterator it = i_rList.begin();
it != i_rList.end();
++it )
{
push_back(*it);
}
return *this;
}
template <class XX>
void
ST_List<XX>::Insert(unsigned pos, const XX & elem_)
{
if ( pos > len )
return;
checkSize(len+2);
for ( unsigned p = len; p > pos; --p)
{
inhalt[p] = inhalt[p-1];
}
inhalt[pos] = elem_;
len++;
}
template <class XX>
void
ST_List<XX>::Remove(unsigned pos)
{
if ( pos >= len )
return;
len--;
for ( unsigned p = pos; p < len; ++p)
{
inhalt[p] = inhalt[p+1];
}
}
// Protected:
template <class XX>
void
ST_List<XX>::checkSize(unsigned newLength)
{
// neuen Platzbedarf pruefen:
unsigned newSpace = space();
if (newLength >= newSpace)
{
if (!newSpace)
newSpace = 1;
const unsigned nBorder = 2000000000;
while(newLength >= newSpace)
{
if (newSpace < nBorder)
newSpace <<= 1;
else
{
std::cerr << "List becomes too big" << std::endl;
exit(1);
}
}
}
// Veraenderung ?:
if (newSpace != space())
alloc(newSpace,true);
}
template <class XX>
void
ST_List<XX>::alloc( unsigned newSpace,
bool re )
{
XX * pNew = new XX[newSpace];
if (inhalt != 0)
{
if (re)
{
for (unsigned i = 0; i < len; ++i)
{
pNew[i] = inhalt[i];
} // end for
}
delete [] inhalt;
}
inhalt = pNew;
allocated = newSpace;
}
template <class XY>
DynamicList<XY>::DynamicList()
{
}
template <class XY>
DynamicList<XY>::DynamicList( const DynamicList<XY> & i_rList )
: ST_List< XY* >(i_rList)
{
for ( typename DynamicList<XY>::iterator it = this->begin();
it != DynamicList<XY>::end();
++it )
{
// Copying the contents the pointers point at:
(*it) = new XY( *(*it) );
}
}
template <class XY>
DynamicList<XY>::~DynamicList()
{
this->erase_all();
}
template <class XY>
DynamicList<XY> &
DynamicList<XY>::operator=( const DynamicList<XY> & i_rList )
{
for ( typename DynamicList<XY>::const_iterator it = i_rList.begin();
it != i_rList.end();
++it )
{
this->push_back( new XY(*(*it)) );
}
return *this;
}
template <class XY>
void
DynamicList<XY>::Insert(unsigned pos, XY * const & elem_)
{
if ( pos > this->len )
return;
this->checkSize(DynamicList<XY>::len+2);
memmove( DynamicList<XY>::inhalt+pos+1, DynamicList<XY>::inhalt+pos, (DynamicList<XY>::len-pos) * sizeof(XY*) );
this->inhalt[pos] = elem_;
this->len++;
}
template <class XY>
void
DynamicList<XY>::Remove( unsigned pos )
{
if (!this->is_valid_index(pos) )
return;
this->len--;
delete DynamicList<XY>::inhalt[pos];
memmove(DynamicList<XY>::inhalt+pos, DynamicList<XY>::inhalt+pos+1, (DynamicList<XY>::len-pos) * sizeof(XY*) );
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#
# 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 .
#
PRJ=..
PRJNAME=soltools
TARGET=javadep
TARGETTYPE=CUI
NO_DEFAULT_STL=TRUE
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
.INCLUDE : settings.mk
.IF "$(CROSS_COMPILING)"=="YES"
all:
# nothing
.ENDIF
UWINAPILIB=$(0)
LIBSALCPPRT=$(0)
# --- Files --------------------------------------------------------
APP1TARGET = javadep
APP1OBJS = $(OBJ)$/javadep.obj
DEPOBJFILES = $(APP1OBJS)
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
This diff is collapsed.
#
# 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 .
#
$solarversion = $ENV{SOLARVERSION};
$solarversion =~ s![^0-9A-Za-z]!\\$&!g;
$in = <> || die 'no input';
chomp $in;
if ($ENV{OS} eq 'LINUX') {
1 while $in =~ s!\s+-I\s*[^/]\S*\s*! !g; # discard relative includes
$in =~ s!(\s+-I\s*)$solarversion(\S*)!$1\${SOLARVERSION}$2!og;
# macrofy includes to solver
$in =~ s!\s+-o\s*\S+! -o /dev/null! || die 'bad input: no -o';
$in =~ s!\S+/testhxx.cxx!-x c++ /proc/self/fd/0!
|| die 'bad input: no source file';
print STDOUT '#!/bin/sh', "\n";
print STDOUT $in,
' <<<"#include \\"`echo $(if [ ${1%/*} != $1 ];then cd ${1%/*};fi;',
'/bin/pwd)/${1##*/}`\\""', "\n";
} elsif ($ENV{OS} eq 'SOLARIS') {
1 while $in =~ s!\s+-I\s*[^/]\S*\s*! !g; # discard relative includes
$in =~ s!(\s+-I\s*)$solarversion(\S*)!$1\${SOLARVERSION}$2!og;
# macrofy includes to solver
$in =~ s!\s+-o\s*\S+! -o /dev/null! || die 'bad input: no -o';
$in =~ s!\S+/testhxx.cxx!\${my_tmp}!
|| die 'bad input: no source file';
print STDOUT '#!/bin/sh', "\n";
print STDOUT
'my_tmp=${TMPDIR:-/tmp}/`/usr/xpg4/bin/id -u`_$$_include.cc', "\n";
print STDOUT 'my_pat=`dirname $1`', "\n";
print STDOUT 'my_fil=`basename $1`', "\n";
print STDOUT 'my_org=${PWD}', "\n";
print STDOUT 'cd $my_pat || exit 1', "\n";
print STDOUT 'my_pat=`pwd`', "\n";
print STDOUT 'cd $my_org || exit 1', "\n";
print STDOUT
'echo "#include \\"${my_pat}/${my_fil}\\"" > ${my_tmp} || exit 1', "\n";
print STDOUT $in, ' > ${my_tmp}.out 2>&1', "\n";
print STDOUT 'my_ret=$?', "\n";
print STDOUT
'if [ ${my_ret} -ne 0 ] ; then echo $1 >&2 ; cat ${my_tmp}.out >&2 ;',
' fi', "\n";
print STDOUT 'unlink ${my_tmp} || exit 1', "\n";
print STDOUT 'unlink ${my_tmp}.out || exit 1', "\n";
print STDOUT 'exit ${my_ret}', "\n";
} elsif ($ENV{OS} eq 'WNT') {
if ($ENV{COM} eq 'GCC') {
1 while $in =~ s!\s+-I\s*\.\S*\s*! !g; # discard relative includes
$in =~ s!(\s+-I\s*)(?i:$solarversion)(\S*)!$1\${SOLARVERSION}$2!og;
# macrofy includes to solver
$in =~ s!\s+-o\s*\S+! -o /dev/null! || die 'bad input: no -o';
$in =~ s!\S+/testhxx.cxx!\${my_tmp}!
|| die 'bad input: no source file';
print STDOUT '#!/bin/sh', "\n";
print STDOUT
'my_tmp=${TMPDIR:-/tmp}/`id -u`_$$_include.cc', "\n";
print STDOUT 'my_pat=`dirname $1`', "\n";
print STDOUT 'my_fil=`basename $1`', "\n";
print STDOUT 'my_org=${PWD}', "\n";
print STDOUT 'cd $my_pat || exit 1', "\n";
print STDOUT 'my_pat=`cygpath -m \`pwd\``', "\n";
print STDOUT 'cd $my_org || exit 1', "\n";
print STDOUT
'echo "#include \\"${my_pat}/${my_fil}\\"" > ${my_tmp} || exit 1', "\n";
print STDOUT $in, ' > ${my_tmp}.out 2>&1', "\n";
print STDOUT 'my_ret=$?', "\n";
print STDOUT
'if [ ${my_ret} -ne 0 ] ; then echo $1 >&2 ; cat ${my_tmp}.out >&2 ;',
' fi', "\n";
print STDOUT 'unlink ${my_tmp} || exit 1', "\n";
print STDOUT 'unlink ${my_tmp}.out || exit 1', "\n";
print STDOUT 'exit ${my_ret}', "\n";
} else {
1 while $in =~ s!\s+-I\s*\.\S*\s*! !g; # discard relative includes
$in =~ s!(\s+-I\s*)(?i:$solarversion)(\S*)!$1\${SOLARVERSION}$2!og;
# macrofy includes to solver
$in =~ s!\s+-Fo\s*\S+! -Fo$[my_tmp}obj! || die 'bad input: no -Fo';
$in =~ s!\s+-Zi\s! !;
$in =~ s!\s+-Fd\s*\S+!!;
print STDOUT '#!/bin/sh', "\n";
print STDOUT
'my_tmp=${TMPDIR:-/tmp}/`id -u`_$$_include.cc', "\n";
print STDOUT 'my_pat=`dirname $1`', "\n";
print STDOUT 'my_fil=`basename $1`', "\n";
print STDOUT 'my_org=${PWD}', "\n";
print STDOUT 'cd $my_pat || exit 1', "\n";
print STDOUT 'my_pat=`pwd`', "\n";
print STDOUT 'cd $my_org || exit 1', "\n";
print STDOUT
'echo "#include \\"${my_pat}/${my_fil}\\"" > ${my_tmp} || exit 1', "\n";
print STDOUT $in, ' > ${my_tmp}.out 2>&1', "\n";
print STDOUT 'my_ret=$?', "\n";
print STDOUT
'if [ ${my_ret} -ne 0 ] ; then echo $1 >&2 ; cat ${my_tmp}.out >&2 ;',
' fi', "\n";
print STDOUT 'unlink ${my_tmp} || exit 1', "\n";
print STDOUT 'unlink ${my_tmp}.out || exit 1', "\n";
print STDOUT 'exit ${my_ret}', "\n";
}
} else {
print STDOUT 'echo \'no testhxx on this platform\'', "\n";
}
/* -*- 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 .
*/
// This is just a dummy file; see the makefile.mk for the real work.
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment