Subject: re: portability of .fas files

From: [email-masked] (Don Cohen)
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.