home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk1.iso
/
altsrc
/
articles
/
11157
< prev
next >
Wrap
Lisp/Scheme
|
1994-08-23
|
25KB
|
801 lines
Path: wupost!uhog.mit.edu!news.kei.com!travelers.mail.cornell.edu!newstand.syr.edu!galileo.cc.rochester.edu!ceas.rochester.edu!ceas.rochester.edu!not-for-mail
From: weisberg@kirchoff.ee.rochester.edu (Jeff Weisberg)
Newsgroups: alt.sources
Subject: jlisp interpreter part02 / 10
Followup-To: alt.sources.d
Date: 23 Aug 1994 11:07:28 -0400
Organization: University of Rochester School of Engineering and Applied Science
Lines: 788
Message-ID: <Jlisp94Aug23part02@ee.rochester.edu>
References: <Jlisp94Aug23Notice@ee.rochester.edu>
NNTP-Posting-Host: kirchoff.ee.rochester.edu
Archive-name: jlisp-1.03
Submitted-by: weisberg@ee.rochester.edu
#! /bin/sh
# 0. this is shell archive
# 1. Remove everything above the #! /bin/sh line
# 2. Save the resulting text in a file
# 3. Execute the file with /bin/sh (not csh)
# 4. Or use your favorite variant of unshar
# 5. To overwrite existing files use "sh -c"
#
# Created by: weisberg@ankara on Tue Aug 23 10:50:47 EDT 1994
#
# This is part 02
if test -f jlisp-1.03/lisp/init.cf.jl -a "$1" != "-c" ; then
echo "will not overwrite jlisp-1.03/lisp/init.cf.jl"
else
echo " x - jlisp-1.03/lisp/init.cf.jl (5406 bytes)"
sed 's/^X//' > jlisp-1.03/lisp/init.cf.jl << \CEST_TOUT
X
X;;;; Copyright (c) 1994 Jeff Weisberg
X;;;; see the file "License"
X
X;;;; $Id: init.cf.jl,v 1.16 94/08/23 07:19:15 weisberg Exp Locker: weisberg $
X
X(set! .hash_table_size 7) ; most often a small table will suffice
X ; this was determined empirically
X(set! .box_size 1024) ; allocate cells at a time
X(set! .gc_thresh (* .box_size 50)) ; keep threshhold high
X
X
X;;; yes, defun/defmac could possibly have been combound, but
X;;; it becomes an unreadable mess of `,`,',`',`',,`,```,,',,,
X
X;;; for space savings the docstr and defined-in-file props can be removed
X
X(define defun
X "(defun name args [docstr] body...) Define a Function"
X (macro (func argl &rest args)
X (let* ((docstr (car args))
X (body (cdr args)))
X (if (stringp docstr)
X #t
X (set! docstr "Not Documented")
X (set! body args))
X `(progn
X (define ,func ,docstr
X ,(cons lambda (cons argl body)))
X (set-props! ,func (cons
X (cons 'defined-in-file ,*current-file*)
X (get-props ',func)))
X ,func ; retval
X ))))
X
X(define defmac
X "(defmac name args [docstr] body...) Define a macro"
X (macro (func argl &rest args)
X (let* ((docstr (car args))
X (body (cdr args)))
X (if (stringp docstr)
X #t
X (set! docstr "Not Documented")
X (set! body args))
X `(progn
X (define ,func ,docstr
X ,(cons macro (cons argl body)))
X (set-props! ,func (cons
X (cons 'defined-in-file ,*current-file*)
X (get-props ',func)))
X ,func ; retval
X ))))
X
X(defmac defvar (sym val &optional doc)
X "(defvar var initvalue [docstring]) defines var as initvalue only if var is undefined"
X (if (definedp sym)
X `()
X `(define ,sym ,val ,doc)))
X
X(defun print argl
X "(print args...) print the args on stdout"
X (while (not (nullp argl))
X (display (car argl))
X (set! argl (cdr argl))))
X
X(defun newline (&optional port)
X "(newline [port]) output a newline [to a specified port]"
X (display ?\n port))
X
X(defvar load-path
X "load-path list of directories to search for lisp files"
X (list
X "%LOCALLISP%"
X "%LISPDIR%"
X "%ETCDIR%" ; start grasping at straws
X "%SRCDIR%/lisp"
X "%SRCDIR%/jlisp"
X "%SRCDIR%/lib" ))
X
X(defvar load-extensions
X "load-extensions list of extensions to try for lisp files"
X (list
X ".jl"
X ".jlisp"))
X
X(defvar *load:echo* #f) ; echo filenames as loaded
X(defvar *load:verbose* #f) ; echo each exp of the file as it is read
X
X(defvar *builtin-load* load)
X(defvar *current-file* "init")
X
X;;; redefine load, the builtin is just a minimal stub
X;;; this is a macro, as it must execute in the current env frame
X(defmac load (file)
X "(load file) load a file"
X (let* ((efn (eval file))
X (fp (cond
X ((inputportp efn) efn)
X ((stringp efn) (let ((foo ())
X bar
X baz
X (l (append '(()) load-path)) ; try as given first
X (e ()))
X ;; search for the file
X (while (and (nullp foo) (not (nullp l)))
X (set! bar (if (stringp (car l))
X (strcat (car l) "/" efn)
X efn))
X (set! e (append '(()) load-extensions)) ; as given first
X (while (and (nullp foo) (not (nullp e)))
X (set! baz (car e))
X ;; saved in file so we can access it later if need be
X (set! file (if (stringp baz)
X (strcat bar baz)
X bar))
X (set! foo (open:read file))
X (set! e (cdr e)))
X (set! l (cdr l)))
X foo))
X (#t
X (funcall error "load" efn "WTA: filename or port p")))))
X (if (nullp fp)
X (funcall error "load" efn "Could not open"))
X (if (or *load:echo*
X (and (definedp 'mritool) (debug-flag 1 1))) ; lisp, echo
X (progn (display "Loading: ") (display file) (display ?\n)))
X ;; the following will be executed in the calling env
X `(unwind-protect
X (progn
X (set! .lineno 1)
X (set! *current-file* ,file)
X (if (catch 'error ; catch any errors, handle below
X (catch 'eof
X (if (or *load:verbose*
X (and (definedp 'mritool) (debug-flag 1 0))) ; lisp, verbose
X (while #t
X (eval (let ((foo (read ,fp)))
X (display foo) (display ?\n)
X foo)))
X (while #t
X (eval (read ,fp)))))
X #f)
X ;; handle errors
X (print "\nERROR while loading \"" ,file "\" near line " .lineno ?\n))
X (close ,fp))
X (set! *current-file* ,*current-file*) ; restore filename
X (set! .lineno ,.lineno)))) ; restore lineno
X
X;; load more
X(load "debug.jl")
X(load "autoload.jl")
X(load "lib.jl")
X(load "math.jl")
X(load "pred.jl")
X(load "cmdline.jl")
X(load "repl.jl")
X(load "signal.jl")
X(load "unistd.jl")
X; uncomment the following 2 for more scheme-itivity
X(load "slib.jl")
X(load "r4rs.jl")
X; and one for some CL-isms
X(load "cl.jl")
X
X(autoload expand-filename "expand.jl" "expand ~ in filenames")
X(autoload roman "roman.jl" "return the roman numeral represenation of the number")
X(autoload bind "bind.jl" "bind function calls")
X(autoload format "format.jl" "formatted output")
X(autoload appropos "all-syms.jl" "what function? by keyword")
X(autoload time "time.jl" "how long does it take?")
X
X(if (definedp 'mritool)
X (progn
X (load "mritool.jl")
X (define mri:background #t) ; used internally by initliaztion in c code
X (define mri:windows #t) ; ditto
X (define mri:winsys 'x))) ; what window system are we using
X
X
CEST_TOUT
if test `wc -c < jlisp-1.03/lisp/init.cf.jl` -ne 5406 ; then
echo "file jlisp-1.03/lisp/init.cf.jl has been corrupted (should be 5406 bytes)"
fi
fi
if test -f jlisp-1.03/lisp/julia.jl -a "$1" != "-c" ; then
echo "will not overwrite jlisp-1.03/lisp/julia.jl"
else
echo " x - jlisp-1.03/lisp/julia.jl (720 bytes)"
sed 's/^X//' > jlisp-1.03/lisp/julia.jl << \CEST_TOUT
X
X
X(defmac with-output (out &rest body)
X (let ((*stdout_port* (eval out)))
X (display body *stderr_port*) (newline)
X (eval (cons progn body))))
X
X(defun julia (cx cy n)
X "(julia cx cy n) draw julia set"
X (let ((zx 0)
X (zy 0)
X x
X y
X s
X (i 0)
X (out (open:write "| graph -g0 -m0 -s | plot")))
X (while (!= i n)
X (set! zx (- zx cx))
X (set! zy (- zy cy))
X (set! s (sqrt (+ (* zx zx) (* zy zy))))
X (set! x (/ (+ s zx) 2.0))
X (set! y (/ (- s zx) 2.0))
X (if (< zy 0) (set! y (- y)))
X (set! zx x)
X (set! zy y)
X (if (> (random) 500000)
X (progn
X (set! zx (- zx))
X (set! zy (- zy))))
X (format out "~A~T~A~%" zx zy)
X (set! i (+ i 1)))
X (close out)))
X
X
X
X
X
CEST_TOUT
if test `wc -c < jlisp-1.03/lisp/julia.jl` -ne 720 ; then
echo "file jlisp-1.03/lisp/julia.jl has been corrupted (should be 720 bytes)"
fi
fi
if test -f jlisp-1.03/lisp/lib.jl -a "$1" != "-c" ; then
echo "will not overwrite jlisp-1.03/lisp/lib.jl"
else
echo " x - jlisp-1.03/lisp/lib.jl (4621 bytes)"
sed 's/^X//' > jlisp-1.03/lisp/lib.jl << \CEST_TOUT
X
X;;;; Copyright (c) 1994 Jeff Weisberg
X;;;; see the file "License"
X
X;;;; $Id: lib.jl,v 1.24 94/08/16 07:40:14 weisberg Exp Locker: weisberg $
X
X(defvar *unintered-symbol-maker-counter* 0)
X
X(defun cddr (x) "(cddr x) ..." (cdr (cdr x)))
X(defun caar (x) "(caar x) ..." (car (car x)))
X(defun cdar (x) "(cdar x) ..." (cdr (car x)))
X(defun cadr (x) "(cadr x) ..." (car (cdr x)))
X(defun cdddr (x) "(cdddr x) ..." (cdr (cddr x)))
X(defun caddr (x) "(caddr x) ..." (car (cddr x)))
X(defun cadddr (x) "(cadddr x) ..." (car (cdddr x)))
X
X(defun version ()
X "(version) What version are we using?"
X (display .version)
X (newline))
X
X(defmac docstr (s)
X "(docstr symbol) retreive the documentation from a symbol"
X (let* ((pl (if (definedp s)
X (get-props s)))
X (ds (if (listp pl)
X (assq '.docstring pl))))
X (if (consp ds)
X (cdr ds)
X "No documentation available")))
X
X(defun cat-file (file)
X "(cat-file file) cat a file to stdout"
X (system (strcat "cat " (expand-filename file))))
X
X(defun make-range (lo hi)
X "(make-range lo hi) return a list of numbers from lo to hi (inclusive)"
X (cond
X ((>= lo hi)
X (list hi))
X (#t
X (cons lo (make-range (+ lo 1) hi)))))
X
X(defmac define-with (name val pred prepr &optional doc)
X "(define-with name value predicate preproc [docstring])
X defines name as val and adds a few properties to the alist, for type safety
X [see also: sets!]"
X
X (if (definedp name)
X `(print ',name " already defined\n")
X `(progn
X (define ,name ,val ,doc)
X (set-props! ,name (acons 'predicate ,pred
X (acons 'preproc ,prepr
X (get-props ',name))))
X ())))
X
X
X(defmac sets! (name val)
X "(sets! name val) sets name to val, possibly with some type checking..."
X
X (if (ndefinedp name)
X `(error "sets!" ,name "not defined")
X (let* ((value (eval val))
X (pl (get-props name))
X (okp (assq 'predicate pl))
X (pp (assq 'preproc pl))
X (v (if (and pp (cdr pp) (nnullp (cdr pp)))
X ((cdr pp) value)
X value)))
X (if (or (not (and okp (cdr okp) (nnullp okp))) ((cdr okp) v))
X `(set! ,name ',v)
X `(error "sets!" ,val "bad value")))))
X
X
X; SAP p. 97
X(defun reverse (l)
X "(reverse list) reverse a list"
X (if (nconsp l)
X l
X (append (reverse (cdr l)) (list (car l)))))
X
X(defun 1+ (i)
X "(1+ i) return (+ 1 i)"
X (+ 1 i))
X
X(defun 1- (i)
X "(1- i) return (+ -1 i)"
X (+ -1 i))
X
X(defmac ++ (i)
X "(++ i) increment a number"
X `(progn
X (set! ,i (1+ ,i))
X ,i))
X
X(defmac -- (i)
X "(-- i) decrement a number"
X `(progn
X (set! ,i (1- ,i))
X ,i))
X
X(defun != (x y)
X "(!= a b) are they different?
X [see also: = < > <= >=]"
X (not (= x y)))
X
X(defun string->number (str &optional %input-radix%)
X "(string->number string [radix]) convert string to a number
X [see also: number->string]"
X (read (open:string str)))
X
X(defun number->string (n &optional %output-radix%)
X "(number->string number [radix]) convert number to a string
X [see also: string->number]"
X (let ((str (strcpy ""))
X (sp (open:string str)))
X (write n sp)
X str))
X
X(defun getline (&optional port)
X "(getline [port]) read in a line [from port] will return () on eof"
X (let ((s (strcpy ""))
X (e (eof-object))
X (c ()))
X (if (catch 'eof
X (while (not (or (eq c ?\n) (eq c e)))
X (set! c (getc port))
X (strappend! s c))) ; strings magically grow
X ()
X s)))
X
X(defun print-stderr argl
X "(print-stderr args...) print the args on stderr"
X (while (nnullp argl)
X (display (car argl) *stderr_port*)
X (set! argl (cdr argl))))
X
X(defun nop argl
X "(nop) does nothing")
X
X(defun acons (a b c)
X (cons (cons a b) c))
X
X(defun cons2 (a b c)
X (cons a (cons b c)))
X
X
X(defun memoize (fnc)
X (eval
X `(lambda (x)
X (let* ((memo '( () . () ) )
X (r (assv x memo)))
X (if r
X (cdr r)
X (let ((y (,fnc x)))
X ; (print "calculating\n")
X (append! memo (cons (cons x y) ()))
X y))))))
X
X
X(defun die (&optional message)
X "(die [message]) print out the message and exit
X [see also: quit _quit]"
X (if (boundp message)
X (print-stderr message ?\n))
X (quit 1))
X
X(defun output-of-shell-command->string (cmd)
X "(output-of-shell-command->string command) return the output of running the command
X much like using `command` in the shell"
X (let ((str (strcpy ""))
X (ln #t)
X (fp (open:read (strcat "|" cmd))))
X (while (nnullp (set! ln (getline fp)))
X (strappend! str ln))
X str))
X
X(defun unintered-symbol ()
X "(unintered-symbol) returns a unique unintered symbol"
X (++ *unintered-symbol-maker-counter*)
X (string->symbol (strcat "#<G-"
X (number->string *unintered-symbol-maker-counter* 36)
X ">")))
X
X
X
X
CEST_TOUT
if test `wc -c < jlisp-1.03/lisp/lib.jl` -ne 4621 ; then
echo "file jlisp-1.03/lisp/lib.jl has been corrupted (should be 4621 bytes)"
fi
fi
if test -f jlisp-1.03/lisp/math.jl -a "$1" != "-c" ; then
echo "will not overwrite jlisp-1.03/lisp/math.jl"
else
echo " x - jlisp-1.03/lisp/math.jl (2023 bytes)"
sed 's/^X//' > jlisp-1.03/lisp/math.jl << \CEST_TOUT
X
X;;;; Copyright (c) 1994 Jeff Weisberg
X;;;; see the file "License"
X
X;;;; $Id: math.jl,v 1.8 94/08/15 15:50:10 weisberg Exp Locker: weisberg $
X;; supplemental math routines/extensions
X
X(defvar $+$ +)
X(defvar $-$ -)
X(defvar $*$ *)
X(defvar $/$ /)
X
X;;; the builtins only handle 2 args
X;;; these will take any number of args
X
X(defun + argl
X (listop 0 $+$ argl))
X
X(defun * argl
X (listop 1 $*$ argl))
X
X(defun - argl
X (cond
X ((nullp argl) 0)
X ((nullp (cdr argl)) (- 0 (car argl)))
X (#t
X (listop (car argl) $-$ (cdr argl)))))
X
X(defun / argl
X (cond
X ((nullp argl) 1)
X ((nullp (cdr argl)) (/ 1 (car argl)))
X (#t
X (listop (car argl) $/$ (cdr argl)))))
X
X(defun listop (acc op argl)
X (while (nnullp argl)
X (set! acc (op acc (car argl)))
X (set! argl (cdr argl)))
X acc)
X
X(defun max argl
X (extreme > argl))
X
X(defun min argl
X (extreme < argl))
X
X(defun extreme (op argl)
X (if (nullp argl) ()
X (let ((a (car argl))
X (l (cdr argl)))
X (while (nnullp l)
X (set! a
X (if (op a (car l))
X a
X (car l)))
X (set! l (cdr l)))
X a)))
X
X(defun truncate (x)
X (if (< x 0)
X (- (floor (- x)))
X (floor x)))
X
X(defun round (x)
X (floor (+ x .5)))
X
X(defun gcd (a b)
X "(gcd a b) find the greatest common denominator"
X (cond ((zerop a) b)
X (#t (gcd (% b a) a))))
X
X(defun lcm (a b)
X "(lcm a b) find the least common multiple"
X (abs (/ (* a b) (gcd a b))))
X
X(defun quotient (a b)
X "(quotient a b) the integer division of a b"
X (truncate (/ a b)))
X
X
X;; the % operator is not garunteed to be either modulo or remainder
X;; so lets play ...
X
X(defun remainder (a b)
X "(remainder a b) the remainder of integer division (has the sign of a)"
X (% a (abs b))) ;; is this garunteed to be right?
X;; (- a (* b (quotient a b)))
X
X;;; note: I don't think I spelled "garunteed" correctly
X;;; but ispell was no help....
X
X(defun modulo (a b)
X "(modulo a b) the modulous of a b (has sign of b)"
X (let ((c (% a b)))
X (cond
X ((or (and (< b 0) (> c 0))
X (and (> b 0) (< c 0)))
X (+ c b))
X (#t c))))
X
X
CEST_TOUT
if test `wc -c < jlisp-1.03/lisp/math.jl` -ne 2023 ; then
echo "file jlisp-1.03/lisp/math.jl has been corrupted (should be 2023 bytes)"
fi
fi
if test -f jlisp-1.03/lisp/mouse.jl -a "$1" != "-c" ; then
echo "will not overwrite jlisp-1.03/lisp/mouse.jl"
else
echo " x - jlisp-1.03/lisp/mouse.jl (4226 bytes)"
sed 's/^X//' > jlisp-1.03/lisp/mouse.jl << \CEST_TOUT
X
X;;;; Copyright (c) 1994 Jeff Weisberg
X;;;; see the file "License"
X
X;;;; $Id: mouse.jl,v 1.4 94/08/16 16:30:06 weisberg Exp Locker: weisberg $
X
X;;; format of event is:
X;;; #(code flags shiftmask locx locy time action string)
X;;; see .../xview/win_input.h
X
X
X;;; some (possibly) useful defines
X;;; mostly from /usr/openwin/include/xview/win_input.h
X
X;;; event codes
X(define MS_LEFT 32563 )
X(define MS_MIDDLE 32564 )
X(define MS_RIGHT 32565 )
X(define LOC_DRAG 32515 )
X
X;;; shifmasks
X(define CAPSLOCK 0 ); /* Caps Lock key */
X(define CAPSMASK #x0001 )
X(define SHIFTLOCK 1 ); /* Shift Lock key */
X(define LEFTSHIFT 2 ); /* Left-hand shift key */
X(define RIGHTSHIFT 3 ); /* Right-hand shift key */
X(define SHIFTMASK #x000E )
X(define LEFTCTRL 4 ); /* Left-hand (or only) ctrl key */
X(define RIGHTCTRL 5 ); /* Right-hand control key */
X(define CTRLMASK #x0030 )
X
X(define META_SHIFT_MASK #x0040 )
X(define MS_LEFT_MASK #x0080 )
X(define MS_MIDDLE_MASK #x0100 )
X(define MS_RIGHT_MASK #x0200 )
X(define MS_BUTTON_MASK #x0380 )
X(define ALTMASK #x0400 )
X
X
X(define mouse:start-x () "x coord. of the first point on the contour")
X(define mouse:start-y () "y coord. of the first point on the contour")
X(define mouse:last-x () "x coord. of the most recent point on the contour")
X(define mouse:last-y () "y coord. of the most recent point on the contour")
X(define mouse:mode () "the current mouse mode")
X(define mouse:selected 0 "currently selected contour")
X
X(define mouse:menu
X '(("None" "(progn (set! mouse:mode ()) (set-left-footer-text \"None\"))")
X ("Draw" "(progn (set! mouse:mode 'mouse:DRAW) (set-left-footer-text \"Draw\"))")
X ("Erase" "(progn (set! mouse:mode 'mouse:ERASE) (set-left-footer-text \"Erase\"))")
X ("W/L" "(progn (set! mouse:mode 'mouse:FIDDLE) (set-left-footer-text \"Adjust W/L\"))")
X ("Visine" "(mri:visine)") ; defined in mritool.jl
X ("Snake LOI" "(progn (set! mouse:mode 'mouse:SELLOI) (set-left-footer-text \"Set LOI\"))")))
X
X
X(defun mouse:handler (event)
X "(mouse:handler event) called from internally to handle mouse events"
X (let ((x (nth event 3))
X (y (nth event 4))
X (code (nth event 0)))
X ; (print "Mouse: " mouse:mode " " event ?\n)
X
X (if (or (and (= MS_LEFT code) (= 1 (& (nth event 1) 1))) ; left & down
X (and (= LOC_DRAG code) (!= 0 (& (nth event 2) MS_LEFT_MASK))) ; or left drag
X (eq mouse:mode 'mouse:NXTSNK))
X
X (case mouse:mode
X
X (mouse:DRAW
X (if (nullp mouse:last-x)
X ;; first point
X (progn
X (set-left-footer-text (strcat "Draw: "
X (nth mri:buttons mouse:selected)))
X (set! mouse:start-x (set! mouse:last-x x))
X (set! mouse:start-y (set! mouse:last-y y))
X (draw-point x y mouse:selected))
X (draw-line x y mouse:last-x mouse:last-y mouse:selected)
X (set! mouse:last-x x)
X (set! mouse:last-y y)))
X
X (mouse:ERASE
X (erase-area x y)
X (set! mouse:last-x ())
X (set! mouse:last-y ()))
X
X (mouse:FIDDLE
X (adjust-wl ($-$ y 256) ($-$ x 128))
X (set-left-footer-text (strcat "W/L: "
X (number->string ($-$ y 256))
X "/"
X (number->string ($-$ x 128)))))
X
X (mouse:SELLOI
X (set-left-footer-text (strcat "LOI: ("
X (number->string x)
X ", "
X (number->string y)
X ") = "
X (number->string (mouse-set-loi x y mouse:selected)))))
X
X (mouse:NXTSNK
X ;; only reachable from clicking on measure button
X (if (and (nnullp mouse:start-x)
X (nnullp mouse:last-x))
X (draw-line mouse:start-x mouse:start-y mouse:last-x mouse:last-y mouse:selected))
X (set! mouse:last-x ())
X (set! mouse:last-y ())
X (set! mouse:mode 'mouse:DRAW)
X (set-left-footer-text (strcat "Draw: "
X (nth mri:buttons mouse:selected))))
X
X (#t
X )))))
X
X;; we want the this to be fairly quick
X(set! mouse:handler (bind mouse:handler))
X
X
X
X
X
CEST_TOUT
if test `wc -c < jlisp-1.03/lisp/mouse.jl` -ne 4226 ; then
echo "file jlisp-1.03/lisp/mouse.jl has been corrupted (should be 4226 bytes)"
fi
fi
if test -f jlisp-1.03/lisp/mrirc.cf.jl -a "$1" != "-c" ; then
echo "will not overwrite jlisp-1.03/lisp/mrirc.cf.jl"
else
echo " x - jlisp-1.03/lisp/mrirc.cf.jl (3805 bytes)"
sed 's/^X//' > jlisp-1.03/lisp/mrirc.cf.jl << \CEST_TOUT
X
X;;;; Copyright (c) 1994 Jeff Weisberg
X;;;; see the file "License"
X
X;;;; $Id: mrirc.cf.jl,v 1.7 94/08/11 15:50:49 weisberg Exp Locker: weisberg $
X;;;; system wide config file for mritool program
X
X; define-with name default-value type-predicate preprocess-command docstrings
X(define-with mri:across 2 intp () "number of buttons across")
X(define-with mri:buttons ; the button labels
X '("R Temporal" "L Temporal"
X "R White" "L White"
X "R Grey" "L Grey"
X "R Amygdala" "L Amygdala"
X "R Hippocampus" "L Hippocampus"
X "R Parahippocampus" "L Parahippocampus"
X "R Horn" "L Horn"
X "R Brain" "L Brain")
X listp () "a list of labels for the buttons")
X
X(define-with mri:top-row
X '(
X ("File" (("Patients" "(show-patient-popup)")
X ("Next Image" "(set image next)")
X ("Prev Image" "(set image prev)")
X ("Select Image" "(show-image-popup)")))
X
X ("Command" (("View Modes" ( ("Image" "(set mode view)")
X ("Segm" "(set mode segm)")))
X ("Function" ( ("Show LUT" "(show-lut)")
X ("New Frame" "(new-frame)")
X ("Analyze" "(analyze)")))
X ("Help" "(help)")
X ("Refresh" "(refresh)")
X ("Visine" "(progn (visine)(refresh))")
X ("Snake" "(progn (show-snake-popup) (show-measure-popup) (show-bounds-popup))")
X ("Segment" "(progn (show-segm-popup) (show-bounds-popup))")
X ("Quit" "(quit)")))
X
X )
X listp () "a list describing the buttons and menus along the top of the tool")
X
X
X;;; locate some important files
X(define-with mri:patdir (mriname "%PATDIR%") stringp mriname "where the mri-scans are")
X(define-with mri:segmdir (mriname "%SEGMDIR%") stringp mriname "where the segm data is kept")
X(define-with mri:etcdir (mriname "%ETCDIR%") stringp mriname "where some goodies are")
X(define-with mri:savedir (mriname "~/data/save") stringp mriname "where to save stuff")
X(define-with mri:savename "Datafile" stringp () "the name of the data file")
X(define-with mri:statefile ".mri-state" stringp () "the name of the state file")
X(define-with mri:helpfile (strcat mri:etcdir "/help.txt") stringp mriname "the help file")
X(define-with mri:patients "" stringp mriname "list of patients for this project")
X
X;;; various parameters
X(define-with mri:line-width 2 intp () "the width of lines you draw")
X(define-with mri:line-style 1 intp () "1=solid, 2=dashed, 3=double-dashed")
X(define-with mri:erasor 16 intp () "size of erasor")
X
X(define-with mri:elastic 20 intp () "default snake elasticity")
X(define-with mri:attractive 15 intp () "default snake atractiveness")
X(define-with mri:stiffness 100 intp () "default snake stiffness")
X(define-with mri:3dconstraint 0 intp () "default snake 3D term")
X(define-with mri:similarity 5 intp () "default snake similararity")
X(define-with mri:maxiter 100 intp () "max # of iters when minimizing snake")
X(define-with mri:percent 90 intp () "max # of iters when minimizing snake")
X
X(define-with mri:nlev 6 intp () "defualt number of segm levels")
X
X(define-with mri:window 230 intp () "default window")
X(define-with mri:level -15 intp () "default level")
X
X(sets! prompt (lambda () (print-stderr "mri(" .lineno ") > ")))
X
X(define-with mri:init-msg
X (lambda ()
X (display mri:version) (newline)
X (display .version) (newline)
X (copyright) (newline) (newline))
X procedurep () "thunk to display initialization message")
X
CEST_TOUT
if test `wc -c < jlisp-1.03/lisp/mrirc.cf.jl` -ne 3805 ; then
echo "file jlisp-1.03/lisp/mrirc.cf.jl has been corrupted (should be 3805 bytes)"
fi
fi
echo part02 done.
exit 0