[Pinfo-devel] r174 - pinfo/branches/cxx/src
Nathanael Nerode
neroden-guest at costa.debian.org
Tue Sep 6 12:16:56 UTC 2005
Author: neroden-guest
Date: 2005-09-06 12:16:55 +0000 (Tue, 06 Sep 2005)
New Revision: 174
Modified:
pinfo/branches/cxx/src/mainfunction.cxx
pinfo/branches/cxx/src/printinfo.cxx
pinfo/branches/cxx/src/printinfo.h
Log:
Convert use of message in (untested) printinfo to vector<string>.
Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx 2005-09-06 11:59:03 UTC (rev 173)
+++ pinfo/branches/cxx/src/mainfunction.cxx 2005-09-06 12:16:55 UTC (rev 174)
@@ -211,8 +211,20 @@
if ((key == keys.print_1) ||
(key == keys.print_2))
{
- if (yesno(_("Are you sure to print?"), 0) == 1)
- printnode(message, lines);
+ if (yesno(_("Are you sure you want to print?"), 0) == 1) {
+ /* Quick conversion to vector. Temporary, FIXME. */
+ vector<string> my_message;
+ for (typeof(my_message.size()) x = 0; x < Lines; x++) {
+ if ((*message)[x] == NULL) {
+ my_message.push_back("");
+ /* Yaah, FIXME. index 0 is funky. */
+ } else {
+ string foo = (*message)[x];
+ my_message.push_back(foo);
+ }
+ }
+ printnode(my_message);
+ }
}
/*==========================================================================*/
if ((key == keys.pgdn_auto_1) ||
Modified: pinfo/branches/cxx/src/printinfo.cxx
===================================================================
--- pinfo/branches/cxx/src/printinfo.cxx 2005-09-06 11:59:03 UTC (rev 173)
+++ pinfo/branches/cxx/src/printinfo.cxx 2005-09-06 12:16:55 UTC (rev 174)
@@ -23,6 +23,8 @@
#include "common_includes.h"
#include <string>
using std::string;
+#include <vector>
+using std::vector;
/*
* Algorithm: We first print highlights, then we send `\r' to the printer,
@@ -30,7 +32,7 @@
* are darker than the rest :)
*/
void
-printnode(char ***message, long *lines)
+printnode(const vector<string> message)
{
/* printer fd */
FILE *prnFD;
@@ -38,7 +40,7 @@
prnFD = popen(printutility.c_str(), "w");
/* scan through all lines */
- for (int i = 1; i < (*lines); i++) {
+ for (int i = 1; i < message.size(); i++) {
/*
* This says where the printer's head is right now,
* offset in columns from the beginning of the line
@@ -47,8 +49,6 @@
/*
* Handle the highlights which belong to our (i'th) line.
*/
- /* FIXME: This depends on the hyperobjects being sorted, and
- * they aren't. */
int highlight = 0; /* counter to track which highlights have been handled */
while (hyperobjects[highlight].line <= i) {
string mynode;
@@ -84,7 +84,7 @@
}
/* Carriage return and print the whole line. */
fputc('\r', prnFD);
- fputs( (*message)[i], prnFD);
+ fputs( message[i].c_str(), prnFD);
}
pclose(prnFD);
}
Modified: pinfo/branches/cxx/src/printinfo.h
===================================================================
--- pinfo/branches/cxx/src/printinfo.h 2005-09-06 11:59:03 UTC (rev 173)
+++ pinfo/branches/cxx/src/printinfo.h 2005-09-06 12:16:55 UTC (rev 174)
@@ -22,7 +22,9 @@
#ifndef PRINTINFO_H
#define PRINTINFO_H
+#include <string>
+#include <vector>
/* prints node, pointed by `message', of `lines' length. */
-void printnode (char ***message, long *lines);
+void printnode (const std::vector<std::string> message);
#endif
More information about the Pinfo-devel
mailing list