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

Nathanael Nerode neroden-guest at costa.debian.org
Tue Aug 30 14:38:23 UTC 2005


Author: neroden-guest
Date: 2005-08-30 14:38:22 +0000 (Tue, 30 Aug 2005)
New Revision: 101

Modified:
   pinfo/branches/cxx/src/mainfunction.cxx
   pinfo/branches/cxx/src/menu_and_note_utils.cxx
   pinfo/branches/cxx/src/menu_and_note_utils.h
Log:
Fold most of menu_and_note_utils.cxx into mainfunction.cxx.
Eliminate useless declarations in menu_and_note_utils.h, leaving
very little.



Modified: pinfo/branches/cxx/src/mainfunction.cxx
===================================================================
--- pinfo/branches/cxx/src/mainfunction.cxx	2005-08-30 14:30:50 UTC (rev 100)
+++ pinfo/branches/cxx/src/mainfunction.cxx	2005-08-30 14:38:22 UTC (rev 101)
@@ -43,6 +43,66 @@
 int toggled_by_menu = 0;
 long pos, cursor, infomenu, infocolumn=0;
 
+
+
+/* Inline support functions formerly in menu_and_note_utils.cxx */
+
+/*
+ * Read the `$foo' header entry
+ * Eliminates former duplicate code
+ */
+
+#define ERRNODE "ERR@!#$$@#!%%^#@!OR"
+
+static inline void
+get_foo_node(const char * const foo, char *type, char *node)
+{
+	string tmpstr = type;
+	string::size_type start_idx;
+	start_idx = tmpstr.find(foo);
+	if (start_idx == string::npos) {
+		strcpy(node, ERRNODE);
+		return;
+	}
+
+	start_idx += strlen(foo);
+	string::size_type end_idx;
+	end_idx = tmpstr.find_first_of(",\n", start_idx);
+	if (end_idx != string::npos) {
+		strcpy(node, tmpstr.substr(start_idx, end_idx - start_idx).c_str() );
+	}
+}
+
+/* read the `Next:' header entry */
+static inline void
+getnextnode(char *type, char *node)
+{
+	get_foo_node("Next: ", type, node);
+}
+
+/* read the `Prev:' header entry */
+static inline void
+getprevnode(char *type, char *node)
+{
+	get_foo_node("Prev: ", type, node);
+}
+
+/* read the `Up:' header entry */
+static inline void
+getupnode(char *type, char *node)
+{
+	get_foo_node("Up: ", type, node);
+}
+
+/* read the `Node:' header entry */
+static inline void
+getnodename(char *type, char *node)
+{
+	get_foo_node("Node: ", type, node);
+}
+
+/* Main work functions */
+
 WorkRVal
 work(char ***message, char **type, long *lines, FILE * id, int tag_table_pos)
 {

Modified: pinfo/branches/cxx/src/menu_and_note_utils.cxx
===================================================================
--- pinfo/branches/cxx/src/menu_and_note_utils.cxx	2005-08-30 14:30:50 UTC (rev 100)
+++ pinfo/branches/cxx/src/menu_and_note_utils.cxx	2005-08-30 14:38:22 UTC (rev 101)
@@ -47,56 +47,3 @@
 	}
 	TagTableEntries = 0;
 }
-
-/*
- * Read the `$foo' header entry
- * Eliminates former duplicate code
- */
-static inline void
-get_foo_node(const char * const foo, char *type, char *node)
-{
-	string tmpstr = type;
-	string::size_type start_idx;
-	start_idx = tmpstr.find(foo);
-	if (start_idx == string::npos) {
-		strcpy(node, ERRNODE);
-		return;
-	}
-
-	start_idx += strlen(foo);
-	string::size_type end_idx;
-	end_idx = tmpstr.find_first_of(",\n", start_idx);
-	if (end_idx != string::npos) {
-		strcpy(node, tmpstr.substr(start_idx, end_idx - start_idx).c_str() );
-	}
-	/* Otherwise what?  EOF? */
-}
-
-/* read the `Next:' header entry */
-void
-getnextnode(char *type, char *node)
-{
-	get_foo_node("Next: ", type, node);
-}
-
-/* read the `Prev:' header entry */
-void
-getprevnode(char *type, char *node)
-{
-	get_foo_node("Prev: ", type, node);
-}
-
-/* read the `Up:' header entry */
-void
-getupnode(char *type, char *node)
-{
-	get_foo_node("Up: ", type, node);
-}
-
-
-/* read the `Node:' header entry */
-void
-getnodename(char *type, char *node)
-{
-	get_foo_node("Node: ", type, node);
-}

Modified: pinfo/branches/cxx/src/menu_and_note_utils.h
===================================================================
--- pinfo/branches/cxx/src/menu_and_note_utils.h	2005-08-30 14:30:50 UTC (rev 100)
+++ pinfo/branches/cxx/src/menu_and_note_utils.h	2005-08-30 14:38:22 UTC (rev 101)
@@ -3,6 +3,7 @@
  *
  *  Copyright (C) 1999  Przemek Borys <pborys at dione.ids.pl>
  *  Copyright (C) 2005  Bas Zoetekouw <bas at debian.org>
+ *  Copyright 2005  Nathanael Nerode <neroden at gcc.gnu.org>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of version 2 of the GNU General Public License as
@@ -22,24 +23,6 @@
 #ifndef __MENU_AND_NOTE_UTILS_H
 #define __MENU_AND_NOTE_UTILS_H
 
-#define ERRNODE "ERR@!#$$@#!%%^#@!OR"
-
-/* checks whether a line contains menu */
-int ismenu (const char *line);
-/* checks whether a line contains note */
-int isnote (char *line, char *nline);
-/* reads menu token from line */
-int getmenutoken (char *line);
-/* reads note token from line */
-int getnotetoken (char *line, char *nline);
-/* gets nextnode token from top line */
-void getnextnode (char *type, char *node);
-/* gets prevnode token from top line */
-void getprevnode (char *type, char *node);
-/* gets the up node token from top line */
-void getupnode (char *type, char *node);
-/* reads the nodename from top line */
-void getnodename (char *type, char *node);
 void freeindirect ();
 void freetagtable ();
 #endif




More information about the Pinfo-devel mailing list