1/* $NetBSD: macro.h,v 1.1.1.1 2016/01/14 00:11:29 christos 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 26extern FILE *macro_expansion_output_stream; 27extern char *macro_expansion_filename; 28extern int me_executing_string; 29extern int only_macro_expansion; 30 31/* Here is a structure used to remember input text strings and offsets 32 within them. */ 33typedef 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. */ 39typedef 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 53extern void execute_macro (MACRO_DEF *def); 54extern MACRO_DEF *find_macro (char *name); 55extern char *expand_macro (MACRO_DEF *def); 56 57extern ITEXT *remember_itext (char *pointer, int offset); 58extern void forget_itext (char *pointer); 59extern void maybe_write_itext (char *pointer, int offset); 60extern void write_region_to_macro_output (char *string, int start, int end); 61extern void append_to_expansion_output (int offset); 62extern void me_append_before_this_command (void); 63extern void me_execute_string (char *execution_string); 64extern void me_execute_string_keep_state (char *execution_string, 65 char *append_string); 66 67extern char *alias_expand (char *tok); 68extern int enclosure_command (char *tok); 69extern void enclosure_expand (int arg, int start, int end); 70 71/* The @commands. */ 72extern void cm_macro (void), cm_rmacro (void), cm_unmacro (void); 73extern void cm_alias (void), cm_definfoenclose (void); 74 75extern int array_len (char **array); 76extern void free_array (char **array); 77extern char **get_brace_args (int quote_single); 78 79#endif /* not MACRO_H */ 80