Removed mark types as they served absolutely zero purpose

Sun, 12 Aug 2012 04:13:27 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Sun, 12 Aug 2012 04:13:27 +0300
changeset 45
e1d3b7ea975c
parent 44
6bbaebc472b5
child 46
a29eeecf3ecb

Removed mark types as they served absolutely zero purpose

databuffer.h file | annotate | diff | comparison | revisions
objwriter.cxx file | annotate | diff | comparison | revisions
objwriter.h file | annotate | diff | comparison | revisions
parser.cxx file | annotate | diff | comparison | revisions
--- a/databuffer.h	Sun Aug 12 04:10:25 2012 +0300
+++ b/databuffer.h	Sun Aug 12 04:13:27 2012 +0300
@@ -145,7 +145,7 @@
 		for (u = 0; u < MAX_MARKS; u++) {
 			if (other->marks[u]) {
 				// Add the mark and offset its position.
-				unsigned int u = AddMark (other->marks[u]->type, other->marks[u]->name);
+				unsigned int u = AddMark (other->marks[u]->name);
 				marks[u]->pos += other->writesize;
 			}
 			
@@ -172,7 +172,7 @@
 	// position in the bytecode. The actual permanent position cannot
 	// be predicted in any way or form, thus these things will be used
 	// to "mark" a position like that for future use.
-	unsigned int AddMark (int type, str name) {
+	unsigned int AddMark (str name) {
 		// Find a free slot for the mark
 		unsigned int u;
 		for (u = 0; u < MAX_MARKS; u++)
@@ -184,7 +184,6 @@
 		
 		ScriptMark* m = new ScriptMark;
 		m->name = name;
-		m->type = type;
 		m->pos = writesize;
 		marks[u] = m;
 		return u;
--- a/objwriter.cxx	Sun Aug 12 04:10:25 2012 +0300
+++ b/objwriter.cxx	Sun Aug 12 04:13:27 2012 +0300
@@ -154,8 +154,8 @@
 ScriptMark* g_ScriptMark = NULL;
 
 // Adds a mark
-unsigned int ObjWriter::AddMark (int type, str name) {
-	return GetCurrentBuffer()->AddMark (type, name);
+unsigned int ObjWriter::AddMark (str name) {
+	return GetCurrentBuffer()->AddMark (name);
 }
 
 // Adds a reference
@@ -165,10 +165,10 @@
 }
 
 // Finds a mark
-unsigned int ObjWriter::FindMark (int type, str name) {
+unsigned int ObjWriter::FindMark (str name) {
 	DataBuffer* b = GetCurrentBuffer();
 	for (unsigned int u = 0; u < MAX_MARKS; u++) {
-		if (b->marks[u] && b->marks[u]->type == type && !b->marks[u]->name.icompare (name))
+		if (b->marks[u] && !b->marks[u]->name.icompare (name))
 			return u;
 	}
 	return MAX_MARKS;
--- a/objwriter.h	Sun Aug 12 04:10:25 2012 +0300
+++ b/objwriter.h	Sun Aug 12 04:13:27 2012 +0300
@@ -72,12 +72,10 @@
 	void WriteBuffers ();
 	void WriteStringTable ();
 	void WriteToFile ();
-	void StartDo ();
-	void EndDo ();
 	DataBuffer* GetCurrentBuffer ();
 	
-	unsigned int AddMark (int type, str name);
-	unsigned int FindMark (int type, str name);
+	unsigned int AddMark (str name);
+	unsigned int FindMark (str name);
 	unsigned int AddReference (unsigned int mark);
 	void MoveMark (unsigned int mark);
 	void OffsetMark (unsigned int mark, int offset);
--- a/parser.cxx	Sun Aug 12 04:10:25 2012 +0300
+++ b/parser.cxx	Sun Aug 12 04:13:27 2012 +0300
@@ -187,7 +187,7 @@
 			if (FindGlobalVariable (token))
 				ParserError ("label name `%s` conflicts with variable\n", token.chars());
 			
-			w->AddMark (MARKTYPE_LABEL, token);
+			w->AddMark (token);
 			MustNext (":");
 			continue;
 		}
@@ -201,7 +201,7 @@
 			MustNext ();
 			
 			// Find the mark this goto statement points to
-			unsigned int m = w->FindMark (MARKTYPE_LABEL, token);
+			unsigned int m = w->FindMark (token);
 			if (m == MAX_MARKS)
 				ParserError ("unknown label `%s`!", token.chars());
 			
@@ -231,7 +231,7 @@
 			
 			// Add a mark - to here temporarily - and add a reference to it.
 			// Upon a closing brace, the mark will be adjusted.
-			unsigned int marknum = w->AddMark (MARKTYPE_IF, "");
+			unsigned int marknum = w->AddMark ("");
 			
 			// Use DH_IFNOTGOTO - if the expression is not true, we goto the mark
 			// we just defined - and this mark will be at the end of the block.
@@ -254,8 +254,8 @@
 			// end. The condition is checked at the very start of the loop, if it fails,
 			// we use goto to skip to the end of the loop. At the end, we loop back to
 			// the beginning with a go-to statement.
-			unsigned int mark1 = w->AddMark (MARKTYPE_INTERNAL, ""); // start
-			unsigned int mark2 = w->AddMark (MARKTYPE_INTERNAL, ""); // end
+			unsigned int mark1 = w->AddMark (""); // start
+			unsigned int mark2 = w->AddMark (""); // end
 			
 			// Condition
 			MustNext ("(");
@@ -306,8 +306,8 @@
 			w->WriteBuffer (init);
 			
 			// Init two marks
-			int mark1 = w->AddMark (MARKTYPE_INTERNAL, "");
-			int mark2 = w->AddMark (MARKTYPE_INTERNAL, "");
+			int mark1 = w->AddMark ("");
+			int mark2 = w->AddMark ("");
 			
 			// Add the condition
 			w->WriteBuffer (cond);
@@ -330,7 +330,7 @@
 			MustNext ("{");
 			
 			// Store the marks and incrementor
-			blockstack[g_BlockStackCursor].mark1 = w->AddMark (MARKTYPE_INTERNAL, "");
+			blockstack[g_BlockStackCursor].mark1 = w->AddMark ("");
 			blockstack[g_BlockStackCursor].type = BLOCKTYPE_DO;
 			continue;
 		}

mercurial