altos/scheme: Add ports. Split scheme code up.
[fw/altos] / src / scheme / ao_scheme_port.scheme
1 ;
2 ; Copyright © 2018 Keith Packard <keithp@keithp.com>
3 ;
4 ; This program is free software; you can redistribute it and/or modify
5 ; it under the terms of the GNU General Public License as published by
6 ; the Free Software Foundation, either version 2 of the License, or
7 ; (at your option) any later version.
8 ;
9 ; This program is distributed in the hope that it will be useful, but
10 ; WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 ; General Public License for more details.
13 ;
14 ; port functions placed in ROM
15
16
17 (define newline
18   (lambda args
19     (if (null? args)
20         (write-char #\newline)
21         (write-char #\newline (car args))
22         )
23     )
24   )
25
26 (newline)
27 (newline (open-output-file "/dev/null"))
28
29 (define (load name)
30   (let ((p (open-input-file name))
31         (e))
32     (while (not (eof-object? (set! e (read p))))
33            (write (eval e)) (newline)
34            )
35     (close-port p)
36     )
37   )
38
39 (load "/dev/null")