/*
**  Filename: escseq.h
**  Date: 93/04/22
**  Contains useful #defines for Console - Windows
**  For ANSI - C  and  C++
**  written by Harald Pehl in 1993
*/

#ifndef __INCLUDE_ESCSEQ_H
#define __INCLUDE_ESCSEQ_H

#ifdef __cplusplus
#include <stream.h>
#define MOVE(x,y)       cout << "\033[" << x << "x" << "\033[" << y << "y";
#define LOCATE(s,z)     cout << "\033[" << s << ";" << z << "H";
#define SET_A_PEN(a)    cout << "\033[3" << a+4 << "m";
#define SET_B_PEN(b)    cout << "\033[4" << b+4 << "m";
#else
#include <stdio.h>
#define MOVE(x,y)       printf ("\033[%dx\033[%dy", x, y);
#define LOCATE(s,z)     printf ("\033[%d;%dH", s, z);
#define SET_A_PEN(a)    printf ("\033[3%dm", a+4);
#define SET_B_PEN(b)    printf ("\033[4%dm", b+4);
#endif

#define RESET           "\033[0m"
#define BOLD_ON         "\033[1m"
#define BOLD_OFF        "\033[22m"
#define ITALIC_ON       "\033[3m"
#define ITALIC_OFF      "\033[23m"
#define UNDERLINE_ON    "\033[4m"
#define UNDERLINE_OFF   "\033[24m"
#define INVERS_ON       "\033[7m"
#define INVERS_OFF      "\033[27m"
#define WIDTH(w)        "\033["#w"u"
#define HEIGHT(h)       "\033["#h"t"
#define INSERT_SPACE    "\033[@"
#define CURSOR_UP       "\033[#A"
#define CURSOR_DOWN     "\033[#B"
#define CURSOR_RIGHT    "\033[#C"
#define CURSOR_LEFT     "\033[#D"
#define LINE_UP         "\033[#F"
#define LINE_DOWN       "\033[#E"
#define DEL_EOL         "\033[#K"
#define INSERT_LINE     "\033[#L"
#define DEL_LINE        "\033[#M"
#define SCROLL_UP       "\033[#S"
#define SCROLL_DOWN     "\033[#T"

#endif
