xref: /openbsd/gnu/usr.bin/texinfo/makeinfo/macro.h (revision a1acfa9b)
1 /* macro.h -- declarations for macro.c.
2    $Id: macro.h,v 1.1.1.2 2006/07/17 16:03:47 espie Exp $
3 
4    Copyright (C) 1998, 99 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 2, or (at your option)
9    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, write to the Free Software
18    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19    */
20 
21 #ifndef MACRO_H
22 #define MACRO_H
23 
24 extern FILE *macro_expansion_output_stream;
25 extern char *macro_expansion_filename;
26 extern int me_executing_string;
27 extern int only_macro_expansion;
28 
29 /* Here is a structure used to remember input text strings and offsets
30    within them. */
31 typedef struct {
32   char *pointer;                /* Pointer to the input text. */
33   int offset;                   /* Offset of the last character output. */
34 } ITEXT;
35 
36 /* Macro definitions for user-defined commands. */
37 typedef struct {
38   char *name;                   /* Name of the macro. */
39   char **arglist;               /* Args to replace when executing. */
40   char *body;                   /* Macro body. */
41   char *source_file;            /* File where this macro is defined. */
42   int source_lineno;            /* Line number within FILENAME. */
43   int inhibited;                /* Nonzero means make find_macro () fail. */
44   int flags;                    /* ME_RECURSE, ME_QUOTE_ARG, etc. */
45 } MACRO_DEF;
46 
47 /* flags for MACRO_DEF */
48 #define ME_RECURSE      0x01
49 #define ME_QUOTE_ARG    0x02
50 
51 extern void execute_macro (MACRO_DEF *def);
52 extern MACRO_DEF *find_macro (char *name);
53 extern char *expand_macro (MACRO_DEF *def);
54 
55 extern ITEXT *remember_itext (char *pointer, int offset);
56 extern void forget_itext (char *pointer);
57 extern void maybe_write_itext (char *pointer, int offset);
58 extern void write_region_to_macro_output (char *string, int start, int end);
59 extern void append_to_expansion_output (int offset);
60 extern void me_append_before_this_command (void);
61 extern void me_execute_string (char *execution_string);
62 extern void me_execute_string_keep_state (char *execution_string,
63     char *append_string);
64 
65 extern char *alias_expand (char *tok);
66 extern int enclosure_command (char *tok);
67 extern void enclosure_expand (int arg, int start, int end);
68 
69 /* The @commands.  */
70 extern void cm_macro (void), cm_rmacro (void), cm_unmacro (void);
71 extern void cm_alias (void), cm_definfoenclose (void);
72 
73 extern int array_len (char **array);
74 extern void free_array (char **array);
75 extern char **get_brace_args (int quote_single);
76 
77 #endif /* not MACRO_H */
78