Upgrade Texinfo from 4.8 to 4.13 on the vendor branch
[dragonfly.git] / contrib / texinfo / makeinfo / macro.h
1 /* macro.h -- declarations for macro.c.
2    $Id: macro.h,v 1.6 2007/07/01 21:20:32 karl Exp $
3
4    Copyright (C) 1998, 1999, 2007 Free Software Foundation, Inc.
5
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation, either version 3 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 #ifndef MACRO_H
20 #define MACRO_H
21
22 extern FILE *macro_expansion_output_stream;
23 extern char *macro_expansion_filename;
24 extern int me_executing_string;
25 extern int only_macro_expansion;
26
27 /* Here is a structure used to remember input text strings and offsets
28    within them. */
29 typedef struct {
30   char *pointer;                /* Pointer to the input text. */
31   int offset;                   /* Offset of the last character output. */
32 } ITEXT;
33
34 /* Macro definitions for user-defined commands. */
35 typedef struct {
36   char *name;                   /* Name of the macro. */
37   char **arglist;               /* Args to replace when executing. */
38   int argcount;                 /* Number of args in arglist */
39   char *body;                   /* Macro body. */
40   char *source_file;            /* File where this macro is defined. */
41   int source_lineno;            /* Line number within FILENAME. */
42   int inhibited;                /* Nonzero means make find_macro () fail. */
43   int flags;                    /* ME_RECURSE, etc. */
44 } MACRO_DEF;
45
46 /* flags for MACRO_DEF */
47 #define ME_RECURSE      0x01
48
49 extern void execute_macro (MACRO_DEF *def);
50 extern MACRO_DEF *find_macro (char *name);
51 extern char *expand_macro (MACRO_DEF *def);
52
53 extern ITEXT *remember_itext (char *pointer, int offset);
54 extern void forget_itext (char *pointer);
55 extern void maybe_write_itext (char *pointer, int offset);
56 extern void write_region_to_macro_output (char *string, int start, int end);
57 extern void append_to_expansion_output (int offset);
58 extern void me_append_before_this_command (void);
59 extern void me_execute_string (char *execution_string);
60 extern void me_execute_string_keep_state (char *execution_string,
61     char *append_string);
62
63 extern char *alias_expand (char *tok);
64 extern int enclosure_command (char *tok);
65 extern void enclosure_expand (int arg, int start, int end);
66
67 /* The @commands.  */
68 extern void cm_macro (void), cm_rmacro (void), cm_unmacro (void);
69 extern void cm_alias (void), cm_definfoenclose (void);
70
71 extern int array_len (char **array);
72 extern void free_array (char **array);
73
74 enum quote_type { quote_none, quote_single, quote_many };
75 extern char **get_brace_args (enum quote_type type);
76
77 #endif /* not MACRO_H */