1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 23:36:23 -05:00

uemacs: Make getgoal function private to basic.c.

This functions is only used internally by basic.c, so marking it static,
to make it private.

Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Thiago Farina 2010-08-26 13:20:25 -03:00 committed by Linus Torvalds
parent 799b74b9e7
commit 7622263b45
2 changed files with 41 additions and 43 deletions

68
basic.c
View File

@ -14,6 +14,36 @@
#include "edef.h"
#include "efunc.h"
/*
* This routine, given a pointer to a struct line, and the current cursor goal
* column, return the best choice for the offset. The offset is returned.
* Used by "C-N" and "C-P".
*/
static int getgoal(struct line *dlp)
{
int c;
int col;
int newcol;
int dbo;
col = 0;
dbo = 0;
while (dbo != llength(dlp)) {
c = lgetc(dlp, dbo);
newcol = col;
if (c == '\t')
newcol |= tabmask;
else if (c < 0x20 || c == 0x7F)
++newcol;
++newcol;
if (newcol > curgoal)
break;
col = newcol;
++dbo;
}
return dbo;
}
/*
* Move the cursor to the beginning of the current line.
*/
@ -315,36 +345,6 @@ int gotoeop(int f, int n)
}
#endif
/*
* This routine, given a pointer to a struct line, and the current cursor goal
* column, return the best choice for the offset. The offset is returned.
* Used by "C-N" and "C-P".
*/
int getgoal(struct line *dlp)
{
int c;
int col;
int newcol;
int dbo;
col = 0;
dbo = 0;
while (dbo != llength(dlp)) {
c = lgetc(dlp, dbo);
newcol = col;
if (c == '\t')
newcol |= tabmask;
else if (c < 0x20 || c == 0x7F)
++newcol;
++newcol;
if (newcol > curgoal)
break;
col = newcol;
++dbo;
}
return (dbo);
}
/*
* Scroll forward by a specified number of lines, or by a full page if no
* argument. Bound to "C-V". The "2" in the arithmetic on the window size is
@ -368,7 +368,7 @@ int forwpage(int f, int n)
if (n <= 0) /* Forget the overlap. */
n = 1; /* If tiny window. */
} else if (n < 0)
return (backpage(f, -n));
return backpage(f, -n);
#if CVMVAS
else /* Convert from pages. */
n *= curwp->w_ntrows; /* To lines. */
@ -410,10 +410,10 @@ int backpage(int f, int n)
if (n <= 0) /* Don't blow up if the. */
n = 1; /* Window is tiny. */
} else if (n < 0)
return (forwpage(f, -n));
return forwpage(f, -n);
#if CVMVAS
else /* Convert from pages */
n *= curwp->w_ntrows; /* to lines. */
else /* Convert from pages. */
n *= curwp->w_ntrows; /* To lines. */
#endif
lp = curwp->w_linep;
while (n-- && lback(lp) != curbp->b_linep)

16
efunc.h
View File

@ -1,16 +1,15 @@
/* EFUNC.H
/* efunc.h
*
* Function declarations and names
* Function declarations and names.
*
* This file list all the C code functions used
* and the names to use to bind keys to them. To add functions,
* declare it here in both the extern function list and the name
* binding table.
* This file list all the C code functions used and the names to use
* to bind keys to them. To add functions, declare it here in both the
* extern function list and the name binding table.
*
* modified by Petri Kutvonen
*/
/* External function declarations */
/* External function declarations. */
/* word.c */
extern int wrapword(int f, int n);
@ -78,14 +77,13 @@ 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(struct 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 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);