[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5548] [QUOTE_NODENAMES] support of nodename quoting
From: |
Gavin D. Smith |
Subject: |
[5548] [QUOTE_NODENAMES] support of nodename quoting |
Date: |
Sat, 10 May 2014 19:26:29 +0000 |
Revision: 5548
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5548
Author: gavin
Date: 2014-05-10 19:26:29 +0000 (Sat, 10 May 2014)
Log Message:
-----------
[QUOTE_NODENAMES] support of nodename quoting
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/info-utils.c
trunk/info/info.c
trunk/info/nodes.c
trunk/info/search.c
trunk/info/search.h
trunk/info/t/infodir/quoting.info
Added Paths:
-----------
trunk/info/t/quoted-label-and-target.drib
trunk/info/t/quoted-label-and-target.sh
trunk/info/t/quoted-label-as-target.drib
trunk/info/t/quoted-label-as-target.sh
trunk/info/t/quoted-target.drib
trunk/info/t/quoted-target.sh
Removed Paths:
-------------
trunk/info/t/reference-quoted.drib
trunk/info/t/reference-quoted.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/ChangeLog 2014-05-10 19:26:29 UTC (rev 5548)
@@ -1,5 +1,24 @@
2014-05-10 Gavin Smith <address@hidden>
+ * info/info-utils.c (info_parse_node): Call read_quoted_string
+ to get node name.
+ (read_quoted_string) [QUOTE_NODENAMES]: Interpretation of
+ quoting mechanism made conditional.
+ (scan_reference_target): Add comment to clarify that references
+ like "*note (filename)nodename::" are not supported.
+ (scan_node_contents): Free output of read_quoted_string.
+ * info/search.c (skip_node_characters): Function merged into
+ info_parse_node.
+ * info/nodes.c (get_nodes_of_info_file): Call get_quoted_string
+ to read node name from node information line.
+ * info/t/reference-quoted.sh: Deleted, replaced with new tests:
+ * info/t/quoted-label-as-target.sh, info/t/quoted-target.sh,
+ info/t/quoted-label-and-target.sh
+
+ * info/info.c (get_initial_file): Store full path of file found
+ from dir entry.
+2014-05-10 Gavin Smith <address@hidden>
+
* info/info.c (get_initial_file): Special handling of "info -O info"
moved from add_initial_nodes. Save node name found in dir.
* info/infodoc.c (replace_in_documentation): Show "H" to close
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/Makefile.am 2014-05-10 19:26:29 UTC (rev 5548)
@@ -111,13 +111,18 @@
t/index-apropos.sh \
t/split-index.sh \
t/index-long-nodeline.sh \
+ t/quoted-label-as-target.sh \
+ t/quoted-target.sh \
+ t/quoted-label-and-target.sh \
t/goto-quoted.sh \
- t/reference-quoted.sh \
t/next-quoted.sh \
t/help.sh
XFAIL_TESTS = \
t/index-long-nodeline.sh \
- t/reference-quoted.sh \
+ t/quoted-label-as-target.sh \
+ t/quoted-target.sh \
+ t/quoted-label-and-target.sh \
+ t/goto-quoted.sh \
t/next-quoted.sh
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/info-utils.c 2014-05-10 19:26:29 UTC (rev 5548)
@@ -64,8 +64,20 @@
info_parse_node (char *string, int flag)
{
register int i = 0;
+ int nodename_len;
+ char *terminator;
int length = 0; /* Return value */
+ switch (flag)
+ {
+ case PARSE_NODE_DFLT:
+ terminator = "\r\n,.\t"; break;
+ case PARSE_NODE_SKIP_NEWLINES:
+ terminator = ",.\t"; break;
+ case PARSE_NODE_VERBATIM:
+ terminator = ""; break;
+ }
+
/* Default the answer. */
free (info_parsed_filename);
free (info_parsed_nodename);
@@ -130,14 +142,26 @@
}
/* Parse out nodename. */
- i = skip_node_characters (string, flag);
- length += i;
- length++; /* skip_node_characters() stops on terminating character */
+ nodename_len = read_quoted_string (string, terminator,
+ &info_parsed_nodename);
+ /* If the quoting mechanism was not used, go past the terminating
+ character. */
+ if (string[nodename_len - 1] != '\177')
+ {
+ string++;
+ length++;
+ }
+ string += nodename_len;
+ length += nodename_len;
- info_parsed_nodename = xcalloc (1, i+1);
- memcpy (info_parsed_nodename, string, i);
+ if (nodename_len == 0)
+ {
+ free (info_parsed_nodename);
+ info_parsed_nodename = 0;
+ }
+ else
+ canonicalize_whitespace (info_parsed_nodename);
- canonicalize_whitespace (info_parsed_nodename);
if (info_parsed_nodename && !*info_parsed_nodename)
{
free (info_parsed_nodename);
@@ -198,6 +222,7 @@
return len;
}
+#ifdef QUOTE_NODENAMES
else
{
len = strcspn (start + 1, "\177");
@@ -208,6 +233,10 @@
return len + 2;
}
+#else /* ! QUOTE_NODENAMES */
+ *output = "";
+ return 0;
+#endif
}
@@ -1034,6 +1063,7 @@
/* Separate at commas or newlines, so it will work for
filenames including full stops. */
+ /* TODO: Account for "(dir)" and "(DIR)". */
value_length = read_quoted_string (inptr, "\n\t,", store_in);
/* Skip past value and any quoting or separating characters. */
@@ -1139,18 +1169,20 @@
void
scan_reference_target (REFERENCE *entry, int found_menu_entry, int in_index)
{
- /* If this reference entry continues with another ':' then the
- nodename is the same as the label. */
+ /* If this reference entry continues with another ':' then the reference is
+ within the same file, and the nodename is the same as the label. */
if (*inptr == ':')
{
- entry->nodename = xstrdup (entry->label);
+ skip_input (1);
- skip_input (1);
if (found_menu_entry)
{
/* Output two spaces to match the length of "::" */
write_extra_bytes_to_output (" ", 2);
}
+
+ entry->filename = 0;
+ entry->nodename = xstrdup (entry->label);
}
else
{
@@ -1217,6 +1249,11 @@
}
}
+ if (found_menu_entry && !in_index)
+ /* Output spaces the length of the node specifier to avoid
+ messing up left edge of second column of menu. */
+ for (i = 0; i < length; i++)
+ write_extra_bytes_to_output (" ", 1);
if (info_parsed_filename)
entry->filename = xstrdup (info_parsed_filename);
@@ -1232,12 +1269,6 @@
of an image tag. This subtracts 1 for a removed node information
line. */
entry->line_number = info_parsed_line_number - 1;
-
- if (found_menu_entry && !in_index)
- /* Output spaces the length of the node specifier to avoid
- messing up left edge of second column of menu. */
- for (i = 0; i < length; i++)
- write_extra_bytes_to_output (" ", 1);
}
}
@@ -1382,7 +1413,7 @@
/* Copy any white space before label. */
copy_input_to_output (skip_whitespace_and_newlines (inptr));
- /* Search forward to ":" to get label name */
+ /* Search forward to ":" to get label name. */
/* Cross-references may have a newline in the middle. */
if (!found_menu_entry)
label_len = read_quoted_string (inptr, ":", &label);
@@ -1405,6 +1436,7 @@
(label, label_len,
(s.buffer + start_of_reference) - node->contents,
found_menu_entry);
+ free (label);
/* Get target of reference and update entry. */
scan_reference_target (entry, found_menu_entry, in_index);
Modified: trunk/info/info.c
===================================================================
--- trunk/info/info.c 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/info.c 2014-05-10 19:26:29 UTC (rev 5548)
@@ -199,6 +199,9 @@
if (entry)
{
initial_file = info_find_fullpath (entry->filename, 0);
+ /* Store full path, so that we find the already loaded file in
+ info_find_file, and show the full path if --where is used. */
+ entry->filename = initial_file;
add_pointer_to_array (entry, ref_index, ref_list, ref_slots, 2);
}
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/nodes.c 2014-05-10 19:26:29 UTC (rev 5548)
@@ -218,16 +218,9 @@
/* Find the start of the nodename. */
start += skip_whitespace (nodeline + start);
- /* Find the end of the nodename. */
- end = start +
- skip_node_characters (nodeline + start, PARSE_NODE_DFLT);
-
- /* Okay, we have isolated the node name, and we know where the
- node starts. Remember this information. */
+ /* Record nodename and nodestart. */
entry = info_create_node ();
- entry->nodename = xmalloc (1 + (end - start));
- strncpy (entry->nodename, nodeline + start, end - start);
- entry->nodename[end - start] = 0;
+ read_quoted_string (nodeline + start, ",\n\t", &entry->nodename);
entry->nodestart = nodestart;
init_file_buffer_tag (file_buffer, entry);
Modified: trunk/info/search.c
===================================================================
--- trunk/info/search.c 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/search.c 2014-05-10 19:26:29 UTC (rev 5548)
@@ -489,87 +489,6 @@
for (i = 0; string && string[i] && !whitespace (string[i]); i++);
return i;
}
-
-/* Return the index of the first non-node character in STRING.
-
- The second argument instructs how to parse the node name:
-
- PARSE_NODE_DFLT Node name stops at LF, `,', `.', or `TAB'
- PARSE_NODE_SKIP_NEWLINES Node name stops at `,', `.', or `TAB'
- PARSE_NODE_VERBATIM Don't parse nodename
- PARSE_NODE_START The STRING argument is retrieved from a node
- start line, and therefore ends in `,' only.
-
- Note that if FLAG is PARSE_NODE_DFLT or PARSE_NODE_SKIP_NEWLINES, this
- function contains quite a bit of hair to ignore periods in some special
- cases. This is because we here at GNU ship some info files which contain
- nodenames that contain periods. No such nodename can start with a period,
- or continue with whitespace, newline, or ')' immediately following the
- period. If second argument NEWLINES_OKAY is non-zero, newlines should
- be skipped while parsing out the nodename specification. */
-int
-skip_node_characters (char *string, int flag)
-{
- register int c, i = 0;
- int paren_seen = 0;
- int paren = 0;
-
- if (!string)
- return 0;
-
- if (flag == PARSE_NODE_VERBATIM)
- return strlen (string);
-
- /* Handle special case. This is when another function has parsed out the
- filename component of the node name, and we just want to parse out the
- nodename proper. In that case, a period at the start of the nodename
- indicates an empty nodename. */
- if (*string == '.')
- return 0;
-
- if (*string == '(')
- {
- paren++;
- paren_seen++;
- i++;
- }
-
- for (; (c = string[i]); i++)
- {
- if (paren)
- {
- if (c == '(')
- paren++;
- else if (c == ')')
- paren--;
-
- continue;
- }
-
- /* If the character following the close paren is a space or period,
- then this node name has no more characters associated with it. */
- if (c == '\t' ||
- c == ',' ||
- c == INFO_TAGSEP ||
- (!(flag == PARSE_NODE_SKIP_NEWLINES) && (c == '\n')) ||
- ((paren_seen && string[i - 1] == ')') &&
- (c == ' ' || c == '.')) ||
- (flag != PARSE_NODE_START &&
- (c == '.' &&
- (
-#if 0
-/* This test causes a node name ending in a period, like `This.', not to
- be found. The trailing . is stripped. This occurs in the jargon
- file (`I see no X here.' is a node name). */
- (!string[i + 1]) ||
-#endif
- (whitespace_or_newline (string[i + 1])) ||
- (string[i + 1] == ')')))))
- break;
- }
- return i;
-}
-
/* **************************************************************** */
/* */
Modified: trunk/info/search.h
===================================================================
--- trunk/info/search.h 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/search.h 2014-05-10 19:26:29 UTC (rev 5548)
@@ -77,7 +77,6 @@
extern int skip_non_whitespace (char *string);
extern int skip_whitespace_and_newlines (char *string);
extern int skip_line (char *string);
-extern int skip_node_characters (char *string, int newlines_okay);
extern int skip_node_separator (char *body);
extern long find_node_separator (SEARCH_BINDING *binding);
Modified: trunk/info/t/infodir/quoting.info
===================================================================
(Binary files differ)
Added: trunk/info/t/quoted-label-and-target.drib
===================================================================
--- trunk/info/t/quoted-label-and-target.drib (rev 0)
+++ trunk/info/t/quoted-label-and-target.drib 2014-05-10 19:26:29 UTC (rev
5548)
@@ -0,0 +1,3 @@
+
+
+Dq
\ No newline at end of file
Added: trunk/info/t/quoted-label-and-target.sh
===================================================================
--- trunk/info/t/quoted-label-and-target.sh (rev 0)
+++ trunk/info/t/quoted-label-and-target.sh 2014-05-10 19:26:29 UTC (rev
5548)
@@ -0,0 +1,29 @@
+#!/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/>.
+
+. t/Init-test.inc
+. t/Init-intera.inc
+
+# Follow a cross-reference with both the label and destination quoted.
+$GINFO -f quoting --restore $t/quoted-label-and-target.drib
+
+test -f $GINFO_OUTPUT || exit 1
+# Return non-zero (test failure) if files differ
+diff $GINFO_OUTPUT $t/node-target
+RETVAL=$?
+
+. t/Cleanup.inc
+
Property changes on: trunk/info/t/quoted-label-and-target.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/info/t/quoted-label-as-target.drib
===================================================================
--- trunk/info/t/quoted-label-as-target.drib (rev 0)
+++ trunk/info/t/quoted-label-as-target.drib 2014-05-10 19:26:29 UTC (rev
5548)
@@ -0,0 +1,3 @@
+
+
+Dq
\ No newline at end of file
Added: trunk/info/t/quoted-label-as-target.sh
===================================================================
--- trunk/info/t/quoted-label-as-target.sh (rev 0)
+++ trunk/info/t/quoted-label-as-target.sh 2014-05-10 19:26:29 UTC (rev
5548)
@@ -0,0 +1,29 @@
+#!/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/>.
+
+. t/Init-test.inc
+. t/Init-intera.inc
+
+# Follow a cross-reference to a node with colons and commas in its name
+$GINFO -f quoting --restore $t/quoted-label-as-target.drib
+
+test -f $GINFO_OUTPUT || exit 1
+# Return non-zero (test failure) if files differ
+diff $GINFO_OUTPUT $t/node-target
+RETVAL=$?
+
+. t/Cleanup.inc
+
Property changes on: trunk/info/t/quoted-label-as-target.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/info/t/quoted-target.drib
===================================================================
--- trunk/info/t/quoted-target.drib (rev 0)
+++ trunk/info/t/quoted-target.drib 2014-05-10 19:26:29 UTC (rev 5548)
@@ -0,0 +1,3 @@
+
+
+Dq
\ No newline at end of file
Added: trunk/info/t/quoted-target.sh
===================================================================
--- trunk/info/t/quoted-target.sh (rev 0)
+++ trunk/info/t/quoted-target.sh 2014-05-10 19:26:29 UTC (rev 5548)
@@ -0,0 +1,29 @@
+#!/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/>.
+
+. t/Init-test.inc
+. t/Init-intera.inc
+
+# Follow a cross-reference to a node with colons and commas in its name
+$GINFO -f quoting --restore $t/quoted-target.drib
+
+test -f $GINFO_OUTPUT || exit 1
+# Return non-zero (test failure) if files differ
+diff $GINFO_OUTPUT $t/node-target
+RETVAL=$?
+
+. t/Cleanup.inc
+
Property changes on: trunk/info/t/quoted-target.sh
___________________________________________________________________
Added: svn:executable
+ *
Deleted: trunk/info/t/reference-quoted.drib
===================================================================
--- trunk/info/t/reference-quoted.drib 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/t/reference-quoted.drib 2014-05-10 19:26:29 UTC (rev 5548)
@@ -1,3 +0,0 @@
-
-
-Dq
\ No newline at end of file
Deleted: trunk/info/t/reference-quoted.sh
===================================================================
--- trunk/info/t/reference-quoted.sh 2014-05-10 11:47:12 UTC (rev 5547)
+++ trunk/info/t/reference-quoted.sh 2014-05-10 19:26:29 UTC (rev 5548)
@@ -1,29 +0,0 @@
-#!/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/>.
-
-. t/Init-test.inc
-. t/Init-intera.inc
-
-# Follow a cross-reference to a node with colons and commas in its name
-$GINFO -f quoting --restore $t/reference-quoted.drib
-
-test -f $GINFO_OUTPUT || exit 1
-# Return non-zero (test failure) if files differ
-diff $GINFO_OUTPUT $t/node-target
-RETVAL=$?
-
-. t/Cleanup.inc
-
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5548] [QUOTE_NODENAMES] support of nodename quoting,
Gavin D. Smith <=