This commit is contained in:
Oliver Lehmann 1989-07-12 08:20:19 +00:00
parent 4f9d7e698d
commit 48a90f1501
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
# include <stdio.h>
# include "gen.h"
# include "../h/dbs.h"
/*
** MCALL -- call a macro
**
** This takes care of springing a macro and processing it for
** any side effects. Replacement text is saved away in a static
** buffer and returned.
**
** Parameters:
** mac -- the macro to spring.
**
** Returns:
** replacement text.
*/
char *mcall(mac)
char *mac;
{
static char buf[FILENAME + 1];
register int c;
register char *p;
extern int macsget();
# ifdef xMTR2
AAtTfp(18, -1, "MCALL: `%s'\n", mac);
# endif
/* set up to process the macro */
macinit(macsget, &mac, FALSE);
/* process it -- throw away result */
for (p = buf; (c = macgetch()) > 0; )
{
# ifdef xMTR2
if (AAtTf(18, 1))
putchar(c);
# endif
if (p < &buf[sizeof buf])
*p++ = c;
}
*p = 0;
# ifdef xMTR2
if (AAtTf(18, 1))
putchar('\n');
# endif
return (buf);
}