diff --git a/Makefile b/Makefile index 4860935..5f7c659 100644 --- a/Makefile +++ b/Makefile @@ -128,7 +128,7 @@ depend: ${SRC} ansi.o: ansi.c estruct.h retcode.h edef.h buffer.h crypt.h line.h utf8.h basic.o: basic.c basic.h buffer.h crypt.h line.h utf8.h display.h \ - estruct.h retcode.h edef.h input.h random.h window.h defines.h word.h + estruct.h retcode.h edef.h input.h random.h window.h defines.h bind.o: bind.c bind.h edef.h buffer.h crypt.h line.h utf8.h estruct.h \ retcode.h bindable.h display.h ebind.h exec.h file.h flook.h input.h \ names.h window.h defines.h diff --git a/basic.c b/basic.c index dd8f2a7..bb97d9d 100644 --- a/basic.c +++ b/basic.c @@ -24,7 +24,6 @@ #include "random.h" #include "utf8.h" #include "window.h" -#include "word.h" /* * This routine, given a pointer to a struct line, and the current cursor goal @@ -215,106 +214,6 @@ int backline(int f, int n) return TRUE; } -#if WORDPRO -/* - * go back to the beginning of the current paragraph - * here we look for a or or - * combination to delimit the beginning of a paragraph - * - * int f, n; default Flag & Numeric argument - */ -int gotobop(int f, int n) -{ - int suc; /* success of last backchar */ - - if (n < 0) /* the other way... */ - return gotoeop(f, -n); - - while (n-- > 0) { /* for each one asked for */ - - /* first scan back until we are in a word */ - suc = backchar(FALSE, 1); - while (!inword() && suc) - suc = backchar(FALSE, 1); - curwp->w_doto = 0; /* and go to the B-O-Line */ - - /* and scan back until we hit a or - or a */ - while (lback(curwp->w_dotp) != curbp->b_linep) - if (llength(curwp->w_dotp) != 0 && -#if PKCODE - ((justflag == TRUE) || -#endif - (lgetc(curwp->w_dotp, curwp->w_doto) != TAB && - lgetc(curwp->w_dotp, curwp->w_doto) != ' ')) -#if PKCODE - ) -#endif - curwp->w_dotp = lback(curwp->w_dotp); - else - break; - - /* and then forward until we are in a word */ - suc = forwchar(FALSE, 1); - while (suc && !inword()) - suc = forwchar(FALSE, 1); - } - curwp->w_flag |= WFMOVE; /* force screen update */ - return TRUE; -} - -/* - * Go forword to the end of the current paragraph - * here we look for a or or - * combination to delimit the beginning of a paragraph - * - * int f, n; default Flag & Numeric argument - */ -int gotoeop(int f, int n) -{ - int suc; /* success of last backchar */ - - if (n < 0) /* the other way... */ - return gotobop(f, -n); - - while (n-- > 0) { /* for each one asked for */ - /* first scan forward until we are in a word */ - suc = forwchar(FALSE, 1); - while (!inword() && suc) - suc = forwchar(FALSE, 1); - curwp->w_doto = 0; /* and go to the B-O-Line */ - if (suc) /* of next line if not at EOF */ - curwp->w_dotp = lforw(curwp->w_dotp); - - /* and scan forword until we hit a or - or a */ - while (curwp->w_dotp != curbp->b_linep) { - if (llength(curwp->w_dotp) != 0 && -#if PKCODE - ((justflag == TRUE) || -#endif - (lgetc(curwp->w_dotp, curwp->w_doto) != TAB && - lgetc(curwp->w_dotp, curwp->w_doto) != ' ')) -#if PKCODE - ) -#endif - curwp->w_dotp = lforw(curwp->w_dotp); - else - break; - } - - /* and then backward until we are in a word */ - suc = backchar(FALSE, 1); - while (suc && !inword()) { - suc = backchar(FALSE, 1); - } - curwp->w_doto = llength(curwp->w_dotp); /* and to the EOL */ - } - curwp->w_flag |= WFMOVE; /* force screen update */ - return TRUE; -} -#endif - /* * 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 diff --git a/basic.h b/basic.h index 8ebbeea..1b0f6ee 100644 --- a/basic.h +++ b/basic.h @@ -8,8 +8,6 @@ int gotobob( int f, int n) ; int gotoeob( int f, int n) ; int forwline( int f, int n) ; int backline( int f, int n) ; -int gotobop( int f, int n) ; -int gotoeop( int f, int n) ; int forwpage( int f, int n) ; int backpage( int f, int n) ; int setmark( int f, int n) ; diff --git a/estruct.h b/estruct.h index 2bcd834..d74a405 100644 --- a/estruct.h +++ b/estruct.h @@ -154,9 +154,7 @@ #if 0 #define ISRCH 1 /* Incremental searches like ITS EMACS */ -#endif #define WORDPRO 1 /* Advanced word processing features */ -#if 0 #define APROP 1 /* Add code for Apropos command */ #define CRYPT 1 /* file encryption enabled? */ #define MAGIC 1 /* include regular expression matching? */ diff --git a/word.c b/word.c index 8420912..72edea4 100644 --- a/word.c +++ b/word.c @@ -22,6 +22,8 @@ #include "region.h" #include "window.h" +static int inword( void) ; + /* Word wrap on n-spaces. Back-over whatever precedes the point on the current * line and stop on the first word-break or the beginning of the line. If we * reach the beginning of the line, jump back to the end of the word and start @@ -378,7 +380,7 @@ int delbword(int f, int n) * 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. */ -int inword(void) +static int inword(void) { int c; @@ -717,3 +719,103 @@ int wordcount(int f, int n) return TRUE; } #endif + +#if WORDPRO +/* + * go back to the beginning of the current paragraph + * here we look for a or or + * combination to delimit the beginning of a paragraph + * + * int f, n; default Flag & Numeric argument + */ +int gotobop(int f, int n) +{ + int suc; /* success of last backchar */ + + if (n < 0) /* the other way... */ + return gotoeop(f, -n); + + while (n-- > 0) { /* for each one asked for */ + + /* first scan back until we are in a word */ + suc = backchar(FALSE, 1); + while (!inword() && suc) + suc = backchar(FALSE, 1); + curwp->w_doto = 0; /* and go to the B-O-Line */ + + /* and scan back until we hit a or + or a */ + while (lback(curwp->w_dotp) != curbp->b_linep) + if (llength(curwp->w_dotp) != 0 && +#if PKCODE + ((justflag == TRUE) || +#endif + (lgetc(curwp->w_dotp, curwp->w_doto) != TAB && + lgetc(curwp->w_dotp, curwp->w_doto) != ' ')) +#if PKCODE + ) +#endif + curwp->w_dotp = lback(curwp->w_dotp); + else + break; + + /* and then forward until we are in a word */ + suc = forwchar(FALSE, 1); + while (suc && !inword()) + suc = forwchar(FALSE, 1); + } + curwp->w_flag |= WFMOVE; /* force screen update */ + return TRUE; +} + +/* + * Go forword to the end of the current paragraph + * here we look for a or or + * combination to delimit the beginning of a paragraph + * + * int f, n; default Flag & Numeric argument + */ +int gotoeop(int f, int n) +{ + int suc; /* success of last backchar */ + + if (n < 0) /* the other way... */ + return gotobop(f, -n); + + while (n-- > 0) { /* for each one asked for */ + /* first scan forward until we are in a word */ + suc = forwchar(FALSE, 1); + while (!inword() && suc) + suc = forwchar(FALSE, 1); + curwp->w_doto = 0; /* and go to the B-O-Line */ + if (suc) /* of next line if not at EOF */ + curwp->w_dotp = lforw(curwp->w_dotp); + + /* and scan forword until we hit a or + or a */ + while (curwp->w_dotp != curbp->b_linep) { + if (llength(curwp->w_dotp) != 0 && +#if PKCODE + ((justflag == TRUE) || +#endif + (lgetc(curwp->w_dotp, curwp->w_doto) != TAB && + lgetc(curwp->w_dotp, curwp->w_doto) != ' ')) +#if PKCODE + ) +#endif + curwp->w_dotp = lforw(curwp->w_dotp); + else + break; + } + + /* and then backward until we are in a word */ + suc = backchar(FALSE, 1); + while (suc && !inword()) { + suc = backchar(FALSE, 1); + } + curwp->w_doto = llength(curwp->w_dotp); /* and to the EOL */ + } + curwp->w_flag |= WFMOVE; /* force screen update */ + return TRUE; +} +#endif diff --git a/word.h b/word.h index 2d0316d..e89d095 100644 --- a/word.h +++ b/word.h @@ -1,6 +1,8 @@ #ifndef _WORD_H_ #define _WORD_H_ +#define WORDPRO 1 + int wrapword( int f, int n) ; int backword( int f, int n) ; int forwword( int f, int n) ; @@ -9,10 +11,13 @@ int lowerword( int f, int n) ; int capword( int f, int n) ; int delfword( int f, int n) ; int delbword( int f, int n) ; -int inword( void) ; +#if WORDPRO +int gotobop( int f, int n) ; +int gotoeop( int f, int n) ; int fillpara( int f, int n) ; int justpara( int f, int n) ; int killpara( int f, int n) ; int wordcount( int f, int n) ; +#endif #endif