diff options
| author | Keith Packard <keithp@keithp.com> | 2018-01-06 17:29:10 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2018-01-06 17:31:43 -0800 | 
| commit | 16061947d4376b41e596d87f97ec53ec29d17644 (patch) | |
| tree | f7ad08f8810b0ea78cf282048eacb46d441a2ee1 /src/scheme/tiny-test/ao_scheme_test.c | |
| parent | 39df849f0717d92a7d5bdf8aa5904bd4db1b467f (diff) | |
altos/scheme: Add ports. Split scheme code up.
And lots of other changes, including freeing unreferenced atoms.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/scheme/tiny-test/ao_scheme_test.c')
| -rw-r--r-- | src/scheme/tiny-test/ao_scheme_test.c | 35 | 
1 files changed, 5 insertions, 30 deletions
| diff --git a/src/scheme/tiny-test/ao_scheme_test.c b/src/scheme/tiny-test/ao_scheme_test.c index 45068369..89b8e5fa 100644 --- a/src/scheme/tiny-test/ao_scheme_test.c +++ b/src/scheme/tiny-test/ao_scheme_test.c @@ -15,9 +15,6 @@  #include "ao_scheme.h"  #include <stdio.h> -static FILE *ao_scheme_file; -static int newline = 1; -  static char save_file[] = "scheme.image";  int @@ -70,42 +67,20 @@ ao_scheme_os_restore(void)  }  int -ao_scheme_getc(void) -{ -	int c; - -	if (ao_scheme_file) -		return getc(ao_scheme_file); - -	if (newline) { -		if (ao_scheme_read_list) -			printf("+ "); -		else -			printf("> "); -		newline = 0; -	} -	c = getchar(); -	if (c == '\n') -		newline = 1; -	return c; -} - -int  main (int argc, char **argv)  {  	(void) argc;  	while (*++argv) { -		ao_scheme_file = fopen(*argv, "r"); -		if (!ao_scheme_file) { +		FILE *in = fopen(*argv, "r"); +		if (!in) {  			perror(*argv);  			exit(1);  		} -		ao_scheme_read_eval_print(); -		fclose(ao_scheme_file); -		ao_scheme_file = NULL; +		ao_scheme_read_eval_print(in, stdout, false); +		fclose(in);  	} -	ao_scheme_read_eval_print(); +	ao_scheme_read_eval_print(stdin, stdout, true);  #ifdef DBG_MEM_STATS  	printf ("collects: full: %lu incremental %lu\n", | 
