Kaydet (Commit) 53adf7ca authored tarafından Nils Fuhrmann's avatar Nils Fuhrmann

Initial import, replacement of solenv/wnti/ldump

üst bf483b81
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: hashtbl.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: nf $ $Date: 2001-04-11 09:52:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#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 */
);
~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* FindValidObject(bool bForward);
protected:
void* GetFirst(); // Interation _ohne_ Sortierung
void* GetNext();
void* GetLast();
void* GetPrev();
public:
HashTableIterator(HashTable const&);
};
// typsichere Makros ---------------------------------------------------
#define DECLARE_HASHTABLE_INTERN(ClassName,Owner,KeyType,ObjType) \
class ClassName : public HashTable \
{ \
public: \
ClassName \
( \
unsigned long lSize, \
double dMaxLoadFactor = HashTable::m_defMaxLoadFactor, \
double dGrowFactor = HashTable::m_defDefGrowFactor \
) \
: HashTable(lSize,Owner,dMaxLoadFactor,dGrowFactor) {} \
\
ObjType Find (KeyType const& Key) const \
{ return (ObjType) HashTable::Find((char *) Key); } \
\
bool Insert (KeyType const& Key, ObjType Object) \
{ return HashTable::Insert((char *) Key, (void*) Object); } \
\
ObjType Delete (KeyType const&Key) \
{ return (ObjType) HashTable::Delete ((char *) Key); } \
};
// HashTable OHNE Owner-Verhalten
#define DECLARE_HASHTABLE(ClassName,KeyType,ObjType) \
DECLARE_HASHTABLE_INTERN(ClassName,false,KeyType,ObjType)
// HashTable MIT Owner-Verhalten
#define DECLARE_HASHTABLE_OWNER(ClassName,KeyType,ObjType) \
DECLARE_HASHTABLE_INTERN(ClassName##2,true,KeyType,ObjType) \
class ClassName : public ClassName##2 \
{ \
protected: \
virtual void OnDeleteObject(void* pObject); \
public: \
ClassName \
( \
unsigned long lSize, \
double dMaxLoadFactor = HashTable::m_defMaxLoadFactor, \
double dGrowFactor = HashTable::m_defDefGrowFactor \
) \
: ClassName##2(lSize,dMaxLoadFactor,dGrowFactor) {} \
~ClassName(); \
};
#define IMPLEMENT_HASHTABLE_OWNER(ClassName,KeyType,ObjType) \
void ClassName::OnDeleteObject(void* pObject) \
{ delete (ObjType) pObject; } \
\
ClassName::~ClassName() \
{ \
for (unsigned long i=0; i<GetSize(); i++) \
{ \
void *pObject = GetObjectAt(i); \
if (pObject != NULL) \
OnDeleteObject(pObject); \
} \
}
// Iterator-Makros --------------------------------------------------
#define DECLARE_HASHTABLE_ITERATOR(ClassName,ObjType) \
class ClassName : public HashTableIterator \
{ \
public: \
ClassName(HashTable const& aTable) \
: HashTableIterator(aTable) {} \
\
ObjType GetFirst() \
{ return (ObjType)HashTableIterator::GetFirst(); } \
ObjType GetNext() \
{ return (ObjType)HashTableIterator::GetNext(); } \
ObjType GetLast() \
{ return (ObjType)HashTableIterator::GetLast(); } \
ObjType GetPrev() \
{ return (ObjType)HashTableIterator::GetPrev(); } \
};
#endif // _HASHTBL_HXX
This diff is collapsed.
/*************************************************************************
*
* $RCSfile: ldump.hxx,v $
*
* $Revision: 1.1 $
*
* last change: $Author: nf $ $Date: 2001-04-11 09:52:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
*
* - GNU Lesser General Public License Version 2.1
* - Sun Industry Standards Source License Version 1.1
*
* Sun Microsystems Inc., October, 2000
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2000 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
*
* Sun Industry Standards Source License Version 1.1
* =================================================
* The contents of this file are subject to the Sun Industry Standards
* Source License Version 1.1 (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.openoffice.org/license.html.
*
* Software provided under this License is provided on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
* See the License for the specific provisions governing your rights and
* obligations concerning the Software.
*
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
*
* Copyright: 2000 by Sun Microsystems, Inc.
*
* All Rights Reserved.
*
* Contributor(s): _______________________________________
*
*
************************************************************************/
#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 )
bool CheckDataBase();
bool CheckLibrary(char * cName);
bool ReadDataBase();
bool ReadFilter(char *);
bool PrintSym(char *, bool bName = true );
public:
LibDump( char *cFileName );
~LibDump();
bool Dump();
bool SetFilter(char *cFilterName);
void SetBeginExport(unsigned short nVal){nBegin = nVal;}
void SetCExport( char* pName );
bool Filter(char *pName);
bool PrintDefFile();
bool PrintDataBase();
static bool DumpError(unsigned long nError);
};
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1 $
#
# last change: $Author: nf $ $Date: 2001-04-11 09:52:26 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library 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 for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (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.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..
PRJNAME=ldump
TARGET=ldump
TARGETTYPE=CUI
# --- Settings -----------------------------------------------------
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
# --- Files --------------------------------------------------------
# ldump only supports windows environment
.IF "$(GUI)"=="WNT"
#ldump4 reimplements feature set of ldump2 and ldump3
APP1TARGET= ldump4
APP1STACK= 16000
APP1OBJS= $(OBJ)$/ldump.obj $(OBJ)$/hashtbl.obj
.ENDIF #"$(GUI)"=="WNT"
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
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