2010-07-11 13:54:48 -04:00
|
|
|
/* vt52.c
|
2005-05-31 11:50:56 -04:00
|
|
|
*
|
|
|
|
* The routines in this file
|
|
|
|
* provide support for VT52 style terminals
|
|
|
|
* over a serial line. The serial I/O services are
|
|
|
|
* provided by routines in "termio.c". It compiles
|
|
|
|
* into nothing if not a VT52 style device. The
|
|
|
|
* bell on the VT52 is terrible, so the "beep"
|
|
|
|
* routine is conditionalized on defining BEL.
|
|
|
|
*
|
|
|
|
* modified by Petri Kutvonen
|
|
|
|
*/
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
#define termdef 1 /* don't define "term" external */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "estruct.h"
|
|
|
|
#include "edef.h"
|
|
|
|
|
|
|
|
#if VT52
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
#define NROW 24 /* Screen size. */
|
|
|
|
#define NCOL 80 /* Edit if you want to. */
|
|
|
|
#define MARGIN 8 /* size of minimim margin and */
|
|
|
|
#define SCRSIZ 64 /* scroll size for extended lines */
|
|
|
|
#define NPAUSE 100 /* # times thru update to pause */
|
|
|
|
#define BIAS 0x20 /* Origin 0 coordinate bias. */
|
|
|
|
#define ESC 0x1B /* ESC character. */
|
|
|
|
#define BEL 0x07 /* ascii bell character */
|
|
|
|
|
|
|
|
extern int ttopen(); /* Forward references. */
|
|
|
|
extern int ttgetc();
|
|
|
|
extern int ttputc();
|
|
|
|
extern int ttflush();
|
|
|
|
extern int ttclose();
|
|
|
|
extern int vt52move();
|
|
|
|
extern int vt52eeol();
|
|
|
|
extern int vt52eeop();
|
|
|
|
extern int vt52beep();
|
|
|
|
extern int vt52open();
|
|
|
|
extern int vt52rev();
|
|
|
|
extern int vt52cres();
|
|
|
|
extern int vt52kopen();
|
|
|
|
extern int vt52kclose();
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2010-07-11 13:54:48 -04:00
|
|
|
#if COLOR
|
2005-09-30 18:26:09 -04:00
|
|
|
extern int vt52fcol();
|
|
|
|
extern int vt52bcol();
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
2010-07-11 13:54:48 -04:00
|
|
|
* Dispatch table.
|
|
|
|
* All the hard fields just point into the terminal I/O code.
|
2005-05-31 11:50:56 -04:00
|
|
|
*/
|
2010-07-11 13:54:48 -04:00
|
|
|
struct terminal term = {
|
2005-09-30 18:26:09 -04:00
|
|
|
NROW - 1,
|
|
|
|
NROW - 1,
|
|
|
|
NCOL,
|
|
|
|
NCOL,
|
2005-05-31 11:50:56 -04:00
|
|
|
MARGIN,
|
|
|
|
SCRSIZ,
|
|
|
|
NPAUSE,
|
2005-09-30 18:26:09 -04:00
|
|
|
&vt52open,
|
|
|
|
&ttclose,
|
2005-05-31 11:50:56 -04:00
|
|
|
&vt52kopen,
|
|
|
|
&vt52kclose,
|
2005-09-30 18:26:09 -04:00
|
|
|
&ttgetc,
|
|
|
|
&ttputc,
|
|
|
|
&ttflush,
|
|
|
|
&vt52move,
|
|
|
|
&vt52eeol,
|
|
|
|
&vt52eeop,
|
|
|
|
&vt52beep,
|
|
|
|
&vt52rev,
|
|
|
|
&vt52cres
|
2005-05-31 11:50:56 -04:00
|
|
|
#if COLOR
|
2005-09-30 18:26:09 -04:00
|
|
|
, &vt52fcol,
|
2005-05-31 11:50:56 -04:00
|
|
|
&vt52bcol
|
|
|
|
#endif
|
|
|
|
#if SCROLLCODE
|
2005-09-30 18:26:09 -04:00
|
|
|
, NULL
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
vt52move(row, col)
|
|
|
|
{
|
2005-09-30 18:26:09 -04:00
|
|
|
ttputc(ESC);
|
|
|
|
ttputc('Y');
|
|
|
|
ttputc(row + BIAS);
|
|
|
|
ttputc(col + BIAS);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
vt52eeol()
|
|
|
|
{
|
2005-09-30 18:26:09 -04:00
|
|
|
ttputc(ESC);
|
|
|
|
ttputc('K');
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
vt52eeop()
|
|
|
|
{
|
2005-09-30 18:26:09 -04:00
|
|
|
ttputc(ESC);
|
|
|
|
ttputc('J');
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
vt52rev(status)
|
|
|
|
/* set the reverse video state */
|
|
|
|
int status; /* TRUE = reverse video, FALSE = normal video */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
/* can't do this here, so we won't */
|
|
|
|
}
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
vt52cres()
|
|
|
|
{ /* change screen resolution - (not here though) */
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if COLOR
|
2005-09-30 18:26:09 -04:00
|
|
|
vt52fcol()
|
|
|
|
{ /* set the forground color [NOT IMPLIMENTED] */
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
vt52bcol()
|
|
|
|
{ /* set the background color [NOT IMPLIMENTED] */
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
vt52beep()
|
|
|
|
{
|
|
|
|
#ifdef BEL
|
2005-09-30 18:26:09 -04:00
|
|
|
ttputc(BEL);
|
|
|
|
ttflush();
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
vt52open()
|
|
|
|
{
|
|
|
|
#if V7 | BSD
|
2010-02-27 05:38:22 -05:00
|
|
|
char *cp;
|
2005-09-30 18:26:09 -04:00
|
|
|
char *getenv();
|
|
|
|
|
|
|
|
if ((cp = getenv("TERM")) == NULL) {
|
|
|
|
puts("Shell variable TERM not defined!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
if (strcmp(cp, "vt52") != 0 && strcmp(cp, "z19") != 0) {
|
|
|
|
puts("Terminal type not 'vt52'or 'z19' !");
|
|
|
|
exit(1);
|
|
|
|
}
|
2005-05-31 11:50:56 -04:00
|
|
|
#endif
|
2005-09-30 18:26:09 -04:00
|
|
|
ttopen();
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
vt52kopen()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
vt52kclose()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|