Back to index

tetex-bin  3.0
macro.h
Go to the documentation of this file.
00001 /* macro.h -- declarations for macro.c.
00002    $Id: macro.h,v 1.2 2004/04/11 17:56:47 karl Exp $
00003 
00004    Copyright (C) 1998, 99 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019    */
00020 
00021 #ifndef MACRO_H
00022 #define MACRO_H
00023 
00024 extern FILE *macro_expansion_output_stream;
00025 extern char *macro_expansion_filename;
00026 extern int me_executing_string;
00027 extern int only_macro_expansion;
00028 
00029 /* Here is a structure used to remember input text strings and offsets
00030    within them. */
00031 typedef struct {
00032   char *pointer;                /* Pointer to the input text. */
00033   int offset;                   /* Offset of the last character output. */
00034 } ITEXT;
00035 
00036 /* Macro definitions for user-defined commands. */
00037 typedef struct {
00038   char *name;                   /* Name of the macro. */
00039   char **arglist;               /* Args to replace when executing. */
00040   char *body;                   /* Macro body. */
00041   char *source_file;            /* File where this macro is defined. */
00042   int source_lineno;            /* Line number within FILENAME. */
00043   int inhibited;                /* Nonzero means make find_macro () fail. */
00044   int flags;                    /* ME_RECURSE, ME_QUOTE_ARG, etc. */
00045 } MACRO_DEF;
00046 
00047 /* flags for MACRO_DEF */
00048 #define ME_RECURSE      0x01
00049 #define ME_QUOTE_ARG    0x02
00050 
00051 extern void execute_macro (MACRO_DEF *def);
00052 extern MACRO_DEF *find_macro (char *name);
00053 extern char *expand_macro (MACRO_DEF *def);
00054 
00055 extern ITEXT *remember_itext (char *pointer, int offset);
00056 extern void forget_itext (char *pointer);
00057 extern void maybe_write_itext (char *pointer, int offset);
00058 extern void write_region_to_macro_output (char *string, int start, int end);
00059 extern void append_to_expansion_output (int offset);
00060 extern void me_append_before_this_command (void);
00061 extern void me_execute_string (char *execution_string);
00062 extern void me_execute_string_keep_state (char *execution_string,
00063     char *append_string);
00064 
00065 extern char *alias_expand (char *tok);
00066 extern int enclosure_command (char *tok);
00067 extern void enclosure_expand (int arg, int start, int end);
00068 
00069 /* The @commands.  */
00070 extern void cm_macro (void), cm_rmacro (void), cm_unmacro (void);
00071 extern void cm_alias (void), cm_definfoenclose (void);
00072 
00073 extern int array_len (char **array);
00074 extern void free_array (char **array);
00075 extern char **get_brace_args (int quote_single);
00076 
00077 #endif /* not MACRO_H */