; int lowlim ; int highlim ; int target ; int trimarg ; int filopen ; int dovtedit ; int argstat ; int curmode[NWINDOWS]; int *loclow ; int *lochigh ; int *curline ; int ttpsize ; int verbose = 1 ; int kblun = kb_lun ; int cmdlun= kb_lun ; int inlun = in_lun ; int outlun = out_lun ; int indlun = ind_lun ; int tmp1lun = tmp1_lun ; int tmp2lun = tmp2_lun ; int p_lines = 1 ; int oldstsone = 0 ; int sts_one = 0 ; int sts_two = 0 ; char argfile[_FILESIZE] ; char insource[_FILESIZE]; char worddelim[32] ; int dirindex = 0 ; int stvtedit = 0 ; int restart = 0 ; int waswild = 0 ; int maxfilesize = _FILESIZE ; int filesize = 0 ; int hlpctx[2] ; char *hlbuffer ; int nwindows = NWINDOWS ; char infi1[_FILESIZE] ; char infi2[_FILESIZE] ; #if NWINDOWS-3 char infi3[2] ; #else char infi3[_FILESIZE] ; #endif char *infile[] = { infi1,infi2,infi3 } ; /* Define the mechanism for indexing into the window pointers */ /* First, the fast way for virtual 32 bit systems like VMS. */ #if VAXVMS #define _gworkpt(offset) workpt+offset #endif #if RSX extern struct tempindex *mapwin() ; #define _gworkpt mapwin #endif /* #if RSX #define _gworkpt workpt+ #endif */ /* If we want to use a mapped dynamic region for memory management we can define _gworkpt as follows and write a function to check the mapping and appropiately remap if need be. Doing so will of course require mods to the way getvm is called. Additionally, the editor will run a bit slower due to the over- head involved with procedure calls and mapping the region. This alternative has been defined for possible use in the PDP-11 TED and has NO place being used on VMS (obviously). #define _gworkpt(offset) mapwork(offset) static struct tempindex *mapwork(offset) int offset ; { return( workpt+offset ) ; } */ /* Procedure Ins_Line Ins_line takes the line passed to it and inserts it into the current workfile bucket. Obviously, if the current bucket should become full Ins_Line will process that. For insertions after the initial file load, it is assumed that SAVELN has been called to setup the bucket split to handle this. */ ins_line( line ,size ) char *line; int size; { struct textline detab_buffer ; /* in case removing tabs and such */ register char *lp,*dp ; /* register pointer to the line */ register int i ; int more ; /* some local things */ extern int checkindex(); /* check the index for room */ lp = line ; if ( inswitch.tabxl ) then { lp = detab_buffer.c ; size = detab( lp,line, size ) ; } if ( inswitch.casexl ) then { dp = detab_buffer.c ; for (i=size; i > 0; i-- ) *dp++ = toupper(*lp++) ; lp = detab_buffer.c ; } more = true ; while (more) { curbucket[w] = lstbucket[w] ; if ( linecount[w] == 0 ) then blkoffset[w] = 0 ; if ((linecount[w] == bck_fil) || (blkoffset[w]+size >= bck_size)) then { ins_block(); ins_lnks(); linecount[w] = 0 ; more = true ; } else more = false ; } if ( size != 0 ) then tempbuffer[w].rsize[linecount[w]++] = size ; dp = &tempbuffer[w].txt[blkoffset[w]] ; blkoffset[w] += size ; scopy(dp,lp,size) ; return(SYS_NORMAL) ; } putlast( line,size ) char *line ; int size ; { ins_block(); ins_lnks(); ins_line( line,size ); } ins_block() { register int nxtbucket,done,foundlink; lstbucket[w] = 0 ; if ( curmode[w] == ST_IFL ) then { curbucket[w]++ ; lstbucket[w] = curbucket[w] ; (_gworkpt(lstbucket[w]))->link = lstbucket[w] + 1 ; } else { nxtbucket = 1 ; done = ( nxtbucket > maxbucket[w] ) ? true:false ; while (done == false ) { lstbucket[w] = nxtbucket ; if ( (_gworkpt(nxtbucket))->lcount != 0 ) then { nxtbucket++ ; foundlink = false ; done = ( nxtbucket > maxbucket[w] ) ? true:false ; } else { done = true ;TEMPIOC [.050036]TEMPIO.C [.050036]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddf>lcount ; } ; } ; status = gettemp( &tempbuffer[w],curbucket[w],w ) ; tempstat.reads++ ; lstbucket[w] = curbucket[w] ; ctx_valid = 1 ; buffoffset = 0 ; temp = (_gworkpt(curbucket[w]))->lcount ; for (wline=0; wlinec , &tempbuffer[w].txt[buffoffset] , tempbuffer[w].rsize[wline] ) ; w_l_address[wline]->len = tempbuffer[w].rsize[wline] ; buffoffset += w_l_address[wline]->len ; /* scopy( &windpt->lines[wline].c[0], */ /* &tempbuffer[w].txt[buffoffset], */ /* tempbuffer[w].rsize[wline] ) ; */ /* windpt->lines[wline].len = tempbuffer[w].rsize[wline] ;*/ /* buffoffset += windpt->lines[wline].len ; */ } curmode[w] = ST_NORMAL_MODE ; return( lineno - windpt->botlin ); } } putback() { register int i,nlines ; lstbucket[w] = curbucket[w] ; linecount[w] = 0 ; nlines = (_gworkpt(curbucket[w]))->lcount ; for ( i=0; i < nlines ; i++ ) ins_line( &windpt->lines[i].c[0],windpt->lines[i].len ); ins_lnks(); if (curmode[w] != ST_SPECIAL) then curmode[w] = ST_NORMAL_MODE ; ctx_valid = 0 ; return(SYS_NORMAL); } /* Procedure SAVELN SAVELN takes the current window from the start linenumber (relative to the start of the window) to the desired line and updates the index to make room for a new line. The line number are relative, in that they are number 1..WINDOWSIZE. Since offsets for array in 'C' start at zero, the reference to 'lineno-1' should be obvious. */ saveline(rel_start_line,rel_fin_line) int rel_start_line,rel_fin_line; { register int lineno; for ( lineno = rel_start_line; lineno < rel_fin_line; lineno++ ) ins_line(windpt->lines[lineno].c,windpt->lines[lineno].len); return(SYS_NORMAL); } /* Procedure CheckIndex Checkindex should check to see if there is sufficient space in the workfile pointer index (which is maintained in memory) to add ano- ther entry. If not, then it should do the equivalent of a EXTK$S to get the space needed and update the size. */ checkindex( rnum ) int rnum ; { register struct tempindex *status ; extern struct tempindex *getvm() ; int temp ; if ( rnum < indexsize[w]-10 ) then return( SYS_NORMAL ) ; else { if ( (status=getvm(indexsize[w]+INCR_SIZE,w,&temp)) == 0 ) then { tederror("Failure to extend index, please finish") ; return(0) ; } else { indexsize[w] = indexsize[w] + temp ; win_workpt[w] = status ; workpt = win_workpt[w] ; return( SYS_NORMAL ) ; } } } /* SCLOADLINE() load workbuffer with desired line */ /* SCUNLOADLINE() unload desired line from workbuffer */ /* TEXTMODIFY() mark text window as being dirty */ scunloadline() { extern int loaded,laddr,worklength ; extern char workbuffer[] ; register char *wp,*cp; register int i; if ( loaded == 0 ) then return(1) ; loaded = 0 ; wp = workbuffer ; if (worklength == 0) then worklength = 1 ; windpt->lines[sccontext.laddr].len = worklength ; cp = windpt->lines[sccontext.laddr].c ; for (i=0;i= *maxline ) then *curline = *maxline - 1 ; i = findline( *curline ) ; sccontext.laddr = i ; wp = workbuffer ; cp = windpt->lines[i].c ; worklength = windpt->lines[i].len ; scopy(workbuffer,windpt->lines[i].c,worklength) ; read_only = 0 ; if ( *curline == *maxline-1 ) then read_only = 1 ; return(1) ; } txtmod() { extern int *curline,inmode ; if ( (sts_one & _vtedit) == 0 ) then curmode[w] = ST_UPDATE ; else if ( *curline != *maxline ) then curmode[w] = ST_UPDATE ; } ins_scline() { savectx() ; rstctx() ; } savectx() { extern int *curline ; sccontexTEMPIOC [.050036]TEMPIO.C [.050036]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddft.laddr = findline(*curline) ; linecount[w] = 0 ; curmode[w] = ST_INSERT ; sccontext.lc = (_gworkpt(curbucket[w]))->lcount ; saveline(0,sccontext.laddr) ; } rstctx() { extern char workbuffer[]; extern int worklength ; ins_line(workbuffer,worklength) ; (*maxline)++ ; saveline(sccontext.laddr,sccontext.lc) ; ins_lnks() ; } /* switch to a new editing window */ wptset() { register int i ; for ( i = 0 ; i < _BCK_FIL; i++ ) w_l_address[i] = &windpt->lines[i] ; } vtswindow(new_w) int new_w ; { int temp_w ; #if NWINDOWS-1 temp_w = w ; if ( new_w == -1 ) then temp_w = ( temp_w == 0 ) ?1:0 ; else temp_w = new_w ; if ( temp_w > NWINDOWS-1 ) then { scwarning(w_badwin) ; return(0) ; } ; scunloadline() ; w = temp_w ; workpt = win_workpt[w] ; maxline = &win_maxline[w] ; windpt = &window[w] ; wptset() ; loclow = &win_low[w] ; lochigh = &win_high[w] ; curline = &win_curline[w] ; if ( *curline == 0 ) then { inseofmark() ; *loclow = 1 ; *curline = *loclow ; } putbin("\015\012",2) ; scloadline() ; scmove() ; newpage(*curline) ; sctopline() ; scloadline() ; scmove() ; return(1) ; #else scwarning(w_badwin) ; return(0) ; #endif }