-
Notifications
You must be signed in to change notification settings - Fork 24
/
lenin.sc
89 lines (73 loc) · 2.87 KB
/
lenin.sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
;;; LaHaShem HaAretz U'Mloah
;;; Stalin 0.11 - A global optimizing compiler for Scheme
;;; Copyright 1993, 1994, and 1995 University of Toronto. All rights reserved.
;;; Copyright 1996 Technion. All rights reserved.
;;; Copyright 1996 and 1997 University of Vermont. All rights reserved.
;;; Copyright 1997, 1998, 1999, 2000, and 2001 NEC Research Institute, Inc. All
;;; rights reserved.
;;; Copyright 2002, 2003, 2004, 2005, and 2006 Purdue University. All rights
;;; reserved.
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License
;;; as published by the Free Software Foundation; either version 2
;;; of the License, or (at your option) any later version.
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; written by:
;;; Jeffrey Mark Siskind
;;; School of Electrical and Computer Engineering
;;; Purdue University
;;; Electrical Engineering Building, Room 330
;;; 465 Northwestern Avenue
;;; West Lafayette IN 47907-2035 USA
;;; voice: 765/496-3197
;;; fax: 765/494-6440
;;; http://www.ece.purdue.edu/~qobi
(include "QobiScheme")
;;; GENSYM
(define (gensym string) (string->uninterned-symbol (string-copy string)))
(define (no-cursor) #f)
(define (no-version) #f)
(define (notify format-string . args)
;; conventions: FORMAT-STRING ARGS
(let ((string (apply format #f format-string args)))
(display string)
(newline)))
(define (split-into-lines s)
;; conventions: S
(let loop ((characters (string->list s)) (lines '("")))
;; conventions: CHARACTERS LINES
(cond ((null? characters) (reverse lines))
((char=? (first characters) #\newline)
(loop (rest characters) (cons "" lines)))
(else (loop (rest characters)
(cons (string-append (first lines)
(string (first characters)))
(rest lines)))))))
(define (notify-pp format-string . args)
;; conventions: FORMAT-STRING ARGS
(let ((pretty? (write-pretty)))
;; conventions: PRETTY?
(set-write-pretty! #t)
(apply format #t format-string args)
(set-write-pretty! pretty?))
(newline))
(define (notify-pp3 format-string . args)
;; conventions: FORMAT-STRING ARGS
(let ((level (write-level))
(pretty? (write-pretty)))
;; conventions: LEVEL PRETTY?
(set-write-level! 3)
(set-write-pretty! #t)
(apply format #t format-string args)
(set-write-level! level)
(set-write-pretty! pretty?))
(newline))
(define (terminate) (exit -1))
;;; Tam V'Nishlam Shevah L'El Borei Olam