// // NEWS.VDM - erleichtert den Zugriff auf News, die in einem ASCII-File // zusammengefasst sind. In einem List-Fenster werden die // Subjects angezeift, durch die man scrollen kann. // // C.Z. 31.08.1996 // // basiert auf: CFUNC.VDM // Originally by: Kerry E. Wilkinson // // Usage: Select {MISC, Load/Execute macro}; load into T-Reg "100". // Num_Push(80,89) // Save numeric registers used here #85 = Buf_Num // #85 = original edit buffer #80 = Reg_Free() // #80 = T-Reg to hold function name array Reg_Set(#80,/ /) // Insert something so next "Reg_Free" works #81 = Reg_Free() // #81 = T-Reg to hold file position array #82 = Buf_Free() // #82 = Buffer to process function name array Buf_Switch(#82) // Needed to make next "Buf_Free" work Buf_Switch(#85) // Switch back #83 = Buf_Free() // #83 = Buffer to process file position array if (#80<=0 || #81<=0 || #82<=0 || #83<=0) { // If no resources... Get_Key("No T-Regs or Buffers available",STATLINE+RAW) Num_Pop(80,89) Return } Reg_Empty(#80) // Empty #80 #84 = 0 // Init loop counter to zero #86 = Cur_Pos // #86 = original buffer's file position #87 = 0 // Clear line number register // #88 = temp used below key_add("F11",'[VISUAL EXIT] Search("|<========|>",REVERSE+NOERR) Search("|<========|>",REVERSE+NOERR) if (!Error_Match) {Search("|",ADVANCE+NOERR) if (!Error_Match) {Search("|",REVERSE+NOERR) BB(CLEAR) BB(CP) Line(1) Search("|<========|>",NOERR) if (Error_Match) {EOF} BE(CP) GP(BB) Line(2) SVL(1)',NOCONFIRM) key_add("Shft-F12",'[VISUAL EXIT] Translate_Load("c:\VEDIT\ANSI.TBL") Translate_Block(BB,BE,REVERSE)',NOCONFIRM) key_add("Ctrl-F12","[VISUAL EXIT] call(100)",NOCONFIRM) Begin_Of_File() Message("Processing file. Please wait...",STATLINE) // // Create arrays of function name and corresponding file position. // repeat (ALL) { // Start 'endless' loop Buf_Switch(#85) // Switch to original buffer Search("|<========|>",ADVANCE+ERRBREAK) Search("|{}, ) {}, // ) {} /* */ #87 = Cur_Pos // Store the function location Out_Reg(#81,APPEND) // Append file position to T-Reg #81 Num_Type(#87,LEFT) Out_Reg(CLEAR) #84++ // Increment loop counter Reg_Set(#80,/ /,APPEND) // Precede function name with space Reg_Copy(#80,1,APPEND) // Append function name to T-Reg #80 Line(1,NOERR) // Continue search on next line } // End of loop // if (#84>0) { // If at least 1 function found... Win_Create(*,2,47,22,32) // Create function display window to the right Win_Switch(*) // Switch to the new window if (Is_Mono) { Win_Color(112) } // If monochrome use black chars on while else { Win_Color(32) } // If color use black chars on green Win_Clear() // Clear window with new color // // Setup buffer #82 to process function name array. // Setup buffer #83 to process file position array. // Buf_Switch(#83) Buf_Empty(OK) Reg_Ins(#81) BOF() // Load file position array Buf_Switch(#82) Buf_Empty(OK) Reg_Ins(#80) BOF() // Load function name array Win_Attach(*) // Attach special window repeat (ALL) { // Loop until or BOL() Block_Begin(Cur_Pos) EOL() Block_End(Cur_Pos) BOL() Update() // Highlight current function name #88 = Cur_Line // #88 = array index Buf_Switch(#83) Goto_Line(#88) // Index into file_position array #86 = Num_Eval() // #86 = corresponding file position Buf_Switch(#85) // Return to main buffer Goto_Pos(#86) Update() // Goto function location BOL() // Goto beginning of line Buf_Switch(#82) Win_Switch(*) // Go back to function list window #88 = Get_Key("Cursor+Enter: select º F11/F12: jump, sF11: mark, sF12: translate, cF12: restart",STATLINE) if(#88=='E'+'S'*256) { // Escape break } if (#88=='R'+'T'*256) { // Return Buf_Switch(#85) #86 = Cur_Pos() Break // Break out of Repeat Loop } if (#88=='C'+'D'*256) { // Cursor Down if (Cur_Line<#84) { Do_Visual("\CD\") } } if (#88=='C'+'U'*256) { // Cursor Up if (Cur_Line>1) { Do_Visual("\CU\") } } if (#88=='P'+'D'*256) { // Page Down if ((Cur_Line+23)<#84) { Line(23,NOERR) } else { EOF() Line(-1,NOERR) } } if (#88=='P'+'U'*256) { // Page Up if (Cur_Line > 23) { Line(-23,NOERR) } else { BOF()} } if (#88=='L'+'E'*256) { End_Of_File() Line(-1,NOERR) } if (#88=='L'+'B'*256) { Begin_Of_File() } // Home } Win_Delete(*) Buf_Switch(#82) Buf_Quit(OK) Buf_Switch(#83) Buf_Quit(OK) } else { Message("No news found. Load new ones and start with cF12. Please press any key now.",STATLINE) } Buf_Switch(#85) Goto_Pos(#86) Update() Num_Pop(80,99) // Restore numeric regs Return