File: view.scm

package info (click to toggle)
jacal 1b7-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 808 kB
  • ctags: 884
  • sloc: lisp: 5,842; makefile: 316; sh: 104
file content (71 lines) | stat: -rw-r--r-- 2,542 bytes parent folder | download
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
;; JACAL: Symbolic Mathematics System.        -*-scheme-*-
;; Copyright 1989, 1990, 1991, 1992, 1993, 1997 Aubrey Jaffer.
;;
;; 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.


;;; See Template.scm in the Scheme Library for how to set up
;;; vicinities and require.

(require 'with-file)

;(slib:load (in-vicinity (program-vicinity) "scl"))
			;Common Lisp/Scheme compatability definitions.
;(slib:load (in-vicinity (program-vicinity) "toploads"))

(slib:load (in-vicinity (program-vicinity) "grammar"))

(define page-height #f)
(define page-width #f)
(define *input-grammar* (get-grammar 'scheme))
			;grammar to use if none is loaded.
(define *output-grammar* (get-grammar 'scheme))
			;grammar to use if none is loaded.
(define *echo-grammar* (get-grammar 'null))

(slib:load (in-vicinity (library-vicinity) "prec"))
;;(prec:trace)
(slib:load (in-vicinity (program-vicinity) "unparse"))
(slib:load (in-vicinity (program-vicinity) "English"))

(define *input-grammar* (get-grammar 'standard)) ;tex

(define (view . file)
  (define obj #f)
  (define math:prompt ":")
  ((lambda (doit)
     (cond ((not (null? file)) (with-input-from-file (car file) doit))
	   (else (doit))))
   (lambda ()
     (define cip (current-input-port))
     (let loop ()
       (cond ((output-port? cip)
	      (display math:prompt cip)
	      (force-output cip)
	      (tok:bump-column (string-length math:prompt) cip))
	     (else (display math:prompt)
		   (force-output)
		   (tok:bump-column (string-length math:prompt) cip)))
       (set! obj (read-sexp *input-grammar*))
       (tok:bump-column 0 cip)
       (cond ((and (null? file) (not obj)))
	     ((eof-object? obj))
	     ((not obj) (display "got #f") (newline))
	     (else (write-sexp obj *output-grammar*)
		   (newline)
		   (loop)))))))
;;(pretty-print (grammar-read-tab *input-grammar*))
(view)
;; scm -ip1 -lmath -e(batch"demo")