Use target specific, language specific object files feature to allow build
[official-gcc.git] / texinfo / info / info-utils.h
blob8c526c40f138bb8d4cb904137233586db87aedd0
1 /* info-utils.h -- Exported functions and variables from info-util.c.
2 $Id: info-utils.h,v 1.1.1.2 1998/03/22 20:42:36 law Exp $
4 This file is part of GNU Info, a program for reading online documentation
5 stored in Info format.
7 Copyright (C) 1993, 96 Free Software Foundation, Inc.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Written by Brian Fox (bfox@ai.mit.edu). */
25 #ifndef INFO_UTILS_H
26 #define INFO_UTILS_H
28 #if !defined (HAVE_STRCHR)
29 # undef strchr
30 # undef strrchr
31 # define strchr index
32 # define strrchr rindex
33 #endif /* !HAVE_STRCHR */
35 #include "nodes.h"
36 #include "window.h"
37 #include "search.h"
39 /* Structure which describes a node reference, such as a menu entry or
40 cross reference. Arrays of such references can be built by calling
41 info_menus_of_node () or info_xrefs_of_node (). */
42 typedef struct {
43 char *label; /* User Label. */
44 char *filename; /* File where this node can be found. */
45 char *nodename; /* Name of the node. */
46 int start, end; /* Offsets within the containing node of LABEL. */
47 } REFERENCE;
49 /* When non-zero, various display and input functions handle ISO Latin
50 character sets correctly. */
51 extern int ISO_Latin_p;
53 /* Variable which holds the most recent filename parsed as a result of
54 calling info_parse_xxx (). */
55 extern char *info_parsed_filename;
57 /* Variable which holds the most recent nodename parsed as a result of
58 calling info_parse_xxx (). */
59 extern char *info_parsed_nodename;
61 /* Parse the filename and nodename out of STRING. If STRING doesn't
62 contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
63 INFO_PARSED_FILENAME to NULL. If second argument NEWLINES_OKAY is
64 non-zero, it says to allow the nodename specification to cross a
65 newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
66 void info_parse_node ();
68 /* Return a NULL terminated array of REFERENCE * which represents the menu
69 found in NODE. If there is no menu in NODE, just return a NULL pointer. */
70 extern REFERENCE **info_menu_of_node ();
72 /* Return a NULL terminated array of REFERENCE * which represents the cross
73 refrences found in NODE. If there are no cross references in NODE, just
74 return a NULL pointer. */
75 extern REFERENCE **info_xrefs_of_node ();
77 /* Glean cross references from BINDING->buffer + BINDING->start until
78 BINDING->end. Return an array of REFERENCE * that represents each
79 cross reference in this range. */
80 extern REFERENCE **info_xrefs ();
82 /* Get the entry associated with LABEL in REFERENCES. Return a pointer to
83 the reference if found, or NULL. */
84 extern REFERENCE *info_get_labeled_reference ();
86 /* Glean menu entries from BINDING->buffer + BINDING->start until we
87 have looked at the entire contents of BINDING. Return an array
88 of REFERENCE * that represents each menu item in this range. */
89 extern REFERENCE **info_menu_items ();
91 /* A utility function for concatenating REFERENCE **. Returns a new
92 REFERENCE ** which is the concatenation of REF1 and REF2. The REF1
93 and REF2 arrays are freed, but their contents are not. */
94 REFERENCE **info_concatenate_references ();
96 /* Free the data associated with REFERENCES. */
97 extern void info_free_references ();
99 /* Search for sequences of whitespace or newlines in STRING, replacing
100 all such sequences with just a single space. Remove whitespace from
101 start and end of string. */
102 void canonicalize_whitespace ();
104 /* Return a pointer to a string which is the printed representation
105 of CHARACTER if it were printed at HPOS. */
106 extern char *printed_representation ();
108 /* Return a pointer to the part of PATHNAME that simply defines the file. */
109 extern char *filename_non_directory ();
111 /* Return non-zero if NODE is one especially created by Info. */
112 extern int internal_info_node_p ();
114 /* Make NODE appear to be one especially created by Info, and give it NAME. */
115 extern void name_internal_node ();
117 /* Return the window displaying NAME, the name of an internally created
118 Info window. */
119 extern WINDOW *get_internal_info_window ();
121 /* Return the node addressed by LABEL in NODE (usually one of "Prev:",
122 "Next:", "Up:", "File:", or "Node:". After a call to this function,
123 the global INFO_PARSED_NODENAME and INFO_PARSED_FILENAME contain
124 the information. */
125 extern void info_parse_label (/* label, node */);
127 #define info_label_was_found \
128 (info_parsed_nodename != NULL || info_parsed_filename != NULL)
130 #define info_file_label_of_node(n) info_parse_label (INFO_FILE_LABEL, n)
131 #define info_next_label_of_node(n) info_parse_label (INFO_NEXT_LABEL, n)
132 #define info_up_label_of_node(n) info_parse_label (INFO_UP_LABEL, n)
133 #define info_prev_label_of_node(n) \
134 do { \
135 info_parse_label (INFO_PREV_LABEL, n); \
136 if (!info_label_was_found) \
137 info_parse_label (INFO_ALTPREV_LABEL, n); \
138 } while (0)
140 #endif /* not INFO_UTILS_H */