home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / alt / msdos / programm / 3288 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.3 KB

  1. Xref: sparky alt.msdos.programmer:3288 comp.os.msdos.programmer:12541 comp.sys.ibm.pc.programmer:810
  2. Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer
  3. Path: sparky!uunet!math.fu-berlin.de!fauern!dec16!dec8!schoof
  4. From: schoof@informatik.uni-wuerzburg.de (Jochen "Joscho" Schoof)
  5. Subject: Re: ANSI escape sequences
  6. Message-ID: <1993Jan28.134648.24382@informatik.uni-wuerzburg.de>
  7. Followup-To: alt.msdos.programmer,comp.os.msdos.programmer,comp.sys.ibm.pc.programmer
  8. Sender: news@informatik.uni-wuerzburg.de (USENET News account)
  9. Organization: University of Wuerzburg, Germany
  10. X-Newsreader: TIN [version 1.1 PL8]
  11. References: <1993Jan22.180945.452@newsgate.sps.mot.com>
  12. Date: Thu, 28 Jan 1993 13:46:48 GMT
  13. Lines: 48
  14.  
  15. Carl Dichter (dichter@chdasic.sps.mot.com) wrote:
  16. : Does anyone have an a list of the ANSI (terminal) escape sequences?
  17.  
  18. : I'm especially interested in the ones to change
  19. : color or attributes.
  20.  
  21. Voila, I think the following lines in C (to be exact C-Preprocessor)
  22. show the abilities quite well. I think the macros are described by their
  23. names, so no further comments are needed. BTW: There are much more
  24. features available. They are described in the documentation to some of
  25. those ANSI.SYS substitutes (I strongly recommend NNANSI Version 09/92).
  26. Have fun with these...
  27.  
  28. -Jochen
  29.  
  30. ------------------ C program starts here -------------------------------
  31.  
  32. /* XANSI.H - Screen Control Routines for Color Machines */
  33.  
  34. #define GotoXY(x,y)    printf("\033[%d;%dH",(y),(x))
  35. #define ClrScr()    printf("\033[2J")
  36. #define Color(f,b)    printf("\033[%d;%d;%dm",(f)>8,30+(f)%8,40+(b)%8)
  37. #define ClrEol()    printf("\033[K")
  38.  
  39. /* ...and finally the available colors with their ANSI-values */
  40.  
  41. #define    BLACK        0
  42. #define RED        1
  43. #define GREEN        2
  44. #define    BROWN        3
  45. #define    BLUE        4
  46. #define    MAGENTA        5
  47. #define CYAN        6
  48. #define    WHITE        7
  49. #define GREY        8
  50. #define    LIGHT_RED    9
  51. #define    LIGHT_GREEN    10
  52. #define YELLOW        11
  53. #define    LIGHT_BLUE    12
  54. #define    LIGHT_MAGENTA    13
  55. #define    LIGHT_CYAN    14
  56. #define    LIGHT_WHITE    15
  57.  
  58. ---------------------------------------------------------------------------
  59. Jochen Schoof                      schoof@dec5.informatik.uni-wuerzburg.de
  60. Lehrstuhl f. Informatik II +-----------------------------------------------
  61. Universitaet Wuerzburg     | It's worse than that: he's dead, Jim!  -Bones
  62. ---------------------------+-----------------------------------------------
  63.