From c7cacc86dc4115ecae1bd50e64d5203aee12ce61 Mon Sep 17 00:00:00 2001 From: bostic Date: Wed, 29 Dec 1993 09:50:44 +0000 Subject: [PATCH] add EX_AUTOPRINT flag to ex private structure, replaces S_AUTOPRINT in the SCR structure --- common/screen.h | 37 ++++++++++++++++++------------------- ex/ex.c | 9 +++++---- ex/ex.h | 5 ++++- ex/ex_bang.c | 4 ++-- ex/ex_cmd.c | 22 +++++++++++----------- ex/ex_delete.c | 11 ++++++----- ex/ex_join.c | 4 +--- ex/ex_move.c | 4 +--- ex/ex_put.c | 4 +--- ex/ex_read.c | 4 ++-- ex/ex_shift.c | 4 +--- ex/ex_subst.c | 4 ++-- ex/ex_undo.c | 6 +----- 13 files changed, 55 insertions(+), 63 deletions(-) diff --git a/common/screen.h b/common/screen.h index 936ed894..cf614bf6 100644 --- a/common/screen.h +++ b/common/screen.h @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * $Id: screen.h,v 8.80 1993/12/22 16:14:30 bostic Exp $ (Berkeley) $Date: 1993/12/22 16:14:30 $ + * $Id: screen.h,v 8.81 1993/12/29 09:51:24 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:51:24 $ */ /* @@ -246,24 +246,23 @@ struct _scr { #define S_MAJOR_CHANGE /* Screen or file changes. */ \ (S_EXIT | S_EXIT_FORCE | S_FSWITCH | S_SSWITCH) -#define S_AUTOPRINT 0x0000080 /* Autoprint flag. */ -#define S_BELLSCHED 0x0000100 /* Bell scheduled. */ -#define S_CONTINUE 0x0000200 /* Need to ask the user to continue. */ -#define S_EXSILENT 0x0000400 /* Ex batch script. */ -#define S_GLOBAL 0x0000800 /* Doing a global command. */ -#define S_INPUT 0x0001000 /* Doing text input. */ -#define S_INTERRUPTED 0x0002000 /* If have been interrupted. */ -#define S_INTERRUPTIBLE 0x0004000 /* If can be interrupted. */ -#define S_REDRAW 0x0008000 /* Redraw the screen. */ -#define S_REFORMAT 0x0010000 /* Reformat the screen. */ -#define S_REFRESH 0x0020000 /* Refresh the screen. */ -#define S_RENUMBER 0x0040000 /* Renumber the screen. */ -#define S_RESIZE 0x0080000 /* Resize the screen. */ -#define S_SCRIPT 0x0100000 /* Window is a shell script. */ -#define S_SRE_SET 0x0200000 /* The search RE has been set. */ -#define S_SUBRE_SET 0x0400000 /* The substitute RE has been set. */ -#define S_TIMER_SET 0x0800000 /* If a busy timer is running. */ -#define S_UPDATE_MODE 0x1000000 /* Don't repaint modeline. */ +#define S_BELLSCHED 0x0000080 /* Bell scheduled. */ +#define S_CONTINUE 0x0000100 /* Need to ask the user to continue. */ +#define S_EXSILENT 0x0000200 /* Ex batch script. */ +#define S_GLOBAL 0x0000400 /* Doing a global command. */ +#define S_INPUT 0x0000800 /* Doing text input. */ +#define S_INTERRUPTED 0x0001000 /* If have been interrupted. */ +#define S_INTERRUPTIBLE 0x0002000 /* If can be interrupted. */ +#define S_REDRAW 0x0004000 /* Redraw the screen. */ +#define S_REFORMAT 0x0008000 /* Reformat the screen. */ +#define S_REFRESH 0x0010000 /* Refresh the screen. */ +#define S_RENUMBER 0x0020000 /* Renumber the screen. */ +#define S_RESIZE 0x0040000 /* Resize the screen. */ +#define S_SCRIPT 0x0080000 /* Window is a shell script. */ +#define S_SRE_SET 0x0100000 /* The search RE has been set. */ +#define S_SUBRE_SET 0x0200000 /* The substitute RE has been set. */ +#define S_TIMER_SET 0x0400000 /* If a busy timer is running. */ +#define S_UPDATE_MODE 0x0800000 /* Don't repaint modeline. */ u_int flags; }; diff --git a/ex/ex.c b/ex/ex.c index bce7b65f..00bafdeb 100644 --- a/ex/ex.c +++ b/ex/ex.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex.c,v 8.87 1993/12/27 17:34:05 bostic Exp $ (Berkeley) $Date: 1993/12/27 17:34:05 $"; +static char sccsid[] = "$Id: ex.c,v 8.88 1993/12/29 09:50:44 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:44 $"; #endif /* not lint */ #include @@ -1022,8 +1022,8 @@ addr2: switch (exc.addrcnt) { TRACE(sp, "\n"); } #endif - /* Clear autoprint. */ - F_CLR(sp, S_AUTOPRINT); + /* Clear autoprint flag. */ + F_CLR(exp, EX_AUTOPRINT); /* Increment the command count if not called from vi. */ if (!IN_VI_MODE(sp)) @@ -1128,7 +1128,8 @@ addr2: switch (exc.addrcnt) { sp->lno += flagoff; } - if (F_ISSET(sp, S_AUTOPRINT) && O_ISSET(sp, O_AUTOPRINT)) + if (O_ISSET(sp, O_AUTOPRINT) && + (F_ISSET(exp, EX_AUTOPRINT) || F_ISSET(cp, E_AUTOPRINT))) LF_INIT(E_F_PRINT); else LF_INIT(F_ISSET(&exc, E_F_HASH | E_F_LIST | E_F_PRINT)); diff --git a/ex/ex.h b/ex/ex.h index 07db3df5..7101aada 100644 --- a/ex/ex.h +++ b/ex/ex.h @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * $Id: ex.h,v 8.43 1993/12/28 17:24:41 bostic Exp $ (Berkeley) $Date: 1993/12/28 17:24:41 $ + * $Id: ex.h,v 8.44 1993/12/29 09:51:01 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:51:01 $ */ /* Ex command structure. */ @@ -92,6 +92,9 @@ typedef struct _ex_private { /* Linked list of ranges. */ CIRCLEQ_HEAD(_rangeh, _range) rangeq; recno_t range_lno; /* Range set line number. */ + +#define EX_AUTOPRINT 0x01 /* Autoprint flag. */ + u_int flags; } EX_PRIVATE; #define EXP(sp) ((EX_PRIVATE *)((sp)->ex_private)) diff --git a/ex/ex_bang.c b/ex/ex_bang.c index 886d438f..fc8d7b0d 100644 --- a/ex/ex_bang.c +++ b/ex/ex_bang.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_bang.c,v 8.21 1993/12/09 19:42:38 bostic Exp $ (Berkeley) $Date: 1993/12/09 19:42:38 $"; +static char sccsid[] = "$Id: ex_bang.c,v 8.22 1993/12/29 09:50:48 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:48 $"; #endif /* not lint */ #include @@ -124,7 +124,7 @@ ex_bang(sp, ep, cmdp) &cmdp->addr1, &cmdp->addr2, &rm, ap->bp, ftype)) return (1); sp->lno = rm.lno; - F_SET(sp, S_AUTOPRINT); + F_SET(exp, EX_AUTOPRINT); return (0); } diff --git a/ex/ex_cmd.c b/ex/ex_cmd.c index 1b486e98..c9f5fe23 100644 --- a/ex/ex_cmd.c +++ b/ex/ex_cmd.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_cmd.c,v 8.34 1993/12/22 18:38:40 bostic Exp $ (Berkeley) $Date: 1993/12/22 18:38:40 $"; +static char sccsid[] = "$Id: ex_cmd.c,v 8.35 1993/12/29 09:50:59 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:59 $"; #endif /* not lint */ #include @@ -62,7 +62,7 @@ EXCMDLIST const cmds[] = { "* [buffer]", "execute a buffer"}, /* C_SHIFTL */ - {"<", ex_shiftl, E_ADDR2|E_NORC, + {"<", ex_shiftl, E_ADDR2|E_AUTOPRINT|E_NORC, "ca1", "[line [,line]] <[<...] [count] [flags]", "shift lines left"}, @@ -72,7 +72,7 @@ EXCMDLIST const cmds[] = { "[line] = [flags]", "display line number"}, /* C_SHIFTR */ - {">", ex_shiftr, E_ADDR2|E_NORC, + {">", ex_shiftr, E_ADDR2|E_AUTOPRINT|E_NORC, "ca1", "[line [,line]] >[>...] [count] [flags]", "shift lines right"}, @@ -117,12 +117,12 @@ EXCMDLIST const cmds[] = { "chd[ir][!] [directory]", "change the current directory"}, /* C_COPY */ - {"copy", ex_copy, E_ADDR2|E_NORC, + {"copy", ex_copy, E_ADDR2|E_AUTOPRINT|E_NORC, "l1", "[line [,line]] co[py] line [flags]", "copy lines elsewhere in the file"}, /* C_DELETE */ - {"delete", ex_delete, E_ADDR2|E_NORC, + {"delete", ex_delete, E_ADDR2|E_AUTOPRINT|E_NORC, "bca1", "[line [,line]] d[elete] [buffer] [count] [flags]", "delete lines from the file"}, @@ -177,7 +177,7 @@ EXCMDLIST const cmds[] = { "[line] i[nsert][!]", "insert input before a line"}, /* C_JOIN */ - {"join", ex_join, E_ADDR2|E_NORC, + {"join", ex_join, E_ADDR2|E_AUTOPRINT|E_NORC, "!ca1", "[line [,line]] j[oin][!] [count] [flags]", "join lines into a single line"}, @@ -192,7 +192,7 @@ EXCMDLIST const cmds[] = { "[line [,line]] l[ist] [count] [#]", "display lines in an unambiguous form"}, /* C_MOVE */ - {"move", ex_move, E_ADDR2|E_NORC, + {"move", ex_move, E_ADDR2|E_AUTOPRINT|E_NORC, "l", "[line [,line]] m[ove] line", "move lines elsewhere in the file"}, @@ -242,7 +242,7 @@ EXCMDLIST const cmds[] = { "prev[ious][!]", "edit the previous file in the file argument list"}, /* C_PUT */ - {"put", ex_put, E_ADDR1|E_NORC|E_ZERO, + {"put", ex_put, E_ADDR1|E_AUTOPRINT|E_NORC|E_ZERO, "b", "[line] pu[t] [buffer]", "append a cut buffer to the line"}, @@ -307,7 +307,7 @@ EXCMDLIST const cmds[] = { "su[spend][!]", "suspend the edit session"}, /* C_T */ - {"t", ex_copy, E_ADDR2|E_NORC, + {"t", ex_copy, E_ADDR2|E_AUTOPRINT|E_NORC, "l1", "[line [,line]] t line [flags]", "move lines elsewhere in the file"}, @@ -327,12 +327,12 @@ EXCMDLIST const cmds[] = { "tagt[op][!]", "return to the first tag"}, /* C_UNDOL */ - {"Undo", ex_undol, E_NOGLOBAL|E_NORC, + {"Undo", ex_undol, E_AUTOPRINT|E_NOGLOBAL|E_NORC, "", "U[ndo]", "undo all the changes to this line"}, /* C_UNDO */ - {"undo", ex_undo, E_NOGLOBAL|E_NORC, + {"undo", ex_undo, E_AUTOPRINT|E_NOGLOBAL|E_NORC, "", "u[ndo]", "undo the most recent change"}, diff --git a/ex/ex_delete.c b/ex/ex_delete.c index 83b9b557..99391dd4 100644 --- a/ex/ex_delete.c +++ b/ex/ex_delete.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_delete.c,v 8.3 1993/11/04 16:16:54 bostic Exp $ (Berkeley) $Date: 1993/11/04 16:16:54 $"; +static char sccsid[] = "$Id: ex_delete.c,v 8.4 1993/12/29 09:50:49 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:49 $"; #endif /* not lint */ #include @@ -14,6 +14,11 @@ static char sccsid[] = "$Id: ex_delete.c,v 8.3 1993/11/04 16:16:54 bostic Exp $ #include "vi.h" #include "excmd.h" +/* + * ex_delete: [line [,line]] d[elete] [buffer] [count] [flags] + * + * Delete lines from the file. + */ int ex_delete(sp, ep, cmdp) SCR *sp; @@ -40,9 +45,5 @@ ex_delete(sp, ep, cmdp) return (1); if (sp->lno > lno) sp->lno = lno; - - /* Set autoprint. */ - F_SET(sp, S_AUTOPRINT); - return (0); } diff --git a/ex/ex_join.c b/ex/ex_join.c index d565c0dd..7d8caa3b 100644 --- a/ex/ex_join.c +++ b/ex/ex_join.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_join.c,v 8.7 1993/12/09 19:42:42 bostic Exp $ (Berkeley) $Date: 1993/12/09 19:42:42 $"; +static char sccsid[] = "$Id: ex_join.c,v 8.8 1993/12/29 09:50:50 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:50 $"; #endif /* not lint */ #include @@ -159,7 +159,5 @@ err: FREE_SPACE(sp, bp, blen); FREE_SPACE(sp, bp, blen); sp->rptlines[L_JOINED] += (cmdp->addr2.lno - cmdp->addr1.lno) + 1; - - F_SET(sp, S_AUTOPRINT); return (0); } diff --git a/ex/ex_move.c b/ex/ex_move.c index 3b397ffd..4a712196 100644 --- a/ex/ex_move.c +++ b/ex/ex_move.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_move.c,v 8.2 1993/07/21 09:00:31 bostic Exp $ (Berkeley) $Date: 1993/07/21 09:00:31 $"; +static char sccsid[] = "$Id: ex_move.c,v 8.3 1993/12/29 09:50:51 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:51 $"; #endif /* not lint */ #include @@ -95,7 +95,5 @@ cm(sp, ep, cmdp, cmd) /* Reporting. */ sp->rptlines[cmd == COPY ? L_COPIED : L_MOVED] += (fm2.lno - fm1.lno) + 1; - - F_SET(sp, S_AUTOPRINT); return (0); } diff --git a/ex/ex_put.c b/ex/ex_put.c index 871c8ed5..4ba032cc 100644 --- a/ex/ex_put.c +++ b/ex/ex_put.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_put.c,v 8.2 1993/11/04 16:16:54 bostic Exp $ (Berkeley) $Date: 1993/11/04 16:16:54 $"; +static char sccsid[] = "$Id: ex_put.c,v 8.3 1993/12/29 09:50:52 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:52 $"; #endif /* not lint */ #include @@ -36,7 +36,5 @@ ex_put(sp, ep, cmdp) F_ISSET(cmdp, E_BUFFER) ? DEFCB : cmdp->buffer, &cmdp->addr1, &m, 1)) return (1); - - F_SET(sp, S_AUTOPRINT); return (0); } diff --git a/ex/ex_read.c b/ex/ex_read.c index e0f10caf..7a4f43f4 100644 --- a/ex/ex_read.c +++ b/ex/ex_read.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_read.c,v 8.19 1993/12/28 17:24:01 bostic Exp $ (Berkeley) $Date: 1993/12/28 17:24:01 $"; +static char sccsid[] = "$Id: ex_read.c,v 8.20 1993/12/29 09:50:53 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:53 $"; #endif /* not lint */ #include @@ -127,7 +127,7 @@ ex_read(sp, ep, cmdp) if (nlines) ++sp->lno; - F_SET(sp, S_AUTOPRINT); + F_SET(EXP(sp), EX_AUTOPRINT); return (rval); } diff --git a/ex/ex_shift.c b/ex/ex_shift.c index e0c5594c..957e7808 100644 --- a/ex/ex_shift.c +++ b/ex/ex_shift.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_shift.c,v 8.11 1993/12/09 19:42:45 bostic Exp $ (Berkeley) $Date: 1993/12/09 19:42:45 $"; +static char sccsid[] = "$Id: ex_shift.c,v 8.12 1993/12/29 09:50:54 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:54 $"; #endif /* not lint */ #include @@ -163,7 +163,5 @@ err: FREE_SPACE(sp, bp, blen); sp->rptlines[rl == RIGHT ? L_RSHIFT : L_LSHIFT] += cmdp->addr2.lno - cmdp->addr1.lno + 1; - - F_SET(sp, S_AUTOPRINT); return (0); } diff --git a/ex/ex_subst.c b/ex/ex_subst.c index c3fc6404..6250c7e5 100644 --- a/ex/ex_subst.c +++ b/ex/ex_subst.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_subst.c,v 8.29 1993/12/23 16:10:22 bostic Exp $ (Berkeley) $Date: 1993/12/23 16:10:22 $"; +static char sccsid[] = "$Id: ex_subst.c,v 8.30 1993/12/29 09:50:56 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:56 $"; #endif /* not lint */ #include @@ -749,7 +749,7 @@ endmatch: if (!linechanged) if (!F_ISSET(sp, S_GLOBAL)) msgq(sp, M_INFO, "No match found."); } else if (!lflag && !nflag && !pflag) - F_SET(sp, S_AUTOPRINT); + F_SET(EXP(sp), EX_AUTOPRINT); if (bp != NULL) FREE_SPACE(sp, bp, blen); diff --git a/ex/ex_undo.c b/ex/ex_undo.c index 563cfeb9..4f59e8de 100644 --- a/ex/ex_undo.c +++ b/ex/ex_undo.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "$Id: ex_undo.c,v 8.2 1993/12/28 17:10:50 bostic Exp $ (Berkeley) $Date: 1993/12/28 17:10:50 $"; +static char sccsid[] = "$Id: ex_undo.c,v 8.3 1993/12/29 09:50:58 bostic Exp $ (Berkeley) $Date: 1993/12/29 09:50:58 $"; #endif /* not lint */ #include @@ -28,8 +28,6 @@ ex_undol(sp, ep, cmdp) return (1); sp->cno = 0; - F_SET(sp, S_AUTOPRINT); - return (0); } @@ -69,7 +67,5 @@ ex_undo(sp, ep, cmdp) } sp->lno = m.lno; sp->cno = m.cno; - F_SET(sp, S_AUTOPRINT); - return (0); } -- 2.11.4.GIT