[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * info/dir.c, info/display.c, info/scan.c: reinde
From: |
Patrice Dumas |
Subject: |
branch master updated: * info/dir.c, info/display.c, info/scan.c: reindent, replace tabs by spaces, remove spaces, minor edit of a comment. |
Date: |
Sat, 12 Oct 2024 03:20:08 -0400 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 311f475c73 * info/dir.c, info/display.c, info/scan.c: reindent,
replace tabs by spaces, remove spaces, minor edit of a comment.
311f475c73 is described below
commit 311f475c731df4bc636aff82bb57df9bd87aa00b
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 12 09:19:57 2024 +0200
* info/dir.c, info/display.c, info/scan.c: reindent, replace tabs by
spaces, remove spaces, minor edit of a comment.
---
ChangeLog | 5 +++
info/dir.c | 57 +++++++++++++-------------
info/display.c | 102 +++++++++++++++++++++++------------------------
info/scan.c | 124 ++++++++++++++++++++++++++++-----------------------------
4 files changed, 146 insertions(+), 142 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 52ae5e81b3..a32f22a896 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-10-12 Patrice Dumas <pertusus@free.fr>
+
+ * info/dir.c, info/display.c, info/scan.c: reindent, replace tabs by
+ spaces, remove spaces, minor edit of a comment.
+
2024-10-12 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/convert/html_prepare_converter.c
diff --git a/info/dir.c b/info/dir.c
index 84695368f9..756f1e6559 100644
--- a/info/dir.c
+++ b/info/dir.c
@@ -61,43 +61,42 @@ build_dir_node (void)
node->fullpath = xstrdup ("dir");
node->contents = xstrdup (
-"File: dir, Node: Top, This is the top of the INFO tree.\n"
-"\n"
-"This is the Info main menu (aka directory node).\n"
-"A few useful Info commands:\n"
-"\n"
-" 'q' quits;\n"
-" 'H' lists all Info commands;\n"
-" 'h' starts the Info tutorial;\n"
-" 'mTexinfo RET' visits the Texinfo manual, etc.\n"
-
+ "File: dir, Node: Top, This is the top of the INFO tree.\n"
+ "\n"
+ "This is the Info main menu (aka directory node).\n"
+ "A few useful Info commands:\n"
+ "\n"
+ " 'q' quits;\n"
+ " 'H' lists all Info commands;\n"
+ " 'h' starts the Info tutorial;\n"
+ " 'mTexinfo RET' visits the Texinfo manual, etc.\n"
);
node->nodelen = strlen (node->contents);
- for (this_dir = infopath_first (&path_index); this_dir;
- this_dir = infopath_next (&path_index))
- {
- char *result;
- char *fullpath;
- int len;
- size_t filesize;
- struct stat finfo;
- int compressed;
- char *contents;
+ for (this_dir = infopath_first (&path_index); this_dir;
+ this_dir = infopath_next (&path_index))
+ {
+ char *result;
+ char *fullpath;
+ int len;
+ size_t filesize;
+ struct stat finfo;
+ int compressed;
+ char *contents;
/* Space for an appended compressed file extension, like ".gz". */
#define PADDING "XXXXXXXXX"
- len = xasprintf (&fullpath, "%s/dir%s", this_dir, PADDING);
- fullpath[len - strlen(PADDING)] = '\0';
+ len = xasprintf (&fullpath, "%s/dir%s", this_dir, PADDING);
+ fullpath[len - strlen(PADDING)] = '\0';
- result = info_check_compressed (fullpath, &finfo);
- if (!result)
- {
- free (fullpath);
- continue;
- }
+ result = info_check_compressed (fullpath, &finfo);
+ if (!result)
+ {
+ free (fullpath);
+ continue;
+ }
contents = filesys_read_info_file (fullpath, &filesize,
&finfo, &compressed);
@@ -156,7 +155,7 @@ add_menu_to_node (char *contents, size_t size, NODE *node)
fb_binding.start = 0;
fb_binding.end = node->nodelen;
if (search_forward (INFO_MENU_LABEL, &fb_binding, &fb_offset)
- != search_success)
+ != search_success)
abort ();
}
diff --git a/info/display.c b/info/display.c
index 4db4a1d665..32815e3008 100644
--- a/info/display.c
+++ b/info/display.c
@@ -104,7 +104,7 @@ find_diff (const char *a, size_t alen, const char *b,
size_t blen, int *ppos)
int pos = 0;
int first_escape = -1;
int escape_pos = -1;
-
+
for (i = 0, mbi_init (itra, a, alen), mbi_init (itrb, b, blen);
mbi_avail (itra) && mbi_avail (itrb);
i += wcwidth (itra.cur.wc), mbi_advance (itra), mbi_advance (itrb))
@@ -160,57 +160,57 @@ display_update_line (long pl_num, char *printed_line,
if (entry)
{
int i, off;
-
+
/* If the screen line is inversed, or if the entry is marked as
invalid, then clear the line from the screen first. */
if (entry->inverse)
- {
- terminal_goto_xy (0, pl_num);
- terminal_clear_to_eol ();
- entry->inverse = 0;
- entry->text[0] = '\0';
- entry->textlen = 0;
- }
+ {
+ terminal_goto_xy (0, pl_num);
+ terminal_clear_to_eol ();
+ entry->inverse = 0;
+ entry->text[0] = '\0';
+ entry->textlen = 0;
+ }
i = find_diff (printed_line, pl_bytes,
- entry->text, strlen (entry->text), &off);
+ entry->text, strlen (entry->text), &off);
/* If the lines differed at all, we must do some redrawing. */
if (i != -1)
- {
+ {
int printed_line_len = strlen (printed_line);
- /* Move to the proper point on the terminal. */
- terminal_goto_xy (i, pl_num);
+ /* Move to the proper point on the terminal. */
+ terminal_goto_xy (i, pl_num);
- /* If there is any text to print, print it. */
+ /* If there is any text to print, print it. */
terminal_put_text (printed_line + off);
-
- /* If the printed text didn't extend all the way to the edge
- of the screen, and text was appearing between here and the
- edge of the screen, clear from here to the end of the
- line. */
- if ((pl_chars < screenwidth && pl_chars < entry->textlen)
- || entry->inverse)
- terminal_clear_to_eol ();
-
- fflush (stdout);
-
- /* Update the display text buffer. */
- if (printed_line_len > screenwidth)
- /* printed_line[] can include more than screenwidth
- characters, e.g. if multibyte encoding is used or
- if we are under -R and there are escape sequences
- in it. However, entry->text was allocated (in
- display_initialize_display) for screenwidth
- bytes only. */
- entry->text = xrealloc (entry->text, printed_line_len + 1);
- strcpy (entry->text + off, printed_line + off);
- entry->textlen = pl_chars;
-
- /* Lines showing node text are not in inverse. Only modelines
- have that distinction. */
- entry->inverse = 0;
- }
+
+ /* If the printed text didn't extend all the way to the edge
+ of the screen, and text was appearing between here and the
+ edge of the screen, clear from here to the end of the
+ line. */
+ if ((pl_chars < screenwidth && pl_chars < entry->textlen)
+ || entry->inverse)
+ terminal_clear_to_eol ();
+
+ fflush (stdout);
+
+ /* Update the display text buffer. */
+ if (printed_line_len > screenwidth)
+ /* printed_line[] can include more than screenwidth
+ characters, e.g. if multibyte encoding is used or
+ if we are under -R and there are escape sequences
+ in it. However, entry->text was allocated (in
+ display_initialize_display) for screenwidth
+ bytes only. */
+ entry->text = xrealloc (entry->text, printed_line_len + 1);
+ strcpy (entry->text + off, printed_line + off);
+ entry->textlen = pl_chars;
+
+ /* Lines showing node text are not in inverse. Only modelines
+ have that distinction. */
+ entry->inverse = 0;
+ }
}
/* A line has been displayed, and the screen reflects that state.
@@ -271,9 +271,9 @@ static int writing_out;
priority over RENDITION1. */
static void
wrap_terminal_switch_rendition (struct text_buffer *printed_line,
- RENDITION rendition1,
- RENDITION rendition2,
- RENDITION rendition3)
+ RENDITION rendition1,
+ RENDITION rendition2,
+ RENDITION rendition3)
{
long int desired_rendition = 0;
desired_rendition = rendition1.value;
@@ -298,7 +298,7 @@ wrap_terminal_switch_rendition (struct text_buffer
*printed_line,
}
}
-/* Set in display_update_node_text if matches or references are to be
+/* Set in display_update_node_text if matches or references are to be
distinguished with terminal appearance modes. */
static MATCH_STATE *matches;
static REFERENCE **refs;
@@ -308,7 +308,7 @@ static int ref_index;
/* Number of screen columns output so far in a line. */
static int pl_chars;
-/* Whether we are currently outputting a highlighted reference. This can be
+/* Whether we are currently outputting a highlighted reference. This can be
carried over from one line to another. */
static int ref_highlighted;
@@ -405,7 +405,7 @@ display_process_line (WINDOW *win,
else if (win->point >= refs[ref_index]->start
&& win->point < refs[ref_index]->end)
{
- /* The point is in a cross-reference, but not in the
+ /* The point is in a cross-reference, but not in the
current line. */
ref_highlighted = 1;
}
@@ -536,7 +536,7 @@ display_update_node_text (WINDOW *win)
if (pl_num == win->height)
break;
- /* Check if this line of the window is off the screen. This might
+ /* Check if this line of the window is off the screen. This might
happen if the screen was resized very small. */
if (win->first_row + pl_num >= screenheight)
break;
@@ -598,7 +598,7 @@ display_update_node_text (WINDOW *win)
}
/* Check if a line continuation character should be displayed.
- Don't print one on the very last line of the display, as this could
+ Don't print one on the very last line of the display, as this could
cause it to scroll. */
if (delim)
mbi_advance (iter);
@@ -708,7 +708,7 @@ display_update_one_window (WINDOW *win)
line_index = display_update_node_text (win);
if (display_was_interrupted_p)
- goto funexit;
+ goto funexit;
}
/* We have reached the end of the node or the end of the window. If it
@@ -742,7 +742,7 @@ display_update_one_window (WINDOW *win)
/* Okay, this window doesn't need updating anymore. */
win->flags &= ~W_UpdateWindow;
-funexit:
+ funexit:
signal_unblock_winch ();
}
diff --git a/info/scan.c b/info/scan.c
index 93a130ba19..c1b903aaa6 100644
--- a/info/scan.c
+++ b/info/scan.c
@@ -51,7 +51,7 @@ char *info_parsed_filename = NULL;
char *info_parsed_nodename = NULL;
/* Read a filename surrounded by "(" and ")", accounting for matching
- characters, and place it in *FILENAME if FILENAME is not null. Return
+ characters, and place it in *FILENAME if FILENAME is not null. Return
length of read filename. On error, set *FILENAME to null and return 0. */
size_t
read_bracketed_filename (char *string, char **filename)
@@ -77,9 +77,9 @@ read_bracketed_filename (char *string, char **filename)
count--;
if (count == 0)
break;
- }
+ }
}
-
+
/* If string ended before brackets were balanced, take the first ")" as
terminating the filename. */
if (count > 0)
@@ -105,7 +105,7 @@ read_bracketed_filename (char *string, char **filename)
/* Parse the filename and nodename out of STRING, saving in
INFO_PARSED_FILENAME and INFO_PARSED_NODENAME. These variables should not
be freed by calling code. If either is missing, the relevant variable is
- set to a null pointer. */
+ set to a null pointer. */
void
info_parse_node (char *string)
{
@@ -218,7 +218,7 @@ read_quoted_string (char *start, char *terminator, size_t
lines, char **output)
be freed by caller. If SLOPPY, allow initial matches, like
"Buffers" for a LABEL "buffer". */
REFERENCE *
-info_get_menu_entry_by_label (NODE *node, char *label, int sloppy)
+info_get_menu_entry_by_label (NODE *node, char *label, int sloppy)
{
register int i;
int best_guess = -1;
@@ -300,7 +300,7 @@ info_copy_reference (REFERENCE *src)
dest->end = src->end;
dest->line_number = src->line_number;
dest->type = src->type;
-
+
return dest;
}
@@ -525,7 +525,7 @@ init_conversion (FILE_BUFFER *fb)
/* Return if no conversion function implemented */
iconv_close (iconv_to_output);
iconv_to_output = (iconv_t) -1;
- return;
+ return;
}
}
@@ -685,11 +685,11 @@ copy_converting (long n)
size_t iconv_ret;
long output_start;
- size_t utf8_char_free;
+ size_t utf8_char_free;
char utf8_char[4]; /* Maximum 4 bytes in a UTF-8 character */
char *utf8_char_ptr, *orig_inptr;
size_t i;
-
+
/* Use n as an estimate of how many bytes will be required
in target encoding. */
text_buffer_alloc (&output_buf, (size_t) n);
@@ -703,12 +703,12 @@ copy_converting (long n)
(ICONV_CONST char **)&inptr, &bytes_left);
/* Make sure libiconv flushes out the last converted character.
- This is required when the conversion is stateful, in which
- case libiconv might not output the last character, waiting to
- see whether it should be combined with the next one. */
+ This is required when the conversion is stateful, in which
+ case libiconv might not output the last character, waiting to
+ see whether it should be combined with the next one. */
if (iconv_ret != (size_t) -1
- && text_buffer_iconv (&output_buf, iconv_to_output,
- NULL, NULL) != (size_t) -1)
+ && text_buffer_iconv (&output_buf, iconv_to_output,
+ NULL, NULL) != (size_t) -1)
/* Success: all of input converted. */
break;
@@ -748,11 +748,11 @@ copy_converting (long n)
/* Flush any waiting input in iconv_to_output and enter the
default shift state. */
text_buffer_iconv (&output_buf, iconv_to_output, NULL, NULL);
-
+
if (file_is_in_utf8)
{
degrade_utf8 (&inptr, &bytes_left);
- continue;
+ continue;
}
/* If file is not in UTF-8, we degrade to ASCII in two steps:
@@ -782,30 +782,30 @@ copy_converting (long n)
/* errno == E2BIG if iconv ran out of output buffer,
which is expected. */
if (iconv_ret == (size_t) -1 && errno != E2BIG)
- {
- /* Character is not recognized. Copy a single byte. */
- inptr = orig_inptr; /* iconv might have incremented inptr */
- copy_direct (1);
- bytes_left = orig_bytes_left - 1;
- }
+ {
+ /* Character is not recognized. Copy a single byte. */
+ inptr = orig_inptr; /* iconv might have incremented inptr */
+ copy_direct (1);
+ bytes_left = orig_bytes_left - 1;
+ }
else
{
utf8_char_ptr = utf8_char;
/* i is width of UTF-8 character */
degrade_utf8 (&utf8_char_ptr, &i);
- /* If we are done, make sure iconv flushes the last character. */
- if (bytes_left <= 0)
- {
- utf8_char_ptr = utf8_char;
- i = 4;
- iconv (iconv_to_utf8, NULL, NULL,
- &utf8_char_ptr, &utf8_char_free);
- if (utf8_char_ptr > utf8_char)
- {
- utf8_char_ptr = utf8_char;
- degrade_utf8 (&utf8_char_ptr, &i);
- }
- }
+ /* If we are done, make sure iconv flushes the last character. */
+ if (bytes_left <= 0)
+ {
+ utf8_char_ptr = utf8_char;
+ i = 4;
+ iconv (iconv_to_utf8, NULL, NULL,
+ &utf8_char_ptr, &utf8_char_free);
+ if (utf8_char_ptr > utf8_char)
+ {
+ utf8_char_ptr = utf8_char;
+ degrade_utf8 (&utf8_char_ptr, &i);
+ }
+ }
}
}
@@ -984,7 +984,7 @@ parse_top_node_line (NODE *node)
ptr += strlen (INFO_PREV_LABEL);
store_in = &node->prev;
}
- else if (!strncasecmp (ptr, INFO_ALTPREV_LABEL,
+ else if (!strncasecmp (ptr, INFO_ALTPREV_LABEL,
strlen(INFO_ALTPREV_LABEL)))
{
ptr += strlen (INFO_ALTPREV_LABEL);
@@ -1000,7 +1000,7 @@ parse_top_node_line (NODE *node)
ptr += strlen (INFO_UP_LABEL);
store_in = &node->up;
}
- else
+ else
{
store_in = 0;
/* Not recognized - code below will skip to next comma */
@@ -1013,8 +1013,8 @@ parse_top_node_line (NODE *node)
else
value_length = read_bracketed_filename (ptr, 0);
- /* Get length of node name, or filename if following "File:". Note
- that . is not included in the second argument here in order to
+ /* Get length of node name, or filename if following "File:". Note
+ that "." is not included in the second argument here in order to
support this character in file names. */
value_length += read_quoted_string (ptr + value_length,
"\n\r\t,", 1, &nodename);
@@ -1065,8 +1065,8 @@ scan_reference_marker (REFERENCE *entry, int
in_parentheses)
copy_input_to_output (strlen ("\n* "));
else
{
- /* Only match "*Note" if it is followed by a whitespace character so
that
- it will not be recognized if, e.g., it is surrounded in inverted
+ /* Only match "*Note" if it is followed by a whitespace character so that
+ it will not be recognized if, e.g., it is surrounded in inverted
commas. */
if (!strchr (" \t\r\n", inptr[strlen ("*Note")]))
{
@@ -1091,10 +1091,10 @@ scan_reference_marker (REFERENCE *entry, int
in_parentheses)
{
write_extra_bytes_to_output ("see", 3);
/* Only output the "see" for input like "(*note ...)", which
- would have come from a use of @pxref. We used to output "see"
for
+ would have come from a use of @pxref. We used to output "see" for
"*note" in more circumstances, with a list of words where to
suppress it (to avoid "see *note" turning into "see see"), but
- such a list can't be complete or reliable. It's better to remove
+ such a list can't be complete or reliable. It's better to remove
it with more enthusiasm, then if the document writer wants a "see"
to appear, they can add one themselves. */
}
@@ -1294,7 +1294,7 @@ scan_reference_target (REFERENCE *entry, NODE *node, int
in_parentheses)
write_extra_bytes_to_output (" manual)",
strlen (" manual)"));
}
-
+
/* Hide terminating punctuation if we are in a reference
like "(*note Label:(file)node.)". */
if (in_parentheses && inptr[0] == '.')
@@ -1306,7 +1306,7 @@ scan_reference_target (REFERENCE *entry, NODE *node, int
in_parentheses)
/* Output a newline if one is needed. Don't do it at the end of
a paragraph. */
if (nl_off && *inptr != '\n')
- {
+ {
size_t i;
write_extra_bytes_to_output ("\n", 1);
@@ -1325,7 +1325,7 @@ scan_reference_target (REFERENCE *entry, NODE *node, int
in_parentheses)
length += strspn (inptr + length, " ");
/* Get the node name. */
- length += read_quoted_string (inptr + length, ",.\t\n", 2,
+ length += read_quoted_string (inptr + length, ",.\t\n", 2,
&entry->nodename);
if (inptr[length] == '.') /* A '.' terminating the entry. */
length++;
@@ -1445,7 +1445,7 @@ scan_info_tag (NODE *node, int *in_index, FILE_BUFFER *fb)
}
else
{
- /* It was not a valid tag. */
+ /* It was not a valid tag. */
copy_input_to_output (p - inptr + 1);
}
@@ -1460,11 +1460,11 @@ static char *
forward_to_info_syntax (char *contents)
{
/* Loop until just before the end of the input. The '- 3' prevents us
- accessing memory after the end of the input, and none of the strings we
+ accessing memory after the end of the input, and none of the strings we
are looking for are shorter than 3 bytes. */
while (contents < input_start + input_length - 3)
{
- /* Menu entry comes first to optimize for the case of looking through a
+ /* Menu entry comes first to optimize for the case of looking through a
long index node. */
if (looking_at_string (contents, INFO_MENU_ENTRY_LABEL)
|| looking_at_string (contents, INFO_XREF_LABEL)
@@ -1477,14 +1477,14 @@ forward_to_info_syntax (char *contents)
/* Scan contents of NODE, recording cross-references and similar.
- Convert character encoding of node contents to that of the user if the two
- are known to be different. If PREPROCESS_NODES_P == 1, remove Info syntax
+ Convert character encoding of node contents to that of the user if the two
+ are known to be different. If PREPROCESS_NODES_P == 1, remove Info syntax
in contents.
- If FB is non-null, it is the file containing the node, and TAG_PTR is an
+ If FB is non-null, it is the file containing the node, and TAG_PTR is an
offset into FB->tags. If the node contents are rewritten, adjust anchors
- that occur in the node and store adjusted value as TAG->nodestart_adjusted,
- otherwise simply copy TAG->nodestart to TAG->nodestart_adjusted for each
+ that occur in the node and store adjusted value as TAG->nodestart_adjusted,
+ otherwise simply copy TAG->nodestart to TAG->nodestart_adjusted for each
anchor in the node. */
void
scan_node_contents (NODE *node, FILE_BUFFER *fb, TAG **tag_ptr)
@@ -1551,7 +1551,7 @@ scan_node_contents (NODE *node, FILE_BUFFER *fb, TAG
**tag_ptr)
REFERENCE *entry;
/* Write out up to match */
- copy_input_to_output (match - inptr);
+ copy_input_to_output (match - inptr);
if ((in_menu && match[0] == '\n') || match[0] == '*')
{
@@ -1564,7 +1564,7 @@ scan_node_contents (NODE *node, FILE_BUFFER *fb, TAG
**tag_ptr)
in_parentheses = 1;
save_conversion_state ();
-
+
if (!scan_reference_marker (entry, in_parentheses))
goto not_a_reference;
@@ -1592,7 +1592,7 @@ scan_node_contents (NODE *node, FILE_BUFFER *fb, TAG
**tag_ptr)
else
{
/* Proceed to read the rest of the reference. */
- /* TODO: we should probably not allow references of the form
+ /* TODO: we should probably not allow references of the form
"(file)node1:node2." or "(file1)node1:(file2)node2", so
bail out here if entry->filename is non-null. */
@@ -1606,8 +1606,8 @@ scan_node_contents (NODE *node, FILE_BUFFER *fb, TAG
**tag_ptr)
{
char *cur_inptr;
-not_a_reference:
- /* This is not a menu entry or reference. Do not add to our
+ not_a_reference:
+ /* This is not a menu entry or reference. Do not add to our
list. */
cur_inptr = inptr;
reset_conversion ();
@@ -1640,7 +1640,7 @@ not_a_reference:
/* If we haven't accidentally gone past the end of the node, write
out the rest of it. */
if (inptr < node->contents + node->nodelen)
- copy_input_to_output ((node->contents + node->nodelen) - inptr);
+ copy_input_to_output ((node->contents + node->nodelen) - inptr);
/* Null to terminate buffer. */
if (rewrite_p)
@@ -1648,7 +1648,7 @@ not_a_reference:
/* Free resources used in character encoding conversion. */
close_conversion ();
-
+
node->references = refs;
if (rewrite_p)
@@ -1657,7 +1657,7 @@ not_a_reference:
free (node->contents);
node->contents = text_buffer_base (&output_buf);
node->flags |= N_WasRewritten;
-
+
/* output_buf.off is the offset of the next character to be
written. Subtracting 1 gives the offset of our terminating
null, that is, the length. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * info/dir.c, info/display.c, info/scan.c: reindent, replace tabs by spaces, remove spaces, minor edit of a comment.,
Patrice Dumas <=