[comp.misc] UNIX C-compiler

brad@SSD.CSD.HARRIS.COM (Brad Appleton) (04/08/90)

In article <2JO2148xds13@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
>> Yes, a shell 
>> command from within vi will do the compilation, but either you'll lose your 
>> errors on return to vi (if you don't redirect stdout), or you won't see 
>> them in the first place (if you do).
>
>:map ^C Go^V^[!!cc -c $CFLAGS %
>
>Now when you hit '^C' your program is compiled and the errors are included at
>the end of the file.
>
I like this a lot Peter! Just to be safe though, anyone who tries this ...
make sure you write the file before you use the mapping (or put the "write"
command into the mapping). Even the best of us forget this every now & then!


For those who arent satisfied with the above ...

I bet it wouldnt be obscenely hard to make a shell/awk/sed/perl script to take
the output of cc and insert the error messages into the file, after the
line in which they occur (anyone care to try this one out?). Then your map
command could: 

1) write the file
2) compile the program and send/pipe the error output to the script
3) do a re-sync command from vi so that you are now editing the file
   with the inserted messages.

If you want to get fancy, you can put some funky text around the error 
messages "%%% <text> ###" and add step 4) to search for "^%%%.*###$".
You can delete the messages with "g/^%%%.*###$/d"

Anyone who has (or composes) such a script please post (or at least 
e-mail it to me!)
-=-=-=-=-=-=-=-=-=-=-= "And miles to go before I sleep." =-=-=-=-=-=-=-=-=-=-=-
 Brad Appleton         Harris Computer Systems         brad@ssd.csd.harris.com
 (305) 973-5007        Fort Lauderdale, FL USA        {uunet,novavax}!hcx1!brad
-=-=-=-=-=-=-=-=-=-= Disclaimer: I said it, not my company! -=-=-=-=-=-=-=-=-=-

brad@SSD.CSD.HARRIS.COM (Brad Appleton) (04/12/90)

Sorry to have to post this but this seems to be the only solution!

STOP SENDING ME E-MAIL ABOUT THE BSD ERROR(1) PROGRAM!!!!!

Yes, I did ask for scripts to do this sort of thing but anyone who has
read this thread at all will notice that this program was already 
mentioned! If you read real closely, you will notice that I WAS THE 
ONE THAT MENTIONED IT! Please pay more attention to the threads you read.


To all those that havent sent me e-mail about error(1)
THANK YOU SO VERY MUCH, and I apologize for having to post this!

-=-=-=-=-=-=-=-=-=-=-= "And miles to go before I sleep." =-=-=-=-=-=-=-=-=-=-=-
 Brad Appleton         Harris Computer Systems         brad@ssd.csd.harris.com
 (305) 973-5007        Fort Lauderdale, FL USA        {uunet,novavax}!hcx1!brad
-=-=-=-=-=-=-=-=-=-= Disclaimer: I said it, not my company! -=-=-=-=-=-=-=-=-=-

jik@athena.mit.edu (Jonathan I. Kamens) (04/13/90)

In article <3659@hcx1.SSD.CSD.HARRIS.COM>, brad@SSD.CSD.HARRIS.COM (Brad 
Appleton) writes:
> I bet it wouldnt be obscenely hard to make a shell/awk/sed/perl script
to take
> the output of cc and insert the error messages into the file, after the
> line in which they occur (anyone care to try this one out?). Then your map
> command could: 
> 
> 1) write the file
> 2) compile the program and send/pipe the error output to the script
> 3) do a re-sync command from vi so that you are now editing the file
>    with the inserted messages.
> 
> If you want to get fancy, you can put some funky text around the error 
> messages "%%% <text> ###" and add step 4) to search for "^%%%.*###$".
> You can delete the messages with "g/^%%%.*###$/d"

  You're right, it wouldn't be obscenely hard to do this with a script. 
However, Berkeley has already written a C program to do it, and the
source code for that program is freely redistributable, so why reinvent
the wheel?

  To quote from error(1):

     Error analyzes and optionally disperses the diagnostic error
     messages produced by a number of compilers and language pro-
     cessors to the source file and line where the errors
     occurred.  It can replace the painful, traditional methods
     of scribbling abbreviations of errors on paper, and permits
     error messages and source code to be viewed simultaneously
     without machinations of multiple windows in a screen editor.

     ...

     Error knows about the error messages produced by: make, cc,
     cpp, ccom, as, ld, lint, pi, pc, f77, and DEC Western
     Research Modula-2.

  You can get the sources to error from uunet via anonymous ftp (or
anonymous ftp, whatever) in the directory ~ftp/bsd-sources/src/ucb/error.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710

jik@athena.mit.edu (Jonathan I. Kamens) (04/13/90)

In article <1990Apr12.192458.16096@athena.mit.edu>, I write:
>   You can get the sources to error from uunet via anonymous ftp (or
> anonymous ftp, whatever) in the directory ~ftp/bsd-sources/src/ucb/error.
  ^^^^^^^^^^^^^

  This should have been "anonymous uucp", of course.

  And, of course, I didn't notice the mistake until it was too late to
stop the posting.

  Sigh.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710