/* SCHEAD.C */ #define then #include "sysdef.h" #include "scerrd.h" #include "scterm.h" #define CR 015 #define LF 012 /* */ /* Copyright Notice */ /* */ /* */ /* C version Copyright (C) 1984 Change Software, Inc. */ /* Copyright (C) 1978 1979 1980 1981 1982 1983 1984 1985 */ /* Change Software, Inc. */ /* */ /* */ /* This software is furnished under a license and may */ /* be used and copied only in accordance with the */ /* terms of such license and with the inclusion of */ /* the above copyright notice. This software or any */ /* other copies thereof may not be provided or other- */ /* wise made available to any other person. No title */ /* to and ownership of the software is hereby trans- */ /* ferred. */ /* */ extern int w ; static char _topline[] = "PF1 H =Help, PF1 F =Exit, CTRL P=Refresh, " ; static char updformat[] = "Current: %8d , Last: %8d , Col: %3d , " ; static char savc[] = { '\033','7','\033','[','7','m',0 } ; static char rstc[] = { '\033','8','\033','[','0','m',0 } ; scupdheader() { extern int updheader,updcontext[] ; extern int curposition,*curline,*maxline ; register int *ip ; if ( updheader == 0 ) then return(1) ; ip = &updcontext[0] ; if ( *ip != *curline ) then updval(*ip,*curline,10,8) ; *ip++ = *curline ; if ( *ip != (*maxline)-1 ) then updval(*ip,(*maxline)-1,27,8) ; *ip++ = *maxline - 1 ; if ( *ip != curposition ) then updval(*ip,curposition,43,3) ; *ip++ = curposition ; } static updval(ov,nv,start,width) int ov,nv,start,width ; { register char *op,*np ; char oldval[20],newval[10],fmt[5] ; int i ; extern int termtype ; switch( termtype ) { case _VT100: case _VT220: putbin(savc,0) ; op = oldval ; np = newval ; fmt[0] = '%'; fmt[1] = width + '0' ; fmt[2] = 'd' ; fmt[3] = 0 ; sxprintf(op,fmt,ov) ; sxprintf(np,fmt,nv) ; for ( i=0; i < width;i++ ) if ( *op == *np ) { np++ ; op++ ; start++ ; } ; if ( *np ) then { sxprintf(oldval,"\033[1;%dH%s",start,np) ; putbin(oldval,0) ; } ; putbin(rstc,0) ; break ; case _ANSI: break ; } } vtmacnum() { extern int rept,maccurrent ; if ( rept >= 0 && rept < _NMACROS ) maccurrent = rept ; sctopline() ; } static int msg_position = 0 ; msgcount_update() { extern int msg_count ; char junk[20] ; if ( msg_position == 0 ) { sctopline() ; return(1) ; } ; rvon() ; putbin("\033",1) ; putbin("7\033[H\033[",0) ; sxprintf(junk,"%dC%d",msg_position,msg_count) ; putbin(junk,0) ; putbin("\033",1) ; putbin("8",1) ; rvoff() ; return(1) ; } sctopline() { extern int bufnumber,sts_one,termtype,updcontext[],updheader ; extern int curposition, chposition,*curline,*maxline ; extern int maccurrent,msg_count ; register int *ip ; char topline[80] ; if ( ( sts_one & _vtedit ) == 0 ) then return(0) ; ip = &updcontext[0] ; *ip++ = *curline ; *ip++ = *maxline - 1 ; *ip++ = curposition ; strcpy(topline,_topline) ; if ( updheader ) then sxprintf(topline,updformat,*curline,(*maxline)-1,curposition) ; switch( termtype ) { case _VT100: case _VT220: msg_position = strlen(topline) ; rvon() ; putbin("\033",1) ; putbin("7\033[H\033[2K",0) ; putbin(topline,0) ; sxprintf(topline,"Win=%d Pasteb=%d Macb=%d Msgs=%d\n",w, bufnumber,maccurrent,msg_count); msg_position += strlen(topline) - 2 ; if ( msg_count > 9 ) msg_position-- ; putbin(topline,0) ; putbin("\033",1) ; putbin("8",1) ; rvoff() ; break ; case _ANSI: break ; default: break ; } }