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:
2ca6f20
)
bug fixes, treewalk printing of classes/sets
author
ken
<ken@mihrtec.com>
Fri, 20 Jan 2017 03:29:42 +0000
(19:29 -0800)
committer
ken
<ken@mihrtec.com>
Fri, 20 Jan 2017 03:29:42 +0000
(19:29 -0800)
src/ir.c
patch
|
blob
|
history
diff --git
a/src/ir.c
b/src/ir.c
index
e88ac36
..
0e95d7f
100644
(file)
--- a/
src/ir.c
+++ b/
src/ir.c
@@
-632,7
+632,7
@@
uint8_t* name_alloc
copy:
\r
name = (uint8_t*)namepages.head->header.head;
\r
iter = name_src;
\r
copy:
\r
name = (uint8_t*)namepages.head->header.head;
\r
iter = name_src;
\r
- for (head_mem = PL_HEADMEM(namepages); *iter && *iter != '_' && head_mem; head_mem--)
\r
+ for (head_mem = PL_HEADMEM(namepages); *iter && *iter != '_' &&
*iter != '.' &&
head_mem; head_mem--)
\r
*(namepages.head->header.head)++ = *iter++;
\r
if (head_mem < 1) //not enough room
\r
{ pagelist_alloc(namepages);
\r
*(namepages.head->header.head)++ = *iter++;
\r
if (head_mem < 1) //not enough room
\r
{ pagelist_alloc(namepages);
\r
@@
-661,36
+661,36
@@
uint8_t* classname_alloc
return name;
\r
}
\r
\r
return name;
\r
}
\r
\r
-static void crawl_class(struct ir_class_t*
,int
);
\r
+static void crawl_class(struct ir_class_t*);
\r
static void crawl_set(struct ir_set_t*,int);
\r
void ir_test(void)
\r
{ uprintf("IR From Directory: %s\n",getcwd(NULL,255));
\r
static void crawl_set(struct ir_set_t*,int);
\r
void ir_test(void)
\r
{ uprintf("IR From Directory: %s\n",getcwd(NULL,255));
\r
- crawl_class(&root_class
,0
);
\r
+ crawl_class(&root_class);
\r
}
\r
\r
}
\r
\r
-#define pspace(num) for (i = 0; i < (num); i++) putchar('
')
\r
+#define pspace(num) for (i = 0; i < (num); i++) putchar('
.
')
\r
static
\r
void crawl_class
\r
static
\r
void crawl_class
\r
-( struct ir_class_t* class,
\r
- int depth
\r
-)
\r
+( struct ir_class_t* class )
\r
{ struct ir_class_t* iter;
\r
{ struct ir_class_t* iter;
\r
- /*if(chdir((char*)class->name))
\r
- eprintf("CHDIR %U\n",class->name);
\r
- else
\r
- wprintf("chdir %U\n",class->name);*/
\r
- if (class->nextchild != NULL)
\r
- { iter = class->nextchild;
\r
- do {
\r
- crawl_class(iter,depth + 1);
\r
- /*if (chdir(".."))
\r
- eprintf("CHDIR ..\n");*/
\r
- } while ((iter = iter->nextsib) != NULL);
\r
- }
\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
+ crawl_class(class->nextchild);
\r
if (class->root_set != NULL)
\r
if (class->root_set != NULL)
\r
- crawl_set(class->root_set,0);
\r
+ crawl_set(class->root_set, 0);
\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
+ 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("\n%U\\\n",class->name);
\r
+ if (chdir(".."))
\r
+ eprintf("CHDIR ..\n");
\r
}
\r
\r
static
\r
}
\r
\r
static
\r
@@
-699,18
+699,17
@@
void crawl_set
int depth
\r
)
\r
{ struct ir_set_t* iter;
\r
int depth
\r
)
\r
{ struct ir_set_t* iter;
\r
- int i = depth * 10;
\r
- pspace(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
i = 0;
\r
for(iter = set->nextchild; iter != NULL; iter = iter->nextchild)
\r
- { uprintf("[%8U]", iter->name);
\r
- }
\r
- for(iter = set->nextchild; iter != NULL; iter = iter->nextchild)
\r
- { if (iter->nextsib != NULL)
\r
- crawl_set(iter->nextsib, i);
\r
- i++;
\r
- }
\r
- for(iter = set->nextchild; iter != NULL; iter = iter->nextchild)
\r
- crawl_set(iter, depth + 1);
\r
- putchar('\n');
\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
}
\r
}
\r