McC - Version 2.0 By John H. McClennan February 20, 1989 Introduction: McC is a set of ARexx macros that create an integrated compile/edit enviroment using TxEd Plus and the Lattice C compiler. Version 2.0 of McC is intended for use with Version 5.0 of the Lattice C compiler although it should also work fine with earlier versions of the compiler (this has not been tested, however). In addition to the ARexx macros, Version 2.0 of McC also includes a small filter program written in C. This filter is used to remove the control codes that the compiler uses to highlight errors when the output from the compiler is sent to the standard output stream. Installation: Nine files are included in the distribution of McC Version 2.0. They are: mcc.rexx - This is the ARexx macro invoked to set up the integrated enviroment. mcc1.txed - This is the ARexx macro called from TxEd in order to invoke the compiler. mccnext.txed - This ARexx macro is called from TxEd in order to advance to the next compilation error. mccopts.txed - This ARexx macro is called from TxEd in order to redefine the compiler options. mccstmain.txed - This is the McC startup macro for the main edit window. The standard TxEd startup macro, startup.txed, is called by this macro so any modifications you have made to the TxEd options will be in effect. mccsterr.txed - This is the McC startup macro for the compiler error message window. It also calls startup.txed. mccfilt.c - This is the C source code for the filter to remove the screen control codes from the compiler error output. mccfilt - This is the executable version of the filter. mcc.doc - The file you are reading now. All the files ending in .txed and the file mcc.rexx should be copied into your REXX: directory. The executable file mccfilt should either be in your C: directory or your LC: directory. You may place the file mccfilt.c anywhere you wish (including the circular file). Usage: McC Version 2.0 works whether called from the CLI, the AmigaDOS V1.3 Shell, or from WShell. The only difference is in the way the macro is invoked. When running McC from the CLI or the V1.3 Shell, you must type the command "rx mcc" (omit the quotes). WShell, however, allows the direct execution of ARexx macros (as well as some other nice things). To run McC from WShell, all you must do is type "mcc" at the prompt. Once the macro has been run, the normal TxEd screen will appear. At that time, the editor will attempt to load the file "noname.c". If such a file doesn't exist, the message "Can't Open File" will appear in the window's titlebar. If you wish to use "noname.c" as your file name, you can begin to enter your program. Otherwise, use the normal TxEd commands to load the file you wish to work on. The only change that McC makes to TxEd is the addition of 3 options (and two command key shortcuts) to the User menu. In all other aspects TxEd will work the way it normally does. Compiling a file: To compile the file that you have been editing, select the Compile option from the User menu (or use the keyboard short-cut: Right-Amiga M). A window will appear at the bottom of the screen informing you that the compiler has been invoked and will show the complete path name of the file being compiled. When the compilation is complete, a second TxEd window will appear at the bottom of the screen in the same place that the compilation status window appeared and the main TxEd edit window containing your program will have been decreased slightly in height in order to allow the error window to be visible. If the program compiled without any errors, the compiler message "Total files: 1, Compiled OK: 1" will appear in the error message window. If an error was detected, the first error message will be displayed in the error message window and the cursor in the main edit window will be placed on the line containing the error. Correcting errors: As stated above, if an error is detected in your program by the compiler, the error description will appear in the error message window and the cursor in the main edit window will be placed on the line containing the error. To advance to the next error that was found, seleced the Next Error option from the User menu (or use the short-cut: Right-Amiga N). The next error message, if there is one, will be displayed and the cursor will be advanced to the corresponding line. NOTE: This is where a problem with the Next Error option may occur. If a correction you made for a previous error required the insertion or deletion of a line (or lines), the cursor will not be placed on the correct line for the next error when the Next Error option is selected. This is due to the fact that McC parses the compiler error message in order to get the line number that the error occurred on. When lines have been added to or deleted from the file, the line number in the error message will not be correct. The only way to get the two back in sync is to recompile the file. Setting the compiler options: The Lattice C V5.0 compiler has an abundance of command line options. When it is first run, McC will not pass any options to the compiler. You may use the Set Options item in the User menu to set the options you wish the compiler to use. When the menu item is selected, a window will appear over the error message window. It will display the options currently in effect and prompt you to enter the new options list. NOTE: the new option list supersedes the old one, it is not concatenated to it. Opening other windows: You can use the standard TxEd option to open a new window from within either the McC main edit window or the error message window. Note, however, the only the main edit window opened by McC when it is run will contain the additional menu options allowing the integrated enviroment. If this window is closed, it will not be possible to reopen it without re-running the McC macro. Editing other files: You can edit a new file by using the Open command in the Project menu while the main edit window is active. The new file will replace the one you were currently editing. Exiting McC: Exit from the McC enviroment the same way you would from a normal TxEd edit session by selecting the QUIT option (Right-Amiga Q) from the Project menu. You will have to close both the main edit and the error message windows. When the windows close, you will notice that one (or more) of the Lattice C compiler header messages will be displayed in the CLI (or Shell or WShell) window. Simply press return and the prompt will reappear. Using McC with other compilers: It should not be difficult to modify McC Version 2.0 to work with compilers other than Lattice C V5.0. Lines 41-44 in the file mcc1.txed are the lines that invoke the compiler and are all that should have to be changed in order to invoke a different compiler. A slightly more difficult (but not much more) would be the changes needed to the file mccnext.txed which is used to parse the error messages in order to find where to position the cursor. The parser would have to be changed to reflect the way your compiler's error messages are output. Using McC with other editors: When McC was first written, TxEd Plus was the only editor that had an ARexx interface. Now, however, there are a number of editors that support ARexx and some attention must be given towards modifying McC to work with them. It should not be that difficult since most of the editor commands used by McC are at the very general level (e.g. move to line n) and should have counterparts in other editors. The only two places where problems might occur are in the status and window commands. The status command is used to get the current directory path for editor data files and to get the editor's ARexx port name. If there is a corresponding command in other editors' macro languages, it should be possible to sucessfully modify McC. If there is no corresponding command, it would be extremely difficult, if not impossible, to sucessfully modify McC. The window command is used to modify the sizes and locations of the main edit and error message windows. The absence of a corresponding command would not prevent McC from being successfully modified, but would lead to an interface that wasn't as nice as the automatic sizing and positioning of windows available using TxEd. As a final note, I do not have any other editors that support ARexx so the above is just my observations on possible pitfalls in converting McC to work with other editors. Changes in Version 2.0 with respect to Version 1.3: 1. Version 2.0 is now optimized to work with Lattice C Version 5.0. This has added a little bit of complexity to the internal invocation of the compiler (and the creation of a new temp file in ram: which is deleted after use) due to the need to remove the reverse video and other control codes that look so nice when output is send to the CLI screen but just looks like garbage when view from within TxEd. None of this additional complexity is visible to the user, however. 2. A new, more attractive format for the positioning of the main edit, error message, and status windows has been adopted. 3. An improved error checking scheme has been implemented to handle the two McC windows. Bug reports and comments: Any bug reports or comments can be sent to me via BIXmail to jmcclennan or paper (yechh!!) mail to: John H. McClennan 65 Bonney Dr. Holliston, MA 01746