From: Michael Huang
Subject: How to send out ANSI code ?
Date: 
Message-ID: <1992Dec17.113424.7819@debbie.cc.nctu.edu.tw>
When I want to use the ANSI code to control the terminal position,
I tried the following program

   (prog () (code-char 27) (princ "[5,5H"))

The result is that 
  
   #\Esc
   [5,5H

 How to send out the ANSI code ?
 I will be very appreciated if some body can tell me how.

 Thanks.
--



Michael Huang

Dept. of Electronics Engineering
National Chiao Tung Univ.
Taiwan R.O.C.

E-mail:                   
········@cc.nctu.edu.tw  
·······@twnctu02.bitnet 

 

From: David Loewenstern
Subject: Re: How to send out ANSI code ?
Date: 
Message-ID: <1992Dec21.223203.261@cbnewsl.cb.att.com>
... On Thu, 17 Dec 1992 11:34:24 GMT, ·····@cc.nctu.edu.tw (Michael Huang) said:


} When I want to use the ANSI code to control the terminal position,
} I tried the following program

}    (prog () (code-char 27) (princ "[5,5H"))

} The result is that 
}   
}    #\Esc
}    [5,5H


Odd.  I would have expected it to print just

[5,5H

Anyway, (write-char #\Esc) will do what you want:

(progn
  (write-char #\Esc)
  (princ "[5,5H"))

These opinions are shareware.  If you like the product,
please send your $0.02 to
               David Loewenstern
          <·················@att.com>
From: Tom Kramer
Subject: Re: How to send out ANSI code ?
Date: 
Message-ID: <20468@cosmos.cme.nist.gov>
In article <·····················@debbie.cc.nctu.edu.tw>, ·····@cc.nctu.edu.tw (Michael Huang) writes:
> 
> 
> 
> 
> When I want to use the ANSI code to control the terminal position,
> I tried the following program
> 
>    (prog () (code-char 27) (princ "[5,5H"))
> 
> The result is that 
>   
>    #\Esc
>    [5,5H
> 
>  How to send out the ANSI code ?

Here are two examples of functions I use to send out ANSI code. The first
one hides the window I am using. The second one resizes it. Both work
from Allegro Common LISP running on a SUN3 or SUN4 with the Sunview
window system. I do not know if they will work in other situations.

(defun window-hide (portname)
  (princ (concatenate 'string (princ-to-string (code-char 27)) "[6t") portname)
  (finish-output portname))

(defun window-resize (portname corner_x corner_y x_size y_size)
  (princ (concatenate 'string (princ-to-string (code-char 27))
                    "[4;" (princ-to-string y_size) ";"
                    (princ-to-string x_size) "t") portname)
  (princ (concatenate 'string (princ-to-string (code-char 27))
                    "[3;" (princ-to-string corner_y) ";"
                    (princ-to-string corner_x) "t") portname)
  (finish-output portname))

Something similar should work for sending other ANSI codes.

Tom Kramer
······@cme.nist.gov