mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-23 17:46:23 -05:00
More ANSI-fication of the sources
Ugh. Some of this is ugly. We should really include <curses.h> etc, but there are too many name clashes for that right now.
This commit is contained in:
parent
021605246c
commit
453f80d269
8
edef.h
8
edef.h
@ -491,3 +491,11 @@ extern int copyregion(int f, int n);
|
|||||||
extern int lowerregion(int f, int n);
|
extern int lowerregion(int f, int n);
|
||||||
extern int upperregion(int f, int n);
|
extern int upperregion(int f, int n);
|
||||||
extern int getregion(REGION *rp);
|
extern int getregion(REGION *rp);
|
||||||
|
|
||||||
|
/* posix.c */
|
||||||
|
extern void ttopen(void);
|
||||||
|
extern void ttclose(void);
|
||||||
|
extern int ttputc(int c);
|
||||||
|
extern void ttflush(void);
|
||||||
|
extern int ttgetc(void);
|
||||||
|
extern int typahead(void);
|
||||||
|
28
estruct.h
28
estruct.h
@ -554,25 +554,25 @@ typedef struct {
|
|||||||
short t_margin; /* min margin for extended lines */
|
short t_margin; /* min margin for extended lines */
|
||||||
short t_scrsiz; /* size of scroll region " */
|
short t_scrsiz; /* size of scroll region " */
|
||||||
int t_pause; /* # times thru update to pause */
|
int t_pause; /* # times thru update to pause */
|
||||||
int (*t_open) (); /* Open terminal at the start. */
|
void (*t_open)(void); /* Open terminal at the start. */
|
||||||
int (*t_close) (); /* Close terminal at end. */
|
void (*t_close)(void); /* Close terminal at end. */
|
||||||
int (*t_kopen) (); /* Open keyboard */
|
void (*t_kopen)(void); /* Open keyboard */
|
||||||
int (*t_kclose) (); /* close keyboard */
|
void (*t_kclose)(void); /* close keyboard */
|
||||||
int (*t_getchar) (); /* Get character from keyboard. */
|
int (*t_getchar)(void); /* Get character from keyboard. */
|
||||||
int (*t_putchar) (); /* Put character to display. */
|
int (*t_putchar)(int); /* Put character to display. */
|
||||||
int (*t_flush) (); /* Flush output buffers. */
|
void (*t_flush) (void); /* Flush output buffers. */
|
||||||
int (*t_move) (); /* Move the cursor, origin 0. */
|
void (*t_move)(int, int);/* Move the cursor, origin 0. */
|
||||||
int (*t_eeol) (); /* Erase to end of line. */
|
void (*t_eeol)(void); /* Erase to end of line. */
|
||||||
int (*t_eeop) (); /* Erase to end of page. */
|
void (*t_eeop)(void); /* Erase to end of page. */
|
||||||
int (*t_beep) (); /* Beep. */
|
void (*t_beep)(void); /* Beep. */
|
||||||
int (*t_rev) (); /* set reverse video state */
|
void (*t_rev)(int); /* set reverse video state */
|
||||||
int (*t_rez) (); /* change screen resolution */
|
int (*t_rez)(char *); /* change screen resolution */
|
||||||
#if COLOR
|
#if COLOR
|
||||||
int (*t_setfor) (); /* set forground color */
|
int (*t_setfor) (); /* set forground color */
|
||||||
int (*t_setback) (); /* set background color */
|
int (*t_setback) (); /* set background color */
|
||||||
#endif
|
#endif
|
||||||
#if SCROLLCODE
|
#if SCROLLCODE
|
||||||
int (*t_scroll) (); /* scroll a region of the screen */
|
void (*t_scroll)(int, int,int); /* scroll a region of the screen */
|
||||||
#endif
|
#endif
|
||||||
} TERM;
|
} TERM;
|
||||||
|
|
||||||
|
12
posix.c
12
posix.c
@ -38,7 +38,7 @@ char tobuf[TBUFSIZ]; /* terminal output buffer */
|
|||||||
* On VMS, it translates TT until it finds the terminal, then assigns
|
* On VMS, it translates TT until it finds the terminal, then assigns
|
||||||
* a channel to it and sets it raw. On CPM it is a no-op.
|
* a channel to it and sets it raw. On CPM it is a no-op.
|
||||||
*/
|
*/
|
||||||
ttopen()
|
void ttopen(void)
|
||||||
{
|
{
|
||||||
tcgetattr(0, &otermios); /* save old settings */
|
tcgetattr(0, &otermios); /* save old settings */
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ ttopen()
|
|||||||
* interpreter. On VMS it puts the terminal back in a reasonable state.
|
* interpreter. On VMS it puts the terminal back in a reasonable state.
|
||||||
* Another no-operation on CPM.
|
* Another no-operation on CPM.
|
||||||
*/
|
*/
|
||||||
ttclose()
|
void ttclose(void)
|
||||||
{
|
{
|
||||||
tcsetattr(0, TCSADRAIN, &otermios); /* restore terminal settings */
|
tcsetattr(0, TCSADRAIN, &otermios); /* restore terminal settings */
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ ttclose()
|
|||||||
* On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
|
* On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
|
||||||
* MS-DOS (use the very very raw console output routine).
|
* MS-DOS (use the very very raw console output routine).
|
||||||
*/
|
*/
|
||||||
ttputc(c)
|
int ttputc(int c)
|
||||||
{
|
{
|
||||||
fputc(c, stdout);
|
fputc(c, stdout);
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ ttputc(c)
|
|||||||
* Flush terminal buffer. Does real work where the terminal output is buffered
|
* Flush terminal buffer. Does real work where the terminal output is buffered
|
||||||
* up. A no-operation on systems where byte at a time terminal I/O is done.
|
* up. A no-operation on systems where byte at a time terminal I/O is done.
|
||||||
*/
|
*/
|
||||||
ttflush()
|
void ttflush(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Add some terminal output success checking, sometimes an orphaned
|
* Add some terminal output success checking, sometimes an orphaned
|
||||||
@ -135,7 +135,7 @@ ttflush()
|
|||||||
* at all. More complex in VMS that almost anyplace else, which figures. Very
|
* at all. More complex in VMS that almost anyplace else, which figures. Very
|
||||||
* simple on CPM, because the system can do exactly what you want.
|
* simple on CPM, because the system can do exactly what you want.
|
||||||
*/
|
*/
|
||||||
ttgetc()
|
int ttgetc(void)
|
||||||
{
|
{
|
||||||
return (255 & fgetc(stdin)); /* 8BIT P.K. */
|
return (255 & fgetc(stdin)); /* 8BIT P.K. */
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ ttgetc()
|
|||||||
keyboard buffer
|
keyboard buffer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typahead()
|
int typahead(void)
|
||||||
{
|
{
|
||||||
int x; /* holds # of pending chars */
|
int x; /* holds # of pending chars */
|
||||||
|
|
||||||
|
102
tcap.c
102
tcap.c
@ -14,9 +14,11 @@
|
|||||||
#define termdef 1 /* don't define "term" external */
|
#define termdef 1 /* don't define "term" external */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
|
|
||||||
|
|
||||||
#if TERMCAP
|
#if TERMCAP
|
||||||
|
|
||||||
#if UNIX
|
#if UNIX
|
||||||
@ -29,23 +31,26 @@
|
|||||||
#define BEL 0x07
|
#define BEL 0x07
|
||||||
#define ESC 0x1B
|
#define ESC 0x1B
|
||||||
|
|
||||||
extern int ttopen();
|
/* FIXME! termcap */
|
||||||
extern int ttgetc();
|
extern int tgetnum(char *);
|
||||||
extern int ttputc();
|
extern char *tgetstr(char *id, char **area);
|
||||||
extern int tgetnum();
|
extern int tputs(const char *str, int affcnt, int (*putc)(int));
|
||||||
extern int ttflush();
|
extern char *tgoto(const char *cap, int col, int row);
|
||||||
extern int ttclose();
|
|
||||||
extern int tcapkopen();
|
static void tcapkopen(void);
|
||||||
extern int tcapkclose();
|
static void tcapkclose(void);
|
||||||
extern int tcapmove();
|
static void tcapmove(int, int);
|
||||||
extern int tcapeeol();
|
static void tcapeeol(void);
|
||||||
extern int tcapeeop();
|
static void tcapeeop(void);
|
||||||
extern int tcapbeep();
|
static void tcapbeep(void);
|
||||||
extern int tcaprev();
|
static void tcaprev(int);
|
||||||
extern int tcapcres();
|
static int tcapcres(char *);
|
||||||
extern int tcapopen();
|
static void tcapscrollregion(int top, int bot);
|
||||||
|
static void putpad(char *str);
|
||||||
|
|
||||||
|
static void tcapopen(void);
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
extern int tcapclose();
|
static void tcapclose(void);
|
||||||
#endif
|
#endif
|
||||||
extern int tput();
|
extern int tput();
|
||||||
extern char *tgoto();
|
extern char *tgoto();
|
||||||
@ -54,8 +59,8 @@ extern int tcapfcol();
|
|||||||
extern int tcapbcol();
|
extern int tcapbcol();
|
||||||
#endif
|
#endif
|
||||||
#if SCROLLCODE
|
#if SCROLLCODE
|
||||||
extern int tcapscroll_reg();
|
static void tcapscroll_reg(int from, int to, int lines);
|
||||||
extern int tcapscroll_delins();
|
static void tcapscroll_delins(int from, int to, int lines);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -106,10 +111,10 @@ TERM term = {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
tcapopen()
|
static void tcapopen(void)
|
||||||
{
|
{
|
||||||
char *getenv();
|
char *getenv();
|
||||||
char *t, *p, *tgetstr();
|
char *t, *p;
|
||||||
char tcbuf[1024];
|
char tcbuf[1024];
|
||||||
char *tv_stype;
|
char *tv_stype;
|
||||||
char err_str[72];
|
char err_str[72];
|
||||||
@ -216,7 +221,7 @@ tcapopen()
|
|||||||
|
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
|
|
||||||
tcapclose()
|
static void tcapclose(void)
|
||||||
{
|
{
|
||||||
putpad(tgoto(CM, 0, term.t_nrow));
|
putpad(tgoto(CM, 0, term.t_nrow));
|
||||||
putpad(TE);
|
putpad(TE);
|
||||||
@ -225,7 +230,7 @@ tcapclose()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tcapkopen()
|
static void tcapkopen(void)
|
||||||
{
|
{
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
putpad(TI);
|
putpad(TI);
|
||||||
@ -234,30 +239,31 @@ tcapkopen()
|
|||||||
strcpy(sres, "NORMAL");
|
strcpy(sres, "NORMAL");
|
||||||
}
|
}
|
||||||
|
|
||||||
tcapkclose()
|
static void tcapkclose(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
tcapmove(row, col)
|
static void tcapmove(int row, int col)
|
||||||
register int row, col;
|
|
||||||
{
|
{
|
||||||
putpad(tgoto(CM, col, row));
|
putpad(tgoto(CM, col, row));
|
||||||
}
|
}
|
||||||
|
|
||||||
tcapeeol()
|
static void tcapeeol(void)
|
||||||
{
|
{
|
||||||
putpad(CE);
|
putpad(CE);
|
||||||
}
|
}
|
||||||
|
|
||||||
tcapeeop()
|
static void tcapeeop(void)
|
||||||
{
|
{
|
||||||
putpad(CL);
|
putpad(CL);
|
||||||
}
|
}
|
||||||
|
|
||||||
tcaprev(state)
|
/*
|
||||||
/* change reverse video status */
|
* change reverse video status
|
||||||
int state; /* FALSE = normal video, TRUE = reverse video */
|
*
|
||||||
|
* int state; FALSE = normal video, TRUE = reverse video
|
||||||
|
*/
|
||||||
|
static void tcaprev(int state)
|
||||||
{
|
{
|
||||||
static int revstate = FALSE;
|
static int revstate = FALSE;
|
||||||
if (state) {
|
if (state) {
|
||||||
@ -267,7 +273,7 @@ int state; /* FALSE = normal video, TRUE = reverse video */
|
|||||||
putpad(SE);
|
putpad(SE);
|
||||||
}
|
}
|
||||||
|
|
||||||
tcapcres()
|
static int tcapcres(char *res)
|
||||||
{ /* change screen resolution */
|
{ /* change screen resolution */
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
@ -275,7 +281,7 @@ tcapcres()
|
|||||||
#if SCROLLCODE
|
#if SCROLLCODE
|
||||||
|
|
||||||
/* move howmanylines lines starting at from to to */
|
/* move howmanylines lines starting at from to to */
|
||||||
tcapscroll_reg(from, to, howmanylines)
|
static void tcapscroll_reg(int from, int to, int howmanylines)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (to == from)
|
if (to == from)
|
||||||
@ -295,7 +301,7 @@ tcapscroll_reg(from, to, howmanylines)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* move howmanylines lines starting at from to to */
|
/* move howmanylines lines starting at from to to */
|
||||||
tcapscroll_delins(from, to, howmanylines)
|
static void tcapscroll_delins(int from, int to, int howmanylines)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
if (to == from)
|
if (to == from)
|
||||||
@ -318,7 +324,7 @@ tcapscroll_delins(from, to, howmanylines)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* cs is set up just like cm, so we use tgoto... */
|
/* cs is set up just like cm, so we use tgoto... */
|
||||||
tcapscrollregion(top, bot)
|
static void tcapscrollregion(int top, int bot)
|
||||||
{
|
{
|
||||||
ttputc(PC);
|
ttputc(PC);
|
||||||
putpad(tgoto(CS, bot, top));
|
putpad(tgoto(CS, bot, top));
|
||||||
@ -326,44 +332,44 @@ tcapscrollregion(top, bot)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
spal(dummy)
|
void spal(int dummy)
|
||||||
{ /* change palette string */
|
{ /* change palette string */
|
||||||
/* Does nothing here */
|
/* Does nothing here */
|
||||||
}
|
}
|
||||||
|
|
||||||
#if COLOR
|
#if COLOR
|
||||||
tcapfcol()
|
static void tcapfcol(void)
|
||||||
{ /* no colors here, ignore this */
|
{ /* no colors here, ignore this */
|
||||||
}
|
}
|
||||||
|
|
||||||
tcapbcol()
|
static void tcapbcol(void)
|
||||||
{ /* no colors here, ignore this */
|
{ /* no colors here, ignore this */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tcapbeep()
|
static void tcapbeep(void)
|
||||||
{
|
{
|
||||||
ttputc(BEL);
|
ttputc(BEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
putpad(str)
|
static void putpad(char *str)
|
||||||
char *str;
|
|
||||||
{
|
{
|
||||||
tputs(str, 1, ttputc);
|
tputs(str, 1, ttputc);
|
||||||
}
|
}
|
||||||
|
|
||||||
putnpad(str, n)
|
static void putnpad(char *str, int n)
|
||||||
char *str;
|
|
||||||
{
|
{
|
||||||
tputs(str, n, ttputc);
|
tputs(str, n, ttputc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if FNLABEL
|
#if FNLABEL
|
||||||
fnclabel(f, n)
|
/*
|
||||||
/* label a function key */
|
* label a function key
|
||||||
int f, n; /* default flag, numeric argument [unused] */
|
*
|
||||||
|
* int f, n; default flag, numeric argument [unused]
|
||||||
|
*/
|
||||||
|
static int fnclabel(int f, int n)
|
||||||
{
|
{
|
||||||
/* on machines with no function keys...don't bother */
|
/* on machines with no function keys...don't bother */
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -371,7 +377,7 @@ int f, n; /* default flag, numeric argument [unused] */
|
|||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
hello()
|
static void hello(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user