projects
/
henge
/
apc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8b56606
)
fixed tree printing for real
author
ken
<ken@mihrtec.com>
Fri, 20 Jan 2017 05:48:33 +0000
(21:48 -0800)
committer
ken
<ken@mihrtec.com>
Fri, 20 Jan 2017 05:48:33 +0000
(21:48 -0800)
src/ir.c
patch
|
blob
|
history
diff --git
a/src/ir.c
b/src/ir.c
index
0e95d7f
..
ab97305
100644
(file)
--- a/
src/ir.c
+++ b/
src/ir.c
@@
-101,7
+101,7
@@
struct ir_class_t
uint8_t* name;
\r
};
\r
struct ir_set_t
\r
uint8_t* name;
\r
};
\r
struct ir_set_t
\r
-{ struct ir_set_t* nextchild, * nextsib;
\r
+{ struct ir_set_t* nextchild, * nextsib
, * p
;
\r
uint32_t ref;
\r
uint8_t* name;
\r
struct ir_framebox_t* frameboxes;
\r
uint32_t ref;
\r
uint8_t* name;
\r
struct ir_framebox_t* frameboxes;
\r
@@
-672,8
+672,7
@@
void ir_test(void)
static
\r
void crawl_class
\r
( struct ir_class_t* class )
\r
static
\r
void crawl_class
\r
( struct ir_class_t* class )
\r
-{ struct ir_class_t* iter;
\r
- wprintf("%U/\n", class->name);
\r
+{ wprintf("%U/\n", class->name);
\r
if(chdir((char*)class->name))
\r
eprintf("CHDIR %U from %s\n",class->name,getcwd(NULL,255));
\r
if (class->nextchild != NULL)
\r
if(chdir((char*)class->name))
\r
eprintf("CHDIR %U from %s\n",class->name,getcwd(NULL,255));
\r
if (class->nextchild != NULL)
\r
@@
-683,12
+682,11
@@
void crawl_class
if (class->nextsib != NULL)
\r
{ if (chdir(".."))
\r
eprintf("CHDIR ..\n");
\r
if (class->nextsib != NULL)
\r
{ if (chdir(".."))
\r
eprintf("CHDIR ..\n");
\r
- for (iter = class->nextsib; iter != NULL; iter = iter->nextsib)
\r
- crawl_class(iter);
\r
+ crawl_class(class->nextsib);
\r
if(chdir((char*)class->name))
\r
eprintf("CHDIR %U from %s\n",class->name,getcwd(NULL,255));
\r
}
\r
if(chdir((char*)class->name))
\r
eprintf("CHDIR %U from %s\n",class->name,getcwd(NULL,255));
\r
}
\r
- uprintf("
\n
%U\\\n",class->name);
\r
+ uprintf("%U\\\n",class->name);
\r
if (chdir(".."))
\r
eprintf("CHDIR ..\n");
\r
}
\r
if (chdir(".."))
\r
eprintf("CHDIR ..\n");
\r
}
\r
@@
-698,18
+696,21
@@
void crawl_set
( struct ir_set_t* set,
\r
int depth
\r
)
\r
( struct ir_set_t* set,
\r
int depth
\r
)
\r
-{ struct ir_set_t* iter;
\r
+{ struct ir_set_t* iter
, * last
;
\r
int i;
\r
int i;
\r
- pspace(depth * 10);
\r
- i = 0;
\r
- for(iter = set; iter != NULL; iter = iter->nextchild, ++i)
\r
- uprintf("[%8U]", iter->name);
\r
- if (i)
\r
- putchar('\n');
\r
- i = 0;
\r
- for(iter = set->nextchild; iter != NULL; iter = iter->nextchild)
\r
+ pspace(depth * 12);
\r
+ last = NULL;
\r
+ i = depth;
\r
+ for(iter = set; iter != NULL; iter = iter->nextchild)
\r
+ { uprintf("[%10U]", iter->name);
\r
+ if (last != NULL)
\r
+ iter->p = last;
\r
+ last = iter;
\r
+ i++;
\r
+ }
\r
+ --i;
\r
+ putchar('\n');
\r
+ for(iter = last; iter != NULL; iter = iter->p, --i)
\r
if (iter->nextsib != NULL)
\r
if (iter->nextsib != NULL)
\r
- crawl_set(iter->nextsib, ++i);
\r
- for(iter = set->nextsib; iter != NULL; iter = iter->nextsib)
\r
- crawl_set(iter, depth);
\r
+ crawl_set(iter->nextsib,i);
\r
}
\r
}
\r