Print results individually, on separate lines, rather than as a list.

This commit is contained in:
Jesse D. McDonald 2009-11-14 19:13:16 -06:00
parent c1ac1323bf
commit 88ebc7ca77
3 changed files with 45 additions and 39 deletions

View File

@ -12,7 +12,7 @@ endif
all: rosella all: rosella
.PHONY: all clean .PHONY: all clean
ifneq ($(PROFILE),no) ifeq ($(PROFILE),yes)
CFLAGS += -fprofile-generate CFLAGS += -fprofile-generate
LDFLAGS += -fprofile-generate LDFLAGS += -fprofile-generate
endif endif

View File

@ -1,23 +1,23 @@
#S(#="lambda" #S(#="lambda"
#( #(
#S(#="template" #S(#="template" ; g1
#( #(
#0=#S(#="lambda" #0=#S(#="lambda" ; g1
#( #(
#S(#="lambda" #S(#="lambda" ; g1
#(1 #f) #(1 #f) ; g1 g2
#() #1=#()
1 1 ; f0
"\x02\x80\x01\x00"; (set! f0 (cons g1 nil)) "\x02\x80\x01\x00"; (set! f0 (cons g1 nil))
0xfe 0xfe ; k
0x80 0x80 ; f0
0x02 0x02 ; g2 (#f)
0xff 0xff ; ctx
) )
#S(#="template" #S(#="template"
#( #(
#=0 #=0 ; g1
#S(#="template" #S(#="template" ; g2
#(#f) #(#f)
"\x40\xff\xfe" ; i0 ctx k "\x40\xff\xfe" ; i0 ctx k
1 1
@ -29,49 +29,48 @@
0x01 ; g1 0x01 ; g1
0x41 ; i1 0x41 ; i1
) )
1 1 ; g3
) )
"\x80" ; f0 "\x80" ; f0
2 2 ; f0-f1
"\x09\x80\x40\x03\; (set! f0 (fix- i0 g3)) "\x09\x80\x40\x03\; (set! f0 (fix- i0 g3))
\x02\x80\x80\x00\; (set! f0 (cons f0 nil)) \x02\x80\x80\x00\; (set! f0 (cons f0 nil))
\x00\x81\x1b\x02"; (set! f1 (lambda g2)) \x00\x81\x1b\x02"; (set! f1 (lambda g2))
0x01 0x01 ; g1
0x80 0x80 ; f0
0x81 0x81 ; f1
0xff 0xff ; ctx
) )
1 1 ; g3
) )
#() #=1 ; #()
2 2
"\x00\x80\x03\xfd\; (set! f0 (car argv)) "\x00\x80\x03\xfd\; (set! f0 (car argv))
\x0d\x81\x80\x03\; (set! f1 (fix< f0 g3)) \x0d\x81\x80\x03\; (set! f1 (fix< f0 g3))
\x81\x81\x01\x02\; (set! f1 (if f1 g1 g2)) \x81\x81\x01\x02\; (set! f1 (if f1 g1 g2))
\x00\x81\x1b\x81"; (set! f1 (lambda f1)) \x00\x81\x1b\x81"; (set! f1 (lambda f1))
0x81 0x81 ; f1
0x00 0x00 ; nil
0xfe 0xfe ; k
0xff 0xff ; ctx
) )
#f
) )
"\xfe\xff" ; k ctx "\xfe\xff" ; k ctx
0 0
"" ""
0x01 0x01 ; f1
0xfd 0xfd ; argv
0x40 0x40 ; i0
0x41 0x41 ; i1
) )
#="string->number" #="string->number" ; g2
) )
#() #=1 ; #()
1 1 ; f0
"\x00\x80\x1b\x01"; (set! f0 (lambda g1)) "\x00\x80\x1b\x01"; (set! f0 (lambda g1))
0x02 0x02 ; g2
0xfd 0xfd ; argv
0x80 0x80 ; f0
0xff 0xff ; ctx
) )
; vim:set syntax= sw=2 expandtab: ; vim:set syntax= sw=2 expandtab:

View File

@ -51,6 +51,7 @@ int main(int argc, char **argv)
{ {
gc_root_t argv_root; gc_root_t argv_root;
value_t program; value_t program;
value_t results;
register_gc_root(&argv_root, NIL); register_gc_root(&argv_root, NIL);
@ -62,10 +63,16 @@ int main(int argc, char **argv)
} }
program = read_value(f); program = read_value(f);
print_value(run_interpreter(program, argv_root.value));
nl();
fclose(f); fclose(f);
unregister_gc_root(&argv_root); unregister_gc_root(&argv_root);
results = run_interpreter(program, argv_root.value);
for (value_t result = results; !is_nil(result); result = _CDR(result))
{
print_value(CAR(result));
nl();
}
} }
else else
{ {