⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttysw_notify.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
	 * the entire selection image. 	 */	ttysel_hilite(ttysw);	(void)restoreCursor();    }    ttysw_sigwinch(ttysw);}static Notify_valuettysw_pty_output_pending(ttysw, pty)    Ttysw                *ttysw;    int                   pty;{        (void)ttysw_pty_output(ttysw, pty);    return (NOTIFY_DONE);}Notify_valuettysw_pty_input_pending(ttysw, pty)    Ttysw                *ttysw;    int                   pty;{    (void)ttysw_pty_input(ttysw, pty);    return (NOTIFY_DONE);}/* ARGSUSED */Notify_valuettysw_itimer_expired(ttysw, which)    Ttysw                *ttysw;    int                   which;{    (void)ttysw_handle_itimer(ttysw);    return (NOTIFY_DONE);}static Notify_valuettysw_win_input_pending(ttysw, win_fd)    Ttysw                *ttysw;    int                   win_fd;{    /*     * Differs from readwin in that don't loop around input_readevent     * until get a EWOULDBLOCK.      */    if (iwbp >= iebp)	return (NOTIFY_IGNORED);    return(notify_next_input_func((Notify_client)ttysw, win_fd));}/* Pkg_private */ Notify_valuettysw_text_input_pending(textsw, win_fd)    Textsw	 textsw;    int		 win_fd;{    Ttysw	*ttysw = (Ttysw *)		    LINT_CAST(textsw_get(textsw, TEXTSW_CLIENT_DATA));    /*     * Differs from readwin in that don't loop around input_readevent     * until get a EWOULDBLOCK.      */    if (iwbp >= iebp)	return (NOTIFY_IGNORED);    return(notify_next_input_func((Notify_client)textsw, win_fd));}/* * Conditionally set conditions */ttysw_reset_conditions(ttysw)    register Ttysw       *ttysw;{/* #ifndef CMDSW */    static struct itimerval ttysw_itimerval = {{0, 0}, {0, TTYSW_USEC_DELAY}};/* #endif */    static struct itimerval pty_itimerval = {{0, 0}, {0, 10}};    register int          pty = ttysw->ttysw_pty;    /* Send program output to terminal emulator */    (void)ttysw_consume_output(ttysw);    /* Toggle between window input and pty output being done */    if (iwbp > irbp    || (ttysw_getopt((caddr_t)ttysw, TTYOPT_TEXT) && cmdsw->pty_eot > -1)) {	if (!ttysw_waiting_for_pty_output) {	    /* Wait for output to complete on pty */	    (void) notify_set_output_func((Notify_client)(LINT_CAST(ttysw)),					  ttysw_pty_output_pending, pty);	    ttysw_waiting_for_pty_output = 1;	    /* 	     * Pty timer is no longer needed because the	     * pty driver bug that causes the ttysw to lock up is fixed.	     * (void)ttysw_add_pty_timer(ttysw, &pty_itimerval);	     */	}    } else {	if (ttysw_waiting_for_pty_output) {	    /* Don't wait for output to complete on pty any more */	    (void) notify_set_output_func((Notify_client)(LINT_CAST(ttysw)), 	    		NOTIFY_FUNC_NULL, pty);	    ttysw_waiting_for_pty_output = 0;	}    }    /* Set pty input pending */    if (owbp == orbp) {	if (!ttysw_waiting_for_pty_input) {	    (void) notify_set_input_func((Notify_client)ttysw,					 ttysw_pty_input_pending, pty);	    ttysw_waiting_for_pty_input = 1;	}    } else {	if (ttysw_waiting_for_pty_input) {	    (void) notify_set_input_func((Notify_client)ttysw, NOTIFY_FUNC_NULL,					 pty);	    ttysw_waiting_for_pty_input = 0;	}    }    /*     * Try to optimize displaying by waiting for image to be completely filled     * after being cleared (vi(^F ^B) page) before painting.      */    if (!ttysw_getopt((caddr_t)ttysw, TTYOPT_TEXT) && delaypainting)	(void) notify_set_itimer_func((Notify_client)(LINT_CAST(ttysw)), 			ttysw_itimer_expired,		       ITIMER_REAL, &ttysw_itimerval, ITIMER_NULL);}Notify_valuettysw_prioritizer(ttysw, nfd, ibits_ptr, obits_ptr, ebits_ptr,		  nsig, sigbits_ptr, auto_sigbits_ptr, event_count_ptr, events)    register Ttysw       *ttysw;    fd_set               *ibits_ptr, *obits_ptr, *ebits_ptr;    int			  nsig, *sigbits_ptr, *event_count_ptr;    register int         *auto_sigbits_ptr, nfd;    Notify_event         *events;{    register int          bit;    register int          pty = ttysw->ttysw_pty;    ttysw->ttysw_flags |= TTYSW_FL_IN_PRIORITIZER;    if (*auto_sigbits_ptr) {	/* Send itimers */	if (*auto_sigbits_ptr & SIG_BIT(SIGALRM)) {	    (void) notify_itimer((Notify_client)(LINT_CAST(ttysw)), ITIMER_REAL);	    *auto_sigbits_ptr &= ~SIG_BIT(SIGALRM);	}    }    /* if (*obits_ptr & (bit = FD_BIT(ttysw->ttysw_tty))) { */    if (FD_ISSET(ttysw->ttysw_tty, obits_ptr)) {	(void) notify_output((Notify_client)(LINT_CAST(ttysw)), ttysw->ttysw_tty);	FD_CLR(ttysw->ttysw_tty, obits_ptr);    }    /* if (*ibits_ptr & (bit = FD_BIT(ttysw->ttysw_wfd))) { */    if (FD_ISSET(ttysw->ttysw_tty, ibits_ptr)) {	(void) notify_input((Notify_client)(LINT_CAST(ttysw)), ttysw->ttysw_wfd);	FD_CLR(ttysw->ttysw_tty, ibits_ptr);    }    /* if (*obits_ptr & (bit = FD_BIT(pty))) { */    if (FD_ISSET(pty, obits_ptr)) {	(void) notify_output((Notify_client)(LINT_CAST(ttysw)), pty);	FD_CLR(pty, obits_ptr);		/* 	 * Pty timer is no longer needed because the	 * (void)ttysw_remove_pty_timer(ttysw);	 */    }    /* if (*ibits_ptr & (bit = FD_BIT(pty))) { */    if (FD_ISSET(pty, ibits_ptr)) {	(void) notify_input((Notify_client)(LINT_CAST(ttysw)), pty);	FD_CLR(pty, ibits_ptr);    }    (void) ttysw_cached_pri(ttysw, nfd, ibits_ptr, obits_ptr, ebits_ptr,		nsig, sigbits_ptr, auto_sigbits_ptr, event_count_ptr, events);    (void)ttysw_reset_conditions(ttysw);    ttysw->ttysw_flags &= ~TTYSW_FL_IN_PRIORITIZER;    return (NOTIFY_DONE);}ttysw_resize(ttysw)    Ttysw                *ttysw;{    int                   pagemode;    /*     * Turn off page mode because send characters through character image     * manager during resize.      */    pagemode = ttysw_getopt((caddr_t)ttysw, TTYOPT_PAGEMODE);    (void)ttysw_setopt((caddr_t)ttysw, TTYOPT_PAGEMODE, 0);    if (ttysw_getopt((caddr_t)ttysw, TTYOPT_TEXT)) {	(void)ttynewsize(textsw_screen_column_count((Textsw)ttysw->ttysw_hist),		   textsw_screen_line_count((Textsw)ttysw->ttysw_hist));    } else {	/* Have character image update self */	(void)csr_resize(ttysw);	/* Have screen update any size change parameters */	(void)cim_resize(ttysw);	if (ttysw->ttysw_hist) {	    cmdsw->ttysw_resized++;	}    }    /* Turn page mode back on */    (void)ttysw_setopt((caddr_t)ttysw, TTYOPT_PAGEMODE, pagemode);}cim_resize(ttysw)    Ttysw                *ttysw;{    struct rectlist       rl;    extern struct pixwin *csr_pixwin;    int                   (*tmp_getclipping) ();    int                   ttysw_null_getclipping();    /* Prevent any screen writing by making clipping null */    rl = rl_null;    (void)pw_restrict_clipping(csr_pixwin, &rl);    /* Make sure clipping remains null */    tmp_getclipping = csr_pixwin->pw_clipops->pwco_getclipping;    csr_pixwin->pw_clipops->pwco_getclipping = ttysw_null_getclipping;    /* Redo character image */    (void)imagerepair(ttysw);    /* Restore get clipping function */    csr_pixwin->pw_clipops->pwco_getclipping = tmp_getclipping;}csr_resize(ttysw)    Ttysw                *ttysw;{    struct rect           r_new;    extern                wfd;    /* Update notion of size */    (void)win_getsize(wfd, &r_new);    winwidthp = r_new.r_width;    winheightp = r_new.r_height;    /* Don't currently support selections across size changes */    ttynullselection(ttysw);}ttysw_null_getclipping(){}#ifdef notdef---------------------- Obsoleted code follows -----------------------------/* ARGSUSED */Notify_valuettysw_pty_timer_expired(pty, which)    Notify_client              pty;    int				which;{/*  * Pty timer is no longer needed because the * pty driver bug that causes the ttysw to lock up is fixed. * When there is more than 256 character stuffed into the ttysw, * it will beep at the user.    */    register Ttysw	*ttysw;/***	Added by brentb (8-12-86) to take care of input queue overflow warning*/    int			max_fds = GETDTABLESIZE();    fd_set			writefds;    static struct timeval	tv = {0,0};    struct inputevent		event;    int				nfd;        ttysw = _ttysw; /*global data */    FD_ZERO(&writefds);    FD_SET(ttysw->ttysw_pty, &writefds);        if(!ttysw_getopt((caddr_t)ttysw, TTYOPT_TEXT) && 	ttysw_waiting_for_pty_output)    {	if((nfd = select(max_fds, NULL, &writefds, NULL, &tv)) < 0)		perror("TTYSW select");	if (nfd == 0)	{		int	result;		Event	event;		result = alert_prompt(				(Frame)0,				&event,				ALERT_MESSAGE_STRINGS,				    "Too many keystrokes in the input buffer.",				    0,				ALERT_BUTTON_YES,	"Flush input buffer",				ALERT_BUTTON_NO,	"Cancel",				ALERT_POSITION,		ALERT_SCREEN_CENTERED,				0);		if (result == ALERT_YES)			(void)ttysw_flush_input((caddr_t)ttysw);	}    }     return(NOTIFY_DONE);}voidttysw_add_pty_timer(ttysw, itimer)    register Ttysw                *ttysw;    register struct itimerval	*itimer;{/*  * Pty timer is no longer needed because the * pty driver bug that causes the ttysw to lock up is fixed. */       if (NOTIFY_FUNC_NULL ==        notify_set_itimer_func((Notify_client)(LINT_CAST(&ttysw->ttysw_pty)),				   ttysw_pty_timer_expired, ITIMER_REAL,				   itimer, ITIMER_NULL))	    notify_perror("ttysw_add_pty_timer");}voidttysw_remove_pty_timer(ttysw)    register Ttysw                *ttysw;{/*  * Pty timer is no longer needed because the * pty driver bug that causes the ttysw to lock up is fixed. */    ttysw_add_pty_timer(ttysw, ITIMER_NULL);} #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -