changeset 991:9d43d30dc0ce

add windows support
author bachmann
date Wed, 07 Oct 2009 14:38:00 -0700
parents 7cc4944cae98
children 1aa3af5d8319
files src/share/tools/MakeDeps/ArgsParser.cpp src/share/tools/MakeDeps/ArgsParser.h src/share/tools/MakeDeps/BuildConfig.cpp src/share/tools/MakeDeps/BuildConfig.h src/share/tools/MakeDeps/DirectoryTree.cpp src/share/tools/MakeDeps/DirectoryTree.h src/share/tools/MakeDeps/DirectoryTreeNode.h src/share/tools/MakeDeps/Exceptions.cpp src/share/tools/MakeDeps/Exceptions.h src/share/tools/MakeDeps/FileList.cpp src/share/tools/MakeDeps/MakeDeps.cpp src/share/tools/MakeDeps/UnixPlatform.h src/share/tools/MakeDeps/Util.cpp src/share/tools/MakeDeps/Util.h src/share/tools/MakeDeps/WinGammaPlatform.cpp src/share/tools/MakeDeps/WinGammaPlatform.h src/share/tools/MakeDeps/WinGammaPlatformVC6.cpp src/share/tools/MakeDeps/WinGammaPlatformVC6.h src/share/tools/MakeDeps/WinGammaPlatformVC7.cpp src/share/tools/MakeDeps/WinGammaPlatformVC7.h src/share/tools/MakeDeps/makefile
diffstat 21 files changed, 2435 insertions(+), 2486 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/tools/MakeDeps/ArgsParser.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/ArgsParser.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -34,6 +34,9 @@
 std::string ArgIterator::get() { return args[i]; }
 bool ArgIterator::hasMore() { return i < args.size(); }
 bool ArgIterator::next() { return ++i < args.size(); }
+ArgIterator::~ArgIterator() { }
+
+ArgHandler::~ArgHandler() { }
 
 ArgRule::ArgRule(std::string arg, ArgHandler * handler) {
     this->arg = arg;
@@ -52,6 +55,10 @@
     return arg == rule_pattern;
 }
 
+ArgRule::~ArgRule() {
+  // delete handler?
+}
+
 ArgsParser::ArgsParser(std::vector < std::string > args,
            std::vector < ArgRule * > rules,
            ArgHandler * defaulter) {
@@ -75,3 +82,4 @@
     }
 }
 
+ArgsParser::~ArgsParser() { }
--- a/src/share/tools/MakeDeps/ArgsParser.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/ArgsParser.h	Wed Oct 07 14:38:00 2009 -0700
@@ -36,12 +36,12 @@
     std::string get() ;
     bool hasMore() ;
     bool next() ;
-	virtual ~ArgIterator();
+    virtual ~ArgIterator();
 };
 
 /* abstract */ class ArgHandler {
-    public: virtual /*abstract*/ void handle(ArgIterator * it);
-	virtual ~ArgHandler();
+    public: virtual /*abstract*/ void handle(ArgIterator * it) = 0;
+  virtual ~ArgHandler();
 };
 
 class ArgRule {
--- a/src/share/tools/MakeDeps/BuildConfig.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/BuildConfig.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -23,685 +23,655 @@
  */
 
 #include "BuildConfig.h"
+#include "DirectoryTree.h"
+#include "Macro.h"
+#include "Database.h"
+#include "FileName.h"
+#include "FileList.h"
+#include "Exceptions.h"
+#include "Util.h"
+#include "WinGammaPlatform.h"
+#include "WinGammaPlatformVC6.h"
+#include "WinGammaPlatformVC7.h"
 #include <string>
 #include <vector>
+#include <iostream>
+#include <sstream>
+#include <sys/stat.h>
 
-class BuildConfig {
-Hashtable vars;
-std::vector < ? > basicNames, basicPaths;
+void CompilerInterface::addAttr(std::vector < std::string > * receiver, std::string attr, std::string value) {
+  receiver->push_back(attr); receiver->push_back(value);
+}
+
+std::map < std::string, void * > vars;
 std::vector < std::string > context;
 
-static CompilerInterface ci;
-static CompilerInterface getCI() {
-    if (ci == NULL) {
-        std::string comp = (std::string)getField(NULL, "CompilerVersion");
-        try {
-            ci = (CompilerInterface)Class.forName("CompilerInterface" + comp).newInstance();
-        } catch (Exception cnfe) {
-            std::cerr << ln("Cannot find support for compiler " + comp);
-            throw RuntimeException(cnfe.toString());
-        }
+CompilerInterface * BuildConfig::ci = NULL;
+CompilerInterface * BuildConfig::getCI() {
+  if (ci == NULL) {
+    std::string comp = getFieldString(NULL, "CompilerVersion");
+    if (comp == "VC6") {
+      std::cerr << "ci = new CompilerInterfaceVC6();" << std::endl;
+    } else if (comp == "VC7") {
+      std::cerr << "ci = new CompilerInterfaceVC7();" << std::endl;
+    } else {
+      std::cerr << "Cannot find support for compiler " << comp << std::endl;
+      throw RuntimeException("no support for compiler");
     }
-    return ci;
+  }
+  return ci;
 }
 
-void initNames(std::string flavour, std::string build, std::string outDll) {
-    if (vars == NULL) vars = new Hashtable();
+void BuildConfig::initNames(std::string flavour, std::string build, std::string outDll) {
+  std::string flavourBuild = flavour + "_" + build;
+  put("Name", getCI()->makeCfgName(flavourBuild));
+  put("Flavour", flavour);
+  put("Build", build);
 
-    std::string flavourBuild =  flavour + "_" + build;
-    put("Name", getCI().makeCfgName(flavourBuild));
-    put("Flavour", flavour);
-    put("Build", build);
+  // ones mentioned above were needed to expand format
+  std::string buildBase = expandFormat(getFieldString(NULL, "BuildBase"));
+  std::string jdkDir = getFieldString(NULL, "JdkTargetRoot");
+  std::string sourceBase = getFieldString(NULL, "SourceBase");
+  std::string outDir = buildBase;
 
-    // ones mentioned above were needed to expand format
-    std::string buildBase = expandFormat(getFieldString(NULL, "BuildBase"));
-    std::string jdkDir =  getFieldString(NULL, "JdkTargetRoot");
-    std::string sourceBase = getFieldString(NULL, "SourceBase");
-    std::string outDir = buildBase;
+  put("Id", flavourBuild);
+  put("OutputDir", outDir);
+  put("SourceBase", sourceBase);
+  put("BuildBase", buildBase);
+  put("OutputDll", jdkDir + Util::sep + outDll);
 
-    put("Id", flavourBuild);
-    put("OutputDir", outDir);
-    put("SourceBase", sourceBase);
-    put("BuildBase", buildBase);
-    put("OutputDll", jdkDir + Util.sep + outDll);
-
-    context = new std::string [] {flavourBuild, flavour, build, NULL};
+  context.push_back(flavourBuild);
+  context.push_back(flavour);
+  context.push_back(build);
 }
 
-void init(std::vector < ? > includes, std::vector < ? > defines) {
-    initDefaultDefines(defines);
-    initDefaultCompilerFlags(includes);
-    initDefaultLinkerFlags();
-    handleDB((std::string)getFieldInContext("IncludeDB"));
+void BuildConfig::init(std::vector < std::string > * includes, std::vector < std::string > * defines) {
+  initDefaultDefines(*defines);
+  initDefaultCompilerFlags(*includes);
+  initDefaultLinkerFlags();
+  handleDB(*((std::string*)getFieldInContext("IncludeDB")));
 }
 
-
-void initDefaultCompilerFlags(std::vector < ? > includes) {
-    std::vector < ? > compilerFlags = new std::vector < ? >();
-
-    compilerFlags.addAll(getCI().getBaseCompilerFlags(getV("Define"),
-                                                      includes,
-                                                      get("OutputDir")));
-
-    put("CompilerFlags", compilerFlags);
+void BuildConfig::initDefaultCompilerFlags(std::vector < std::string > includes) {
+  std::vector < std::string > * compilerFlags = new std::vector < std::string >();
+  std::vector < std::string> flags = getCI()->getBaseCompilerFlags(*getV("Define"), includes, get("OutputDir"));
+  compilerFlags->insert(compilerFlags->end(), flags.begin(), flags.end());
+  put("CompilerFlags", compilerFlags);
 }
 
-void initDefaultLinkerFlags() {
-    std::vector < ? > linkerFlags = new std::vector < ? >();
-
-    linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll")));
-
-    put("LinkerFlags", linkerFlags);
+void BuildConfig::initDefaultLinkerFlags() {
+  std::vector < std::string> * linkerFlags = new std::vector < std::string >();
+  std::vector < std::string> flags = getCI()->getBaseLinkerFlags( get("OutputDir"), get("OutputDll"));
+  linkerFlags->insert(linkerFlags->end(), flags.begin(), flags.end());
+  put("LinkerFlags", linkerFlags);
 }
 
-DirectoryTree getSourceTree(std::string sourceBase, std::string startAt) {
-    DirectoryTree tree = new DirectoryTree();
-
-    tree.addSubdirToIgnore("Codemgr_wsdata");
-    tree.addSubdirToIgnore("deleted_files");
-    tree.addSubdirToIgnore("SCCS");
-    tree.setVerbose(true);
-    if (startAt != NULL) {
-        tree.readDirectory(sourceBase + File.separator + startAt);
-    } else {
-        tree.readDirectory(sourceBase);
-    }
-
-    return tree;
+DirectoryTree * BuildConfig::getSourceTree(std::string sourceBase, std::string startAt) {
+  DirectoryTree * tree = new DirectoryTree();
+  tree->addSubdirToIgnore("Codemgr_wsdata");
+  tree->addSubdirToIgnore("deleted_files");
+  tree->addSubdirToIgnore("SCCS");
+  tree->setVerbose(true);
+  if (!startAt.empty()) {
+    std::ostringstream baseDirectory;
+    baseDirectory << sourceBase << File::separator << startAt;
+    tree->readDirectory(baseDirectory.str());
+  } else {
+    tree->readDirectory(sourceBase);
+  }
+  return tree;
 }
 
-
-std::vector < ? > getPreferredPaths(Database currentDB) {
-    std::vector < ? > preferredPaths = new std::vector < ? >();
-    // In the case of multiple files with the same name in
-    // different subdirectories, prefer the versions specified in
-    // the platform file as the "os_family" and "arch" macros.
-    for (std::vector < ? >::iterator iter = currentDB.getMacros(); iter != ?->end(); ) {
-        Macro macro = (Macro) iter.next();
-        if (macro.name == "os_family") ||
-            macro.name == "arch")) {
-            preferredPaths->push_back(macro.contents);
-        }
+std::vector < std::string > * BuildConfig::getPreferredPaths(Database * currentDB) {
+  std::vector < std::string > * preferredPaths = new std::vector < std::string >();
+  // In the case of multiple files with the same name in
+  // different subdirectories, prefer the versions specified in
+  // the platform file as the "os_family" and "arch" macros.
+  for (std::vector < Macro* >::iterator iter = currentDB->getMacrosBegin(); iter != currentDB->getMacrosEnd(); iter++) {
+    Macro * macro = *iter;
+    if ((macro->name == "os_family") || (macro->name == "arch")) {
+      preferredPaths->push_back(macro->contents);
     }
-    // Also prefer "opto" over "adlc" for adlcVMDeps.hpp
-    preferredPaths->push_back("opto");
-
-    return preferredPaths;
+  }
+  // Also prefer "opto" over "adlc" for adlcVMDeps.hpp
+  preferredPaths->push_back("opto");
+  return preferredPaths;
 }
 
 
-void handleDB(std::string dbFile) {
-    WinGammaPlatform platform = (WinGammaPlatform)getField(NULL, "PlatformObject");
-    Database db = new Database(platform, platform.defaultGrandIncludeThreshold());
-
-    try {
-        File incls = new File(get("OutputDir")+Util.sep+"incls");
-        FileName oldInclTempl = platform.getInclFileTemplate();
-        FileName oldGITempl = platform.getGIFileTemplate();
-        FileName oldGDTempl = platform.getGDFileTemplate();
-
-        platform.setInclFileTemplate(new FileName(platform, incls.getPath()+Util.sep,
-                                                  "_", "", ".incl", "", ""));
-        platform.setGIFileTemplate(new FileName(platform, incls.getPath()+Util.sep,
-                                                "",  "_precompiled", ".incl", "", ""));
-
-        incls.mkdirs();
-
-        db.get(getFieldString(NULL, "Platform"), dbFile);
-        db.compute();
-
-        db.put();
-
-        //platform.setInclFileTemplate(oldInclTempl);
-        //platform.setGIFileTemplate(oldInclTempl);
-    } catch (Exception e) {
-        e << StackTrace();
-        throw RuntimeException("cannot do db: "+e);
-    }
-
-    putSpecificField("AllFilesHash", computeAllFiles(platform, db));
+void BuildConfig::handleDB(std::string dbFile) {
+  std::string empty;
+  WinGammaPlatform * platform = (WinGammaPlatform*)getField(empty, "PlatformObject");
+  Database * db = new Database(platform, platform->defaultGrandIncludeThreshold());
+  try {
+    std::ostringstream includeDirectory;
+    includeDirectory << get("OutputDir") << Util::sep << "incls";
+    mkdir(includeDirectory.str().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
+    includeDirectory << Util::sep;
+    FileName * oldInclTempl = platform->getInclFileTemplate();
+    FileName * oldGITempl = platform->getGIFileTemplate();
+    FileName * oldGDTempl = platform->getGDFileTemplate();
+    platform->setInclFileTemplate(
+      new FileName(platform, includeDirectory.str(), "_", "", ".incl", "", ""));
+    platform->setGIFileTemplate(
+      new FileName(platform, includeDirectory.str(), "",  "_precompiled", ".incl", "", ""));
+    db->get(getFieldString(NULL, "Platform"), dbFile);
+    db->compute();
+    db->put();
+    //platform->setInclFileTemplate(oldInclTempl);
+    //platform->setGIFileTemplate(oldInclTempl);
+  } catch (Exception e) {
+    std::ostringstream message;
+    message << "cannot do db: " << e.getMessage();
+    throw RuntimeException(message.str());
+  }
+  putSpecificField("AllFilesHash", computeAllFiles(platform, db));
 }
 
 
-void addAll(std::vector < ? >::iterator i, Hashtable hash,
-            WinGammaPlatform platform, DirectoryTree tree,
-            std::vector < ? > preferredPaths, std::vector < ? > filesNotFound, std::vector < ? > filesDuplicate) {
-    for (; i != ?->end(); ) {
-        std::string fileName = (std::string) i.next();
-        if (lookupHashFieldInContext("IgnoreFile", fileName) == NULL) {
-            std::string prefixedName = platform.envVarPrefixedFileName(fileName,
+void BuildConfig::addAll(std::vector< std::string > * vector, 
+			 std::map < std::string , std::string > * hash,
+			 WinGammaPlatform * platform, DirectoryTree * tree,
+			 std::vector < std::string > * preferredPaths, 
+			 std::vector < std::string > * filesNotFound, 
+			 std::vector < std::string > * filesDuplicate) {
+  for (std::vector< std::string >::iterator i = vector->begin(); i != vector->end(); i++) {
+    std::string fileName = *i;
+    if (lookupHashFieldInContext("IgnoreFile", fileName) == NULL) {
+      std::string prefixedName = platform->envVarPrefixedFileName(fileName,
                                                                   0, /* ignored */
                                                                   tree,
                                                                   preferredPaths,
                                                                   filesNotFound,
                                                                   filesDuplicate);
-            if (prefixedName != NULL) {
-                addTo(hash, Util.normalize(prefixedName), fileName);
-            }
-        }
+      if (!prefixedName.empty()) {
+	addTo(hash, Util::normalize(prefixedName), fileName);
+      }
     }
+  }
 }
 
-void addTo(Hashtable ht, std::string key, std::string value) {
-    ht.put(expandFormat(key), expandFormat(value));
+void BuildConfig::addTo(std::map < std::string, std::string > * ht, std::string key, std::string value) {
+  (*ht)[expandFormat(key)] = expandFormat(value);
 }
 
-Hashtable computeAllFiles(WinGammaPlatform platform, Database db) {
-    Hashtable rv = new Hashtable();
-    DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(NULL, "StartAt"));
-    std::vector < ? > preferredPaths = getPreferredPaths(db);
+std::map < std::string , std::string > * BuildConfig::computeAllFiles(WinGammaPlatform * platform, Database * db) {
+  std::map < std::string , std::string > * rv = new std::map < std::string , std::string >();
+  DirectoryTree * tree = getSourceTree(get("SourceBase"), getFieldString(NULL, "StartAt"));
+  std::vector < std::string > * preferredPaths = getPreferredPaths(db);
 
-    // Hold errors until end
-    std::vector < ? > filesNotFound = new std::vector < ? >();
-    std::vector < ? > filesDuplicate = new std::vector < ? >();
+  // Hold errors until end
+  std::vector < std::string > * filesNotFound = new std::vector < std::string >();
+  std::vector < std::string > * filesDuplicate = new std::vector < std::string >();
 
+  // find all files
+  std::vector < std::string > * dbFiles = new std::vector < std::string >();
+  FileList * dbAllFiles = db->getAllFiles();
+  for (std::vector < FileList* >::iterator i=dbAllFiles->begin(); i != dbAllFiles->end(); i++) {
+    FileList * fl = *i;
+    dbFiles->push_back(fl->getName());
+  }
+  addAll(dbFiles, rv,
+	 platform, tree,
+	 preferredPaths, filesNotFound, filesDuplicate);
 
-    // find all files
-    std::vector < ? > dbFiles = new std::vector < ? >();
-    for (std::vector < ? >::iterator i=db.getAllFiles()->begin(); i != ?->end(); ) {
-        FileList fl = (FileList) i.next();
-        dbFiles->push_back(fl.getName());
+  std::vector < std::string > * addFiles = new std::vector < std::string >();
+  collectRelevantVectors(addFiles, "AdditionalFile");
+  addAll(addFiles, rv,
+	 platform, tree,
+	 preferredPaths, filesNotFound, filesDuplicate);
+
+  collectRelevantHashes(rv, "AdditionalGeneratedFile");
+
+  if ((filesNotFound->size() != 0) ||
+      (filesDuplicate->size() != 0)) {
+    std::cerr << "Error: some files were not found or " 
+	      << "appeared in multiple subdirectories of "
+	      << "directory " << get("SourceBase") << " and could not "
+	      << "be resolved with the os_family and arch " 
+	      << "macros in the platform file." << std::endl;
+    if (filesNotFound->size() != 0) {
+      std::cerr << "Files not found:" << std::endl;
+      for (std::vector < std::string >::iterator iter = filesNotFound->begin();
+	   iter != filesNotFound->end(); ) {
+	std::cerr << "  " << *iter++ << std::endl ;
+      }
     }
-    addAll(dbFiles->begin(), rv,
-           platform, tree,
-           preferredPaths, filesNotFound, filesDuplicate);
-
-    std::vector < ? > addFiles = new std::vector < ? >();
-    collectRelevantVectors(addFiles, "AdditionalFile");
-    addAll(addFiles->begin(), rv,
-           platform, tree,
-           preferredPaths, filesNotFound, filesDuplicate);
-
-    collectRelevantHashes(rv, "AdditionalGeneratedFile");
-
-    if ((filesNotFound.size() != 0) ||
-        (filesDuplicate.size() != 0)) {
-        std::cerr << ln("Error: some files were not found or " +
-                           "appeared in multiple subdirectories of " +
-                           "directory " + get("SourceBase") + " and could not " +
-                           "be resolved with the os_family and arch " +
-                           "macros in the platform file.");
-        if (filesNotFound.size() != 0) {
-            std::cerr << ln("Files not found:");
-            for (std::vector < ? >::iterator iter = filesNotFound->begin();
-                 iter != ?->end(); ) {
-                std::cerr << ln("  " + (std::string) iter.next());
-            }
-        }
-        if (filesDuplicate.size() != 0) {
-            std::cerr << ln("Duplicate files:");
-            for (std::vector < ? >::iterator iter = filesDuplicate->begin();
-                 iter != ?->end(); ) {
-                std::cerr << ln("  " + (std::string) iter.next());
-            }
-        }
-        throw RuntimeException();
+    if (filesDuplicate->size() != 0) {
+      std::cerr << "Duplicate files:" << std::endl;
+      for (std::vector < std::string >::iterator iter = filesDuplicate->begin();
+	   iter != filesDuplicate->end(); ) {
+	std::cerr << "  " << *iter++ << std::endl ;
+      }
     }
-
-    return rv;
+    throw RuntimeException();
+  }
+  return rv;
 }
 
-void initDefaultDefines(std::vector < ? > defines) {
-    std::vector < ? > sysDefines = new std::vector < ? >();
-    sysDefines->push_back("WIN32");
-    sysDefines->push_back("_WINDOWS");
-    sysDefines->push_back("HOTSPOT_BUILD_USER="+getenv("user.name"));
-    sysDefines->push_back("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
-    sysDefines->push_back("_JNI_IMPLEMENTATION_");
-
-    sysDefines.addAll(defines);
-
-    put("Define", sysDefines);
+void BuildConfig::initDefaultDefines(std::vector < std::string > defines) {
+  std::vector < std::string > * sysDefines = new std::vector < std::string >();
+  sysDefines->push_back("WIN32");
+  sysDefines->push_back("_WINDOWS");
+  std::ostringstream user;
+  user << "HOTSPOT_BUILD_USER=" << getenv("user.name");
+  sysDefines->push_back(user.str());
+  std::ostringstream target;
+  target << "HOTSPOT_BUILD_TARGET=\\\"" << get("Build") << "\\\"";
+  sysDefines->push_back(target.str());
+  sysDefines->push_back("_JNI_IMPLEMENTATION_");
+  sysDefines->insert(sysDefines->begin(), defines.begin(), defines.end());
+  put("Define", sysDefines);
 }
 
-std::string get(std::string key) {
-    return (std::string)vars.get(key);
+std::string BuildConfig::get(std::string key) {
+  if (vars.count(key) == 0) {
+    return "";
+  }
+  std::string * ptr = (std::string*)vars[key];
+  return *ptr;
 }
 
-std::vector < ? > getV(std::string key) {
-    return (std::vector < ? >)vars.get(key);
+std::vector < std::string > * BuildConfig::getV(std::string key) {
+  if (vars.count(key) == 0) {
+    return NULL;
+  }
+  return (std::vector < std::string > *) vars[key];
 }
 
-Object getO(std::string key) {
-    return vars.get(key);
+void * BuildConfig::getO(std::string key) {
+  if (vars.count(key) == 0) {
+    return NULL;
+  }
+  return vars[key];
 }
 
-Hashtable getH(std::string key) {
-    return (Hashtable)vars.get(key);
+void * BuildConfig::getFieldInContext(std::string field) {
+  for (std::vector < std::string >::size_type i=0; i<context.size(); i++) {
+    void * rv = getField(context[i], field);
+    if (rv != NULL) {
+      return rv;
+    }
+  }
+  return NULL;
 }
 
-Object getFieldInContext(std::string field) {
-    for (int i=0; i<context.size(); i++) {
-        Object rv = getField(context[i], field);
-        if (rv != NULL) {
-            return rv;
-        }
+void * BuildConfig::lookupHashFieldInContext(std::string field, std::string key) {
+  for (std::vector < std::string >::size_type i=0; i<context.size(); i++) {
+    std::map < std::string, void *> * ht = (std::map < std::string, void *>*)getField(context[i], field);
+    if (ht != NULL) {
+      if (ht->count(key) != 0) {
+	return (*ht)[key];
+      }
     }
-    return NULL;
+  }
+  return NULL;
 }
 
-Object lookupHashFieldInContext(std::string field, std::string key) {
-    for (int i=0; i<context.size(); i++) {
-        Hashtable ht = (Hashtable)getField(context[i], field);
-        if (ht != NULL) {
-            Object rv = ht.get(key);
-            if (rv != NULL) {
-                return rv;
-            }
-        }
-    }
-    return NULL;
+void BuildConfig::put(std::string key, std::string value) {
+  vars[key] = new std::string(value);
 }
 
-void put(std::string key, std::string value) {
-    vars.put(key, value);
+void BuildConfig::put(std::string key, std::vector < std::string > * vvalue) {
+  vars[key] = vvalue;
 }
 
-void put(std::string key, std::vector < ? > vvalue) {
-    vars.put(key, vvalue);
+void BuildConfig::add(std::string key, std::vector < std::string > * vvalue) {
+  std::vector < std::string > * v = getV(key);
+  v->insert(v->begin(), vvalue->begin(), vvalue->end());
 }
 
-void add(std::string key, std::vector < ? > vvalue) {
-    getV(key).addAll(vvalue);
+std::string BuildConfig::flavour() {
+  return get("Flavour");
 }
 
-std::string flavour() {
-    return get("Flavour");
+std::string BuildConfig::build() {
+  return get("Build");
 }
 
-std::string build() {
-    return get("Build");
+void * BuildConfig::getSpecificField(std::string field) {
+  return getField(get("Id"), field);
 }
 
-Object getSpecificField(std::string field) {
-    return getField(get("Id"), field);
+void BuildConfig::putSpecificField(std::string field, void * value) {
+  putField(get("Id"), field, value);
 }
 
-void putSpecificField(std::string field, Object value) {
-    putField(get("Id"), field, value);
+void BuildConfig::collectRelevantVectors(std::vector < std::string > * rv, std::string field) {
+  for (std::vector < std::string >::size_type i = 0; i < context.size(); i++) {
+    std::vector < std::string > * v = getFieldVector(context[i], field);
+    if (v != NULL) {
+      for (std::vector < std::string >::iterator j=v->begin(); j != v->end(); ) {
+	std::string val = *j++;
+	rv->push_back(expandFormat(val));
+      }
+    }
+  }
 }
 
-void collectRelevantVectors(std::vector < ? > rv, std::string field) {
-    for (int i = 0; i < context.size(); i++) {
-        std::vector < ? > v = getFieldVector(context[i], field);
-        if (v != NULL) {
-            for (std::vector < ? >::iterator j=v->begin(); j != ?->end(); ) {
-                std::string val = (std::string)j.next();
-                rv->push_back(expandFormat(val));
-            }
-        }
+void BuildConfig::collectRelevantHashes(std::map < std::string , std::string > * rv, std::string field) {
+  for (std::vector < std::string >::size_type i = 0; i < context.size(); i++) {
+    std::map < std::string, std::string > * v = (std::map < std::string, std::string > *)getField(context[i], field);
+    if (v != NULL) {
+      std::map < std::string, std::string>::iterator i = v->begin();
+      while (i != v->end()) {
+	std::string key = i->first;
+	std::string val = i->second;
+	addTo(rv, key, val);
+	i++;
+      }
     }
+  }
 }
 
-void collectRelevantHashes(Hashtable rv, std::string field) {
-    for (int i = 0; i < context.size(); i++) {
-        Hashtable v = (Hashtable)getField(context[i], field);
-        if (v != NULL) {
-            for (Enumeration e=v.keys(); e.hasMoreElements(); ) {
-                std::string key = (std::string)e.nextElement();
-                std::string val =  (std::string)v.get(key);
-                addTo(rv, key, val);
-            }
-        }
-    }
+std::vector < std::string > * BuildConfig::getDefines() {
+  std::vector < std::string > * rv;
+  collectRelevantVectors(rv, "Define");
+  return rv;
 }
 
-
-std::vector < ? > getDefines() {
-    std::vector < ? > rv = new std::vector < ? >();
-    collectRelevantVectors(rv, "Define");
-    return rv;
+std::vector < std::string > * BuildConfig::getIncludes() {
+  std::vector < std::string > * rv = new std::vector < std::string>();
+  // for generated includes
+  rv->push_back(get("OutputDir"));
+  collectRelevantVectors(rv, "AbsoluteInclude");
+  std::vector < std::string > ri;
+  std::string sourceBase = getFieldString(NULL, "SourceBase");
+  collectRelevantVectors(&ri, "RelativeInclude");
+  for (std::vector < std::string >::iterator i = ri.begin(); i != ri.end(); ) {
+    std::string f = *i++;
+    std::ostringstream include;
+    include << sourceBase << Util::sep << f;
+    rv->push_back(include.str());
+  }
+  return rv;
 }
 
-std::vector < ? > getIncludes() {
-    std::vector < ? > rv = new std::vector < ? >();
+std::map < std::string , std::map < std::string , void * > * > BuildConfig::cfgData;
+std::map < std::string , void * > BuildConfig::globalData;
 
-    // for generated includes
-    rv->push_back(get("OutputDir"));
-
-    collectRelevantVectors(rv, "AbsoluteInclude");
-
-    std::vector < ? > ri = new std::vector < ? >();
-    std::string sourceBase = getFieldString(NULL, "SourceBase");
-    collectRelevantVectors(ri, "RelativeInclude");
-    for (std::vector < ? >::iterator i = ri->begin(); i != ?->end(); ) {
-        std::string f = (std::string)i.next();
-        rv->push_back(sourceBase + Util.sep + f);
-    }
-
-    return rv;
-}
-
-static Hashtable cfgData = new Hashtable();
-static Hashtable globalData = new Hashtable();
-
-static bool appliesToTieredBuild(std::string cfg) {
-    return (cfg != NULL &&
-            (cfg.startsWith("compiler1") ||
-             cfg.startsWith("compiler2")));
+bool BuildConfig::appliesToTieredBuild(std::string cfg) {
+  return (!cfg.empty() &&
+	  (startsWith(cfg, "compiler1") ||
+	   startsWith(cfg, "compiler2")));
 }
 
 // Filters out the IncludeDB statement, which is the only command-
 // line argument we explicitly specialize for the tiered build
-static bool appliesToTieredBuild(std::string cfg, std::string key) {
-    return (appliesToTieredBuild(cfg) &&
-            (key != NULL &&
-             !key == "IncludeDB")));
+bool BuildConfig::appliesToTieredBuild(std::string cfg, std::string key) {
+  return (appliesToTieredBuild(cfg) &&
+	  (!key.empty() && key != "IncludeDB"));
 }
 
-static std::string getTieredBuildCfg(std::string cfg) {
-    assert appliesToTieredBuild(cfg) : "illegal configuration " + cfg;
-    return "tiered" + cfg.substring(9);
+std::string BuildConfig::getTieredBuildCfg(std::string cfg) {
+  if (!appliesToTieredBuild(cfg)) {
+    std::ostringstream message;
+    message << "illegal configuration" << cfg;
+    throw new RuntimeException(message.str());
+  }
+  std::ostringstream tiered;
+  tiered << "tiered" << cfg.substr(9);
+  return tiered.str();
 }
 
-static Object getField(std::string cfg, std::string field) {
-    if (cfg == NULL) {
-        return globalData.get(field);
+void * BuildConfig::getField(std::string cfg, std::string field) {
+  if (cfg.empty()) {
+    if (globalData.count(field) == 0) {
+      return NULL;
     }
-
-    Hashtable ht =  (Hashtable)cfgData.get(cfg);
-    return ht == NULL ? NULL : ht.get(field);
+    return globalData[field];
+  }
+  if (cfgData.count(cfg) == 0) {
+    return NULL;
+  }
+  std::map < std::string, void * > * ht = (std::map < std::string, void * > *)cfgData[cfg];
+  if (ht == NULL || ht->count(field) == 0) {
+    return NULL;
+  }
+  return (*ht)[field];
 }
 
-static std::string getFieldString(std::string cfg, std::string field) {
-    return (std::string)getField(cfg, field);
+std::string BuildConfig::getFieldString(std::string cfg, std::string field) {
+  return *((std::string*)getField(cfg, field));
 }
 
-static std::vector < ? > getFieldVector(std::string cfg, std::string field) {
-    return (std::vector < ? >)getField(cfg, field);
+std::vector < std::string > * BuildConfig::getFieldVector(std::string cfg, std::string field) {
+  return (std::vector < std::string > *)getField(cfg, field);
 }
 
-static void putField(std::string cfg, std::string field, Object value) {
-    putFieldImpl(cfg, field, value);
-    if (appliesToTieredBuild(cfg, field)) {
-        putFieldImpl(getTieredBuildCfg(cfg), field, value);
-    }
+void BuildConfig::putField(std::string cfg, std::string field, void * value) {
+  putFieldImpl(cfg, field, value);
+  if (appliesToTieredBuild(cfg, field)) {
+    putFieldImpl(getTieredBuildCfg(cfg), field, value);
+  }
 }
 
-static void putFieldImpl(std::string cfg, std::string field, Object value) {
-    if (cfg == NULL) {
-        globalData.put(field, value);
-        return;
-    }
-
-    Hashtable ht = (Hashtable)cfgData.get(cfg);
-    if (ht == NULL) {
-        ht = new Hashtable();
-        cfgData.put(cfg, ht);
-    }
-
-    ht.put(field, value);
+void BuildConfig::putFieldImpl(std::string cfg, std::string field, void * value) {
+  if (cfg.empty()) {
+    globalData[field] = value;
+    return;
+  }
+  if (cfgData.count(cfg) == 0) {
+    cfgData[cfg] = new std::map < std::string, void * >();
+  }
+  (*((std::map < std::string, void *> *)cfgData[cfg]))[field] = value;
 }
 
-static Object getFieldHash(std::string cfg, std::string field, std::string name) {
-    Hashtable ht = (Hashtable)getField(cfg, field);
-
-    return ht == NULL ? NULL : ht.get(name);
+void * BuildConfig::getFieldHash(std::string cfg, std::string field, std::string name) {
+  std::map < std::string, void * > * ht = (std::map < std::string, void * > *)getField(cfg, field);
+  return ht == NULL ? NULL : (*ht)[name];
 }
 
-static void putFieldHash(std::string cfg, std::string field, std::string name, Object val) {
-    putFieldHashImpl(cfg, field, name, val);
-    if (appliesToTieredBuild(cfg)) {
-        putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val);
-    }
+void BuildConfig::putFieldHash(std::string cfg, std::string field, std::string name, void * val) {
+  putFieldHashImpl(cfg, field, name, val);
+  if (appliesToTieredBuild(cfg)) {
+    putFieldHashImpl(getTieredBuildCfg(cfg), field, name, val);
+  }
 }
 
-static void putFieldHashImpl(std::string cfg, std::string field, std::string name, Object val) {
-    Hashtable ht = (Hashtable)getField(cfg, field);
-
-    if (ht == NULL) {
-        ht = new Hashtable();
-        putFieldImpl(cfg, field, ht);
-    }
-
-    ht.put(name, val);
+void BuildConfig::putFieldHashImpl(std::string cfg, std::string field, std::string name, void * val) {
+  std::map < std::string, void * > * ht = (std::map < std::string, void * > *)getField(cfg, field);
+  if (ht == NULL) {
+    ht = new std::map < std::string, void * >();
+    putFieldImpl(cfg, field, ht);
+  }
+  (*ht)[name] = val;
 }
 
-static void addFieldVector(std::string cfg, std::string field, std::string element) {
-    addFieldVectorImpl(cfg, field, element);
-    if (appliesToTieredBuild(cfg)) {
-        addFieldVectorImpl(getTieredBuildCfg(cfg), field, element);
-    }
+void BuildConfig::addFieldVector(std::string cfg, std::string field, std::string element) {
+  addFieldVectorImpl(cfg, field, element);
+  if (appliesToTieredBuild(cfg)) {
+    addFieldVectorImpl(getTieredBuildCfg(cfg), field, element);
+  }
 }
 
-static void addFieldVectorImpl(std::string cfg, std::string field, std::string element) {
-    std::vector < ? > v = (std::vector < ? >)getField(cfg, field);
-
-    if (v == NULL) {
-        v = new std::vector < ? >();
-        putFieldImpl(cfg, field, v);
-    }
-
-    v->push_back(element);
+void BuildConfig::addFieldVectorImpl(std::string cfg, std::string field, std::string element) {
+  std::vector < std::string > * v = (std::vector < std::string >*)getField(cfg, field);
+  if (v == NULL) {
+    v = new std::vector < std::string >();
+    putFieldImpl(cfg, field, v);
+  }
+  v->push_back(element);
 }
 
-std::string expandFormat(std::string format) {
-    if (format == NULL) {
-        return NULL;
+std::string BuildConfig::expandFormat(std::string format) {
+  if (format.empty()) {
+    return "";
+  }
+  if (format.find('%') == std::string::npos) {
+    return format;
+  }
+  std::ostringstream sb;
+  int len = format.size();
+  for (int i=0; i<len; i++) {
+    char ch = format[i];
+    if (ch == '%') {
+      char ch1 = format[i+1];
+      switch (ch1) {
+      case '%':
+	sb << ch1;
+	break;
+      case 'b':
+	sb << build();
+	break;
+      case 'f':
+	sb << flavour();
+	break;
+      default:
+	sb << ch;
+	sb << ch1;
+      }
+      i++;
+    } else {
+      sb << ch;
     }
-
-    if (format.indexOf('%') == -1) {
-        return format;
-    }
-
-    StringBuffer sb = new StringBuffer();
-    int len = format.size()();
-    for (int i=0; i<len; i++) {
-        char ch = format.charAt(i);
-        if (ch == '%') {
-            char ch1 = format.charAt(i+1);
-            switch (ch1) {
-            case '%':
-                sb.append(ch1);
-                break;
-            case 'b':
-                sb.append(build());
-                break;
-            case 'f':
-                sb.append(flavour());
-                break;
-            default:
-                sb.append(ch);
-                sb.append(ch1);
-            }
-            i++;
-        } else {
-            sb.append(ch);
-        }
-    }
-
-    return sb.toString();
-}
+  }
+  return sb.str();
 }
 
-abstract class GenericDebugConfig : public BuildConfig {
-virtual /*abstract*/ std::string getOptFlag();
-
-void init(std::vector < ? > includes, std::vector < ? > defines) {
-    defines->push_back("_DEBUG");
-    defines->push_back("ASSERT");
-
-    super.init(includes, defines);
-
-    getV("CompilerFlags").addAll(getCI().getDebugCompilerFlags(getOptFlag()));
-    getV("LinkerFlags").addAll(getCI().getDebugLinkerFlags());
-   }
+void GenericDebugConfig::init(std::vector < std::string > * includes, std::vector < std::string > * defines) {
+  defines->push_back("_DEBUG");
+  defines->push_back("ASSERT");
+  BuildConfig::init(includes, defines);
+  std::vector < std::string > * compilerFlags = getV("CompilerFlags");
+  std::vector < std::string > debugCompilerFlags = getCI()->getDebugCompilerFlags(getOptFlag());
+  compilerFlags->insert(compilerFlags->begin(), debugCompilerFlags.begin(), debugCompilerFlags.end());
+  std::vector < std::string > * linkerFlags = getV("LinkerFlags");
+  std::vector < std::string > debugLinkerFlags = getCI()->getDebugLinkerFlags();
+  linkerFlags->insert(linkerFlags->begin(), debugLinkerFlags.begin(), debugLinkerFlags.end());
 }
 
-class C1DebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getNoOptFlag();
+std::string C1DebugConfig::getOptFlag() {
+  return getCI()->getNoOptFlag();
 }
 
-C1DebugConfig() {
-    initNames("compiler1", "debug", "fastdebug\\jre\\bin\\client\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+C1DebugConfig::C1DebugConfig() {
+  initNames("compiler1", "debug", "fastdebug\\jre\\bin\\client\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class C1FastDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getOptFlag();
+std::string C1FastDebugConfig::getOptFlag() {
+  return getCI()->getOptFlag();
 }
 
-C1FastDebugConfig() {
-    initNames("compiler1", "fastdebug", "fastdebug\\jre\\bin\\client\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+C1FastDebugConfig::C1FastDebugConfig() {
+  initNames("compiler1", "fastdebug", "fastdebug\\jre\\bin\\client\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class C2DebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getNoOptFlag();
+std::string C2DebugConfig::getOptFlag() {
+  return getCI()->getNoOptFlag();
 }
 
-C2DebugConfig() {
-    initNames("compiler2", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+C2DebugConfig::C2DebugConfig() {
+  initNames("compiler2", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class C2FastDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getOptFlag();
+std::string C2FastDebugConfig::getOptFlag() {
+  return getCI()->getOptFlag();
 }
 
-C2FastDebugConfig() {
-    initNames("compiler2", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+C2FastDebugConfig::C2FastDebugConfig() {
+  initNames("compiler2", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class TieredDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getNoOptFlag();
+std::string TieredDebugConfig::getOptFlag() {
+  return getCI()->getNoOptFlag();
 }
 
-TieredDebugConfig() {
-    initNames("tiered", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+TieredDebugConfig::TieredDebugConfig() {
+  initNames("tiered", "debug", "fastdebug\\jre\\bin\\server\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class TieredFastDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getOptFlag();
+std::string TieredFastDebugConfig::getOptFlag() {
+  return getCI()->getOptFlag();
 }
 
-TieredFastDebugConfig() {
-    initNames("tiered", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+TieredFastDebugConfig::TieredFastDebugConfig() {
+  initNames("tiered", "fastdebug", "fastdebug\\jre\\bin\\server\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
 
-abstract class ProductConfig : public BuildConfig {
-void init(std::vector < ? > includes, std::vector < ? > defines) {
-    defines->push_back("NDEBUG");
-    defines->push_back("PRODUCT");
-
-    super.init(includes, defines);
-
-    getV("CompilerFlags").addAll(getCI().getProductCompilerFlags());
-    getV("LinkerFlags").addAll(getCI().getProductLinkerFlags());
-}
+void ProductConfig::init(std::vector < std::string > * includes, std::vector < std::string > * defines) {
+  defines->push_back("NDEBUG");
+  defines->push_back("PRODUCT");
+  BuildConfig::init(includes, defines);
+  std::vector < std::string > * compilerFlags = getV("CompilerFlags");
+  std::vector < std::string > productCompilerFlags = getCI()->getProductCompilerFlags();
+  compilerFlags->insert(compilerFlags->begin(), productCompilerFlags.begin(), productCompilerFlags.end());
+  std::vector < std::string > * linkerFlags = getV("LinkerFlags");
+  std::vector < std::string > productLinkerFlags = getCI()->getProductLinkerFlags();
+  linkerFlags->insert(linkerFlags->begin(), productLinkerFlags.begin(), productLinkerFlags.end());
 }
 
-class C1ProductConfig : public ProductConfig {
-C1ProductConfig() {
-    initNames("compiler1", "product", "jre\\bin\\client\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+C1ProductConfig::C1ProductConfig() {
+  initNames("compiler1", "product", "jre\\bin\\client\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class C2ProductConfig : public ProductConfig {
-C2ProductConfig() {
-    initNames("compiler2", "product", "jre\\bin\\server\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+C2ProductConfig::C2ProductConfig() {
+  initNames("compiler2", "product", "jre\\bin\\server\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class TieredProductConfig : public ProductConfig {
-TieredProductConfig() {
-    initNames("tiered", "product", "jre\\bin\\server\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+TieredProductConfig::TieredProductConfig() {
+  initNames("tiered", "product", "jre\\bin\\server\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
 
-class CoreDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getNoOptFlag();
+std::string CoreDebugConfig::getOptFlag() {
+  return getCI()->getNoOptFlag();
 }
 
-CoreDebugConfig() {
-    initNames("core", "debug", "fastdebug\\jre\\bin\\core\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+CoreDebugConfig::CoreDebugConfig() {
+  initNames("core", "debug", "fastdebug\\jre\\bin\\core\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
 
-class CoreFastDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getOptFlag();
+std::string CoreFastDebugConfig::getOptFlag() {
+  return getCI()->getOptFlag();
 }
 
-CoreFastDebugConfig() {
-    initNames("core", "fastdebug", "fastdebug\\jre\\bin\\core\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+CoreFastDebugConfig::CoreFastDebugConfig() {
+  initNames("core", "fastdebug", "fastdebug\\jre\\bin\\core\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
 
-class CoreProductConfig : public ProductConfig {
-CoreProductConfig() {
-    initNames("core", "product", "jre\\bin\\core\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+CoreProductConfig::CoreProductConfig() {
+  initNames("core", "product", "jre\\bin\\core\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
-class KernelDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getNoOptFlag();
+std::string KernelDebugConfig::getOptFlag() {
+  return getCI()->getNoOptFlag();
 }
 
-KernelDebugConfig() {
-    initNames("kernel", "debug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+KernelDebugConfig::KernelDebugConfig() {
+  initNames("kernel", "debug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
 
-class KernelFastDebugConfig : public GenericDebugConfig {
-std::string getOptFlag() {
-    return getCI().getOptFlag();
+std::string KernelFastDebugConfig::getOptFlag() {
+  return getCI()->getOptFlag();
 }
 
-KernelFastDebugConfig() {
-    initNames("kernel", "fastdebug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
-    init(getIncludes(), getDefines());
-}
+KernelFastDebugConfig::KernelFastDebugConfig() {
+  initNames("kernel", "fastdebug", "fastdebug\\jre\\bin\\kernel\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
 
 
-class KernelProductConfig : public ProductConfig {
-KernelProductConfig() {
-    initNames("kernel", "product", "jre\\bin\\kernel\\jvm.dll");
-    init(getIncludes(), getDefines());
+KernelProductConfig::KernelProductConfig() {
+  initNames("kernel", "product", "jre\\bin\\kernel\\jvm.dll");
+  init(getIncludes(), getDefines());
 }
-}
-abstract class CompilerInterface {
-virtual /*abstract*/ std::vector < ? > getBaseCompilerFlags(std::vector < ? > defines, std::vector < ? > includes, std::string outDir);
-virtual /*abstract*/ std::vector < ? > getBaseLinkerFlags(std::string outDir, std::string outDll);
-virtual /*abstract*/ std::vector < ? > getDebugCompilerFlags(std::string opt);
-virtual /*abstract*/ std::vector < ? > getDebugLinkerFlags();
-virtual /*abstract*/ std::vector < ? > getProductCompilerFlags();
-virtual /*abstract*/ std::vector < ? > getProductLinkerFlags();
-virtual /*abstract*/ std::string getOptFlag();
-virtual /*abstract*/ std::string getNoOptFlag();
-virtual /*abstract*/ std::string makeCfgName(std::string flavourBuild);
 
-void addAttr(std::vector < ? > receiver, std::string attr, std::string value) {
-    receiver->push_back(attr); receiver->push_back(value);
-}
-}
+
--- a/src/share/tools/MakeDeps/BuildConfig.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/BuildConfig.h	Wed Oct 07 14:38:00 2009 -0700
@@ -26,79 +26,97 @@
 #define _MAKEDEPS_BUILD_CONFIG_H_
 
 #include <vector>
+#include <map>
+
+class Database;
+class DirectoryTree;
+class WinGammaPlatform;
+
+/* abstract */ class CompilerInterface {
+ public:
+    virtual /* abstract */ std::vector < std::string > getBaseCompilerFlags(std::vector < std::string > defines, std::vector < std::string > includes, std::string outDir) = 0;
+    virtual /* abstract */ std::vector < std::string > getBaseLinkerFlags(std::string outDir, std::string outDll) = 0;
+    virtual /* abstract */ std::vector < std::string > getDebugCompilerFlags(std::string opt) = 0;
+    virtual /* abstract */ std::vector < std::string > getDebugLinkerFlags() = 0;
+    virtual /* abstract */ std::vector < std::string > getProductCompilerFlags() = 0;
+    virtual /* abstract */ std::vector < std::string > getProductLinkerFlags() = 0;
+    virtual /* abstract */ std::string getOptFlag() = 0;
+    virtual /* abstract */ std::string getNoOptFlag() = 0;
+    virtual /* abstract */ std::string makeCfgName(std::string flavourBuild) = 0;
+
+    void addAttr(std::vector < std::string > * receiver, std::string attr, std::string value) ;
+};
 
 class BuildConfig {
-    Hashtable vars;
-    std::vector < ? > basicNames, basicPaths;
+    std::map < std::string, void * > vars;
     std::vector < std::string > context;
 
-    static CompilerInterface ci;
-    static CompilerInterface getCI() ;
+    static CompilerInterface * ci;
+    protected: static CompilerInterface * getCI() ;
 
     protected: void initNames(std::string flavour, std::string build, std::string outDll) ;
 
-    protected: void init(std::vector < ? > includes, std::vector < ? > defines) ;
+    protected: void init(std::vector < std::string > * includes, std::vector < std::string > * defines) ;
 
-
-    protected: void initDefaultCompilerFlags(std::vector < ? > includes) ;
+    protected: void initDefaultCompilerFlags(std::vector < std::string > includes) ;
 
     protected: void initDefaultLinkerFlags() ;
 
-    DirectoryTree getSourceTree(std::string sourceBase, std::string startAt) ;
+    DirectoryTree * getSourceTree(std::string sourceBase, std::string startAt) ;
 
-
-    std::vector < ? > getPreferredPaths(Database currentDB) ;
+    std::vector < std::string > * getPreferredPaths(Database * currentDB) ;
 
     void handleDB(std::string dbFile) ;
 
+    void addAll(std::vector< std::string > * vector, 
+		std::map < std::string , std::string > * hash,
+                WinGammaPlatform * platform, DirectoryTree * tree,
+                std::vector < std::string > * preferredPaths,
+		std::vector < std::string > * filesNotFound, 
+		std::vector < std::string > * filesDuplicate) ;
 
-    void addAll(std::vector < ? >::iterator i, Hashtable hash,
-                WinGammaPlatform platform, DirectoryTree tree,
-                std::vector < ? > preferredPaths, std::vector < ? > filesNotFound, std::vector < ? > filesDuplicate) ;
+    void addTo(std::map < std::string , std::string > * ht,
+	       std::string key, std::string value) ;
 
-    void addTo(Hashtable ht, std::string key, std::string value) ;
+    std::map < std::string , std::string > * computeAllFiles(WinGammaPlatform * platform, Database * db) ;
 
-    Hashtable computeAllFiles(WinGammaPlatform platform, Database db) ;
+    void initDefaultDefines(std::vector < std::string > defines) ;
 
-    void initDefaultDefines(std::vector < ? > defines) ;
-
+ public:
     std::string get(std::string key) ;
 
-    std::vector < ? > getV(std::string key) ;
+    std::vector < std::string > * getV(std::string key) ;
 
-    Object getO(std::string key) ;
+    void * getO(std::string key) ;
 
-    Hashtable getH(std::string key) ;
+    void * getFieldInContext(std::string field) ;
 
-    Object getFieldInContext(std::string field) ;
-
-    Object lookupHashFieldInContext(std::string field, std::string key) ;
+    void * lookupHashFieldInContext(std::string field, std::string key) ;
 
     void put(std::string key, std::string value) ;
 
-    void put(std::string key, std::vector < ? > vvalue) ;
+    void put(std::string key, std::vector < std::string > * vvalue) ;
 
-    void add(std::string key, std::vector < ? > vvalue) ;
+    void add(std::string key, std::vector < std::string > * vvalue) ;
 
     std::string flavour() ;
 
     std::string build() ;
 
-    Object getSpecificField(std::string field) ;
+    void * getSpecificField(std::string field) ;
 
-    void putSpecificField(std::string field, Object value) ;
+    void putSpecificField(std::string field, void * value) ;
 
-    void collectRelevantVectors(std::vector < ? > rv, std::string field) ;
+    void collectRelevantVectors(std::vector < std::string > * rv, std::string field) ;
 
-    void collectRelevantHashes(Hashtable rv, std::string field) ;
+    void collectRelevantHashes(std::map < std::string, std::string > * rv, std::string field) ;
 
+    std::vector < std::string > * getDefines() ;
 
-    std::vector < ? > getDefines() ;
+    std::vector < std::string > * getIncludes() ;
 
-    std::vector < ? > getIncludes() ;
-
-    static Hashtable cfgData = new Hashtable();
-    static Hashtable globalData = new Hashtable();
+    static std::map < std::string , std::map < std::string , void * > * > cfgData;
+    static std::map < std::string , void * > globalData;
 
     static bool appliesToTieredBuild(std::string cfg) ;
 
@@ -108,136 +126,126 @@
 
     static std::string getTieredBuildCfg(std::string cfg) ;
 
-    static Object getField(std::string cfg, std::string field) ;
+    public: static void * getField(std::string cfg, std::string field) ;
 
-    static std::string getFieldString(std::string cfg, std::string field) ;
+    public: static std::string getFieldString(std::string cfg, std::string field) ;
 
-    static std::vector < ? > getFieldVector(std::string cfg, std::string field) ;
+    static std::vector < std::string > * getFieldVector(std::string cfg, std::string field) ;
 
-    static void putField(std::string cfg, std::string field, Object value) ;
+    public: static void putField(std::string cfg, std::string field, void * value) ;
 
-    private: static void putFieldImpl(std::string cfg, std::string field, Object value) ;
+    private: static void putFieldImpl(std::string cfg, std::string field, void * value) ;
 
-    static Object getFieldHash(std::string cfg, std::string field, std::string name) ;
+    static void * getFieldHash(std::string cfg, std::string field, std::string name) ;
 
-    static void putFieldHash(std::string cfg, std::string field, std::string name, Object val) ;
+    public: static void putFieldHash(std::string cfg, std::string field, std::string name, void * val) ;
 
-    private: static void putFieldHashImpl(std::string cfg, std::string field, std::string name, Object val) ;
+    private: static void putFieldHashImpl(std::string cfg, std::string field, std::string name, void * val) ;
 
-    static void addFieldVector(std::string cfg, std::string field, std::string element) ;
+    public: static void addFieldVector(std::string cfg, std::string field, std::string element) ;
 
     private: static void addFieldVectorImpl(std::string cfg, std::string field, std::string element) ;
 
-    std::string expandFormat(std::string format) ;
+    public: std::string expandFormat(std::string format) ;
 };
 
-abstract class GenericDebugConfig : public BuildConfig {
-    virtual /*abstract*/ std::string getOptFlag();
-
-    protected: void init(std::vector < ? > includes, std::vector < ? > defines) ;
+/* abstract */ class GenericDebugConfig : public BuildConfig {
+    virtual /*abstract*/ std::string getOptFlag() = 0;
+    protected: void init(std::vector < std::string > * includes, std::vector < std::string > * defines) ;
 };
 
 class C1DebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     C1DebugConfig() ;
 };
 
 class C1FastDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     C1FastDebugConfig() ;
 };
 
 class C2DebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     C2DebugConfig() ;
 };
 
 class C2FastDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     C2FastDebugConfig() ;
 };
 
 class TieredDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     TieredDebugConfig() ;
 };
 
 class TieredFastDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     TieredFastDebugConfig() ;
 };
 
 
-abstract class ProductConfig : public BuildConfig {
-    protected: void init(std::vector < ? > includes, std::vector < ? > defines) ;
+/* abstract */ class ProductConfig : public BuildConfig {
+    protected: void init(std::vector < std::string > * includes, std::vector < std::string > * defines) ;
 };
 
 class C1ProductConfig : public ProductConfig {
+ public:
     C1ProductConfig() ;
 };
 
 class C2ProductConfig : public ProductConfig {
+ public:
     C2ProductConfig() ;
 };
 
 class TieredProductConfig : public ProductConfig {
+ public:
     TieredProductConfig() ;
 };
 
 
 class CoreDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     CoreDebugConfig() ;
 };
 
 
 class CoreFastDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     CoreFastDebugConfig() ;
 };
 
 
 class CoreProductConfig : public ProductConfig {
+ public:
     CoreProductConfig() ;
 };
 
 class KernelDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     KernelDebugConfig() ;
 };
 
 
 class KernelFastDebugConfig : public GenericDebugConfig {
+ public:
     std::string getOptFlag() ;
-
     KernelFastDebugConfig() ;
 };
 
 
 class KernelProductConfig : public ProductConfig {
-    KernelProductConfig() ;
-};
-abstract class CompilerInterface {
-    virtual /*abstract*/ std::vector < ? > getBaseCompilerFlags(std::vector < ? > defines, std::vector < ? > includes, std::string outDir);
-    virtual /*abstract*/ std::vector < ? > getBaseLinkerFlags(std::string outDir, std::string outDll);
-    virtual /*abstract*/ std::vector < ? > getDebugCompilerFlags(std::string opt);
-    virtual /*abstract*/ std::vector < ? > getDebugLinkerFlags();
-    virtual /*abstract*/ std::vector < ? > getProductCompilerFlags();
-    virtual /*abstract*/ std::vector < ? > getProductLinkerFlags();
-    virtual /*abstract*/ std::string getOptFlag();
-    virtual /*abstract*/ std::string getNoOptFlag();
-    virtual /*abstract*/ std::string makeCfgName(std::string flavourBuild);
-
-    void addAttr(std::vector < ? > receiver, std::string attr, std::string value) ;
+public:     KernelProductConfig() ;
 };
 
 #endif // _MAKEDEPS_BUILD_CONFIG_H_
--- a/src/share/tools/MakeDeps/DirectoryTree.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/DirectoryTree.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -26,25 +26,67 @@
 querying of full paths for unique filenames in the hierarchy. */
 
 #include "DirectoryTree.h"
+#include "Util.h"
 #include <string>
 #include <vector>
+#include <sys/stat.h>
+#include <cstdlib>
+#include <dirent.h>
+#include <libgen.h>
+#include <sstream>
+#include <iostream>
 
-class DirectoryTree {
+/** file must be a canonical file */
+DirectoryTree::Node::Node(std::string file) {
+    this->file = file;
+}
 
-/** The root of the read directoryTree */
-Node rootNode;
+bool DirectoryTree::Node::isFile() {
+    struct stat sstat;
+    stat(file.c_str(), &sstat);
+    return S_ISREG(sstat.st_mode);
+}
 
-/** Subdirs to ignore; std::vector < ? > of Strings */
-std::vector < ? > subdirsToIgnore;
+bool DirectoryTree::Node::isDirectory() {
+    struct stat sstat;
+    stat(file.c_str(), &sstat);
+    return S_ISDIR(sstat.st_mode);
+}
 
-/** This maps file names to Lists of nodes. */
-Hashtable nameToNodeListTable;
+std::string DirectoryTree::Node::getName() {
+  char result[file.size()];
+  strcpy(result, file.c_str());
+  return basename(result); // file->getPath());
+}
 
-/** Output "."'s as directories are read. Defaults to false. */
-bool verbose;
+std::string DirectoryTree::Node::getParent() {
+  char result[file.size()];
+  strcpy(result, file.c_str());
+  return dirname(result); // file->getParent();
+}
 
-DirectoryTree() {
-    subdirsToIgnore = new std::vector < ? >();
+void DirectoryTree::Node::addChild(Node * n) {
+    children.push_back(n);
+}
+
+std::vector < DirectoryTreeNode* >::iterator DirectoryTree::Node::getChildrenStart() throw (IllegalArgumentException) {
+    return children.begin();
+}
+
+std::vector < DirectoryTreeNode* >::iterator DirectoryTree::Node::getChildrenEnd() throw (IllegalArgumentException) {
+    return children.end();
+}
+
+int DirectoryTree::Node::getNumChildren() throw (IllegalArgumentException) {
+    return children.size();
+}
+
+DirectoryTreeNode * DirectoryTree::Node::getChild(int i)
+throw (IllegalArgumentException, ArrayIndexOutOfBoundsException) {
+    return (DirectoryTreeNode*) children[i];
+}
+
+DirectoryTree::DirectoryTree() {
     verbose = false;
 }
 
@@ -52,48 +94,51 @@
     DirectoryTree. Throws IllegalArgumentException if the given
     string represents a plain file or nonexistent directory. */
 
-DirectoryTree(std::string baseDirectory) {
-    this();
+DirectoryTree::DirectoryTree(std::string baseDirectory) {
+    verbose = false;
     readDirectory(baseDirectory);
 }
 
-void addSubdirToIgnore(std::string subdir) {
-    subdirsToIgnore->push_back(subdir);
+void DirectoryTree::addSubdirToIgnore(std::string subdir) {
+    subdirsToIgnore.push_back(subdir);
 }
 
 /** Output "."'s to std::cout as directories are read. Defaults
     to false. */
-void setVerbose(bool newValue) {
+void DirectoryTree::setVerbose(bool newValue) {
     verbose = newValue;
 }
 
-bool getVerbose() {
+bool DirectoryTree::getVerbose() {
     return verbose;
 }
 
-std::string getRootNodeName() {
-    return rootNode.getName();
+std::string DirectoryTree::getRootNodeName() {
+    return rootNode->getName();
 }
 
 /** Takes an absolute path to the root directory of this
     DirectoryTree. Throws IllegalArgumentException if the given
     string represents a plain file or nonexistent directory. */
 
-void readDirectory(std::string baseDirectory)
-    throw (IllegalArgumentException {
-    File root = new File(baseDirectory);
-    if (!root.isDirectory()) {
-        throw IllegalArgumentException("baseDirectory \"" +
-                                           baseDirectory +
-                                           "\" does not exist or " +
-                                           "is not a directory");
+void DirectoryTree::readDirectory(std::string baseDirectory) throw (IllegalArgumentException) {
+    std::string root = baseDirectory;
+    struct stat sstat;
+    stat(root.c_str(), &sstat);
+    bool isDirectory = S_ISDIR(sstat.st_mode);
+    if (!isDirectory) {
+        std::ostringstream message;
+        message << "baseDirectory \"" << baseDirectory 
+                << "\" does not exist or " << "is not a directory";
+        throw new IllegalArgumentException(message.str());
     }
-    try {
-        root = root.getCanonicalFile();
+    char path[PATH_MAX];
+    if (realpath(root.c_str(), path) == NULL) {
+        std::ostringstream message;
+        message << "bad path: " << root;
+        throw new RuntimeException(message.str());
     }
-    catch (IOException e) {
-        throw RuntimeException(e.toString());
-    }
+    root = path;
     rootNode = new Node(root);
     readDirectory(rootNode, root);
 }
@@ -105,73 +150,69 @@
     the files or directories of this name in the DirectoryTree.
     Returns NULL if the directory tree has not been read from disk
     yet or if the file was not found in the tree. */
-List findFile(std::string name) {
+std::vector < DirectoryTreeNode *> DirectoryTree::findFile(std::string name) {
     if (rootNode == NULL) {
-        return NULL;
+        std::vector < DirectoryTreeNode *> empty;
+        return empty;
     }
-
-    if (nameToNodeListTable == NULL) {
-        nameToNodeListTable = new Hashtable();
+    if (nameToNodeListTable.empty()) {
         try {
             buildNameToNodeListTable(rootNode);
         } catch (IOException e) {
-            e << StackTrace();
-            return NULL;
+            std::cerr << e.getMessage();
+            std::vector < DirectoryTreeNode *> empty;
+            return empty;
         }
     }
-
-    return (List) nameToNodeListTable.get(name);
+    std::map < std::string, std::vector < DirectoryTreeNode * > >::iterator iter = nameToNodeListTable.find(name);
+    if (iter == nameToNodeListTable.end()) {
+        std::vector < DirectoryTreeNode *> empty;
+        return empty;
+    }
+    return iter->second;
 }
 
-void buildNameToNodeListTable(Node curNode)
-  throw (IOException {
-    std::string fullName = curNode.getName();
-    std::string parent = curNode.getParent();
-    std::string separator = getenv("file.separator");
-
-    if (parent != NULL) {
-      if (!fullName.startsWith(parent)) {
-        throw RuntimeException(
-            "Internal error: parent of file name \"" + fullName +
-            "\" does not match file name \"" + parent + "\""
-        );
+void DirectoryTree::buildNameToNodeListTable(Node * curNode)
+  throw (IOException) {
+    std::string fullName = curNode->getName();
+    std::string parent = curNode->getParent();
+    std::string separator = "/";
+    if (!parent.empty()) {
+      if (!startsWith(fullName, parent)) {
+        std::ostringstream message;
+        message << "Internal error: parent of file name \"" << fullName
+		<< "\" does not match file name \"" << parent << "\"";
+        throw new RuntimeException(message.str());
       }
-
-      int len = parent.size()();
-      if (!parent.endsWith(separator)) {
-        len += separator.size()();
+      int len = parent.size();
+      if (!endsWith(parent, separator)) {
+        len += separator.size();
       }
-
-      std::string fileName = fullName.substring(len);
-
-      if (fileName == NULL) {
-        throw RuntimeException(
+      std::string fileName = fullName.substr((size_t)0, (size_t)len);
+      if (fileName.empty()) {
+        throw new RuntimeException(
             "Internal error: file name was empty"
         );
       }
-
-      List nodeList = (List) nameToNodeListTable.get(fileName);
-      if (nodeList == NULL) {
-        nodeList = new std::vector < ? >();
-        nameToNodeListTable.put(fileName, nodeList);
+      std::map < std::string, std::vector < DirectoryTreeNode * > >::iterator iter = nameToNodeListTable.find(fileName);
+      if (iter == nameToNodeListTable.end()) {
+        std::vector < DirectoryTreeNode * > empty;
+        nameToNodeListTable[fileName] = empty;
       }
-
-      nodeList->push_back(curNode);
+      nameToNodeListTable[fileName].push_back(curNode);
     } else {
       if (curNode != rootNode) {
-        throw RuntimeException(
-            "Internal error: parent of file + \"" + fullName + "\"" +
-            " was NULL"
-        );
+        std::ostringstream message;
+        message << "Internal error: parent of file + \""
+		<< fullName << "\"" << " was NULL";
+        throw new RuntimeException(message.str());
       }
     }
-
-    if (curNode.isDirectory()) {
-      std::vector < ? >::iterator iter = curNode.getChildren();
-      if (iter != NULL) {
-        while (iter != ?->end()) {
-          buildNameToNodeListTable((Node) iter.next());
-        }
+    if (curNode->isDirectory()) {
+      std::vector < DirectoryTreeNode* >::iterator iter = curNode->getChildrenStart();
+      std::vector < DirectoryTreeNode* >::iterator end = curNode->getChildrenEnd();
+      while (iter != end) {
+        buildNameToNodeListTable((Node*)*iter++);
       }
     }
 }
@@ -180,79 +221,38 @@
     children of the directory tree node. Requires that the passed
     node represents a directory. */
 
-void readDirectory(Node parentNode, File parentDir) {
-    File[] children = parentDir.listFiles();
-    if (children == NULL)
-        return;
-    if (verbose) {
-        std::cout << (".");
+void DirectoryTree::readDirectory(Node * parentNode, std::string parentDir) {
+    DIR * dirp = opendir(parentDir.c_str());
+    struct dirent * dirent = readdir(dirp);
+    if ((dirent != NULL) && verbose) {
+        std::cout << ".";
         std::cout.flush();
     }
-    for (int i = 0; i < children.size(); i++) {
-        File child = children[i];
-        children[i] = NULL;
-        bool isDir = child.isDirectory();
-        bool mustSkip = false;
-        if (isDir) {
-            for (std::vector < ? >::iterator iter = subdirsToIgnore->begin();
-                 iter != ?->end(); ) {
-                if (child.getName() == (std::string) iter.next())) {
-                    mustSkip = true;
-                    break;
-                }
-            }
+    while (dirent != NULL) {
+      std::string child = dirent->d_name;
+      struct stat sstat;
+      stat(child.c_str(), &sstat);
+      bool isDir = S_ISDIR(sstat.st_mode);
+      bool mustSkip = false;
+      if (isDir) {
+        for (std::vector < std::string >::iterator iter = subdirsToIgnore.begin() ; iter != subdirsToIgnore.end() ; iter++) {
+          if (child == *iter) {
+            mustSkip = true;
+            break;
+          }
         }
-        if (!mustSkip) {
-            Node childNode = new Node(child);
-            parentNode.addChild(childNode);
-            if (isDir) {
-                readDirectory(childNode, child);
-            }
-        }
+      }
+      if (!mustSkip) {
+        Node * childNode = new Node(child);
+        parentNode->addChild(childNode);
+	if (isDir) {
+	  readDirectory(childNode, child);
+	}
+      }
+      dirent = readdir(dirp);
     }
+    closedir(dirp);
 }
 
-class Node implements DirectoryTreeNode {
-    File file;
-    std::vector < ? > children;
 
-    /** file must be a canonical file */
-    Node(File file) {
-        this->file = file;
-        children = new std::vector < ? >();
-    }
 
-    bool isFile() {
-        return file.isFile();
-    }
-
-    bool isDirectory() {
-        return file.isDirectory();
-    }
-
-    std::string getName() {
-        return file.getPath();
-    }
-
-    std::string getParent() {
-        return file.getParent();
-    }
-
-    void addChild(Node n) {
-        children->push_back(n);
-    }
-
-    std::vector < ? >::iterator getChildren() throw (IllegalArgumentException {
-        return children->begin();
-    }
-
-    int getNumChildren() throw (IllegalArgumentException {
-        return children.size();
-    }
-
-    DirectoryTreeNode getChild(int i)
-        throw (IllegalArgumentException, ArrayIndexOutOfBoundsException {
-        return (DirectoryTreeNode) children.get(i);
-    }
-}
-}
--- a/src/share/tools/MakeDeps/DirectoryTree.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/DirectoryTree.h	Wed Oct 07 14:38:00 2009 -0700
@@ -30,17 +30,46 @@
 
 #include <string>
 #include <vector>
+#include <map>
+#include "DirectoryTreeNode.h"
 
 class DirectoryTree {
 
+    private: class Node : public DirectoryTreeNode {
+        private: std::string file;
+        private: std::vector < DirectoryTreeNode* > children;
+
+        /** file must be a canonical file */
+        public: Node(std::string file) ;
+
+        public: bool isFile() ;
+
+        public: bool isDirectory() ;
+
+        public: std::string getName() ;
+
+        public: std::string getParent() ;
+
+        public: void addChild(Node * n) ;
+
+        public: std::vector < DirectoryTreeNode* >::iterator getChildrenStart() throw (IllegalArgumentException) ;
+
+        public: std::vector < DirectoryTreeNode* >::iterator getChildrenEnd() throw (IllegalArgumentException) ;
+
+        public: int getNumChildren() throw (IllegalArgumentException) ;
+
+        public: DirectoryTreeNode* getChild(int i)
+            throw (IllegalArgumentException, ArrayIndexOutOfBoundsException) ;
+    };
+
     /** The root of the read directoryTree */
-    private: Node rootNode;
+    private: Node * rootNode;
 
-    /** Subdirs to ignore; std::vector < ? > of Strings */
-    private: std::vector < ? > subdirsToIgnore;
+    /** Subdirs to ignore; std::vector < std::string > of Strings */
+    private: std::vector < std::string > subdirsToIgnore;
 
     /** This maps file names to Lists of nodes. */
-    private: Hashtable nameToNodeListTable;
+    private: std::map < std::string, std::vector < DirectoryTreeNode* > > nameToNodeListTable;
 
     /** Output "."'s as directories are read. Defaults to false. */
     private: bool verbose;
@@ -77,41 +106,17 @@
         the files or directories of this name in the DirectoryTree.
         Returns null if the directory tree has not been read from disk
         yet or if the file was not found in the tree. */
-    public: List findFile(std::string name) ;
+    public: std::vector < DirectoryTreeNode * > findFile(std::string name) ;
 
-    private: void buildNameToNodeListTable(Node curNode)
+    private: void buildNameToNodeListTable(Node * curNode)
       throw (IOException) ;
 
     /** Reads all of the files in the given directory and adds them as
         children of the directory tree node. Requires that the passed
         node represents a directory. */
 
-    private: void readDirectory(Node parentNode, File parentDir) ;
+    private: void readDirectory(Node * parentNode, std::string parentDir) ;
 
-    private: class Node implements DirectoryTreeNode {
-        private: File file;
-        private: std::vector < ? > children;
-
-        /** file must be a canonical file */
-        Node(File file) ;
-
-        public: bool isFile() ;
-
-        public: bool isDirectory() ;
-
-        public: std::string getName() ;
-
-        public: std::string getParent() ;
-
-        public: void addChild(Node n) ;
-
-        public: std::vector < ? >::iterator getChildren() throw (IllegalArgumentException) ;
-
-        public: int getNumChildren() throw (IllegalArgumentException) ;
-
-        public: DirectoryTreeNode getChild(int i)
-            throw (IllegalArgumentException, ArrayIndexOutOfBoundsException) ;
-    }
 };
 
 #endif // _MAKEDEPS_DIRECTORY_TREE_H_
--- a/src/share/tools/MakeDeps/DirectoryTreeNode.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/DirectoryTreeNode.h	Wed Oct 07 14:38:00 2009 -0700
@@ -26,15 +26,17 @@
 #define _MAKEDEPS_DIRECTORY_TREE_NODE_H_
 
 #include <vector>
+#include "Exceptions.h"
 
 /*interface*/ class DirectoryTreeNode {
     public: virtual bool isFile() = 0;
     public: virtual bool isDirectory() = 0;
     public: virtual std::string getName() = 0;
     public: virtual std::string getParent() = 0;
-    public: virtual std::vector < ? >::iterator getChildren() throw (IllegalArgumentException) = 0;
+    public: virtual std::vector < DirectoryTreeNode* >::iterator getChildrenStart() throw (IllegalArgumentException) = 0;
+    public: virtual std::vector < DirectoryTreeNode* >::iterator getChildrenEnd() throw (IllegalArgumentException) = 0;
     public: virtual int getNumChildren() throw (IllegalArgumentException) = 0;
-    public: virtual DirectoryTreeNode getChild(int i)
+    public: virtual DirectoryTreeNode* getChild(int i)
         throw (IllegalArgumentException, ArrayIndexOutOfBoundsException) = 0;
 };
 
--- a/src/share/tools/MakeDeps/Exceptions.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/Exceptions.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -83,3 +83,14 @@
 {
 }
 
+// ArrayIndexOutOfBoundsException
+
+ArrayIndexOutOfBoundsException::ArrayIndexOutOfBoundsException() : RuntimeException()
+{
+}
+
+ArrayIndexOutOfBoundsException::ArrayIndexOutOfBoundsException(std::string message)
+	: RuntimeException(message)
+{
+}
+
--- a/src/share/tools/MakeDeps/Exceptions.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/Exceptions.h	Wed Oct 07 14:38:00 2009 -0700
@@ -55,4 +55,10 @@
 	NullPointerException(std::string message);
 };
 
+class ArrayIndexOutOfBoundsException : public RuntimeException {
+public:
+	ArrayIndexOutOfBoundsException();
+	ArrayIndexOutOfBoundsException(std::string message);
+};
+
 #endif // _MAKEDEPS_EXCEPTIONS_H_
--- a/src/share/tools/MakeDeps/FileList.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/FileList.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -34,243 +34,243 @@
 #include <sstream>
 
 /** This class implements the java.util.List interface as well as
-providing functionality specific to keeping track of lists of
-files. See the documentation for the Database class to see how
-these are used. Each FileList must only contain other FileLists
-(although that is not currently enforced in the mutators). */
+    providing functionality specific to keeping track of lists of
+    files. See the documentation for the Database class to see how
+    these are used. Each FileList must only contain other FileLists
+    (although that is not currently enforced in the mutators). */
 
 FileList::FileList(std::string n, Platform * plat) {
-    this->plat = plat;
-    beenHere = mayBeCycle = isCycle = false;
-    platformDependentInclude = "";
-    name = n;
-    count = 0;
-    useGrandInclude = plat->haveGrandInclude();
+  this->plat = plat;
+  beenHere = mayBeCycle = isCycle = false;
+  platformDependentInclude = "";
+  name = n;
+  count = 0;
+  useGrandInclude = plat->haveGrandInclude();
 }
 
 // Necessary accessors
 std::string FileList::getName() {
-    return name;
+  return name;
 }
 
 void FileList::setPlatformDependentInclude(std::string arg) {
-    platformDependentInclude = arg;
+  platformDependentInclude = arg;
 }
 
 std::string FileList::getPlatformDependentInclude() {
-    return platformDependentInclude;
+  return platformDependentInclude;
 }
 
 bool FileList::getUseGrandInclude() {
-    return useGrandInclude;
+  return useGrandInclude;
 }
 
 void FileList::setUseGrandInclude(bool arg) {
-    useGrandInclude = arg;
+  useGrandInclude = arg;
 }
 
 void FileList::incrementCount() {
-    count++;
+  count++;
 }
 
 int FileList::getCount() {
-    return count;
+  return count;
 }
 
 FileList * FileList::listForFile(std::string fileName) {
-    for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
-        FileList * fl = *iter;
-        if (plat->fileNameStringEquality(fl->name, fileName)) {
-            plat->fileNamePortabilityCheck(fl->name, fileName);
-            return fl;
-        }
+  for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
+    FileList * fl = *iter;
+    if (plat->fileNameStringEquality(fl->name, fileName)) {
+      plat->fileNamePortabilityCheck(fl->name, fileName);
+      return fl;
     }
-    plat->fileNamePortabilityCheck(fileName);
-    FileList * newList = new FileList(fileName, plat);
-    push_back(newList);
-    return newList;
+  }
+  plat->fileNamePortabilityCheck(fileName);
+  FileList * newList = new FileList(fileName, plat);
+  push_back(newList);
+  return newList;
 }
 
 bool FileList::hasListForFile(std::string fileName) {
-    for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
-        FileList * fl = *iter;
-        if (plat->fileNameStringEquality(fl->name, fileName)) {
-            plat->fileNamePortabilityCheck(fl->name, fileName);
-            return true;
-        }
+  for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
+    FileList * fl = *iter;
+    if (plat->fileNameStringEquality(fl->name, fileName)) {
+      plat->fileNamePortabilityCheck(fl->name, fileName);
+      return true;
     }
-    return false;
+  }
+  return false;
 }
 
 bool FileList::compareLists(FileList * s) {
-    std::vector < FileList* >::iterator myIter = begin();
-    std::vector < FileList* >::iterator hisIter = s->begin();
+  std::vector < FileList* >::iterator myIter = begin();
+  std::vector < FileList* >::iterator hisIter = s->begin();
 
-    while (myIter != end() &&
-           hisIter != s->end()) {
-        // crude: order dependent
-        FileList * myElement = *myIter;
-        FileList * hisElement = *hisIter;
-        if (!plat->fileNameStringEquality(myElement->name,
-                                         hisElement->name)) {
-            return false;
-        }
-        myIter++;
-        hisIter++;
+  while (myIter != end() &&
+	 hisIter != s->end()) {
+    // crude: order dependent
+    FileList * myElement = *myIter;
+    FileList * hisElement = *hisIter;
+    if (!plat->fileNameStringEquality(myElement->name,
+				      hisElement->name)) {
+      return false;
     }
+    myIter++;
+    hisIter++;
+  }
 
-    if ((myIter != end()) != (hisIter != s->end())) {
-        // One ended earlier
-        return false;
-    }
+  if ((myIter != end()) != (hisIter != s->end())) {
+    // One ended earlier
+    return false;
+  }
 
-    return true;
+  return true;
 }
 
 void FileList::addIfAbsent(FileList * s) {
-    for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
-        if (*iter == s) {
-            return;
-        }
+  for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
+    if (*iter == s) {
+      return;
     }
-    push_back(s);
+  }
+  push_back(s);
 }
 
-bool comparison(FileList * a, FileList * b) {
-	return (a->getName() < b->getName());
+bool comparison(FileList * fl1, FileList * fl2) {
+  return (fl1->getName() < fl2->getName());
 }
 
 void FileList::sortByName() {
-	std::sort(begin(), end(), &comparison);
+  std::sort(begin(), end(), &comparison);
 }
 
 void FileList::setFirstFile(FileList * s) {
   std::vector < FileList* >::iterator iter = begin();
-   	// insert at the front
-   	iter = insert(iter,s);
-   	// then skip over it and check for any already existing
-   	iter++;
-   	while (iter != end()) {
-   		if (s == *iter) {
-   			iter = erase(iter);
-   			break; // java.util.Vector.remove() only removes first occurance
-   		}
-   		else {
-   			iter++;
-   		}
-   	}
+  // insert at the front
+  iter = insert(iter,s);
+  // then skip over it and check for any already existing
+  iter++;
+  while (iter != end()) {
+    if (s == *iter) {
+      iter = erase(iter);
+      break; // java.util.Vector.remove() only removes first occurance
+    }
+    else {
+      iter++;
+    }
+  }
 }
 
 void FileList::setLastFile(FileList * s) {
   std::vector < FileList* >::iterator iter;
-   	// Remove the file list if it's already here
-   	iter = begin();
-   	while (iter != end()) {
-   		if (s == *iter) {
-   			iter = erase(iter);
-   			break; // java.util.Vector.remove() only removes first occurance
-   		} else {
-   			iter++;
-   		}   		
-   	}
-    // insert it at the back
-    push_back(s);
+  // Remove the file list if it's already here
+  iter = begin();
+  while (iter != end()) {
+    if (s == *iter) {
+      iter = erase(iter);
+      break; // java.util.Vector.remove() only removes first occurance
+    } else {
+      iter++;
+    }   		
+  }
+  // insert it at the back
+  push_back(s);
 }
 
 bool FileList::doFiles(FileList * s) {
-    bool result = true;
-    for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
-        FileList * h = *iter;
-        if (h->platformDependentInclude != "") {
-            std::cerr << "Error: the source for "
-					  << h->platformDependentInclude
-					  << " is " << h->name << "." << std::endl;
-            std::cerr << "\tIt shouldn't be included directly by "
-					  << name << "." << std::endl;
-            h->platformDependentInclude = ""; // report once per file
-            result = false;
-        }
-        h->doHFile(s);
+  bool result = true;
+  for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
+    FileList * h = *iter;
+    if (h->platformDependentInclude != "") {
+      std::cerr << "Error: the source for "
+		<< h->platformDependentInclude
+		<< " is " << h->name << "." << std::endl;
+      std::cerr << "\tIt shouldn't be included directly by "
+		<< name << "." << std::endl;
+      h->platformDependentInclude = ""; // report once per file
+      result = false;
     }
-    return result;
+    h->doHFile(s);
+  }
+  return result;
 }
 
 void FileList::traceCycle(FileList * s) {
-    if (isCycle) // already traced
-        return;
-    isCycle = true;
-    std::cerr << "\ttracing cycle for " << name << std::endl;
-    // FIXME: must return status in caller routine
-    // exitCode = 1;
-    for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
-        FileList * q = *iter;
-        if (q->mayBeCycle) {
-            if (s == q) {
-				std::ostringstream errorMessage;
-				errorMessage << "\tend of cycle for " << s->getName();
-                plat->fatalError(errorMessage.str());
-            } else {
-                q->traceCycle(s);
-            }
-        }
+  if (isCycle) // already traced
+    return;
+  isCycle = true;
+  std::cerr << "\ttracing cycle for " << name << std::endl;
+  // FIXME: must return status in caller routine
+  // exitCode = 1;
+  for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
+    FileList * q = *iter;
+    if (q->mayBeCycle) {
+      if (s == q) {
+	std::ostringstream errorMessage;
+	errorMessage << "\tend of cycle for " << s->getName();
+	plat->fatalError(errorMessage.str());
+      } else {
+	q->traceCycle(s);
+      }
     }
+  }
 }
 
 void FileList::doHFile(FileList * s) {
-    if (beenHere) {
-        if (mayBeCycle) {
-            traceCycle(this);
-        }
-        return;
+  if (beenHere) {
+    if (mayBeCycle) {
+      traceCycle(this);
     }
-    beenHere = true;
-    mayBeCycle = true;
-    doFiles(s);
-    mayBeCycle = false;
-    s->push_back(this);
+    return;
+  }
+  beenHere = true;
+  mayBeCycle = true;
+  doFiles(s);
+  mayBeCycle = false;
+  s->push_back(this);
 }
 
 FileList * FileList::doCFile() {
-    FileList * s = new FileList(name, plat);
-    s->useGrandInclude = useGrandInclude; // propagate this
-    doFiles(s);
-    for (std::vector < FileList* >::iterator iter = s->begin(); iter != s->end(); iter++) {
-        FileList * l = *iter;
-        l->beenHere = false;
-    }
-    return s;
+  FileList * s = new FileList(name, plat);
+  s->useGrandInclude = useGrandInclude; // propagate this
+  doFiles(s);
+  for (std::vector < FileList* >::iterator iter = s->begin(); iter != s->end(); iter++) {
+    FileList * l = *iter;
+    l->beenHere = false;
+  }
+  return s;
 }
 
 /** if .h file is included thresh times, put it in the grand
     include file */
 void FileList::putInclFile(Database * db)
-    throw (IOException) {
-    bool needline = true;
-    FileName * inclName = plat->getInclFileTemplate()->copyStem(name);
-    std::ofstream inclFile(inclName->dirPreStemSuff().c_str(),std::ios::out);
-    if (plat->haveGrandInclude() && plat->includeGIInEachIncl()) {
-        inclFile << "# include \"" 
-				 << plat->getGIFileTemplate()->dirPreStemAltSuff() 
-				 << "\"" << std::endl;
-        needline = false;
+  throw (IOException) {
+  bool needline = true;
+  FileName * inclName = plat->getInclFileTemplate()->copyStem(name);
+  std::ofstream inclFile(inclName->dirPreStemSuff().c_str(),std::ios::out);
+  if (plat->haveGrandInclude() && plat->includeGIInEachIncl()) {
+    inclFile << "# include \"" 
+	     << plat->getGIFileTemplate()->dirPreStemAltSuff() 
+	     << "\"" << std::endl;
+    needline = false;
+  }
+  for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
+    FileList * hfile = *iter;
+    if (!db->hfileIsInGrandInclude(hfile, this)) {
+      inclFile << "# include \""
+	       << plat->getInclFileTemplate()->getInvDir()
+	       << hfile->name
+	       << "\"" << std::endl;
+      needline = false;
     }
-    for (std::vector < FileList* >::iterator iter = begin(); iter != end(); iter++) {
-        FileList * hfile = *iter;
-        if (!db->hfileIsInGrandInclude(hfile, this)) {
-            inclFile << "# include \""
-					 << plat->getInclFileTemplate()->getInvDir()
-					 << hfile->name
-					 << "\"" << std::endl;
-            needline = false;
-        }
-    }
+  }
 
-    // Solaris C++ in strict mode warns about empty files
+  // Solaris C++ in strict mode warns about empty files
 
-    if(needline) {
-        inclFile << std::endl; 
-    }
+  if(needline) {
+    inclFile << std::endl; 
+  }
 
-    inclFile.close();
+  inclFile.close();
 }
 
--- a/src/share/tools/MakeDeps/MakeDeps.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/MakeDeps.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -69,13 +69,12 @@
     std::cout << "\tmakeDeps platform-name     platform-file     database-file [MakeDeps args] [platform args]" << std::endl;
     std::cout << "\tmakeDeps diffs platform-name old-platform-file old-database-file new-platform-file new-database-file [MakeDeps args] [platform args]" << std::endl;
     std::cout << "where platform-name is the name of a platform MakeDeps supports" << std::endl;
-    std::cout << "(currently \"UnixPlatform\" or \"MetroWerksMacPlatform\")" << std::endl;
+    std::cout << "(currently \"UnixPlatform\", \"MetroWerksMacPlatform\", or \"WinGammaPlatform\")" << std::endl;
     std::cout << "MakeDeps options:" << std::endl;
     std::cout << "  -firstFile [filename]: Specify the first file in link order (i.e.," << std::endl;
     std::cout << "   to have a well-known function at the start of the output file)" << std::endl;
     std::cout << "  -lastFile [filename]: Specify the last file in link order (i.e.," << std::endl;
     std::cout << "   to have a well-known function at the end of the output file)" << std::endl;
-/*
     std::cerr << "WinGammaPlatform platform-specific options:" << std::endl;
     std::cerr << "  -sourceBase <path to directory (workspace) " <<
                        "containing source files; no trailing slash>" << std::endl;
@@ -122,7 +121,6 @@
     std::cerr << " are both quoted strings." << std::endl;
     std::cerr << "    Default includes: \".\"" << std::endl;
     std::cerr << "    Default defines: WIN32, _WINDOWS, \"HOTSPOT_BUILD_USER=$(USERNAME)\"" << std::endl;
-    */
 }
 
 void MakeDeps::main(std::vector < std::string > args) {
--- a/src/share/tools/MakeDeps/UnixPlatform.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/UnixPlatform.h	Wed Oct 07 14:38:00 2009 -0700
@@ -60,4 +60,4 @@
     public: bool writeDependenciesOnHFilesFromGI() ;
 };
 
-#endif _MAKEDEPS_UNIX_PLATFORM_H_
+#endif // _MAKEDEPS_UNIX_PLATFORM_H_
--- a/src/share/tools/MakeDeps/Util.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/Util.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -23,67 +23,167 @@
  */
 
 #include "Util.h"
+#include "regex.h"
 #include <string>
 #include <vector>
+#include <sstream>
 
-class Util {
-static std::string join(std::string padder, std::vector < ? > v) {
+std::string Util::join(std::string padder, std::vector < std::string > v) {
     return join(padder, v, false);
 }
 
-static std::string join(std::string padder, std::vector < ? > v, bool quoted) {
-    StringBuffer sb = new StringBuffer();
+std::string Util::join(std::string padder, std::vector < std::string > v, bool quoted) {
+  std::ostringstream sb;
 
-    for (std::vector < ? >::iterator iter = v->begin(); iter != ?->end(); ) {
+    for (std::vector < std::string >::iterator iter = v.begin(); iter != v.end(); ) {
         if (quoted) {
-            sb.append('"');
+	  sb << '"';
         }
-        sb.append((std::string)iter.next());
+        sb << (std::string)*iter++;
         if (quoted) {
-            sb.append('"');
+	  sb << '"';
         }
-        if (iter != ?->end()) sb.append(padder);
+        if (iter != v.end()) sb << padder;
     }
 
-    return sb.toString();
+    return sb.str();
 }
 
- static std::string join(std::string padder, std::string v[]) {
-    StringBuffer sb = new StringBuffer();
+std::string Util::join(std::string padder, std::string v[], int v_size) {
+  std::ostringstream sb;
 
-    for (int i=0; i<v.size(); i++) {
-        sb.append(v[i]);
-        if (i < (v.size()  - 1)) sb.append(padder);
+    for (int i=0; i<v_size; i++) {
+      sb << v[i];
+      if (i < (v_size - 1)) sb << padder;
     }
 
-    return sb.toString();
+    return sb.str();
 }
 
 
+std::string Util::prefixed_join(std::string padder, std::vector < std::string > v, bool quoted) {
+  std::ostringstream sb;
 
-static std::string prefixed_join(std::string padder, std::vector < ? > v, bool quoted) {
-    StringBuffer sb = new StringBuffer();
-
-    for (std::vector < ? >::iterator iter = v->begin(); iter != ?->end(); ) {
-        sb.append(padder);
+    for (std::vector < std::string >::iterator iter = v.begin(); iter != v.end(); ) {
+      sb << padder;
 
         if (quoted) {
-            sb.append('"');
+	  sb << '"';
         }
-        sb.append((std::string)iter.next());
+        sb << (std::string)*iter++;
         if (quoted) {
-            sb.append('"');
+	  sb << '"';
         }
     }
 
-    return sb.toString();
+    return sb.str();
 }
 
 
-static std::string normalize(std::string file) {
-    return file.replace('\\', '/');
+std::string Util::normalize(std::string file) {
+  std::ostringstream os;
+  for (std::string::iterator iter = file.begin(); iter != file.end() ; iter++) {
+    char c = *iter;
+    if (c == '\\') {
+      os << "/";
+    } else {
+      os << c;
+    }
+  }
+  return os.str();
 }
 
-static std::string sep = File.separator;
-static std::string os = "Win32"; //getenv("os.name");
+std::string Util::sep = "/";
+std::string Util::os = "Win32"; //getenv("os.name");
+
+bool Util::case_insensitive_equals(const std::string & s1, const std::string & s2) {
+  if (s1.size() != s2.size()) {
+    return false;
+  }
+  std::string::const_iterator iter1 = s1.begin();
+  std::string::const_iterator iter2 = s2.begin();
+  while ((iter1 != s1.end()) && (iter2 != s2.end())) { 
+    if (::toupper(*iter1) != ::toupper(*iter2)) {
+      return false;
+    }
+  }
+  return true;
 }
+
+std::string File::separator = "\\";
+
+bool startsWith(std::string string, std::string start) {
+  return (string.compare(0, start.size(), start) == 0);
+}
+
+bool endsWith(std::string string, std::string end) {
+  std::string::size_type stringSize = string.size();
+  std::string::size_type endSize = end.size();
+  if (endSize > stringSize) {
+    return false;
+  }
+  return (string.compare(stringSize - endSize, endSize, end) == 0);
+}
+
+bool matches(std::string string, std::string regex) {
+  regex_t preg;
+  int result1 = regcomp(&preg, regex.c_str(), REG_NOSUB);
+  if (result1 != 0) {
+    return false;
+  }
+  int result2 = regexec(&preg, string.c_str(), 0, NULL, 0);
+  regfree(&preg);
+  return (result2 == 0);
+}
+
+bool regionMatches(std::string string, bool ignoreCase, std::string::size_type toffset, std::string other, std::string::size_type ooffset, std::string::size_type len) {
+  if ((toffset < 0) || (ooffset < 0) 
+      || (toffset + len > string.size())
+      || (ooffset + len > other.size())) {
+    return false;
+  }
+  for (std::string::size_type i = 0 ; i < len ; i++) {
+    char x = string[i];
+    char y = other[i];
+    if (ignoreCase) {
+      char xu = toupper(x);
+      char xl = tolower(x);
+      char yu = toupper(y);
+      char yl = tolower(y);
+      if ((xu != yu) && (xl != yl)) {
+	return false;
+      }
+    } else {
+      if (x != y) {
+	return false;
+      }
+    }
+  }
+  return true;
+}
+
+std::string replace(std::string string, char original, char replacement) {
+  std::string result = string;
+  for (std::string::size_type i = 0 ; i < result.size() ; i++) {
+    if (original == result[i]) {
+      result[i] = replacement;
+    }
+  }
+  return result;
+}
+
+std::string replace(std::string string, std::string target, std::string replacement) {
+  std::string result;
+  std::string::size_type start = 0;
+  while (start < string.size()) {
+    std::string::size_type next = string.find(target, start);
+    if (next == std::string::npos) {
+      result.append(string, start, std::string::npos);
+      break;
+    }
+    result.append(string, start, next - start);
+    result.append(replacement);
+    start = next + target.size();
+  }
+  return result;
+}
--- a/src/share/tools/MakeDeps/Util.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/Util.h	Wed Oct 07 14:38:00 2009 -0700
@@ -29,21 +29,33 @@
 #include <string>
 
 class Util {
-    static std::string join(std::string padder, std::vector < ? > v) ;
+ public:
+  static std::string join(std::string padder, std::vector < std::string > v) ;
 
-    static std::string join(std::string padder, std::vector < ? > v, bool quoted) ;
+  static std::string join(std::string padder, std::vector < std::string > v, bool quoted) ;
 
-	static std::string join(std::string padder, std::string v[]) ;
+  static std::string join(std::string padder, std::string v[], int v_size) ;
 
+  static std::string prefixed_join(std::string padder, std::vector < std::string > v, bool quoted) ;
 
+  static std::string normalize(std::string file) ;
 
-    static std::string prefixed_join(std::string padder, std::vector < ? > v, bool quoted) ;
+  static std::string sep;
+  static std::string os;
 
-
-    static std::string normalize(std::string file) ;
-
-    static std::string sep = "/";
-    static std::string os = "Win32"; //getenv("os.name");
+  static bool case_insensitive_equals(const std::string & s1, const std::string & s2);
 };
 
+class File {
+public:
+  static std::string separator;
+};
+
+bool startsWith(std::string string, std::string start);
+bool endsWith(std::string string, std::string end);
+bool matches(std::string string, std::string regex);
+bool regionMatches(std::string string, bool ignoreCase, std::string::size_type toffset, std::string other, std::string::size_type ooffset, std::string::size_type len);
+std::string replace(std::string string, char original, char replacement);
+std::string replace(std::string string, std::string original, std::string replacement);
+
 #endif // _MAKEDEPS_UTIL_H_
--- a/src/share/tools/MakeDeps/WinGammaPlatform.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/WinGammaPlatform.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -23,227 +23,209 @@
  */
 
 #include "WinGammaPlatform.h"
+#include "DirectoryTreeNode.h"
+#include "DirectoryTree.h"
+#include "BuildConfig.h"
+#include "FileName.h"
+#include "FileList.h"
+#include "Database.h"
+#include "Util.h"
 #include <string>
 #include <vector>
+#include <iostream>
+#include <sstream>
+#include <cstdlib>
+#include <sys/stat.h>
+#include <libgen.h>
 
-abstract class HsArgHandler : public ArgHandler {
-static final int STRING = 1;
-static final int VECTOR = 2;
-static final int HASH   = 3;
+const int HsArgHandler::STRING = 1;
+const int HsArgHandler::VECTOR = 2;
+const int HsArgHandler::HASH   = 3;
 
-bool nextNotKey(ArgIterator it) {
-    if (it.next()) {
-        std::string s = it.get();
-        return (s.size()() == 0) || (s.charAt(0) != '-');
-    } else {
-        return false;
-    }
+bool HsArgHandler::nextNotKey(ArgIterator * it) {
+  if (it->next()) {
+    std::string s = it->get();
+    return (s.size() == 0) || (s[0] != '-');
+  } else {
+    return false;
+  }
 }
 
-void empty(std::string key, std::string message) {
-    if (key != NULL) {
-        std::cerr << ln("** Error: empty " + key);
-    }
-    if (message != NULL) {
-        std::cerr << ln(message);
-    }
-    WinGammaPlatform.usage();
+void HsArgHandler::empty(std::string key, std::string message) {
+  if (!key.empty()) {
+    std::cerr << "** Error: empty " << key << std::endl;
+  }
+  if (!message.empty()) {
+    std::cerr << message << std::endl;
+  }
+  WinGammaPlatform::usage();
 }
 
-static std::string getCfg(std::string val) {
-    int under = val.indexOf('_');
-    int len = val.size()();
-    if (under != -1 && under < len - 1) {
-        return val.substring(under+1, len);
-    } else {
-        return NULL;
-    }
-}
+std::string HsArgHandler::getCfg(std::string val) {
+  std::string::size_type under = val.find('_'); // int under = val.indexOf('_');
+  std::string::size_type len = val.size();
+  if ((under != std::string::npos) && under < len - 1) {
+    return val.substr(under+1, len - (under+1));
+  } else {
+    std::string empty;
+    return empty;
+  }
 }
 
-class ArgRuleSpecific : public ArgRule {
-ArgRuleSpecific(std::string arg, ArgHandler handler) {
-    super(arg, handler);
+ArgRuleSpecific::ArgRuleSpecific(std::string arg, ArgHandler * handler)
+  : ArgRule(arg, handler) {
 }
 
-bool match(std::string rulePattern, std::string arg) {
-    return rulePattern.startsWith(arg);
-}
+bool ArgRuleSpecific::match(std::string rulePattern, std::string arg) {
+  return startsWith(rulePattern, arg);
 }
 
-
-class SpecificHsArgHandler : public HsArgHandler {
-
-std::string message, argKey, valKey;
-int type;
-
-void handle(ArgIterator it) {
-    std::string cfg = getCfg(it.get());
-    if (nextNotKey(it)) {
-        std::string val = it.get();
-        switch (type) {
-        case VECTOR:
-            BuildConfig.addFieldVector(cfg, valKey, val);
-            break;
-        case HASH:
-            BuildConfig.putFieldHash(cfg, valKey, val, "1");
-            break;
-        case STRING:
-            BuildConfig.putField(cfg, valKey, val);
-            break;
-        default:
-            empty(valKey, "Unknown type: "+type);
-        }
-        it.next();
-
-    } else {
-        empty(argKey, message);
+void SpecificHsArgHandler::handle(ArgIterator * it) {
+  std::string cfg = getCfg(it->get());
+  if (nextNotKey(it)) {
+    std::string val = it->get();
+    switch (type) {
+    case VECTOR:
+      BuildConfig::addFieldVector(cfg, valKey, val);
+      break;
+    case HASH:
+      BuildConfig::putFieldHash(cfg, valKey, val, new std::string("1"));
+      break;
+    case STRING:
+      BuildConfig::putField(cfg, valKey, new std::string(val));
+      break;
+    default:
+      std::ostringstream message;
+      message << "Unknown type: " << type;
+      empty(valKey, message.str());
     }
+    it->next();
+  } else {
+    empty(argKey, message);
+  }
 }
 
-SpecificHsArgHandler(std::string argKey, std::string valKey, std::string message, int type) {
-    this->argKey = argKey;
-    this->valKey = valKey;
-    this->message = message;
-    this->type = type;
-}
+
+SpecificHsArgHandler::SpecificHsArgHandler(std::string argKey, std::string valKey, std::string message, int type) {
+  this->argKey = argKey;
+  this->valKey = valKey;
+  this->message = message;
+  this->type = type;
 }
 
 
-class HsArgRule : public ArgRuleSpecific {
-
-HsArgRule(std::string argKey, std::string valKey, std::string message, int type) {
-    super(argKey, new SpecificHsArgHandler(argKey, valKey, message, type));
+HsArgRule::HsArgRule(std::string argKey, std::string valKey, std::string message, int type) 
+  : ArgRuleSpecific(argKey, new SpecificHsArgHandler(argKey, valKey, message, type)) {
 }
 
+std::vector < std::string > WinGammaPlatform::suffixes;
+
+WinGammaPlatform::WinGammaPlatform() : Platform() {
+  if (suffixes.empty()) {
+    suffixes.push_back(".cpp");
+    suffixes.push_back(".c");
+  }
 }
 
-/*abstract*/ class WinGammaPlatform : public Platform {
-void setupFileTemplates() {
-    inclFileTemplate = new FileName(this,
-        "incls\\", "_", "",                      ".incl", "", ""
-    );
-    giFileTemplate = new FileName(this,
-        "incls\\", "",  "_precompiled", ".incl", "", ""
-    );
-    gdFileTemplate = new FileName(this,
-        "", "",  "Dependencies",         "",      "", ""
-    );
+void WinGammaPlatform::setupFileTemplates() {
+  inclFileTemplate = new FileName(this, "incls\\", "_", "", ".incl", "", "");
+  giFileTemplate = new FileName(this, "incls\\", "",  "_precompiled", ".incl", "", "");
+  gdFileTemplate = new FileName(this, "", "", "Dependencies", "", "", "");
 }
 
-static std::vector < std::string > suffixes = { ".cpp", ".c" };
-
-std::vector < std::string > outerSuffixes() {
-    return suffixes;
+std::vector < std::string > WinGammaPlatform::outerSuffixes() {
+  return suffixes;
 }
 
-std::string objFileSuffix() {
-    return ".obj";
+std::string WinGammaPlatform::objFileSuffix() {
+  return ".obj";
 }
 
-std::string asmFileSuffix() {
-    return ".i";
+std::string WinGammaPlatform::asmFileSuffix() {
+  return ".i";
 }
 
-std::string dependentPrefix() {
-    return "$(VM_PATH)";
+std::string WinGammaPlatform::dependentPrefix() {
+  return "$(VM_PATH)";
 }
 
-bool includeGIInEachIncl() {
-    return false;
+bool WinGammaPlatform::includeGIInEachIncl() {
+  return false;
 }
 
-bool fileNameStringEquality(std::string s1, std::string s2) {
-    return s1.equalsIgnoreCase(s2);
+bool WinGammaPlatform::fileNameStringEquality(std::string s1, std::string s2) {
+  return Util::case_insensitive_equals(s1, s2);
 }
 
-static void usage() throw (IllegalArgumentException {
-    std::cerr << ln("WinGammaPlatform platform-specific options:");
-    std::cerr << ln("  -sourceBase <path to directory (workspace) " +
-                       "containing source files; no trailing slash>");
-    std::cerr << ln("  -projectFileName <full pathname to which project file " +
-                       "will be written; all parent directories must " +
-                       "already exist>");
-    std::cerr << ln("  If any of the above are specified, "+
-                       "they must all be.");
-    std::cerr << ln("  Additional, optional arguments, which can be " +
-                       "specified multiple times:");
-    std::cerr << ln("    -absoluteInclude <string containing absolute " +
-                       "path to include directory>");
-    std::cerr << ln("    -relativeInclude <string containing include " +
-                       "directory relative to -sourceBase>");
-    std::cerr << ln("    -define <preprocessor flag to be #defined " +
-                       "(note: doesn't yet support " +
-                       "#define (flag) (value))>");
-    std::cerr << ln("    -startAt <subdir of sourceBase>");
-    std::cerr << ln("    -additionalFile <file not in database but " +
-                       "which should show up in project file, like " +
-                       "includeDB_core>");
-    std::cerr << ln("    -additionalGeneratedFile <absolute path to " +
-                       "directory containing file; no trailing slash> " +
-                       "<name of file generated later in the build process>");
-    throw IllegalArgumentException();
+void WinGammaPlatform::usage() throw (IllegalArgumentException) {
+  std::cerr << "WinGammaPlatform platform-specific options:" << std::endl;
+  std::cerr << "  -sourceBase <path to directory (workspace) " <<
+    "containing source files; no trailing slash>" << std::endl;
+  std::cerr << "  -projectFileName <full pathname to which project file " <<
+    "will be written; all parent directories must " <<
+    "already exist>" << std::endl;
+  std::cerr << "  If any of the above are specified, " <<
+    "they must all be." << std::endl;
+  std::cerr << "  Additional, optional arguments, which can be " <<
+    "specified multiple times:" << std::endl;
+  std::cerr << "    -absoluteInclude <string containing absolute " <<
+    "path to include directory>" << std::endl;
+  std::cerr << "    -relativeInclude <string containing include " <<
+    "directory relative to -sourceBase>" << std::endl;
+  std::cerr << "    -define <preprocessor flag to be #defined " <<
+    "(note: doesn't yet support " <<
+    "#define (flag) (value))>" << std::endl;
+  std::cerr << "    -startAt <subdir of sourceBase>" << std::endl;
+  std::cerr << "    -additionalFile <file not in database but " <<
+    "which should show up in project file, like " <<
+    "includeDB_core>" << std::endl;
+  std::cerr << "    -additionalGeneratedFile <absolute path to " <<
+    "directory containing file; no trailing slash> " <<
+    "<name of file generated later in the build process>" << std::endl;
+  throw IllegalArgumentException();
 }
 
-
-void addPerFileLine(Hashtable table,
-                           std::string fileName,
-                           std::string line) {
-    std::vector < ? > v = (std::vector < ? >) table.get(fileName);
-    if (v != NULL) {
-        v->push_back(line);
-    } else {
-        v = new std::vector < ? >();
-        v->push_back(line);
-        table.put(fileName, v);
-    }
+void WinGammaPlatform::addPerFileLine(std::map < std::string, std::vector < std::string > > table,
+				      std::string fileName,
+				      std::string line) {
+  if (table.count(fileName) == 0) {
+    std::vector < std::string > newVector;
+    table[fileName] = newVector;
+  }
+  table[fileName].push_back(line);
 }
 
-static class PerFileCondData {
-    std::string releaseString;
-    std::string debugString;
+void WinGammaPlatform::addConditionalPerFileLine(std::map < std::string, std::vector < PerFileCondData * > > table,
+						 std::string fileName,
+						 std::string releaseLine,
+						 std::string debugLine) {
+  PerFileCondData * data = new PerFileCondData();
+  data->releaseString = releaseLine;
+  data->debugString = debugLine;
+  if (table.count(fileName) == 0) {
+    std::vector < PerFileCondData * > newVector;
+    table[fileName] = newVector;
+  }
+  table[fileName].push_back(data);
 }
 
-void addConditionalPerFileLine(Hashtable table,
-                                       std::string fileName,
-                                       std::string releaseLine,
-                                       std::string debugLine) {
-    PerFileCondData data = new PerFileCondData();
-    data.releaseString = releaseLine;
-    data.debugString = debugLine;
-    std::vector < ? > v = (std::vector < ? >) table.get(fileName);
-    if (v != NULL) {
-        v->push_back(data);
-    } else {
-        v = new std::vector < ? >();
-        v->push_back(data);
-        table.put(fileName, v);
-    }
+void WinGammaPlatform::addPrelinkCommand(std::map < std::string, PrelinkCommandData * > table,
+					 std::string build,
+					 std::string description,
+					 std::string commands) {
+  PrelinkCommandData * data = new PrelinkCommandData();
+  data->description = description;
+  data->commands = commands;
+  table[build] = data;
 }
 
-static class PrelinkCommandData {
-  std::string description;
-  std::string commands;
-}
-
-void addPrelinkCommand(Hashtable table,
-                                 std::string build,
-                                 std::string description,
-                                 std::string commands) {
-  PrelinkCommandData data = new PrelinkCommandData();
-  data.description = description;
-  data.commands = commands;
-  table.put(build, data);
-}
-
-bool findString(std::vector < ? > v, std::string s) {
-    for (std::vector < ? >::iterator iter = v->begin(); iter != ?->end(); ) {
-        if (((std::string) iter.next()) == s)) {
-            return true;
-        }
+bool WinGammaPlatform::findString(std::vector < std::string > * v, std::string s) {
+  for (std::vector < std::string >::iterator iter = v->begin(); iter != v->end(); ) {
+    if (*iter++ == s) {
+      return true;
     }
-
-    return false;
+  }
+  return false;
 }
 
 /* This returns a std::string containing the full path to the passed
@@ -251,516 +233,423 @@
    found or was a duplicate and couldn't be resolved using the
    preferred paths, the file name is added to the appropriate
    std::vector < ? > of Strings. */
-std::string findFileInDirectory(std::string fileName,
-                                   DirectoryTree directory,
-                                   std::vector < ? > preferredPaths,
-                                   std::vector < ? > filesNotFound,
-                                   std::vector < ? > filesDuplicate) {
-    List locationsInTree = directory.findFile(fileName);
-    int  rootNameLength = directory.getRootNodeName().size()();
-    std::string name = NULL;
-    if ((locationsInTree == NULL) ||
-        (locationsInTree.size() == 0)) {
-        filesNotFound->push_back(fileName);
-    } else if (locationsInTree.size() > 1) {
-        // We shouldn't have duplicate file names in our workspace.
-        std::cerr << std::endl; 
-        std::cerr << ln("There are multiple files named as: " + fileName);
-        System.exit(-1);
-        // The following code could be safely removed if we don't need duplicate
-        // file names.
+std::string WinGammaPlatform::findFileInDirectory(std::string fileName,
+						  DirectoryTree * directory,
+						  std::vector < std::string > * preferredPaths,
+						  std::vector < std::string > * filesNotFound,
+						  std::vector < std::string > * filesDuplicate) {
+  std::vector < DirectoryTreeNode * > locationsInTree = directory->findFile(fileName);
+  int rootNameLength = directory->getRootNodeName().size();
+  std::string name = "";
+  if (locationsInTree.size() == 0) {
+    filesNotFound->push_back(fileName);
+  } else if (locationsInTree.size() > 1) {
+    // We shouldn't have duplicate file names in our workspace.
+    std::cerr << std::endl; 
+    std::cerr << "There are multiple files named as: " << fileName << std::endl;
+    exit(-1);
+    // The following code could be safely removed if we don't need duplicate
+    // file names.
 
-        // Iterate through them, trying to find one with a
-        // preferred path
-    search:
-        {
-            for (std::vector < ? >::iterator locIter = locationsInTree->begin();
-                 locIter != ?->end(); ) {
-                DirectoryTreeNode node =
-                    (DirectoryTreeNode) locIter.next();
-                std::string tmpName = node.getName();
-                for (std::vector < ? >::iterator prefIter = preferredPaths->begin();
-                     prefIter != ?->end(); ) {
-                    // We need to make sure the preferred path is
-                    // found from the file path not including the root node name.
-                    if (tmpName.indexOf((std::string)prefIter.next(),
-                                        rootNameLength) != -1) {
-                        name = tmpName;
-                        break search;
-                    }
-                }
-            }
-        }
-
-        if (name == NULL) {
-            filesDuplicate->push_back(fileName);
-        }
-    } else {
-        name = ((DirectoryTreeNode) locationsInTree.get(0)).getName();
+    // Iterate through them, trying to find one with a
+    // preferred path
+    for (std::vector < DirectoryTreeNode * >::iterator locIter = locationsInTree.begin();
+	 locIter != locationsInTree.end(); ) {
+      DirectoryTreeNode * node = *locIter++;
+      std::string tmpName = node->getName();
+      for (std::vector < std::string >::iterator prefIter = preferredPaths->begin();
+	   prefIter != preferredPaths->end(); ) {
+	// We need to make sure the preferred path is
+	// found from the file path not including the root node name.
+	std::string pref = *prefIter++;
+	if (tmpName.find(pref, rootNameLength) != std::string::npos) {
+	  name = tmpName;
+	  goto search;
+	}
+      }
     }
-
-    return name;
+  search:
+    if (name == "") {
+      filesDuplicate->push_back(fileName);
+    }
+  } else {
+    name = locationsInTree[0]->getName();
+  }
+  return name;
 }
 
-bool databaseAllFilesEqual(Database previousDB,
-                                        Database currentDB) {
-    std::vector < ? >::iterator i1 = previousDB.getAllFiles()->begin();
-    std::vector < ? >::iterator i2 = currentDB.getAllFiles()->begin();
+bool WinGammaPlatform::databaseAllFilesEqual(Database * previousDB,
+					     Database * currentDB) {
+  FileList * previousFiles = previousDB->getAllFiles();
+  FileList * currentFiles = currentDB->getAllFiles();
+  std::vector < FileList* >::iterator i1 = previousFiles->begin();
+  std::vector < FileList* >::iterator i2 = currentFiles->begin();
 
-    while (i1 != ?->end() && i2 != ?->end()) {
-        FileList fl1 = (FileList) i1.next();
-        FileList fl2 = (FileList) i2.next();
-        if (!fl1.getName() == fl2.getName())) {
-            return false;
-        }
+  while (i1 != previousFiles->end() && i2 != previousFiles->end()) {
+    FileList * fl1 = (FileList *) *i1++;
+    FileList * fl2 = (FileList *) *i2++;
+    if (fl1->getName() != fl2->getName()) {
+      return false;
     }
-
-    if (i1 != ?->end() != i2 != ?->end()) {
-        // Different lengths
-        return false;
-    }
-
-    return true;
+  }
+  if ((i1 != previousFiles->end()) != (i2 != previousFiles->end())) {
+    // Different lengths
+    return false;
+  }
+  return true;
 }
 
-std::string envVarPrefixedFileName(std::string fileName,
-                                        int sourceBaseLen,
-                                        DirectoryTree tree,
-                                        std::vector < ? > preferredPaths,
-                                        std::vector < ? > filesNotFound,
-                                        std::vector < ? > filesDuplicate) {
-    std::string fullName = findFileInDirectory(fileName,
-                                          tree,
-                                          preferredPaths,
-                                          filesNotFound,
-                                          filesDuplicate);
-    return fullName;
+std::string WinGammaPlatform::envVarPrefixedFileName(std::string fileName,
+						     int sourceBaseLen,
+						     DirectoryTree * tree,
+						     std::vector < std::string > * preferredPaths,
+						     std::vector < std::string > * filesNotFound,
+						     std::vector < std::string > * filesDuplicate) {
+  std::string fullName = findFileInDirectory(fileName,
+					     tree,
+					     preferredPaths,
+					     filesNotFound,
+					     filesDuplicate);
+  return fullName;
 }
 
- std::string getProjectName(std::string fullPath, std::string extension)
-    throw (IllegalArgumentException, IOException {
-    File file = new File(fullPath).getCanonicalFile();
-    fullPath = file.getCanonicalPath();
-    std::string parent = file.getParent();
-
-    if (!fullPath.endsWith(extension)) {
-        throw IllegalArgumentException("project file name \"" +
-                                           fullPath +
-                                           "\" does not end in "+extension);
-    }
-
-    if ((parent != NULL) &&
-        (!fullPath.startsWith(parent))) {
-        throw RuntimeException(
-            "Internal error: parent of file name \"" + parent +
-            "\" does not match file name \"" + fullPath + "\""
-        );
-    }
-
-    int len = parent.size()();
-    if (!parent.endsWith(Util.sep)) {
-        len += Util.sep.size()();
-    }
-
-    int end = fullPath.size()() - extension.size()();
-
-    if (len == end) {
-        throw RuntimeException(
-            "Internal error: file name was empty"
-        );
-    }
-
-    return fullPath.substring(len, end);
+std::string WinGammaPlatform::getProjectName(std::string fullPath, std::string extension)
+  throw (IllegalArgumentException, IOException) {
+  char canonicalPath[fullPath.size()];
+  realpath(fullPath.c_str(), canonicalPath);
+  fullPath = canonicalPath;
+  char parentC[fullPath.size()];
+  strcpy(parentC, fullPath.c_str());
+  std::string parent = dirname(parentC);
+  if (!endsWith(fullPath, extension)) {
+    std::ostringstream message;
+    message << "project file name \"" << fullPath 
+	    << "\" does not end in " << extension;
+    throw IllegalArgumentException(message.str());
+  }
+  if (!parent.empty() && (!startsWith(fullPath, parent))) {
+    std::ostringstream message;
+    message << "Internal error: parent of file name \"" << parent
+	    << "\" does not match file name \"" << fullPath << "\"";
+    throw RuntimeException(message.str());
+  }
+  int len = parent.size();
+  if (!endsWith(parent, Util::sep)) {
+    len += Util::sep.size();
+  }
+  int end = fullPath.size() - extension.size();
+  if (len == end) {
+    throw RuntimeException("Internal error: file name was empty");
+  }
+  return fullPath.substr(len, end - len);
 }
 
-virtual /*abstract*/ std::string getProjectExt();
+void WinGammaPlatform::writePlatformSpecificFiles(Database * previousDB,
+						  Database * currentDB, std::vector < std::string > args)
+  throw (IllegalArgumentException, IOException) {
 
-void writePlatformSpecificFiles(Database previousDB,
-                                       Database currentDB, std::vector < std::string > args)
-    throw (IllegalArgumentException, IOException {
+  parseArguments(args);
 
-    parseArguments(args);
+  std::string projectFileName = BuildConfig::getFieldString(NULL, "ProjectFileName");
+  std::string ext = getProjectExt();
 
-    std::string projectFileName = BuildConfig.getFieldString(NULL, "ProjectFileName");
-    std::string ext = getProjectExt();
-
-    // Compare contents of allFiles of previousDB and includeDB.
-    // If these haven't changed, then skip writing the .vcproj file.
-    if (false && databaseAllFilesEqual(previousDB, currentDB) &&
-        new File(projectFileName).exists()) {
-        std::cout << ln(
-                           "    Databases unchanged; skipping overwrite of "+ext+" file."
-                           );
-        return;
+  // Compare contents of allFiles of previousDB and includeDB.
+  // If these haven't changed, then skip writing the .vcproj file.
+  if (false && databaseAllFilesEqual(previousDB, currentDB)) {
+    struct stat sstat;
+    stat(projectFileName.c_str(), &sstat);
+    if (S_ISREG(sstat.st_mode)) {
+      std::cout << "    Databases unchanged; skipping overwrite of " << ext << " file." << std::endl;
+      return;
     }
-
-    std::string projectName = getProjectName(projectFileName, ext);
-
-    writeProjectFile(projectFileName, projectName, createAllConfigs());
+  }
+  std::string projectName = getProjectName(projectFileName, ext);
+  writeProjectFile(projectFileName, projectName, createAllConfigs());
 }
 
-void writePrologue(std::vector < std::string > args) {
-    std::cerr << ln("WinGammaPlatform platform-specific arguments:");
-    for (int i = 0; i < args.size(); i++) {
-        std::cerr << (args[i] + " ");
-    }
-    std::cerr << std::endl; 
+void WinGammaPlatform::writePrologue(std::vector < std::string > args) {
+  std::cerr << "WinGammaPlatform platform-specific arguments:" << std::endl;
+  for (size_t i = 0; i < args.size(); i++) {
+    std::cerr << args[i] << " ";
+  }
+  std::cerr << std::endl; 
 }
 
 
-void setInclFileTemplate(FileName val) {
-    this->inclFileTemplate = val;
+void WinGammaPlatform::setInclFileTemplate(FileName * val) {
+  this->inclFileTemplate = val;
 }
 
-void setGIFileTemplate(FileName val) {
-    this->giFileTemplate = val;
+void WinGammaPlatform::setGIFileTemplate(FileName * val) {
+  this->giFileTemplate = val;
 }
 
 
-void parseArguments(std::vector < std::string > args) {
-    new ArgsParser(args,
-                   new ArgRule[]
-        {
-            new HsArgRule("-sourceBase",
-                          "SourceBase",
-                          "   (Did you set the HotSpotWorkSpace environment variable?)",
-                          HsArgHandler.STRING
-                          ),
-
-            new HsArgRule("-buildBase",
-                          "BuildBase",
-                          "   (Did you set the HotSpotBuildSpace environment variable?)",
-                          HsArgHandler.STRING
-                          ),
-
-            new HsArgRule("-projectFileName",
-                          "ProjectFileName",
-                          NULL,
-                          HsArgHandler.STRING
-                          ),
-
-            new HsArgRule("-jdkTargetRoot",
-                          "JdkTargetRoot",
-                          "   (Did you set the HotSpotJDKDist environment variable?)",
-                          HsArgHandler.STRING
-                          ),
-
-            new HsArgRule("-compiler",
-                          "CompilerVersion",
-                          "   (Did you set the VcVersion correctly?)",
-                          HsArgHandler.STRING
-                          ),
-
-            new HsArgRule("-platform",
-                          "Platform",
-                          NULL,
-                          HsArgHandler.STRING
-                          ),
-
-            new HsArgRule("-absoluteInclude",
-                          "AbsoluteInclude",
-                          NULL,
-                          HsArgHandler.VECTOR
-                          ),
-
-            new HsArgRule("-relativeInclude",
-                          "RelativeInclude",
-                          NULL,
-                          HsArgHandler.VECTOR
-                          ),
-
-            new HsArgRule("-define",
-                          "Define",
-                          NULL,
-                          HsArgHandler.VECTOR
-                          ),
-
-            new HsArgRule("-useToGeneratePch",
-                          "UseToGeneratePch",
-                          NULL,
-                          HsArgHandler.STRING
-                          ),
-
-            new ArgRuleSpecific("-perFileLine",
-                        new HsArgHandler() {
-                            void handle(ArgIterator it) {
-                                std::string cfg = getCfg(it.get());
-                                if (nextNotKey(it)) {
-                                    std::string fileName = it.get();
-                                    if (nextNotKey(it)) {
-                                        std::string line = it.get();
-                                        BuildConfig.putFieldHash(cfg, "PerFileLine", fileName, line);
-                                        it.next();
-                                        return;
-                                    }
-                                }
-                                empty(NULL, "** Error: wrong number of args to -perFileLine");
-                            }
-                        }
-                        ),
-
-            new ArgRuleSpecific("-conditionalPerFileLine",
-                        new HsArgHandler() {
-                            void handle(ArgIterator it) {
-                                std::string cfg = getCfg(it.get());
-                                if (nextNotKey(it)) {
-                                    std::string fileName = it.get();
-                                    if (nextNotKey(it)) {
-                                        std::string productLine = it.get();
-                                        if (nextNotKey(it)) {
-                                            std::string debugLine = it.get();
-                                            BuildConfig.putFieldHash(cfg+"_debug", "CondPerFileLine",
-                                                                     fileName, debugLine);
-                                            BuildConfig.putFieldHash(cfg+"_product", "CondPerFileLine",
-                                                                     fileName, productLine);
-                                            it.next();
-                                            return;
-                                        }
-                                    }
-                                }
-
-                                empty(NULL, "** Error: wrong number of args to -conditionalPerFileLine");
-                            }
-                        }
-                        ),
-
-            new HsArgRule("-disablePch",
-                          "DisablePch",
-                          NULL,
-                          HsArgHandler.HASH
-                          ),
-
-            new ArgRule("-startAt",
-                        new HsArgHandler() {
-                            void handle(ArgIterator it) {
-                                if (BuildConfig.getField(NULL, "StartAt") != NULL) {
-                                    empty(NULL, "** Error: multiple -startAt");
-                                }
-                                if (nextNotKey(it)) {
-                                    BuildConfig.putField(NULL, "StartAt", it.get());
-                                    it.next();
-                                } else {
-                                    empty("-startAt", NULL);
-                                }
-                            }
-                        }
-                        ),
-
-            new HsArgRule("-ignoreFile",
-                                  "IgnoreFile",
-                                  NULL,
-                                  HsArgHandler.HASH
-                                  ),
-
-            new HsArgRule("-additionalFile",
-                          "AdditionalFile",
-                          NULL,
-                          HsArgHandler.VECTOR
-                          ),
-
-            new ArgRuleSpecific("-additionalGeneratedFile",
-                        new HsArgHandler() {
-                            void handle(ArgIterator it) {
-                                std::string cfg = getCfg(it.get());
-                                if (nextNotKey(it)) {
-                                    std::string dir = it.get();
-                                    if (nextNotKey(it)) {
-                                        std::string fileName = it.get();
-                                        // we ignore files that we know are generated, so we coudn't
-                                        // find them in sources
-                                        BuildConfig.putFieldHash(cfg, "IgnoreFile",  fileName, "1");
-                                        BuildConfig.putFieldHash(cfg, "AdditionalGeneratedFile",
-                                                                 Util.normalize(dir + Util.sep + fileName),
-                                                                 fileName);
-                                        it.next();
-                                        return;
-                                    }
-                                }
-                                empty(NULL, "** Error: wrong number of args to -additionalGeneratedFile");
-                            }
-                        }
-                        ),
-
-            new HsArgRule("-includeDB",
-                          "IncludeDB",
-                          NULL,
-                          HsArgHandler.STRING
-                          ),
-
-            new ArgRule("-prelink",
-                        new HsArgHandler() {
-                            void handle(ArgIterator it) {
-                                if (nextNotKey(it)) {
-                                    std::string build = it.get();
-                                    if (nextNotKey(it)) {
-                                        std::string description = it.get();
-                                        if (nextNotKey(it)) {
-                                            std::string command = it.get();
-                                            BuildConfig.putField(NULL, "PrelinkDescription", description);
-                                            BuildConfig.putField(NULL, "PrelinkCommand", command);
-                                            it.next();
-                                            return;
-                                        }
-                                    }
-                                }
-
-                                empty(NULL,  "** Error: wrong number of args to -prelink");
-                            }
-                        }
-                        )
-        },
-                                   new ArgHandler() {
-                                       void handle(ArgIterator it) {
-
-                                           throw RuntimeException("Arg Parser: unrecognized option "+it.get());
-                                       }
-                                   }
-                                   );
-    if (BuildConfig.getField(NULL, "SourceBase") == NULL      ||
-        BuildConfig.getField(NULL, "BuildBase") == NULL       ||
-        BuildConfig.getField(NULL, "ProjectFileName") == NULL ||
-        BuildConfig.getField(NULL, "CompilerVersion") == NULL) {
-        usage();
+void WinGammaPlatform::parseArguments(std::vector < std::string > args) {
+  std::vector < ArgRule * > rules;
+  rules.push_back(new HsArgRule("-sourceBase", "SourceBase",
+				"   (Did you set the HotSpotWorkSpace environment variable?)",
+				HsArgHandler::STRING));
+  rules.push_back(new HsArgRule("-buildBase", "BuildBase",
+				"   (Did you set the HotSpotBuildSpace environment variable?)",
+				HsArgHandler::STRING));
+  rules.push_back(new HsArgRule("-projectFileName", "ProjectFileName",
+				NULL, HsArgHandler::STRING));
+  rules.push_back(new HsArgRule("-jdkTargetRoot", "JdkTargetRoot",
+				"   (Did you set the HotSpotJDKDist environment variable?)",
+				HsArgHandler::STRING));
+  rules.push_back(new HsArgRule("-compiler", "CompilerVersion",
+				"   (Did you set the VcVersion correctly?)",
+				HsArgHandler::STRING));
+  rules.push_back(new HsArgRule("-platform", "Platform",
+				NULL, HsArgHandler::STRING));
+  rules.push_back(new HsArgRule("-absoluteInclude", "AbsoluteInclude",
+				NULL, HsArgHandler::VECTOR));
+  rules.push_back(new HsArgRule("-relativeInclude", "RelativeInclude",
+				NULL, HsArgHandler::VECTOR));
+  rules.push_back(new HsArgRule("-define", "Define",
+				NULL, HsArgHandler::VECTOR));
+  rules.push_back(new HsArgRule("-useToGeneratePch", "UseToGeneratePch",
+				NULL, HsArgHandler::STRING));
+  class PrefFileLineHsArgHandler : public HsArgHandler {
+    void handle(ArgIterator * it) {
+      std::string cfg = getCfg(it->get());
+      if (nextNotKey(it)) {
+	std::string fileName = it->get();
+	if (nextNotKey(it)) {
+	  std::string line = it->get();
+	  BuildConfig::putFieldHash(cfg, "PerFileLine", fileName, new std::string(line));
+	  it->next();
+	  return;
+	}
+      }
+      std::string emptyStr;
+      empty(emptyStr, "** Error: wrong number of args to -perFileLine");
     }
-
-    if (BuildConfig.getField(NULL, "UseToGeneratePch") == NULL) {
-        throw RuntimeException("ERROR: need to specify one file to compute PCH, with -useToGeneratePch flag");
+  };
+  rules.push_back(new ArgRuleSpecific("-perFileLine", new PrefFileLineHsArgHandler()));
+  class ConditionalPerFileLineHsArgHandler : public HsArgHandler {
+    void handle(ArgIterator * it) {
+      std::string cfg = getCfg(it->get());
+      if (nextNotKey(it)) {
+	std::string fileName = it->get();
+	if (nextNotKey(it)) {
+	  std::string productLine = it->get();
+	  if (nextNotKey(it)) {
+	    std::string debugLine = it->get();
+	    BuildConfig::putFieldHash(cfg+"_debug", "CondPerFileLine",
+				      fileName, new std::string(debugLine));
+	    BuildConfig::putFieldHash(cfg+"_product", "CondPerFileLine",
+				      fileName, new std::string(productLine));
+	    it->next();
+	    return;
+	  }
+	}
+      }
+      std::string emptyStr;
+      empty(emptyStr, "** Error: wrong number of args to -conditionalPerFileLine");
     }
-
-    BuildConfig.putField(NULL, "PlatformObject", this);
+  };
+  rules.push_back(new ArgRuleSpecific("-conditionalPerFileLine", new ConditionalPerFileLineHsArgHandler()));
+  rules.push_back(new HsArgRule("-disablePch", "DisablePch",
+				NULL, HsArgHandler::HASH));
+  class StartAtHsArgHandler : public HsArgHandler {
+    void handle(ArgIterator * it) {
+      std::string emptyStr;
+      if (BuildConfig::getField(emptyStr, "StartAt") != NULL) {
+	empty(emptyStr, "** Error: multiple -startAt");
+      }
+      if (nextNotKey(it)) {
+	BuildConfig::putField(emptyStr, "StartAt", new std::string(it->get()));
+	it->next();
+      } else {
+	empty("-startAt", emptyStr);
+      }
+    }
+  };
+  rules.push_back(new ArgRule("-startAt", new StartAtHsArgHandler()));
+  rules.push_back(new HsArgRule("-ignoreFile", "IgnoreFile",
+				NULL, HsArgHandler::HASH));
+  rules.push_back(new HsArgRule("-additionalFile", "AdditionalFile",
+				NULL, HsArgHandler::VECTOR));
+  class AdditionalGeneratedFileHsArgHandler : public HsArgHandler {
+    void handle(ArgIterator * it) {
+      std::string cfg = getCfg(it->get());
+      if (nextNotKey(it)) {
+	std::string dir = it->get();
+	if (nextNotKey(it)) {
+	  std::string fileName = it->get();
+	  // we ignore files that we know are generated, so we coudn't
+	  // find them in sources
+	  BuildConfig::putFieldHash(cfg, "IgnoreFile",  fileName, new std::string("1"));
+	  std::ostringstream value;
+	  value << dir << Util::sep << fileName;
+	  BuildConfig::putFieldHash(cfg, "AdditionalGeneratedFile",
+				    Util::normalize(value.str()),
+				    new std::string(fileName));
+	  it->next();
+	  return;
+	}
+      }
+      std::string emptyStr;
+      empty(emptyStr, "** Error: wrong number of args to -additionalGeneratedFile");
+    }
+  };
+  rules.push_back(new ArgRuleSpecific("-additionalGeneratedFile", new AdditionalGeneratedFileHsArgHandler()));
+  rules.push_back(new HsArgRule("-includeDB", "IncludeDB",
+				NULL, HsArgHandler::STRING));
+  class PrelinkHsArgHandler : public HsArgHandler {
+    void handle(ArgIterator * it) {
+      std::string emptyStr;
+      if (nextNotKey(it)) {
+	std::string build = it->get();
+	if (nextNotKey(it)) {
+	  std::string description = it->get();
+	  if (nextNotKey(it)) {
+	    std::string command = it->get();
+	    BuildConfig::putField(emptyStr, "PrelinkDescription", new std::string(description));
+	    BuildConfig::putField(emptyStr, "PrelinkCommand", new std::string(command));
+	    it->next();
+	    return;
+	  }
+	}
+      }
+      empty(emptyStr, "** Error: wrong number of args to -prelink");
+    }
+  };
+  rules.push_back(new ArgRule("-prelink", new PrelinkHsArgHandler()));
+  class DefaultArgHandler : public ArgHandler {
+  public:
+    virtual void handle(ArgIterator * it) {
+      std::ostringstream message;
+      message << "Arg Parser: unrecognized option " << it->get();
+      throw RuntimeException(message.str());
+    }
+  };
+  ArgHandler * defaulter = new DefaultArgHandler();
+  new ArgsParser(args, rules, defaulter);
+  if (BuildConfig::getField(NULL, "SourceBase") == NULL      ||
+      BuildConfig::getField(NULL, "BuildBase") == NULL       ||
+      BuildConfig::getField(NULL, "ProjectFileName") == NULL ||
+      BuildConfig::getField(NULL, "CompilerVersion") == NULL) {
+    usage();
+  }
+  if (BuildConfig::getField(NULL, "UseToGeneratePch") == NULL) {
+    throw RuntimeException("ERROR: need to specify one file to compute PCH, with -useToGeneratePch flag");
+  }
+  BuildConfig::putField(NULL, "PlatformObject", this);
 }
 
-std::vector < ? > createAllConfigs() {
-    std::vector < ? > allConfigs = new std::vector < ? >();
+std::vector < BuildConfig * > WinGammaPlatform::createAllConfigs() {
+  std::vector < BuildConfig * > allConfigs;
+  allConfigs.push_back(new C1DebugConfig());
+  bool b = true;
+  if (b) {
+    allConfigs.push_back(new C1FastDebugConfig());
+    allConfigs.push_back(new C1ProductConfig());
 
-    allConfigs->push_back(new C1DebugConfig());
+    allConfigs.push_back(new C2DebugConfig());
+    allConfigs.push_back(new C2FastDebugConfig());
+    allConfigs.push_back(new C2ProductConfig());
 
-    bool b = true;
-    if (b) {
-        allConfigs->push_back(new C1FastDebugConfig());
-        allConfigs->push_back(new C1ProductConfig());
+    allConfigs.push_back(new TieredDebugConfig());
+    allConfigs.push_back(new TieredFastDebugConfig());
+    allConfigs.push_back(new TieredProductConfig());
 
-        allConfigs->push_back(new C2DebugConfig());
-        allConfigs->push_back(new C2FastDebugConfig());
-        allConfigs->push_back(new C2ProductConfig());
+    allConfigs.push_back(new CoreDebugConfig());
+    allConfigs.push_back(new CoreFastDebugConfig());
+    allConfigs.push_back(new CoreProductConfig());
 
-        allConfigs->push_back(new TieredDebugConfig());
-        allConfigs->push_back(new TieredFastDebugConfig());
-        allConfigs->push_back(new TieredProductConfig());
-
-        allConfigs->push_back(new CoreDebugConfig());
-        allConfigs->push_back(new CoreFastDebugConfig());
-        allConfigs->push_back(new CoreProductConfig());
-
-        allConfigs->push_back(new KernelDebugConfig());
-        allConfigs->push_back(new KernelFastDebugConfig());
-        allConfigs->push_back(new KernelProductConfig());
-    }
-
-    return allConfigs;
+    allConfigs.push_back(new KernelDebugConfig());
+    allConfigs.push_back(new KernelFastDebugConfig());
+    allConfigs.push_back(new KernelProductConfig());
+  }
+  return allConfigs;
 }
 
-class FileAttribute {
-    int     numConfigs;
-    std::vector < ? >  configs;
-    std::string  shortName;
-    bool noPch, pchRoot;
-
-    FileAttribute(std::string shortName, BuildConfig cfg, int numConfigs) {
-        this->shortName = shortName;
-        this->noPch =  (cfg.lookupHashFieldInContext("DisablePch", shortName) != NULL);
-        this->pchRoot = shortName == BuildConfig.getFieldString(NULL, "UseToGeneratePch"));
-        this->numConfigs = numConfigs;
-
-        configs = new std::vector < ? >();
-        add(cfg.get("Name"));
-    }
-
-    void add(std::string confName) {
-        configs->push_back(confName);
-
-        // if presented in all configs
-        if (configs.size() == numConfigs) {
-            configs = NULL;
-        }
-    }
+WinGammaPlatform::FileAttribute::FileAttribute(std::string shortName, BuildConfig * cfg, int numConfigs) {
+  this->shortName = shortName;
+  this->noPch = (cfg->lookupHashFieldInContext("DisablePch", shortName) != NULL);
+  this->pchRoot = (shortName == BuildConfig::getFieldString(NULL, "UseToGeneratePch"));
+  this->numConfigs = numConfigs;
+  add(cfg->get("Name"));
 }
 
-class FileInfo implements Comparable {
-    std::string        full;
-    FileAttribute attr;
-
-    FileInfo(std::string full, FileAttribute  attr) {
-        this->full = full;
-        this->attr = attr;
-    }
-
-    int compareTo(Object o) {
-        FileInfo oo = (FileInfo)o;
-        // Don't squelch identical short file names where the full
-        // paths are different
-        if (!attr.shortName == oo.attr.shortName))
-          return attr.shortName.compareTo(oo.attr.shortName);
-        return full.compareTo(oo.full);
-    }
-
-    bool isHeader() {
-        return attr.shortName.endsWith(".h") || attr.shortName.endsWith(".hpp");
-    }
+void WinGammaPlatform::FileAttribute::add(std::string confName) {
+  configs.push_back(confName);
+  // if presented in all configs
+  if (configs.size() == (size_t)numConfigs) {
+    configs.clear();
+  }
 }
 
 
-TreeSet sortFiles(Hashtable allFiles) {
-    TreeSet rv = new TreeSet();
-    Enumeration e = allFiles.keys();
-    while (e.hasMoreElements()) {
-        std::string fullPath = (std::string)e.nextElement();
-        rv->push_back(new FileInfo(fullPath, (FileAttribute)allFiles.get(fullPath)));
-    }
-    return rv;
+WinGammaPlatform::FileInfo::FileInfo(std::string full, FileAttribute * attr) {
+  this->full = full;
+  this->attr = attr;
 }
 
-Hashtable computeAttributedFiles(std::vector < ? > allConfigs) {
-    Hashtable ht = new Hashtable();
-    int numConfigs = allConfigs.size();
-
-    for (std::vector < ? >::iterator i = allConfigs->begin(); i != ?->end(); ) {
-        BuildConfig bc = (BuildConfig)i.next();
-        Hashtable  confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
-        std::string confName = bc.get("Name");
-
-        for (Enumeration e=confFiles.keys(); e.hasMoreElements(); ) {
-            std::string filePath = (std::string)e.nextElement();
-            FileAttribute fa = (FileAttribute)ht.get(filePath);
-
-            if (fa == NULL) {
-                fa = new FileAttribute((std::string)confFiles.get(filePath), bc, numConfigs);
-                ht.put(filePath, fa);
-            } else {
-                fa->push_back(confName);
-            }
-        }
-    }
-
-    return ht;
+bool WinGammaPlatform::FileInfo::comparison(FileInfo * fi1, FileInfo * fi2) {
+  if (fi1->attr->shortName != fi2->attr->shortName)
+    return (fi1->attr->shortName < fi2->attr->shortName);
+  return (fi1->full < fi2->full);
 }
 
- Hashtable computeAttributedFiles(BuildConfig bc) {
-    Hashtable ht = new Hashtable();
-    Hashtable confFiles = (Hashtable)bc.getSpecificField("AllFilesHash");
-
-    for (Enumeration e = confFiles.keys(); e.hasMoreElements(); ) {
-        std::string filePath = (std::string)e.nextElement();
-        ht.put(filePath,  new FileAttribute((std::string)confFiles.get(filePath), bc, 1));
-    }
-
-    return ht;
+bool WinGammaPlatform::FileInfo::isHeader() {
+  return endsWith(attr->shortName, ".h") || endsWith(attr->shortName, ".hpp");
 }
 
-ofstream &  printWriter;
+std::vector < WinGammaPlatform::FileInfo * > WinGammaPlatform::sortFiles(std::map < std::string, FileAttribute * > allFiles) {
+  std::vector < WinGammaPlatform::FileInfo *> rv;
+  std::map < std::string, FileAttribute * >::iterator it = allFiles.begin();
+  while (it != allFiles.end()) {
+    std::string fullPath = it->first;
+    FileAttribute * attr = it->second;
+    it++;
+    rv.push_back(new FileInfo(fullPath, attr));
+  }
+  std::sort(rv.begin(), rv.end(), &FileInfo::comparison);
+  return rv;
+}
 
-void writeProjectFile(std::string projectFileName, std::string projectName,
-                             std::vector < ? > allConfigs) throw (IOException {
-    throw RuntimeException("use compiler version specific version");
+std::map < std::string, WinGammaPlatform::FileAttribute * > 
+WinGammaPlatform::computeAttributedFiles(std::vector < BuildConfig * > allConfigs) {
+  std::map < std::string, FileAttribute * > ht;
+  int numConfigs = allConfigs.size();
+  for (std::vector < BuildConfig* >::iterator i = allConfigs.begin(); i != allConfigs.end(); ) {
+    BuildConfig * bc = *i++;
+    std::map < std::string, std::string > * confFiles = (std::map < std::string, std::string > *)bc->getSpecificField("AllFilesHash");
+    std::string confName = bc->get("Name");
+    std::map < std::string, std::string >::iterator iter = confFiles->begin();
+    while (iter != confFiles->end()) {
+      std::string filePath = iter->first;
+      std::string value = iter->second;
+      iter++;
+      if (ht.count(filePath) == 0) {
+	ht[filePath] = new FileAttribute(value, bc, numConfigs);
+      } else {
+	ht[filePath]->add(confName);
+      }
+    }
+  }
+  return ht;
 }
+
+std::map < std::string, WinGammaPlatform::FileAttribute * > WinGammaPlatform::computeAttributedFiles(BuildConfig * bc) {
+  std::map < std::string, FileAttribute * > ht;
+  std::map < std::string, std::string > * confFiles = 
+    (std::map < std::string, std::string > *)bc->getSpecificField("AllFilesHash");
+  std::map < std::string, std::string >::iterator iter = confFiles->begin();
+  while (iter != confFiles->end()) {
+    std::string filePath = iter->first;
+    std::string value = iter->second;
+    iter++;
+    ht[filePath] = new FileAttribute(value, bc, 1);
+  }
+  return ht;
 }
+
+void WinGammaPlatform::writeProjectFile(std::string projectFileName, std::string projectName,
+					std::vector < BuildConfig * > allConfigs) throw (IOException) {
+  throw RuntimeException("use compiler version specific version");
+}
--- a/src/share/tools/MakeDeps/WinGammaPlatform.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/WinGammaPlatform.h	Wed Oct 07 14:38:00 2009 -0700
@@ -25,169 +25,179 @@
 #ifndef _MAKEDEPS_WIN_GAMMA_PLATFORM_H_
 #define _MAKEDEPS_WIN_GAMMA_PLATFORM_H_
 
+#include "ArgsParser.h"
+#include "Platform.h"
+#include "Exceptions.h"
 #include <string>
 #include <vector>
+#include <map>
+#include <set>
+#include <fstream>
 
-abstract class HsArgHandler : public ArgHandler {
-    static final int STRING = 1;
-    static final int VECTOR = 2;
-    static final int HASH   = 3;
+class DirectoryTree;
+class BuildConfig;
 
-    bool nextNotKey(ArgIterator it) ;
+/* abstract */ class HsArgHandler : public ArgHandler {
+ public:
+  static const int STRING;
+  static const int VECTOR;
+  static const int HASH;
+ protected:
+  virtual bool nextNotKey(ArgIterator * it) ;
 
-    void empty(std::string key, std::string message) ;
+  virtual void empty(std::string key, std::string message) ;
 
-    static std::string getCfg(std::string val) ;
+  static std::string getCfg(std::string val) ;
 };
 
 class ArgRuleSpecific : public ArgRule {
-    ArgRuleSpecific(std::string arg, ArgHandler handler) ;
+ public:
+  ArgRuleSpecific(std::string arg, ArgHandler * handler) ;
 
-    bool match(std::string rulePattern, std::string arg) ;
+  bool match(std::string rulePattern, std::string arg) ;
 };
 
 
 class SpecificHsArgHandler : public HsArgHandler {
 
-    std::string message, argKey, valKey;
-    int type;
+  std::string message, argKey, valKey;
+  int type;
 
-    public: void handle(ArgIterator it) ;
+ public: virtual void handle(ArgIterator * it) ;
 
-    SpecificHsArgHandler(std::string argKey, std::string valKey, std::string message, int type) ;
+  SpecificHsArgHandler(std::string argKey, std::string valKey, std::string message, int type) ;
 };
 
 
 class HsArgRule : public ArgRuleSpecific {
-
-    HsArgRule(std::string argKey, std::string valKey, std::string message, int type) ;
+ public:
+  HsArgRule(std::string argKey, std::string valKey, std::string message, int type) ;
 
 };
 
 /*abstract*/ class WinGammaPlatform : public Platform {
-    public: void setupFileTemplates() ;
+ protected: WinGammaPlatform() ;
 
-    private: static std::vector < std::string > suffixes = { ".cpp", ".c" };
+ public: virtual void setupFileTemplates() ;
 
-    public: std::vector < std::string > outerSuffixes() ;
+ private: static std::vector < std::string > suffixes;
 
-    public: std::string objFileSuffix() ;
+ public: virtual std::vector < std::string > outerSuffixes() ;
 
-    public: std::string asmFileSuffix() ;
+ public: virtual std::string objFileSuffix() ;
 
-    public: std::string dependentPrefix() ;
+ public: virtual std::string asmFileSuffix() ;
 
-    public: bool includeGIInEachIncl() ;
+ public: virtual std::string dependentPrefix() ;
 
-    public: bool fileNameStringEquality(std::string s1, std::string s2) ;
+ public: virtual bool includeGIInEachIncl() ;
 
-    static void usage() throw (IllegalArgumentException) ;
+ public: virtual bool fileNameStringEquality(std::string s1, std::string s2) ;
 
+  static void usage() throw (IllegalArgumentException) ;
 
-    public: void addPerFileLine(Hashtable table,
-                               std::string fileName,
-                               std::string line) ;
+ public: virtual void addPerFileLine(std::map < std::string, std::vector < std::string > > table,
+				     std::string fileName,
+				     std::string line) ;
 
-    protected: static class PerFileCondData {
-        public: std::string releaseString;
-        public: std::string debugString;
-    }
+ protected: class PerFileCondData {
+  public: std::string releaseString;
+  public: std::string debugString;
+  };
 
-    protected: void addConditionalPerFileLine(Hashtable table,
-                                           std::string fileName,
-                                           std::string releaseLine,
-                                           std::string debugLine) ;
+ protected: virtual void addConditionalPerFileLine(std::map < std::string, std::vector < PerFileCondData * > > table,
+						   std::string fileName,
+						   std::string releaseLine,
+						   std::string debugLine) ;
 
-    protected: static class PrelinkCommandData {
-      std::string description;
-      std::string commands;
-    }
+ protected: class PrelinkCommandData {
+  public:
+    std::string description;
+    std::string commands;
+  };
 
-    protected: void addPrelinkCommand(Hashtable table,
-                                     std::string build,
-                                     std::string description,
-                                     std::string commands) ;
+ protected: virtual void addPrelinkCommand(std::map < std::string, PrelinkCommandData * > table,
+					   std::string build,
+					   std::string description,
+					   std::string commands) ;
 
-    public: bool findString(std::vector < ? > v, std::string s) ;
+ public: virtual bool findString(std::vector < std::string > * v, std::string s) ;
 	
-    /* This returns a std::string containing the full path to the passed
-       file name, or null if an error occurred. If the file was not
-       found or was a duplicate and couldn't be resolved using the
-       preferred paths, the file name is added to the appropriate
-       std::vector < ? > of Strings. */
-    private: std::string findFileInDirectory(std::string fileName,
-                                       DirectoryTree directory,
-                                       std::vector < ? > preferredPaths,
-                                       std::vector < ? > filesNotFound,
-                                       std::vector < ? > filesDuplicate) ;
+  /* This returns a std::string containing the full path to the passed
+     file name, or null if an error occurred. If the file was not
+     found or was a duplicate and couldn't be resolved using the
+     preferred paths, the file name is added to the appropriate
+     std::vector < std::string > . */
+ private: virtual std::string findFileInDirectory(std::string fileName,
+						  DirectoryTree * directory,
+						  std::vector < std::string > * preferredPaths,
+						  std::vector < std::string > * filesNotFound,
+						  std::vector < std::string > * filesDuplicate) ;
 
-    protected: bool databaseAllFilesEqual(Database previousDB,
-                                            Database currentDB) ;
+ protected: virtual bool databaseAllFilesEqual(Database * previousDB,
+					       Database * currentDB) ;
 
-    protected: std::string envVarPrefixedFileName(std::string fileName,
-                                            int sourceBaseLen,
-                                            DirectoryTree tree,
-                                            std::vector < ? > preferredPaths,
-                                            std::vector < ? > filesNotFound,
-                                            std::vector < ? > filesDuplicate) ;
+ public: virtual std::string envVarPrefixedFileName(std::string fileName,
+						       int sourceBaseLen,
+						       DirectoryTree * tree,
+						       std::vector < std::string > * preferredPaths,
+						       std::vector < std::string > * filesNotFound,
+						       std::vector < std::string > * filesDuplicate) ;
 
-     std::string getProjectName(std::string fullPath, std::string extension)
-        throw (IllegalArgumentException, IOException) ;
+ protected: virtual std::string getProjectName(std::string fullPath, std::string extension)
+    throw (IllegalArgumentException, IOException) ;
 
-    protected: virtual /*abstract*/ std::string getProjectExt();
+ protected: virtual /*abstract*/ std::string getProjectExt() = 0;
 
-    public: void writePlatformSpecificFiles(Database previousDB,
-                                           Database currentDB, std::vector < std::string > args)
-        throw (IllegalArgumentException, IOException) ;
+ public: virtual void writePlatformSpecificFiles(Database * previousDB,
+						 Database * currentDB, std::vector < std::string > args)
+    throw (IllegalArgumentException, IOException) ;
 
-    protected: void writePrologue(std::vector < std::string > args) ;
+ protected: virtual void writePrologue(std::vector < std::string > args) ;
 
+ public:
+  virtual void setInclFileTemplate(FileName * val) ;
 
-    void setInclFileTemplate(FileName val) ;
+  virtual void setGIFileTemplate(FileName * val) ;
 
-    void setGIFileTemplate(FileName val) ;
+ protected:
+  virtual void parseArguments(std::vector < std::string > args) ;
 
+  virtual std::vector < BuildConfig * > createAllConfigs() ;
 
-    void parseArguments(std::vector < std::string > args) ;
+  class FileAttribute {
+  public:
+    int     numConfigs;
+    std::vector < std::string >  configs;
+    std::string  shortName;
+    bool noPch, pchRoot;
 
-    std::vector < ? > createAllConfigs() ;
+    FileAttribute(std::string shortName, BuildConfig * cfg, int numConfigs) ;
 
-    class FileAttribute {
-        int     numConfigs;
-        std::vector < ? >  configs;
-        std::string  shortName;
-        bool noPch, pchRoot;
+    void add(std::string confName) ;
+  };
 
-        FileAttribute(std::string shortName, BuildConfig cfg, int numConfigs) ;
+  class FileInfo {
+  public:
+    std::string full;
+    FileAttribute * attr;
 
-        void add(std::string confName) ;
-    }
+    FileInfo(std::string full, FileAttribute * attr);
 
-    class FileInfo implements Comparable {
-        std::string        full;
-        FileAttribute attr;
+    static bool comparison(FileInfo * fi1, FileInfo * fi2);
 
-        FileInfo(std::string full, FileAttribute  attr) {
-            this->full = full;
-            this->attr = attr;
-        }
+    bool isHeader() ;
+  };
 
-        public: int compareTo(Object o) ;
 
-        bool isHeader() ;
-    }
+  virtual std::vector < FileInfo * > sortFiles(std::map < std::string, FileAttribute * > allFiles) ;
 
+  virtual std::map < std::string, FileAttribute * > computeAttributedFiles(std::vector < BuildConfig * > allConfigs) ;
 
-    TreeSet sortFiles(Hashtable allFiles) ;
+  virtual std::map < std::string, FileAttribute * > computeAttributedFiles(BuildConfig * bc) ;
 
-    Hashtable computeAttributedFiles(std::vector < ? > allConfigs) ;
-
-     Hashtable computeAttributedFiles(BuildConfig bc) ;
-
-    ofstream &  printWriter;
-
-    public: void writeProjectFile(std::string projectFileName, std::string projectName,
-                                 std::vector < ? > allConfigs) throw (IOException) ;
+ public: virtual void writeProjectFile(std::string projectFileName, std::string projectName,
+				       std::vector < BuildConfig * > allConfigs) throw (IOException) ;
 };
 
 #endif // _MAKEDEPS_WIN_GAMMA_PLATFORM_H_
--- a/src/share/tools/MakeDeps/WinGammaPlatformVC6.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/WinGammaPlatformVC6.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -22,271 +22,262 @@
  *
  */
 
-#include "WinGammaPlatformVC6.cpp"
+#include "WinGammaPlatformVC6.h"
+#include "Util.h"
 #include <string>
 #include <vector>
+#include <sstream>
+#include <algorithm>
 
-class WinGammaPlatformVC6 : public WinGammaPlatform {
-void writeProjectFile(std::string projectFileName, std::string projectName,
-                             std::vector < ? > allConfigs) throw (IOException {
-    std::vector < ? > allConfigNames = new std::vector < ? >();
+void WinGammaPlatformVC6::writeProjectFile(std::string projectFileName, std::string projectName,
+					   std::vector < BuildConfig * > allConfigs) throw (IOException) {
+  printWriter = new std::ofstream(projectFileName.c_str());
+  std::string cfg = allConfigs[0]->get("Name");
 
-    printWriter = new ofstream & (new FileWriter(projectFileName));
-    std::string cfg = ((BuildConfig)allConfigs.get(0)).get("Name");
+  (*printWriter) << "# Microsoft Developer Studio Project File - Name=\"" << projectName << "\" - Package Owner=<4>" << std::endl;
+  (*printWriter) << "# Microsoft Developer Studio Generated Build File, Format Version 6.00" << std::endl;
+  (*printWriter) << "# ** DO NOT EDIT **" << std::endl;
+  (*printWriter) << "" << std::endl;
+  (*printWriter) << "# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102" << std::endl;
+  (*printWriter) << "CFG=" << cfg << std::endl;
+  (*printWriter) << "" << std::endl;
 
-    printWriter << ln("# Microsoft Developer Studio Project File - Name=\"" + projectName + "\" - Package Owner=<4>");
-    printWriter << ln("# Microsoft Developer Studio Generated Build File, Format Version 6.00");
-    printWriter << ln("# ** DO NOT EDIT **");
-    printWriter << ln("");
-    printWriter << ln("# TARGTYPE \"Win32 (x86) Dynamic-Link Library\" 0x0102");
-    printWriter << ln("CFG=" + cfg);
-    printWriter << ln("");
+  (*printWriter) << "!MESSAGE This is not a valid makefile. To build this project using NMAKE," << std::endl;
+  (*printWriter) << "!MESSAGE use the Export Makefile command and run" << std::endl;
+  (*printWriter) << "!MESSAGE " << std::endl;
+  (*printWriter) << "!MESSAGE NMAKE /f \"" << projectName << ".mak\"." << std::endl;
+  (*printWriter) << "!MESSAGE " << std::endl;
+  (*printWriter) << "!MESSAGE You can specify a configuration when running NMAKE" << std::endl;
+  (*printWriter) << "!MESSAGE by defining the macro CFG on the command line. For example:" << std::endl;
+  (*printWriter) << "!MESSAGE " << std::endl;
+  (*printWriter) << "!MESSAGE NMAKE /f \"" << projectName << ".mak\" CFG=\"" << cfg << "\"" << std::endl;
+  (*printWriter) << "!MESSAGE " << std::endl;
+  (*printWriter) << "!MESSAGE Possible choices for configuration are:" << std::endl;
+  (*printWriter) << "!MESSAGE " << std::endl;
+  std::vector < std::string > allConfigNames;
+  for (std::vector < BuildConfig * >::iterator i = allConfigs.begin(); i != allConfigs.end(); i++) {
+    std::string name = (*i)->get("Name");
+    (*printWriter) << "!MESSAGE \"" << name << "\" (based on \"Win32 (x86) Dynamic-Link Library\")" << std::endl;
+    allConfigNames.push_back(name);
+  }
+  (*printWriter) << "!MESSAGE " << std::endl;
+  (*printWriter) << "" << std::endl;
 
-    printWriter << ln("!MESSAGE This is not a valid makefile. To build this project using NMAKE,");
-    printWriter << ln("!MESSAGE use the Export Makefile command and run");
-    printWriter << ln("!MESSAGE ");
-    printWriter << ln("!MESSAGE NMAKE /f \"" + projectName + ".mak\".");
-    printWriter << ln("!MESSAGE ");
-    printWriter << ln("!MESSAGE You can specify a configuration when running NMAKE");
-    printWriter << ln("!MESSAGE by defining the macro CFG on the command line. For example:");
-    printWriter << ln("!MESSAGE ");
-    printWriter << ln("!MESSAGE NMAKE /f \"" + projectName + ".mak\" CFG=\"" + cfg + "\"");
-    printWriter << ln("!MESSAGE ");
-    printWriter << ln("!MESSAGE Possible choices for configuration are:");
-    printWriter << ln("!MESSAGE ");
-    for (std::vector < ? >::iterator i = allConfigs->begin(); i != ?->end(); ) {
-        std::string name = ((BuildConfig)i.next()).get("Name");
-        printWriter << ln("!MESSAGE \""+ name + "\" (based on \"Win32 (x86) Dynamic-Link Library\")");
-        allConfigNames->push_back(name);
+  (*printWriter) << "# Begin Project" << std::endl;
+  (*printWriter) << "# PROP AllowPerConfigDependencies 0" << std::endl;
+  (*printWriter) << "# PROP Scc_ProjName \"\"" << std::endl;
+  (*printWriter) << "# PROP Scc_LocalPath \"\"" << std::endl;
+  (*printWriter) << "CPP=cl.exe" << std::endl;
+  (*printWriter) << "MTL=midl.exe" << std::endl;
+  (*printWriter) << "RSC=rc.exe" << std::endl;
+
+  std::string keyword = "!IF";
+  for (std::vector < BuildConfig * >::iterator i = allConfigs.begin(); i != allConfigs.end(); i++) {
+    BuildConfig * bcfg = *i;
+    (*printWriter) << keyword << "  \"$(CFG)\" == \"" << bcfg->get("Name") << "\"" << std::endl;
+    writeConfigHeader(bcfg);
+    keyword = "!ELSEIF";
+    if (i == allConfigs.end()) (*printWriter) << "!ENDIF" << std::endl;
+  }
+
+  std::vector < FileInfo * > sortedFiles = sortFiles(computeAttributedFiles(allConfigs));
+
+  (*printWriter) << "# Begin Target" << std::endl;
+
+  for (std::vector < BuildConfig* >::iterator i = allConfigs.begin(); i != allConfigs.end(); i++) {
+    (*printWriter) << "# Name \"" << (*i)->get("Name") << "\"" << std::endl;
+  }
+  (*printWriter) << "# Begin Group \"Header Files\"" << std::endl;
+  (*printWriter) << "# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\"" << std::endl;
+
+  std::vector < FileInfo * >::iterator i = sortedFiles.begin();
+  while (i != sortedFiles.end()) {
+    FileInfo * fi = *i++;
+    // skip sources
+    if (!fi->isHeader()) {
+      continue;
     }
-    printWriter << ln("!MESSAGE ");
-    printWriter << ln("");
+    printFile(fi, allConfigNames);
+  }
+  (*printWriter) << "# End Group" << std::endl;
+  (*printWriter) << "" << std::endl;
 
-    printWriter << ln("# Begin Project");
-    printWriter << ln("# PROP AllowPerConfigDependencies 0");
-    printWriter << ln("# PROP Scc_ProjName \"\"");
-    printWriter << ln("# PROP Scc_LocalPath \"\"");
-    printWriter << ln("CPP=cl.exe");
-    printWriter << ln("MTL=midl.exe");
-    printWriter << ln("RSC=rc.exe");
+  (*printWriter) << "# Begin Group \"Source Files\"" << std::endl;
+  (*printWriter) << "# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90\"" << std::endl;
 
+  i = sortedFiles.begin();
+  while (i != sortedFiles.end()) {
+    FileInfo * fi = *i++;
+    // skip headers
+    if (fi->isHeader()) {
+      continue;
+    }
+    printFile(fi, allConfigNames);
+  }
+  (*printWriter) << "# End Group" << std::endl;
+  (*printWriter) << "" << std::endl;
 
-    std::string keyword = "!IF";
-    for (std::vector < ? >::iterator i = allConfigs->begin(); i != ?->end(); ) {
-        BuildConfig bcfg = (BuildConfig)i.next();
-        printWriter << ln(keyword + "  \"$(CFG)\" == \"" + bcfg.get("Name") + "\"");
-        writeConfigHeader(bcfg);
-        keyword = "!ELSEIF";
-        if (!i != ?->end()) printWriter << ln("!ENDIF");
-    }
+  (*printWriter) << "# Begin Group \"Resource Files\"" << std::endl;
+  (*printWriter) << "# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\"" << std::endl;
+  (*printWriter) << "# End Group" << std::endl;
+  (*printWriter) << "" << std::endl;
+  (*printWriter) << "# End Target" << std::endl;
 
+  (*printWriter) << "# End Project" << std::endl;
 
-    TreeSet sortedFiles = sortFiles(computeAttributedFiles(allConfigs));
-
-    printWriter << ln("# Begin Target");
-
-    for (std::vector < ? >::iterator i = allConfigs->begin(); i != ?->end(); ) {
-        printWriter << ln("# Name \"" + ((BuildConfig)i.next()).get("Name") + "\"");
-    }
-    printWriter << ln("# Begin Group \"Header Files\"");
-    printWriter << ln("# PROP Default_Filter \"h;hpp;hxx;hm;inl;fi;fd\"");
-
-    std::vector < ? >::iterator i = sortedFiles->begin();
-
-    while (i != ?->end()) {
-        FileInfo fi = (FileInfo)i.next();
-
-        // skip sources
-        if (!fi.isHeader()) {
-            continue;
-        }
-
-        printFile(fi, allConfigNames);
-    }
-    printWriter << ln("# End Group");
-    printWriter << ln("");
-
-    printWriter << ln("# Begin Group \"Source Files\"");
-    printWriter << ln("# PROP Default_Filter \"cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90\"");
-
-    i = sortedFiles->begin();
-    while (i != ?->end()) {
-        FileInfo fi = (FileInfo)i.next();
-
-        // skip headers
-        if (fi.isHeader()) {
-            continue;
-        }
-
-        printFile(fi, allConfigNames);
-    }
-    printWriter << ln("# End Group");
-    printWriter << ln("");
-
-
-    printWriter << ln("# Begin Group \"Resource Files\"");
-    printWriter << ln("# PROP Default_Filter \"ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe\"");
-    printWriter << ln("# End Group");
-    printWriter << ln("");
-    printWriter << ln("# End Target");
-
-    printWriter << ln("# End Project");
-
-    printWriter.close();
+  (*printWriter) << std::flush;
+  delete printWriter;
 }
 
 
-void printFile(FileInfo fi, std::vector < ? > allConfigNames) {
-    printWriter << ln("# Begin Source File");
-    printWriter << ln("");
-    printWriter << ln("SOURCE=\"" + fi.full + "\"");
-    FileAttribute attr = fi.attr;
-
-    if (attr.noPch) {
-        printWriter << ln("# SUBTRACT CPP /YX /Yc /Yu");
+void WinGammaPlatformVC6::printFile(FileInfo * fi, std::vector < std::string > allConfigNames) {
+  (*printWriter) << "# Begin Source File" << std::endl;
+  (*printWriter) << "" << std::endl;
+  (*printWriter) << "SOURCE=\"" << fi->full << "\"" << std::endl;
+  FileAttribute * attr = fi->attr;
+  if (attr->noPch) {
+    (*printWriter) << "# SUBTRACT CPP /YX /Yc /Yu" << std::endl;
+  }
+  if (attr->pchRoot) {
+    (*printWriter) << "# ADD CPP /Yc\"incls/_precompiled.incl\"" << std::endl;
+  }
+  if (!attr->configs.empty()) {
+    std::string keyword = "!IF";
+    for (std::vector < std::string >::iterator j=allConfigNames.begin(); j != allConfigNames.end();) {
+      std::string cfg = *j++;
+      if (std::find(attr->configs.begin(), attr->configs.end(), cfg) == attr->configs.end()) {
+	(*printWriter) << keyword <<" \"$(CFG)\" == \"" << cfg <<"\"" << std::endl;
+	(*printWriter) << "# PROP BASE Exclude_From_Build 1" << std::endl;
+	(*printWriter) << "# PROP Exclude_From_Build 1" << std::endl;
+	keyword = "!ELSEIF";
+      }
     }
-
-    if (attr.pchRoot) {
-        printWriter << ln("# ADD CPP /Yc\"incls/_precompiled.incl\"");
-    }
-    if (attr.configs != NULL) {
-        std::string keyword = "!IF";
-        for (std::vector < ? >::iterator j=allConfigNames->begin(); j != ?->end();) {
-            std::string cfg = (std::string)j.next();
-            if (!attr.configs.contains(cfg)) {
-                printWriter << ln(keyword+" \"$(CFG)\" == \"" + cfg +"\"");
-                printWriter << ln("# PROP BASE Exclude_From_Build 1");
-                printWriter << ln("# PROP Exclude_From_Build 1");
-                keyword = "!ELSEIF";
-            }
-        }
-        printWriter << ln("!ENDIF");
-    }
-
-    printWriter << ln("# End Source File");
+    (*printWriter) << "!ENDIF" << std::endl;
+  }
+  (*printWriter) << "# End Source File" << std::endl;
 }
 
-void writeConfigHeader(BuildConfig cfg) {
-    printWriter << ln("# Begin Special Build Tool");
-    printWriter << ln("SOURCE=\"$(InputPath)\"");
-    printWriter << ln("PreLink_Desc=" +  BuildConfig.getFieldString(NULL, "PrelinkDescription"));
-    printWriter << ln("PreLink_Cmds=" +
-                        cfg.expandFormat(BuildConfig.getFieldString(NULL, "PrelinkCommand")));
-    printWriter << ln("# End Special Build Tool");
-    printWriter << ln("");
-
-    for (std::vector < ? >::iterator i = cfg.getV("CompilerFlags")->begin(); i != ?->end(); ) {
-        printWriter << ln("# "+(std::string)i.next());
-    }
-
-
-    printWriter << ln("LINK32=link.exe");
-
-    for (std::vector < ? >::iterator i = cfg.getV("LinkerFlags")->begin(); i != ?->end(); ) {
-        printWriter << ln("# "+(std::string)i.next());
-    }
-
-    printWriter << ln("ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32");
-    printWriter << ln("ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32");
-    printWriter << ln("ADD BASE RSC /l 0x409 /d \"_DEBUG\"");
-    printWriter << ln("ADD RSC /l 0x409 /d \"_DEBUG\"");
-    printWriter << ln("BSC32=bscmake.exe");
-    printWriter << ln("ADD BASE BSC32 /nologo");
-    printWriter << ln("ADD BSC32 /nologo");
-    printWriter << ln("");
+void WinGammaPlatformVC6::writeConfigHeader(BuildConfig * cfg) {
+  (*printWriter) << "# Begin Special Build Tool" << std::endl;
+  (*printWriter) << "SOURCE=\"$(InputPath)\"" << std::endl;
+  (*printWriter) << "PreLink_Desc="
+	      << BuildConfig::getFieldString(NULL, "PrelinkDescription") << std::endl;
+  (*printWriter) << "PreLink_Cmds=" 
+	      << cfg->expandFormat(BuildConfig::getFieldString(NULL, "PrelinkCommand")) << std::endl;
+  (*printWriter) << "# End Special Build Tool" << std::endl;
+  (*printWriter) << "" << std::endl;
+  std::vector < std::string > * compilerFlags = cfg->getV("CompilerFlags");
+  for (std::vector < std::string >::iterator i = compilerFlags->begin(); i != compilerFlags->end(); i++) {
+    (*printWriter) << "# " << *i << std::endl;
+  }
+  (*printWriter) << "LINK32=link.exe" << std::endl;
+  std::vector < std::string > * linkerFlags = cfg->getV("LinkerFlags");
+  for (std::vector < std::string >::iterator i = linkerFlags->begin(); i != linkerFlags->end(); i++) {
+    (*printWriter) << "# " << *i << std::endl;
+  }
+  (*printWriter) << "ADD BASE MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32" << std::endl;
+  (*printWriter) << "ADD MTL /nologo /D \"_DEBUG\" /mktyplib203 /win32" << std::endl;
+  (*printWriter) << "ADD BASE RSC /l 0x409 /d \"_DEBUG\"" << std::endl;
+  (*printWriter) << "ADD RSC /l 0x409 /d \"_DEBUG\"" << std::endl;
+  (*printWriter) << "BSC32=bscmake.exe" << std::endl;
+  (*printWriter) << "ADD BASE BSC32 /nologo" << std::endl;
+  (*printWriter) << "ADD BSC32 /nologo" << std::endl;
+  (*printWriter) << "" << std::endl;
 }
 
-std::string getProjectExt() {
-    return ".dsp";
-}
+std::string WinGammaPlatformVC6::getProjectExt() {
+  return ".dsp";
 }
 
 
-class CompilerInterfaceVC6  : public CompilerInterface {
-std::vector < ? > getBaseCompilerFlags(std::vector < ? > defines, std::vector < ? > includes, std::string outDir) {
-    std::vector < ? > rv = new std::vector < ? >();
-
-    rv->push_back("PROP BASE Use_MFC 0");
-    rv->push_back("PROP Use_MFC 0");
-    rv->push_back("ADD CPP /nologo /MT /W3 /WX /GX /YX /Fr /FD /c");
-    rv->push_back("PROP BASE Output_Dir \""+outDir+"\"");
-    rv->push_back("PROP Output_Dir \""+outDir+"\"");
-    rv->push_back("PROP BASE Intermediate_Dir \""+outDir+"\"");
-    rv->push_back("PROP Intermediate_Dir \""+outDir+"\"");
-    rv->push_back("PROP BASE Target_Dir \"\"");
-    rv->push_back("PROP Target_Dir \"\"");
-    rv->push_back("ADD BASE CPP "+Util.prefixed_join(" /I ", includes, true));
-    rv->push_back("ADD CPP "+Util.prefixed_join(" /I ", includes, true));
-    rv->push_back("ADD BASE CPP "+Util.prefixed_join(" /D ", defines, true));
-    rv->push_back("ADD CPP "+Util.prefixed_join(" /D ", defines, true));
-    rv->push_back("ADD CPP /Yu\"incls/_precompiled.incl\"");
-
-    return rv;
+std::vector < std::string > CompilerInterfaceVC6::getBaseCompilerFlags(std::vector < std::string > defines, std::vector < std::string > includes, std::string outDir) {
+  std::vector < std::string > rv;
+  rv.push_back("PROP BASE Use_MFC 0");
+  rv.push_back("PROP Use_MFC 0");
+  rv.push_back("ADD CPP /nologo /MT /W3 /WX /GX /YX /Fr /FD /c");
+  std::ostringstream baseOutput; baseOutput << "PROP BASE Output_Dir \"" << outDir << "\"";
+  rv.push_back(baseOutput.str());
+  std::ostringstream output; output << "PROP Output_Dir \"" << outDir << "\"";
+  rv.push_back(output.str());
+  std::ostringstream baseIntermediate; baseIntermediate << "PROP BASE Intermediate_Dir \"" << outDir << "\"";
+  rv.push_back(baseIntermediate.str());
+  std::ostringstream intermediate; intermediate << "PROP Intermediate_Dir \"" << outDir << "\"";
+  rv.push_back(intermediate.str());
+  rv.push_back("PROP BASE Target_Dir \"\"");
+  rv.push_back("PROP Target_Dir \"\"");
+  std::ostringstream baseI; baseI << "ADD BASE CPP " << Util::prefixed_join(" /I ", includes, true);
+  rv.push_back(baseI.str());
+  std::ostringstream cppI; cppI << "ADD CPP " << Util::prefixed_join(" /I ", includes, true);
+  rv.push_back(cppI.str());
+  std::ostringstream baseD; baseD << "ADD BASE CPP " << Util::prefixed_join(" /D ", defines, true);
+  rv.push_back(baseD.str());
+  std::ostringstream cppD; cppD << "ADD CPP " << Util::prefixed_join(" /D ", defines, true);
+  rv.push_back(cppD.str());
+  rv.push_back("ADD CPP /Yu\"incls/_precompiled.incl\"");
+  return rv;
 }
 
-std::vector < ? > getBaseLinkerFlags(std::string outDir, std::string outDll) {
-    std::vector < ? > rv = new std::vector < ? >();
-
-    rv->push_back("PROP Ignore_Export_Lib 0");
-    rv->push_back("ADD BASE CPP /MD");
-    rv->push_back("ADD CPP /MD");
-    rv->push_back("ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib " +
-           "           advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib");
-    rv->push_back("ADD LINK32      /out:\""+outDll+"\" "+
-           "                /nologo /subsystem:windows /machine:I386" +
-           "                /nologo /base:\"0x8000000\" /subsystem:windows /dll" +
-           "                /export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM /export:JNI_GetCreatedJavaVMs "+
-           "                /export:jio_snprintf /export:jio_printf /export:jio_fprintf /export:jio_vfprintf "+
-           "                /export:jio_vsnprintf ");
-    rv->push_back("SUBTRACT LINK32 /pdb:none /map");
-
-    return rv;
+std::vector < std::string > CompilerInterfaceVC6::getBaseLinkerFlags(std::string outDir, std::string outDll) {
+  std::vector < std::string > rv;
+  rv.push_back("PROP Ignore_Export_Lib 0");
+  rv.push_back("ADD BASE CPP /MD");
+  rv.push_back("ADD CPP /MD");
+  std::ostringstream addLinkLibs;
+  addLinkLibs << "ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib "
+	      << "           advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib";
+  rv.push_back(addLinkLibs.str());
+  std::ostringstream addLinkFlags;
+  addLinkFlags << "ADD LINK32      /out:\"" << outDll << "\" " << 
+    "                /nologo /subsystem:windows /machine:I386"  << 
+    "                /nologo /base:\"0x8000000\" /subsystem:windows /dll"  << 
+    "                /export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM /export:JNI_GetCreatedJavaVMs " << 
+    "                /export:jio_snprintf /export:jio_printf /export:jio_fprintf /export:jio_vfprintf " << 
+    "                /export:jio_vsnprintf ";
+  rv.push_back(addLinkFlags.str());
+  rv.push_back("SUBTRACT LINK32 /pdb:none /map");
+  return rv;
 }
 
-std::vector < ? > getDebugCompilerFlags(std::string opt) {
-    std::vector < ? > rv = new std::vector < ? >();
-
-    rv->push_back("ADD BASE CPP /Gm /Zi /O"+opt);
-
-    return rv;
+std::vector < std::string > CompilerInterfaceVC6::getDebugCompilerFlags(std::string opt) {
+  std::vector < std::string > rv;
+  std::ostringstream base; base << "ADD BASE CPP /Gm /Zi /O" << opt;
+  rv.push_back(base.str());
+  return rv;
 }
 
-std::vector < ? > getDebugLinkerFlags() {
-    std::vector < ? > rv = new std::vector < ? >();
-
-    rv->push_back("PROP BASE Use_Debug_Libraries 1");
-    rv->push_back("PROP Use_Debug_Libraries 1");
-    rv->push_back("ADD LINK32 /debug");
-
-    return rv;
+std::vector < std::string > CompilerInterfaceVC6::getDebugLinkerFlags() {
+  std::vector < std::string > rv;
+  rv.push_back("PROP BASE Use_Debug_Libraries 1");
+  rv.push_back("PROP Use_Debug_Libraries 1");
+  rv.push_back("ADD LINK32 /debug");
+  return rv;
 }
 
-std::vector < ? > getProductCompilerFlags() {
-    std::vector < ? > rv = new std::vector < ? >();
-
-    rv->push_back("ADD CPP /O"+getOptFlag());
-
-    return rv;
+std::vector < std::string > CompilerInterfaceVC6::getProductCompilerFlags() {
+  std::vector < std::string > rv;
+  std::ostringstream cpp; cpp << "ADD CPP /O" << getOptFlag();
+  rv.push_back(cpp.str());
+  return rv;
 }
 
-std::vector < ? > getProductLinkerFlags() {
-    std::vector < ? > rv = new std::vector < ? >();
-
-    rv->push_back("PROP BASE Use_Debug_Libraries 0");
-    rv->push_back("PROP Use_Debug_Libraries 0");
-
-    return rv;
+std::vector < std::string > CompilerInterfaceVC6::getProductLinkerFlags() {
+  std::vector < std::string > rv;
+  rv.push_back("PROP BASE Use_Debug_Libraries 0");
+  rv.push_back("PROP Use_Debug_Libraries 0");
+  return rv;
 }
 
-std::string getOptFlag() {
-    return "2";
+std::string CompilerInterfaceVC6::getOptFlag() {
+  return "2";
 }
 
-std::string getNoOptFlag() {
-    return "d";
+std::string CompilerInterfaceVC6::getNoOptFlag() {
+  return "d";
 }
 
-std::string makeCfgName(std::string flavourBuild) {
-    return "vm - "+ Util.os + " " + flavourBuild;
+std::string CompilerInterfaceVC6::makeCfgName(std::string flavourBuild) {
+  std::ostringstream cfgName;
+  cfgName << "vm - " << Util::os << " " << flavourBuild;
+  return cfgName.str();
 }
-}
+
--- a/src/share/tools/MakeDeps/WinGammaPlatformVC6.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/WinGammaPlatformVC6.h	Wed Oct 07 14:38:00 2009 -0700
@@ -27,32 +27,38 @@
 
 #include <string>
 #include <vector>
+#include "BuildConfig.h"
+#include "WinGammaPlatform.h"
 
 class WinGammaPlatformVC6 : public WinGammaPlatform {
+
+    std::ofstream * printWriter;
+
     public: void writeProjectFile(std::string projectFileName, std::string projectName,
-                                 std::vector < ? > allConfigs) throw (IOException) ;
+                                 std::vector < BuildConfig * > allConfigs) throw (IOException) ;
 
+    void printFile(FileInfo * fi, std::vector < std::string > allConfigNames) ;
 
-    void printFile(FileInfo fi, std::vector < ? > allConfigNames) ;
-
-    void writeConfigHeader(BuildConfig cfg) ;
+    void writeConfigHeader(BuildConfig * cfg) ;
 
     protected: std::string getProjectExt() ;
+
 };
 
 
 class CompilerInterfaceVC6  : public CompilerInterface {
-    std::vector < ? > getBaseCompilerFlags(std::vector < ? > defines, std::vector < ? > includes, std::string outDir) ;
 
-    std::vector < ? > getBaseLinkerFlags(std::string outDir, std::string outDll) ;
+    std::vector < std::string > getBaseCompilerFlags(std::vector < std::string > defines, std::vector < std::string > includes, std::string outDir) ;
 
-    std::vector < ? > getDebugCompilerFlags(std::string opt) ;
+    std::vector < std::string > getBaseLinkerFlags(std::string outDir, std::string outDll) ;
 
-    std::vector < ? > getDebugLinkerFlags() ;
+    std::vector < std::string > getDebugCompilerFlags(std::string opt) ;
 
-    std::vector < ? > getProductCompilerFlags() ;
+    std::vector < std::string > getDebugLinkerFlags() ;
 
-    std::vector < ? > getProductLinkerFlags() ;
+    std::vector < std::string > getProductCompilerFlags() ;
+
+    std::vector < std::string > getProductLinkerFlags() ;
 
     std::string getOptFlag() ;
 
--- a/src/share/tools/MakeDeps/WinGammaPlatformVC7.cpp	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/WinGammaPlatformVC7.cpp	Wed Oct 07 14:38:00 2009 -0700
@@ -23,173 +23,164 @@
  */
 
 #include "WinGammaPlatformVC7.h"
+#include "Util.h"
 #include <string>
 #include <vector>
+#include <sstream>
+#include <iostream>
+#include <cstdarg>
 
-class WinGammaPlatformVC7 : public WinGammaPlatform {
-
-void writeProjectFile(std::string projectFileName, std::string projectName,
-                             std::vector < ? > allConfigs) throw (IOException {
-    std::cout << std::endl; 
-    std::cout << ln("    Writing .vcproj file...");
-    // If we got this far without an error, we're safe to actually
-    // write the .vcproj file
-    printWriter = new ofstream & (new FileWriter(projectFileName));
-
-    printWriter << ln("<?xml version=\"1.0\" encoding=\"windows-1251\"?>");
-    startTag(
-        "VisualStudioProject",
-        new std::vector < std::string > {
-            "ProjectType", "Visual C++",
-            "Version", "7.10",
-            "Name", projectName,
-            "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}",
-            "SccProjectName", "",
-            "SccLocalPath", ""
-        }
-        );
-
-    startTag("Platforms", NULL);
-    tag("Platform", new std::vector < std::string > {"Name", Util.os});
-    endTag("Platforms");
-
-    startTag("Configurations", NULL);
-
-    for (std::vector < ? >::iterator i = allConfigs->begin(); i != ?->end(); ) {
-        writeConfiguration((BuildConfig)i.next());
-    }
-
-    endTag("Configurations");
-
-    tag("References", NULL);
-
-    writeFiles(allConfigs);
-
-    tag("Globals", NULL);
-
-    endTag("VisualStudioProject");
-    printWriter.close();
-
-    std::cout << ln("    Done.");
+std::vector < std::string > strings(const char * s1, ...) {
+  std::vector < std::string > result;
+  va_list argptr;
+  va_start(argptr, s1);
+  while (s1 != NULL) {
+    const char * s = va_arg(argptr, const char *);
+    result.push_back(s);
+  }
+  va_end(argptr);
+  return result;
 }
 
+void WinGammaPlatformVC7::writeProjectFile(std::string projectFileName, std::string projectName,
+					   std::vector < BuildConfig * > allConfigs) throw (IOException) {
+  std::cout << std::endl; 
+  std::cout << "    Writing .vcproj file..." << std::endl;
+  // If we got this far without an error, we're safe to actually
+  // write the .vcproj file
+  printWriter = new std::ofstream(projectFileName.c_str());
 
-virtual /*abstract*/ class NameFilter {
-    std::string fname;
+  (*printWriter) << "<?xml version=\"1.0\" encoding=\"windows-1251\"?>" << std::endl;
 
-    virtual /*abstract*/ bool match(FileInfo fi);
+  startTag("VisualStudioProject", 
+	   strings("ProjectType", "Visual C++",
+		   "Version", "7.10",
+		   "Name", projectName.c_str(),
+		   "ProjectGUID", "{8822CB5C-1C41-41C2-8493-9F6E1994338B}",
+		   "SccProjectName", "",
+		   "SccLocalPath", ""));
 
-    std::string  filterString() { return ""; }
-    std::string name() { return this->fname;}
+  startTag("Platforms", strings(NULL));
+
+  tag("Platform", strings("Name", Util::os.c_str()));
+
+  endTag("Platforms");
+
+  startTag("Configurations", strings(NULL));
+
+  for (std::vector < BuildConfig * >::iterator i = allConfigs.begin(); i != allConfigs.end(); i++) {
+    writeConfiguration(*i);
+  }
+
+  endTag("Configurations");
+
+  tag("References", strings(NULL));
+
+  writeFiles(allConfigs);
+
+  tag("Globals", strings(NULL));
+
+  endTag("VisualStudioProject");
+
+  (*printWriter) << std::flush;
+  delete printWriter;
+
+  std::cout << "    Done." << std::endl;
 }
 
-class DirectoryFilter : public NameFilter {
-    std::string dir;
-    int baseLen, dirLen;
-
-    DirectoryFilter(std::string dir, std::string sbase) {
-        this->dir = dir;
-        this->baseLen = sbase.size()();
-        this->dirLen = dir.size()();
-        this->fname = dir;
-    }
-
-    DirectoryFilter(std::string fname, std::string dir, std::string sbase) {
-        this->dir = dir;
-        this->baseLen = sbase.size()();
-        this->dirLen = dir.size()();
-        this->fname = fname;
-    }
-
-
-    bool match(FileInfo fi) {
-        return fi.full.regionMatches(true, baseLen, dir, 0, dirLen);
-    }
+std::string WinGammaPlatformVC7::NameFilter::filterString() {
+  return "";
 }
 
-class TypeFilter : public NameFilter {
-    std::vector < std::string > exts;
-
-    TypeFilter(std::string fname, std::vector < std::string > exts) {
-        this->fname = fname;
-        this->exts = exts;
-    }
-
-    bool match(FileInfo fi) {
-        for (int i=0; i<exts.size(); i++) {
-            if (fi.full.endsWith(exts[i])) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    std::string  filterString() {
-        return Util.join(";", exts);
-    }
+std::string WinGammaPlatformVC7::NameFilter::name() {
+  return this->fname;
 }
 
-class TerminatorFilter : public NameFilter {
-    TerminatorFilter(std::string fname) {
-        this->fname = fname;
-
-    }
-    bool match(FileInfo fi) {
-        return true;
-    }
-
+WinGammaPlatformVC7::DirectoryFilter::DirectoryFilter(std::string dir, std::string sbase) {
+  this->dir = dir;
+  this->baseLen = sbase.size();
+  this->dirLen = dir.size();
+  this->fname = dir;
 }
 
-class SpecificNameFilter : public NameFilter {
-    std::string pats[];
-
-    SpecificNameFilter(std::string fname, std::vector < std::string > pats) {
-        this->fname = fname;
-        this->pats = pats;
-    }
-
-    bool match(FileInfo fi) {
-        for (int i=0; i<pats.size(); i++) {
-            if (fi.attr.shortName.matches(pats[i])) {
-                return true;
-            }
-        }
-        return false;
-    }
-
+WinGammaPlatformVC7::DirectoryFilter::DirectoryFilter(std::string fname, std::string dir, std::string sbase) {
+  this->dir = dir;
+  this->baseLen = sbase.size();
+  this->dirLen = dir.size();
+  this->fname = fname;
 }
 
-class ContainerFilter : public NameFilter {
-    std::vector < ? > children;
-
-    ContainerFilter(std::string fname) {
-        this->fname = fname;
-        children = new std::vector < ? >();
-
-    }
-    bool match(FileInfo fi) {
-        return false;
-    }
-
-    std::vector < ? >::iterator babies() { return children->begin(); }
-
-    void add(NameFilter f) {
-        children->push_back(f);
-    }
+bool WinGammaPlatformVC7::DirectoryFilter::match(FileInfo * fi) {
+  return regionMatches(fi->full, true, baseLen, dir, 0, dirLen);
 }
 
 
-void writeCustomToolConfig(std::vector < ? > configs, std::vector < std::string > customToolAttrs) {
-    for (std::vector < ? >::iterator i = configs->begin(); i != ?->end(); ) {
-        startTag("FileConfiguration",
-                 new std::vector < std::string > {
-                     "Name",  (std::string)i.next()
-                 }
-                 );
-        tag("Tool", customToolAttrs);
+WinGammaPlatformVC7::TypeFilter::TypeFilter(std::string fname, std::vector < std::string > exts) {
+  this->fname = fname;
+  this->exts = exts;
+}
 
-        endTag("FileConfiguration");
+bool WinGammaPlatformVC7::TypeFilter::match(FileInfo * fi) {
+  for (std::vector < std::string >::size_type i=0; i<exts.size(); i++) {
+    if (endsWith(fi->full, exts[i])) {
+      return true;
     }
+  }
+  return false;
+}
+
+std::string WinGammaPlatformVC7::TypeFilter::filterString() {
+  return Util::join(";", exts);
+}
+
+
+WinGammaPlatformVC7::TerminatorFilter::TerminatorFilter(std::string fname) {
+  this->fname = fname;
+}
+
+bool WinGammaPlatformVC7::TerminatorFilter::match(FileInfo * fi) {
+  return true;
+}
+
+
+WinGammaPlatformVC7::SpecificNameFilter::SpecificNameFilter(std::string fname, std::vector < std::string > pats) {
+  this->fname = fname;
+  this->pats = pats;
+}
+
+bool WinGammaPlatformVC7::SpecificNameFilter::match(FileInfo * fi) {
+  for (std::vector < std::string >::size_type i=0; i<pats.size(); i++) {
+    if (matches(fi->attr->shortName, pats[i])) {
+      return true;
+    }
+  }
+  return false;
+}
+
+
+WinGammaPlatformVC7::ContainerFilter::ContainerFilter(std::string fname) {
+  this->fname = fname;
+}
+
+bool WinGammaPlatformVC7::ContainerFilter::match(FileInfo * fi) {
+  return false;
+}
+
+std::vector < WinGammaPlatformVC7::NameFilter * > WinGammaPlatformVC7::ContainerFilter::babies() {
+  return children;
+}
+
+void WinGammaPlatformVC7::ContainerFilter::push_back(NameFilter * f) {
+  children.push_back(f);
+}
+
+
+void WinGammaPlatformVC7::writeCustomToolConfig(std::vector < std::string > configs, std::vector < std::string > customToolAttrs) {
+  for (std::vector < std::string >::iterator i = configs.begin(); i != configs.end(); i++) {
+    startTag("FileConfiguration", strings("Name", i->c_str()));
+    tag("Tool", customToolAttrs);
+    endTag("FileConfiguration");
+  }
 }
 
 // here we define filters, which define layout of what can be seen in 'Solution View' of MSVC
@@ -197,452 +188,391 @@
 //   - container filter just provides a container to group together real filters
 //   - real filter can select elements from the set according to some rule, put it into XML
 //     and remove from the list
-std::vector < ? > makeFilters(TreeSet files) {
-    std::vector < ? > rv = new std::vector < ? >();
-    std::string sbase = Util.normalize(BuildConfig.getFieldString(NULL, "SourceBase")+"/src/");
+std::vector < WinGammaPlatformVC7::NameFilter* > WinGammaPlatformVC7::makeFilters(std::vector < FileInfo * > files) {
+  std::vector < NameFilter* > rv;
+  std::ostringstream sbasestream;
+  sbasestream << BuildConfig::getFieldString(NULL, "SourceBase") << "/src/";
+  std::string sbase = Util::normalize(sbasestream.str());
 
-    ContainerFilter rt = new ContainerFilter("Runtime");
-    rt->push_back(new DirectoryFilter("share/vm/prims", sbase));
-    rt->push_back(new DirectoryFilter("share/vm/runtime", sbase));
-    rt->push_back(new DirectoryFilter("share/vm/oops", sbase));
-    rv->push_back(rt);
+  ContainerFilter * rt = new ContainerFilter("Runtime");
+  rt->push_back(new DirectoryFilter("share/vm/prims", sbase));
+  rt->push_back(new DirectoryFilter("share/vm/runtime", sbase));
+  rt->push_back(new DirectoryFilter("share/vm/oops", sbase));
+  rv.push_back(rt);
 
-    ContainerFilter gc = new ContainerFilter("GC");
-    gc->push_back(new DirectoryFilter("share/vm/memory", sbase));
-    gc->push_back(new DirectoryFilter("share/vm/gc_interface", sbase));
+  ContainerFilter * gc = new ContainerFilter("GC");
+  gc->push_back(new DirectoryFilter("share/vm/memory", sbase));
+  gc->push_back(new DirectoryFilter("share/vm/gc_interface", sbase));
 
-    ContainerFilter gc_impl = new ContainerFilter("Implementations");
-    gc_impl->push_back(new DirectoryFilter("CMS",
-                                    "share/vm/gc_implementation/concurrentMarkSweep",
-                                    sbase));
-    gc_impl->push_back(new DirectoryFilter("Parallel Scavenge",
-                                    "share/vm/gc_implementation/parallelScavenge",
-                                    sbase));
-    gc_impl->push_back(new DirectoryFilter("Shared",
-                                    "share/vm/gc_implementation/shared",
-                                    sbase));
-    // for all leftovers
-    gc_impl->push_back(new DirectoryFilter("Misc",
-                                    "share/vm/gc_implementation",
-                                    sbase));
+  ContainerFilter * gc_impl = new ContainerFilter("Implementations");
+  gc_impl->push_back(new DirectoryFilter("CMS",
+					 "share/vm/gc_implementation/concurrentMarkSweep",
+					 sbase));
+  gc_impl->push_back(new DirectoryFilter("Parallel Scavenge",
+					 "share/vm/gc_implementation/parallelScavenge",
+					 sbase));
+  gc_impl->push_back(new DirectoryFilter("Shared",
+					 "share/vm/gc_implementation/shared",
+					 sbase));
+  // for all leftovers
+  gc_impl->push_back(new DirectoryFilter("Misc",
+					 "share/vm/gc_implementation",
+					 sbase));
+  
+  gc->push_back(gc_impl);
+  rv.push_back(gc);
 
-    gc->push_back(gc_impl);
-    rv->push_back(gc);
+  rv.push_back(new DirectoryFilter("C1", "share/vm/c1", sbase));
 
-    rv->push_back(new DirectoryFilter("C1", "share/vm/c1", sbase));
+  ContainerFilter * c2 = new ContainerFilter("C2");
+  //c2->push_back(new DirectoryFilter("share/vm/adlc", sbase));
+  c2->push_back(new DirectoryFilter("share/vm/opto", sbase));
+  c2->push_back(new SpecificNameFilter("Generated", strings("^ad_.+", "^dfa_.+", "^adGlobals.+")));
+  rv.push_back(c2);
 
-    ContainerFilter c2 = new ContainerFilter("C2");
-    //c2->push_back(new DirectoryFilter("share/vm/adlc", sbase));
-    c2->push_back(new DirectoryFilter("share/vm/opto", sbase));
-    c2->push_back(new SpecificNameFilter("Generated", new std::vector < std::string > {"^ad_.+", "^dfa_.+", "^adGlobals.+"}));
-    rv->push_back(c2);
+  ContainerFilter * comp = new ContainerFilter("Compiler Common");
+  comp->push_back(new DirectoryFilter("share/vm/asm", sbase));
+  comp->push_back(new DirectoryFilter("share/vm/ci", sbase));
+  comp->push_back(new DirectoryFilter("share/vm/code", sbase));
+  comp->push_back(new DirectoryFilter("share/vm/compiler", sbase));
+  rv.push_back(comp);
 
-    ContainerFilter comp = new ContainerFilter("Compiler Common");
-    comp->push_back(new DirectoryFilter("share/vm/asm", sbase));
-    comp->push_back(new DirectoryFilter("share/vm/ci", sbase));
-    comp->push_back(new DirectoryFilter("share/vm/code", sbase));
-    comp->push_back(new DirectoryFilter("share/vm/compiler", sbase));
-    rv->push_back(comp);
+  rv.push_back(new DirectoryFilter("Interpreter",
+				    "share/vm/interpreter",
+				    sbase));
 
-    rv->push_back(new DirectoryFilter("Interpreter",
-                               "share/vm/interpreter",
-                               sbase));
+  ContainerFilter * misc = new ContainerFilter("Misc");
+  //misc->push_back(new DirectoryFilter("share/vm/launch", sbase));
+  misc->push_back(new DirectoryFilter("share/vm/libadt", sbase));
+  misc->push_back(new DirectoryFilter("share/vm/services", sbase));
+  misc->push_back(new DirectoryFilter("share/vm/utilities", sbase));
+  rv.push_back(misc);
 
-    ContainerFilter misc = new ContainerFilter("Misc");
-    //misc->push_back(new DirectoryFilter("share/vm/launch", sbase));
-    misc->push_back(new DirectoryFilter("share/vm/libadt", sbase));
-    misc->push_back(new DirectoryFilter("share/vm/services", sbase));
-    misc->push_back(new DirectoryFilter("share/vm/utilities", sbase));
-    rv->push_back(misc);
+  rv.push_back(new DirectoryFilter("os_cpu", sbase));
 
-    rv->push_back(new DirectoryFilter("os_cpu", sbase));
+  rv.push_back(new DirectoryFilter("cpu", sbase));
 
-    rv->push_back(new DirectoryFilter("cpu", sbase));
+  rv.push_back(new DirectoryFilter("os", sbase));
 
-    rv->push_back(new DirectoryFilter("os", sbase));
+  rv.push_back(new SpecificNameFilter("JVMTI Generated", strings("^jvmti.+")));
 
-    rv->push_back(new SpecificNameFilter("JVMTI Generated", new std::vector < std::string > {"^jvmti.+"}));
+  rv.push_back(new SpecificNameFilter("C++ Interpreter Generated", strings("^bytecodeInterpreterWithChecks.+")));
 
-    rv->push_back(new SpecificNameFilter("C++ Interpreter Generated", new std::vector < std::string > {"^bytecodeInterpreterWithChecks.+"}));
+  rv.push_back(new SpecificNameFilter("Include DBs", strings("^includeDB_.+")));
 
-    rv->push_back(new SpecificNameFilter("Include DBs", new std::vector < std::string > {"^includeDB_.+"}));
+  // this one is to catch files not caught by other filters
+  //rv.push_back(new TypeFilter("Header Files", strings("h", "hpp", "hxx", "hm", "inl", "fi", "fd")));
+  rv.push_back(new TerminatorFilter("Source Files"));
 
-    // this one is to catch files not caught by other filters
-    //rv->push_back(new TypeFilter("Header Files", new std::vector < std::string > {"h", "hpp", "hxx", "hm", "inl", "fi", "fd"}));
-    rv->push_back(new TerminatorFilter("Source Files"));
-
-    return rv;
+  return rv;
 }
 
-void writeFiles(std::vector < ? > allConfigs) {
+void WinGammaPlatformVC7::writeFiles(std::vector < BuildConfig* > allConfigs) {
 
-    Hashtable allFiles = computeAttributedFiles(allConfigs);
+  std::map < std::string, FileAttribute * > allFiles = computeAttributedFiles(allConfigs);
 
-    std::vector < ? > allConfigNames = new std::vector < ? >();
-    for (std::vector < ? >::iterator i = allConfigs->begin(); i != ?->end(); ) {
-        allConfigNames->push_back(((BuildConfig)i.next()).get("Name"));
-    }
+  std::vector < std::string > allConfigNames;
+  for (std::vector < BuildConfig* >::iterator i = allConfigs.begin(); i != allConfigs.end(); i++) {
+    allConfigNames.push_back((*i)->get("Name"));
+  }
 
-    TreeSet sortedFiles = sortFiles(allFiles);
+  std::vector < FileInfo * > sortedFiles = sortFiles(allFiles);
 
-    startTag("Files", NULL);
+  startTag("Files", strings(NULL));
 
-    for (std::vector < ? >::iterator i = makeFilters(sortedFiles)->begin(); i != ?->end(); ) {
-        doWriteFiles(sortedFiles, allConfigNames, (NameFilter)i.next());
-    }
+  std::vector < NameFilter* > filters = makeFilters(sortedFiles);
+  for (std::vector < NameFilter* >::iterator i = filters.begin(); i != filters.end(); i++) {
+    doWriteFiles(&sortedFiles, allConfigNames, *i);
+  }
 
+  startTag("Filter", 
+	   strings("Name", "Resource Files",
+		   "Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"));
+  endTag("Filter");
 
-    startTag("Filter",
-             new std::vector < std::string > {
-                 "Name", "Resource Files",
-                 "Filter", "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
-             }
-             );
-    endTag("Filter");
-
-    endTag("Files");
+  endTag("Files");
 }
 
-void doWriteFiles(TreeSet allFiles, std::vector < ? > allConfigNames, NameFilter filter) {
-    startTag("Filter",
-             new std::vector < std::string > {
-                 "Name",   filter.name(),
-                 "Filter", filter.filterString()
-             }
-             );
+void WinGammaPlatformVC7::doWriteFiles(std::vector < FileInfo* > * allFiles, std::vector < std::string > allConfigNames, NameFilter * filter) {
+  startTag("Filter",
+	   strings("Name", filter->name().c_str(),
+		   "Filter", filter->filterString().c_str()));
 
-    if (filter instanceof ContainerFilter) {
+  ContainerFilter * containerFilter = dynamic_cast<ContainerFilter*>(filter);
+  if (containerFilter != NULL) {
+    std::vector < NameFilter* > babies = containerFilter->babies();
+    std::vector < NameFilter* >::iterator i = babies.begin();
+    while (i != babies.end()) {
+      doWriteFiles(allFiles, allConfigNames, *i++);
+    }
+  } else {
+    std::vector < FileInfo* >::iterator i = allFiles->begin();
+    while (i != allFiles->end()) {
+      FileInfo * fi = *i++;
+      if (!filter->match(fi)) {
+	continue;
+      }
 
-        std::vector < ? >::iterator i = ((ContainerFilter)filter).babies();
-        while (i != ?->end()) {
-            doWriteFiles(allFiles, allConfigNames, (NameFilter)i.next());
-        }
+      startTag("File", strings("RelativePath", replace(fi->full, '/', '\\').c_str()));
 
-    } else {
+      FileAttribute * a = fi->attr;
+      if (a->pchRoot) {
+	writeCustomToolConfig(allConfigNames,
+			      strings("Name", "VCCLCompilerTool",
+				      "UsePrecompiledHeader", "1"));
+      }
+      if (a->noPch) {
+	writeCustomToolConfig(allConfigNames,
+			      strings("Name", "VCCLCompilerTool",
+				      "UsePrecompiledHeader", "0"));
+      }
+      if (!a->configs.empty()) {
+	for (std::vector < std::string >::iterator j=allConfigNames.begin(); j != allConfigNames.end();) {
+	  std::string cfg = *j++;
+	  bool found = false;
+	  for (std::vector < std::string >::iterator k=a->configs.begin(); k != a->configs.end(); k++) {
+	    if (*k == cfg) {
+	      found = true;
+	      break;
+	    }
+	  }
+	  if (!found) {
+	    startTag("FileConfiguration",
+		     strings("Name", cfg.c_str(),
+			     "ExcludedFromBuild", "TRUE"));
+	    tag("Tool", strings("Name", "VCCLCompilerTool"));
+	    endTag("FileConfiguration");
+	  }
+	}
+      }
 
-        std::vector < ? >::iterator i = allFiles->begin();
-        while (i != ?->end()) {
-            FileInfo fi = (FileInfo)i.next();
+      endTag("File");
 
-            if (!filter.match(fi)) {
-                continue;
-            }
+      // we not gonna look at this file anymore
+      allFiles->erase(i);
+    }
+  }
 
-            startTag("File",
-                     new std::vector < std::string > {
-                         "RelativePath", fi.full.replace('/', '\\')
-                     }
-                     );
-
-            FileAttribute a = fi.attr;
-            if (a.pchRoot) {
-                writeCustomToolConfig(allConfigNames,
-                                      new std::vector < std::string > {
-                                          "Name", "VCCLCompilerTool",
-                                          "UsePrecompiledHeader", "1"
-                                      });
-            }
-
-            if (a.noPch) {
-                writeCustomToolConfig(allConfigNames,
-                                      new std::vector < std::string > {
-                                          "Name", "VCCLCompilerTool",
-                                          "UsePrecompiledHeader", "0"
-                                      });
-            }
-
-            if (a.configs != NULL) {
-                for (std::vector < ? >::iterator j=allConfigNames->begin(); j != ?->end();) {
-                    std::string cfg = (std::string)j.next();
-                    if (!a.configs.contains(cfg)) {
-                        startTag("FileConfiguration",
-                                 new std::vector < std::string > {
-                                     "Name", cfg,
-                                     "ExcludedFromBuild", "TRUE"
-                                 });
-                        tag("Tool", new std::vector < std::string > {"Name", "VCCLCompilerTool"});
-                        endTag("FileConfiguration");
-
-                    }
-                }
-            }
-
-            endTag("File");
-
-            // we not gonna look at this file anymore
-            i.remove();
-        }
-    }
-
-    endTag("Filter");
+  endTag("Filter");
 }
 
 
-void writeConfiguration(BuildConfig cfg) {
-    startTag("Configuration",
-             new std::vector < std::string > {
-                 "Name", cfg.get("Name"),
-                 "OutputDirectory",  cfg.get("OutputDir"),
-                 "IntermediateDirectory",  cfg.get("OutputDir"),
-                 "ConfigurationType", "2",
-                 "UseOfMFC", "0",
-                 "ATLMinimizesCRunTimeLibraryUsage", "FALSE"
-             }
-             );
-
-
-
-    tagV("Tool", cfg.getV("CompilerFlags"));
-
-    tag("Tool",
-        new std::vector < std::string > {
-            "Name", "VCCustomBuildTool"
-        }
-        );
-
-    tagV("Tool", cfg.getV("LinkerFlags"));
-
-    tag("Tool",
-        new std::vector < std::string > {
-            "Name", "VCPostBuildEventTool"
-        }
-        );
-
-    tag("Tool",
-        new std::vector < std::string > {
-            "Name", "VCPreBuildEventTool"
-        }
-        );
-
-    tag("Tool",
-        new std::vector < std::string > {
-            "Name", "VCPreLinkEventTool",
-            "Description", BuildConfig.getFieldString(NULL, "PrelinkDescription"),
-            "CommandLine", cfg.expandFormat(BuildConfig.getFieldString(NULL, "PrelinkCommand").replace('\t', '\n'))
-        }
-        );
-
-    tag("Tool",
-        new std::vector < std::string > {
-            "Name", "VCResourceCompilerTool",
-            // XXX???
-            "PreprocessorDefinitions", "NDEBUG",
-            "Culture", "1033"
-        }
-        );
-    tag("Tool",
-        new std::vector < std::string > {
-          "Name", "VCWebServiceProxyGeneratorTool"
-        }
-        );
-
-    tag ("Tool",
-         new std::vector < std::string > {
-          "Name", "VCXMLDataGeneratorTool"
-         }
-         );
-
-    tag("Tool",
-        new std::vector < std::string > {
-          "Name", "VCWebDeploymentTool"
-        }
-        );
-    tag("Tool",
-         new std::vector < std::string > {
-        "Name", "VCManagedWrapperGeneratorTool"
-         }
-        );
-    tag("Tool",
-        new std::vector < std::string > {
-          "Name", "VCAuxiliaryManagedWrapperGeneratorTool"
-        }
-        );
-
-    tag("Tool",
-        new std::vector < std::string > {
-            "Name", "VCMIDLTool",
-            "PreprocessorDefinitions", "NDEBUG",
-            "MkTypLibCompatible", "TRUE",
-            "SuppressStartupBanner", "TRUE",
-            "TargetEnvironment", "1",
-            "TypeLibraryName", cfg.get("OutputDir") + Util.sep + "vm.tlb",
-            "HeaderFileName", ""
-        }
-        );
-
-    endTag("Configuration");
+void WinGammaPlatformVC7::writeConfiguration(BuildConfig * cfg) {
+  startTag("Configuration",
+	   strings("Name", cfg->get("Name").c_str(),
+		   "OutputDirectory",  cfg->get("OutputDir").c_str(),
+		   "IntermediateDirectory",  cfg->get("OutputDir").c_str(),
+		   "ConfigurationType", "2",
+		   "UseOfMFC", "0",
+		   "ATLMinimizesCRunTimeLibraryUsage", "FALSE"));
+  tagV("Tool", *cfg->getV("CompilerFlags"));
+  tag("Tool", strings("Name", "VCCustomBuildTool"));
+  tagV("Tool", *cfg->getV("LinkerFlags"));
+  tag("Tool", strings("Name", "VCPostBuildEventTool"));
+  tag("Tool", strings("Name", "VCPreBuildEventTool"));
+  tag("Tool",
+      strings("Name", "VCPreLinkEventTool",
+	      "Description", BuildConfig::getFieldString(NULL, "PrelinkDescription").c_str(),
+	      "CommandLine", cfg->expandFormat(replace(BuildConfig::getFieldString(NULL, "PrelinkCommand"), '\t', '\n')).c_str()
+	      ));
+  tag("Tool",
+      strings("Name", "VCResourceCompilerTool",
+	      // XXX???
+	      "PreprocessorDefinitions", "NDEBUG",
+	      "Culture", "1033"));
+  tag("Tool", strings("Name", "VCWebServiceProxyGeneratorTool"));
+  tag("Tool", strings("Name", "VCXMLDataGeneratorTool"));
+  tag("Tool", strings("Name", "VCWebDeploymentTool"));
+  tag("Tool", strings("Name", "VCManagedWrapperGeneratorTool"));
+  tag("Tool", strings("Name", "VCAuxiliaryManagedWrapperGeneratorTool"));
+  std::ostringstream typeLibraryName;
+  typeLibraryName << cfg->get("OutputDir") << Util::sep << "vm.tlb";
+  tag("Tool", strings("Name", "VCMIDLTool",
+		      "PreprocessorDefinitions", "NDEBUG",
+		      "MkTypLibCompatible", "TRUE",
+		      "SuppressStartupBanner", "TRUE",
+		      "TargetEnvironment", "1",
+		      "TypeLibraryName", typeLibraryName.str().c_str(),
+		      "HeaderFileName", ""));
+  endTag("Configuration");
 }
 
-int indent;
-
-void startTagPrim(std::string name,
-                          std::vector < std::string > attrs,
-                          bool close) {
-    doIndent();
-    printWriter << ("<"+name);
-    indent++;
-
-    if (attrs != NULL) {
-        printWriter << std::endl; 
-        for (int i=0; i<attrs.size(); i+=2) {
-            doIndent();
-            printWriter << ln(" " + attrs[i]+"=\""+attrs[i+1]+"\"");
-        }
+void WinGammaPlatformVC7::startTagPrim(std::string name,
+				       std::vector < std::string > attrs,
+				       bool close) {
+  doIndent();
+  (*printWriter) << "<" << name;
+  indent++;
+  if (!attrs.empty()) {
+    (*printWriter) << std::endl; 
+    for (std::vector < std::string >::size_type i=0; i<attrs.size(); i+=2) {
+      doIndent();
+      (*printWriter) << " " << attrs[i] << "=\"" << attrs[i+1] << "\"" << std::endl;
     }
-
-    if (close) {
-        indent--;
-        //doIndent();
-        printWriter << ln("/>");
-    } else {
-        //doIndent();
-        printWriter << ln(">");
-    }
+  }
+  if (close) {
+    indent--;
+    //doIndent();
+    (*printWriter) << "/>" << std::endl;
+  } else {
+    //doIndent();
+    (*printWriter) << ">" << std::endl;
+  }
 }
 
-void startTag(std::string name, std::vector < std::string > attrs) {
-    startTagPrim(name, attrs, false);
+void WinGammaPlatformVC7::startTag(std::string name, std::vector < std::string > attrs) {
+  startTagPrim(name, attrs, false);
 }
 
-void startTagV(std::string name, std::vector < ? > attrs) {
-    std::string s[] = new std::string [attrs.size()];
-     for (int i=0; i<attrs.size(); i++) {
-         s[i] = (std::string)attrs.elementAt(i);
-     }
-    startTagPrim(name, s, false);
+void WinGammaPlatformVC7::startTagV(std::string name, std::vector < std::string > attrs) {
+  startTagPrim(name, attrs, false);
 }
 
-void endTag(std::string name) {
-    indent--;
-    doIndent();
-    printWriter << ln("</"+name+">");
+void WinGammaPlatformVC7::endTag(std::string name) {
+  indent--;
+  doIndent();
+  (*printWriter) << "</" << name << ">" << std::endl;
 }
 
-void tag(std::string name, std::vector < std::string > attrs) {
-    startTagPrim(name, attrs, true);
+void WinGammaPlatformVC7::tag(std::string name, std::vector < std::string > attrs) {
+  startTagPrim(name, attrs, true);
 }
 
- void tagV(std::string name, std::vector < ? > attrs) {
-     std::string s[] = new std::string [attrs.size()];
-     for (int i=0; i<attrs.size(); i++) {
-         s[i] = (std::string)attrs.elementAt(i);
-     }
-     startTagPrim(name, s, true);
+void WinGammaPlatformVC7::tagV(std::string name, std::vector < std::string > attrs) {
+  startTagPrim(name, attrs, true);
 }
 
 
-void doIndent() {
-    for (int i=0; i<indent; i++) {
-        printWriter << ("    ");
-    }
+void WinGammaPlatformVC7::doIndent() {
+  for (int i=0; i<indent; i++) {
+    (*printWriter) << "    ";
+  }
 }
 
-std::string getProjectExt() {
-    return ".vcproj";
-}
+std::string WinGammaPlatformVC7::getProjectExt() {
+  return ".vcproj";
 }
 
-class CompilerInterfaceVC7 : public CompilerInterface {
-std::vector < ? > getBaseCompilerFlags(std::vector < ? > defines, std::vector < ? > includes, std::string outDir) {
-    std::vector < ? > rv = new std::vector < ? >();
 
-    // advanced M$ IDE (2003) can only recognize name if it's first or
-    // second attribute in the tag - go guess
-    addAttr(rv, "Name", "VCCLCompilerTool");
-    addAttr(rv, "AdditionalIncludeDirectories", Util.join(",", includes));
-    addAttr(rv, "PreprocessorDefinitions", Util.join(";", defines).replace("\"","&quot;"));
-    addAttr(rv, "UsePrecompiledHeader", "3");
-    addAttr(rv, "PrecompiledHeaderThrough", "incls"+Util.sep+"_precompiled.incl");
-    addAttr(rv, "PrecompiledHeaderFile", outDir+Util.sep+"vm.pch");
-    addAttr(rv, "AssemblerListingLocation", outDir);
-    addAttr(rv, "ObjectFile", outDir+Util.sep);
-    addAttr(rv, "ProgramDataBaseFileName", outDir+Util.sep+"vm.pdb");
-    addAttr(rv, "SuppressStartupBanner", "TRUE");
-    addAttr(rv, "CompileAs", "0");
-    addAttr(rv, "WarningLevel", "3");
-    addAttr(rv, "WarnAsError", "TRUE");
-    addAttr(rv, "BufferSecurityCheck", "FALSE");
-    addAttr(rv, "ExceptionHandling", "FALSE");
+std::vector < std::string > CompilerInterfaceVC7::getBaseCompilerFlags(std::vector < std::string > defines, std::vector < std::string > includes, std::string outDir) {
+  std::vector < std::string > * rv = new std::vector < std::string >();
 
-    return rv;
+  // advanced M$ IDE (2003) can only recognize name if it's first or
+  // second attribute in the tag - go guess
+  addAttr(rv, "Name", "VCCLCompilerTool");
+  addAttr(rv, "AdditionalIncludeDirectories", Util::join(",", includes));
+  addAttr(rv, "PreprocessorDefinitions", replace(Util::join(";", defines), "\"", "&quot;"));
+  addAttr(rv, "UsePrecompiledHeader", "3");
+  std::ostringstream precompiledHeaderThrough;
+  precompiledHeaderThrough << "incls" << Util::sep << "_precompiled.incl";
+  addAttr(rv, "PrecompiledHeaderThrough", precompiledHeaderThrough.str());
+  std::ostringstream precompiledHeaderFile;
+  precompiledHeaderFile << outDir << Util::sep << "vm.pch";
+  addAttr(rv, "PrecompiledHeaderFile", precompiledHeaderFile.str());
+  addAttr(rv, "AssemblerListingLocation", outDir);
+  std::ostringstream objectFile;
+  objectFile << outDir << Util::sep;
+  addAttr(rv, "ObjectFile", objectFile.str());
+  std::ostringstream programDataBaseFileName;
+  programDataBaseFileName << outDir << Util::sep << "vm.pdb";
+  addAttr(rv, "ProgramDataBaseFileName", programDataBaseFileName.str());
+  addAttr(rv, "SuppressStartupBanner", "TRUE");
+  addAttr(rv, "CompileAs", "0");
+  addAttr(rv, "WarningLevel", "3");
+  addAttr(rv, "WarnAsError", "TRUE");
+  addAttr(rv, "BufferSecurityCheck", "FALSE");
+  addAttr(rv, "ExceptionHandling", "FALSE");
+
+  return *rv;
 }
 
-std::vector < ? > getBaseLinkerFlags(std::string outDir, std::string outDll) {
-    std::vector < ? > rv = new std::vector < ? >();
+std::vector < std::string > CompilerInterfaceVC7::getBaseLinkerFlags(std::string outDir, std::string outDll) {
+  std::vector < std::string > * rv = new std::vector < std::string >();
 
-    addAttr(rv, "Name", "VCLinkerTool");
-    addAttr(rv, "AdditionalOptions",
-            "/export:JNI_GetDefaultJavaVMInitArgs " +
-            "/export:JNI_CreateJavaVM " +
-            "/export:JNI_GetCreatedJavaVMs "+
-            "/export:jio_snprintf /export:jio_printf "+
-            "/export:jio_fprintf /export:jio_vfprintf "+
-            "/export:jio_vsnprintf ");
-    addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib");
-    addAttr(rv, "OutputFile", outDll);
-    addAttr(rv, "LinkIncremental", "1");
-    addAttr(rv, "SuppressStartupBanner", "TRUE");
-    addAttr(rv, "ModuleDefinitionFile", outDir+Util.sep+"vm.def");
-    addAttr(rv, "ProgramDatabaseFile", outDir+Util.sep+"vm.pdb");
-    addAttr(rv, "SubSystem", "2");
-    addAttr(rv, "BaseAddress", "0x8000000");
-    addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib");
-    addAttr(rv, "TargetMachine", "1");
+  addAttr(rv, "Name", "VCLinkerTool");
+  std::ostringstream additionalOptions;
+  additionalOptions << "/export:JNI_GetDefaultJavaVMInitArgs "
+		    << "/export:JNI_CreateJavaVM "
+		    << "/export:JNI_GetCreatedJavaVMs "
+		    << "/export:jio_snprintf /export:jio_printf "
+		    << "/export:jio_fprintf /export:jio_vfprintf "
+		    << "/export:jio_vsnprintf ";
+  addAttr(rv, "AdditionalOptions", additionalOptions.str());
+  addAttr(rv, "AdditionalDependencies", "Wsock32.lib winmm.lib");
+  addAttr(rv, "OutputFile", outDll);
+  addAttr(rv, "LinkIncremental", "1");
+  addAttr(rv, "SuppressStartupBanner", "TRUE");
+  std::ostringstream moduleDefinitionsFile;
+  moduleDefinitionsFile << outDir << Util::sep << "vm.def";
+  addAttr(rv, "ModuleDefinitionFile", moduleDefinitionsFile.str());
+  std::ostringstream programDatabaseFile;
+  programDatabaseFile << outDir << Util::sep << "vm.pdb";
+  addAttr(rv, "ProgramDatabaseFile", programDatabaseFile.str());
+  addAttr(rv, "SubSystem", "2");
+  addAttr(rv, "BaseAddress", "0x8000000");
+  std::ostringstream importLibrary;
+  importLibrary << outDir << Util::sep << "jvm.lib";
+  addAttr(rv, "ImportLibrary", importLibrary.str());
+  addAttr(rv, "TargetMachine", "1");
 
-    return rv;
+  return *rv;
 }
 
-std::vector < ? > getDebugCompilerFlags(std::string opt) {
-    std::vector < ? > rv = new std::vector < ? >();
+std::vector < std::string > CompilerInterfaceVC7::getDebugCompilerFlags(std::string opt) {
+  std::vector < std::string > * rv = new std::vector < std::string >();
 
-    addAttr(rv, "Optimization", opt);
-    addAttr(rv, "OptimizeForProcessor", "1");
-    addAttr(rv, "DebugInformationFormat", "3");
-    addAttr(rv, "RuntimeLibrary", "2");
-    addAttr(rv, "BrowseInformation", "1");
-    addAttr(rv, "BrowseInformationFile", "$(IntDir)" + Util.sep);
+  addAttr(rv, "Optimization", opt);
+  addAttr(rv, "OptimizeForProcessor", "1");
+  addAttr(rv, "DebugInformationFormat", "3");
+  addAttr(rv, "RuntimeLibrary", "2");
+  addAttr(rv, "BrowseInformation", "1");
+  std::ostringstream browseInformationFile;
+  browseInformationFile << "$(IntDir)" << Util::sep;
+  addAttr(rv, "BrowseInformationFile", browseInformationFile.str());
 
-    return rv;
+  return *rv;
 }
 
-std::vector < ? > getDebugLinkerFlags() {
-    std::vector < ? > rv = new std::vector < ? >();
+std::vector < std::string > CompilerInterfaceVC7::getDebugLinkerFlags() {
+  std::vector < std::string > * rv = new std::vector < std::string >();
 
-    addAttr(rv, "GenerateDebugInformation", "TRUE");
+  addAttr(rv, "GenerateDebugInformation", "TRUE");
 
-    return rv;
+  return *rv;
 }
 
-std::vector < ? > getProductCompilerFlags() {
-    std::vector < ? > rv = new std::vector < ? >();
+std::vector < std::string > CompilerInterfaceVC7::getProductCompilerFlags() {
+  std::vector < std::string > * rv = new std::vector < std::string >();
 
-    addAttr(rv, "Optimization", "2");
-    addAttr(rv, "InlineFunctionExpansion", "1");
-    addAttr(rv, "StringPooling", "TRUE");
-    addAttr(rv, "RuntimeLibrary", "2");
-    addAttr(rv, "EnableFunctionLevelLinking", "TRUE");
+  addAttr(rv, "Optimization", "2");
+  addAttr(rv, "InlineFunctionExpansion", "1");
+  addAttr(rv, "StringPooling", "TRUE");
+  addAttr(rv, "RuntimeLibrary", "2");
+  addAttr(rv, "EnableFunctionLevelLinking", "TRUE");
 
-    return rv;
+  return *rv;
 }
 
-std::vector < ? > getProductLinkerFlags() {
-    std::vector < ? > rv = new std::vector < ? >();
+std::vector < std::string > CompilerInterfaceVC7::getProductLinkerFlags() {
+  std::vector < std::string > * rv = new std::vector < std::string >();
 
-    addAttr(rv, "OptimizeReferences", "2");
-    addAttr(rv, "EnableCOMDATFolding", "2");
+  addAttr(rv, "OptimizeReferences", "2");
+  addAttr(rv, "EnableCOMDATFolding", "2");
 
-    return rv;
+  return *rv;
 }
 
-std::string getOptFlag() {
-    return "2";
+std::string CompilerInterfaceVC7::getOptFlag() {
+  return "2";
 }
 
-std::string getNoOptFlag() {
-    return "0";
+std::string CompilerInterfaceVC7::getNoOptFlag() {
+  return "0";
 }
 
-std::string makeCfgName(std::string flavourBuild) {
-    return  flavourBuild + "|" + Util.os;
+std::string CompilerInterfaceVC7::makeCfgName(std::string flavourBuild) {
+  std::ostringstream result;
+  result << flavourBuild << "|" << Util::os;
+  return result.str();
 }
-}
+
--- a/src/share/tools/MakeDeps/WinGammaPlatformVC7.h	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/WinGammaPlatformVC7.h	Wed Oct 07 14:38:00 2009 -0700
@@ -27,23 +27,27 @@
 
 #include <string>
 #include <vector>
+#include "BuildConfig.h"
+#include "WinGammaPlatform.h"
 
 class WinGammaPlatformVC7 : public WinGammaPlatform {
 
+    std::ofstream * printWriter;
+
     public: void writeProjectFile(std::string projectFileName, std::string projectName,
-                                 std::vector < ? > allConfigs) throw (IOException) ;
+                                 std::vector < BuildConfig * > allConfigs) throw (IOException) ;
 
+    /*abstract*/ class NameFilter {
+    protected: std::string fname;
+    public:
+        virtual /*abstract*/ bool match(FileInfo * fi) = 0;
 
-    virtual /*abstract*/ class NameFilter {
-        protected: std::string fname;
-
-        virtual /*abstract*/ bool match(FileInfo fi);
-
-        std::string  filterString() ;
+        virtual std::string filterString() ;
         std::string name() ;
     };
 
     class DirectoryFilter : public NameFilter {
+    public:
         std::string dir;
         int baseLen, dirLen;
 
@@ -51,8 +55,7 @@
 
         DirectoryFilter(std::string fname, std::string dir, std::string sbase) ;
 
-
-        bool match(FileInfo fi) ;
+        bool match(FileInfo * fi) ;
     };
 
     class TypeFilter : public NameFilter {
@@ -60,53 +63,55 @@
 
         TypeFilter(std::string fname, std::vector < std::string > exts) ;
 
-        bool match(FileInfo fi) ;
+        bool match(FileInfo * fi) ;
 
         std::string  filterString() ;
     };
 
     class TerminatorFilter : public NameFilter {
+    public:
         TerminatorFilter(std::string fname) ;
-        bool match(FileInfo fi) ;
+        bool match(FileInfo * fi) ;
 
     };
 
     class SpecificNameFilter : public NameFilter {
-        std::string pats[];
+    public:
+      std::vector < std::string > pats;
 
         SpecificNameFilter(std::string fname, std::vector < std::string > pats) ;
 
-        bool match(FileInfo fi) ;
+        bool match(FileInfo * fi) ;
 
     };
 
     class ContainerFilter : public NameFilter {
-        std::vector < ? > children;
+    public:
+        std::vector < NameFilter * > children;
 
         ContainerFilter(std::string fname) ;
-        bool match(FileInfo fi) ;
+        bool match(FileInfo * fi) ;
 
-        std::vector < ? >::iterator babies() ;
+        std::vector < NameFilter * > babies() ;
 
-        void add(NameFilter f) ;
+        void push_back(NameFilter * f) ;
     };
 
 
-    void writeCustomToolConfig(std::vector < ? > configs, std::vector < std::string > customToolAttrs) ;
+    void writeCustomToolConfig(std::vector < std::string > configs, std::vector < std::string > customToolAttrs) ;
 
     // here we define filters, which define layout of what can be seen in 'Solution View' of MSVC
     // Basically there are two types of entities - container filters and real filters
     //   - container filter just provides a container to group together real filters
     //   - real filter can select elements from the set according to some rule, put it into XML
     //     and remove from the list
-    std::vector < ? > makeFilters(TreeSet files) ;
+    std::vector < NameFilter* > makeFilters(std::vector < FileInfo * > files) ;
 
-    void writeFiles(std::vector < ? > allConfigs) ;
+    void writeFiles(std::vector < BuildConfig* > allConfigs) ;
 
-    void doWriteFiles(TreeSet allFiles, std::vector < ? > allConfigNames, NameFilter filter) ;
+    void doWriteFiles(std::vector < FileInfo* > * allFiles, std::vector < std::string > allConfigNames, NameFilter * filter) ;
 
-
-    void writeConfiguration(BuildConfig cfg) ;
+    void writeConfiguration(BuildConfig * cfg) ;
 
     int indent;
 
@@ -116,14 +121,13 @@
 
     void startTag(std::string name, std::vector < std::string > attrs) ;
 
-    void startTagV(std::string name, std::vector < ? > attrs) ;
+    void startTagV(std::string name, std::vector < std::string > attrs) ;
 
     void endTag(std::string name) ;
 
     void tag(std::string name, std::vector < std::string > attrs) ;
 
-     void tagV(std::string name, std::vector < ? > attrs) ;
-
+    void tagV(std::string name, std::vector < std::string > attrs) ;
 
     void doIndent() ;
 
@@ -131,17 +135,17 @@
 };
 
 class CompilerInterfaceVC7 : public CompilerInterface {
-    std::vector < ? > getBaseCompilerFlags(std::vector < ? > defines, std::vector < ? > includes, std::string outDir) ;
+    std::vector < std::string > getBaseCompilerFlags(std::vector < std::string > defines, std::vector < std::string > includes, std::string outDir) ;
 
-    std::vector < ? > getBaseLinkerFlags(std::string outDir, std::string outDll) ;
+    std::vector < std::string > getBaseLinkerFlags(std::string outDir, std::string outDll) ;
 
-    std::vector < ? > getDebugCompilerFlags(std::string opt) ;
+    std::vector < std::string > getDebugCompilerFlags(std::string opt) ;
 
-    std::vector < ? > getDebugLinkerFlags() ;
+    std::vector < std::string > getDebugLinkerFlags() ;
 
-    std::vector < ? > getProductCompilerFlags() ;
+    std::vector < std::string > getProductCompilerFlags() ;
 
-    std::vector < ? > getProductLinkerFlags() ;
+    std::vector < std::string > getProductLinkerFlags() ;
 
     std::string getOptFlag() ;
 
--- a/src/share/tools/MakeDeps/makefile	Thu Feb 28 22:49:00 2008 -0800
+++ b/src/share/tools/MakeDeps/makefile	Wed Oct 07 14:38:00 2009 -0700
@@ -3,11 +3,10 @@
 LDFLAGS=
 SOURCES=Exceptions.cpp FileFormatException.cpp MacroDefinitions.cpp \
 	FileName.cpp FileList.cpp Platform.cpp UnixPlatform.cpp \
-	MetroWerksMacPlatform.cpp Database.cpp MakeDeps.cpp
-
-# ArgsParser.cpp			
-# 	BuildConfig.cpp		 	DirectoryTree.cpp		Util.cpp \
-#	WinGammaPlatform.cpp	WinGammaPlatformVC6.cpp WinGammaPlatformVC7.cpp
+	MetroWerksMacPlatform.cpp Database.cpp MakeDeps.cpp \
+	ArgsParser.cpp Util.cpp DirectoryTree.cpp \
+	BuildConfig.cpp WinGammaPlatform.cpp \
+	WinGammaPlatformVC6.cpp WinGammaPlatformVC7.cpp
 
 OBJECTS=$(SOURCES:.cpp=.o)
 EXECUTABLE=MakeDeps