156160Sru/* macro.h -- declarations for macro.c. 2146515Sru $Id: macro.h,v 1.2 2004/04/11 17:56:47 karl Exp $ 356160Sru 456160Sru Copyright (C) 1998, 99 Free Software Foundation, Inc. 556160Sru 656160Sru This program is free software; you can redistribute it and/or modify 756160Sru it under the terms of the GNU General Public License as published by 856160Sru the Free Software Foundation; either version 2, or (at your option) 956160Sru any later version. 1056160Sru 1156160Sru This program is distributed in the hope that it will be useful, 1256160Sru but WITHOUT ANY WARRANTY; without even the implied warranty of 1356160Sru MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1456160Sru GNU General Public License for more details. 1556160Sru 1656160Sru You should have received a copy of the GNU General Public License 1756160Sru along with this program; if not, write to the Free Software 1856160Sru Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 1956160Sru */ 2056160Sru 2156160Sru#ifndef MACRO_H 2256160Sru#define MACRO_H 2356160Sru 2456160Sruextern FILE *macro_expansion_output_stream; 2556160Sruextern char *macro_expansion_filename; 2656160Sruextern int me_executing_string; 2756160Sruextern int only_macro_expansion; 2856160Sru 2956160Sru/* Here is a structure used to remember input text strings and offsets 3056160Sru within them. */ 3156160Srutypedef struct { 3256160Sru char *pointer; /* Pointer to the input text. */ 3356160Sru int offset; /* Offset of the last character output. */ 3456160Sru} ITEXT; 3556160Sru 3656160Sru/* Macro definitions for user-defined commands. */ 3756160Srutypedef struct { 3856160Sru char *name; /* Name of the macro. */ 3956160Sru char **arglist; /* Args to replace when executing. */ 4056160Sru char *body; /* Macro body. */ 4156160Sru char *source_file; /* File where this macro is defined. */ 4256160Sru int source_lineno; /* Line number within FILENAME. */ 4356160Sru int inhibited; /* Nonzero means make find_macro () fail. */ 4456160Sru int flags; /* ME_RECURSE, ME_QUOTE_ARG, etc. */ 4556160Sru} MACRO_DEF; 4656160Sru 4756160Sru/* flags for MACRO_DEF */ 4856160Sru#define ME_RECURSE 0x01 4956160Sru#define ME_QUOTE_ARG 0x02 5056160Sru 51146515Sruextern void execute_macro (MACRO_DEF *def); 52146515Sruextern MACRO_DEF *find_macro (char *name); 53146515Sruextern char *expand_macro (MACRO_DEF *def); 5456160Sru 55146515Sruextern ITEXT *remember_itext (char *pointer, int offset); 56146515Sruextern void forget_itext (char *pointer); 57146515Sruextern void maybe_write_itext (char *pointer, int offset); 58146515Sruextern void write_region_to_macro_output (char *string, int start, int end); 59146515Sruextern void append_to_expansion_output (int offset); 60146515Sruextern void me_append_before_this_command (void); 61146515Sruextern void me_execute_string (char *execution_string); 62146515Sruextern void me_execute_string_keep_state (char *execution_string, 63146515Sru char *append_string); 6456160Sru 65146515Sruextern char *alias_expand (char *tok); 66146515Sruextern int enclosure_command (char *tok); 67146515Sruextern void enclosure_expand (int arg, int start, int end); 6856160Sru 6956160Sru/* The @commands. */ 70146515Sruextern void cm_macro (void), cm_rmacro (void), cm_unmacro (void); 71146515Sruextern void cm_alias (void), cm_definfoenclose (void); 7256160Sru 73146515Sruextern int array_len (char **array); 74146515Sruextern void free_array (char **array); 75146515Sruextern char **get_brace_args (int quote_single); 76146515Sru 7756160Sru#endif /* not MACRO_H */ 78