mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
instrumentation for tracing mode: macro expansion
This commit is contained in:
parent
2e9786c130
commit
99f77b33d6
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: eval.c,v 1.33 2001/09/18 14:17:38 espie Exp $ */
|
||||
/* $OpenBSD: eval.c,v 1.34 2001/09/18 14:43:22 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.33 2001/09/18 14:17:38 espie Exp $";
|
||||
static char rcsid[] = "$OpenBSD: eval.c,v 1.34 2001/09/18 14:43:22 espie Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -84,6 +84,7 @@ static void expand_builtin __P((const char *[], int, int));
|
||||
static void expand_macro __P((const char *[], int));
|
||||
static void dump_one_def __P((ndptr));
|
||||
|
||||
unsigned long expansion_id;
|
||||
|
||||
/*
|
||||
* eval - eval all macros and builtins calls
|
||||
@ -94,6 +95,7 @@ eval(argv, argc, td)
|
||||
int argc;
|
||||
int td;
|
||||
{
|
||||
expansion_id++;
|
||||
if (td & RECDEF)
|
||||
errx(1, "%s at line %lu: expanding recursive definition for %s",
|
||||
CURRENT_NAME, CURRENT_LINE, argv[1]);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: extern.h,v 1.23 2001/09/18 14:05:14 espie Exp $ */
|
||||
/* $OpenBSD: extern.h,v 1.24 2001/09/18 14:43:22 espie Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.3 1996/01/13 23:25:24 pk Exp $ */
|
||||
|
||||
/*-
|
||||
@ -42,6 +42,7 @@
|
||||
/* eval.c */
|
||||
extern void eval __P((const char *[], int, int));
|
||||
extern void dodefine __P((const char *, const char *));
|
||||
extern unsigned long expansion_id;
|
||||
|
||||
/* expr.c */
|
||||
extern int expr __P((const char *));
|
||||
@ -87,6 +88,8 @@ extern void *xalloc __P((size_t));
|
||||
extern char *xstrdup __P((const char *));
|
||||
extern void usage __P((void));
|
||||
extern void resizedivs __P((int n));
|
||||
extern size_t buffer_mark __P((void));
|
||||
extern void dump_buffer __P((FILE *, size_t));
|
||||
|
||||
extern int obtain_char __P((struct input_file *));
|
||||
extern void set_input __P((struct input_file *, FILE *, const char *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: misc.c,v 1.21 2001/07/18 16:18:17 espie Exp $ */
|
||||
/* $OpenBSD: misc.c,v 1.22 2001/09/18 14:43:23 espie Exp $ */
|
||||
/* $NetBSD: misc.c,v 1.6 1995/09/28 05:37:41 tls Exp $ */
|
||||
|
||||
/*
|
||||
@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
static char rcsid[] = "$OpenBSD: misc.c,v 1.21 2001/07/18 16:18:17 espie Exp $";
|
||||
static char rcsid[] = "$OpenBSD: misc.c,v 1.22 2001/09/18 14:43:23 espie Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -357,3 +357,25 @@ doprintfilename(f)
|
||||
{
|
||||
pbstr(f->name);
|
||||
}
|
||||
|
||||
/*
|
||||
* buffer_mark/dump_buffer: allows one to save a mark in a buffer,
|
||||
* and later dump everything that was added since then to a file.
|
||||
*/
|
||||
size_t
|
||||
buffer_mark()
|
||||
{
|
||||
return bp - buf;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dump_buffer(f, m)
|
||||
FILE *f;
|
||||
size_t m;
|
||||
{
|
||||
char *s;
|
||||
|
||||
for (s = bp; s != buf + m;)
|
||||
fputc(*--s, f);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user