mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-27 11:36: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 upperregion(int f, int n);
|
||||
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_scrsiz; /* size of scroll region " */
|
||||
int t_pause; /* # times thru update to pause */
|
||||
int (*t_open) (); /* Open terminal at the start. */
|
||||
int (*t_close) (); /* Close terminal at end. */
|
||||
int (*t_kopen) (); /* Open keyboard */
|
||||
int (*t_kclose) (); /* close keyboard */
|
||||
int (*t_getchar) (); /* Get character from keyboard. */
|
||||
int (*t_putchar) (); /* Put character to display. */
|
||||
int (*t_flush) (); /* Flush output buffers. */
|
||||
int (*t_move) (); /* Move the cursor, origin 0. */
|
||||
int (*t_eeol) (); /* Erase to end of line. */
|
||||
int (*t_eeop) (); /* Erase to end of page. */
|
||||
int (*t_beep) (); /* Beep. */
|
||||
int (*t_rev) (); /* set reverse video state */
|
||||
int (*t_rez) (); /* change screen resolution */
|
||||
void (*t_open)(void); /* Open terminal at the start. */
|
||||
void (*t_close)(void); /* Close terminal at end. */
|
||||
void (*t_kopen)(void); /* Open keyboard */
|
||||
void (*t_kclose)(void); /* close keyboard */
|
||||
int (*t_getchar)(void); /* Get character from keyboard. */
|
||||
int (*t_putchar)(int); /* Put character to display. */
|
||||
void (*t_flush) (void); /* Flush output buffers. */
|
||||
void (*t_move)(int, int);/* Move the cursor, origin 0. */
|
||||
void (*t_eeol)(void); /* Erase to end of line. */
|
||||
void (*t_eeop)(void); /* Erase to end of page. */
|
||||
void (*t_beep)(void); /* Beep. */
|
||||
void (*t_rev)(int); /* set reverse video state */
|
||||
int (*t_rez)(char *); /* change screen resolution */
|
||||
#if COLOR
|
||||
int (*t_setfor) (); /* set forground color */
|
||||
int (*t_setback) (); /* set background color */
|
||||
#endif
|
||||
#if SCROLLCODE
|
||||
int (*t_scroll) (); /* scroll a region of the screen */
|
||||
void (*t_scroll)(int, int,int); /* scroll a region of the screen */
|
||||
#endif
|
||||
} 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
|
||||
* 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 */
|
||||
|
||||
@ -86,7 +86,7 @@ ttopen()
|
||||
* interpreter. On VMS it puts the terminal back in a reasonable state.
|
||||
* Another no-operation on CPM.
|
||||
*/
|
||||
ttclose()
|
||||
void ttclose(void)
|
||||
{
|
||||
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
|
||||
* MS-DOS (use the very very raw console output routine).
|
||||
*/
|
||||
ttputc(c)
|
||||
int ttputc(int c)
|
||||
{
|
||||
fputc(c, stdout);
|
||||
}
|
||||
@ -106,7 +106,7 @@ ttputc(c)
|
||||
* 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.
|
||||
*/
|
||||
ttflush()
|
||||
void ttflush(void)
|
||||
{
|
||||
/*
|
||||
* 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
|
||||
* simple on CPM, because the system can do exactly what you want.
|
||||
*/
|
||||
ttgetc()
|
||||
int ttgetc(void)
|
||||
{
|
||||
return (255 & fgetc(stdin)); /* 8BIT P.K. */
|
||||
}
|
||||
@ -144,7 +144,7 @@ ttgetc()
|
||||
keyboard buffer
|
||||
*/
|
||||
|
||||
typahead()
|
||||
int typahead(void)
|
||||
{
|
||||
int x; /* holds # of pending chars */
|
||||
|
||||
|
102
tcap.c
102
tcap.c
@ -14,9 +14,11 @@
|
||||
#define termdef 1 /* don't define "term" external */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "estruct.h"
|
||||
#include "edef.h"
|
||||
|
||||
|
||||
#if TERMCAP
|
||||
|
||||
#if UNIX
|
||||
@ -29,23 +31,26 @@
|
||||
#define BEL 0x07
|
||||
#define ESC 0x1B
|
||||
|
||||
extern int ttopen();
|
||||
extern int ttgetc();
|
||||
extern int ttputc();
|
||||
extern int tgetnum();
|
||||
extern int ttflush();
|
||||
extern int ttclose();
|
||||
extern int tcapkopen();
|
||||
extern int tcapkclose();
|
||||
extern int tcapmove();
|
||||
extern int tcapeeol();
|
||||
extern int tcapeeop();
|
||||
extern int tcapbeep();
|
||||
extern int tcaprev();
|
||||
extern int tcapcres();
|
||||
extern int tcapopen();
|
||||
/* FIXME! termcap */
|
||||
extern int tgetnum(char *);
|
||||
extern char *tgetstr(char *id, char **area);
|
||||
extern int tputs(const char *str, int affcnt, int (*putc)(int));
|
||||
extern char *tgoto(const char *cap, int col, int row);
|
||||
|
||||
static void tcapkopen(void);
|
||||
static void tcapkclose(void);
|
||||
static void tcapmove(int, int);
|
||||
static void tcapeeol(void);
|
||||
static void tcapeeop(void);
|
||||
static void tcapbeep(void);
|
||||
static void tcaprev(int);
|
||||
static int tcapcres(char *);
|
||||
static void tcapscrollregion(int top, int bot);
|
||||
static void putpad(char *str);
|
||||
|
||||
static void tcapopen(void);
|
||||
#if PKCODE
|
||||
extern int tcapclose();
|
||||
static void tcapclose(void);
|
||||
#endif
|
||||
extern int tput();
|
||||
extern char *tgoto();
|
||||
@ -54,8 +59,8 @@ extern int tcapfcol();
|
||||
extern int tcapbcol();
|
||||
#endif
|
||||
#if SCROLLCODE
|
||||
extern int tcapscroll_reg();
|
||||
extern int tcapscroll_delins();
|
||||
static void tcapscroll_reg(int from, int to, int lines);
|
||||
static void tcapscroll_delins(int from, int to, int lines);
|
||||
#endif
|
||||
|
||||
|
||||
@ -106,10 +111,10 @@ TERM term = {
|
||||
#endif
|
||||
};
|
||||
|
||||
tcapopen()
|
||||
static void tcapopen(void)
|
||||
{
|
||||
char *getenv();
|
||||
char *t, *p, *tgetstr();
|
||||
char *t, *p;
|
||||
char tcbuf[1024];
|
||||
char *tv_stype;
|
||||
char err_str[72];
|
||||
@ -216,7 +221,7 @@ tcapopen()
|
||||
|
||||
#if PKCODE
|
||||
|
||||
tcapclose()
|
||||
static void tcapclose(void)
|
||||
{
|
||||
putpad(tgoto(CM, 0, term.t_nrow));
|
||||
putpad(TE);
|
||||
@ -225,7 +230,7 @@ tcapclose()
|
||||
}
|
||||
#endif
|
||||
|
||||
tcapkopen()
|
||||
static void tcapkopen(void)
|
||||
{
|
||||
#if PKCODE
|
||||
putpad(TI);
|
||||
@ -234,30 +239,31 @@ tcapkopen()
|
||||
strcpy(sres, "NORMAL");
|
||||
}
|
||||
|
||||
tcapkclose()
|
||||
static void tcapkclose(void)
|
||||
{
|
||||
}
|
||||
|
||||
tcapmove(row, col)
|
||||
register int row, col;
|
||||
static void tcapmove(int row, int col)
|
||||
{
|
||||
putpad(tgoto(CM, col, row));
|
||||
}
|
||||
|
||||
tcapeeol()
|
||||
static void tcapeeol(void)
|
||||
{
|
||||
putpad(CE);
|
||||
}
|
||||
|
||||
tcapeeop()
|
||||
static void tcapeeop(void)
|
||||
{
|
||||
putpad(CL);
|
||||
}
|
||||
|
||||
tcaprev(state)
|
||||
/* change reverse video status */
|
||||
int state; /* FALSE = normal video, TRUE = reverse video */
|
||||
|
||||
/*
|
||||
* change reverse video status
|
||||
*
|
||||
* int state; FALSE = normal video, TRUE = reverse video
|
||||
*/
|
||||
static void tcaprev(int state)
|
||||
{
|
||||
static int revstate = FALSE;
|
||||
if (state) {
|
||||
@ -267,7 +273,7 @@ int state; /* FALSE = normal video, TRUE = reverse video */
|
||||
putpad(SE);
|
||||
}
|
||||
|
||||
tcapcres()
|
||||
static int tcapcres(char *res)
|
||||
{ /* change screen resolution */
|
||||
return (TRUE);
|
||||
}
|
||||
@ -275,7 +281,7 @@ tcapcres()
|
||||
#if SCROLLCODE
|
||||
|
||||
/* 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;
|
||||
if (to == from)
|
||||
@ -295,7 +301,7 @@ tcapscroll_reg(from, to, howmanylines)
|
||||
}
|
||||
|
||||
/* 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;
|
||||
if (to == from)
|
||||
@ -318,7 +324,7 @@ tcapscroll_delins(from, to, howmanylines)
|
||||
}
|
||||
|
||||
/* cs is set up just like cm, so we use tgoto... */
|
||||
tcapscrollregion(top, bot)
|
||||
static void tcapscrollregion(int top, int bot)
|
||||
{
|
||||
ttputc(PC);
|
||||
putpad(tgoto(CS, bot, top));
|
||||
@ -326,44 +332,44 @@ tcapscrollregion(top, bot)
|
||||
|
||||
#endif
|
||||
|
||||
spal(dummy)
|
||||
void spal(int dummy)
|
||||
{ /* change palette string */
|
||||
/* Does nothing here */
|
||||
}
|
||||
|
||||
#if COLOR
|
||||
tcapfcol()
|
||||
static void tcapfcol(void)
|
||||
{ /* no colors here, ignore this */
|
||||
}
|
||||
|
||||
tcapbcol()
|
||||
static void tcapbcol(void)
|
||||
{ /* no colors here, ignore this */
|
||||
}
|
||||
#endif
|
||||
|
||||
tcapbeep()
|
||||
static void tcapbeep(void)
|
||||
{
|
||||
ttputc(BEL);
|
||||
}
|
||||
|
||||
putpad(str)
|
||||
char *str;
|
||||
static void putpad(char *str)
|
||||
{
|
||||
tputs(str, 1, ttputc);
|
||||
}
|
||||
|
||||
putnpad(str, n)
|
||||
char *str;
|
||||
static void putnpad(char *str, int n)
|
||||
{
|
||||
tputs(str, n, ttputc);
|
||||
}
|
||||
|
||||
|
||||
#if FNLABEL
|
||||
fnclabel(f, n)
|
||||
/* label a function key */
|
||||
int f, n; /* default flag, numeric argument [unused] */
|
||||
|
||||
/*
|
||||
* label a function key
|
||||
*
|
||||
* int f, n; default flag, numeric argument [unused]
|
||||
*/
|
||||
static int fnclabel(int f, int n)
|
||||
{
|
||||
/* on machines with no function keys...don't bother */
|
||||
return (TRUE);
|
||||
@ -371,7 +377,7 @@ int f, n; /* default flag, numeric argument [unused] */
|
||||
#endif
|
||||
#else
|
||||
|
||||
hello()
|
||||
static void hello(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user