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

Nathanael Nerode neroden-guest at costa.debian.org
Tue Sep 6 13:02:12 UTC 2005


Author: neroden-guest
Date: 2005-09-06 13:02:11 +0000 (Tue, 06 Sep 2005)
New Revision: 178

Modified:
   pinfo/branches/cxx/src/mainfunction.cxx
   pinfo/branches/cxx/src/mainfunction.h
   pinfo/branches/cxx/src/pinfo.cxx
Log:
Pull vector<string> version of message through the interface of work().


Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx	2005-09-06 12:55:41 UTC (rev 177)
+++ pinfo/branches/cxx/src/mainfunction.cxx	2005-09-06 13:02:11 UTC (rev 178)
@@ -105,17 +105,9 @@
 /* Main work functions */
 
 WorkRVal
-work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos)
+work(const vector<string> my_message, char **type, FILE * id, int tag_table_pos)
 {
 #define Type	(*type)
-	/* Quick conversion to vector.  Temporary, FIXME. */
-	vector<string> my_message;
-	for (typeof(my_message.size()) x = 0; x < (*lines); x++) {
-		/* one-based to zero-based conversion, ick */
-		string foo = (*message)[x + 1];
-		my_message.push_back(foo);
-	}
-
 	static WorkRVal rval;
 	FILE *pipe;
 	int fileoffset;

Modified: pinfo/branches/cxx/src/mainfunction.h
===================================================================
--- pinfo/branches/cxx/src/mainfunction.h	2005-09-06 12:55:41 UTC (rev 177)
+++ pinfo/branches/cxx/src/mainfunction.h	2005-09-06 13:02:11 UTC (rev 178)
@@ -23,6 +23,7 @@
 #ifndef __MAINFUNCTION_H
 #define __MAINFUNCTION_H
 #include <string>
+#include <vector>
 
 /*
  * return value type for work(). it is the name of node, where to go, after
@@ -43,12 +44,11 @@
 /*
  * this is main function which handles almost all of the work (keyboard
  * actions while viewing info). Arguments:
- * message: a pointer to char** node content, stored line by line.
+ * message: vector of string node content, stored line by line.
  * type: a pointer to char*, which holds the header of info node.
- * lines: pointer to a long, which holds the number of lines in node.
  * id: file descriptor of current info file
  * tag_table_pos: position in tag table of the current node (needed for history)
  */
-WorkRVal work (char ***message, char **type, long *lines,
+WorkRVal work (const std::vector<std::string> message, char **type,
 		FILE * id, int tag_table_pos);
 #endif

Modified: pinfo/branches/cxx/src/pinfo.cxx
===================================================================
--- pinfo/branches/cxx/src/pinfo.cxx	2005-09-06 12:55:41 UTC (rev 177)
+++ pinfo/branches/cxx/src/pinfo.cxx	2005-09-06 13:02:11 UTC (rev 178)
@@ -27,6 +27,8 @@
 
 #include <string>
 using std::string;
+#include <vector>
+using std::vector;
 
 #ifdef HAVE_GETOPT_LONG
  #include <getopt.h>
@@ -398,7 +400,16 @@
 			addinfohistory(curfile, tag_table[tag_table_pos].nodename, -1, -1, -1);
 		else
 			filenotfound = 0;
-		work_return_value = work(&message, &type, &lines, id, tag_table_pos);
+
+		/* Quick conversion to vector.  Temporary, FIXME. */
+		vector<string> my_message;
+		for (typeof(my_message.size()) x = 0; x < lines; x++) {
+			/* one-based to zero-based conversion, ick */
+			string foo = message[x + 1];
+			my_message.push_back(foo);
+		}
+
+		work_return_value = work(my_message, &type, id, tag_table_pos);
 		if (work_return_value.keep_going)
 		{
 			/* no cross-file link selected */




More information about the Pinfo-devel mailing list