file: resolved_line.h

/*************************************************************************** resolved_line resolved_line Class made in C++ ***************************************************************************/ /* This file contains the "class" declaration and method declarations for the resolved_line class. define inlined methods: resolved_line::resolved_line(String filename) -sets up the object Revision History: First made by John Langford on 3/4/97 */ /* Class: resolved_line Description: This class resolves identifiers between lines based on EQUs, labels, or #defines. The class also assigns the location in the object code. Private Members: int current_location -instruction location in the object code. preprocessor preproc -where we get our lines from bool resolving -true if there may be unresolved -but resolvable lines stored in -the map String to_be_resolved -if (resolving) to_be_resolved = -a string that is resolved and -may have unresolved lines -dependent on it. error err; -error handling object multimap<String,line,comp_String> unresolved; //OVERLOAD CALL: comp_String: filtermain.cc(?), resolved_line.h(?) -map of unresolvable lines -keyed on the tokens they need -to resolve map<String,String,comp_String> resolved; //OVERLOAD CALL: comp_String: filtermain.cc(?), resolved_line.h(?) -a map that resolves lines error err - the error handling object. Static Members: none Base Classes: none. Friend Classes: none Static Members: none Public Members: none Constructors: resolved_line::resolved_line(String filename) Methods: private: bool resolve_map_line(line& current); -attempts to resolve a line in the unresolved multimap based on the -string to_be_resolved bool newline(line& current); -attempts to get a new line from the preprocessor bool resolveline(line& current); -attempts to resolve a line based on the current contents of the -resolved map public: resolved_line(String filename); -constructor passes "filename" through to preprocessor ~resolved_line(); -checks to see that the "unresolved" multimap is empty bool next(line& good); -returns a good line or false if there are no more //OVERLOAD CALL: next: resolved_line.cc(resolved_line), line.cpp(line), pre.cpp(preprocessor) -good lines Error Handler: err */ #ifndef RESOLVED_LINE_H #define RESOLVED_LINE_H #include <assert.h> #include <stl.h> #include <multimap.h> #include <String.h> #include <stdio.h> #include <iostream.h> #include "line.h" #include "error.h" struct preprocessor{ preprocessor(String){}; bool next(line&){return false;}; //OVERLOAD CALL: next: resolved_line.cc(resolved_line), line.cpp(line), pre.cpp(preprocessor) }; struct comp_String{//used by STL bool operator() (const String i1, const String i2) const //OVERLOAD CALL: operator: error.cc(arg_out), error.cc(error), error.cc(error), error.cc(error), filter.cc(foo), filtermain.cc(comp_String), direct.cpp(include), direct.cpp(define), direct.cpp(ifdef), direct.cpp(ifndef), direct.cpp(_else), direct.cpp(endif) { return strcmp(i1,i2); }; }; class resolved_line { private: int current_location;//in the object code. preprocessor preproc;//where we get our lines from bool resolving;//true if there may be unresolved lines stored in the map //which may be resolved String to_be_resolved; //if (resolving) to_be_resolved = a string that is //resolved and may have unresolved lines dependent on it. error err; //error handling object multimap<String,line,comp_String> unresolved;//map of unresolvable lines //OVERLOAD CALL: comp_String: filtermain.cc(?), resolved_line.h(?) //keyed on the tokens they need to resolve map<String,String,comp_String> resolved;//a map that resolves lines //OVERLOAD CALL: comp_String: filtermain.cc(?), resolved_line.h(?) //helper functions //attempts to resolve a line in the unresolved multimap based on the string //to_be_resolved bool resolve_map_line(line& current); //attempts to get a new line from the preprocessor bool newline(line& current); //attempts to resolve a line based on the current contents of the resolved //map bool resolveline(line& current); public: resolved_line(String filename);//constructor passes "filename" through to //preprocessor ~resolved_line();//does some error checking bool next(line& good);//returns a good line or false if there are no more //OVERLOAD CALL: next: resolved_line.cc(resolved_line), line.cpp(line), pre.cpp(preprocessor) //good lines }; resolved_line::resolved_line(String filename):preproc(filename) { current_location=0; resolving=false;//start out taking lines from preprocessor } #endif


Back to Source File Index


C++ to HTML Conversion by ctoohtml