From 075e3957eaedc259ec5ceda71fbc399ebb27f739 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Thu, 27 Sep 2001 11:40:34 +0000 Subject: traceon/traceoff built-ins. --- usr.bin/m4/eval.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'usr.bin/m4/eval.c') diff --git a/usr.bin/m4/eval.c b/usr.bin/m4/eval.c index 868621d2d57..36f70ee4d6a 100644 --- a/usr.bin/m4/eval.c +++ b/usr.bin/m4/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.36 2001/09/19 13:14:18 espie Exp $ */ +/* $OpenBSD: eval.c,v 1.37 2001/09/27 11:40:33 espie Exp $ */ /* $NetBSD: eval.c,v 1.7 1996/11/10 21:21:29 pk Exp $ */ /* @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)eval.c 8.2 (Berkeley) 4/27/95"; #else -static char rcsid[] = "$OpenBSD: eval.c,v 1.36 2001/09/19 13:14:18 espie Exp $"; +static char rcsid[] = "$OpenBSD: eval.c,v 1.37 2001/09/27 11:40:33 espie Exp $"; #endif #endif /* not lint */ @@ -70,6 +70,7 @@ static char rcsid[] = "$OpenBSD: eval.c,v 1.36 2001/09/19 13:14:18 espie Exp $"; static void dodefn __P((const char *)); static void dopushdef __P((const char *, const char *)); static void dodump __P((const char *[], int)); +static void dotrace __P((const char *[], int, int)); static void doifelse __P((const char *[], int)); static int doincl __P((const char *)); static int dopaste __P((const char *)); @@ -169,6 +170,14 @@ expand_builtin(argv, argc, td) dodump(argv, argc); break; + case TRACEONTYPE: + dotrace(argv, argc, 1); + break; + + case TRACEOFFTYPE: + dotrace(argv, argc, 0); + break; + case EXPRTYPE: /* * doexpr - evaluate arithmetic @@ -675,6 +684,24 @@ dodump(argv, argc) } } +/* + * dotrace - mark some macros as traced/untraced depending upon on. + */ +static void +dotrace(argv, argc, on) + const char *argv[]; + int argc; + int on; +{ + int n; + + if (argc > 2) { + for (n = 2; n < argc; n++) + mark_traced(argv[n], on); + } else + mark_traced(NULL, on); +} + /* * doifelse - select one of two alternatives - loop. */ -- cgit v1.2.3