Dec 132017
 
Make ANSI C style function protocols from your existing source.
File MKPROTO.ZIP from The Programmer’s Corner in
Category C Source Code
Make ANSI C style function protocols from your existing source.
File Name File Size Zip Size Zip Type
MKPROTO.C 13468 4243 deflated
MKPROTO.EXE 14197 8591 deflated
MKPROTO.H 731 304 deflated
MKPROTO.MAN 2499 1139 deflated
README 1914 1002 deflated

Download File MKPROTO.ZIP Here

Contents of the README file


Here is mkproto, a program for generating prototype declarations for all
functions appearing in a C source file. The input C code may be either
K&R or ANSI C (i.e. it's OK if the functions are defined using prototypes).
Unlike some of the sed-based scripts floating around, it correctly
handles prototype promotion (e.g. the prototype for 'int foo() char x;...'
is 'int foo(int x)'). Also, it should work OK on just about any computer,
not just Unix-based ones (it's been tested under minix, Unix, and TOS).

Use: typically, you would type 'mkproto *.c >proto.h' and then add a
'#include "proto.h"' line to all the C source files. An ANSI conformant
compiler will then be able to do type checking on function calls across
module boundaries. As a bonus, proto.h will tell you which source files
functions were defined in, and (if you gave the -n function to mkproto)
their line numbers. The resulting include file may also be used by
non-ANSI compilers; you can disable this feature (for cleaner, strictly
ANSI-conforming output) with the -p flag.

Please read the description of bugs in mkproto.man; definitely mkproto
will not handle all programs correctly, but it does work on the majority of
them. A sample of its output is provided in the file "mkproto.h"; this
is the result of 'mkproto mkproto.c >mkproto.h'.

There is ABSOLUTELY NO WARRANTY for the program; as I said, it doesn't work
on all programs (complicated function definitions can make it produce bogus
output). It does what I need, though, and it can certainly make porting stuff
to ANSI compilers easier.

Mkproto is in the public domain. If you find any bugs (other than the ones
documented) please let me know.
--
Eric R. Smith email:
Dept. of Mathematics [email protected]
University of Western Ontario [email protected]
London, Ont. Canada N6A 5B7
ph: (519) 661-3638


 December 13, 2017  Add comments

Leave a Reply