prettier printing
This commit is contained in:
parent
41f05b9556
commit
38b044921f
17
main.c
17
main.c
|
@ -764,24 +764,25 @@ static void display(struct uns_ctr *ctr)
|
|||
tmp.p = gc.record_get_ptr(ctr->p, 1);
|
||||
display(&tmp);
|
||||
|
||||
tmp.p = gc.record_get_ptr(ctr->p, 2);
|
||||
switch (get_type(tmp.p)) {
|
||||
case EMPTY_LIST:
|
||||
printf(")");
|
||||
goto remove;
|
||||
case CELL:
|
||||
ctr->p = gc.record_get_ptr(ctr->p, 2);
|
||||
while (get_type(ctr->p) == CELL) {
|
||||
printf(" ");
|
||||
tmp.p = gc.record_get_ptr(ctr->p, 1);
|
||||
display(&tmp);
|
||||
ctr->p = gc.record_get_ptr(ctr->p, 2);
|
||||
}
|
||||
|
||||
switch (get_type(ctr->p)) {
|
||||
case EMPTY_LIST:
|
||||
printf(")");
|
||||
break;
|
||||
default:
|
||||
printf(" . ");
|
||||
display(&tmp);
|
||||
display(ctr);
|
||||
printf(")");
|
||||
break;
|
||||
}
|
||||
|
||||
remove:
|
||||
uns_root_remove(&gc, &tmp);
|
||||
return;
|
||||
case INTEGER:
|
||||
|
|
Reference in New Issue