// C-INIT.VDM - Common code for each {COMPILE} item. // Modified by: Christian Ziemski, April, 2001 // Last Change: 04-Feb-2002. // Last Change: 28-Aug-2003. CZ // //////////////// // // Edit Buffer Usage: // // $30 MAKE's batch file // $31 Temporary // $32 Temporary // XBUF1 Temporary (Can be used in .VCS) // XBUF2 Compiler/tool output file (VCS.TMP) // // Text Register Usage: // // 80 MAKE selected Compiler name // 81 Error file name (Return from .VCS) // 82 Error message (Return from .VCS; Empty ==> no more errors) // 83 Temporary (Can be used in .VCS) // 84 User selected Compiler name (command) // 85 Project filename without extension // 86 Current Link command // 87 Current Make command // 88 MAKE's batch file // 89 Current Debug command // 90 Path to Compiler support files // 91 Current Compiler name // 92 Current Compiler command // 93 Temporary (Can be used in .VCS) // 94 String for error messages; error filename for Make // 95 Config file; OS command to execute // 96 Project directory // 97 Project pathname // 98 Compiler reroute command // 99 Compiler specific ".VCS" macro // 103 Holds C-INIT.VDM and its subroutines // 105 Name of "compile.cnf" or "java-sdk.cnf" file // // Numeric Register Usage: // // #57 Color of include window // #58 Color of options window // #59 Color of help window // #50 Color of error window // #51 Color of menu window // #60 Edit position in Project file (flag) // #61 0=Normal; 1=JavaSDK // #62 Unused // #63 Unused // #64 Unused // #65 Temporary // #66 Flag for use with "-a" invocation option // #67 Flag - 0x434F4D50 ("COMP") when macro is running // #68 Flag - give "Break-out" message // #69 T-Reg with break-out macro // #74 Save original value of -MORE- config // #75 Offset into line of located error // #76 Unused // #77 Edit buffer # of Source-error file (0=None) // #78 Return value from last System() command // #79 Flag/line # in MAKE's batch file // #80 T-Reg containing this macro // #81 Parent's locked-in macro (0=none) // #82 Original buffer # // #83 Original window # // #84 Save state of Visual_Macro // #85 Window zoom status // #86 Unused // #87 Bottom reserved window ID (0=none) // #88 Size of reserved bottom window // #89 Size of reserved bottom window border // #94 Temporary - size for error window // #95 Temporary - line # used in .VCS files // #96 Flag to get 0=next or REVERSE=previous compiler error // #97 Temp used in .VCS files // #98 18 Running Make - non-script // 19 Running Make - script // #99 Flag when chaining from Make/JavaVM to C-COMPILE // #100 Temp used anywhere // #103 - #106 Temp used anywhere // #124 Register # used by COMPILE.MNU // ////// if (#67==0x434F4D50) { //If compiler support already running Return //Return } // // Determine if normal Compiler support or Java SDK support is loaded. // Assume Java SDK if the {TOOLS} menu contains the word "java". // #106 = Buf_Num Buf_Switch(XBUF1) Buf_Empty(OK) //Switch to temp buffer and empty it Reg_Ins(123) //Insert {Tools} menu if ( Search("java",BEGIN+NOERR) ) { //If "java" found... #105 = 1 //Set flag, assume Java SDK support Reg_Set(105,"java-sdk.cnf") //Use "java-sdk.cnf" } else { #105 = 0 //Clear flag for normal compiler support Reg_Set(105,"compile.cnf") //Use "compile.cnf" } Buf_Empty(OK) Buf_Switch(#106) //Switch back to original buffer if ((File_Exist(@(105))==0) && (File_Exist("|(HOME)/|@(105)")==0)) { Alert() if (OS_TYPE==1) { DI1(0,"`VEDIT Compiler Support Error`,`Required file |@(105) not found.`",APP+CENTER,0,0) } else { Get_Key(/Required file COMPILE.CNF not found./,STATLINE) } Return(-1) } // // If buffers 30 - 32 are in use, get confirmation to save/abandon them. // if (Buf_Status(30)>=0 || Buf_Status(31)>=0 || Buf_Status(32)>=0) { Alert() Message("\nBuffers 30 - 32 may contain files. Do you want to save them?") Message("\n[S]ave files; [A]bandon files; [C]ancel macro : ") while ((#103 = Get_Key()&0xFFDF)!='S' && #103!='A' && #103!='C') { Alert } //Get valid input "S", "A" or "C" Char_Dump(#103) if (#103=='C') { Break_Out } for (#104=30; #104<=32; #104++) { //Loop for buffers 30-32 if (Buf_Status(#104)>=0) { //If buffer is open... Buf_Switch(#104) //Switch to buffer if (#103=='S' && Is_Open_Write) { File_Close() //Close file } Buf_Quit(OK+MAINBUF) //Close buffer } } } // Init - 1) Save state // 2) Determine free buffers/T-Regs // 3) Setup T-Reg #69 with Break-out/exit (locked-in) macro // Num_Push(55,99) //Save numeric regs Reg_Push(80,99) //Save text regs #67 = 0x434F4D50 //Flag that compiler support running #80 = Macro_Num //#80 = T-Reg containing this macro #81 = Reg_Lock_Macro //#81 = parent's locked-in macro (0=none) #82 = Buf_Num //#82 = original buffer # #83 = Win_Num //#83 = original window # (maybe status line!) #84 = Visual_Macro //#84 = save state of Visual_Macro #85 = Is_Zoomed //#85 = window zoom status #87 = 0 //Assume no reserved windows Win_Zoom(CLEAR) //Dezoom windows #74 = Config(S_E_MORE,0) //Disable -MORE- #61 = #105 //Set #61=1 if Java SDK support // // Save state of any reserved bottom window. // if (#87=Win_Reserved_Bottom_ID) { //If reserved bottom window... Win_Switch(#87) //Switch to it #88 = Win_Lines //#88 = lines in it #89 = Win_Border //#89 = # border lines in it Win_Delete() //Delete it Win_Switch(#83) //Switch back to original window } // // #77 = 0 //No error file yet Reg_Set(#69=Reg_Free," ") //#69 = Reserve T-reg for locked-in macro Visual_Macro(CLEAR) //Permit run from {MISC, Load/execute macro} // // "Locked-in" macro #69 catches break-outs and exits macro. // Reg_Set(#69,~ // // If #68 > 0; an error break-out occurred. if (#68>0) { if (OS_Type==1) { #103 = DI1(9,^`VEDIT Compiler Support Error`, `An unexpected error occurred. An error message may be visible on the screen. [Continue] Resume editing. [Debug] Goto the COMMAND: prompt. (For experienced users.)`, `[&Continue]`,`[&Debug]`^,APP+CENTER,0,0) if (#103==2) { Reg_Lock_Macro(CLEAR) //Disable locked-in macro Break_Out //Break out to "COMMAND:" prompt } } else { Win_Create('M',6,19,10,42) //Create pop-up message window Win_Switch('M') Win_Color(79) Win_Clear() Message(" *** Compiler support error ***\n\n",TAB8) Message("An unexpected error occurred. An error\n") Message("message may be visible on the screen.\n\n") Message("[C]ontinue] Resume editing.\n\n",TAB8) Message("[Debug] Goto the COMMAND: prompt.\n",TAB8) Message(" (For experienced users.)\n\n",TAB8) Message("Select which option? [C] [D]\n",TAB8) Win_Vert(9) Win_Hor(31) while ((#103 = Get_Key()&0xDF)!='C' && #103!='D') { Alert } Win_Delete('M') if (#103=='D') { Reg_Lock_Macro(CLEAR) //Disable locked-in macro Break_Out //Break out to "COMMAND:" prompt } } Win_Delete('H') } // Buf_Switch(XBUF1,LOCAL) Buf_Quit(OK+DELETE) //Quit any temp file Buf_Switch(30) Buf_Quit(OK) //Delete any Make script buffer File_Delete("|@(96)/vcs-tmp.bat",OK+NOERR) //Delete any .BAT file // // If #60>=0, reload the current file. // if (#60>=0) { //Need to restore "current" file Buf_Switch(#82) Buf_Empty(OK) if (Reg_Size(97)) { // File_Open(@97) // CZ- File_Open('"|@(97)"') // CZ: double quotes due to possible spaces in filenames Goto_Pos(#60) if (Cur_Char==10) { Char(-1) } //Backup to CR if at LF } #60 = -1 //Reset flag } // // If VCS.TMP file open, save our position in it with a header. // if (Buf_Status(XBUF2)>=0) { //If VCS.TMP file open... Buf_Switch(XBUF2) #103 = Cur_Line //#103 = current line # BOF() Ins_Text("*** VCS Last Line = ") //Add header Num_Ins(#103) //Add line# and CR+LF Buf_Close(NOMSG+NOEVENT) //Save modified vcs.tmp file } // Delete any bottom help window. // Restore any original reserved bottom window. // Win_Delete('H') Win_Delete(XBUF2) if (#87) { if (#89==0) { Win_Reserved(#87,#88,BOTTOM+NOBORDER) } else { if (#89==1) { Win_Reserved(#87,#88,BOTTOM+MINBORDER) } else { Win_Reserved(#87,#88,BOTTOM) } } } Win_Switch(#83) //Return to original window Win_Zoom(#85) //Restore window zoom state if (#77 >= 1 && #77 < 30) { Buf_Switch(#77) //Switch to buffer with error file } else { Buf_Switch(#82) //Return to original buffer } // if (#84) { Visual_Macro(SET+NOMSG) } //Return to Visual Mode; no Pause Config(S_E_MORE,#74) //Restore -MORE- state Escape_Mode(-1) //Restore key to normal operation Reg_Empty(99) //Empty .VCS macro Reg_Empty(#80,EXTRA) //Empty register with main macro Reg_Lock_Macro(#81) //Restore any previous locked-in macro Reg_Pop(80,99) //Restore text regs Num_Pop(55,99) //Restore numeric regs Reg_Empty(Macro_Num,EXTRA) //Empty this T-Reg; return Return //Just in case ~) Reg_Lock_Macro(#69) //Use #69 as locked-in macro #68 = 1 //Flag to give "Break-out" message // :START: #60 = -1 //Clear edit-file flag/position if (OS_Type<4) { Reg_Set(93,"\") } //@93 = "\" or "/" depending upon else { Reg_Set(93,"/") } //DOS or UNIX if (#61) { Reg_Set(94,"Error in JAVA-SDK.CNF parameter: ") } else { Reg_Set(94,"Error in COMPILE.CNF parameter: ") } Reg_Load(95,@(105),EXTRA) //Load default configuration Buf_Switch(XBUF1) Buf_Empty(OK) //Switch to temp buffer and empty it Reg_Ins(95) //Load COMPILE.CNF/JAVA-SDK.CNF #101 = 0 //Reset CNFERROR error reason // // Check the "SUPPORTPATH=" in COMPILE.CNF. If set use it, otherwise // default to VEDIT-Home-Directory\COMPILE, e.g. "C:\VEDIT\COMPILE". // if (Search("| beginning of parameter if (Search('|{",|B,|>}',NOERR)==0) { Goto CNFERROR } //Error if end-of-parameter not found Char(-1) //Backup to last char of parameter if (Match(@93,ADVANCE)!=0) { //If last char not "\" (or "/") ... Char() Ins_Text(@93) //Ensure path ends in "\" (or "/") } Reg_Copy_Block(90,Block_Begin,Cur_Pos) //@90 = support path Block_Begin(CLEAR) //Remove markers } else { Reg_Set(90,HOME) //@90 = (e.g.) "c:\vedit" Reg_Set(90,@93,APPEND) //@90 = (e.g.) "c:\vedit\" Reg_Set(90,"compile",APPEND) //@90 = (e.g.) "c:\vedit\compile" Reg_Set(90,@93,APPEND) //@90 = (e.g.) "c:\vedit\compile\" } // // Determine whether to use Color or Monochrome colors. // if (Search("|=2) { #57 = #58 = 7 //Values for Monochrome IBMPC #59 = #50 = 112 #51 = 15 } else { #57 = #58 = 0 //Values for non-IBMPC #59 = #50 = 1 #51 = 0 }} // // Read the default Compile, Link, Debug and Make commands from COMPILE.CNF. // @92 = Default Compile command. // @86 = Default Link command // @89 = Default Debug command // @87 = Default Make command if (Search("|",NOERR)==0) { Goto CNFERROR } //Find end of parameter Reg_Copy_Block(92,Block_Begin,Cur_Pos) Block_Begin(-1) if (Search("|",NOERR)==0) { Goto CNFERROR } Reg_Copy_Block(86,Block_Begin,Cur_Pos) Block_Begin(-1) if (Search("|",NOERR)==0) { Goto CNFERROR } Reg_Copy_Block(89,Block_Begin,Cur_Pos) Block_Begin(-1) if (Search("|",NOERR)==0) { Goto CNFERROR } Reg_Copy_Block(87,Block_Begin,Cur_Pos) Block_Begin(-1) // // Search for a local COMPILE.VCO file and use any commands in it. // The first line is the compiler command, followed by the Link command, // Debug command and Make command. // Buf_Quit(OK) //Dump COMPILE.CNF file if (File_Exist("compile.vco")) { //Check for local Compile commands Reg_Load(95,"compile.vco") //Load local configuration Buf_Switch(XBUF1) Buf_Empty(OK) //Switch to temp buffer and empty it Reg_Ins(95,BEGIN) //Load COMPILE.VCO // Match("|W",ADVANCE) Block_Begin(Cur_Pos) //Skip leading whitespace End_Of_Line() if (Cur_Pos>Block_Begin) { //1st line is Compile command Reg_Copy_Block(92,Block_Begin,Cur_Pos) } Line(1,NOERR) if (At_EOF) { Goto Start_1 } //Branch if no more lines Match("|W",ADVANCE) Block_Begin(Cur_Pos) End_Of_Line() if (Cur_Pos>Block_Begin) { //2nd line is Link command Reg_Copy_Block(86,Block_Begin,Cur_Pos) } Line(1,NOERR) if (At_EOF) { Goto Start_1 } Match("|W",ADVANCE) Block_Begin(Cur_Pos) End_Of_Line() if (Cur_Pos>Block_Begin) { //3rd line is Debug command Reg_Copy_Block(89,Block_Begin,Cur_Pos) } Line(1,NOERR) if (At_EOF) { Goto Start_1 } Match("|W",ADVANCE) Block_Begin(Cur_Pos) End_Of_Line() if (Cur_Pos>Block_Begin) { //4th line is Make command Reg_Copy_Block(87,Block_Begin,Cur_Pos) } } :Start_1: Reg_Set(84,@92) //Save compile command in @84 Buf_Switch(32) Buf_Empty(OK) //Switch to temp buffer Reg_Ins(92,BEGIN) //Work with compile command Search("|{|B,|>}",NOERR) //Go to end of program name Block_Begin(Cur_Pos) //Set marker if (OS_Type<4) { Search("|{|<,:,\}",REVERSE) Char(Chars_Matched) //Backup to start of name } else { Search("|{|<,/}",REVERSE) //Chars for UNIX/QNX Char(Chars_Matched) } Reg_Copy_Block(91,Cur_Pos,Block_Begin) //@91 = compiler name Buf_Switch(31) if (! File_Exist("|@(90)|@(91).vcs")) { //Make sure compiler.VCS file exists Reg_Set(94,"Compiler specific .VCS file not found") #101=1 Goto CNFERROR } Buf_Quit(OK) //Dump config file Buf_Switch(#82) //Return to original buffer File_Delete("|@(96)/vcs-tmp.bat",OK+NOERR) //Delete any .BAT file Escape_Mode('V'+'E'*256) //Make key do [Visual Exit] if (Buf_Status(30)>=0) { Buf_Switch(30) Buf_Quit(OK) } //Delete temp buffers if (Buf_Status(31)>=0) { Buf_Switch(31) Buf_Quit(OK) } if (Buf_Status(32)>=0) { Buf_Switch(32) Buf_Quit(OK) } Buf_Switch(#82) //Switch to "current" buffer Reg_Empty(83) //Empty temp T-Regs... Reg_Empty(94) Reg_Empty(95) Reg_Empty(97) //Setup to determine Project file Reg_Empty(96) Reg_Empty(85) if (Is_Open_Write) { //If Project file exists... Reg_Set(97,PATHNAME) //@97 = full project pathname Reg_Set(96,PATHONLY) //@96 = project directory Reg_Set(85,FILEONLY) //@85 = project filename without .ext } // // Load compiler support .VCS file. // Reg_Load(99,"|@(90)|@(91).vcs",EXTRA) //Load compiler support into @99 Reg_Set(92,@84) //Reset compile command from @84 Return // // COMPILE.CNF Error // :CNFERROR: if (#101==1) { Reg_Set(94," Check that you have a .VCS file for the compiler specified in your COMPILE.CNF file, or in the (optional) local COMPILE.VCO file. (COMPILE.CNF will be loaded for you)",APPEND) } else { Reg_Set(94," Your COMPILE.CNF file does not have the parameter specified above, or it does not have the correct syntax. (COMPILE.CNF will be loaded for you)",APPEND) } // if (OS_Type ==1) { DI1(9,^`VEDIT Compiler Support Error`,`|@(94)`^,APP+CENTER,0,0) } else { Win_Create('M',6,15,12,50) //Create pop-up message window Win_Switch('M') Win_Color(79) Win_Clear() Message(" *** Compiler support error ***\n\n",TAB8) Reg_Type(94) //Display error message Message(" [Ok]",TAB8) Win_Vert(11) Win_Hor(25) #104=Get_Key("",RAW) if (#104==^X) { //If "^X" maintenance exit... Break_Out //Break out to "COMMAND:" prompt } Win_Delete('M') } Reg_Empty(94) Reg_Empty(95) File_Open("|(HOME)/|@(105)") //Load .CNF file Visual() //Go edit loaded file Return(-2) // // S U B R O U T I N E S // // // ADD_PROJECT - Expand command line to include name of program. // Close project file; save all other buffers. // Enter: @95 = command line. // @96 = Project directory. // @97 = project pathname. // @85 = project filename without .ext. // Return: @95 = command line with "-proj" and "-name" expanded. // :ADD_PROJECT: Buf_Switch(#82) //Switch to "current" buffer if (Is_Open_Write) { //If a Project file exists... if (#60==-1) { #60 = Cur_Pos } //Set flag/save cursor position File_Close(NOMSG) //Close (save) Project file } File_Save(ALL) //Save all open files Buf_Switch(XBUF1) Buf_Empty(OK) //Switch to temp buffer and empty it Reg_Ins(95,BEGIN) //Load command line; goto beginning repeat (10) { //Up to 10 "-proj" Search("-proj",ADVANCE+ERRBREAK) //Search for "-proj" (or "-proj.ext") if (! Reg_Size(97)) { //If no project file specified... Get_Input(93,"\nProject file: ",NOCR) //Ask for name if (!Reg_Size(93)) { Call(99,"DEFAULT") } //If blank use default (e.g. "*.C") Get_Filename(93,@93) //If wildcards, via point&shoot if (Reg_Size(93)>0) { // CZ: divided into 2 if's because of if (File_Exist(@93)) { //If file exists... // CZ: problem when GF() returns without filename Reg_Set(97,@93) //Transfer name to @97 } else { #92 = 0 //Suppress BREAKOUT message Break_Out //Break out to locked-in main menu } } else { #92 = 0 //Suppress BREAKOUT message Break_Out //Break out to locked-in main menu } Buf_Switch(#82) //Switch to "current" buffer // File_Open(@97) Update() //Open Project file // CZ- File_Open('"|@(97)"') Update() //Open Project file // CZ: double quotes due to spaces in filenames Reg_Set(96,PATHONLY) //@96 = project directory Reg_Set(85,FILEONLY) //@85 = project filename without .ext // CZ: typo fixed } Buf_Switch(XBUF1) //-> past "-proj" if (Match(".ext",ADVANCE)==0) { //If extension included... Del_Char(-9) //Delete the "-proj.ext" Reg_Ins(97) //Use full project filename.ext } else { //Else, leave off the ".ext" ... Block_Begin(Cur_Pos - 6) //BB-> beginning of filename Del_Char(-5) //Delete the "-proj" Reg_Ins(97) //Insert the project pathname.ext Block_End(Cur_Pos) //BE-> past end of pathname.ext // // Strip existing .ext from pathname. // Watch out for "." within the path. // Goto_Pos(BE) //Goto end of pathname.ext Search_Block("\", BB,BE, NOERR+REVERSE) //Find beginning of filename BB(Cur_Pos) //BB-> beginning of filename Goto_Pos(BE) //Goto end of filename.ext if (Search_Block(".",BB,BE,NOERR+REVERSE)) { //If file extension found... Del_Block(Cur_Pos,Block_End) //Delete ".ext" } // // Java SDK VM needs full pathname split into path, space, filename. // if (#61==1) { //If Java SDK VM... Goto_Pos(BE) //Goto end of filename Reg_Ins(98) //Add reroute tail "> vcs.tmp" Goto_Pos(BE) // Replace_Block("\"," ",BB,BE,REVERSE+NOERR) // CZ- Replace_Block('\','" "',BB,BE,REVERSE+NOERR) //Change "\" to a space // CZ and add surrounding double quotes } Goto_Pos(BE) //Goto end of filename Block_Begin(CLEAR) //Clear BB and BE } } // // Replace "-name" with simple project filename, without the .ext. // Replace("-name",@85,BEGIN+ALL+NOERR) Begin_Of_File Reg_Copy(95,ALL) //Copy expanded command back to @95 // if (Buf_Status(XBUF2)>=0) { //Be sure vcs.tmp not open Buf_Switch(XBUF2) Buf_Quit(OK) } File_Delete('"|@(96)/vcs.tmp"',OK+NOERR) //Delete any error/output file // CZ: single quotes around doubles Buf_Switch(#82) //Switch to "current" buffer Return // // MAKE_BAT - Create VCS-TMP.BAT file in project directory. // Needed by Windows version to set current directory after shelling. // Enter: @95 = Command line and options. // @96 = Project directory. // @97 = Project pathname. // @98 = Rerouting command (optional). // :MAKE-BAT: Buf_Switch(XBUF1) Buf_Empty(OK) //Switch to temp buffer and empty it Reg_Ins(96) //Insert project directory if (OS_Type<4) { Search("\",BEGIN+NOERR) } else { Search("/",BEGIN+NOERR) } // // If Project directory is empty, source file is in root. // if (Error_Match) { if (OS_Type<4) { Ins_Text("\") } else { Ins_Text("/") } Char(-1) } // Ins_Newline() //Split drive from path // Ins_Text("cd ") // CZ- Ins_Text('cd "') // CZ opening double quote around path EOF IT ('"') // CZ closing double quote around path Ins_Newline() Reg_Ins(95) //@95 is the shell command string IT(" ") Reg_Ins(98) //@98 is the reroute tail, e.g. "> vcs.tmp" Write_Block('"|@(96)/vcs-tmp.bat"',0,EOB_Pos,OK) // CZ: single quotes around doubles Buf_Switch(#82) Return // // OPEN-VCS.TMP - Open the vcs.tmp file in Extra_Buffer_2. // Display error if no vcs.tmp found after compile/link. // :OPEN-VCS.TMP: if ((#103=File_Check('"|@(96)/vcs.tmp"'))>0) { //If vcs.tmp file already open... // CZ: single quotes around doubles if (#103==XBUF2) { //If already open in Extra_Buffer_2... Buf_Switch(XBUF2) //Be sure switched to Extra_Buffer_2 Return //And return } Buf_Switch(#103) //Else switch to its buffer Buf_Close(NOMSG+NOEVENT) // and close it } if (! File_Exist('"|@(96)/vcs.tmp"')) { //If no output file... // CZ: single quotes around doubles Alert() if (OS_Type ==1) { DI1(9,^`VEDIT Compiler Support Error`, `No "vcs.tmp" error/output file created or cannot run specified compiler/tool. Possible causes: Can't shell to COMMAND.COM Insufficient free memory Compiler/tool not found`, `[&Ok]`^,APP+CENTER,0,0) } else { Win_Create('M',6,20,12,40) Win_Switch('M') Win_Color(#57) Win_Clear() Message(` No "vcs.tmp" error file created or cannot run specified compiler/tool. Possible causes: Can't find `) if (OS_Type<3) { Message("COMMAND.COM") } else { Message("shell") } Message(" [Ok]") Win_Vert(10) Win_Hor(19) Get_Key("") Win_Delete('M') } Return(-1) //Error return } // // Open vcs.tmp file in Extra_Buffer_2. // If file contains our header, goto last processed line. // Buf_Switch(XBUF2,EXTRA) Buf_Empty(OK) File_Open('"|@(96)/vcs.tmp"',FORCE+NOEVENT) //Open error/output file // CZ: single quotes around doubles if (Match("*** VCS Last Line = ",ADVANCE)==0) { //If file already processed #103 = Num_Eval() //#103 = last processed line number BOL() Del_Line() //Delete our header Goto_Line(#103) //Goto previous position } else { Replace(" "," ",BEGIN+ALL+NOERR) //Clean up double (Avocet C) End_Of_File() Ins_Newline() //Place extra "newline" at end BOF() } File_Save(NOMSG) //Save cleaned-up vcs.tmp file if (File_Size < 3) { //If just a trivial output file... return(-1) // e.g. just 1/2 blank lines } Return // // DISPLAY-OUTPUT - Display vcs.tmp file, allow viewing it in Visual Mode. // :DISPLAY-OUTPUT: if (Win_Status('H')<0) { //Create help window if needed if (Win_Border>=2) { Win_Reserved('H',1,BOTTOM+NOBORDER) } else { Win_Reserved('H',1,BOTTOM) } } if (OS_TYPE==1) { Win_Create(XBUF2,0,0,0,0) //Create full-size window } else { Win_Create(XBUF2,0,0,Screen_Lines-2,Screen_Cols) } Win_Switch(XBUF2) Win_Color(#57) //Switch to new window, set color Buf_Switch(XBUF2) BOF() Config(PG_E_SYNTAX,0,LOCAL) //Disable Syntax Highlight in output file Update() //Display output Win_Switch('H') Win_Color(#59) Win_Clear() Message('Press "V" to view output; any other key to continue: ') #103 = Get_Key("",RAW)&0xFFDF //Get key, convert to UC if (#103=='V') { Win_Switch('H') Win_Color(#59) Win_Clear() Message("View file; press to resume normal editing") Visual() } Return