dump.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1984-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* make dump and trace routines
*/
#include "make.h"
static int dumpall; /* don't be selective */
/*
* list a rule name in re-readable form
*/
static void
{
register char* s;
register char* t;
register int paren;
int quote;
{
if (*t == '(')
paren++;
else if (*t == ')')
paren--;
if (quote = (*t || t == s))
for (; *s; s++)
{
switch (*s)
{
case '"':
if (quote)
break;
case '$':
if (*(s + 1) == '(')
break;
}
}
if (quote)
}
else
{
if (*r->name)
else
{
}
}
#if DEBUG
#endif
}
/*
* list a single rule and its attributes
*/
static int
listrule(const char* s, char* v, void* h)
{
register List_t* p;
register int n;
!(r->property & (P_accept|P_after|P_always|P_archive|P_before|P_command|P_force|P_foreground|P_functional|P_ignore|P_immediate|P_implicit|P_joint|P_local|P_make|P_multiple|P_operator|P_parameter|P_read|P_repeat|P_target|P_terminal|P_use|P_virtual)) && !((r->property & P_attribute) && r->attribute) && !r->semaphore))
return 0;
{
}
if (!(r->property & P_attribute))
{
if (r->attribute)
if (r->scan)
{
break;
}
}
{
{
if (r->property & P_staterule)
{
if (!isaltstate(r->name))
}
else if (r->property & P_statevar)
else
}
else if (r->view)
if (r->must)
if (r->semaphore)
if (r->active)
if (r->property & P_attribute)
{
if (r->attribute)
else if (r->scan)
else
}
if (r->property & P_dontcare)
if (r->property & P_foreground)
if (r->property & P_functional)
if (r->property & P_immediate)
if (r->property & P_implicit)
if (r->property & P_internal)
if (r->property & P_metarule)
if (r->property & P_multiple)
if (r->property & P_operator)
if (r->property & P_parameter)
if (r->property & P_readonly)
if (r->property & P_terminal)
if (r->dynamic & D_aliaschanged)
#if BINDINDEX
if (r->dynamic & D_bindindex)
#endif
if (r->dynamic & D_compiled)
if (r->dynamic & D_hasafter)
if (r->dynamic & D_hasbefore)
if (r->dynamic & D_hasscope)
if (r->dynamic & D_hassemaphore)
if (r->dynamic & D_intermediate)
if (r->dynamic & D_membertoo)
if (r->dynamic & D_triggered)
else
switch (r->status)
{
case NOTYET:
break;
case UPDATE:
break;
case MAKING:
break;
case TOUCH:
break;
case EXISTS:
break;
case IGNORE:
break;
case FAILED:
break;
case OLDRULE:
break;
#if DEBUG
default:
break;
#endif
}
if (r->mark)
{
if (r->mark & M_directory)
if (r->mark & M_generate)
if (r->mark & M_metarule)
}
}
else
{
if (r->property & P_attribute)
{
if (r->attribute)
else if (r->scan)
}
if (r->property & P_foreground)
if (r->property & P_functional)
if (r->property & P_multiple)
if (r->property & P_immediate)
if (r->property & P_implicit)
if (r->property & P_operator)
if (r->property & P_parameter)
if (r->semaphore)
for (n = r->semaphore - 1; n; n--)
if (r->property & P_terminal)
}
if (p = r->prereqs)
{
for (; p; p = p->next)
}
{
}
return 0;
}
/*
* list a single variable and its value
*/
static int
listvar(const char* s, char* u, void* h)
{
register char* t;
register char* q;
{
{
if (*q)
q = "\"";
}
else
q = null;
#if DEBUG
#endif
{
if (v->property & V_auxiliary)
if (v->property & V_functional)
if (v->property & V_oldvalue)
{
if (t = getold(s))
}
if (v->property & V_readonly)
if (v->property & V_restored)
}
{
else if (*t)
}
}
return 0;
}
/*
* dump rules and variables
*/
void
{
static int dumping;
if (!dumping++)
{
if (verbose)
{
}
{
}
dumping--;
}
}
/*
* dump regression prefix,name,value
*/
void
{
register int c;
register int n;
int* rp;
char* bp;
char* np;
static int index;
n = -1;
if (value)
for (;;)
{
switch (c = *value++)
{
case 0:
break;
case '\n':
n = 1;
continue;
case '\t':
c = ' ';
/*FALLTHROUGH*/
case ' ':
continue;
/*FALLTHROUGH*/
case '\'':
case '"':
case '=':
case ':':
n = 1;
continue;
case '/':
if (n)
{
for (;;)
{
switch (*value++)
{
case ' ':
case '\t':
case '\n':
case '\'':
case '"':
case ':':
case 0:
break;
case '/':
/*FALLTHROUGH*/
default:
continue;
}
break;
}
c = *--value;
*value = 0;
{
*value = c;
*value = 0;
}
{
}
*value = c;
n = 0;
}
else
continue;
case '-':
case '+':
if (n)
{
if (!(c = *value++))
break;
n = isalnum(c) ? 1 : 0;
}
continue;
default:
n = 0;
continue;
}
break;
}
}
/*
* dump an action placing prefix at the beginning of each line
*/
void
{
register char* s;
char* mamlabel;
char* sep;
if (prefix)
{
}
else
{
{
return;
}
{
prefix = "exec";
if (!name)
name = "-";
sep = " ";
}
else
{
action++;
if (!*action)
return;
prefix = "+";
}
}
for (;;)
{
*s = 0;
if (!s)
break;
*s++ = '\n';
action = s;
}
}
/*
* dump variable info
*/
void
{
dumpall++;
dumpall--;
}
/*
* dump rule info
*/
void
{
register int i;
register Rule_t* z;
dumpall++;
z = 0;
{
z = r;
r = z;
}
if (r != z)
for (i = RULE; i <= STATERULES; i++)
dumpall--;
}