home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / lisp / 3134 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.7 KB  |  51 lines

  1. Path: sparky!uunet!dove!cme!kramer
  2. From: kramer@cme.nist.gov (Tom Kramer)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: How to send out ANSI code ?
  5. Summary: example LISP code for sending out ANSI code
  6. Message-ID: <20468@cosmos.cme.nist.gov>
  7. Date: 23 Dec 92 14:14:50 GMT
  8. References: <1992Dec17.113424.7819@debbie.cc.nctu.edu.tw>
  9. Organization: National Institute of Standards & Technology, Gaithersburg, MD
  10. Lines: 39
  11.  
  12. In article <1992Dec17.113424.7819@debbie.cc.nctu.edu.tw>, GHOST@cc.nctu.edu.tw (Michael Huang) writes:
  13. > When I want to use the ANSI code to control the terminal position,
  14. > I tried the following program
  15. >    (prog () (code-char 27) (princ "[5,5H"))
  16. > The result is that 
  17. >   
  18. >    #\Esc
  19. >    [5,5H
  20. >  How to send out the ANSI code ?
  21.  
  22. Here are two examples of functions I use to send out ANSI code. The first
  23. one hides the window I am using. The second one resizes it. Both work
  24. from Allegro Common LISP running on a SUN3 or SUN4 with the Sunview
  25. window system. I do not know if they will work in other situations.
  26.  
  27. (defun window-hide (portname)
  28.   (princ (concatenate 'string (princ-to-string (code-char 27)) "[6t") portname)
  29.   (finish-output portname))
  30.  
  31. (defun window-resize (portname corner_x corner_y x_size y_size)
  32.   (princ (concatenate 'string (princ-to-string (code-char 27))
  33.                     "[4;" (princ-to-string y_size) ";"
  34.                     (princ-to-string x_size) "t") portname)
  35.   (princ (concatenate 'string (princ-to-string (code-char 27))
  36.                     "[3;" (princ-to-string corner_y) ";"
  37.                     (princ-to-string corner_x) "t") portname)
  38.   (finish-output portname))
  39.  
  40. Something similar should work for sending other ANSI codes.
  41.  
  42. Tom Kramer
  43. kramer@cme.nist.gov
  44.