texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[5579] skip quoting characters properly


From: Gavin D. Smith
Subject: [5579] skip quoting characters properly
Date: Sun, 18 May 2014 15:34:30 +0000

Revision: 5579
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5579
Author:   gavin
Date:     2014-05-18 15:34:28 +0000 (Sun, 18 May 2014)
Log Message:
-----------
skip quoting characters properly

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/info-utils.c
    trunk/info/window.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-05-18 14:12:41 UTC (rev 5578)
+++ trunk/ChangeLog     2014-05-18 15:34:28 UTC (rev 5579)
@@ -1,3 +1,15 @@
+2014-05-18  Gavin Smith  <address@hidden>
+
+       * info/t (all files): Set srcdir variable before including any shell
+       snippets.  Suggested by Patrice Dumas.  Other fixes for tests in
+       out-of-source builds.
+
+       * info/info-utils.c (printed_representation): Corrected output lengths
+       for META-x and DEL.  Function comment corrected.
+       (init_output_stream): Always initialize output_bytes_difference.
+       (copy_converting): Remove unnecessary cast.
+       (scan_reference_label): [QUOTE_NODENAMES] Skip quoting bytes properly.
+
 2014-05-18  Patrice Dumas  <address@hidden>
 
        * tp/Texinfo/Convert/Converter.pm (output): warn about 

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2014-05-18 14:12:41 UTC (rev 5578)
+++ trunk/info/info-utils.c     2014-05-18 15:34:28 UTC (rev 5579)
@@ -471,11 +471,12 @@
 
 /* Return pointer to string that is the printed representation of character
    (or other logical unit) at ITER if it were printed at screen column
-   PL_CHARS.  Update mb_len (mbi_cur (*ITER)) if byte length is different.
-   If ITER points at an end-of-line character, set *DELIM to this character.
-   *PCHARS gets the number of screen columns taken up by outputting the return
-   value, and *PBYTES the number of bytes in returned string.  Return value is
-   not null-terminated.  Return value must not be freed by caller. */
+   PL_CHARS.  Use ITER_SETBYTES (info-utils.h) on ITER if byte length is
+   different.  If ITER points at an end-of-line character, set *DELIM to this
+   character.  *PCHARS gets the number of screen columns taken up by
+   outputting the return value, and *PBYTES the number of bytes in returned
+   string.  Return value is not null-terminated.  Return value must not be
+   freed by caller. */
 char *
 printed_representation (mbi_iterator_t *iter, int *delim, size_t pl_chars,
                         size_t *pchars, size_t *pbytes) 
@@ -543,18 +544,18 @@
       text_buffer_add_char (rep, *cur_ptr | 0x40);
       return text_buffer_base (rep);
     }
-  /* Show META-x as "\0370".  */
+  /* Show META-x as "\370".  */
   else if (*cur_ptr > printable_limit)
     {
-      *pchars = 5;
-      *pbytes = cur_len;
+      *pchars = 4;
+      *pbytes = 4;
       text_buffer_printf (rep, "\\%0o", *cur_ptr);
       return text_buffer_base (rep);
     }
   else if (*cur_ptr == DEL)
     {
       *pchars = 2;
-      *pbytes = cur_len;
+      *pbytes = 2;
       text_buffer_add_char (rep, '^');
       text_buffer_add_char (rep, '?');
       return text_buffer_base (rep);
@@ -683,12 +684,10 @@
 init_output_stream (FILE_BUFFER *fb)
 {
   init_conversion (fb);
+  output_bytes_difference = 0;
 
   if (rewrite_p)
-    {
-      text_buffer_init (&output_buf);
-      output_bytes_difference = 0;
-    }
+    text_buffer_init (&output_buf);
 }
 
 /* Copy bytes from input to output with no encoding conversion. */
@@ -860,7 +859,7 @@
          string.  Note that mixing iconv_to_output and iconv_to_utf8
          on the same input may not work well if the input encoding
          is stateful.  We could deal with this by always converting to
-         UTF-8 first, then we could mix conversions on the UTF-8 stream. */
+         UTF-8 first; then we could mix conversions on the UTF-8 stream. */
 
       /* We want to read exactly one character.  Do this by
          restricting size of output buffer. */
@@ -890,8 +889,7 @@
   /* Must cast because the difference between unsigned size_t is always
      positive. */
   output_bytes_difference +=
-    (signed long) n
-    - (signed long) (text_buffer_off (&output_buf) - output_start);
+    n - ((signed long) text_buffer_off (&output_buf) - output_start);
 
   return extra_at_end;
 #endif /* HAVE_ICONV */
@@ -1096,7 +1094,8 @@
     }
 }
 
-/* Output reference label and create REFERENCE object. */
+/* Output reference label and create REFERENCE object.  inptr should be
+   on the first non-whitespace byte of label when this function is called. */
 static REFERENCE *
 scan_reference_label (char *label, long label_len, long start_of_reference,
                       int found_menu_entry)
@@ -1143,6 +1142,11 @@
       entry->start = start_of_reference;
     }
 
+#ifdef QUOTE_NODENAMES
+  if (inptr[0] == '\177')
+    skip_input (1);
+#endif
+
   /* Write text of label.  If there is a newline in the middle of
      a reference label, turn off underling until text starts again. */
   while (nl_ptr = strchr (label_ptr, '\n'))
@@ -1165,6 +1169,11 @@
   copy_input_to_output (label + strlen (label) - label_ptr);
   underlining_off ();
 
+#ifdef QUOTE_NODENAMES
+  if (inptr[0] == '\177')
+    skip_input (1);
+#endif
+
   /* Colon after label. */
   skip_input (1);
 

Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-05-18 14:12:41 UTC (rev 5578)
+++ trunk/info/window.c 2014-05-18 15:34:28 UTC (rev 5579)
@@ -1424,8 +1424,8 @@
      ll_num -- Number of processed logical lines (starts from 0);
      pl_start -- Offset of start of physical line from START;
      printed_line -- Collected line contents, ready for output;
-     pl_bytes -- Number of bytes in prt_line;
-     pl_chars -- Number of characters in prt_line.
+     pl_bytes -- Number of bytes in printed_line;
+     pl_chars -- Number of characters in printed_line.
 
    If FUN returns non zero, process_node_text stops processing and returns
    immediately.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]