version 1.29, 2000/11/24 14:36:35 |
version 1.30, 2001/03/02 16:57:26 |
|
|
#ifdef CLEANUP |
#ifdef CLEANUP |
static LIST allGNs; /* List of all the GNodes */ |
static LIST allGNs; /* List of all the GNodes */ |
#endif |
#endif |
static struct hash targets; /* a hash table of same */ |
static struct ohash targets; /* a hash table of same */ |
static struct hash_info gnode_info = { |
static struct ohash_info gnode_info = { |
offsetof(GNode, name), |
offsetof(GNode, name), |
NULL, hash_alloc, hash_free, element_alloc }; |
NULL, hash_alloc, hash_free, element_alloc }; |
|
|
|
|
Lst_Init(&allGNs); |
Lst_Init(&allGNs); |
#endif |
#endif |
/* A small make file already creates 200 targets. */ |
/* A small make file already creates 200 targets. */ |
hash_init(&targets, 10, &gnode_info); |
ohash_init(&targets, 10, &gnode_info); |
} |
} |
|
|
/*- |
/*- |
|
|
{ |
{ |
#ifdef CLEANUP |
#ifdef CLEANUP |
Lst_Destroy(&allGNs, TargFreeGN); |
Lst_Destroy(&allGNs, TargFreeGN); |
hash_delete(&targets); |
ohash_delete(&targets); |
#endif |
#endif |
} |
} |
|
|
|
|
{ |
{ |
GNode *gn; |
GNode *gn; |
|
|
gn = hash_create_entry(&gnode_info, name, &end); |
gn = ohash_create_entry(&gnode_info, name, &end); |
gn->path = NULL; |
gn->path = NULL; |
if (name[0] == '-' && name[1] == 'l') { |
if (name[0] == '-' && name[1] == 'l') { |
gn->type = OP_LIB; |
gn->type = OP_LIB; |
|
|
GNode *gn; /* node in that element */ |
GNode *gn; /* node in that element */ |
unsigned int slot; |
unsigned int slot; |
|
|
slot = hash_qlookupi(&targets, name, &end); |
slot = ohash_qlookupi(&targets, name, &end); |
|
|
gn = hash_find(&targets, slot); |
gn = ohash_find(&targets, slot); |
|
|
if (gn == NULL && (flags & TARG_CREATE)) { |
if (gn == NULL && (flags & TARG_CREATE)) { |
gn = Targ_NewGN(name, end); |
gn = Targ_NewGN(name, end); |
hash_insert(&targets, slot, gn); |
ohash_insert(&targets, slot, gn); |
} |
} |
|
|
return gn; |
return gn; |
|
|
unsigned int i; |
unsigned int i; |
|
|
printf("#*** Input graph:\n"); |
printf("#*** Input graph:\n"); |
for (gn = hash_first(&targets, &i); gn != NULL; |
for (gn = ohash_first(&targets, &i); gn != NULL; |
gn = hash_next(&targets, &i)) |
gn = ohash_next(&targets, &i)) |
TargPrintNode(gn, pass); |
TargPrintNode(gn, pass); |
printf("\n\n"); |
printf("\n\n"); |
printf("#\n# Files that are only sources:\n"); |
printf("#\n# Files that are only sources:\n"); |
for (gn = hash_first(&targets, &i); gn != NULL; |
for (gn = ohash_first(&targets, &i); gn != NULL; |
gn = hash_next(&targets, &i)) |
gn = ohash_next(&targets, &i)) |
TargPrintOnlySrc(gn); |
TargPrintOnlySrc(gn); |
printf("#*** Global Variables:\n"); |
printf("#*** Global Variables:\n"); |
Var_Dump(VAR_GLOBAL); |
Var_Dump(VAR_GLOBAL); |