X-Git-Url: https://www.kengrimes.com/gitweb/?p=henge%2Fapc.git;a=blobdiff_plain;f=src%2Fir.c;h=63556545b04c6494fb53ae974372fd8b1aa7ecd1;hp=d0abf1fffbceb7ecad46e66260f038f7dbb042b4;hb=2d355679ac2a1e225f158ab8064566174e9e1402;hpb=10757d8de188be16a6d805c074ddff27e63f5b89 diff --git a/src/ir.c b/src/ir.c index d0abf1f..6355654 100644 --- a/src/ir.c +++ b/src/ir.c @@ -666,9 +666,10 @@ static void crawl_set(struct ir_set_t*,int); void ir_test(void) { uprintf("IR From Directory: %s\n",getcwd(NULL,255)); crawl_class(&root_class); + if (root_class.root_set != NULL) + crawl_set(root_class.root_set, 0); } -#define pspace(num) for (i = 0; i < (num); i++) putchar('.') static void crawl_class ( struct ir_class_t* class ) @@ -686,24 +687,26 @@ void crawl_class } } +#define push_setp(setp) (*(struct ir_set_t**)stack_alloc(sizeof(struct ir_set_t*)) = setp) +#define pop_setp() (*(struct ir_set_t**)pagelist_pop(&datapages, sizeof(struct ir_set_t*))) static void crawl_set ( struct ir_set_t* set, int depth ) -{ struct ir_set_t* setlist[64], ** slp, * iter; +{ struct ir_set_t* iter; int i; - pspace(depth * 12); + i = depth * 12; + while (i--) + putchar('.'); i = depth; - slp = setlist; for(iter = set; iter != NULL; iter = iter->nextchild) { uprintf("[%10U]", iter->name); - *slp++ = iter; + push_setp(iter); i++; } - --i; putchar('\n'); - for(iter = *--slp; slp >= setlist; iter = *--slp, --i) - if (iter->nextsib != NULL) + while (--i >= depth) + if (((iter = pop_setp())->nextsib) != NULL) crawl_set(iter->nextsib,i); }