[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
re: portability of .fas files
- To: clisp-list@ma2s2.mathematik.uni-karlsruhe.de
- Subject: re: portability of .fas files
- From: donc@ISI.EDU (Don Cohen)
- Date: Wed, 21 Dec 94 11:59:26 -0800
- Cc: donc@ISI.EDU, hoehle@inf-wiss.uni-konstanz.de
- Posted-date: Wed, 21 Dec 94 11:59:26 -0800
Since you mention with-keyboard as an example, let me suggest an alternative
implementation.
The original:
(defmacro with-keyboard (&body body)
#+(or ATARI DOS OS/2) ; *keyboard-input* existiert schon
`(LET () (PROGN ,@body))
#+UNIX
`(UNWIND-PROTECT
(PROGN
(SYS::TERMINAL-RAW *TERMINAL-IO* T)
,@body
)
(SYS::TERMINAL-RAW *TERMINAL-IO* NIL)
)
)
my proposal:
(defmacro with-keyboard (&body body)
`(do-with-keyboard (function (lambda nil ,@body))))
#+(or ATARI DOS OS/2)
(defun do-with-keyboard (fn) (funcall fn))
; BTW, what was that LET () for?
#+UNIX
(defun do-with-keyboard (fn)
(UNWIND-PROTECT
(PROGN
(SYS::TERMINAL-RAW *TERMINAL-IO* T)
(funcall fn))
(SYS::TERMINAL-RAW *TERMINAL-IO* NIL)))
The result is that the macro expands the same way on all machines.
The difference is hidden inside a function that differs from one
machine to the next. Thus the compiled code that uses the macro
(as opposed to the compiled code that defines it, which is another
matter) is machine independent.
> at least between DOS and UNIX machines.
Why just these?
They're the ones that I actually use. The point was really that
I did NOT only want compatibility between unix machines. (This was
in response to an earlier message.) Notice that my proposal was
meant to obtain compatibility among ALL machines.