Utility to convert complex declarations into, well, lol, plain-text

G

Guest

Is there a utility that takes an arbitrarily complex C language
declaration, checks it validity, and breaks it down into something
more understandable.

Is there a executable version for wintel platforms?
 
B

Ben Pfaff

nospam said:
Is there a utility that takes an arbitrarily complex C language
declaration, checks it validity, and breaks it down into something
more understandable.

Is there a executable version for wintel platforms?

This is in the FAQ.

Section 18. Tools and Resources

18.1: I need: A: Look for programs (see also
question 18.16) named:

a C cross-reference cflow, cxref, calls, cscope,
generator xscope, or ixfw

a C beautifier/pretty- cb, indent, GNU indent, or
printer vgrind

a revision control or CVS, RCS, or SCCS
configuration management
tool

a C source obfuscator obfus, shroud, or opqcp
(shrouder)

a "make" dependency makedepend, or try cc -M or
generator cpp -M

tools to compute code ccount, Metre, lcount, or csize,
metrics or see URL http://www.qucis.queensu.ca/
Software-Engineering/Cmetrics.html ;
there is also a package sold
by McCabe and Associates

a C lines-of-source this can be done very
counter crudely with the standard
Unix utility wc, and
somewhat better with
grep -c ";"

a C declaration aid check volume 14 of
(cdecl) comp.sources.unix (see
question 18.16) and K&R2

a prototype generator see question 11.31

a tool to track down
malloc problems see question 18.2

a "selective" C
preprocessor see question 10.18

language translation see questions 11.31 and
tools 20.26

C verifiers (lint) see question 18.7

a C compiler! see question 18.3

(This list of tools is by no means complete; if you know of
tools not mentioned, you're welcome to contact this list's
maintainer.)
 
M

Malcolm McLean

Ben Pfaff said:
This is in the FAQ.

Section 18. Tools and Resources
What he wants is something like

input:
y = 1/((x + 1) * ( x + 2) + 3);
output:
y = (x+1) * (x+2);
y += 3;
y = 1/y;

Now the snag is more obvious. We need to insert a test before line 3.
 
K

Keith Thompson

Malcolm McLean said:
What he wants is something like

input:
y = 1/((x + 1) * ( x + 2) + 3);
output:
y = (x+1) * (x+2);
y += 3;
y = 1/y;

Now the snag is more obvious. We need to insert a test before line 3.

He asked about declarations, not statements.

Your guess about what he actually wants may well be correct, but if so
then he also needs to understand the terminology.
 
J

jaysome

This is in the FAQ.

Section 18. Tools and Resources

18.1: I need: A: Look for programs (see also
question 18.16) named:
(This list of tools is by no means complete; if you know of
tools not mentioned, you're welcome to contact this list's
maintainer.)

And some of my favorites:

18.1: I need: A: Look for programs
named:

A static source A. PC-lint,
code analyzer. http://www.gimpel.com/

A code coverage A. BullseyeCoverage,
tool. http://www.bullseye.com/

A diff utility. A. BeyondCompare,
http://www.scootersoftware.com/

Best regards
 
D

Dave Vandervies

Malcolm McLean said:
input:
y = 1/((x + 1) * ( x + 2) + 3);
output:
y = (x+1) * (x+2);
y += 3;
y = 1/y;

Now the snag is more obvious. We need to insert a test before line 3.

Under what conditions would you expect the test to fail?


dave
 
B

Ben Pfaff

Malcolm McLean said:
What he wants is something like

input:
y = 1/((x + 1) * ( x + 2) + 3);
output:
y = (x+1) * (x+2);
y += 3;
y = 1/y;

He asked about declarations, not expressions.
 
T

Thomas Dickey

This is in the FAQ.

The FAQ doesn't answer the question. In particular (something to get used
to in case you decide to learn how to do research), it's citing information
that's been obsolete for several years.
Section 18. Tools and Resources
18.1: I need: A: Look for programs (see also
question 18.16) named:
....
a C declaration aid check volume 14 of
(cdecl) comp.sources.unix (see
question 18.16) and K&R2

comp.sources.unix is defunct, has been for a long time - shortly after
the material for the FAQ was scraped out of stray places.

For grins, read 18.16, which was apparently last updated roughly 10 years ago.
 
B

Ben Pfaff

Thomas Dickey said:
The FAQ doesn't answer the question.

It says to get cdecl from comp.sources.unix. You can still do
that, with Google Groups. Or, if you don't want to do that, you
can easily search the web for "cdecl", once you know that the
utility has that name.

There's no need for the FAQ to hold the reader's hand. Its
readers are, after all, programmers, who should be able to use
some amount of logical reasoning.
 
T

Thomas Dickey

It says to get cdecl from comp.sources.unix. You can still do

It says several things. But it doesn't answer the question, as
noted above ("executable"...).
that, with Google Groups. Or, if you don't want to do that, you
can easily search the web for "cdecl", once you know that the
utility has that name.

fortunately ten-year old information is not entirely stale.
But it's not the FAQ which makes it useful (obsolete references
to newsgroups, ftp sites, etc).
There's no need for the FAQ to hold the reader's hand. Its
readers are, after all, programmers, who should be able to use
some amount of logical reasoning.

some of them are programmers. But "logical reasoning" is an unreasonable
inference.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top