[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5516] first support for quoting node names
From: |
Gavin D. Smith |
Subject: |
[5516] first support for quoting node names |
Date: |
Sun, 04 May 2014 10:51:02 +0000 |
Revision: 5516
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5516
Author: gavin
Date: 2014-05-04 10:51:01 +0000 (Sun, 04 May 2014)
Log Message:
-----------
first support for quoting node names
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/info-utils.c
trunk/info/info-utils.h
trunk/info/search.c
Added Paths:
-----------
trunk/info/t/goto-quoted.drib
trunk/info/t/goto-quoted.sh
trunk/info/t/next-quoted.drib
trunk/info/t/next-quoted.sh
trunk/info/t/reference-quoted.drib
trunk/info/t/reference-quoted.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-05-04 10:17:59 UTC (rev 5515)
+++ trunk/ChangeLog 2014-05-04 10:51:01 UTC (rev 5516)
@@ -1,5 +1,14 @@
2014-05-04 Gavin Smith <address@hidden>
+ * info/info-utils.c (read_quoted_string): New function.
+ * info/search.c (find_node_in_binding): Call read_quoted_string.
+
+ * info/t/goto-quoted.sh,
+ info/t/reference-quoted.sh,
+ info/t/next-quoted.sh: New tests.
+
+2014-05-04 Gavin Smith <address@hidden>
+
* info/t/apropos-index.sh: New test.
2014-05-03 Gavin Smith <address@hidden>
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2014-05-04 10:17:59 UTC (rev 5515)
+++ trunk/info/Makefile.am 2014-05-04 10:51:01 UTC (rev 5516)
@@ -108,8 +108,13 @@
t/index-apropos.sh \
t/split-index.sh \
t/index-long-nodeline.sh \
+ t/goto-quoted.sh \
+ t/reference-quoted.sh \
+ t/next-quoted.sh \
t/help.sh
XFAIL_TESTS = \
- t/index-long-nodeline.sh
+ t/index-long-nodeline.sh \
+ t/reference-quoted.sh \
+ t/next-quoted.sh
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2014-05-04 10:17:59 UTC (rev 5515)
+++ trunk/info/info-utils.c 2014-05-04 10:51:01 UTC (rev 5516)
@@ -177,6 +177,49 @@
return length;
}
+/* Set *OUTPUT to a copy of the string starting at START and finishing at
+ a character in TERMINATOR, unless START[0] == INFO_QUOTE, in which case
+ copy string from START+1 until the next occurence of INFO_QUOTE. Return
+ length of *OUTPUT.
+
+ TODO: Decide on best method of quoting. */
+long
+read_quoted_string (char *start, char *terminator, char **output)
+{
+ long len;
+
+ if (start[0] != '\177')
+ {
+ len = strcspn (start, terminator);
+ if (len == 0)
+ {
+ *output = 0;
+ return 0;
+ }
+
+ *output = xmalloc (len + 1);
+ strncpy (*output, start, len);
+ (*output)[len] = '\0';
+
+ return len;
+ }
+ else
+ {
+ len = strcspn (start + 1, "\177");
+ if (len == 0)
+ {
+ *output = 0;
+ return 0;
+ }
+
+ *output = xmalloc (len + 1);
+ strncpy (*output, start + 1, len);
+ (*output)[len] = '\0';
+
+ return len;
+ }
+}
+
/* **************************************************************** */
/* */
Modified: trunk/info/info-utils.h
===================================================================
--- trunk/info/info-utils.h 2014-05-04 10:17:59 UTC (rev 5515)
+++ trunk/info/info-utils.h 2014-05-04 10:51:01 UTC (rev 5516)
@@ -60,6 +60,8 @@
*/
int info_parse_node (char *string, int flag);
+long read_quoted_string (char *start, char *terminator, char **output);
+
void scan_node_contents (FILE_BUFFER *fb, NODE **node_ptr);
/* Get the menu entry associated with LABEL in NODE. Return a
Modified: trunk/info/search.c
===================================================================
--- trunk/info/search.c 2014-05-04 10:17:59 UTC (rev 5515)
+++ trunk/info/search.c 2014-05-04 10:51:01 UTC (rev 5516)
@@ -691,6 +691,10 @@
while ((position = find_node_separator (&tmp_search)) != -1)
{
+ char *nodename_start;
+ char *read_nodename;
+ long nodename_len;
+
tmp_search.start = position;
tmp_search.start += skip_node_separator
(tmp_search.buffer + tmp_search.start);
@@ -703,15 +707,18 @@
tmp_search.start += offset;
tmp_search.start += skip_whitespace (tmp_search.buffer +
tmp_search.start);
- offset = skip_node_characters
- (tmp_search.buffer + tmp_search.start, PARSE_NODE_DFLT);
- /* Notice that this is an exact match. You cannot grovel through
- the buffer with this function looking for random nodes. */
- if ((offset == namelen) &&
- (tmp_search.buffer[tmp_search.start] == nodename[0]) &&
- (strncmp (tmp_search.buffer + tmp_search.start, nodename, offset)
== 0))
- return position;
+ nodename_start = tmp_search.buffer + tmp_search.start;
+ nodename_len = read_quoted_string (nodename_start, "\n\t,.",
+ &read_nodename);
+ if (!read_nodename)
+ return -1;
+
+ if (!strcmp (read_nodename, nodename))
+ {
+ free (read_nodename);
+ return position;
+ }
}
return -1;
}
Added: trunk/info/t/goto-quoted.drib
===================================================================
--- trunk/info/t/goto-quoted.drib (rev 0)
+++ trunk/info/t/goto-quoted.drib 2014-05-04 10:51:01 UTC (rev 5516)
@@ -0,0 +1,3 @@
+g Colo
+
+Dq
\ No newline at end of file
Added: trunk/info/t/goto-quoted.sh
===================================================================
--- trunk/info/t/goto-quoted.sh (rev 0)
+++ trunk/info/t/goto-quoted.sh 2014-05-04 10:51:01 UTC (rev 5516)
@@ -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
+
+# Go to a node with colons and commas in its name with "g"
+$GINFO -f quoting --restore t/goto-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
+
Property changes on: trunk/info/t/goto-quoted.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/info/t/next-quoted.drib
===================================================================
--- trunk/info/t/next-quoted.drib (rev 0)
+++ trunk/info/t/next-quoted.drib 2014-05-04 10:51:01 UTC (rev 5516)
@@ -0,0 +1,2 @@
+n
+Dq
\ No newline at end of file
Added: trunk/info/t/next-quoted.sh
===================================================================
--- trunk/info/t/next-quoted.sh (rev 0)
+++ trunk/info/t/next-quoted.sh 2014-05-04 10:51:01 UTC (rev 5516)
@@ -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
+
+# Go to a node with colons and commas in its name with "n"
+$GINFO -f quoting --restore t/next-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
+
Property changes on: trunk/info/t/next-quoted.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/info/t/reference-quoted.drib
===================================================================
--- trunk/info/t/reference-quoted.drib (rev 0)
+++ trunk/info/t/reference-quoted.drib 2014-05-04 10:51:01 UTC (rev 5516)
@@ -0,0 +1,3 @@
+
+
+Dq
\ No newline at end of file
Added: trunk/info/t/reference-quoted.sh
===================================================================
--- trunk/info/t/reference-quoted.sh (rev 0)
+++ trunk/info/t/reference-quoted.sh 2014-05-04 10:51:01 UTC (rev 5516)
@@ -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/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
+
Property changes on: trunk/info/t/reference-quoted.sh
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5516] first support for quoting node names,
Gavin D. Smith <=