All of the C programs that I get from non-QL sources get to the QL via an MS-DOS disk. As most know, MS-DOS uses LF/CR for newline and the QL uses just LF. I’ve written a simple SuperBasic program that will strip off the last character from each line of a file, thereby getting rid of the unnecessary CR.
I’ve found that it’s a bother to have to run each file through the program first, then edit it. I figured there had to be a way to get rid of the CR in editors that have a macro language.
The editor that I use the most for programming is Metacomco ED. As powerful as MicroEmacs is, I like ED because it can be resized to almost any size. Below is an ED macro that will delete the last character of each line of the resident file. You should be at the top of the file before executing the macro. Since ED does not have a way of checking for End-Of-File, the macro will stop when it comes to an error, which will happen when the macro reaches the end of the file.
RP ( CE; CL; DC; N; )
This macro will also work in QED, the freeware ED work-a-like that comes with C68. One caveat about the macro, don’t worry if the display looks kind of weird while the macro is executing, everything will come back to normal. In fact, it is a good idea to do a screen redraw (F4) to make sure the display looks as it should.
My next task was to write a macro for MicroEmacs. Since I did not find a End-Of-File check in MicroEmacs, it took me a while to realise that MicroEmacs, like ED, will stop a macro when an error is encountered.
After coming up with a script that I felt will work, I loaded a file into MicroEmacs and gave it a try. I found the Execute-File macro, but it is not bound to a key in version 3.9. To run the macro stored in a file, hit M-X (Esc X) to Execute-Program, enter execute-file, and then enter the file name to execute.
Once I figured this out, I thought I had it made. Wrong. Once I entered the file name to execute, nothing happened. I’ve tried it many times and still Nada. Obviously I must be doing something wrong, but I can’t figure it out. Below is the script that I think should work in MicroEmacs. Someone out there should know how to use MicroEmacs better than I and can test it out.
beginning-of-file
!while
end-of-line
delete-previous-character
next-line
!endwhile