@@ -497,17 +497,17 @@ object* splice_match(pvm* vm, object* cookie, object* inst_type) {
497
497
namespace dumper {
498
498
499
499
static void make_refs_list (pvm* vm, object* obj, object** alist) {
500
- again:
501
- if (obj == NULL || (obj->type != &cons_type && obj->type != &obj_type)) return ;
502
- object* entry = assoc (*alist, obj);
503
- if (entry) {
504
- cdr (entry) = vm->integer (2 );
505
- return ;
500
+ for (;;) {
501
+ if (obj == NULL || (obj->type != &cons_type && obj->type != &obj_type)) return ;
502
+ object* entry = assoc (*alist, obj);
503
+ if (entry) {
504
+ cdr (entry) = vm->integer (2 );
505
+ return ;
506
+ }
507
+ vm->push (vm->cons (obj, vm->integer (1 )), *alist);
508
+ if (obj->type != &obj_type) make_refs_list (vm, car (obj), alist); // hashmaps are guaranteed non disjoint, i guess
509
+ obj = cdr (obj);
506
510
}
507
- vm->push (vm->cons (obj, vm->integer (1 )), *alist);
508
- if (obj->type != &obj_type) make_refs_list (vm, car (obj), alist); // hashmaps are guaranteed non disjoint, i guess
509
- obj = cdr (obj);
510
- goto again;
511
511
}
512
512
513
513
// returns zero if the object doesn't need a #N# marker
@@ -535,8 +535,7 @@ static int64_t reffed(pvm* vm, object* obj, object* alist, int64_t* counter) {
535
535
static void print_with_refs (pvm*, object*, object*, int64_t *);
536
536
537
537
static void print_hashmap (pvm* vm, object* node, object* alist, int64_t * counter) {
538
- recur:
539
- if (node) {
538
+ while (node) {
540
539
if (car (node)) {
541
540
object* hinfo = car (node);
542
541
print_with_refs (vm, cadr (hinfo), alist, counter);
@@ -547,7 +546,6 @@ static void print_hashmap(pvm* vm, object* node, object* alist, int64_t* counter
547
546
if (!cdr (node)) return ;
548
547
print_hashmap (vm, cadr (node), alist, counter);
549
548
node = cddr (node);
550
- goto recur;
551
549
}
552
550
}
553
551
@@ -570,15 +568,12 @@ static void print_with_refs(pvm* vm, object* obj, object* alist, int64_t* counte
570
568
putchar (' "' );
571
569
for (char * c = obj->as_chars ; *c; c++) {
572
570
char e = parser::escape (*c);
573
- if (e != *c) {
574
- putchar (' \\ ' );
575
- putchar (e);
576
- }
577
- else putchar (*c);
571
+ if (e != *c) putchar (' \\ ' );
572
+ putchar (e);
578
573
}
579
574
putchar (' "' );
580
575
}
581
- PRINTTYPE (&symbol_type, as_chars, strpbrk (obj->as_chars , " (){}[] " ) ? " #|%s|" : " ' %s" );
576
+ PRINTTYPE (&symbol_type, as_chars, strpbrk (obj->as_chars , " (){}[] " ) ? " #|%s|" : " : %s" );
582
577
PRINTTYPE (&integer_type, as_big_int, " %" PRId64);
583
578
PRINTTYPE (&float_type, as_double, " %lg" );
584
579
PRINTTYPE (&c_function_type, as_ptr, " <function %p>" );
@@ -622,7 +617,7 @@ static void print_with_refs(pvm* vm, object* obj, object* alist, int64_t* counte
622
617
print_hashmap (vm, cdr (obj), alist, counter);
623
618
putchar (' }' );
624
619
}
625
- else printf (" <%s:%p>" , obj->type ->name , obj->as_ptr );
620
+ else printf (" <%s: %p>" , obj->type ->name , obj->as_ptr );
626
621
}
627
622
628
623
}
0 commit comments