Home | History | Annotate | Line # | Download | only in makeinfo
      1 /*	$NetBSD: macro.h,v 1.4 2025/12/31 22:18:50 oster Exp $	*/
      2 
      3 /* macro.h -- declarations for macro.c.
      4    Id: macro.h,v 1.2 2004/04/11 17:56:47 karl Exp
      5 
      6    Copyright (C) 1998, 99 Free Software Foundation, Inc.
      7 
      8    This program is free software; you can redistribute it and/or modify
      9    it under the terms of the GNU General Public License as published by
     10    the Free Software Foundation; either version 2, or (at your option)
     11    any later version.
     12 
     13    This program is distributed in the hope that it will be useful,
     14    but WITHOUT ANY WARRANTY; without even the implied warranty of
     15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16    GNU General Public License for more details.
     17 
     18    You should have received a copy of the GNU General Public License
     19    along with this program; if not, write to the Free Software
     20    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
     21    */
     22 
     23 #ifndef MACRO_H
     24 #define MACRO_H
     25 
     26 extern FILE *macro_expansion_output_stream;
     27 extern char *macro_expansion_filename;
     28 extern int me_executing_string;
     29 extern int only_macro_expansion;
     30 
     31 /* Here is a structure used to remember input text strings and offsets
     32    within them. */
     33 typedef struct {
     34   char *pointer;                /* Pointer to the input text. */
     35   int offset;                   /* Offset of the last character output. */
     36 } ITEXT;
     37 
     38 /* Macro definitions for user-defined commands. */
     39 typedef struct {
     40   char *name;                   /* Name of the macro. */
     41   char **arglist;               /* Args to replace when executing. */
     42   char *body;                   /* Macro body. */
     43   char *source_file;            /* File where this macro is defined. */
     44   int source_lineno;            /* Line number within FILENAME. */
     45   int inhibited;                /* Nonzero means make find_macro () fail. */
     46   int flags;                    /* ME_RECURSE, ME_QUOTE_ARG, etc. */
     47 } MACRO_DEF;
     48 
     49 /* flags for MACRO_DEF */
     50 #define ME_RECURSE      0x01
     51 #define ME_QUOTE_ARG    0x02
     52 
     53 extern void execute_macro (MACRO_DEF *def);
     54 extern MACRO_DEF *find_macro (char *name);
     55 extern char *expand_macro (MACRO_DEF *def);
     56 
     57 extern ITEXT *remember_itext (char *pointer, int offset);
     58 extern void forget_itext (char *pointer);
     59 extern void maybe_write_itext (char *pointer, int offset);
     60 extern void write_region_to_macro_output (char *string, int start, int end);
     61 extern void append_to_expansion_output (int offset);
     62 extern void me_append_before_this_command (void);
     63 extern void me_execute_string (char *execution_string);
     64 extern void me_execute_string_keep_state (char *execution_string,
     65     char *append_string);
     66 
     67 extern char *alias_expand (char *tok);
     68 extern int enclosure_command (char *tok);
     69 extern void enclosure_expand (int arg, int start, int end);
     70 
     71 /* The @commands.  */
     72 extern void cm_macro (int arg, int arg2, int arg3), cm_rmacro (int arg, int arg2, int arg3), cm_unmacro (int arg, int arg2, int arg3);
     73 extern void cm_alias (int arg, int arg2, int arg3), cm_definfoenclose (int arg, int arg2, int arg3);
     74 
     75 extern int array_len (char **array);
     76 extern void free_array (char **array);
     77 extern char **get_brace_args (int quote_single);
     78 
     79 #endif /* not MACRO_H */
     80