Re: prototype conversion tools??? (Ronald F. Guilmette)
Wed, 22 Sep 1993 03:46:12 GMT

          From comp.compilers

Related articles
prototype conversion tools??? (1993-09-14)
Re: prototype conversion tools??? (1993-09-22)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Ronald F. Guilmette)
Keywords: C
Organization: Netcom Online Communications Services
References: 93-09-062
Date: Wed, 22 Sep 1993 03:46:12 GMT (merlin) writes:
>Are there any tools available to identify and write protoptypes for
>functions spread through many C source code files?

Our moderator then comments:
>[There's protoize, which is based on GCC. My impression is that the easy part
>is extracting the prototypes from the code. The hard part is figuring where
>to put them. One big include file? Fold them into per-module includes? -John]

Yes. Exactly so.

As the moderator correctly states, protoize is "based" upon GCC. More
precisely, protoize *uses* GCC (and a very specialized mode of GCC
operation which was developed precisely for this purpose) as if it were
simply a large and sophisticated "information gathering tool". Protoize
automatically invokes GCC (with a special option), and GCC simply sucks up
the input C source code (as if it were preparing to compile it) and then
deposits useful information regarding all of the function declarations and
definitions into a special (temporary) data file. After this step is
completed, protoize comes along and finishes up the job by reading in that
information and by intelligently (and automatically) editing each of the
existing function declarations and definitions in the existing source code
so that they are converted to prototype form.

In other words, protoize uses GCC (as a sort of slave) to do the easy part
(i.e. the "information gathering") but then protoize itself does the hard
part (i.e. performing automatic and intelligent edits to the original
source code needed to convert to prototypes).

Currently, protoize does NOT make any effort to support the styles of
usage which the moderator mentioned (i.e. "One big include file? Fold them
into per-module includes?") Rather, protoize (as now available) simply
changes whatever pre-existing function declarations and/or definitions
happen to already be present in your source code over to prototype form.
No new files are created, and no totally new declarations are added.

P.S. Perhaps the biggest benefit of protoize over other similar
conversion utilities is that it was designed and built to support the
conversion of large *systems* of C source code rather than mere individual
translation units. Specifically, protoize can intelligently apply
information which it collects from one translation unit to the automatic
editing process which it applies to entirely separate translation units of
the same overall program. To the best of my knowledge, no other similar
conversion tool provide such a feature.

P.P.S. Yet another important thing to mention about protoize is the
availability of its sister program `unprotoize'. It has been my sincere
hope that as ANSI C compilers become more widespread, people will use
protoize (once) to convert their programs over to prototype form, and that
they will then use unprotoize only on those rare occasions when they are
forced to "back port" these programs to systems for which no ANSI C
compiler is available. (And I might add that the set of "interesting"
computer systems for which *that* condition applies is almost non-existant
these days.)
-- Ronald F. Guilmette ------------------------------------------------------
------ domain address: ---------------------------------------
------ uucp address: ...!uunet!!rfg -------------------------------

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.