dpmodes(termw, func) XtermWidget	termw; void (*func) PROTO((unsigned *p, unsigned mask));
dpmodes( XtermWidget	termw, void (*func) (unsigned *p, unsigned mask))
dpmodes(termw, func)    XtermWidget	termw;    void (*func) PROTO((unsigned *p, unsigned mask));{	register TScreen	*screen	= &termw->screen;	register int	i, j;	for (i=0; i<nparam; ++i) {		switch (param[i]) {		case 1:			/* DECCKM			*/			(*func)(&termw->keyboard.flags, MODE_DECCKM);			update_appcursor();			break;		case 2:			/* ANSI/VT52 mode		*/			if (func == bitset) {	/* ANSI (VT100)	*/				resetCharsets(screen);				if_OPT_VT52_MODE(screen,{					screen->ansi_level = 1;})			}#if OPT_VT52_MODE			else if (screen->terminal_id >= 100) {	/* VT52 */				screen->ansi_level = 0;				param[0] = 0;				param[1] = 0;				resetCharsets(screen);			}#endif			break;		case 3:			/* DECCOLM			*/			if(screen->c132) {				ClearScreen(screen);				CursorSet(screen, 0, 0, termw->flags);				if((j = func == bitset ? 132 : 80) !=				 ((termw->flags & IN132COLUMNS) ? 132 : 80) ||				 j != screen->max_col + 1)					RequestResize(termw, -1, j, TRUE);				(*func)(&termw->flags, IN132COLUMNS);			}			break;		case 4:			/* DECSCLM (slow scroll)	*/			if (func == bitset) {				screen->jumpscroll = 0;				if (screen->scroll_amt)					FlushScroll(screen);			} else				screen->jumpscroll = 1;			(*func)(&termw->flags, SMOOTHSCROLL);			update_jumpscroll();			break;		case 5:			/* DECSCNM			*/			j = termw->flags;			(*func)(&termw->flags, REVERSE_VIDEO);			if ((termw->flags ^ j) & REVERSE_VIDEO)				ReverseVideo(termw);			/* update_reversevideo done in RevVid */			break;		case 6:			/* DECOM			*/			(*func)(&termw->flags, ORIGIN);			CursorSet(screen, 0, 0, termw->flags);			break;		case 7:			/* DECAWM			*/			(*func)(&termw->flags, WRAPAROUND);			update_autowrap();			break;		case 8:			/* DECARM			*/			/* ignore autorepeat */			break;		case 9:			/* MIT bogus sequence		*/			if(func == bitset)				screen->send_mouse_pos = 1;			else				screen->send_mouse_pos = 0;			break;		case 18:		/* DECPFF: print form feed */		        if(func == bitset)			        screen->printer_formfeed = ON;			else			        screen->printer_formfeed = OFF;			break;		case 19:		/* DECPEX: print extent */		        if(func == bitset)			        screen->printer_extent = ON;			else			        screen->printer_extent = OFF;			break;		case 25:		/* DECTCEM: Show/hide cursor (VT200) */		        if(func == bitset)			        screen->cursor_set = ON;			else			        screen->cursor_set = OFF;			break;		case 38:		/* DECTEK			*/#if OPT_TEK4014			if(func == bitset && !(screen->inhibit & I_TEK)) {#ifdef ALLOWLOGGING				if(screen->logging) {					FlushLog(screen);					screen->logstart = Tbuffer;				}#endif				screen->TekEmu = TRUE;			}#endif			break;		case 40:		/* 132 column mode		*/			screen->c132 = (func == bitset);			update_allow132();			break;		case 41:		/* curses hack			*/			screen->curses = (func == bitset);			update_cursesemul();			break;		case 42:		/* DECNRCM national charset (VT220) */			(*func)(&termw->flags, NATIONAL);			break;		case 44:		/* margin bell			*/			screen->marginbell = (func == bitset);			if(!screen->marginbell)				screen->bellarmed = -1;			update_marginbell();			break;		case 45:		/* reverse wraparound	*/			(*func)(&termw->flags, REVERSEWRAP);			update_reversewrap();			break;#ifdef ALLOWLOGGING		case 46:		/* logging		*/#ifdef ALLOWLOGFILEONOFF			/*			 * if this feature is enabled, logging may be			 * enabled and disabled via escape sequences.			 */			if(func == bitset)				StartLog(screen);			else				CloseLog(screen);#else			Bell(XkbBI_Info,0);			Bell(XkbBI_Info,0);#endif /* ALLOWLOGFILEONOFF */			break;#endif		case 1047:		case 47:		/* alternate buffer */			if (!termw->misc.titeInhibit) {			    if(func == bitset) {				ToAlternate(screen);			    } else {				if (screen->alternate				 && (param[i] == 1047))				    ClearScreen(screen);				FromAlternate(screen);			    }			}			break;		case 66:	/* DECNKM */			/* FIXME: VT300 numeric keypad */			break;		case 67:	/* DECBKM */			/* back-arrow mapped to backspace or delete(D)*/			(*func)(&termw->keyboard.flags, MODE_DECBKM);			update_decbkm();			break;		case 1000:		/* xterm bogus sequence		*/			if(func == bitset)				screen->send_mouse_pos = 2;			else				screen->send_mouse_pos = 0;			break;		case 1001:		/* xterm sequence w/hilite tracking */			if(func == bitset)				screen->send_mouse_pos = 3;			else				screen->send_mouse_pos = 0;			break;		case 1048:			if (!termw->misc.titeInhibit) {		        	if(func == bitset)					CursorSave(termw, &screen->sc);				else					CursorRestore(termw, &screen->sc);			}			break;		}	}}