Polaris: EquivalenceDict Class Reference

EquivalenceDict Class Reference

Dictionary of Equivalences. More...

#include <EquivalenceDict.h>

Inheritance diagram for EquivalenceDict:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 EquivalenceDict ()
 EquivalenceDict (const BinRep &binstr, Symtab &symtab)
 EquivalenceDict (const EquivalenceDict &dict)
virtual ~EquivalenceDict ()
EquivalenceDictoperator= (const EquivalenceDict &dict)
virtual EquivalenceDictclone () const
 The following methods are either new or overridden in EquivalenceDict.h:.
void rename_and_ins (Equivalence *equiv)
 Renames equiv (only if needed) in such a way that there are no naming conflicts (by a call to new_name(sym->name_ref())), then inserts equiv into the dictionary.
void del (const char *equiv_name)
 deletes if found, ignores otherwise
void absorb (EquivalenceDict &other)
 "Absorbs" the other dictionary into itself
void write (ostream &o, int space_for_label, int max_line_len, const Symtab &symtab) const
 Write FORTRAN output to stream in EQUIVALENCE statement form.
int structures_OK () const
 Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.
virtual void exchange_convert (VDL &vdl)
 Convert the Common Block into the exchange format.
int clean (Equivalence &eq)
 Check to see if the equivalence class is fully connected.
void relink_ptrs (ProgramUnit &p)
 Change the pointers within all elements to point within the given ProgramUnit.

Friends

ostream & operator<< (ostream &o, EquivalenceDict &dict)

Detailed Description

Dictionary of Equivalences.

Polairs C++ VDL

See also:
EquivalenceDict.h

EquivalenceDict.h

EquivalenceDict.cc

Description

EquivalenceDict is simply a dictionary for equivalences which includes a constructor from a binstr.

Bugs

Perhaps the destructor for the Equivalence class should automatically call del() on each of its members so that the pointers in the Symtab are all set to null when this is deleted. Then again, perhaps not...

Definition at line 38 of file EquivalenceDict.h.


Constructor & Destructor Documentation

EquivalenceDict::EquivalenceDict  )  [inline]
 

Definition at line 119 of file EquivalenceDict.h.

References register_instance().

Referenced by clone().

EquivalenceDict::EquivalenceDict const BinRep binstr,
Symtab symtab
 

Definition at line 41 of file EquivalenceDict.cc.

References DictionaryIter< T >::current(), dbx_equivalence_debug_level, Dictionary< Equivalence >::ins(), and register_instance().

EquivalenceDict::EquivalenceDict const EquivalenceDict dict  ) 
 

Definition at line 61 of file EquivalenceDict.cc.

References Dictionary< T >::operator=(), and register_instance().

EquivalenceDict::~EquivalenceDict  )  [virtual]
 

Definition at line 70 of file EquivalenceDict.cc.

References unregister_instance().


Member Function Documentation

EquivalenceDict & EquivalenceDict::operator= const EquivalenceDict dict  ) 
 

Definition at line 78 of file EquivalenceDict.cc.

References BaseMapRoot::clear(), and Dictionary< T >::operator=().

EquivalenceDict * EquivalenceDict::clone  )  const [virtual]
 

The following methods are either new or overridden in EquivalenceDict.h:.

void ins(Equivalence *new_equiv); // Insert a new equivalence into the dictionary. This new // equivalence is automatically deleted when the dictionary // is destroyed (which means that new_equiv must be created // dynamically using the keyword "new"). If the name of // new_equiv is already in the symbol table, an error // indication is given and the program aborts. If name // conflicts might be a problem, use rename_and_ins(...) // instead.

Symbol * find_ref(const char *equiv_name) const; // returns pointer to Equivalence if found, 0 if not found

Symbol & operator [ ] (const char *equiv_name) const; // returns reference to a Equivalence if found, causes error // otherwise

int entries() const; // returns number of entries

Definition at line 87 of file EquivalenceDict.cc.

References EquivalenceDict().

Referenced by ProgramUnit::operator=().

void EquivalenceDict::rename_and_ins Equivalence equiv  ) 
 

Renames equiv (only if needed) in such a way that there are no naming conflicts (by a call to new_name(sym->name_ref())), then inserts equiv into the dictionary.

... No naming conflicts -- just insert

... Successively try new renamings until no conflict is found

... Now equiv has been safely renamed. Insert.

Definition at line 111 of file EquivalenceDict.cc.

References Definition::_tag, Dictionary< Equivalence >::find_ref(), and Dictionary< Equivalence >::ins().

Referenced by absorb(), and clean().

void EquivalenceDict::del const char *  equiv_name  )  [virtual]
 

deletes if found, ignores otherwise

Reimplemented from Dictionary< Equivalence >.

Definition at line 93 of file EquivalenceDict.cc.

References Equivalence::clear(), and Dictionary< Equivalence >::grab().

Referenced by clean().

void EquivalenceDict::absorb EquivalenceDict other  ) 
 

"Absorbs" the other dictionary into itself

I.e., removes all equivalences from other, renames them as necessary to avoid naming conflicts, and inserts them all into this dictionary

Definition at line 104 of file EquivalenceDict.cc.

References rename_and_ins().

Referenced by move_saved_vars().

void EquivalenceDict::write ostream &  o,
int  space_for_label,
int  max_line_len,
const Symtab symtab
const
 

Write FORTRAN output to stream in EQUIVALENCE statement form.

Definition at line 139 of file EquivalenceDict.cc.

Referenced by ProgramUnit::display(), and ProgramUnit::write().

int EquivalenceDict::structures_OK  )  const
 

Check the structure of the data for errors or inconsistency Return 0 and print error message if problems found, otherwise return 1 without message.

Reimplemented from BaseMapRoot.

Definition at line 147 of file EquivalenceDict.cc.

Referenced by ProgramUnit::structures_OK().

void EquivalenceDict::exchange_convert VDL vdl  )  [virtual]
 

Convert the Common Block into the exchange format.

Definition at line 293 of file EquivalenceDict.cc.

References EquivalenceMember::byte_base(), eq(), BinRep::find_ref(), Set< T >::ins(), List< T >::ins_last(), Expression::iterator(), Symbol::name_ref(), EquivalenceMember::symbol(), BinRep::to_set(), and BinRep::to_tuple().

Referenced by ProgramUnit::exchange().

int EquivalenceDict::clean Equivalence eq  ) 
 

Check to see if the equivalence class is fully connected.

If it is not, then split it into a number of smaller classes fixing up symbol table references.

Definition at line 162 of file EquivalenceDict.cc.

References EquivalenceMember::byte_base(), Iterator< T >::current(), Iterator< T >::current_valid(), RefList< T >::del(), del(), RefList< T >::entries(), eq(), Symbol::equivalence(), ProtoDatabase< S, T >::find_ref(), TypedBaseMap< S, T >::first_ref(), RefList< T >::grab(), Database< S, T >::grab(), Database< S, T >::ins(), RefList< T >::ins_last(), Expression::iterator(), RefList< T >::member(), rename_and_ins(), Iterator< T >::reset(), Symbol::size(), EquivalenceMember::symbol(), RefList< T >::valid(), and Iterator< T >::valid().

Referenced by ProgramUnit::clean().

void EquivalenceDict::relink_ptrs ProgramUnit p  ) 
 

Change the pointers within all elements to point within the given ProgramUnit.

Definition at line 154 of file EquivalenceDict.cc.

References relink_all_dptrs().

Referenced by move_saved_vars(), and ProgramUnit::operator=().


Friends And Related Function Documentation

ostream& operator<< ostream &  o,
EquivalenceDict dict
[friend]
 

Definition at line 25 of file EquivalenceDict.cc.


The documentation for this class was generated from the following files:
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:07:18 2005