do_erase_display(screen, param, mode) register TScreen *screen; int param; int mode;
do_erase_display( register TScreen *screen, int param, int mode)
do_erase_display(screen, param, mode)	register TScreen *screen;	int param;	int mode;{	int saved_mode = screen->protected_mode;	if (saved_mode == DEC_PROTECT	 && saved_mode != mode)	 	screen->protected_mode = OFF_PROTECT;	switch (param) {	case -1:	/* DEFAULT */	case 0:		if (screen->cur_row == 0		 && screen->cur_col == 0) {			screen->protected_mode = saved_mode;			do_erase_display(screen, 2, mode);			saved_mode = screen->protected_mode;		} else			ClearBelow(screen);		break;	case 1:		if (screen->cur_row == screen->max_row		 && screen->cur_col == screen->max_col) {			screen->protected_mode = saved_mode;			do_erase_display(screen, 2, mode);			saved_mode = screen->protected_mode;		} else			ClearAbove(screen);		break;	case 2:		/*		 * We use 'ClearScreen()' throughout the remainder of the		 * program for places where we don't care if the characters are		 * protected or not.  So we modify the logic around this call		 * on 'ClearScreen()' to handle protected characters.		 */		if (screen->protected_mode != OFF_PROTECT) {			register int row;			int rc = 1;			for (row = 0; row <= screen->max_row; row++)				rc &= ClearInLine(screen, row, 0, screen->max_col + 1);			if (rc != 0)				saved_mode = OFF_PROTECT;		} else {			ClearScreen(screen);		}		break;	}	screen->protected_mode = saved_mode;}