mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
Destroy the StringUtils.h file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@262 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -19,21 +19,18 @@
|
|||||||
#ifndef LLVM_SUPPORT_PROGRAMOPTIONS_H
|
#ifndef LLVM_SUPPORT_PROGRAMOPTIONS_H
|
||||||
#define LLVM_SUPPORT_PROGRAMOPTIONS_H
|
#define LLVM_SUPPORT_PROGRAMOPTIONS_H
|
||||||
|
|
||||||
//************************** System Include Files **************************/
|
|
||||||
|
|
||||||
#include <iostream.h>
|
|
||||||
|
|
||||||
//*************************** User Include Files ***************************/
|
|
||||||
|
|
||||||
#include "llvm/Support/Unique.h"
|
#include "llvm/Support/Unique.h"
|
||||||
#include "llvm/Support/StringUtils.h"
|
#include <vector>
|
||||||
|
#include <hash_map>
|
||||||
|
|
||||||
//************************ Forward Declarations ****************************/
|
template <> struct hash<string> {
|
||||||
|
size_t operator()(string const &str) const {
|
||||||
|
return hash<char const *>()(str.c_str());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ProgramOption;
|
class ProgramOption;
|
||||||
|
|
||||||
//************************* Main Driver Routine ****************************/
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Class: ProgramOptions
|
// Class: ProgramOptions
|
||||||
@@ -99,7 +96,7 @@ public:
|
|||||||
// the option and entry 3n + 2 contains the ascii value of the option.
|
// the option and entry 3n + 2 contains the ascii value of the option.
|
||||||
// All entries are allocated using malloc and can be freed with 'free'.
|
// All entries are allocated using malloc and can be freed with 'free'.
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
virtual vector<char*> GetDescription () const;
|
virtual vector<string> GetDescription () const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
@@ -115,16 +112,16 @@ protected:
|
|||||||
const char* argv[],
|
const char* argv[],
|
||||||
const char* envp[]);
|
const char* envp[]);
|
||||||
|
|
||||||
inline ProgramOption* OptionHandler(const char* optString) {
|
inline ProgramOption* OptionHandler(const string &optString) {
|
||||||
ProgramOption** poPtr = optionRegistry.query(optString);
|
hash_map<string, ProgramOption*>::iterator hp =
|
||||||
return poPtr? *poPtr : NULL;
|
optionRegistry.find(optString);
|
||||||
|
return (hp != optionRegistry.end()) ? hp->second : 0;
|
||||||
}
|
}
|
||||||
|
inline const ProgramOption* OptionHandler(const string &optString) const {
|
||||||
inline const ProgramOption* OptionHandler(const char* optString) const {
|
hash_map<string, ProgramOption*>::const_iterator hp =
|
||||||
const ProgramOption* const* poPtr = optionRegistry.query(optString);
|
optionRegistry.find(optString);
|
||||||
return poPtr? *poPtr : NULL;
|
return (hp != optionRegistry.end()) ? hp->second : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Functions that must be overridden by the subclass.
|
// Functions that must be overridden by the subclass.
|
||||||
@@ -135,7 +132,7 @@ protected:
|
|||||||
virtual void PrintUsage (ostream& stream) const = 0;
|
virtual void PrintUsage (ostream& stream) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
StringMap<ProgramOption*> optionRegistry;
|
hash_map<string, ProgramOption*> optionRegistry;
|
||||||
int argc;
|
int argc;
|
||||||
const char** argv;
|
const char** argv;
|
||||||
const char** envp;
|
const char** envp;
|
||||||
|
@@ -1,75 +0,0 @@
|
|||||||
// $Id$ -*-c++-*-
|
|
||||||
//***************************************************************************
|
|
||||||
//
|
|
||||||
// File:
|
|
||||||
// ProgramOptions.h
|
|
||||||
//
|
|
||||||
// Purpose:
|
|
||||||
// A representation of options for any program.
|
|
||||||
//
|
|
||||||
// History:
|
|
||||||
// 08/08/95 - adve - Created in the dHPF compiler
|
|
||||||
// 10/10/96 - mpal, dbaker - converted to const member functions.
|
|
||||||
// 10/19/96 - meven - slightly changed interface to accomodate
|
|
||||||
// arguments other than -X type options
|
|
||||||
// 07/15/01 - vadve - Copied to LLVM system and modified
|
|
||||||
//
|
|
||||||
//**************************************************************************/
|
|
||||||
|
|
||||||
#ifndef LLVM_SUPPORT_PROGRAMOPTIONS_h
|
|
||||||
#define LLVM_SUPPORT_PROGRAMOPTIONS_h
|
|
||||||
|
|
||||||
//************************** System Include Files **************************/
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <hash_map>
|
|
||||||
|
|
||||||
//*************************** User Include Files ***************************/
|
|
||||||
|
|
||||||
#include "llvm/Support/Unique.h"
|
|
||||||
class ProgramOption;
|
|
||||||
|
|
||||||
//************************ Forward Declarations ****************************/
|
|
||||||
|
|
||||||
//***************************** String Functions ****************************/
|
|
||||||
|
|
||||||
struct eqstr
|
|
||||||
{
|
|
||||||
bool operator()(const char* s1, const char* s2) const
|
|
||||||
{
|
|
||||||
return strcmp(s1, s2) == 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//***************************** String Classes *****************************/
|
|
||||||
|
|
||||||
template <class DataType>
|
|
||||||
class StringMap:
|
|
||||||
public hash_map<const char*, DataType, hash<const char*>, eqstr>
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef hash_map<const char*, DataType, hash<const char*>, eqstr>::iterator
|
|
||||||
iterator;
|
|
||||||
typedef hash_map<const char*, DataType, hash<const char*>, eqstr>::const_iterator
|
|
||||||
const_iterator;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DataType* query(const char* _key)
|
|
||||||
{
|
|
||||||
hash_map<const char*, DataType, hash<const char*>, eqstr>::iterator
|
|
||||||
hashPair = this->find(_key);
|
|
||||||
return (hashPair == this->end())? NULL : & (*hashPair).second;
|
|
||||||
}
|
|
||||||
|
|
||||||
const DataType* query(const char* _key) const
|
|
||||||
{
|
|
||||||
hash_map<const char*, DataType, hash<const char*>, eqstr>::const_iterator
|
|
||||||
hashPair = this->find(_key);
|
|
||||||
return (hashPair == this->end())? NULL : & (*hashPair).second;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//**************************************************************************/
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Reference in New Issue
Block a user