summaryrefslogtreecommitdiff
path: root/soltools/ldump
diff options
context:
space:
mode:
Diffstat (limited to 'soltools/ldump')
-rw-r--r--soltools/ldump/hashtbl.cxx448
-rw-r--r--soltools/ldump/hashtbl.hxx113
-rw-r--r--soltools/ldump/ldump.cxx756
-rw-r--r--soltools/ldump/ldump.hxx80
-rw-r--r--soltools/ldump/makefile.mk59
5 files changed, 0 insertions, 1456 deletions
diff --git a/soltools/ldump/hashtbl.cxx b/soltools/ldump/hashtbl.cxx
deleted file mode 100644
index bd8c098de..000000000
--- a/soltools/ldump/hashtbl.cxx
+++ /dev/null
@@ -1,448 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_soltools.hxx"
-
-#include "hashtbl.hxx"
-#include <string.h>
-
-// -------------------------------------------------------------
-// class HashItem
-//
-class HashItem
-{
- enum ETag { TAG_EMPTY, TAG_USED, TAG_DELETED };
-
- void* m_pObject;
- ETag m_Tag;
- char* m_Key;
-
-public:
- HashItem() { m_Tag = TAG_EMPTY; m_Key = NULL; m_pObject = NULL; }
- ~HashItem() { delete [] m_Key; }
-
- bool IsDeleted() const
- { return m_Tag == TAG_DELETED; }
-
- bool IsEmpty() const
- { return m_Tag == TAG_DELETED || m_Tag == TAG_EMPTY; }
-
- bool IsFree() const
- { return m_Tag == TAG_EMPTY; }
-
- bool IsUsed() const
- { return m_Tag == TAG_USED; }
-
- void Delete()
- { m_Tag = TAG_DELETED; delete [] m_Key; m_Key = new char[ 1 ]; m_Key[ 0 ] = 0; m_pObject = NULL; }
-
- const char *GetKey() const
- { return m_Key; }
-
- void* GetObject() const
- { return m_pObject; }
-
- void SetObject(const char * Key, void *pObject)
- { m_Tag = TAG_USED; delete [] m_Key; m_Key = new char[ strlen( Key ) + 1 ]; strcpy( m_Key, Key ); m_pObject = pObject; }
-};
-
-#define MIN(a,b) (a)<(b)?(a):(b)
-#define MAX(a,b) (a)>(b)?(a):(b)
-
-// -------------------------------------------------------------
-// class HashTable
-//
-
-/*static*/ double HashTable::m_defMaxLoadFactor = 0.5;
-/*static*/ double HashTable::m_defDefGrowFactor = 2.0;
-
-HashTable::HashTable(unsigned long lSize, bool bOwner, double dMaxLoadFactor, double dGrowFactor)
-{
- m_lSize = lSize;
- m_bOwner = bOwner;
- m_lElem = 0;
- m_dMaxLoadFactor = MAX(0.5,MIN(1.0,dMaxLoadFactor)); // 0.5 ... 1.0
- m_dGrowFactor = MAX(2.0,MIN(5.0,dGrowFactor)); // 1.3 ... 5.0
- m_pData = new HashItem [lSize];
-}
-
-HashTable::~HashTable()
-{
- // Wenn die HashTable der Owner der Objecte ist,
- // müssen die Destruktoren separat gerufen werden.
- // Dies geschieht über die virtuelle Methode OnDeleteObject()
- //
- // Problem: Virtuelle Funktionen sind im Destructor nicht virtuell!!
- // Der Code muß deshalb ins Macro
-
- // Speicher für HashItems freigeben
- delete [] m_pData;
-}
-
-void* HashTable::GetObjectAt(unsigned long lPos) const
-// Gibt Objekt zurück, wenn es eines gibt, sonst NULL;
-{
- HashItem *pItem = &m_pData[lPos];
-
- return pItem->IsUsed() ? pItem->GetObject() : NULL;
-}
-
-void HashTable::OnDeleteObject(void*)
-{
-}
-
-unsigned long HashTable::Hash(const char *Key) const
-{
- // Hashfunktion von P.J. Weinberger
- // aus dem "Drachenbuch" von Aho/Sethi/Ullman
- unsigned long i,n;
- unsigned long h = 0;
- unsigned long g = 0;
-
- for (i=0,n=strlen( Key ); i<n; i++)
- {
- h = (h<<4) + (unsigned long)(unsigned short)Key[i];
- g = h & 0xf0000000;
-
- if (g != 0)
- {
- h = h ^ (g >> 24);
- h = h ^ g;
- }
- }
-
- return h % m_lSize;
-}
-
-unsigned long HashTable::DHash(const char* Key, unsigned long lOldHash) const
-{
- unsigned long lHash = lOldHash;
- unsigned long i,n;
-
- for (i=0,n=strlen( Key ); i<n; i++)
- {
- lHash *= 256L;
- lHash += (unsigned long)(unsigned short)Key[i];
- lHash %= m_lSize;
- }
- return lHash;
-}
-
-unsigned long HashTable::Probe(unsigned long lPos) const
-// gibt den Folgewert von lPos zurück
-{
- lPos++; if (lPos==m_lSize) lPos=0;
- return lPos;
-}
-
-bool HashTable::IsFull() const
-{
- return m_lElem>=m_lSize;
-}
-
-bool HashTable::Insert(const char * Key, void* pObject)
-// pre: Key ist nicht im Dictionary enthalten, sonst return FALSE
-// Dictionary ist nicht voll, sonst return FALSE
-// post: pObject ist unter Key im Dictionary; m_nElem wurde erhöht
-{
- SmartGrow();
-
- if (IsFull())
- {
- return false;
- }
-
- if (FindPos(Key) != NULL )
- return false;
-
- unsigned long lPos = Hash(Key);
- HashItem *pItem = &m_pData[lPos];
-
- // first hashing
- //
- if (pItem->IsEmpty())
- {
- pItem->SetObject(Key, pObject);
- m_lElem++;
-
- return true;
- }
-
- // double hashing
- //
- lPos = DHash(Key,lPos);
- pItem = &m_pData[lPos];
-
- if (pItem->IsEmpty())
- {
- pItem->SetObject(Key, pObject);
- m_lElem++;
-
- return true;
- }
-
- // linear probing
- //
- do
- {
- lPos = Probe(lPos);
- pItem = &m_pData[lPos];
- }
- while(!pItem->IsEmpty());
-
- pItem->SetObject(Key, pObject);
- m_lElem++;
- return true;
-}
-
-HashItem* HashTable::FindPos(const char * Key) const
-// sucht den Key; gibt Refrenz auf den Eintrag (gefunden)
-// oder NULL (nicht gefunden) zurück
-//
-// pre: -
-// post: -
-{
- // first hashing
- //
- unsigned long lPos = Hash(Key);
- HashItem *pItem = &m_pData[lPos];
-
- if (pItem->IsUsed()
- && !(strcmp( pItem->GetKey(), Key )))
- {
- return pItem;
- }
-
- // double hashing
- //
- if (pItem->IsDeleted() || pItem->IsUsed())
- {
- lPos = DHash(Key,lPos);
- pItem = &m_pData[lPos];
-
- if (pItem->IsUsed()
- && (!strcmp( pItem->GetKey(), Key)))
- {
- return pItem;
- }
-
- // linear probing
- //
- if (pItem->IsDeleted() || pItem->IsUsed())
- {
- unsigned long n = 0;
- bool bFound = false;
- bool bEnd = false;
-
- do
- {
- n++;
- lPos = Probe(lPos);
- pItem = &m_pData[lPos];
-
- bFound = pItem->IsUsed()
- && !( strcmp( pItem->GetKey(), Key ));
-
- bEnd = !(n<m_lSize || pItem->IsFree());
- }
- while(!bFound && !bEnd);
-
- return bFound ? pItem : NULL;
- }
- }
-
- // nicht gefunden
- //
- return NULL;
-}
-
-void* HashTable::Find(const char *Key) const
-// Gibt Verweis des Objektes zurück, das unter Key abgespeichert ist,
-// oder NULL wenn nicht vorhanden.
-//
-// pre: -
-// post: -
-{
- HashItem *pItem = FindPos(Key);
-
- if (pItem != NULL
- && ( !strcmp( pItem->GetKey(), Key )))
- return pItem->GetObject();
- else
- return NULL;
-}
-
-void* HashTable::Delete( const char * Key)
-// Löscht Objekt, das unter Key abgespeichert ist und gibt Verweis
-// darauf zurück.
-// Gibt NULL zurück, wenn Key nicht vorhanden ist.
-//
-// pre: -
-// post: Objekt ist nicht mehr enthalten; m_lElem dekrementiert
-// Wenn die HashTable der Owner ist, wurde das Object gelöscht
-{
- HashItem *pItem = FindPos(Key);
-
- if (pItem != NULL
- && ( !strcmp( pItem->GetKey(), Key )))
- {
- void* pObject = pItem->GetObject();
-
- if (m_bOwner)
- OnDeleteObject(pObject);
-
- pItem->Delete();
- m_lElem--;
- return pObject;
- }
- else
- {
- return NULL;
- }
-}
-
-double HashTable::CalcLoadFactor() const
-// prozentuale Belegung der Hashtabelle berechnen
-{
- return double(m_lElem) / double(m_lSize);
-}
-
-void HashTable::SmartGrow()
-// Achtung: da die Objekte umkopiert werden, darf die OnDeleteObject-Methode
-// nicht gerufen werden
-{
- double dLoadFactor = CalcLoadFactor();
-
- if (dLoadFactor <= m_dMaxLoadFactor)
- return; // nothing to grow
-
- unsigned long lOldSize = m_lSize; // alte Daten sichern
- HashItem* pOldData = m_pData;
-
- m_lSize = (unsigned long) (m_dGrowFactor * m_lSize); // neue Größe
- m_pData = new HashItem[m_lSize]; // neue Daten holen
-
- // kein Speicher:
- // Zustand "Tabelle voll" wird in Insert abgefangen
- //
- if (m_pData == NULL)
- {
- m_lSize = lOldSize;
- m_pData = pOldData;
- return;
- }
-
- m_lElem = 0; // noch keine neuen Daten
-
- // Umkopieren der Daten
- //
- for (unsigned long i=0; i<lOldSize; i++)
- {
- HashItem *pItem = &pOldData[i];
-
- if (pItem->IsUsed())
- Insert(pItem->GetKey(),pItem->GetObject());
- }
-
- delete [] pOldData;
-}
-
-// Iterator ---------------------------------------------------------
-//
-
-HashTableIterator::HashTableIterator(HashTable const& aTable)
-: m_aTable(aTable)
-{
- m_lAt = 0;
-}
-
-void* HashTableIterator::GetFirst()
-{
- m_lAt = 0;
- return FindValidObject(true /* forward */);
-}
-
-void* HashTableIterator::GetLast()
-{
- m_lAt = m_aTable.GetSize() -1;
- return FindValidObject(false /* backward */);
-}
-
-void* HashTableIterator::GetNext()
-{
- if (m_lAt+1 >= m_aTable.GetSize())
- return NULL;
-
- m_lAt++;
- return FindValidObject(true /* forward */);
-}
-
-void* HashTableIterator::GetPrev()
-{
- if (m_lAt <= 0)
- return NULL;
-
- m_lAt--;
- return FindValidObject(false /* backward */);
-}
-
-void* HashTableIterator::FindValidObject(bool bForward)
-// Sucht nach einem vorhandenen Objekt ab der aktuellen
-// Position.
-//
-// pre: ab inkl. m_lAt soll die Suche beginnen
-// post: if not found then
-// if bForward == TRUE then
-// m_lAt == m_aTable.GetSize() -1
-// else
-// m_lAt == 0
-// else
-// m_lAt ist die gefundene Position
-{
- void *pObject = m_aTable.GetObjectAt(m_lAt);
-
- if (pObject != NULL)
- return pObject;
-
- while (pObject == NULL
- && (bForward ? ((m_lAt+1) < m_aTable.GetSize())
- : m_lAt > 0))
- {
- if (bForward)
- m_lAt++;
- else
- m_lAt--;
-
- pObject = m_aTable.GetObjectAt(m_lAt);
- }
-
- return pObject;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/soltools/ldump/hashtbl.hxx b/soltools/ldump/hashtbl.hxx
deleted file mode 100644
index b65767147..000000000
--- a/soltools/ldump/hashtbl.hxx
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _HASHTBL_HXX
-#define _HASHTBL_HXX
-
-// ADT hash table
-//
-// Invariante:
-// 1. m_lElem < m_lSize
-// 2. die Elemente in m_Array wurden double-hashed erzeugt
-//
-class HashItem;
-
-class HashTable
-{
- unsigned long m_lSize;
- unsigned long m_lElem;
- HashItem *m_pData;
- double m_dMaxLoadFactor;
- double m_dGrowFactor;
- bool m_bOwner;
-
- unsigned long Hash(const char *cKey) const;
- unsigned long DHash(const char *cKey , unsigned long lHash) const;
- unsigned long Probe(unsigned long lPos) const;
-
- HashItem* FindPos(const char *cKey) const;
- void SmartGrow();
- double CalcLoadFactor() const;
-
-protected:
- friend class HashTableIterator;
-
- virtual void OnDeleteObject(void* pObject);
-
- void* GetObjectAt(unsigned long lPos) const;
-
-// Default-Werte
-public:
- static double m_defMaxLoadFactor;
- static double m_defDefGrowFactor;
-
-public:
- HashTable
- (
- unsigned long lSize,
- bool bOwner,
- double dMaxLoadFactor = HashTable::m_defMaxLoadFactor /* 0.8 */,
- double dGrowFactor = HashTable::m_defDefGrowFactor /* 2.0 */
- );
-
- virtual ~HashTable();
-
- bool IsFull() const;
- unsigned long GetSize() const { return m_lSize; }
-
- void* Find (const char *cKey ) const;
- bool Insert (const char *cKey , void* pObject);
- void* Delete (const char *cKey);
-};
-
-// ADT hash table iterator
-//
-// Invariante: 0 <= m_lAt < m_aTable.GetCount()
-//
-class HashTableIterator
-{
- unsigned long m_lAt;
- HashTable const& m_aTable;
-
- void operator =(HashTableIterator &); // not defined
-
- void* FindValidObject(bool bForward);
-
-protected:
- void* GetFirst(); // Interation _ohne_ Sortierung
- void* GetNext();
- void* GetLast();
- void* GetPrev();
-
-public:
- HashTableIterator(HashTable const&);
-};
-
-#endif // _HASHTBL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/soltools/ldump/ldump.cxx b/soltools/ldump/ldump.cxx
deleted file mode 100644
index 24a6a7aef..000000000
--- a/soltools/ldump/ldump.cxx
+++ /dev/null
@@ -1,756 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_soltools.hxx"
-
-#include <string.h>
-#include <direct.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "ldump.hxx"
-#include "hashtbl.hxx"
-
-#define MAXSYM 65536
-#define MAXBASE 98304
-#define MAX_MAN 4096
-
-int bFilter = 0;
-int bLdump3 = 0;
-int bUseDirectives = 0;
-int bVerbose = 0;
-int bExportByName = 0;
-
-class ExportSet : public HashTable
-{
-public:
- ExportSet
- (
- unsigned long lSize,
- double dMaxLoadFactor = HashTable::m_defMaxLoadFactor,
- double dGrowFactor = HashTable::m_defDefGrowFactor
- )
- : HashTable(lSize,false,dMaxLoadFactor,dGrowFactor) {}
-
- virtual ~ExportSet() {}
-
- LibExport * Find (char * const& Key) const
- { return (LibExport *) HashTable::Find((char *) Key); }
-
- bool Insert (char * const& Key, LibExport * Object)
- { return HashTable::Insert((char *) Key, (void*) Object); }
-
- LibExport * Delete (char * const&Key)
- { return (LibExport *) HashTable::Delete ((char *) Key); }
-};
-
-LibDump::LibDump( char *cFileName, int bExportByName )
- : cBName( NULL ),
- cAPrefix( NULL ),
- cLibName( NULL ),
- cFilterName( NULL ),
- cModName( NULL )
-{
- fprintf( stderr, "LIB-NT File Dumper v4.00 (C) 2000 Sun Microsystems, Inc.\n\n" );
- fprintf( stderr, "%s ", cFileName );
-
- bExportName = bExportByName;
-
- unsigned long nSlots = 0xfffff;
- pBaseTab = new ExportSet( nSlots );
- pIndexTab = new ExportSet( nSlots );
- pFilterLines = new char * [MAXFILT];
- CheckLibrary(cFileName);
- bBase = 0;
- bAll = false;
- nDefStart = 0;
- nBaseLines = 0;
- nFilterLines = 0;
- bDef = true;
- cAPrefix = new char[ 1 ];
- cAPrefix[ 0 ] = 0;
- if (!bExportName)
- CheckDataBase();
-}
-
-bool LibDump::Dump()
-{
- FILE *pList;
- char aBuf[MAX_MAN];
- int nLen;
- char aName[MAX_MAN];
-
- pList = fopen( cLibName, "rb");
- if (!pList)
- DumpError(10);
-
- // forget about offset when working on linker directives
- if ( !bUseDirectives )
- {
- // calculating offset for name section
- unsigned char TmpBuffer[4];
- fread( TmpBuffer, 1, 4, pList);
- // anzahl bigendian mal laenge + ueberspringen der naechsten laengenangabe
- unsigned long nOffSet = (unsigned long) ( TmpBuffer[2] * 256 + TmpBuffer[3] ) * 4 + 4;
- fseek( pList, (long) nOffSet, 0);
- }
-
- char aTmpBuf[4096];
- // reading file containing symbols
- while( !feof( pList ) )
- {
- int i = 0;
- if ( !bUseDirectives )
- {
- // symbol komplett einlesen
- for (;;)
- {
- int c = fgetc( pList );
- if ( c == '\0' )
- {
- break;
- }
- if ( ((c >= 33) && (c <= 126)) && ( c!=40 && c!=41) )
- aBuf[i] = static_cast< char >(c);
- else
- {
- aBuf[0] = '\0';
- break;
- }
- i++;
- }
- // Namen found
- aBuf[i] = '\0';
- }
- else
- {
- fgets( aTmpBuf, 4096, pList );
- char * pEnd = 0;
- char *pFound = 0;
- aBuf[0] = '\0';
- pFound = strchr( aTmpBuf, 'E' );
- while ( pFound )
- {
- if ( strncmp( "EXPORT:", pFound, 7) == 0 )
- {
- pFound += 7;
- pEnd = strchr( pFound, ',');
- if ( pEnd )
- *pEnd = '\0';
- strncpy( aBuf, pFound, strlen( pFound));
- aBuf[ strlen( pFound) ] = '\0';
- break;
- }
- else
- {
- pFound++;
- pFound = strchr( pFound, 'E' );
- }
- }
- }
-
- if (aBuf[0] =='?')
- {
- nLen = (int) strlen(aBuf);
- memset( aName, 0, sizeof( aName ) );
- int nName = 0;
- for( i = 0; i < nLen; i++ )
- {
- if ( (aBuf[i] != '\n') && (aBuf[i] != '\r') )
- {
- aName[nName] = aBuf[i];
- nName++;
- }
- }
- // und raus damit
- PrintSym( aName, bExportByName );
- }
- else if ( bAll == true &&
- strncmp(aBuf, "__real@", 7) != 0 &&
- strncmp(aBuf, "__CT",4) != 0 &&
- strncmp(aBuf, "__TI3?", 6) != 0 )
- {
- int nPreLen = (int) strlen( cAPrefix );
-
- nLen = (int) strlen(aBuf);
- memset( aName, 0, sizeof( aName ) );
- int nName = 0;
-
- for( i = 0; i < nLen; i++ )
- {
- if ( (aBuf[i] != '\n') && (aBuf[i] != '\r') )
- {
- aName[nName] = aBuf[i];
- nName++;
- }
- }
- // den ersten _ raus
- nLen = (int) strlen(aName);
-#ifndef _WIN64
- if (aName[0] == '_')
- strcpy( aBuf , &aName[1] );
-#endif
- strncpy ( aTmpBuf, aBuf, (size_t) nPreLen );
- aTmpBuf[nPreLen] = '\0';
- if ( !strcmp( aTmpBuf, cAPrefix ))
- {
- if ( bLdump3 ) {
- int nChar = '@';
- char *pNeu = strchr( aBuf, nChar );
- size_t nPos = pNeu - aBuf + 1;
- if ( nPos > 0 )
- {
- char aOldBuf[MAX_MAN];
- strcpy( aOldBuf, aBuf );
- char pChar[MAX_MAN];
- strncpy( pChar, aBuf, nPos - 1 );
- pChar[nPos-1] = '\0';
- strcpy( aBuf, pChar );
- strcat( aBuf, "=" );
- strcat( aBuf, aOldBuf );
- strcpy( pChar, "" );
- }
- }
- // und raus damit
- PrintSym( aBuf, true );
- }
- }
- }
- fclose(pList);
- return true;
-}
-
-bool LibDump::ReadFilter( char * cFilterName )
-{
- FILE* pfFilter = 0;
- char aBuf[MAX_MAN];
- char* pStr;
- int nLen;
-
- pfFilter = fopen( cFilterName, "r" );
-
- if ( !pfFilter )
- {
- ::bFilter = 0;
- DumpError( 500 );
- }
-
- while( fgets( aBuf, MAX_MAN, pfFilter ) != 0 )
- {
- nLen = (int) strlen(aBuf);
- pStr = new char[(unsigned int) nLen];
- if ( !pStr )
- DumpError( 98 );
- memcpy( pStr, aBuf, (unsigned int) nLen );
- if ( *(pStr+nLen-1) == '\n' )
- *(pStr+nLen-1) = '\0';
- pFilterLines[nFilterLines] = pStr;
- nFilterLines++;
- if ( nFilterLines >= MAXFILT )
- DumpError( 510 );
- }
-
- fclose( pfFilter );
- return true;
-}
-
-bool LibDump::PrintSym(char *pName, bool bName )
-{
- LibExport *pData;
-
-
- // Filter auswerten
- if ( Filter( pName ) )
- {
- if ( strlen( pName ) > 3 )
- {
- if ( bDef )
- {
- if (!bBase)
- if (bExportName) {
- fprintf( stdout, "\t%s\n", pName );
- } else {
- fprintf( stdout, "\t%s\t\t@%lu\n", pName, nDefStart );
- }
- else
- {
- pData = pBaseTab->Find( pName );
- if ( pData )
- {
- pData->bExport = true;
- if ( bName )
- pData->bByName = true;
- else
- pData->bByName = false;
- if ( bVerbose )
- fprintf(stderr,".");
- }
- else
- {
- // neuen Export eintragen
- pData = new LibExport;
- pData->cExportName = new char[ strlen( pName ) + 1 ];
- strcpy( pData->cExportName, pName );
- pData->nOrdinal = nBaseLines++;
- pData->bExport = true;
- if ( bName )
- pData->bByName = true;
- else
- pData->bByName = false;
- pBaseTab->Insert( pData->cExportName, pData );
- char *cBuffer = new char[ 30 ];
- sprintf( cBuffer, "%lu", pData->nOrdinal );
- pIndexTab->Insert( cBuffer, pData );
- delete [] cBuffer;
- if ( bVerbose )
- fprintf(stderr,"n");
- }
- }
- }
- else
- printf( "%s\n", pName );
- nDefStart++;
- }
- }
- return true;
-}
-
-bool LibDump::IsFromAnonymousNamespace (char *pExportName) {
- char* pattern1 = "@?A0x";
-
- if (strstr(pExportName, pattern1)) {
- return true;
- };
- return false;
-};
-
-bool LibDump::Filter(char *pExportName)
-{
- unsigned long i;
- char pTest[256];
-
- // filter out symbols from anonymous namespaces
- if (IsFromAnonymousNamespace (pExportName))
- return false;
-
- // Kein Filter gesetzt
- if ( ::bFilter == 0 )
- return true;
-
- for ( i=0; i<nFilterLines; i++ )
- {
- //Zum vergleichen muá das Plus abgeschnitteb werden
- if(pFilterLines[i][0] != '+')
- {
- if ( strstr( pExportName, pFilterLines[i]))
- return false;
- }
- else
- {
- strcpy(pTest,&pFilterLines[i][1]);
- if ( strstr( pExportName, pTest))
- return true;
- }
- }
- return true;
-}
-
-bool LibDump::SetFilter(char * cFilterName)
-{
- ReadFilter( cFilterName );
- return true;
-}
-
-bool LibDump::CheckLibrary(char * cName)
-{
- delete [] cLibName;
- cLibName = new char[ strlen( cName ) + 1 ];
- strcpy( cLibName, cName );
- return true;
-}
-
-bool LibDump::ReadDataBase()
-{
- FILE* pfBase = 0;
- char aBuf[MAX_MAN];
- char* pStr;
- char cBuffer[ 30 ];
- int nLen;
- LibExport *pData;
-
- pfBase = fopen( cBName, "r" );
-
- if ( !pfBase )
- {
- bBase = 0;
- DumpError( 600 );
- }
-
- bool bRet = true;
- while( fgets( aBuf, MAX_MAN, pfBase ) != 0 )
- {
- nLen = (int) strlen(aBuf);
- pStr = new char[(unsigned int) nLen];
- if ( !pStr )
- DumpError( 98 );
- memcpy( pStr, aBuf, (size_t) nLen );
- if ( *(pStr+nLen-1) == '\n' )
- *(pStr+nLen-1) = '\0';
- pData = new LibExport;
- pData->cExportName = pStr;
- pData->nOrdinal = nBaseLines;
- pData->bExport=false;
-
- if (pBaseTab->Insert(pData->cExportName, pData ) == NULL)
- bRet = false;
- ltoa( (long) pData->nOrdinal, cBuffer, 10 );
- if (pIndexTab->Insert( cBuffer, pData ) == NULL)
- bRet = false;
- nBaseLines++;
- if ( nBaseLines >= MAXBASE )
- DumpError( 610 );
- }
- fclose( pfBase );
- return bRet;
-}
-
-class ExportSetIter : public HashTableIterator
-{
-public:
- ExportSetIter(HashTable const& aTable)
- : HashTableIterator(aTable) {}
-
- LibExport * GetFirst()
- { return (LibExport *)HashTableIterator::GetFirst(); }
- LibExport * GetNext()
- { return (LibExport *)HashTableIterator::GetNext(); }
- LibExport * GetLast()
- { return (LibExport *)HashTableIterator::GetLast(); }
- LibExport * GetPrev()
- { return (LibExport *)HashTableIterator::GetPrev(); }
-
-private:
- void operator =(ExportSetIter &); // not defined
-};
-
-bool LibDump::PrintDataBase()
-{
- if (bExportName)
- return true;
- FILE *pFp;
- pFp = fopen (cBName,"w+");
- if (!pFp)
- fprintf( stderr, "Error opening DataBase File\n" );
-
- LibExport *pData;
- for ( unsigned long i=0; i < nBaseLines+10; i++ )
- {
- char * cBuffer = new char[ 30 ];
- sprintf( cBuffer, "%lu", i );
- pData = pIndexTab->Find( cBuffer );
- delete [] cBuffer;
- if ( pData )
- fprintf(pFp,"%s\n",pData->cExportName);
- }
- fclose(pFp);
- return true;
-}
-
-bool LibDump::PrintDefFile()
-{
-#ifdef FAST
- ExportSetIter aIterator( *pBaseTab );
- for ( LibExport *pData = aIterator.GetFirst(); pData != NULL;
- pData = aIterator.GetNext() )
- {
- if ( pData->bExport )
- {
- if ( pData->bByName )
- {
- fprintf(stdout,"\t%s\n",
- pData->sExportName.GetBuffer());
- }
- else
- {
- fprintf(stdout,"\t%s\t\t@%d NONAME\n",
- pData->sExportName.GetBuffer(), pData->nOrdinal+nBegin);
- }
- }
- }
-#else
- // sortiert nach Ordinals;
- LibExport *pData;
- for ( unsigned long i=0; i<nBaseLines+1; i++)
- {
- char * cBuffer = new char[ 30 ];
- sprintf( cBuffer, "%lu", i );
- pData = pIndexTab->Find( cBuffer );
- delete [] cBuffer;
- if ( pData )
- if ( pData->bExport )
- {
- if ( pData->bByName )
- {
- if ( strlen( pData->cExportName ))
- fprintf(stdout,"\t%s\n",
- pData->cExportName);
- }
- else
- {
- if ( strlen( pData->cExportName ))
- fprintf(stdout,"\t%s\t\t@%d NONAME\n",
- pData->cExportName, pData->nOrdinal+nBegin);
- }
- }
- }
-#endif
- return true;
-}
-
-bool LibDump::CheckDataBase()
-{
- // existiert eine Datenbasis ?
- if (!bBase)
- {
- cBName = new char[ 2048 ];
- char *pTmp = "defs\\";
-
- FILE *fp;
- _mkdir ("defs");
- strcpy(cBName,pTmp);
- strcat(cBName,getenv ("COMP_ENV"));
-
- fp = fopen (cBName,"r");
- if (fp)
- {
- bBase = true;
- }
- else
- {
- fp = fopen (cBName,"w+");
- bBase = true;
- }
- fclose (fp);
- }
- // lese Datenbasis !
- if (bBase)
- {
- ReadDataBase();
- }
- return true;
-}
-
-LibDump::~LibDump()
-{
- delete [] cBName;
- delete [] cAPrefix;
- delete [] cFilterName;
- delete [] cModName;
-}
-
-void LibDump::SetCExport( char* pName )
-{
- delete [] cAPrefix;
- cAPrefix = new char[ strlen( pName ) + 1 ];
- strcpy( cAPrefix, pName );bAll = true;
-}
-
-//******************************************************************
-//* Error() - Gibt Fehlermeldumg aus
-//******************************************************************
-
-void LibDump::DumpError( unsigned long n )
-{
- char *p;
-
- switch (n)
- {
- case 1: p = "Input error in library file"; break;
- case 2: p = "Position error in library file (no THEADR set)"; break;
- case 3: p = "Overflow of symbol table"; break;
-#ifdef WNT
- case 10: p = "EXP file not found"; break;
- case 11: p = "No valid EXP file"; break;
-#else
- case 10: p = "Library file not found"; break;
- case 11: p = "No valid library file"; break;
-#endif
- case 98: p = "Out of memory"; break;
- case 99: p = "LDUMP [-LD3] [-D] [-N] [-A] [-E nn] [-F name] Filename[.LIB]\n"
- "-LD3 : Supports feature set of ldump3 (default: ldump/ldump2)\n"
- "-A : all symbols (default: only C++)\n"
- "-E nn : gerenration of export table beginning with number nn\n"
- "-F name: Filter file\n"
- "-D : file contains \"dumpbin\" directives\n"
- "-N : export by name\n"
- "-V : be verbose\n"; break;
- case 500: p = "Unable to open filter file\n"; break;
- case 510: p = "Overflow of filter table\n"; break;
- case 600: p = "Unable to open base database file\n"; break;
- case 610: p = "Overflow in base database table\n"; break;
- default: p = "Unspecified error";
- }
- fprintf( stdout, "%s\n", p );
- exit (1);
-}
-
-/*********************************************************************
- Test Funktionen
-*********************************************************************/
-
-
-void usage()
-{
- LibDump::DumpError(99);
-}
-
-#define STATE_NON 0x0000
-#define STATE_BEGIN 0x0001
-#define STATE_FILTER 0x0002
-#define STATE_CEXPORT 0x0003
-
-int
-#ifdef WNT
-__cdecl
-#endif
-main( int argc, char **argv )
-{
- char *pLibName = NULL, *pFilterName = NULL, *pCExport= NULL;
- unsigned short nBegin=1;
-
- unsigned short nState = STATE_NON;
-
- if ( argc == 1 ) {
- usage();
- }
-
- for ( int i = 1; i < argc; i++ ) {
- if (( !strcmp( argv[ i ], "-H" )) ||
- ( !strcmp( argv[ i ], "-h" )) ||
- ( !strcmp( argv[ i ], "-?" )))
- {
- usage();
- }
- else if (( !strcmp( argv[ i ], "-LD3" )) ||
- ( !strcmp( argv[ i ], "-Ld3" )) ||
- ( !strcmp( argv[ i ], "-ld3" )) ||
- ( !strcmp( argv[ i ], "-lD3" )))
- {
- if ( nState != STATE_NON ) {
- usage();
- }
- bLdump3 = 1;
- }
- else if (( !strcmp( argv[ i ], "-E" )) || ( !strcmp( argv[ i ], "-e" ))) {
- if ( nState != STATE_NON ) {
- usage();
- }
- nState = STATE_BEGIN;
- }
- else if (( !strcmp( argv[ i ], "-F" )) || ( !strcmp( argv[ i ], "-f" ))) {
- if ( nState != STATE_NON ) {
- usage();
- }
- nState = STATE_FILTER;
- }
- else if (( !strcmp( argv[ i ], "-A" )) || ( !strcmp( argv[ i ], "-a" ))) {
- if ( nState != STATE_NON ) {
- usage();
- }
- nState = STATE_CEXPORT;
- pCExport = new char[ 1 ];
- pCExport[ 0 ] = 0;
- }
- else if (( !strcmp( argv[ i ], "-D" )) || ( !strcmp( argv[ i ], "-d" ))) {
- if ( nState != STATE_NON ) {
- usage();
- }
- bUseDirectives = 1;
- }
- else if (( !strcmp( argv[ i ], "-N" )) || ( !strcmp( argv[ i ], "-n" ))) {
- if ( nState != STATE_NON ) {
- usage();
- }
- bExportByName = 1;
- }
- else if (( !strcmp( argv[ i ], "-V" )) || ( !strcmp( argv[ i ], "-v" ))) {
- if ( nState != STATE_NON ) {
- usage();
- }
- bVerbose = 1;
- }
- else {
- switch ( nState ) {
- case STATE_BEGIN:
- nBegin = static_cast< unsigned short >(atoi( argv[ i ] ));
- nState = STATE_NON;
- break;
- case STATE_FILTER:
- pFilterName = new char[ strlen( argv[ i ] ) + 1 ];
- strcpy( pFilterName, argv[ i ] );
- bFilter = 1;
- nState = STATE_NON;
- break;
- case STATE_CEXPORT:
- delete [] pCExport;
- pCExport = new char[ strlen( argv[ i ] ) + 1 ];
- strcpy( pCExport, argv[ i ] );
- nState = STATE_NON;
- break;
- default:
- pLibName = new char[ strlen( argv[ i ] ) + 1 ];
- strcpy( pLibName, argv[ i ] );
- break;
- }
- }
- }
-
- if ( !pLibName ) {
- usage();
- }
-
- LibDump *pDump = new LibDump( pLibName, bExportByName );
- pDump->SetBeginExport(nBegin);
- if ( bFilter != 0 )
- pDump->SetFilter( pFilterName );
- if ( pCExport )
- pDump->SetCExport( pCExport );
- else {
- char *pEmpty = "";
- pDump->SetCExport( pEmpty );
- }
- pDump->Dump();
- pDump->PrintDefFile();
- pDump->PrintDataBase();
- delete pDump;
- delete [] pLibName;
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/soltools/ldump/ldump.hxx b/soltools/ldump/ldump.hxx
deleted file mode 100644
index 7d66204bf..000000000
--- a/soltools/ldump/ldump.hxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "hashtbl.hxx"
-
-#define MAXFILT 200
-
-struct LibExport
-{
- char *cExportName; // zu exportierende Fkt.
- unsigned long nOrdinal; // Nummer der zu export. Fkt.
- bool bByName; // NONAME anhaengen
- bool bExport; // exportieren oder nicht ?
-};
-
-class ExportSet;
-class LibDump
-{
- ExportSet *pBaseTab; // Zugriff auf gemangelte Namen
- ExportSet *pIndexTab; // Zugriff auf die Ordinals
- char *cBName; // Name der Datenbasis
- char *cAPrefix; // Prefix fuer C-Fkts.
- char *cLibName; // Name der zu untersuchenden Lib
- char *cFilterName; // Name der Filterdatei
- char *cModName; // Modulname
- unsigned short nBegin; // Nummer des ersten Exports
- unsigned long nBaseLines; // Line in Datenbasis
- unsigned long nFilterLines; // Line in FilterTabelle
- char **pFilterLines; // Filtertabelle
- unsigned long nDefStart;
- bool bBase; // Existenz der DatenBasis;
- bool bAll; // Alle Fkts exportieren
- bool bDef; // DefFile schreiben ( bei -E )
- int bExportName; // 0 - export by ordinal; 1 - export by name
-
- bool CheckDataBase();
- bool CheckLibrary(char * cName);
- bool ReadDataBase();
- bool ReadFilter(char *);
- bool PrintSym(char *, bool bName = true );
-public:
- LibDump( char *cFileName, int bExportByName );
- ~LibDump();
- bool Dump();
- bool SetFilter(char *cFilterName);
- void SetBeginExport(unsigned short nVal){nBegin = nVal;}
- void SetCExport( char* pName );
- bool Filter(char *pName);
- bool IsFromAnonymousNamespace(char *pName);
- bool PrintDefFile();
- bool PrintDataBase();
- static void DumpError(unsigned long nError);
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/soltools/ldump/makefile.mk b/soltools/ldump/makefile.mk
deleted file mode 100644
index 6d0eda3bf..000000000
--- a/soltools/ldump/makefile.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..
-
-PRJNAME=ldump
-TARGET=ldump
-TARGETTYPE=CUI
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
-.INCLUDE : settings.mk
-
-UWINAPILIB=$(0)
-LIBSALCPPRT=$(0)
-
-# --- Files --------------------------------------------------------
-
-# ldump only supports windows environment
-.IF "$(GUI)"=="WNT"
-.IF "$(COM)"!="GCC"
-#ldump4 reimplements feature set of ldump2 and ldump3
-APP1TARGET= ldump4
-.IF "$(GUI)"=="WNT"
-APP1STACK= 16000
-.ENDIF
-APP1OBJS= $(OBJ)$/ldump.obj $(OBJ)$/hashtbl.obj
-
-.ENDIF #"$(COM)"!="GCC"
-.ENDIF #"$(GUI)"=="WNT"
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk