[go: up one dir, main page]

Menu

[897c37]: / mlib / include / ansi.h  Maximize  Restore  History

Download this file

103 lines (93 with data), 2.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
/*
* /include/ansi.h
*
* Aaron Wigley (Hunter) & Stuart Day (Squawk)
*
* Changed: 25/2/1999 Robert Rendell (Rhys)
* - added some more codes, parenthesised the macro args.
*
* Provides definitions for ANSI terminal control codes.
* The macros are intended to be used as write() fodder.
*
* Be warned that part of this file might not view well.
*
* These ANSI codes seem to work ok on:
* - xterm
* - CUTE/TCP Telnet
* - vt100
* - vt102
*/
#ifndef __Ansi_h
#define __Ansi_h
/*
* The following line may not display properly (mainly because there
* is an escape character embedded in the line
*/
#define ESC ""
/*
* Graphical Text Modes
*/
#define DEFAULT (ESC+"[0m")
#define BOLD_ON (ESC+"[1m")
#define BOLD_OFF DEFAULT
#define FAINT_ON (ESC+"[2m")
#define FAINT_OFF DEFAULT
#define STANDOUT_ON (ESC+"[3m")
#define STANDOUT_OFF DEFAULT
#define UNDERLINE_ON (ESC+"[4m")
#define UNDERLINE_OFF DEFAULT
#define BLINK_ON (ESC+"[5m")
#define BLINK_OFF DEFAULT
#define NEGATIVE_ON (ESC+"[7m")
#define NEGATIVE_OFF DEFAULT
/*
* Screen Handling
*/
#define ERASE_SCREEN (ESC+"[2J")
#define ERASE_TO_END_OF_LINE (ESC+"[0K")
#define ERASE_TO_END_OF_SCREEN (ESC+"[0J")
#define ERASE_FROM_START_OF_LINE (ESC+"[1K")
#define ERASE_FROM_START_OF_SCREEN (ESC+"[1J")
#define ERASE_LINE (ESC+"[2K")
#define INSERT_LINE(x) (ESC+"["+(x)+"L")
#define DELETE_LINE(x) (ESC+"["+(x)+"M")
#define INSERT_CHARACTER(x) (ESC+"["+(x)+"@")
#define DELETE_CHARACTER(x) (ESC+"["+(x)+"P")
#define SET_SCROLL_REGION(y1, y2) (ESC+"["+(y1)+";"+(y2)+"r")
/*
* Cursor Handling
*
* Note, there is no way of determining where the cursor currently is,
* it will need to be kept track of elsewhere.
*/
#define MOVE_CURSOR(x, y) (ESC+"["+(y)+";"+(x)+"H")
#define CURSOR_UP( y ) (ESC+"["+(y)+"A")
#define CURSOR_DOWN( y ) (ESC+"["+(y)+"B")
#define CURSOR_RIGHT( x ) (ESC+"["+(x)+"C")
#define CURSOR_LEFT( x ) (ESC+"["+(x)+"D")
#define SAVE_CURSOR (ESC+"7")
#define RESTORE_CURSOR (ESC+"8")
#define BLACK 30
#define RED 31
#define GREEN 32
#define YELLOW 33
#define BLUE 34
#define PURPLE 35
#define CYAN 36
#define GREY 38
#define WHITE 39
#define INVERSE_RED 41
#define INVERSE_GREEN 42
#define INVERSE_YELLOW 43
#define INVERSE_BLUE 44
#define INVERSE_PURPLE 45
#define INVERSE_CYAN 46
#define INVERSE_GREY 47
#define FAINT_RED 131
#define FAINT_GREEN 132
#define FAINT_YELLOW 133
#define FAINT_BLUE 134
#define FAINT_PURPLE 135
#define FAINT_CYAN 136
#define FAINT_GREY 137
#endif /* __Ansi_h */