[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5472] man page support
From: |
Gavin D. Smith |
Subject: |
[5472] man page support |
Date: |
Tue, 22 Apr 2014 00:47:36 +0000 |
Revision: 5472
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5472
Author: gavin
Date: 2014-04-22 00:47:35 +0000 (Tue, 22 Apr 2014)
Log Message:
-----------
man page support
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info-utils.c
trunk/info/info-utils.h
trunk/info/man.c
trunk/info/nodemenu.c
trunk/info/nodes.c
trunk/info/nodes.h
trunk/info/session.c
trunk/info/window.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/ChangeLog 2014-04-22 00:47:35 UTC (rev 5472)
@@ -1,5 +1,19 @@
2014-04-22 Gavin Smith <address@hidden>
+ * info/info-utils.c (info_get_labeled_reference)
+ (info_menu_entry_by_label): Renamed. Only look for menu items.
+
+ * info/man.c (manpage_node_of_file_buffer): Set nodelen and nodestart
+ field in returned NODE.
+ (xrefs_of_manpage): If no references, return array with a single
+ null entry instead of null. Set type fields to REFERENCE_XREF.
+ * info/window.c: (window_make_modeline) If preprocess_nodes_p is
+ set, display less information in status bar.
+ * info/nodes.c (get_node_length): Function no longer static.
+ Definition moved in file.
+
+2014-04-22 Gavin Smith <address@hidden>
+
* info/info-utils.c, info/info-utils.h (info_menu_of_node)
(info_xrefs_of_node, info_menu_items, info_xrefs)
(info_references_internal): Functions deleted.
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/info-utils.c 2014-04-22 00:47:35 UTC (rev 5472)
@@ -188,16 +188,17 @@
/* */
/* **************************************************************** */
-/* Get the entry associated with LABEL in REFERENCES. Return a pointer
+/* Get the menu entry associated with LABEL in REFERENCES. Return a pointer
to the ENTRY if found, or NULL. */
REFERENCE *
-info_get_labeled_reference (char *label, REFERENCE **references)
+info_get_menu_entry_by_label (char *label, REFERENCE **references)
{
register int i;
REFERENCE *entry;
for (i = 0; references && (entry = references[i]); i++)
{
+ if (REFERENCE_MENU_ITEM != entry->type) continue;
if (strcmp (label, entry->label) == 0)
return entry;
}
Modified: trunk/info/info-utils.h
===================================================================
--- trunk/info/info-utils.h 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/info-utils.h 2014-04-22 00:47:35 UTC (rev 5472)
@@ -62,9 +62,9 @@
void scan_node_contents (FILE_BUFFER *fb, NODE **node_ptr);
-/* Get the entry associated with LABEL in REFERENCES. Return a pointer to
- the reference if found, or NULL. */
-extern REFERENCE *info_get_labeled_reference (char *label,
+/* Get the menu entry associated with LABEL in REFERENCES. Return a
+ pointer to the reference if found, or NULL. */
+extern REFERENCE *info_get_menu_entry_by_label (char *label,
REFERENCE **references);
/* A utility function for concatenating REFERENCE **. Returns a new
Modified: trunk/info/man.c
===================================================================
--- trunk/info/man.c 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/man.c 2014-04-22 00:47:35 UTC (rev 5472)
@@ -33,6 +33,7 @@
#include "tilde.h"
#include "man.h"
+#include "variables.h"
#if !defined (_POSIX_VERSION)
#define pid_t int
@@ -406,9 +407,28 @@
node->nodename = xstrdup (tag->nodename);
node->contents = file_buffer->contents + tag->nodestart;
node->nodelen = tag->nodelen;
+ node->nodestart = tag->nodestart;
node->flags |= (N_HasTagsTable | N_IsManPage);
node->contents += skip_node_separator (node->contents);
node->body_start = strcspn(node->contents, "\n");
+
+ node->up = "(dir)";
+
+ /* Set nodelen, which is currently -1. */
+
+ {
+ SEARCH_BINDING node_body;
+
+ node_body.buffer = file_buffer->contents;
+ node_body.start = node->nodestart;
+ node_body.start +=
+ skip_node_separator (file_buffer->contents + node->nodestart);
+ node_body.end = file_buffer->filesize;
+ node_body.flags = S_FoldCase;
+ node->nodelen = get_node_length (&node_body);
+
+ node->references = xrefs_of_manpage (node);
+ }
}
return node;
@@ -542,10 +562,14 @@
size_t refs_slots = 0;
long position;
+ /* Initialize reference list to have a single null entry. */
+ refs = calloc(1, sizeof (REFERENCE *));
+ refs_slots = 1;
+
reference_section = find_reference_section (node);
if (reference_section == NULL)
- return NULL;
+ return refs;
/* Grovel the reference section building a list of references found there.
A reference is alphabetic characters followed by non-whitespace text
@@ -590,6 +614,7 @@
entry->nodename = xstrdup (entry->label);
entry->start = start;
entry->end = end;
+ entry->type = REFERENCE_XREF;
add_pointer_to_array (entry, refs_index, refs, refs_slots, 10);
}
Modified: trunk/info/nodemenu.c
===================================================================
--- trunk/info/nodemenu.c 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/nodemenu.c 2014-04-22 00:47:35 UTC (rev 5472)
@@ -20,6 +20,7 @@
Originally written by Brian Fox. */
#include "info.h"
+#include "variables.h"
NODE *get_visited_nodes (Function *filter_func);
@@ -330,7 +331,7 @@
REFERENCE *entry;
/* Find the selected label in the references. */
- entry = info_get_labeled_reference (line, menu);
+ entry = info_get_menu_entry_by_label (line, menu);
if (!entry)
info_error (_("The reference disappeared! (%s)."), line);
Modified: trunk/info/nodes.c
===================================================================
--- trunk/info/nodes.c 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/nodes.c 2014-04-22 00:47:35 UTC (rev 5472)
@@ -45,7 +45,6 @@
/* Functions for tag table creation and destruction. */
-static long get_node_length (SEARCH_BINDING *binding);
static void get_nodes_of_info_file (FILE_BUFFER *file_buffer);
static void get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
SEARCH_BINDING *buffer_binding);
@@ -159,22 +158,6 @@
get_nodes_of_info_file (file_buffer);
}
-/* Return the length of the node which starts at BINDING. */
-static long
-get_node_length (SEARCH_BINDING *binding)
-{
- int i;
- char *body;
-
- /* [A node] ends with either a ^_, a ^L, or end of file. */
- for (i = binding->start, body = binding->buffer; i < binding->end; i++)
- {
- if (body[i] == INFO_FF || body[i] == INFO_COOKIE)
- break;
- }
- return i - binding->start;
-}
-
/* Set fields on new tag table entry. */
static void
init_file_buffer_tag (FILE_BUFFER *fb, NODE *entry)
@@ -962,6 +945,22 @@
return n;
}
+/* Return the length of the node which starts at BINDING. */
+long
+get_node_length (SEARCH_BINDING *binding)
+{
+ int i;
+ char *body;
+
+ /* [A node] ends with either a ^_, a ^L, or end of file. */
+ for (i = binding->start, body = binding->buffer; i < binding->end; i++)
+ {
+ if (body[i] == INFO_FF || body[i] == INFO_COOKIE)
+ break;
+ }
+ return i - binding->start;
+}
+
/* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME,
using WINDOW for defaults. If WINDOW is null, the defaults are:
- If FILENAME is NULL, `dir' is used.
Modified: trunk/info/nodes.h
===================================================================
--- trunk/info/nodes.h 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/nodes.h 2014-04-22 00:47:35 UTC (rev 5472)
@@ -23,6 +23,7 @@
#define NODES_H
#include "info.h"
+#include "search.h"
/* User code interface. */
@@ -135,6 +136,9 @@
/* Externally visible functions. */
+/* Return the length of the node which starts at BINDING. */
+long get_node_length (SEARCH_BINDING *binding);
+
/* Array of FILE_BUFFER * which represents the currently loaded info files. */
extern FILE_BUFFER **info_loaded_files;
Modified: trunk/info/session.c
===================================================================
--- trunk/info/session.c 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/session.c 2014-04-22 00:47:35 UTC (rev 5472)
@@ -21,6 +21,7 @@
#include "info.h"
#include "search.h"
+
#ifndef __MINGW32__
#include <sys/ioctl.h>
#endif
@@ -2781,7 +2782,7 @@
}
/* Find the specified menu item. */
- entry = info_get_labeled_reference (arg, menu);
+ entry = info_get_menu_entry_by_label (arg, menu);
/* If the item wasn't found, search the list sloppily. Perhaps this
user typed "buffer" when they really meant "Buffers". */
@@ -2968,7 +2969,7 @@
REFERENCE *entry;
/* First, try to find the specified menu item verbatim. */
- entry = info_get_labeled_reference (arg, menu);
+ entry = info_get_menu_entry_by_label (arg, menu);
/* If the item wasn't found, search the list sloppily. Perhaps we
have "Option Summary", but ARG is "option". */
Modified: trunk/info/window.c
===================================================================
--- trunk/info/window.c 2014-04-22 00:23:02 UTC (rev 5471)
+++ trunk/info/window.c 2014-04-22 00:47:35 UTC (rev 5472)
@@ -26,6 +26,7 @@
#include "info-utils.h"
#include "infomap.h"
#include "tag.h"
+#include "variables.h"
/* The window which describes the screen. */
WINDOW *the_screen = NULL;
@@ -1067,7 +1068,6 @@
if (node->parent)
{
parent = filename_non_directory (node->parent);
- modeline_len += strlen ("Subfile: ") + strlen (node->filename);
}
if (node->filename)
@@ -1077,37 +1077,70 @@
update_message = _("--*** Tags out of Date ***");
}
- if (update_message)
- modeline_len += strlen (update_message);
- modeline_len += strlen (filename);
- modeline_len += strlen (nodename);
- modeline_len += 4; /* strlen (location_indicator). */
+ if (preprocess_nodes_p)
+ {
+ char *name;
+ int dot;
- /* 10 for the decimal representation of the number of lines in this
- node, and the remainder of the text that can appear in the line. */
- modeline_len += 10 + strlen (_("-----Info: (), lines ----, "));
- modeline_len += window->width;
+ name = parent ? parent : filename ? filename : 0;
- modeline = xmalloc (1 + modeline_len);
+ modeline_len += strlen ("--() --");
+ modeline_len += 3; /* strlen (location_indicator) */
+ modeline_len += strlen (name);
+ if (nodename) modeline_len += strlen (nodename);
+ if (modeline_len < window->width)
+ modeline_len = window->width;
- /* Special internal windows have no filename. */
- if (!parent && !*filename)
- sprintf (modeline, _("-%s---Info: %s, %d lines --%s--"),
- (window->flags & W_NoWrap) ? "$" : "-",
- nodename, window->line_count, location_indicator);
+ modeline = xcalloc (1, 1 + modeline_len);
+
+ /* Omit any extension like ".info.gz" from file name. */
+ dot = strcspn (name, ".");
+
+ sprintf (modeline, "%s--", location_indicator);
+ if (name && strcmp ("", name))
+ {
+ sprintf (modeline + strlen (modeline), "(");
+ strncpy (modeline + strlen (modeline), name, dot);
+ sprintf (modeline + strlen (modeline), ") ");
+ }
+ sprintf (modeline + strlen (modeline), "%s--", nodename);
+ }
else
- sprintf (modeline, _("-%s%s-Info: (%s)%s, %d lines --%s--"),
- (window->flags & W_NoWrap) ? "$" : "-",
- (node && (node->flags & N_IsCompressed)) ? "zz" : "--",
- parent ? parent : filename,
- nodename, window->line_count, location_indicator);
+ {
+ if (node && node->parent)
+ modeline_len += strlen ("Subfile: ") + strlen (node->filename);
- if (parent)
- sprintf (modeline + strlen (modeline), _(" Subfile: %s"), filename);
+ if (update_message)
+ modeline_len += strlen (update_message);
+ modeline_len += strlen (filename);
+ modeline_len += strlen (nodename);
+ modeline_len += 4; /* strlen (location_indicator). */
- if (update_message)
- sprintf (modeline + strlen (modeline), "%s", update_message);
+ /* 10 for the decimal representation of the number of lines in this
+ node, and the remainder of the text that can appear in the line. */
+ modeline_len += 10 + strlen (_("-----Info: (), lines ----, "));
+ modeline_len += window->width;
+ modeline = xmalloc (1 + modeline_len);
+
+ /* Special internal windows have no filename. */
+ if (!parent && !*filename)
+ sprintf (modeline, _("-%s---Info: %s, %d lines --%s--"),
+ (window->flags & W_NoWrap) ? "$" : "-",
+ nodename, window->line_count, location_indicator);
+ else
+ sprintf (modeline, _("-%s%s-Info: (%s)%s, %d lines --%s--"),
+ (window->flags & W_NoWrap) ? "$" : "-",
+ (node && (node->flags & N_IsCompressed)) ? "zz" : "--",
+ parent ? parent : filename,
+ nodename, window->line_count, location_indicator);
+ if (parent)
+ sprintf (modeline + strlen (modeline), _(" Subfile: %s"), filename);
+
+ if (update_message)
+ sprintf (modeline + strlen (modeline), "%s", update_message);
+ }
+
i = strlen (modeline);
if (i >= window->width)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5472] man page support,
Gavin D. Smith <=