// CONDENSE for COBOL macro; uses treg buf_num +11 for output; // Uses nregs 11 and 12 as work areas; // treg 92, 93 as other work areas; final display in buffer buf_num + 11 reg_set(114,"if (BN>11){CF(S_H_CR_LINE,2)} else {CF(S_H_CR_LINE,0)}") save_pos() Begin_Of_File() #11 = Buf_Num // store current buffer in nreg 11 #12 = (Buf_Num + 11) // store target treg in nreg 12 Reg_Empty(#12) Buf_Switch(#12) // goto it in case it exists to quit it Buf_Empty(OK) Buf_Close(DELETE) Buf_Switch(#11) // back to current buffer Search(/|< working-storage /,ADVANCE+NOERR) if(Error_Match==0) { Line(0) Reg_Copy(#12,1,APPEND) Line(1) } Search(/|< procedure /,ADVANCE+NOERR) if(Error_Match==0) { Line(0) Reg_Copy(#12,1,APPEND) Line(1) } while (Search(/|< |F/,NOERR)) { Reg_Copy(93,1) // put located line into treg 93 to test for EXIT buf_switch(33) // work buffer to examine line for EXIT Reg_Ins(93,BEGIN) Match("|Mexit") Buf_Quit(OK) Buf_switch(#11) if(Error_match <> 0) {Reg_Copy(#12,1,APPEND)} // put located line into treg Line(1) } Reg_Set(#12,/--------use CTRL-G to go to line program---------- /,INSERT) // Get filename Out_Reg(92) Name_Write(NOCR+NOMSG) Out_Reg(CLEAR) Reg_Set(92,/-------------/,INSERT) Reg_Set(92,/ CONDENSATION------------- /,APPEND) // //******************************************************** // the following builds GONUM.VDM into CTRL-G //Key_Add($^G$, $[VISUAL EXIT] if(BN<12) { #11 = (BN+11) BS(#11) CF(S_H_CR_LINE,2 ) break_out(EXTRA) } L(0) RC(1,1) #11 = (BN-11) BS(#11) CF(S_H_CR_LINE,0 ) BOF(LOCAL) S( /|@(1)/,ADVANCE+NOERR) if(EM<>0) { BOF() S(/|@(1)/,ADVANCE+NOERR) } L(-1,NOERR) SVL(1)$,NOCONFIRM) Key_Add($^G$, $[VISUAL EXIT] if(BN<12) { #11 = (BN+11) BS(#11,EVENT) Return } L(0) RC(1,1) #11 = (BN-11) BS(#11,EVENT) BOF(LOCAL) S( /|@(1)/,ADVANCE+NOERR) if(EM<>0) { BOF() S(/|@(1)/,ADVANCE+NOERR) } L(-1,NOERR) SVL(1)$,NOCONFIRM) //******************************************************** // modify F2 to not allow toggle to condensed views //Key_Add($F2$, $[VISUAL EXIT]if(BN>11) { #11 = (BN-11) BS(#11) CF(S_H_CR_LINE,0 ) } else {if(BX>11) { BS(1) } else { BS(BX()) }}$,NOCONFIRM) Key_Add($F2$, $[VISUAL EXIT]if(BN>11) { #11 = (BN-11) BS(#11,EVENT) } else {if(BX>11) { BS(1,EVENT) } else { BS(BX(),EVENT) }}$,NOCONFIRM) //******************************************************** // modify F3 to quit on altered condensed view without question Key_Add($F3$, $[VISUAL EXIT]if(BN>11) {BQ(OK+DELETE) BS(BN,EVENT)} else {BQ(DELETE) BS(BN,EVENT)}$,NOCONFIRM) //******************************************************** restore_pos() Buf_Switch(#12,LOCAL+EVENT) // edit .bn + 11 Win_Create(#12,6,50,10,28,ATTACH) Reg_Ins(#12) // insert treg #12 into edit buf #12 BOF() Reg_Ins(92,BEGIN) Reg_empty(#12) Reg_empty(92) DOV(/\CD\\CD\/) // Line() makes the screen scroll