mirror of
https://github.com/rfivet/uemacs.git
synced 2024-12-18 23:36:23 -05:00
First cut at turning things into proper modern ANSI C
Hey! Real declarations!
This commit is contained in:
parent
118ee5f944
commit
9605cf8826
71
basic.c
71
basic.c
@ -18,7 +18,7 @@
|
|||||||
* beginning of the current line.
|
* beginning of the current line.
|
||||||
* Trivial.
|
* Trivial.
|
||||||
*/
|
*/
|
||||||
gotobol(f, n)
|
int gotobol(int f, int n)
|
||||||
{
|
{
|
||||||
curwp->w_doto = 0;
|
curwp->w_doto = 0;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -30,8 +30,7 @@ gotobol(f, n)
|
|||||||
* location. Error if you try and move out of the buffer. Set the flag if the
|
* location. Error if you try and move out of the buffer. Set the flag if the
|
||||||
* line pointer for dot changes.
|
* line pointer for dot changes.
|
||||||
*/
|
*/
|
||||||
backchar(f, n)
|
int backchar(int f, int n)
|
||||||
register int n;
|
|
||||||
{
|
{
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ register int n;
|
|||||||
/*
|
/*
|
||||||
* Move the cursor to the end of the current line. Trivial. No errors.
|
* Move the cursor to the end of the current line. Trivial. No errors.
|
||||||
*/
|
*/
|
||||||
gotoeol(f, n)
|
int gotoeol(int f, int n)
|
||||||
{
|
{
|
||||||
curwp->w_doto = llength(curwp->w_dotp);
|
curwp->w_doto = llength(curwp->w_dotp);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -65,8 +64,7 @@ gotoeol(f, n)
|
|||||||
* location, and move ".". Error if you try and move off the end of the
|
* location, and move ".". Error if you try and move off the end of the
|
||||||
* buffer. Set the flag if the line pointer for dot changes.
|
* buffer. Set the flag if the line pointer for dot changes.
|
||||||
*/
|
*/
|
||||||
forwchar(f, n)
|
int forwchar(int f, int n)
|
||||||
register int n;
|
|
||||||
{
|
{
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return (backchar(f, -n));
|
return (backchar(f, -n));
|
||||||
@ -83,10 +81,14 @@ register int n;
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoline(f, n)
|
/*
|
||||||
{ /* move to a particular line.
|
* move to a particular line.
|
||||||
argument (n) must be a positive integer for
|
*
|
||||||
this to actually do anything */
|
* argument (n) must be a positive integer for
|
||||||
|
* this to actually do anything
|
||||||
|
*/
|
||||||
|
int gotoline(int f, int n)
|
||||||
|
{
|
||||||
register int status; /* status return */
|
register int status; /* status return */
|
||||||
char arg[NSTRING]; /* buffer to hold argument */
|
char arg[NSTRING]; /* buffer to hold argument */
|
||||||
|
|
||||||
@ -114,7 +116,7 @@ gotoline(f, n)
|
|||||||
* considered to be hard motion; it really isn't if the original value of dot
|
* considered to be hard motion; it really isn't if the original value of dot
|
||||||
* is the same as the new value of dot. Normally bound to "M-<".
|
* is the same as the new value of dot. Normally bound to "M-<".
|
||||||
*/
|
*/
|
||||||
gotobob(f, n)
|
int gotobob(int f, int n)
|
||||||
{
|
{
|
||||||
curwp->w_dotp = lforw(curbp->b_linep);
|
curwp->w_dotp = lforw(curbp->b_linep);
|
||||||
curwp->w_doto = 0;
|
curwp->w_doto = 0;
|
||||||
@ -127,7 +129,7 @@ gotobob(f, n)
|
|||||||
* (ZJ). The standard screen code does most of the hard parts of update.
|
* (ZJ). The standard screen code does most of the hard parts of update.
|
||||||
* Bound to "M->".
|
* Bound to "M->".
|
||||||
*/
|
*/
|
||||||
gotoeob(f, n)
|
int gotoeob(int f, int n)
|
||||||
{
|
{
|
||||||
curwp->w_dotp = curbp->b_linep;
|
curwp->w_dotp = curbp->b_linep;
|
||||||
curwp->w_doto = 0;
|
curwp->w_doto = 0;
|
||||||
@ -141,7 +143,7 @@ gotoeob(f, n)
|
|||||||
* controls how the goal column is set. Bound to "C-N". No errors are
|
* controls how the goal column is set. Bound to "C-N". No errors are
|
||||||
* possible.
|
* possible.
|
||||||
*/
|
*/
|
||||||
forwline(f, n)
|
int forwline(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *dlp;
|
register LINE *dlp;
|
||||||
|
|
||||||
@ -178,7 +180,7 @@ forwline(f, n)
|
|||||||
* alternate. Figure out the new line and call "movedot" to perform the
|
* alternate. Figure out the new line and call "movedot" to perform the
|
||||||
* motion. No errors are possible. Bound to "C-P".
|
* motion. No errors are possible. Bound to "C-P".
|
||||||
*/
|
*/
|
||||||
backline(f, n)
|
int backline(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *dlp;
|
register LINE *dlp;
|
||||||
|
|
||||||
@ -211,12 +213,14 @@ backline(f, n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
gotobop(f, n)
|
/*
|
||||||
/* go back to the beginning of the current paragraph
|
* go back to the beginning of the current paragraph
|
||||||
here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
|
* here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
|
||||||
combination to delimit the beginning of a paragraph */
|
* combination to delimit the beginning of a paragraph
|
||||||
int f, n; /* default Flag & Numeric argument */
|
*
|
||||||
|
* int f, n; default Flag & Numeric argument
|
||||||
|
*/
|
||||||
|
int gotobop(int f, int n)
|
||||||
{
|
{
|
||||||
register int suc; /* success of last backchar */
|
register int suc; /* success of last backchar */
|
||||||
|
|
||||||
@ -256,12 +260,14 @@ int f, n; /* default Flag & Numeric argument */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gotoeop(f, n)
|
/*
|
||||||
/* go forword to the end of the current paragraph
|
* go forword to the end of the current paragraph
|
||||||
here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
|
* here we look for a <NL><NL> or <NL><TAB> or <NL><SPACE>
|
||||||
combination to delimit the beginning of a paragraph */
|
* combination to delimit the beginning of a paragraph
|
||||||
int f, n; /* default Flag & Numeric argument */
|
*
|
||||||
|
* int f, n; default Flag & Numeric argument
|
||||||
|
*/
|
||||||
|
int gotoeop(int f, int n)
|
||||||
{
|
{
|
||||||
register int suc; /* success of last backchar */
|
register int suc; /* success of last backchar */
|
||||||
|
|
||||||
@ -312,8 +318,7 @@ int f, n; /* default Flag & Numeric argument */
|
|||||||
* column, return the best choice for the offset. The offset is returned.
|
* column, return the best choice for the offset. The offset is returned.
|
||||||
* Used by "C-N" and "C-P".
|
* Used by "C-N" and "C-P".
|
||||||
*/
|
*/
|
||||||
getgoal(dlp)
|
int getgoal(LINE *dlp)
|
||||||
register LINE *dlp;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register int col;
|
register int col;
|
||||||
@ -344,8 +349,7 @@ register LINE *dlp;
|
|||||||
* the overlap; this value is the default overlap value in ITS EMACS. Because
|
* the overlap; this value is the default overlap value in ITS EMACS. Because
|
||||||
* this zaps the top line in the display window, we have to do a hard update.
|
* this zaps the top line in the display window, we have to do a hard update.
|
||||||
*/
|
*/
|
||||||
forwpage(f, n)
|
int forwpage(int f, int n)
|
||||||
register int n;
|
|
||||||
{
|
{
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
|
|
||||||
@ -387,8 +391,7 @@ register int n;
|
|||||||
* EMACS manual. Bound to "M-V". We do a hard update for exactly the same
|
* EMACS manual. Bound to "M-V". We do a hard update for exactly the same
|
||||||
* reason.
|
* reason.
|
||||||
*/
|
*/
|
||||||
backpage(f, n)
|
int backpage(int f, int n)
|
||||||
register int n;
|
|
||||||
{
|
{
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
|
|
||||||
@ -428,7 +431,7 @@ register int n;
|
|||||||
* Set the mark in the current window to the value of "." in the window. No
|
* Set the mark in the current window to the value of "." in the window. No
|
||||||
* errors are possible. Bound to "M-.".
|
* errors are possible. Bound to "M-.".
|
||||||
*/
|
*/
|
||||||
setmark(f, n)
|
int setmark(int f, int n)
|
||||||
{
|
{
|
||||||
curwp->w_markp = curwp->w_dotp;
|
curwp->w_markp = curwp->w_dotp;
|
||||||
curwp->w_marko = curwp->w_doto;
|
curwp->w_marko = curwp->w_doto;
|
||||||
@ -442,7 +445,7 @@ setmark(f, n)
|
|||||||
* that moves the mark about. The only possible error is "no mark". Bound to
|
* that moves the mark about. The only possible error is "no mark". Bound to
|
||||||
* "C-X C-X".
|
* "C-X C-X".
|
||||||
*/
|
*/
|
||||||
swapmark(f, n)
|
int swapmark(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *odotp;
|
register LINE *odotp;
|
||||||
register int odoto;
|
register int odoto;
|
||||||
|
279
display.c
279
display.c
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include "estruct.h"
|
#include "estruct.h"
|
||||||
#include "edef.h"
|
#include "edef.h"
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ int chg_width, chg_height;
|
|||||||
* The original window has "WFCHG" set, so that it will get completely
|
* The original window has "WFCHG" set, so that it will get completely
|
||||||
* redrawn on the first call to "update".
|
* redrawn on the first call to "update".
|
||||||
*/
|
*/
|
||||||
vtinit()
|
void vtinit(void)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
register VIDEO *vp;
|
register VIDEO *vp;
|
||||||
@ -99,7 +100,7 @@ vtinit()
|
|||||||
#if CLEAN
|
#if CLEAN
|
||||||
/* free up all the dynamically allocated video structures */
|
/* free up all the dynamically allocated video structures */
|
||||||
|
|
||||||
vtfree()
|
void vtfree(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < term.t_mrow; ++i) {
|
for (i = 0; i < term.t_mrow; ++i) {
|
||||||
@ -121,7 +122,7 @@ vtfree()
|
|||||||
* system prompt will be written in the line). Shut down the channel to the
|
* system prompt will be written in the line). Shut down the channel to the
|
||||||
* terminal.
|
* terminal.
|
||||||
*/
|
*/
|
||||||
vttidy()
|
void vttidy(void)
|
||||||
{
|
{
|
||||||
mlerase();
|
mlerase();
|
||||||
movecursor(term.t_nrow, 0);
|
movecursor(term.t_nrow, 0);
|
||||||
@ -138,23 +139,21 @@ vttidy()
|
|||||||
* screen. There is no checking for nonsense values; this might be a good
|
* screen. There is no checking for nonsense values; this might be a good
|
||||||
* idea during the early stages.
|
* idea during the early stages.
|
||||||
*/
|
*/
|
||||||
vtmove(row, col)
|
void vtmove(int row, int col)
|
||||||
{
|
{
|
||||||
vtrow = row;
|
vtrow = row;
|
||||||
vtcol = col;
|
vtcol = col;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write a character to the virtual screen. The virtual row and
|
/*
|
||||||
column are updated. If we are not yet on left edge, don't print
|
* Write a character to the virtual screen. The virtual row and
|
||||||
it yet. If the line is too long put a "$" in the last column.
|
* column are updated. If we are not yet on left edge, don't print
|
||||||
This routine only puts printing characters into the virtual
|
* it yet. If the line is too long put a "$" in the last column.
|
||||||
terminal buffers. Only column overflow is checked.
|
*
|
||||||
*/
|
* This routine only puts printing characters into the virtual
|
||||||
|
* terminal buffers. Only column overflow is checked.
|
||||||
vtputc(c)
|
*/
|
||||||
|
void vtputc(int c)
|
||||||
int c;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register VIDEO *vp; /* ptr to line being updated */
|
register VIDEO *vp; /* ptr to line being updated */
|
||||||
|
|
||||||
@ -183,7 +182,7 @@ int c;
|
|||||||
* Erase from the end of the software cursor to the end of the line on which
|
* Erase from the end of the software cursor to the end of the line on which
|
||||||
* the software cursor is located.
|
* the software cursor is located.
|
||||||
*/
|
*/
|
||||||
vteeol()
|
void vteeol(void)
|
||||||
{
|
{
|
||||||
/* register VIDEO *vp; */
|
/* register VIDEO *vp; */
|
||||||
register char *vcp = vscreen[vtrow]->v_text;
|
register char *vcp = vscreen[vtrow]->v_text;
|
||||||
@ -194,10 +193,12 @@ vteeol()
|
|||||||
vcp[vtcol++] = ' ';
|
vcp[vtcol++] = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* upscreen: user routine to force a screen update
|
/*
|
||||||
always finishes complete update */
|
* upscreen:
|
||||||
|
* user routine to force a screen update
|
||||||
upscreen(f, n)
|
* always finishes complete update
|
||||||
|
*/
|
||||||
|
int upscreen(int f, int n)
|
||||||
{
|
{
|
||||||
update(TRUE);
|
update(TRUE);
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@ -213,11 +214,10 @@ int scrflags;
|
|||||||
* and refresh the screen. Second, make sure that "currow" and "curcol" are
|
* and refresh the screen. Second, make sure that "currow" and "curcol" are
|
||||||
* correct for the current window. Third, make the virtual and physical
|
* correct for the current window. Third, make the virtual and physical
|
||||||
* screens the same.
|
* screens the same.
|
||||||
|
*
|
||||||
|
* int force; force update past type ahead?
|
||||||
*/
|
*/
|
||||||
update(force)
|
int update(int force)
|
||||||
|
|
||||||
int force; /* force update past type ahead? */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
|
|
||||||
@ -314,13 +314,12 @@ int force; /* force update past type ahead? */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reframe: check to see if the cursor is on in the window
|
/*
|
||||||
and re-frame it if needed or wanted */
|
* reframe:
|
||||||
|
* check to see if the cursor is on in the window
|
||||||
reframe(wp)
|
* and re-frame it if needed or wanted
|
||||||
|
*/
|
||||||
WINDOW *wp;
|
int reframe(WINDOW *wp)
|
||||||
|
|
||||||
{
|
{
|
||||||
register LINE *lp, *lp0;
|
register LINE *lp, *lp0;
|
||||||
register int i;
|
register int i;
|
||||||
@ -404,12 +403,13 @@ WINDOW *wp;
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* updone: update the current line to the virtual screen */
|
/*
|
||||||
|
* updone:
|
||||||
updone(wp)
|
* update the current line to the virtual screen
|
||||||
|
*
|
||||||
WINDOW *wp; /* window to update current line in */
|
* WINDOW *wp; window to update current line in
|
||||||
|
*/
|
||||||
|
void updone(WINDOW *wp)
|
||||||
{
|
{
|
||||||
register LINE *lp; /* line to update */
|
register LINE *lp; /* line to update */
|
||||||
register int sline; /* physical screen line to update */
|
register int sline; /* physical screen line to update */
|
||||||
@ -436,12 +436,13 @@ WINDOW *wp; /* window to update current line in */
|
|||||||
vteeol();
|
vteeol();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* updall: update all the lines in a window on the virtual screen */
|
/*
|
||||||
|
* updall:
|
||||||
updall(wp)
|
* update all the lines in a window on the virtual screen
|
||||||
|
*
|
||||||
WINDOW *wp; /* window to update lines in */
|
* WINDOW *wp; window to update lines in
|
||||||
|
*/
|
||||||
|
void updall(WINDOW *wp)
|
||||||
{
|
{
|
||||||
register LINE *lp; /* line to update */
|
register LINE *lp; /* line to update */
|
||||||
register int sline; /* physical screen line to update */
|
register int sline; /* physical screen line to update */
|
||||||
@ -474,10 +475,12 @@ WINDOW *wp; /* window to update lines in */
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* updpos: update the position of the hardware cursor and handle extended
|
/*
|
||||||
lines. This is the only update for simple moves. */
|
* updpos:
|
||||||
|
* update the position of the hardware cursor and handle extended
|
||||||
updpos()
|
* lines. This is the only update for simple moves.
|
||||||
|
*/
|
||||||
|
void updpos(void)
|
||||||
{
|
{
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
register int c;
|
register int c;
|
||||||
@ -512,9 +515,11 @@ updpos()
|
|||||||
lbound = 0;
|
lbound = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* upddex: de-extend any line that derserves it */
|
/*
|
||||||
|
* upddex:
|
||||||
upddex()
|
* de-extend any line that derserves it
|
||||||
|
*/
|
||||||
|
void upddex(void)
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
@ -548,10 +553,12 @@ upddex()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* updgar: if the screen is garbage, clear the physical screen and
|
/*
|
||||||
the virtual screen and force a full update */
|
* updgar:
|
||||||
|
* if the screen is garbage, clear the physical screen and
|
||||||
updgar()
|
* the virtual screen and force a full update
|
||||||
|
*/
|
||||||
|
void updgar(void)
|
||||||
{
|
{
|
||||||
register char *txt;
|
register char *txt;
|
||||||
register int i, j;
|
register int i, j;
|
||||||
@ -581,12 +588,13 @@ updgar()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* updupd: update the physical screen from the virtual screen */
|
/*
|
||||||
|
* updupd:
|
||||||
updupd(force)
|
* update the physical screen from the virtual screen
|
||||||
|
*
|
||||||
int force; /* forced update flag */
|
* int force; forced update flag
|
||||||
|
*/
|
||||||
|
int updupd(int force)
|
||||||
{
|
{
|
||||||
register VIDEO *vp1;
|
register VIDEO *vp1;
|
||||||
register int i;
|
register int i;
|
||||||
@ -620,9 +628,11 @@ int force; /* forced update flag */
|
|||||||
|
|
||||||
#if SCROLLCODE
|
#if SCROLLCODE
|
||||||
|
|
||||||
/* optimize out scrolls (line breaks, and newlines) */
|
/*
|
||||||
/* arg. chooses between looking for inserts or deletes */
|
* optimize out scrolls (line breaks, and newlines)
|
||||||
int scrolls(inserts)
|
* arg. chooses between looking for inserts or deletes
|
||||||
|
*/
|
||||||
|
int scrolls(int inserts)
|
||||||
{ /* returns true if it does something */
|
{ /* returns true if it does something */
|
||||||
struct VIDEO *vpv; /* virtual screen image */
|
struct VIDEO *vpv; /* virtual screen image */
|
||||||
struct VIDEO *vpp; /* physical screen image */
|
struct VIDEO *vpp; /* physical screen image */
|
||||||
@ -758,14 +768,18 @@ int scrolls(inserts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* move the "count" lines starting at "from" to "to" */
|
/* move the "count" lines starting at "from" to "to" */
|
||||||
scrscroll(from, to, count)
|
void scrscroll(int from, int to, int count)
|
||||||
{
|
{
|
||||||
ttrow = ttcol = -1;
|
ttrow = ttcol = -1;
|
||||||
(*term.t_scroll) (from, to, count);
|
(*term.t_scroll) (from, to, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
texttest(vrow, prow) /* return TRUE on text match */
|
/*
|
||||||
int vrow, prow; /* virtual, physical rows */
|
* return TRUE on text match
|
||||||
|
*
|
||||||
|
* int vrow, prow; virtual, physical rows
|
||||||
|
*/
|
||||||
|
int texttest(int vrow, int prow)
|
||||||
{
|
{
|
||||||
struct VIDEO *vpv = vscreen[vrow]; /* virtual screen image */
|
struct VIDEO *vpv = vscreen[vrow]; /* virtual screen image */
|
||||||
struct VIDEO *vpp = pscreen[prow]; /* physical screen image */
|
struct VIDEO *vpp = pscreen[prow]; /* physical screen image */
|
||||||
@ -773,9 +787,10 @@ int vrow, prow; /* virtual, physical rows */
|
|||||||
return (!memcmp(vpv->v_text, vpp->v_text, term.t_ncol));
|
return (!memcmp(vpv->v_text, vpp->v_text, term.t_ncol));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the index of the first blank of trailing whitespace */
|
/*
|
||||||
int endofline(s, n)
|
* return the index of the first blank of trailing whitespace
|
||||||
char *s;
|
*/
|
||||||
|
int endofline(char *s, int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = n - 1; i >= 0; i--)
|
for (i = n - 1; i >= 0; i--)
|
||||||
@ -786,13 +801,14 @@ char *s;
|
|||||||
|
|
||||||
#endif /* SCROLLCODE */
|
#endif /* SCROLLCODE */
|
||||||
|
|
||||||
/* updext: update the extended line which the cursor is currently
|
/*
|
||||||
on at a column greater than the terminal width. The line
|
* updext:
|
||||||
will be scrolled right or left to let the user see where
|
* update the extended line which the cursor is currently
|
||||||
the cursor is
|
* on at a column greater than the terminal width. The line
|
||||||
*/
|
* will be scrolled right or left to let the user see where
|
||||||
|
* the cursor is
|
||||||
updext()
|
*/
|
||||||
|
void updext(void)
|
||||||
{
|
{
|
||||||
register int rcursor; /* real cursor location */
|
register int rcursor; /* real cursor location */
|
||||||
register LINE *lp; /* pointer to current line */
|
register LINE *lp; /* pointer to current line */
|
||||||
@ -870,12 +886,14 @@ struct VIDEO *vp2;
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
updateline(row, vp1, vp2)
|
/*
|
||||||
|
* updateline()
|
||||||
int row; /* row of screen to update */
|
*
|
||||||
struct VIDEO *vp1; /* virtual screen image */
|
* int row; row of screen to update
|
||||||
struct VIDEO *vp2; /* physical screen image */
|
* struct VIDEO *vp1; virtual screen image
|
||||||
|
* struct VIDEO *vp2; physical screen image
|
||||||
|
*/
|
||||||
|
int updateline(int row, struct VIDEO *vp1, struct VIDEO *vp2)
|
||||||
{
|
{
|
||||||
#if RAINBOW
|
#if RAINBOW
|
||||||
/* UPDATELINE specific code for the DEC rainbow 100 micro */
|
/* UPDATELINE specific code for the DEC rainbow 100 micro */
|
||||||
@ -1035,8 +1053,7 @@ struct VIDEO *vp2; /* physical screen image */
|
|||||||
* change the modeline format by hacking at this routine. Called by "update"
|
* change the modeline format by hacking at this routine. Called by "update"
|
||||||
* any time there is a dirty window.
|
* any time there is a dirty window.
|
||||||
*/
|
*/
|
||||||
modeline(wp)
|
void modeline(WINDOW *wp)
|
||||||
WINDOW *wp;
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
register int c;
|
register int c;
|
||||||
@ -1225,7 +1242,7 @@ WINDOW *wp;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
upmode()
|
void upmode(void)
|
||||||
{ /* update all the mode lines */
|
{ /* update all the mode lines */
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
|
|
||||||
@ -1241,7 +1258,7 @@ upmode()
|
|||||||
* and column "col". The row and column arguments are origin 0. Optimize out
|
* and column "col". The row and column arguments are origin 0. Optimize out
|
||||||
* random calls. Update "ttrow" and "ttcol".
|
* random calls. Update "ttrow" and "ttcol".
|
||||||
*/
|
*/
|
||||||
movecursor(row, col)
|
void movecursor(int row, int col)
|
||||||
{
|
{
|
||||||
if (row != ttrow || col != ttcol) {
|
if (row != ttrow || col != ttcol) {
|
||||||
ttrow = row;
|
ttrow = row;
|
||||||
@ -1255,7 +1272,7 @@ movecursor(row, col)
|
|||||||
* is not considered to be part of the virtual screen. It always works
|
* is not considered to be part of the virtual screen. It always works
|
||||||
* immediately; the terminal buffer is flushed via a call to the flusher.
|
* immediately; the terminal buffer is flushed via a call to the flusher.
|
||||||
*/
|
*/
|
||||||
mlerase()
|
void mlerase(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1284,16 +1301,14 @@ mlerase()
|
|||||||
* position. A small class of printf like format items is handled. Assumes the
|
* position. A small class of printf like format items is handled. Assumes the
|
||||||
* stack grows down; this assumption is made by the "++" in the argument scan
|
* stack grows down; this assumption is made by the "++" in the argument scan
|
||||||
* loop. Set the "message line" flag TRUE.
|
* loop. Set the "message line" flag TRUE.
|
||||||
|
*
|
||||||
|
* char *fmt; format string for output
|
||||||
|
* char *arg; pointer to first argument to print
|
||||||
*/
|
*/
|
||||||
|
void mlwrite(const char *fmt, ...)
|
||||||
mlwrite(fmt, arg)
|
|
||||||
|
|
||||||
char *fmt; /* format string for output */
|
|
||||||
char *arg; /* pointer to first argument to print */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register int c; /* current char in format string */
|
register int c; /* current char in format string */
|
||||||
register char *ap; /* ptr to current data field */
|
va_list ap;
|
||||||
|
|
||||||
/* if we are not currently echoing on the command line, abort this */
|
/* if we are not currently echoing on the command line, abort this */
|
||||||
if (discmd == FALSE) {
|
if (discmd == FALSE) {
|
||||||
@ -1313,7 +1328,7 @@ char *arg; /* pointer to first argument to print */
|
|||||||
}
|
}
|
||||||
|
|
||||||
movecursor(term.t_nrow, 0);
|
movecursor(term.t_nrow, 0);
|
||||||
ap = (char *) &arg;
|
va_start(ap, fmt);
|
||||||
while ((c = *fmt++) != 0) {
|
while ((c = *fmt++) != 0) {
|
||||||
if (c != '%') {
|
if (c != '%') {
|
||||||
TTputc(c);
|
TTputc(c);
|
||||||
@ -1321,39 +1336,28 @@ char *arg; /* pointer to first argument to print */
|
|||||||
} else {
|
} else {
|
||||||
c = *fmt++;
|
c = *fmt++;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
#if PKCODE
|
|
||||||
case '*':
|
|
||||||
ap = *(char **) ap;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
case 'd':
|
case 'd':
|
||||||
mlputi(*(int *) ap, 10);
|
mlputi(va_arg(ap, int), 10);
|
||||||
ap += sizeof(int);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
mlputi(*(int *) ap, 8);
|
mlputi(va_arg(ap, int), 8);
|
||||||
ap += sizeof(int);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'x':
|
case 'x':
|
||||||
mlputi(*(int *) ap, 16);
|
mlputi(va_arg(ap, int), 16);
|
||||||
ap += sizeof(int);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
mlputli(*(long *) ap, 10);
|
mlputli(va_arg(ap, long), 10);
|
||||||
ap += sizeof(long);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
mlputs(*(char **) ap);
|
mlputs(va_arg(ap, char *));
|
||||||
ap += sizeof(char *);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
mlputf(*(int *) ap);
|
mlputf(va_arg(ap, int));
|
||||||
ap += sizeof(int);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1362,6 +1366,7 @@ char *arg; /* pointer to first argument to print */
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
/* if we can, erase to the end of screen */
|
/* if we can, erase to the end of screen */
|
||||||
if (eolexist == TRUE)
|
if (eolexist == TRUE)
|
||||||
@ -1370,15 +1375,14 @@ char *arg; /* pointer to first argument to print */
|
|||||||
mpresf = TRUE;
|
mpresf = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Force a string out to the message line regardless of the
|
/*
|
||||||
current $discmd setting. This is needed when $debug is TRUE
|
* Force a string out to the message line regardless of the
|
||||||
and for the write-message and clear-message-line commands
|
* current $discmd setting. This is needed when $debug is TRUE
|
||||||
*/
|
* and for the write-message and clear-message-line commands
|
||||||
|
*
|
||||||
mlforce(s)
|
* char *s; string to force out
|
||||||
|
*/
|
||||||
char *s; /* string to force out */
|
void mlforce(char *s)
|
||||||
|
|
||||||
{
|
{
|
||||||
register int oldcmd; /* original command display flag */
|
register int oldcmd; /* original command display flag */
|
||||||
|
|
||||||
@ -1393,8 +1397,7 @@ char *s; /* string to force out */
|
|||||||
* the characters in the string all have width "1"; if this is not the case
|
* the characters in the string all have width "1"; if this is not the case
|
||||||
* things will get screwed up a little.
|
* things will get screwed up a little.
|
||||||
*/
|
*/
|
||||||
mlputs(s)
|
void mlputs(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
@ -1408,7 +1411,7 @@ char *s;
|
|||||||
* Write out an integer, in the specified radix. Update the physical cursor
|
* Write out an integer, in the specified radix. Update the physical cursor
|
||||||
* position.
|
* position.
|
||||||
*/
|
*/
|
||||||
mlputi(i, r)
|
void mlputi(int i, int r)
|
||||||
{
|
{
|
||||||
register int q;
|
register int q;
|
||||||
static char hexdigits[] = "0123456789ABCDEF";
|
static char hexdigits[] = "0123456789ABCDEF";
|
||||||
@ -1430,8 +1433,7 @@ mlputi(i, r)
|
|||||||
/*
|
/*
|
||||||
* do the same except as a long integer.
|
* do the same except as a long integer.
|
||||||
*/
|
*/
|
||||||
mlputli(l, r)
|
void mlputli(long l, int r)
|
||||||
long l;
|
|
||||||
{
|
{
|
||||||
register long q;
|
register long q;
|
||||||
|
|
||||||
@ -1450,13 +1452,11 @@ long l;
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* write out a scaled integer with two decimal places
|
* write out a scaled integer with two decimal places
|
||||||
|
*
|
||||||
|
* int s; scaled integer to output
|
||||||
*/
|
*/
|
||||||
|
void mlputf(int s)
|
||||||
mlputf(s)
|
|
||||||
|
|
||||||
int s; /* scaled integer to output */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int i; /* integer portion of number */
|
int i; /* integer portion of number */
|
||||||
int f; /* fractional portion of number */
|
int f; /* fractional portion of number */
|
||||||
@ -1475,9 +1475,7 @@ int s; /* scaled integer to output */
|
|||||||
|
|
||||||
#if RAINBOW
|
#if RAINBOW
|
||||||
|
|
||||||
putline(row, col, buf)
|
void putline(int row, int col, char *buf)
|
||||||
int row, col;
|
|
||||||
char buf[];
|
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@ -1492,8 +1490,7 @@ char buf[];
|
|||||||
Store number of lines into *heightp and width into *widthp.
|
Store number of lines into *heightp and width into *widthp.
|
||||||
If zero or a negative number is stored, the value is not valid. */
|
If zero or a negative number is stored, the value is not valid. */
|
||||||
|
|
||||||
getscreensize(widthp, heightp)
|
void getscreensize(int *widthp, int *heightp)
|
||||||
int *widthp, *heightp;
|
|
||||||
{
|
{
|
||||||
#ifdef TIOCGWINSZ
|
#ifdef TIOCGWINSZ
|
||||||
struct winsize size;
|
struct winsize size;
|
||||||
@ -1510,8 +1507,7 @@ int *widthp, *heightp;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
void sizesignal(signr)
|
void sizesignal(int signr)
|
||||||
int signr;
|
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
extern int errno;
|
extern int errno;
|
||||||
@ -1526,14 +1522,13 @@ int signr;
|
|||||||
errno = old_errno;
|
errno = old_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
newscreensize(h, w)
|
int newscreensize(int h, int w)
|
||||||
int h, w;
|
|
||||||
{
|
{
|
||||||
/* do the change later */
|
/* do the change later */
|
||||||
if (displaying) {
|
if (displaying) {
|
||||||
chg_width = w;
|
chg_width = w;
|
||||||
chg_height = h;
|
chg_height = h;
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
chg_width = chg_height = 0;
|
chg_width = chg_height = 0;
|
||||||
if (h - 1 < term.t_mrow)
|
if (h - 1 < term.t_mrow)
|
||||||
|
164
edef.h
164
edef.h
@ -13,6 +13,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
struct VIDEO;
|
||||||
|
|
||||||
char *flook();
|
char *flook();
|
||||||
char *getctext();
|
char *getctext();
|
||||||
char *getfname();
|
char *getfname();
|
||||||
@ -320,3 +322,165 @@ extern char outline[]; /* global string to hold debug line text */
|
|||||||
#ifndef termdef
|
#ifndef termdef
|
||||||
extern TERM term; /* Terminal information. */
|
extern TERM term; /* Terminal information. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* word.c */
|
||||||
|
extern int wrapword(int f, int n);
|
||||||
|
extern int backword(int f, int n);
|
||||||
|
extern int forwword(int f, int n);
|
||||||
|
extern int upperword(int f, int n);
|
||||||
|
extern int lowerword(int f, int n);
|
||||||
|
extern int capword(int f, int n);
|
||||||
|
extern int delfword(int f, int n);
|
||||||
|
extern int delbword(int f, int n);
|
||||||
|
extern int inword(void);
|
||||||
|
extern int fillpara(int f, int n);
|
||||||
|
extern int justpara(int f, int n);
|
||||||
|
extern int killpara(int f, int n);
|
||||||
|
extern int wordcount(int f, int n);
|
||||||
|
|
||||||
|
/* line.c */
|
||||||
|
extern int lfree(LINE *lp);
|
||||||
|
extern int lchange(int flag);
|
||||||
|
extern int insspace(int f, int n);
|
||||||
|
extern int linstr(char *instr);
|
||||||
|
extern int linsert(int n, int c);
|
||||||
|
extern int lowrite(int c);
|
||||||
|
extern int lover(char *ostr);
|
||||||
|
extern int lnewline(void);
|
||||||
|
extern int ldelete(long n, int kflag);
|
||||||
|
extern char *getctext(void);
|
||||||
|
extern int putctext(char *iline);
|
||||||
|
extern int ldelnewline(void);
|
||||||
|
extern int kdelete(void);
|
||||||
|
extern int kinsert(int c);
|
||||||
|
extern int yank(int f, int n);
|
||||||
|
|
||||||
|
/* window.c */
|
||||||
|
extern int reposition(int f, int n);
|
||||||
|
extern int refresh(int f, int n);
|
||||||
|
extern int nextwind(int f, int n);
|
||||||
|
extern int prevwind(int f, int n);
|
||||||
|
extern int mvdnwind(int f, int n);
|
||||||
|
extern int mvupwind(int f, int n);
|
||||||
|
extern int onlywind(int f, int n);
|
||||||
|
extern int delwind(int f, int n);
|
||||||
|
extern int splitwind(int f, int n);
|
||||||
|
extern int enlargewind(int f, int n);
|
||||||
|
extern int shrinkwind(int f, int n);
|
||||||
|
extern int resize(int f, int n);
|
||||||
|
extern int scrnextup(int f, int n);
|
||||||
|
extern int scrnextdw(int f, int n);
|
||||||
|
extern int savewnd(int f, int n);
|
||||||
|
extern int restwnd(int f, int n);
|
||||||
|
extern int newsize(int f, int n);
|
||||||
|
extern int newwidth(int f, int n);
|
||||||
|
extern int getwpos(void);
|
||||||
|
extern int cknewwindow(void);
|
||||||
|
|
||||||
|
/* basic.c */
|
||||||
|
extern int gotobol(int f, int n);
|
||||||
|
extern int backchar(int f, int n);
|
||||||
|
extern int gotoeol(int f, int n);
|
||||||
|
extern int forwchar(int f, int n);
|
||||||
|
extern int gotoline(int f, int n);
|
||||||
|
extern int gotobob(int f, int n);
|
||||||
|
extern int gotoeob(int f, int n);
|
||||||
|
extern int forwline(int f, int n);
|
||||||
|
extern int backline(int f, int n);
|
||||||
|
extern int gotobop(int f, int n);
|
||||||
|
extern int gotoeop(int f, int n);
|
||||||
|
extern int getgoal(LINE *dlp);
|
||||||
|
extern int forwpage(int f, int n);
|
||||||
|
extern int backpage(int f, int n);
|
||||||
|
extern int setmark(int f, int n);
|
||||||
|
extern int swapmark(int f, int n);
|
||||||
|
|
||||||
|
/* random.c */
|
||||||
|
extern int tabsize; /* Tab size (0: use real tabs) */;
|
||||||
|
extern int setfillcol(int f, int n);
|
||||||
|
extern int showcpos(int f, int n);
|
||||||
|
extern int getcline(void);
|
||||||
|
extern int getccol(int bflg);
|
||||||
|
extern int setccol(int pos);
|
||||||
|
extern int twiddle(int f, int n);
|
||||||
|
extern int quote(int f, int n);
|
||||||
|
extern int tab(int f, int n);
|
||||||
|
extern int detab(int f, int n);
|
||||||
|
extern int entab(int f, int n);
|
||||||
|
extern int trim(int f, int n);
|
||||||
|
extern int openline(int f, int n);
|
||||||
|
extern int newline(int f, int n);
|
||||||
|
extern int cinsert(void);
|
||||||
|
extern int insbrace(int n, int c);
|
||||||
|
extern int insbrace(int n, int c);
|
||||||
|
extern int inspound(void);
|
||||||
|
extern int deblank(int f, int n);
|
||||||
|
extern int indent(int f, int n);
|
||||||
|
extern int forwdel(int f, int n);
|
||||||
|
extern int backdel(int f, int n);
|
||||||
|
extern int killtext(int f, int n);
|
||||||
|
extern int setmode(int f, int n);
|
||||||
|
extern int delmode(int f, int n);
|
||||||
|
extern int setgmode(int f, int n);
|
||||||
|
extern int delgmode(int f, int n);
|
||||||
|
extern int adjustmode(int kind, int global);
|
||||||
|
extern int clrmes(int f, int n);
|
||||||
|
extern int writemsg(int f, int n);
|
||||||
|
extern int getfence(int f, int n);
|
||||||
|
extern int fmatch(int ch);
|
||||||
|
extern int istring(int f, int n);
|
||||||
|
extern int ovstring(int f, int n);
|
||||||
|
|
||||||
|
/* main.c */
|
||||||
|
extern int edinit(char *bname);
|
||||||
|
extern int execute(int c, int f, int n);
|
||||||
|
extern int quickexit(int f, int n);
|
||||||
|
extern int quit(int f, int n);
|
||||||
|
extern int ctlxlp(int f, int n);
|
||||||
|
extern int ctlxrp(int f, int n);
|
||||||
|
extern int ctlxe(int f, int n);
|
||||||
|
extern int ctrlg(int f, int n);
|
||||||
|
extern int rdonly(void);
|
||||||
|
extern int resterr(void);
|
||||||
|
extern int nullproc(int f, int n);
|
||||||
|
extern int meta(int f, int n);
|
||||||
|
extern int cex(int f, int n);
|
||||||
|
extern int unarg(int f, int n);
|
||||||
|
extern int cexit(int status);
|
||||||
|
|
||||||
|
/* display.c */
|
||||||
|
extern void vtinit(void);
|
||||||
|
extern void vtfree(void);
|
||||||
|
extern void vttidy(void);
|
||||||
|
extern void vtmove(int row, int col);
|
||||||
|
extern void vtputc(int c);
|
||||||
|
extern void vteeol(void);
|
||||||
|
extern int upscreen(int f, int n);
|
||||||
|
extern int update(int force);
|
||||||
|
extern int reframe(WINDOW *wp);
|
||||||
|
extern void updone(WINDOW *wp);
|
||||||
|
extern void updall(WINDOW *wp);
|
||||||
|
extern void updpos(void);
|
||||||
|
extern void upddex(void);
|
||||||
|
extern void updgar(void);
|
||||||
|
extern int updupd(int force);
|
||||||
|
extern int scrolls(int inserts);
|
||||||
|
extern void scrscroll(int from, int to, int count);
|
||||||
|
extern int texttest(int vrow, int prow);
|
||||||
|
extern int endofline(char *s, int n);
|
||||||
|
extern void updext(void);
|
||||||
|
extern int updateline(int row, struct VIDEO *vp1, struct VIDEO *vp2);
|
||||||
|
extern void modeline(WINDOW *wp);
|
||||||
|
extern void upmode(void);
|
||||||
|
extern void movecursor(int row, int col);
|
||||||
|
extern void mlerase(void);
|
||||||
|
extern void mlwrite(const char *fmt, ...);
|
||||||
|
extern void mlforce(char *s);
|
||||||
|
extern void mlputs(char *s);
|
||||||
|
extern void mlputi(int i, int r);
|
||||||
|
extern void mlputli(long l, int r);
|
||||||
|
extern void mlputf(int s);
|
||||||
|
extern void putline(int row, int col, char *buf);
|
||||||
|
extern void getscreensize(int *widthp, int *heightp);
|
||||||
|
extern void sizesignal(int signr);
|
||||||
|
extern int newscreensize(int h, int w);
|
||||||
|
2
eval.c
2
eval.c
@ -573,7 +573,7 @@ char *value; /* value to set to */
|
|||||||
ldelete(1L, FALSE); /* delete 1 char */
|
ldelete(1L, FALSE); /* delete 1 char */
|
||||||
c = atoi(value);
|
c = atoi(value);
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
lnewline(FALSE, 1);
|
lnewline();
|
||||||
else
|
else
|
||||||
linsert(1, c);
|
linsert(1, c);
|
||||||
backchar(FALSE, 1);
|
backchar(FALSE, 1);
|
||||||
|
87
line.c
87
line.c
@ -26,10 +26,7 @@ int ykboff; /* offset into that chunk */
|
|||||||
* a pointer to the new block, or NULL if there isn't any memory left. Print a
|
* a pointer to the new block, or NULL if there isn't any memory left. Print a
|
||||||
* message in the message line if no space.
|
* message in the message line if no space.
|
||||||
*/
|
*/
|
||||||
LINE *lalloc(used)
|
LINE *lalloc(int used)
|
||||||
|
|
||||||
register int used;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
register int size;
|
register int size;
|
||||||
@ -52,8 +49,7 @@ register int used;
|
|||||||
* might be in. Release the memory. The buffers are updated too; the magic
|
* might be in. Release the memory. The buffers are updated too; the magic
|
||||||
* conditions described in the above comments don't hold here.
|
* conditions described in the above comments don't hold here.
|
||||||
*/
|
*/
|
||||||
lfree(lp)
|
int lfree(LINE *lp)
|
||||||
register LINE *lp;
|
|
||||||
{
|
{
|
||||||
register BUFFER *bp;
|
register BUFFER *bp;
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
@ -98,8 +94,7 @@ register LINE *lp;
|
|||||||
* displayed in more than 1 window we change EDIT t HARD. Set MODE if the
|
* displayed in more than 1 window we change EDIT t HARD. Set MODE if the
|
||||||
* mode line needs to be updated (the "*" has to be set).
|
* mode line needs to be updated (the "*" has to be set).
|
||||||
*/
|
*/
|
||||||
lchange(flag)
|
int lchange(int flag)
|
||||||
register int flag;
|
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
|
|
||||||
@ -117,10 +112,12 @@ register int flag;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
insspace(f, n)
|
/*
|
||||||
/* insert spaces forward into text */
|
* insert spaces forward into text
|
||||||
int f, n; /* default flag and numeric argument */
|
*
|
||||||
|
* int f, n; default flag and numeric argument
|
||||||
|
*/
|
||||||
|
int insspace(int f, int n)
|
||||||
{
|
{
|
||||||
linsert(n, ' ');
|
linsert(n, ' ');
|
||||||
backchar(f, n);
|
backchar(f, n);
|
||||||
@ -130,8 +127,7 @@ int f, n; /* default flag and numeric argument */
|
|||||||
* linstr -- Insert a string at the current point
|
* linstr -- Insert a string at the current point
|
||||||
*/
|
*/
|
||||||
|
|
||||||
linstr(instr)
|
int linstr(char *instr)
|
||||||
char *instr;
|
|
||||||
{
|
{
|
||||||
register int status = TRUE;
|
register int status = TRUE;
|
||||||
char tmpc;
|
char tmpc;
|
||||||
@ -161,7 +157,7 @@ char *instr;
|
|||||||
* well, and FALSE on errors.
|
* well, and FALSE on errors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
linsert(n, c)
|
int linsert(int n, int c)
|
||||||
{
|
{
|
||||||
register char *cp1;
|
register char *cp1;
|
||||||
register char *cp2;
|
register char *cp2;
|
||||||
@ -242,12 +238,9 @@ linsert(n, c)
|
|||||||
/*
|
/*
|
||||||
* Overwrite a character into the current line at the current position
|
* Overwrite a character into the current line at the current position
|
||||||
*
|
*
|
||||||
|
* int c; character to overwrite on current position
|
||||||
*/
|
*/
|
||||||
|
int lowrite(int c)
|
||||||
lowrite(c)
|
|
||||||
|
|
||||||
char c; /* character to overwrite on current position */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
if (curwp->w_doto < curwp->w_dotp->l_used &&
|
if (curwp->w_doto < curwp->w_dotp->l_used &&
|
||||||
(lgetc(curwp->w_dotp, curwp->w_doto) != '\t' ||
|
(lgetc(curwp->w_dotp, curwp->w_doto) != '\t' ||
|
||||||
@ -259,11 +252,7 @@ char c; /* character to overwrite on current position */
|
|||||||
/*
|
/*
|
||||||
* lover -- Overwrite a string at the current point
|
* lover -- Overwrite a string at the current point
|
||||||
*/
|
*/
|
||||||
|
int lover(char *ostr)
|
||||||
lover(ostr)
|
|
||||||
|
|
||||||
char *ostr;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register int status = TRUE;
|
register int status = TRUE;
|
||||||
char tmpc;
|
char tmpc;
|
||||||
@ -292,7 +281,7 @@ char *ostr;
|
|||||||
* update of dot and mark is a bit easier then in the above case, because the
|
* update of dot and mark is a bit easier then in the above case, because the
|
||||||
* split forces more updating.
|
* split forces more updating.
|
||||||
*/
|
*/
|
||||||
lnewline()
|
int lnewline(void)
|
||||||
{
|
{
|
||||||
register char *cp1;
|
register char *cp1;
|
||||||
register char *cp2;
|
register char *cp2;
|
||||||
@ -350,12 +339,11 @@ lnewline()
|
|||||||
* with end of lines, etc. It returns TRUE if all of the characters were
|
* with end of lines, etc. It returns TRUE if all of the characters were
|
||||||
* deleted, and FALSE if they were not (because dot ran into the end of the
|
* deleted, and FALSE if they were not (because dot ran into the end of the
|
||||||
* buffer. The "kflag" is TRUE if the text should be put in the kill buffer.
|
* buffer. The "kflag" is TRUE if the text should be put in the kill buffer.
|
||||||
|
*
|
||||||
|
* long n; # of chars to delete
|
||||||
|
* int kflag; put killed text in kill buffer flag
|
||||||
*/
|
*/
|
||||||
ldelete(n, kflag)
|
int ldelete(long n, int kflag)
|
||||||
|
|
||||||
long n; /* # of chars to delete */
|
|
||||||
int kflag; /* put killed text in kill buffer flag */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register char *cp1;
|
register char *cp1;
|
||||||
register char *cp2;
|
register char *cp2;
|
||||||
@ -419,11 +407,11 @@ int kflag; /* put killed text in kill buffer flag */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getctext: grab and return a string with the text of
|
/*
|
||||||
the current line
|
* getctext: grab and return a string with the text of
|
||||||
*/
|
* the current line
|
||||||
|
*/
|
||||||
char *getctext()
|
char *getctext(void)
|
||||||
{
|
{
|
||||||
register LINE *lp; /* line to copy */
|
register LINE *lp; /* line to copy */
|
||||||
register int size; /* length of line to return */
|
register int size; /* length of line to return */
|
||||||
@ -446,12 +434,13 @@ char *getctext()
|
|||||||
return (rline);
|
return (rline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* putctext: replace the current line with the passed in text */
|
/*
|
||||||
|
* putctext:
|
||||||
putctext(iline)
|
* replace the current line with the passed in text
|
||||||
|
*
|
||||||
char *iline; /* contents of new line */
|
* char *iline; contents of new line
|
||||||
|
*/
|
||||||
|
int putctext(char *iline)
|
||||||
{
|
{
|
||||||
register int status;
|
register int status;
|
||||||
|
|
||||||
@ -477,7 +466,7 @@ char *iline; /* contents of new line */
|
|||||||
* about in memory. Return FALSE on error and TRUE if all looks ok. Called by
|
* about in memory. Return FALSE on error and TRUE if all looks ok. Called by
|
||||||
* "ldelete" only.
|
* "ldelete" only.
|
||||||
*/
|
*/
|
||||||
ldelnewline()
|
int ldelnewline(void)
|
||||||
{
|
{
|
||||||
register char *cp1;
|
register char *cp1;
|
||||||
register char *cp2;
|
register char *cp2;
|
||||||
@ -561,7 +550,7 @@ ldelnewline()
|
|||||||
* new kill context is being created. The kill buffer array is released, just
|
* new kill context is being created. The kill buffer array is released, just
|
||||||
* in case the buffer has grown to immense size. No errors.
|
* in case the buffer has grown to immense size. No errors.
|
||||||
*/
|
*/
|
||||||
kdelete()
|
int kdelete(void)
|
||||||
{
|
{
|
||||||
KILL *kp; /* ptr to scan kill buffer chunk list */
|
KILL *kp; /* ptr to scan kill buffer chunk list */
|
||||||
|
|
||||||
@ -584,12 +573,10 @@ kdelete()
|
|||||||
/*
|
/*
|
||||||
* Insert a character to the kill buffer, allocating new chunks as needed.
|
* Insert a character to the kill buffer, allocating new chunks as needed.
|
||||||
* Return TRUE if all is well, and FALSE on errors.
|
* Return TRUE if all is well, and FALSE on errors.
|
||||||
|
*
|
||||||
|
* int c; character to insert in the kill buffer
|
||||||
*/
|
*/
|
||||||
|
int kinsert(int c)
|
||||||
kinsert(c)
|
|
||||||
|
|
||||||
int c; /* character to insert in the kill buffer */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
KILL *nchunk; /* ptr to newly malloced chunk */
|
KILL *nchunk; /* ptr to newly malloced chunk */
|
||||||
|
|
||||||
@ -616,7 +603,7 @@ int c; /* character to insert in the kill buffer */
|
|||||||
* is done by the standard insert routines. All you do is run the loop, and
|
* is done by the standard insert routines. All you do is run the loop, and
|
||||||
* check for errors. Bound to "C-Y".
|
* check for errors. Bound to "C-Y".
|
||||||
*/
|
*/
|
||||||
yank(f, n)
|
int yank(int f, int n)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register int i;
|
register int i;
|
||||||
|
55
main.c
55
main.c
@ -89,13 +89,10 @@ extern void sizesignal();
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CALLED
|
#if CALLED
|
||||||
emacs(argc, argv)
|
int emacs(int argc, char **argv)
|
||||||
#else
|
#else
|
||||||
main(argc, argv)
|
int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
int argc; /* # of arguments */
|
|
||||||
char *argv[]; /* argument strings */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register int c; /* command character */
|
register int c; /* command character */
|
||||||
register int f; /* default flag */
|
register int f; /* default flag */
|
||||||
@ -430,8 +427,7 @@ char *argv[]; /* argument strings */
|
|||||||
* as an argument, because the main routine may have been told to read in a
|
* as an argument, because the main routine may have been told to read in a
|
||||||
* file by default, and we want the buffer name to be right.
|
* file by default, and we want the buffer name to be right.
|
||||||
*/
|
*/
|
||||||
edinit(bname)
|
int edinit(char *bname)
|
||||||
char bname[];
|
|
||||||
{
|
{
|
||||||
register BUFFER *bp;
|
register BUFFER *bp;
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
@ -469,7 +465,7 @@ char bname[];
|
|||||||
* and arranges to move it to the "lastflag", so that the next command can
|
* and arranges to move it to the "lastflag", so that the next command can
|
||||||
* look at it. Return the status of command.
|
* look at it. Return the status of command.
|
||||||
*/
|
*/
|
||||||
execute(c, f, n)
|
int execute(int c, int f, int n)
|
||||||
{
|
{
|
||||||
register int status;
|
register int status;
|
||||||
int (*execfunc) (); /* ptr to function to execute */
|
int (*execfunc) (); /* ptr to function to execute */
|
||||||
@ -560,7 +556,7 @@ execute(c, f, n)
|
|||||||
* Fancy quit command, as implemented by Norm. If the any buffer has
|
* Fancy quit command, as implemented by Norm. If the any buffer has
|
||||||
* changed do a write on that buffer and exit emacs, otherwise simply exit.
|
* changed do a write on that buffer and exit emacs, otherwise simply exit.
|
||||||
*/
|
*/
|
||||||
quickexit(f, n)
|
int quickexit(int f, int n)
|
||||||
{
|
{
|
||||||
register BUFFER *bp; /* scanning pointer to buffers */
|
register BUFFER *bp; /* scanning pointer to buffers */
|
||||||
register BUFFER *oldcb; /* original current buffer */
|
register BUFFER *oldcb; /* original current buffer */
|
||||||
@ -590,8 +586,7 @@ quickexit(f, n)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emergencyexit(signr)
|
static void emergencyexit(int signr)
|
||||||
int signr;
|
|
||||||
{
|
{
|
||||||
quickexit(FALSE, 0);
|
quickexit(FALSE, 0);
|
||||||
quit(TRUE, 0);
|
quit(TRUE, 0);
|
||||||
@ -601,7 +596,7 @@ int signr;
|
|||||||
* Quit command. If an argument, always quit. Otherwise confirm if a buffer
|
* Quit command. If an argument, always quit. Otherwise confirm if a buffer
|
||||||
* has been changed and not written out. Normally bound to "C-X C-C".
|
* has been changed and not written out. Normally bound to "C-X C-C".
|
||||||
*/
|
*/
|
||||||
quit(f, n)
|
int quit(int f, int n)
|
||||||
{
|
{
|
||||||
register int s;
|
register int s;
|
||||||
|
|
||||||
@ -634,7 +629,7 @@ quit(f, n)
|
|||||||
* Error if not at the top level in keyboard processing. Set up variables and
|
* Error if not at the top level in keyboard processing. Set up variables and
|
||||||
* return.
|
* return.
|
||||||
*/
|
*/
|
||||||
ctlxlp(f, n)
|
int ctlxlp(int f, int n)
|
||||||
{
|
{
|
||||||
if (kbdmode != STOP) {
|
if (kbdmode != STOP) {
|
||||||
mlwrite("%%Macro already active");
|
mlwrite("%%Macro already active");
|
||||||
@ -651,7 +646,7 @@ ctlxlp(f, n)
|
|||||||
* End keyboard macro. Check for the same limit conditions as the above
|
* End keyboard macro. Check for the same limit conditions as the above
|
||||||
* routine. Set up the variables and return to the caller.
|
* routine. Set up the variables and return to the caller.
|
||||||
*/
|
*/
|
||||||
ctlxrp(f, n)
|
int ctlxrp(int f, int n)
|
||||||
{
|
{
|
||||||
if (kbdmode == STOP) {
|
if (kbdmode == STOP) {
|
||||||
mlwrite("%%Macro not active");
|
mlwrite("%%Macro not active");
|
||||||
@ -669,7 +664,7 @@ ctlxrp(f, n)
|
|||||||
* The command argument is the number of times to loop. Quit as soon as a
|
* The command argument is the number of times to loop. Quit as soon as a
|
||||||
* command gets an error. Return TRUE if all ok, else FALSE.
|
* command gets an error. Return TRUE if all ok, else FALSE.
|
||||||
*/
|
*/
|
||||||
ctlxe(f, n)
|
int ctlxe(int f, int n)
|
||||||
{
|
{
|
||||||
if (kbdmode != STOP) {
|
if (kbdmode != STOP) {
|
||||||
mlwrite("%%Macro already active");
|
mlwrite("%%Macro already active");
|
||||||
@ -688,7 +683,7 @@ ctlxe(f, n)
|
|||||||
* Beep the beeper. Kill off any keyboard macro, etc., that is in progress.
|
* Beep the beeper. Kill off any keyboard macro, etc., that is in progress.
|
||||||
* Sometimes called as a routine, to do general aborting of stuff.
|
* Sometimes called as a routine, to do general aborting of stuff.
|
||||||
*/
|
*/
|
||||||
ctrlg(f, n)
|
int ctrlg(int f, int n)
|
||||||
{
|
{
|
||||||
TTbeep();
|
TTbeep();
|
||||||
kbdmode = STOP;
|
kbdmode = STOP;
|
||||||
@ -696,36 +691,37 @@ ctrlg(f, n)
|
|||||||
return (ABORT);
|
return (ABORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tell the user that this command is illegal while we are in
|
/*
|
||||||
VIEW (read-only) mode */
|
* tell the user that this command is illegal while we are in
|
||||||
|
* VIEW (read-only) mode
|
||||||
rdonly()
|
*/
|
||||||
|
int rdonly(void)
|
||||||
{
|
{
|
||||||
TTbeep();
|
TTbeep();
|
||||||
mlwrite("(Key illegal in VIEW mode)");
|
mlwrite("(Key illegal in VIEW mode)");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
resterr()
|
int resterr(void)
|
||||||
{
|
{
|
||||||
TTbeep();
|
TTbeep();
|
||||||
mlwrite("(That command is RESTRICTED)");
|
mlwrite("(That command is RESTRICTED)");
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
nullproc()
|
int nullproc(int f, int n)
|
||||||
{ /* user function that does NOTHING */
|
{ /* user function that does NOTHING */
|
||||||
}
|
}
|
||||||
|
|
||||||
meta()
|
int meta(int f, int n)
|
||||||
{ /* dummy function for binding to meta prefix */
|
{ /* dummy function for binding to meta prefix */
|
||||||
}
|
}
|
||||||
|
|
||||||
cex()
|
int cex(int f, int n)
|
||||||
{ /* dummy function for binding to control-x prefix */
|
{ /* dummy function for binding to control-x prefix */
|
||||||
}
|
}
|
||||||
|
|
||||||
unarg()
|
int unarg(int f, int n)
|
||||||
{ /* dummy function for binding to universal-argument */
|
{ /* dummy function for binding to universal-argument */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,10 +804,13 @@ dspram()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if CLEAN
|
#if CLEAN
|
||||||
cexit(status)
|
|
||||||
|
|
||||||
int status; /* return status of emacs */
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* cexit()
|
||||||
|
*
|
||||||
|
* int status; return status of emacs
|
||||||
|
*/
|
||||||
|
int cexit(int status)
|
||||||
{
|
{
|
||||||
register BUFFER *bp; /* buffer list pointer */
|
register BUFFER *bp; /* buffer list pointer */
|
||||||
register WINDOW *wp; /* window list pointer */
|
register WINDOW *wp; /* window list pointer */
|
||||||
|
238
random.c
238
random.c
@ -15,7 +15,7 @@ int tabsize; /* Tab size (0: use real tabs) */
|
|||||||
/*
|
/*
|
||||||
* Set fill column to n.
|
* Set fill column to n.
|
||||||
*/
|
*/
|
||||||
setfillcol(f, n)
|
int setfillcol(int f, int n)
|
||||||
{
|
{
|
||||||
fillcol = n;
|
fillcol = n;
|
||||||
mlwrite("(Fill column is %d)", n);
|
mlwrite("(Fill column is %d)", n);
|
||||||
@ -29,7 +29,7 @@ setfillcol(f, n)
|
|||||||
* column, but the column that would be used on an infinite width display.
|
* column, but the column that would be used on an infinite width display.
|
||||||
* Normally this is bound to "C-X =".
|
* Normally this is bound to "C-X =".
|
||||||
*/
|
*/
|
||||||
showcpos(f, n)
|
int showcpos(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *lp; /* current line */
|
register LINE *lp; /* current line */
|
||||||
register long numchars; /* # of chars in file */
|
register long numchars; /* # of chars in file */
|
||||||
@ -97,26 +97,13 @@ showcpos(f, n)
|
|||||||
ratio = (100L * predchars) / numchars;
|
ratio = (100L * predchars) / numchars;
|
||||||
|
|
||||||
/* summarize and report the info */
|
/* summarize and report the info */
|
||||||
#if PKCODE
|
|
||||||
pk_mlrec.pk_clin = predlines + 1;
|
|
||||||
pk_mlrec.pk_tlin = numlines + 1;
|
|
||||||
pk_mlrec.pk_ccol = col;
|
|
||||||
pk_mlrec.pk_tcol = ecol;
|
|
||||||
pk_mlrec.pk_cchr = predchars;
|
|
||||||
pk_mlrec.pk_tchr = numchars;
|
|
||||||
pk_mlrec.pk_perc = ratio;
|
|
||||||
pk_mlrec.pk_char = curchar;
|
|
||||||
mlwrite("%*Line %d/%d Col %d/%d Char %D/%D (%d%%) char = 0x%x",
|
|
||||||
&pk_mlrec);
|
|
||||||
#else
|
|
||||||
mlwrite("Line %d/%d Col %d/%d Char %D/%D (%d%%) char = 0x%x",
|
mlwrite("Line %d/%d Col %d/%d Char %D/%D (%d%%) char = 0x%x",
|
||||||
predlines + 1, numlines + 1, col, ecol,
|
predlines + 1, numlines + 1, col, ecol,
|
||||||
predchars, numchars, ratio, curchar);
|
predchars, numchars, ratio, curchar);
|
||||||
#endif
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
getcline()
|
int getcline(void)
|
||||||
{ /* get the current line number */
|
{ /* get the current line number */
|
||||||
register LINE *lp; /* current line */
|
register LINE *lp; /* current line */
|
||||||
register int numlines; /* # of lines before point */
|
register int numlines; /* # of lines before point */
|
||||||
@ -141,8 +128,7 @@ getcline()
|
|||||||
/*
|
/*
|
||||||
* Return current column. Stop at first non-blank given TRUE argument.
|
* Return current column. Stop at first non-blank given TRUE argument.
|
||||||
*/
|
*/
|
||||||
getccol(bflg)
|
int getccol(int bflg)
|
||||||
int bflg;
|
|
||||||
{
|
{
|
||||||
register int c, i, col;
|
register int c, i, col;
|
||||||
col = 0;
|
col = 0;
|
||||||
@ -161,11 +147,10 @@ int bflg;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Set current column.
|
* Set current column.
|
||||||
|
*
|
||||||
|
* int pos; position to set cursor
|
||||||
*/
|
*/
|
||||||
setccol(pos)
|
int setccol(int pos)
|
||||||
|
|
||||||
int pos; /* position to set cursor */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register int c; /* character being scanned */
|
register int c; /* character being scanned */
|
||||||
register int i; /* index into current line */
|
register int i; /* index into current line */
|
||||||
@ -204,7 +189,7 @@ int pos; /* position to set cursor */
|
|||||||
* work. This fixes up a very common typo with a single stroke. Normally bound
|
* work. This fixes up a very common typo with a single stroke. Normally bound
|
||||||
* to "C-T". This always works within a line, so "WFEDIT" is good enough.
|
* to "C-T". This always works within a line, so "WFEDIT" is good enough.
|
||||||
*/
|
*/
|
||||||
twiddle(f, n)
|
int twiddle(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *dotp;
|
register LINE *dotp;
|
||||||
register int doto;
|
register int doto;
|
||||||
@ -233,7 +218,7 @@ twiddle(f, n)
|
|||||||
* its line splitting meaning. The character is always read, even if it is
|
* its line splitting meaning. The character is always read, even if it is
|
||||||
* inserted 0 times, for regularity. Bound to "C-Q"
|
* inserted 0 times, for regularity. Bound to "C-Q"
|
||||||
*/
|
*/
|
||||||
quote(f, n)
|
int quote(int f, int n)
|
||||||
{
|
{
|
||||||
register int s;
|
register int s;
|
||||||
register int c;
|
register int c;
|
||||||
@ -261,7 +246,7 @@ quote(f, n)
|
|||||||
* done in this slightly funny way because the tab (in ASCII) has been turned
|
* done in this slightly funny way because the tab (in ASCII) has been turned
|
||||||
* into "C-I" (in 10 bit code) already. Bound to "C-I".
|
* into "C-I" (in 10 bit code) already. Bound to "C-I".
|
||||||
*/
|
*/
|
||||||
tab(f, n)
|
int tab(int f, int n)
|
||||||
{
|
{
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
@ -275,10 +260,12 @@ tab(f, n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if AEDIT
|
#if AEDIT
|
||||||
detab(f, n)
|
/*
|
||||||
/* change tabs to spaces */
|
* change tabs to spaces
|
||||||
int f, n; /* default flag and numeric repeat count */
|
*
|
||||||
|
* int f, n; default flag and numeric repeat count
|
||||||
|
*/
|
||||||
|
int detab(int f, int n)
|
||||||
{
|
{
|
||||||
register int inc; /* increment to next line [sgn(n)] */
|
register int inc; /* increment to next line [sgn(n)] */
|
||||||
|
|
||||||
@ -315,10 +302,12 @@ int f, n; /* default flag and numeric repeat count */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
entab(f, n)
|
/*
|
||||||
/* change spaces to tabs where posible */
|
* change spaces to tabs where posible
|
||||||
int f, n; /* default flag and numeric repeat count */
|
*
|
||||||
|
* int f, n; default flag and numeric repeat count
|
||||||
|
*/
|
||||||
|
int entab(int f, int n)
|
||||||
{
|
{
|
||||||
register int inc; /* increment to next line [sgn(n)] */
|
register int inc; /* increment to next line [sgn(n)] */
|
||||||
register int fspace; /* pointer to first space if in a run */
|
register int fspace; /* pointer to first space if in a run */
|
||||||
@ -386,10 +375,12 @@ int f, n; /* default flag and numeric repeat count */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
trim(f, n)
|
/*
|
||||||
/* trim trailing whitespace from the point to eol */
|
* trim trailing whitespace from the point to eol
|
||||||
int f, n; /* default flag and numeric repeat count */
|
*
|
||||||
|
* int f, n; default flag and numeric repeat count
|
||||||
|
*/
|
||||||
|
int trim(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *lp; /* current line pointer */
|
register LINE *lp; /* current line pointer */
|
||||||
register int offset; /* original line offset position */
|
register int offset; /* original line offset position */
|
||||||
@ -433,7 +424,7 @@ int f, n; /* default flag and numeric repeat count */
|
|||||||
* and then back up over them. Everything is done by the subcommand
|
* and then back up over them. Everything is done by the subcommand
|
||||||
* procerssors. They even handle the looping. Normally this is bound to "C-O".
|
* procerssors. They even handle the looping. Normally this is bound to "C-O".
|
||||||
*/
|
*/
|
||||||
openline(f, n)
|
int openline(int f, int n)
|
||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
register int s;
|
register int s;
|
||||||
@ -457,7 +448,7 @@ openline(f, n)
|
|||||||
* Insert a newline. Bound to "C-M". If we are in CMODE, do automatic
|
* Insert a newline. Bound to "C-M". If we are in CMODE, do automatic
|
||||||
* indentation as specified.
|
* indentation as specified.
|
||||||
*/
|
*/
|
||||||
newline(f, n)
|
int newline(int f, int n)
|
||||||
{
|
{
|
||||||
register int s;
|
register int s;
|
||||||
|
|
||||||
@ -492,7 +483,7 @@ newline(f, n)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cinsert()
|
int cinsert(void)
|
||||||
{ /* insert a newline and indentation for C */
|
{ /* insert a newline and indentation for C */
|
||||||
register char *cptr; /* string pointer into text to copy */
|
register char *cptr; /* string pointer into text to copy */
|
||||||
register int tptr; /* index to scan into line */
|
register int tptr; /* index to scan into line */
|
||||||
@ -534,11 +525,13 @@ cinsert()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if NBRACE
|
#if NBRACE
|
||||||
insbrace(n, c)
|
/*
|
||||||
/* insert a brace into the text here...we are in CMODE */
|
* insert a brace into the text here...we are in CMODE
|
||||||
int n; /* repeat count */
|
*
|
||||||
int c; /* brace to insert (always } for now) */
|
* int n; repeat count
|
||||||
|
* int c; brace to insert (always } for now)
|
||||||
|
*/
|
||||||
|
int insbrace(int n, int c)
|
||||||
{
|
{
|
||||||
register int ch; /* last character before input */
|
register int ch; /* last character before input */
|
||||||
register int oc; /* caractere oppose a c */
|
register int oc; /* caractere oppose a c */
|
||||||
@ -625,12 +618,16 @@ int c; /* brace to insert (always } for now) */
|
|||||||
/* and insert the required brace(s) */
|
/* and insert the required brace(s) */
|
||||||
return (linsert(n, c));
|
return (linsert(n, c));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
insbrace(n, c)
|
|
||||||
/* insert a brace into the text here...we are in CMODE */
|
|
||||||
int n; /* repeat count */
|
|
||||||
int c; /* brace to insert (always { for now) */
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/*
|
||||||
|
* insert a brace into the text here...we are in CMODE
|
||||||
|
*
|
||||||
|
* int n; repeat count
|
||||||
|
* int c; brace to insert (always { for now)
|
||||||
|
*/
|
||||||
|
int insbrace(int n, int c)
|
||||||
{
|
{
|
||||||
register int ch; /* last character before input */
|
register int ch; /* last character before input */
|
||||||
register int i;
|
register int i;
|
||||||
@ -659,7 +656,7 @@ int c; /* brace to insert (always { for now) */
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inspound()
|
int inspound(void)
|
||||||
{ /* insert a # into the text here...we are in CMODE */
|
{ /* insert a # into the text here...we are in CMODE */
|
||||||
register int ch; /* last character before input */
|
register int ch; /* last character before input */
|
||||||
register int i;
|
register int i;
|
||||||
@ -691,7 +688,7 @@ inspound()
|
|||||||
* the line. Normally this command is bound to "C-X C-O". Any argument is
|
* the line. Normally this command is bound to "C-X C-O". Any argument is
|
||||||
* ignored.
|
* ignored.
|
||||||
*/
|
*/
|
||||||
deblank(f, n)
|
int deblank(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *lp1;
|
register LINE *lp1;
|
||||||
register LINE *lp2;
|
register LINE *lp2;
|
||||||
@ -721,7 +718,7 @@ deblank(f, n)
|
|||||||
* of tabs and spaces. Return TRUE if all ok. Return FALSE if one of the
|
* of tabs and spaces. Return TRUE if all ok. Return FALSE if one of the
|
||||||
* subcomands failed. Normally bound to "C-J".
|
* subcomands failed. Normally bound to "C-J".
|
||||||
*/
|
*/
|
||||||
indent(f, n)
|
int indent(int f, int n)
|
||||||
{
|
{
|
||||||
register int nicol;
|
register int nicol;
|
||||||
register int c;
|
register int c;
|
||||||
@ -755,7 +752,7 @@ indent(f, n)
|
|||||||
* If any argument is present, it kills rather than deletes, to prevent loss
|
* If any argument is present, it kills rather than deletes, to prevent loss
|
||||||
* of text if typed with a big argument. Normally bound to "C-D".
|
* of text if typed with a big argument. Normally bound to "C-D".
|
||||||
*/
|
*/
|
||||||
forwdel(f, n)
|
int forwdel(int f, int n)
|
||||||
{
|
{
|
||||||
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
||||||
return (rdonly()); /* we are in read only mode */
|
return (rdonly()); /* we are in read only mode */
|
||||||
@ -775,7 +772,7 @@ forwdel(f, n)
|
|||||||
* forward, this actually does a kill if presented with an argument. Bound to
|
* forward, this actually does a kill if presented with an argument. Bound to
|
||||||
* both "RUBOUT" and "C-H".
|
* both "RUBOUT" and "C-H".
|
||||||
*/
|
*/
|
||||||
backdel(f, n)
|
int backdel(int f, int n)
|
||||||
{
|
{
|
||||||
register int s;
|
register int s;
|
||||||
|
|
||||||
@ -801,7 +798,7 @@ backdel(f, n)
|
|||||||
* number of newlines. If called with a negative argument it kills backwards
|
* number of newlines. If called with a negative argument it kills backwards
|
||||||
* that number of newlines. Normally bound to "C-K".
|
* that number of newlines. Normally bound to "C-K".
|
||||||
*/
|
*/
|
||||||
killtext(f, n)
|
int killtext(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *nextp;
|
register LINE *nextp;
|
||||||
long chunk;
|
long chunk;
|
||||||
@ -834,10 +831,12 @@ killtext(f, n)
|
|||||||
return (ldelete(chunk, TRUE));
|
return (ldelete(chunk, TRUE));
|
||||||
}
|
}
|
||||||
|
|
||||||
setmode(f, n)
|
/*
|
||||||
/* prompt and set an editor mode */
|
* prompt and set an editor mode
|
||||||
int f, n; /* default and argument */
|
*
|
||||||
|
* int f, n; default and argument
|
||||||
|
*/
|
||||||
|
int setmode(int f, int n)
|
||||||
{
|
{
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
return adjustmode(TRUE, FALSE);
|
return adjustmode(TRUE, FALSE);
|
||||||
@ -846,10 +845,12 @@ int f, n; /* default and argument */
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
delmode(f, n)
|
/*
|
||||||
/* prompt and delete an editor mode */
|
* prompt and delete an editor mode
|
||||||
int f, n; /* default and argument */
|
*
|
||||||
|
* int f, n; default and argument
|
||||||
|
*/
|
||||||
|
int delmode(int f, int n)
|
||||||
{
|
{
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
return adjustmode(FALSE, FALSE);
|
return adjustmode(FALSE, FALSE);
|
||||||
@ -858,10 +859,12 @@ int f, n; /* default and argument */
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
setgmode(f, n)
|
/*
|
||||||
/* prompt and set a global editor mode */
|
* prompt and set a global editor mode
|
||||||
int f, n; /* default and argument */
|
*
|
||||||
|
* int f, n; default and argument
|
||||||
|
*/
|
||||||
|
int setgmode(int f, int n)
|
||||||
{
|
{
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
return adjustmode(TRUE, TRUE);
|
return adjustmode(TRUE, TRUE);
|
||||||
@ -870,10 +873,12 @@ int f, n; /* default and argument */
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
delgmode(f, n)
|
/*
|
||||||
/* prompt and delete a global editor mode */
|
* prompt and delete a global editor mode
|
||||||
int f, n; /* default and argument */
|
*
|
||||||
|
* int f, n; default and argument
|
||||||
|
*/
|
||||||
|
int delgmode(int f, int n)
|
||||||
{
|
{
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
return adjustmode(FALSE, TRUE);
|
return adjustmode(FALSE, TRUE);
|
||||||
@ -882,10 +887,13 @@ int f, n; /* default and argument */
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustmode(kind, global)
|
/*
|
||||||
/* change the editor mode status */
|
* change the editor mode status
|
||||||
int kind; /* true = set, false = delete */
|
*
|
||||||
int global; /* true = global flag, false = current buffer flag */
|
* int kind; true = set, false = delete
|
||||||
|
* int global; true = global flag, false = current buffer flag
|
||||||
|
*/
|
||||||
|
int adjustmode(int kind, int global)
|
||||||
{
|
{
|
||||||
register char *scan; /* scanning pointer to convert prompt */
|
register char *scan; /* scanning pointer to convert prompt */
|
||||||
register int i; /* loop index */
|
register int i; /* loop index */
|
||||||
@ -983,25 +991,25 @@ int global; /* true = global flag, false = current buffer flag */
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function simply clears the message line,
|
/*
|
||||||
mainly for macro usage */
|
* This function simply clears the message line,
|
||||||
|
* mainly for macro usage
|
||||||
clrmes(f, n)
|
*
|
||||||
|
* int f, n; arguments ignored
|
||||||
int f, n; /* arguments ignored */
|
*/
|
||||||
|
int clrmes(int f, int n)
|
||||||
{
|
{
|
||||||
mlforce("");
|
mlforce("");
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function writes a string on the message line
|
/*
|
||||||
mainly for macro usage */
|
* This function writes a string on the message line
|
||||||
|
* mainly for macro usage
|
||||||
writemsg(f, n)
|
*
|
||||||
|
* int f, n; arguments ignored
|
||||||
int f, n; /* arguments ignored */
|
*/
|
||||||
|
int writemsg(int f, int n)
|
||||||
{
|
{
|
||||||
register char *sp; /* pointer into buf to expand %s */
|
register char *sp; /* pointer into buf to expand %s */
|
||||||
register char *np; /* ptr into nbuf */
|
register char *np; /* ptr into nbuf */
|
||||||
@ -1029,12 +1037,12 @@ int f, n; /* arguments ignored */
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if CFENCE
|
#if CFENCE
|
||||||
/* the cursor is moved to a matching fence */
|
/*
|
||||||
|
* the cursor is moved to a matching fence
|
||||||
getfence(f, n)
|
*
|
||||||
|
* int f, n; not used
|
||||||
int f, n; /* not used */
|
*/
|
||||||
|
int getfence(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *oldlp; /* original line pointer */
|
register LINE *oldlp; /* original line pointer */
|
||||||
register int oldoff; /* and offset */
|
register int oldoff; /* and offset */
|
||||||
@ -1128,13 +1136,13 @@ int f, n; /* not used */
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Close fences are matched against their partners, and if
|
/*
|
||||||
on screen the cursor briefly lights there */
|
* Close fences are matched against their partners, and if
|
||||||
|
* on screen the cursor briefly lights there
|
||||||
fmatch(ch)
|
*
|
||||||
|
* char ch; fence type to match against
|
||||||
char ch; /* fence type to match against */
|
*/
|
||||||
|
int fmatch(int ch)
|
||||||
{
|
{
|
||||||
register LINE *oldlp; /* original line pointer */
|
register LINE *oldlp; /* original line pointer */
|
||||||
register int oldoff; /* and offset */
|
register int oldoff; /* and offset */
|
||||||
@ -1195,11 +1203,13 @@ char ch; /* fence type to match against */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
istring(f, n)
|
/*
|
||||||
/* ask for and insert a string into the current
|
* ask for and insert a string into the current
|
||||||
buffer at the current point */
|
* buffer at the current point
|
||||||
int f, n; /* ignored arguments */
|
*
|
||||||
|
* int f, n; ignored arguments
|
||||||
|
*/
|
||||||
|
int istring(int f, int n)
|
||||||
{
|
{
|
||||||
register int status; /* status return code */
|
register int status; /* status return code */
|
||||||
char tstring[NPAT + 1]; /* string to add */
|
char tstring[NPAT + 1]; /* string to add */
|
||||||
@ -1221,11 +1231,13 @@ int f, n; /* ignored arguments */
|
|||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ovstring(f, n)
|
/*
|
||||||
/* ask for and overwite a string into the current
|
* ask for and overwite a string into the current
|
||||||
buffer at the current point */
|
* buffer at the current point
|
||||||
int f, n; /* ignored arguments */
|
*
|
||||||
|
* int f, n; ignored arguments
|
||||||
|
*/
|
||||||
|
int ovstring(int f, int n)
|
||||||
{
|
{
|
||||||
register int status; /* status return code */
|
register int status; /* status return code */
|
||||||
char tstring[NPAT + 1]; /* string to add */
|
char tstring[NPAT + 1]; /* string to add */
|
||||||
|
1
spawn.c
1
spawn.c
@ -23,7 +23,6 @@ extern short iochan; /* In "termio.c" */
|
|||||||
|
|
||||||
#if V7 | USG | BSD
|
#if V7 | USG | BSD
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
extern int vttidy();
|
|
||||||
#ifdef SIGWINCH
|
#ifdef SIGWINCH
|
||||||
extern int chg_width, chg_height;
|
extern int chg_width, chg_height;
|
||||||
extern void sizesignal();
|
extern void sizesignal();
|
||||||
|
105
window.c
105
window.c
@ -15,7 +15,7 @@
|
|||||||
* bottom. If it is 0 the window is centered (this is what the standard
|
* bottom. If it is 0 the window is centered (this is what the standard
|
||||||
* redisplay code does). With no argument it defaults to 0. Bound to M-!.
|
* redisplay code does). With no argument it defaults to 0. Bound to M-!.
|
||||||
*/
|
*/
|
||||||
reposition(f, n)
|
int reposition(int f, int n)
|
||||||
{
|
{
|
||||||
if (f == FALSE) /* default to 0 to center screen */
|
if (f == FALSE) /* default to 0 to center screen */
|
||||||
n = 0;
|
n = 0;
|
||||||
@ -28,7 +28,7 @@ reposition(f, n)
|
|||||||
* Refresh the screen. With no argument, it just does the refresh. With an
|
* Refresh the screen. With no argument, it just does the refresh. With an
|
||||||
* argument it recenters "." in the current window. Bound to "C-L".
|
* argument it recenters "." in the current window. Bound to "C-L".
|
||||||
*/
|
*/
|
||||||
refresh(f, n)
|
int refresh(int f, int n)
|
||||||
{
|
{
|
||||||
if (f == FALSE)
|
if (f == FALSE)
|
||||||
sgarbf = TRUE;
|
sgarbf = TRUE;
|
||||||
@ -47,11 +47,10 @@ refresh(f, n)
|
|||||||
*
|
*
|
||||||
* with an argument this command finds the <n>th window from the top
|
* with an argument this command finds the <n>th window from the top
|
||||||
*
|
*
|
||||||
|
* int f, n; default flag and numeric argument
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
nextwind(f, n)
|
int nextwind(int f, int n)
|
||||||
|
|
||||||
int f, n; /* default flag and numeric argument */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
register int nwindows; /* total number of windows */
|
register int nwindows; /* total number of windows */
|
||||||
@ -94,7 +93,7 @@ int f, n; /* default flag and numeric argument */
|
|||||||
* current window. There arn't any errors, although the command does not do a
|
* current window. There arn't any errors, although the command does not do a
|
||||||
* lot if there is 1 window.
|
* lot if there is 1 window.
|
||||||
*/
|
*/
|
||||||
prevwind(f, n)
|
int prevwind(int f, int n)
|
||||||
{
|
{
|
||||||
register WINDOW *wp1;
|
register WINDOW *wp1;
|
||||||
register WINDOW *wp2;
|
register WINDOW *wp2;
|
||||||
@ -126,10 +125,7 @@ prevwind(f, n)
|
|||||||
* a new dot. We share the code by having "move down" just be an interface to
|
* a new dot. We share the code by having "move down" just be an interface to
|
||||||
* "move up". Magic. Bound to "C-X C-N".
|
* "move up". Magic. Bound to "C-X C-N".
|
||||||
*/
|
*/
|
||||||
mvdnwind(f, n)
|
int mvdnwind(int f, int n)
|
||||||
|
|
||||||
int n;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
return (mvupwind(f, -n));
|
return (mvupwind(f, -n));
|
||||||
}
|
}
|
||||||
@ -141,9 +137,7 @@ int n;
|
|||||||
* (this command does not really move "."; it moves the frame). Bound to
|
* (this command does not really move "."; it moves the frame). Bound to
|
||||||
* "C-X C-P".
|
* "C-X C-P".
|
||||||
*/
|
*/
|
||||||
mvupwind(f, n)
|
int mvupwind(int f, int n)
|
||||||
int n;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
register int i;
|
register int i;
|
||||||
@ -187,7 +181,7 @@ int n;
|
|||||||
* the buffer structures right if the distruction of a window makes a buffer
|
* the buffer structures right if the distruction of a window makes a buffer
|
||||||
* become undisplayed.
|
* become undisplayed.
|
||||||
*/
|
*/
|
||||||
onlywind(f, n)
|
int onlywind(int f, int n)
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
@ -231,12 +225,10 @@ onlywind(f, n)
|
|||||||
/*
|
/*
|
||||||
* Delete the current window, placing its space in the window above,
|
* Delete the current window, placing its space in the window above,
|
||||||
* or, if it is the top window, the window below. Bound to C-X 0.
|
* or, if it is the top window, the window below. Bound to C-X 0.
|
||||||
|
*
|
||||||
|
* int f, n; arguments are ignored for this command
|
||||||
*/
|
*/
|
||||||
|
int delwind(int f, int n)
|
||||||
delwind(f, n)
|
|
||||||
|
|
||||||
int f, n; /* arguments are ignored for this command */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register WINDOW *wp; /* window to recieve deleted space */
|
register WINDOW *wp; /* window to recieve deleted space */
|
||||||
register WINDOW *lwp; /* ptr window before curwp */
|
register WINDOW *lwp; /* ptr window before curwp */
|
||||||
@ -306,18 +298,15 @@ int f, n; /* arguments are ignored for this command */
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
* Split the current window. A window smaller than 3 lines cannot be
|
||||||
Split the current window. A window smaller than 3 lines cannot be
|
* split. An argument of 1 forces the cursor into the upper window, an
|
||||||
split. An argument of 1 forces the cursor into the upper window, an
|
* argument of two forces the cursor to the lower window. The only
|
||||||
argument of two forces the cursor to the lower window. The only other
|
* other error that is possible is a "malloc" failure allocating the
|
||||||
error that is possible is a "malloc" failure allocating the structure
|
* structure for the new window. Bound to "C-X 2".
|
||||||
for the new window. Bound to "C-X 2".
|
*
|
||||||
|
* int f, n; default flag and numeric argument
|
||||||
*/
|
*/
|
||||||
splitwind(f, n)
|
int splitwind(int f, int n)
|
||||||
|
|
||||||
int f, n; /* default flag and numeric argument */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
@ -399,7 +388,7 @@ int f, n; /* default flag and numeric argument */
|
|||||||
* all the hard work. You don't just set "force reframe" because dot would
|
* all the hard work. You don't just set "force reframe" because dot would
|
||||||
* move. Bound to "C-X Z".
|
* move. Bound to "C-X Z".
|
||||||
*/
|
*/
|
||||||
enlargewind(f, n)
|
int enlargewind(int f, int n)
|
||||||
{
|
{
|
||||||
register WINDOW *adjwp;
|
register WINDOW *adjwp;
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
@ -450,7 +439,7 @@ enlargewind(f, n)
|
|||||||
* window descriptions. Ask the redisplay to do all the hard work. Bound to
|
* window descriptions. Ask the redisplay to do all the hard work. Bound to
|
||||||
* "C-X C-Z".
|
* "C-X C-Z".
|
||||||
*/
|
*/
|
||||||
shrinkwind(f, n)
|
int shrinkwind(int f, int n)
|
||||||
{
|
{
|
||||||
register WINDOW *adjwp;
|
register WINDOW *adjwp;
|
||||||
register LINE *lp;
|
register LINE *lp;
|
||||||
@ -497,12 +486,12 @@ shrinkwind(f, n)
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resize the current window to the requested size */
|
/*
|
||||||
|
* Resize the current window to the requested size
|
||||||
resize(f, n)
|
*
|
||||||
|
* int f, n; default flag and numeric argument
|
||||||
int f, n; /* default flag and numeric argument */
|
*/
|
||||||
|
int resize(int f, int n)
|
||||||
{
|
{
|
||||||
int clines; /* current # of lines in window */
|
int clines; /* current # of lines in window */
|
||||||
|
|
||||||
@ -525,7 +514,7 @@ int f, n; /* default flag and numeric argument */
|
|||||||
* Pick the uppermost window that isn't the current window. An LRU algorithm
|
* Pick the uppermost window that isn't the current window. An LRU algorithm
|
||||||
* might be better. Return a pointer, or NULL on error.
|
* might be better. Return a pointer, or NULL on error.
|
||||||
*/
|
*/
|
||||||
WINDOW *wpopup()
|
WINDOW *wpopup(void)
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
|
|
||||||
@ -538,27 +527,27 @@ WINDOW *wpopup()
|
|||||||
return (wp);
|
return (wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrnextup(f, n)
|
int scrnextup(int f, int n)
|
||||||
{ /* scroll the next window up (back) a page */
|
{ /* scroll the next window up (back) a page */
|
||||||
nextwind(FALSE, 1);
|
nextwind(FALSE, 1);
|
||||||
backpage(f, n);
|
backpage(f, n);
|
||||||
prevwind(FALSE, 1);
|
prevwind(FALSE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrnextdw(f, n)
|
int scrnextdw(int f, int n)
|
||||||
{ /* scroll the next window down (forward) a page */
|
{ /* scroll the next window down (forward) a page */
|
||||||
nextwind(FALSE, 1);
|
nextwind(FALSE, 1);
|
||||||
forwpage(f, n);
|
forwpage(f, n);
|
||||||
prevwind(FALSE, 1);
|
prevwind(FALSE, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
savewnd(f, n)
|
int savewnd(int f, int n)
|
||||||
{ /* save ptr to current window */
|
{ /* save ptr to current window */
|
||||||
swindow = curwp;
|
swindow = curwp;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
restwnd(f, n)
|
int restwnd(int f, int n)
|
||||||
{ /* restore the saved screen */
|
{ /* restore the saved screen */
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
|
|
||||||
@ -578,11 +567,13 @@ restwnd(f, n)
|
|||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
newsize(f, n)
|
/*
|
||||||
/* resize the screen, re-writing the screen */
|
* resize the screen, re-writing the screen
|
||||||
int f; /* default flag */
|
*
|
||||||
int n; /* numeric argument */
|
* int f; default flag
|
||||||
|
* int n; numeric argument
|
||||||
|
*/
|
||||||
|
int newsize(int f, int n)
|
||||||
{
|
{
|
||||||
WINDOW *wp; /* current window being examined */
|
WINDOW *wp; /* current window being examined */
|
||||||
WINDOW *nextwp; /* next window to scan */
|
WINDOW *nextwp; /* next window to scan */
|
||||||
@ -664,11 +655,13 @@ int n; /* numeric argument */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
newwidth(f, n)
|
/*
|
||||||
/* resize the screen, re-writing the screen */
|
* resize the screen, re-writing the screen
|
||||||
int f; /* default flag */
|
*
|
||||||
int n; /* numeric argument */
|
* int f; default flag
|
||||||
|
* int n; numeric argument
|
||||||
|
*/
|
||||||
|
int newwidth(int f, int n)
|
||||||
{
|
{
|
||||||
register WINDOW *wp;
|
register WINDOW *wp;
|
||||||
|
|
||||||
@ -698,7 +691,7 @@ int n; /* numeric argument */
|
|||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getwpos()
|
int getwpos(void)
|
||||||
{ /* get screen offset of current line in current window */
|
{ /* get screen offset of current line in current window */
|
||||||
register int sline; /* screen line from top of window */
|
register int sline; /* screen line from top of window */
|
||||||
register LINE *lp; /* scannile line pointer */
|
register LINE *lp; /* scannile line pointer */
|
||||||
@ -715,7 +708,7 @@ int getwpos()
|
|||||||
return (sline);
|
return (sline);
|
||||||
}
|
}
|
||||||
|
|
||||||
cknewwindow()
|
int cknewwindow(void)
|
||||||
{
|
{
|
||||||
execute(META | SPEC | 'X', FALSE, 1);
|
execute(META | SPEC | 'X', FALSE, 1);
|
||||||
}
|
}
|
||||||
|
86
word.c
86
word.c
@ -17,12 +17,12 @@
|
|||||||
* a new line. Otherwise, break the line at the word-break, eat it, and jump
|
* a new line. Otherwise, break the line at the word-break, eat it, and jump
|
||||||
* back to the end of the word.
|
* back to the end of the word.
|
||||||
* Returns TRUE on success, FALSE on errors.
|
* Returns TRUE on success, FALSE on errors.
|
||||||
|
*
|
||||||
|
* int f; default flag
|
||||||
|
* int n; numeric argument
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
wrapword(f, n)
|
int wrapword(int f, int n)
|
||||||
|
|
||||||
int f; /* default flag */
|
|
||||||
int n; /* numeric argument */
|
|
||||||
|
|
||||||
{
|
{
|
||||||
register int cnt; /* size of word wrapped to next line */
|
register int cnt; /* size of word wrapped to next line */
|
||||||
register int c; /* charector temporary */
|
register int c; /* charector temporary */
|
||||||
@ -67,7 +67,7 @@ int n; /* numeric argument */
|
|||||||
* performed by the "backchar" and "forwchar" routines. Error if you try to
|
* performed by the "backchar" and "forwchar" routines. Error if you try to
|
||||||
* move beyond the buffers.
|
* move beyond the buffers.
|
||||||
*/
|
*/
|
||||||
backword(f, n)
|
int backword(int f, int n)
|
||||||
{
|
{
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return (forwword(f, -n));
|
return (forwword(f, -n));
|
||||||
@ -90,7 +90,7 @@ backword(f, n)
|
|||||||
* Move the cursor forward by the specified number of words. All of the motion
|
* Move the cursor forward by the specified number of words. All of the motion
|
||||||
* is done by "forwchar". Error if you try and move beyond the buffer's end.
|
* is done by "forwchar". Error if you try and move beyond the buffer's end.
|
||||||
*/
|
*/
|
||||||
forwword(f, n)
|
int forwword(int f, int n)
|
||||||
{
|
{
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return (backword(f, -n));
|
return (backword(f, -n));
|
||||||
@ -113,7 +113,7 @@ forwword(f, n)
|
|||||||
* convert any characters to upper case. Error if you try and move beyond the
|
* convert any characters to upper case. Error if you try and move beyond the
|
||||||
* end of the buffer. Bound to "M-U".
|
* end of the buffer. Bound to "M-U".
|
||||||
*/
|
*/
|
||||||
upperword(f, n)
|
int upperword(int f, int n)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ upperword(f, n)
|
|||||||
* convert characters to lower case. Error if you try and move over the end of
|
* convert characters to lower case. Error if you try and move over the end of
|
||||||
* the buffer. Bound to "M-L".
|
* the buffer. Bound to "M-L".
|
||||||
*/
|
*/
|
||||||
lowerword(f, n)
|
int lowerword(int f, int n)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ lowerword(f, n)
|
|||||||
* characters to lower case. Error if you try and move past the end of the
|
* characters to lower case. Error if you try and move past the end of the
|
||||||
* buffer. Bound to "M-C".
|
* buffer. Bound to "M-C".
|
||||||
*/
|
*/
|
||||||
capword(f, n)
|
int capword(int f, int n)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ capword(f, n)
|
|||||||
* command for the right number of characters. With a zero argument, just
|
* command for the right number of characters. With a zero argument, just
|
||||||
* kill one word and no whitespace. Bound to "M-D".
|
* kill one word and no whitespace. Bound to "M-D".
|
||||||
*/
|
*/
|
||||||
delfword(f, n)
|
int delfword(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *dotp; /* original cursor line */
|
register LINE *dotp; /* original cursor line */
|
||||||
register int doto; /* and row */
|
register int doto; /* and row */
|
||||||
@ -327,7 +327,7 @@ delfword(f, n)
|
|||||||
* counting the characters. When dot is finally moved to its resting place,
|
* counting the characters. When dot is finally moved to its resting place,
|
||||||
* fire off the kill command. Bound to "M-Rubout" and to "M-Backspace".
|
* fire off the kill command. Bound to "M-Rubout" and to "M-Backspace".
|
||||||
*/
|
*/
|
||||||
delbword(f, n)
|
int delbword(int f, int n)
|
||||||
{
|
{
|
||||||
long size;
|
long size;
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ delbword(f, n)
|
|||||||
* Return TRUE if the character at dot is a character that is considered to be
|
* Return TRUE if the character at dot is a character that is considered to be
|
||||||
* part of a word. The word character list is hard coded. Should be setable.
|
* part of a word. The word character list is hard coded. Should be setable.
|
||||||
*/
|
*/
|
||||||
inword()
|
int inword(void)
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
@ -389,11 +389,13 @@ inword()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if WORDPRO
|
#if WORDPRO
|
||||||
fillpara(f, n)
|
/*
|
||||||
/* Fill the current paragraph according to the current
|
* Fill the current paragraph according to the current
|
||||||
fill column */
|
* fill column
|
||||||
int f, n; /* deFault flag and Numeric argument */
|
*
|
||||||
|
* f and n - deFault flag and Numeric argument
|
||||||
|
*/
|
||||||
|
int fillpara(int f, int n)
|
||||||
{
|
{
|
||||||
register int c; /* current char durring scan */
|
register int c; /* current char durring scan */
|
||||||
register int wordlen; /* length of current word */
|
register int wordlen; /* length of current word */
|
||||||
@ -485,11 +487,12 @@ int f, n; /* deFault flag and Numeric argument */
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if PKCODE
|
#if PKCODE
|
||||||
justpara(f, n)
|
/* Fill the current paragraph according to the current
|
||||||
/* Fill the current paragraph according to the current
|
* fill column and cursor position
|
||||||
fill column and cursor position */
|
*
|
||||||
int f, n; /* deFault flag and Numeric argument */
|
* int f, n; deFault flag and Numeric argument
|
||||||
|
*/
|
||||||
|
int justpara(int f, int n)
|
||||||
{
|
{
|
||||||
register int c; /* current char durring scan */
|
register int c; /* current char durring scan */
|
||||||
register int wordlen; /* length of current word */
|
register int wordlen; /* length of current word */
|
||||||
@ -593,11 +596,13 @@ int f, n; /* deFault flag and Numeric argument */
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
killpara(f, n)
|
/*
|
||||||
/* delete n paragraphs starting with the current one */
|
* delete n paragraphs starting with the current one
|
||||||
int f; /* default flag */
|
*
|
||||||
int n; /* # of paras to delete */
|
* int f default flag
|
||||||
|
* int n # of paras to delete
|
||||||
|
*/
|
||||||
|
int killpara(int f, int n)
|
||||||
{
|
{
|
||||||
register int status; /* returned status of functions */
|
register int status; /* returned status of functions */
|
||||||
|
|
||||||
@ -625,14 +630,14 @@ int n; /* # of paras to delete */
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* wordcount: count the # of words in the marked region,
|
/*
|
||||||
along with average word sizes, # of chars, etc,
|
* wordcount: count the # of words in the marked region,
|
||||||
and report on them. */
|
* along with average word sizes, # of chars, etc,
|
||||||
|
* and report on them.
|
||||||
wordcount(f, n)
|
*
|
||||||
|
* int f, n; ignored numeric arguments
|
||||||
int f, n; /* ignored numeric arguments */
|
*/
|
||||||
|
int wordcount(int f, int n)
|
||||||
{
|
{
|
||||||
register LINE *lp; /* current line to scan */
|
register LINE *lp; /* current line to scan */
|
||||||
register int offset; /* current char to scan */
|
register int offset; /* current char to scan */
|
||||||
@ -702,17 +707,8 @@ int f, n; /* ignored numeric arguments */
|
|||||||
else
|
else
|
||||||
avgch = 0;
|
avgch = 0;
|
||||||
|
|
||||||
#if PKCODE
|
|
||||||
pk_mlrec.pk_1 = nwords;
|
|
||||||
pk_mlrec.pk_2 = nchars;
|
|
||||||
pk_mlrec.pk_3 = nlines + 1;
|
|
||||||
pk_mlrec.pk_4 = avgch;
|
|
||||||
mlwrite("%*Words %D Chars %D Lines %d Avg chars/word %f",
|
|
||||||
&pk_mlrec);
|
|
||||||
#else
|
|
||||||
mlwrite("Words %D Chars %D Lines %d Avg chars/word %f",
|
mlwrite("Words %D Chars %D Lines %d Avg chars/word %f",
|
||||||
nwords, nchars, nlines + 1, avgch);
|
nwords, nchars, nlines + 1, avgch);
|
||||||
#endif
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user