886aed2509ed4b8586cd2e36b172f7e981219517
[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 (eof-object? a)
30   (equal? a 'eof)
31   )
32
33 (define (load name)
34   (let ((p (open-input-file name))
35         (e))
36     (while (not (eof-object? (set! e (read p))))
37            (write (eval e)) (newline)
38            )
39     (close-port p)
40     )
41   )
42
43 (load "/dev/null")