#include "rules.h" extern int debug; AddDependant( pch_name, pch_target ) char *pch_name, *pch_target; { int pos; pos = _Lookup( pch_target ); if( debug ) printf("Found %s at pos %d\n", pch_target, pos ); arl_Rules[ pos ].apch_depend[ arl_Rules[ pos ].c_depend++ ] = pch_name; } char ** GetDependants( pch_target ) char *pch_target; { int pos; pos = _Lookup( pch_target ); return arl_Rules[ pos ].apch_depend; } AddAction( pch_action, pch_target ) char *pch_action, *pch_target; { int pos; pos = _Lookup( pch_target ); if( debug ) printf("Found %s at pos %d\n", pch_target, pos ); arl_Rules[ pos ].apch_action[ arl_Rules[ pos ].c_action++ ] = pch_action; } char ** GetActions( pch_target ) char *pch_target; { int pos; pos = _Lookup( pch_target ); return arl_Rules[ pos ].apch_action; } int n_Rules = 0; struct rule arl_Rules[ MAXRULES ]; _Lookup( pch_target ) char *pch_target; { int pos = 0; arl_Rules[ n_Rules ].pch_target = pch_target; arl_Rules[ n_Rules ].c_action = 0; arl_Rules[ n_Rules ].c_depend = 0; while( strcmp( arl_Rules[pos].pch_target , pch_target ) ) pos++; if ( pos == n_Rules ) n_Rules++; return pos; }