[Pinfo-devel] r147 - pinfo/branches/cxx/src

Nathanael Nerode neroden-guest at costa.debian.org
Fri Sep 2 10:04:24 UTC 2005


Author: neroden-guest
Date: 2005-09-02 10:04:23 +0000 (Fri, 02 Sep 2005)
New Revision: 147

Modified:
   pinfo/branches/cxx/src/filehandling_functions.cxx
   pinfo/branches/cxx/src/initializelinks.cxx
   pinfo/branches/cxx/src/mainfunction.cxx
   pinfo/branches/cxx/src/manual.cxx
   pinfo/branches/cxx/src/utils.cxx
Log:
Use typeof rather than complicated vector<blah>::foo expressions.


Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx	2005-09-02 09:42:17 UTC (rev 146)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx	2005-09-02 10:04:23 UTC (rev 147)
@@ -951,7 +951,7 @@
 {
 	FILE *id = 0;
 	int initial;
-	for (vector<Indirect>::size_type i = 0; i < indirect.size(); i++)
+	for (typeof(indirect.size()) i = 0; i < indirect.size(); i++)
 	{
 		id = openinfo(indirect[i].filename, 1);
 		initial = tag_table.size(); /* Before create_tag_table operates */

Modified: pinfo/branches/cxx/src/initializelinks.cxx
===================================================================
--- pinfo/branches/cxx/src/initializelinks.cxx	2005-09-02 09:42:17 UTC (rev 146)
+++ pinfo/branches/cxx/src/initializelinks.cxx	2005-09-02 10:04:23 UTC (rev 147)
@@ -40,8 +40,8 @@
 
 void
 sort_hyperlinks_from_current_line(
-	vector<HyperObject>::iterator startlink,
-	vector<HyperObject>::iterator endlink)
+	typeof(hyperobjects.begin()) startlink,
+	typeof(hyperobjects.begin()) endlink)
 {
 	std::sort(startlink, endlink, compare_hyperlink);
 }
@@ -225,7 +225,7 @@
 	int changed;
 	int line1len = strlen(line1);
 
-	vector<HyperObject>::size_type initial_hyperobjects_size = hyperobjects.size();
+	typeof(hyperobjects.size()) initial_hyperobjects_size = hyperobjects.size();
 
 	strcpy(buf, line1);		/* copy two lines into one */
 	if (strlen(line1))
@@ -632,7 +632,7 @@
 		hyperobjects.push_back(my_ho);
 	}
 	if (hyperobjects.size() > initial_hyperobjects_size) {
-		vector<HyperObject>::iterator first_new_link
+		typeof(hyperobjects.begin()) first_new_link
 			= hyperobjects.end() - (hyperobjects.size() - initial_hyperobjects_size);
 		sort_hyperlinks_from_current_line(first_new_link, hyperobjects.end());
 	}

Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx	2005-09-02 09:42:17 UTC (rev 146)
+++ pinfo/branches/cxx/src/mainfunction.cxx	2005-09-02 10:04:23 UTC (rev 147)
@@ -37,7 +37,7 @@
 void rescan_cursor();	/* set the cursor to 1st item on visible screen */
 void next_infomenu();	/* go to the next menu item for sequential reading */
 int getnodeoffset(int tag_table_pos,
-			vector<Indirect>::size_type& indirectstart);	/* get node offset in file */
+			typeof(indirect.size())& indirectstart);	/* get node offset in file */
 
 int aftersearch = 0;
 /*
@@ -48,7 +48,7 @@
 long pos, infomenu;
 long infocolumn=0;
 
-vector<HyperObject>::size_type cursor;
+typeof(hyperobjects.size()) cursor;
 
 
 
@@ -115,7 +115,7 @@
 	static WorkRVal rval;
 	FILE *pipe;
 	int fileoffset;
-	vector<Indirect>::size_type indirectstart = -1;
+	typeof(indirect.size()) indirectstart = -1;
 	int cursorchanged = 0;
 	int key = 0;
 	int return_value;
@@ -391,7 +391,7 @@
 					long tokenpos;
 					long starttokenpos;
 					long filelen;
-					for (vector<Indirect>::size_type j = indirectstart;
+					for (typeof(indirect.size()) j = indirectstart;
 					     j < indirect.size(); j++)
 					{
 						fd = openinfo(indirect[j].filename, 1);	/* get file length. */
@@ -854,7 +854,7 @@
 					(key == keys.up_2))
 			{
 				cursorchanged = 0;
-				if (cursor != (vector<HyperObject>::size_type)-1)	{
+				if (cursor != (typeof(hyperobjects.size()))-1)	{
 					/* if we must handle cursor... */
 					if ((cursor > 0) &&(hyperobjects.size()))
 						/* if we really must handle it ;) */
@@ -882,7 +882,7 @@
 					if (pos > 2)	/* lower the nodepos */
 						pos--;
 					/* and scan for a hyperlink in the new line */
-					for (vector<HyperObject>::size_type i = 0;
+					for (typeof(hyperobjects.size()) i = 0;
 					     i < hyperobjects.size(); i++) {
 						if (hyperobjects[i].line == pos)
 						{
@@ -961,7 +961,7 @@
 			{
 				cursorchanged = 0;	/* works similar to keys.up */
 				if (cursor < hyperobjects.size())
-					for (vector<HyperObject>::size_type i = cursor + 1;
+					for (typeof(hyperobjects.size()) i = cursor + 1;
 					     i < hyperobjects.size(); i++)
 					{
 						if ((hyperobjects[i].line >= pos) &&
@@ -979,7 +979,7 @@
 				{
 					if (pos <= Lines -(maxy - 2))
 						pos++;
-					for (vector<HyperObject>::size_type i = cursor + 1;
+					for (typeof(hyperobjects.size()) i = cursor + 1;
 					     i < hyperobjects.size(); i++)
 					{
 						if ((hyperobjects[i].line >= pos) &&
@@ -1113,7 +1113,7 @@
 				{
 					if ((mouse.y > 0) &&(mouse.y < maxy - 1))
 					{
-						for (vector<HyperObject>::size_type i = cursor; i > 0; i--)
+						for (typeof(hyperobjects.size()) i = cursor; i > 0; i--)
 						{
 							if (hyperobjects[i].line == mouse.y + pos - 1)
 							{
@@ -1132,7 +1132,7 @@
 							}
 						}
 						if (!done)
-							for (vector<HyperObject>::size_type i = cursor;
+							for (typeof(hyperobjects.size()) i = cursor;
 							     i < hyperobjects.size(); i++)
 							{
 								if (hyperobjects[i].line == mouse.y + pos - 1)
@@ -1161,7 +1161,7 @@
 				{
 					if ((mouse.y > 0) &&(mouse.y < maxy - 1))
 					{
-						for (vector<HyperObject>::size_type i = cursor; i >= 0; i--)
+						for (typeof(hyperobjects.size()) i = cursor; i >= 0; i--)
 						{
 							if (hyperobjects[i].line == mouse.y + pos - 1)
 							{
@@ -1180,7 +1180,7 @@
 							}
 						}
 						if (!done)
-							for (vector<HyperObject>::size_type i = cursor;
+							for (typeof(hyperobjects.size()) i = cursor;
 							     i < hyperobjects.size(); i++)
 							{
 								if (hyperobjects[i].line == mouse.y + pos - 1)
@@ -1233,7 +1233,7 @@
 		infomenu = -1;
 		return;
 	}
-	for (vector<HyperObject>::size_type i = infomenu + 1;
+	for (typeof(hyperobjects.size()) i = infomenu + 1;
 	     i < hyperobjects.size(); i++) {
 		if (hyperobjects[i].type <= 1) { /* menu item */
 			infomenu = i;
@@ -1246,7 +1246,7 @@
 void
 rescan_cursor()
 {
-	for (vector<HyperObject>::size_type i = 0; i < hyperobjects.size(); i++)
+	for (typeof(hyperobjects.size()) i = 0; i < hyperobjects.size(); i++)
 	{
 		if ((hyperobjects[i].line >= pos) &&
 				(hyperobjects[i].line < pos +(maxy - 2)))
@@ -1262,13 +1262,13 @@
 
 int
 getnodeoffset(int tag_table_pos,
-              vector<Indirect>::size_type& indirectstart)
+              typeof(indirect.size())& indirectstart)
 							/* count node offset in file */
 {
 	int fileoffset = 0;
 	if (!indirect.empty())
 	{
-		for (vector<Indirect>::size_type i = indirect.size() - 1; i >= 0; i--)
+		for (typeof(indirect.size()) i = indirect.size() - 1; i >= 0; i--)
 		{
 			if (indirect[i].offset <= tag_table[tag_table_pos].offset)
 			{

Modified: pinfo/branches/cxx/src/manual.cxx
===================================================================
--- pinfo/branches/cxx/src/manual.cxx	2005-09-02 09:42:17 UTC (rev 146)
+++ pinfo/branches/cxx/src/manual.cxx	2005-09-02 10:04:23 UTC (rev 147)
@@ -537,8 +537,8 @@
 
 void
 sort_manuallinks_from_current_line(
-	vector<manuallink>::iterator startlink,
-	vector<manuallink>::iterator endlink)
+	typeof(manuallinks.begin()) startlink,
+	typeof(manuallinks.begin()) endlink)
 {
 	std::sort(startlink, endlink, compare_manuallink);
 }
@@ -547,7 +547,7 @@
 void
 man_initializelinks(char *tmp, int carry)
 {
-	vector<manuallink>::size_type initialManualLinks = manuallinks.size();
+	typeof(manuallinks.size()) initialManualLinks = manuallinks.size();
 	/******************************************************************************
 	 * handle url refrences                                                       *
 	 *****************************************************************************/
@@ -735,7 +735,7 @@
 	/* do this loop until strchr() won't find a '(' in string */
 
 	if (manuallinks.size() > initialManualLinks) {
-		vector<manuallink>::iterator first_new_link
+		typeof(manuallinks.begin()) first_new_link
 			= manuallinks.end() - (manuallinks.size() - initialManualLinks); 
 		sort_manuallinks_from_current_line(first_new_link, manuallinks.end());
 	}

Modified: pinfo/branches/cxx/src/utils.cxx
===================================================================
--- pinfo/branches/cxx/src/utils.cxx	2005-09-02 09:42:17 UTC (rev 146)
+++ pinfo/branches/cxx/src/utils.cxx	2005-09-02 10:04:23 UTC (rev 147)
@@ -364,7 +364,7 @@
 {
   TagTable dummy;
 	dummy.nodename = node;
-	std::pair<vector<TagTable>::iterator, vector<TagTable>::iterator> my_result;
+	std::pair<typeof(tag_table.begin()), typeof(tag_table.begin())> my_result;
 	/* The following does binary search */
 	my_result = std::equal_range(tag_table.begin(), tag_table.end(),
 	                             dummy, compare_tags);




More information about the Pinfo-devel mailing list