From f923ba3f0527af7f0df2eb5b2ebad9b2c40083d8 Mon Sep 17 00:00:00 2001
From: toole1 <toole1@6fbd10e7-183d-0410-a318-cb416676e4f2>
Date: Tue, 31 Jan 2012 22:24:27 +0000
Subject: [PATCH] monad release 3.0.2

git-svn-id: https://subversion.cs.illinois.edu/svn/cs225@5941 6fbd10e7-183d-0410-a318-cb416676e4f2
---
 .monadid                |  2 +-
 monad                   |  2 +-
 source/Makefile         |  2 +-
 source/Makefile.proxy   |  2 +-
 source/monad.cpp        | 24 ++++++++++++++++--------
 source/monad_shared.cpp |  4 ++--
 source/monad_shared.h   |  7 +++----
 7 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/.monadid b/.monadid
index 605d7b6..8cb4b48 100644
--- a/.monadid
+++ b/.monadid
@@ -1,4 +1,4 @@
 pure-monad identification file
 This file is used for pure-monad directory identification
 Built by toole1 on linux1.ews.illinois.edu
-Build Date: Thu Jan 26 17:09:06 CST 2012
+Build Date: Tue Jan 31 16:22:13 CST 2012
diff --git a/monad b/monad
index 36eb538..d87b952 100755
--- a/monad
+++ b/monad
@@ -14,7 +14,7 @@ MONAD_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
 SOURCE_DIR="$MONAD_DIR/source"
 CALLING_DIR=`pwd`
 
-svn up "$MONAD_DIR" -q
+svn up "$MONAD_DIR" -q --accept theirs-full
 make -C "$SOURCE_DIR" -q
 if [ "$?" -ne 0 ]; then
 	make -C "$SOURCE_DIR" --quiet
diff --git a/source/Makefile b/source/Makefile
index 86d2eca..4aa17a7 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -4,7 +4,7 @@ EXENAME = pure-monad
 CCMONAD = cc-monad
 OBJS = monad.o help.o util.o monad_shared.o
 CCOBJS = ccmonad.o util.o monad_shared.o
-IDFILE = .monadid
+IDFILE = ../.monadid
 OPTIMIZE = off
 
 ifeq ($(strip $(OPTIMIZE)),on)
diff --git a/source/Makefile.proxy b/source/Makefile.proxy
index 4552196..0ba37c0 100644
--- a/source/Makefile.proxy
+++ b/source/Makefile.proxy
@@ -36,7 +36,7 @@ $(TESTEXE): $(TESTOBJS)
 	$(CC) $(TESTOBJS) $(LIBS) -o $@
 
 unit_tests.o : unit_tests.cpp $(wildcard *.h)
-	../cc-monad $(CC) $(CFLAGS) -c $(@:.o=.cpp) -o $@
+	../source/cc-monad $(CC) $(CFLAGS) -c $(@:.o=.cpp) -o $@
 
 %.o : %.cpp $(wildcard *.h)
 	$(CC) $(CFLAGS) -c $(@:.o=.cpp) -o $@
diff --git a/source/monad.cpp b/source/monad.cpp
index c5ad909..5fa40b8 100644
--- a/source/monad.cpp
+++ b/source/monad.cpp
@@ -27,6 +27,7 @@ const int8_t no_mp_part = -1;
 int callingDirFD;
 int monadDirFD;
 
+string monadSourceFolder;
 string testsFolder;
 string sourceFolder;
 string gradeFolder;
@@ -72,7 +73,7 @@ int main(int argc, const char * const * argv)
 
 	// Read in local config settings.
 	// Necessary to do this early for [SVN Root] url
-	readConfig("./", config);
+	readConfig(monadSourceFolder, config);
 	processArgs(argc, argv);
 
 	cout << versioninfo::official_name << endl;
@@ -100,7 +101,7 @@ int main(int argc, const char * const * argv)
 	//	sleep(1);
 
 	output::header("Compiling");
-	chdir(gradeFolder.c_str());
+	chdir(gradeFolder);
 
 	// #define MP_PART_NUMBER in proxy
 	create_mp_part_file();
@@ -322,6 +323,14 @@ void monad::find_base_dir(const char * argv0)
 	}
 	delete [] dir;
 	
+	if (exists("../.monadid"))
+	{
+		chdir("../");
+		monadSourceFolder = "./source/";
+	}
+	else
+		monadSourceFolder = "./";
+
 	monadDirFD = open(".", 0);
 
 	// Ensure the dir is correct
@@ -349,10 +358,10 @@ void monad::copyRequiredFiles()
 	exec("/bin/mkdir", gradeFolder);
 
 	// Copy and link appropriate files - parsed from config.ini
-	importFiles(tempFolder, "./",         gradeFolder, config["Monad Files"]);
-	importFiles(tempFolder, testsFolder,  gradeFolder, config["Testing Files"]);
-	importFiles("",         sourceFolder, gradeFolder, config["Required Files"]);
-	importFiles(tempFolder, "",           gradeFolder, config["Preserved Files"]);
+	importFiles(tempFolder, monadSourceFolder, gradeFolder, config["Monad Files"]);
+	importFiles(tempFolder, testsFolder,       gradeFolder, config["Testing Files"]);
+	importFiles("",         sourceFolder,      gradeFolder, config["Required Files"]);
+	importFiles(tempFolder, "",                gradeFolder, config["Preserved Files"]);
 
 	forceRemoveDir(tempFolder);
 
@@ -368,7 +377,7 @@ void monad::importFiles(const string & preservedFolder, const string & theSource
 
 	assertExists(destFolder);
 	if (preservedFolder != "") assertExists(preservedFolder);
-	if (theSourceFolder    != "") assertExists(theSourceFolder, student_error_code);
+	if (theSourceFolder != "") assertExists(theSourceFolder, student_error_code);
 
 	for (size_t i = 0; i < files.size(); i++)
 	{
@@ -379,7 +388,6 @@ void monad::importFiles(const string & preservedFolder, const string & theSource
 		if (preservedFolder != "" && exists(preservedFile) &&
 		    (theSourceFolder == "" || (permissions(preservedFile) & S_IWUSR) == 0))
 		{
-//!!			cout << "mv " << preservedFile << ' ' << destFile << endl;
 			EXIT_IF_ERROR(rename(preservedFile.c_str(), destFile.c_str()));
 		}
 		else if (theSourceFolder != "")
diff --git a/source/monad_shared.cpp b/source/monad_shared.cpp
index 2866493..8ad8480 100644
--- a/source/monad_shared.cpp
+++ b/source/monad_shared.cpp
@@ -15,8 +15,8 @@ namespace versioninfo
 {
 const char * official_name = "Monad Autograder";
 const char * version_name  = "mazecity";
-const Version version_num  = Version(3, 0, 0, 1);
-const char * date          = "18 Jan 2012";
+const Version version_num  = Version(3, 0, 2);
+const char * date          = "31 Jan 2012";
 }
 
 const char * unit_test_result::pass_string = "~~PASSED~~";
diff --git a/source/monad_shared.h b/source/monad_shared.h
index be64ec4..16465e9 100644
--- a/source/monad_shared.h
+++ b/source/monad_shared.h
@@ -11,10 +11,9 @@ namespace monad_shared
 		int32_t major_;
 		int32_t minor_;
 		int32_t patch_;
-		int32_t build_;
 
-		Version(int32_t maj, int32_t min, int32_t pat, int32_t bld)
-			: major_(maj), minor_(min), patch_(pat), build_(bld)
+		Version(int32_t maj, int32_t min, int32_t pat)
+			: major_(maj), minor_(min), patch_(pat)
 		{ }
 
 #if 0
@@ -27,7 +26,7 @@ namespace monad_shared
 
 		void print(std::ostream & out) const
 		{
-			out << major_ << '.' << minor_ << '.' << patch_ << '.' << build_;
+			out << major_ << '.' << minor_ << '.' << patch_;
 		}
 	};
 
-- 
GitLab