[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5659] M-x menu-sequence
From: |
Gavin D. Smith |
Subject: |
[5659] M-x menu-sequence |
Date: |
Wed, 11 Jun 2014 17:52:16 +0000 |
Revision: 5659
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5659
Author: gavin
Date: 2014-06-11 17:52:15 +0000 (Wed, 11 Jun 2014)
Log Message:
-----------
M-x menu-sequence
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/info.c
trunk/info/nodes.c
trunk/info/nodes.h
trunk/info/session.c
trunk/info/session.h
trunk/info/t/dir-menus-sloppily.sh
Added Paths:
-----------
trunk/info/t/menu-sequence.drib
trunk/info/t/menu-sequence.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/ChangeLog 2014-06-11 17:52:15 UTC (rev 5659)
@@ -1,5 +1,15 @@
-2014-06-12 Gavin Smith <address@hidden>
+2014-06-11 Gavin Smith <address@hidden>
+ * info/session.c (info_follow_menus): Return value changed. All
+ callers updated.
+ * info/nodes.c (info_get_node_with_defaults)
+ (get_filename_and_nodename): Use a NODE instead of a WINDOW to give
+ the defaults.
+ * info/menu-sequence.sh: New test.
+ * info/dir-menus-sloppily.sh: Sequence of menu labels corrected.
+
+2014-06-11 Gavin Smith <address@hidden>
+
* info/info-utils.c (info_parse_node): Don't parse line number part of
menus. Return value and arguments changed. All callers updated.
(info_parsed_line_number): Removed.
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/info/Makefile.am 2014-06-11 17:52:15 UTC (rev 5659)
@@ -118,6 +118,7 @@
t/index-apropos.sh \
t/split-index.sh \
t/index-long-nodeline.sh \
+ t/menu-sequence.sh \
t/quoted-label-as-target.sh \
t/quoted-target.sh \
t/quoted-label-and-target.sh \
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/info/info.c 2014-06-11 17:52:15 UTC (rev 5659)
@@ -362,7 +362,7 @@
else if (*argv)
{
NODE *initial_node; /* Node to start following menus from. */
- char *node_via_menus;
+ NODE *node_via_menus;
if (ref_index == 0)
add_pointer_to_array
@@ -380,8 +380,9 @@
argv += argc; argc = 0;
free (ref_list[0]);
- ref_list[0] = info_new_reference (initial_file->fullpath,
- node_via_menus);
+ ref_list[0] = info_new_reference (node_via_menus->filename,
+ node_via_menus->nodename);
+ free (node_via_menus);
}
/* If no nodes found, and there is exactly one argument remaining,
@@ -432,8 +433,9 @@
argv += argc; argc = 0;
free (ref_list[0]);
- ref_list[0] = info_new_reference (initial_file->fullpath,
- node_via_menus);
+ ref_list[0] = info_new_reference (node_via_menus->filename,
+ node_via_menus->nodename);
+ free (node_via_menus);
}
}
}
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/info/nodes.c 2014-06-11 17:52:15 UTC (rev 5659)
@@ -880,7 +880,7 @@
/* Functions for node creation and retrieval. */
static long get_node_length (SEARCH_BINDING *binding);
-static void get_filename_and_nodename (WINDOW *window,
+static void get_filename_and_nodename (NODE *node,
char **filename, char **nodename,
char *filename_in, char *nodename_in);
static void node_set_body_start (NODE *node);
@@ -926,14 +926,14 @@
}
/* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME,
- using WINDOW for defaults. If WINDOW is null, the defaults are:
+ using DEFAULTS for defaults. If DEFAULTS is null, the defaults are:
- If FILENAME is NULL, `dir' is used.
- If NODENAME is NULL, `Top' is used.
If the node cannot be found, return NULL. */
NODE *
info_get_node_with_defaults (char *filename_in, char *nodename_in,
- WINDOW *window)
+ NODE *defaults)
{
NODE *node = 0;
FILE_BUFFER *file_buffer = NULL;
@@ -941,7 +941,7 @@
info_recent_file_error = NULL;
- get_filename_and_nodename (window, &filename, &nodename,
+ get_filename_and_nodename (defaults, &filename, &nodename,
filename_in, nodename_in);
/* If the file to be looked up is "dir", build the contents from all of
@@ -1000,9 +1000,10 @@
return info_get_node_with_defaults (filename_in, nodename_in, 0);
}
-/* Set default values. Output values should be freed by caller. */
+/* Get filename and nodename of node to load using defaults from NODE. Output
+ values should be freed by caller. */
static void
-get_filename_and_nodename (WINDOW *window,
+get_filename_and_nodename (NODE *node,
char **filename, char **nodename,
char *filename_in, char *nodename_in)
{
@@ -1017,19 +1018,11 @@
/* If FILENAME is not specified, it defaults to "dir". */
if (!*filename)
{
- if (window)
+ if (node)
{
- FILE_BUFFER *fb;
-
- *filename = window->node->parent;
+ *filename = node->parent;
if (!*filename)
- {
- fb = file_buffer_of_window (window);
- if (fb)
- *filename = fb->fullpath;
- else
- *filename = window->node->filename;
- }
+ *filename = node->filename;
}
else
*filename = "dir";
Modified: trunk/info/nodes.h
===================================================================
--- trunk/info/nodes.h 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/info/nodes.h 2014-06-11 17:52:15 UTC (rev 5659)
@@ -152,12 +152,8 @@
If the node cannot be found, return a NULL pointer. */
extern NODE *info_get_node (char *filename, char *nodename);
-/* struct window_struct is typedef as WINDOW in window.h, but we cannot
- include window.h in this file (nodes.h), because window.h includes
- nodes.h. */
-struct window_struct;
extern NODE *info_get_node_with_defaults (char *filename, char *nodename,
- struct window_struct *window);
+ NODE *defaults);
extern NODE *info_node_of_tag (FILE_BUFFER *fb, NODE **tag_ptr);
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/info/session.c 2014-06-11 17:52:15 UTC (rev 5659)
@@ -1338,7 +1338,7 @@
return;
}
- node = info_get_node_with_defaults (0, description, window);
+ node = info_get_node_with_defaults (0, description, window->node);
if (!node)
{
if (info_recent_file_error)
@@ -1722,7 +1722,7 @@
file_system_error = NULL;
node = info_get_node_with_defaults (entry->filename, entry->nodename,
- window);
+ window->node);
/* Try something a little weird. If the node couldn't be found, and the
reference was of the form "foo::", see if the entry->label can be found
@@ -2265,10 +2265,11 @@
menu entries, and whether to return the node so far if we can't
continue at any point (that might be INITIAL_NODE itself), or to
return null. This function frees INITIAL_NODE. */
-char *
+NODE *
info_follow_menus (NODE *initial_node, char **menus, char **error,
int strict)
{
+ WINDOW *defaults;
NODE *node = NULL;
if (error)
@@ -2288,8 +2289,7 @@
asprintf (error, _("No menu in node `%s'."),
node_printed_rep (initial_node));
debug (3, ("no menu found"));
- free (initial_node);
- return strict ? 0 : initial_node->nodename;
+ return strict ? 0 : initial_node;
}
/* Find the specified menu item. */
@@ -2300,20 +2300,16 @@
{
if (error)
asprintf (error, _("No menu item `%s' in node `%s'."),
- arg,
- node_printed_rep (initial_node));
+ arg, node_printed_rep (initial_node));
debug (3, ("no entry found"));
- free (initial_node);
- return strict ? 0 : initial_node->nodename;
+ return strict ? 0 : initial_node;
}
debug (3, ("entry: %s, %s", entry->filename, entry->nodename));
/* Try to find this node. */
- if (initial_node->parent)
- node = info_get_node (initial_node->parent, entry->nodename);
- else
- node = info_get_node (initial_node->filename, entry->nodename);
+ node = info_get_node_with_defaults (entry->filename, entry->nodename,
+ initial_node);
if (!node)
{
debug (3, ("no matching node found"));
@@ -2322,8 +2318,7 @@
_("Unable to find node referenced by `%s' in `%s'."),
entry->label,
node_printed_rep (initial_node));
- free (initial_node);
- return strict ? 0 : initial_node->nodename;
+ return strict ? 0 : initial_node;
}
debug (3, ("node: %s, %s", node->filename, node->nodename));
@@ -2333,8 +2328,7 @@
initial_node = node;
}
- free (initial_node);
- return initial_node->nodename;
+ return initial_node;
}
/* Split STR into individual node names by writing null bytes in wherever
@@ -2388,7 +2382,7 @@
char *error = 0;
NODE *dir_node = get_dir_node ();
char **nodes = split_list_of_nodenames (line);
- char *node = NULL;
+ NODE *node;
/* If DIR_NODE is NULL, they might be reading a file directly,
like in "info -d . -f ./foo". Try using "Top" instead. */
@@ -2401,8 +2395,7 @@
dir_node = info_get_node (file_name, 0);
}
- /* If we still cannot find the starting point, give up.
- We cannot allow a NULL pointer inside info_follow_menus. */
+ /* If we still cannot find the starting point, give up. */
if (!dir_node)
info_error (msg_cant_find_node, "Top");
else
@@ -2412,11 +2405,7 @@
if (error)
show_error_node (error);
else
- {
- NODE *n;
- n = info_get_node_with_defaults (0, node, window);
- info_set_node_of_window (window, n);
- }
+ info_set_node_of_window (window, node);
}
free (line);
Modified: trunk/info/session.h
===================================================================
--- trunk/info/session.h 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/info/session.h 2014-06-11 17:52:15 UTC (rev 5659)
@@ -198,7 +198,7 @@
extern void info_kill_node (WINDOW *window, int count, unsigned char key);
extern void info_view_file (WINDOW *window, int count, unsigned char key);
extern void info_menu_sequence (WINDOW *window, int count, unsigned char key);
-extern char *info_follow_menus (NODE *initial_node, char **menus,
+extern NODE *info_follow_menus (NODE *initial_node, char **menus,
char **error_msg, int strict);
extern void info_man (WINDOW *window, int count, unsigned char key);
extern void list_visited_nodes (WINDOW *window, int count, unsigned char key);
Modified: trunk/info/t/dir-menus-sloppily.sh
===================================================================
--- trunk/info/t/dir-menus-sloppily.sh 2014-06-11 12:41:26 UTC (rev 5658)
+++ trunk/info/t/dir-menus-sloppily.sh 2014-06-11 17:52:15 UTC (rev 5659)
@@ -18,6 +18,6 @@
. $srcdir/t/Init-test.inc
# Follow several menus in a file inexactly to get to desired node
-$GINFO --output - file-menu first nod nod 3 \
+$GINFO --output - file-menu first nod nod \
| grep 'Arrived at Node 3.'
Added: trunk/info/t/menu-sequence.drib
===================================================================
--- trunk/info/t/menu-sequence.drib (rev 0)
+++ trunk/info/t/menu-sequence.drib 2014-06-11 17:52:15 UTC (rev 5659)
@@ -0,0 +1,3 @@
+xmenu-sequence
+file-menu,first,no,nod
+Dq
\ No newline at end of file
Added: trunk/info/t/menu-sequence.sh
===================================================================
--- trunk/info/t/menu-sequence.sh (rev 0)
+++ trunk/info/t/menu-sequence.sh 2014-06-11 17:52:15 UTC (rev 5659)
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Copyright (C) 2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+srcdir=${srcdir:-.}
+. $srcdir/t/Init-test.inc
+. $t/Init-intera.inc
+
+# M-x menu-sequence
+$GINFO -f intera --restore $t/menu-sequence.drib
+
+if ! test -f $GINFO_OUTPUT
+then
+ RETVAL=1
+else
+ grep 'Arrived at Node 3.' $GINFO_OUTPUT
+ RETVAL=$?
+fi
+
+. $t/Cleanup.inc
+
Property changes on: trunk/info/t/menu-sequence.sh
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5659] M-x menu-sequence,
Gavin D. Smith <=