From fbc66a52ed5b51a988ca279b576a817998ffbda4 Mon Sep 17 00:00:00 2001 From: skimo Date: Tue, 28 Aug 2001 21:05:45 +0000 Subject: [PATCH] move ccl from global structure to win --- common/gs.c | 8 ++++---- common/gs.h | 4 +--- common/screen.h | 4 +++- vi/v_ex.c | 30 +++++++++++++++++++----------- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/common/gs.c b/common/gs.c index 8efbd6bf..363806f5 100644 --- a/common/gs.c +++ b/common/gs.c @@ -104,6 +104,10 @@ win_end(WIN *wp) CIRCLEQ_REMOVE(&wp->gp->dq, wp, q); + if (wp->ccl_sp != NULL) { + (void)file_end(wp->ccl_sp, NULL, 1); + (void)screen_end(wp->ccl_sp); + } while ((sp = wp->scrq.cqh_first) != (void *)&wp->scrq) (void)screen_end(sp); @@ -140,10 +144,6 @@ gs_end(GS *gp) WIN *wp; /* If there are any remaining screens, kill them off. */ - if (gp->ccl_sp != NULL) { - (void)file_end(gp->ccl_sp, NULL, 1); - (void)screen_end(gp->ccl_sp); - } while ((wp = gp->dq.cqh_first) != (void *)&gp->dq) (void)win_end(wp); while ((sp = gp->hq.cqh_first) != (void *)&gp->hq) diff --git a/common/gs.h b/common/gs.h index 61389837..cffa8bc1 100644 --- a/common/gs.h +++ b/common/gs.h @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * $Id: gs.h,v 10.53 2001/07/29 19:07:28 skimo Exp $ (Berkeley) $Date: 2001/07/29 19:07:28 $ + * $Id: gs.h,v 10.54 2001/08/28 21:05:45 skimo Exp $ (Berkeley) $Date: 2001/08/28 21:05:45 $ */ #define TEMPORARY_FILE_STRING "/tmp" /* Default temporary file name. */ @@ -59,8 +59,6 @@ struct _gs { CIRCLEQ_HEAD(_dqh, _win) dq; /* Displayed windows. */ CIRCLEQ_HEAD(_hqh, _scr) hq; /* Hidden screens. */ - SCR *ccl_sp; /* Colon command-line screen. */ - void *perl_interp; /* Perl interpreter. */ void *tcl_interp; /* Tcl_Interp *: Tcl interpreter. */ diff --git a/common/screen.h b/common/screen.h index 627be92e..158540b9 100644 --- a/common/screen.h +++ b/common/screen.h @@ -6,7 +6,7 @@ * * See the LICENSE file for redistribution information. * - * $Id: screen.h,v 10.45 2001/08/28 13:29:15 skimo Exp $ (Berkeley) $Date: 2001/08/28 13:29:15 $ + * $Id: screen.h,v 10.46 2001/08/28 21:05:46 skimo Exp $ (Berkeley) $Date: 2001/08/28 21:05:46 $ */ /* @@ -35,6 +35,8 @@ struct _win { GS *gp; /* Pointer to global area. */ + SCR *ccl_sp; /* Colon command-line screen. */ + void *perl_private; /* Perl interpreter. */ void *ip_private; /* IP support private area. */ diff --git a/vi/v_ex.c b/vi/v_ex.c index edac329f..f7b02e0e 100644 --- a/vi/v_ex.c +++ b/vi/v_ex.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: v_ex.c,v 10.55 2001/08/28 13:29:16 skimo Exp $ (Berkeley) $Date: 2001/08/28 13:29:16 $"; +static const char sccsid[] = "$Id: v_ex.c,v 10.56 2001/08/28 21:05:47 skimo Exp $ (Berkeley) $Date: 2001/08/28 21:05:47 $"; #endif /* not lint */ #include @@ -497,11 +497,13 @@ static int v_ecl(SCR *sp) { GS *gp; + WIN *wp; SCR *new; /* Initialize the screen, if necessary. */ gp = sp->gp; - if (gp->ccl_sp == NULL && v_ecl_init(sp)) + wp = sp->wp; + if (wp->ccl_sp == NULL && v_ecl_init(sp)) return (1); /* Get a new screen. */ @@ -513,11 +515,11 @@ v_ecl(SCR *sp) } /* Attach to the screen. */ - new->ep = gp->ccl_sp->ep; + new->ep = wp->ccl_sp->ep; ++new->ep->refcnt; CIRCLEQ_INSERT_HEAD(&new->ep->scrq, new, eq); - new->frp = gp->ccl_sp->frp; + new->frp = wp->ccl_sp->frp; new->frp->flags = sp->frp->flags; /* Move the cursor to the end. */ @@ -584,16 +586,19 @@ v_ecl_log(SCR *sp, TEXT *tp) int rval; CHAR_T *p; size_t len; + SCR *ccl_sp; /* Initialize the screen, if necessary. */ - if (sp->gp->ccl_sp == NULL && v_ecl_init(sp)) + if (sp->wp->ccl_sp == NULL && v_ecl_init(sp)) return (1); + ccl_sp = sp->wp->ccl_sp; + /* * Don't log colon command window commands into the colon command * window... */ - if (sp->ep == sp->gp->ccl_sp->ep) + if (sp->ep == ccl_sp->ep) return (0); /* @@ -606,7 +611,7 @@ v_ecl_log(SCR *sp, TEXT *tp) * Temporarily change fileencoding as well. */ save_ep = sp->ep; - sp->ep = sp->gp->ccl_sp->ep; + sp->ep = ccl_sp->ep; save_enc = O_STR(sp, O_FILEENCODING); o_set(sp, O_FILEENCODING, OS_STR | OS_NOFREE, "WCHAR_T", 0); @@ -642,8 +647,10 @@ v_ecl_init(SCR *sp) { FREF *frp; GS *gp; + WIN *wp; gp = sp->gp; + wp = sp->wp; /* Get a temporary file. */ if ((frp = file_add(sp, NULL)) == NULL) @@ -653,15 +660,16 @@ v_ecl_init(SCR *sp) * XXX * Create a screen -- the file initialization code wants one. */ - if (screen_init(gp, sp, &gp->ccl_sp)) + if (screen_init(gp, sp, &wp->ccl_sp)) return (1); - if (file_init(gp->ccl_sp, frp, NULL, 0)) { - (void)screen_end(gp->ccl_sp); + conv_enc(wp->ccl_sp, O_FILEENCODING, "WCHAR_T"); + if (file_init(wp->ccl_sp, frp, NULL, 0)) { + (void)screen_end(wp->ccl_sp); return (1); } /* The underlying file isn't recoverable. */ - F_CLR(gp->ccl_sp->ep, F_RCV_ON); + F_CLR(wp->ccl_sp->ep, F_RCV_ON); return (0); } -- 2.11.4.GIT