version 1.2, 1996/06/26 05:33:49 |
version 1.3, 2001/03/22 05:18:30 |
|
|
|
|
int dfn_counter; |
int dfn_counter; |
|
|
|
void |
dfn_init() |
dfn_init() |
{ |
{ |
|
|
|
|
/* |
/* |
* given this parent, depth first number its children. |
* given this parent, depth first number its children. |
*/ |
*/ |
|
void |
dfn( parentp ) |
dfn( parentp ) |
nltype *parentp; |
nltype *parentp; |
{ |
{ |
|
|
/* |
/* |
* push a parent onto the stack and mark it busy |
* push a parent onto the stack and mark it busy |
*/ |
*/ |
|
void |
dfn_pre_visit( parentp ) |
dfn_pre_visit( parentp ) |
nltype *parentp; |
nltype *parentp; |
{ |
{ |
|
|
dfn_depth += 1; |
dfn_depth += 1; |
if ( dfn_depth >= DFN_DEPTH ) { |
if ( dfn_depth >= DFN_DEPTH ) |
fprintf( stderr , "[dfn] out of my depth (dfn_stack overflow)\n" ); |
errx(1, "[dfn] out of my depth (dfn_stack overflow)" ); |
exit( 1 ); |
|
} |
|
dfn_stack[ dfn_depth ].nlentryp = parentp; |
dfn_stack[ dfn_depth ].nlentryp = parentp; |
dfn_stack[ dfn_depth ].cycletop = dfn_depth; |
dfn_stack[ dfn_depth ].cycletop = dfn_depth; |
parentp -> toporder = DFN_BUSY; |
parentp -> toporder = DFN_BUSY; |
|
|
/* |
/* |
* MISSING: an explanation |
* MISSING: an explanation |
*/ |
*/ |
|
void |
dfn_findcycle( childp ) |
dfn_findcycle( childp ) |
nltype *childp; |
nltype *childp; |
{ |
{ |
|
|
break; |
break; |
} |
} |
} |
} |
if ( cycletop <= 0 ) { |
if ( cycletop <= 0 ) |
fprintf( stderr , "[dfn_findcycle] couldn't find head of cycle\n" ); |
errx( 1, "[dfn_findcycle] couldn't find head of cycle"); |
exit( 1 ); |
|
} |
|
# ifdef DEBUG |
# ifdef DEBUG |
if ( debug & DFNDEBUG ) { |
if ( debug & DFNDEBUG ) { |
printf( "[dfn_findcycle] dfn_depth %d cycletop %d " , |
printf( "[dfn_findcycle] dfn_depth %d cycletop %d " , |
|
|
} |
} |
# endif DEBUG |
# endif DEBUG |
} |
} |
} else if ( childp -> cyclehead != cycleheadp /* firewall */ ) { |
} else if ( childp -> cyclehead != cycleheadp /* firewall */ ) |
fprintf( stderr , |
warnx("[dfn_busy] glommed, but not to cyclehead"); |
"[dfn_busy] glommed, but not to cyclehead\n" ); |
|
} |
|
} |
} |
} |
} |
} |
} |
|
|
* deal with self-cycles |
* deal with self-cycles |
* for lint: ARGSUSED |
* for lint: ARGSUSED |
*/ |
*/ |
|
void |
dfn_self_cycle( parentp ) |
dfn_self_cycle( parentp ) |
nltype *parentp; |
nltype *parentp; |
{ |
{ |
|
|
* [MISSING: an explanation] |
* [MISSING: an explanation] |
* and pop it off the stack |
* and pop it off the stack |
*/ |
*/ |
|
void |
dfn_post_visit( parentp ) |
dfn_post_visit( parentp ) |
nltype *parentp; |
nltype *parentp; |
{ |
{ |