home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 419b.lha / mkproto / POSTER < prev    next >
Internet Message Format  |  1990-04-01  |  2KB

  1. Path: wright!ncrlnk!ncr-sd!hp-sdd!hplabs!ucbvax!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!allbery
  2. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  3. Newsgroups: comp.sources.misc
  4. Subject: v08i030: mkproto -- make ANSI style prototypes
  5. Message-ID: <66800@uunet.UU.NET>
  6. Date: 7 Sep 89 02:05:45 GMT
  7. Sender: allbery@uunet.UU.NET
  8. Reply-To: ersmith@uwovax.uwo.ca
  9. Lines: 930
  10. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  11.  
  12. Posting-number: Volume 8, Issue 30
  13. Submitted-by: ersmith@uwovax.uwo.ca
  14. Archive-name: mkproto
  15.  
  16. Here is mkproto, a program for generating prototype declarations for all
  17. functions appearing in a C source file. The input C code may be either
  18. K&R or ANSI C (i.e. it's OK if the functions are defined using prototypes).
  19. Unlike some of the sed-based scripts floating around, it correctly
  20. handles prototype promotion (e.g. the prototype for 'int foo() char x;...'
  21. is 'int foo(int x)'). Also, it should work OK on just about any computer,
  22. not just Unix-based ones (it's been tested under minix, Unix, and TOS).
  23.  
  24. Use: typically, you would type 'mkproto *.c >proto.h' and then add a
  25. '#include "proto.h"' line to all the C source files. An ANSI conformant
  26. compiler will then be able to do type checking on function calls across
  27. module boundaries. As a bonus, proto.h will tell you which source files
  28. functions were defined in, and (if you gave the -n function to mkproto)
  29. their line numbers. The resulting include file may also be used by
  30. non-ANSI compilers; you can disable this feature (for cleaner, strictly
  31. ANSI-conforming output) with the -p flag.
  32.  
  33. Please read the description of bugs in mkproto.man; definitely mkproto
  34. will not handle all programs correctly, but it does work on the majority of
  35. them. A sample of its output is provided in the file "mkproto.h"; this
  36. is the result of 'mkproto mkproto.c >mkproto.h'.
  37.  
  38. There is ABSOLUTELY NO WARRANTY for the program; as I said, it doesn't work
  39. on all programs (complicated function definitions can make it produce bogus
  40. output). It does what I need, though, and it can certainly make porting stuff
  41. to ANSI compilers easier.
  42.  
  43. Mkproto is in the public domain. If you find any bugs (other than the ones
  44. documented) please let me know.
  45. --
  46. Eric R. Smith                     email:
  47. Dept. of Mathematics            ersmith@uwovax.uwo.ca
  48. University of Western Ontario   ersmith@uwovax.bitnet
  49. London, Ont. Canada N6A 5B7
  50. ph: (519) 661-3638
  51.