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

Discussion in 'C Programming' started by nospam, Apr 29, 2007.

  1. nospam

    nospam 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?
     
    nospam, Apr 29, 2007
    #1
    1. Advertising

  2. nospam

    Ben Pfaff Guest

    nospam <> writes:

    > 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.)

    --
    "I hope, some day, to learn to read.
    It seems to be even harder than writing."
    --Richard Heathfield
     
    Ben Pfaff, Apr 29, 2007
    #2
    1. Advertising

  3. In article <>,
    nospam <> wrote:
    >Is there a utility that takes an arbitrarily complex C language
    >declaration, checks it validity, and breaks it down into something
    >more understandable.


    You mean something like the old 'cdecl' exercise?

    >Is there a executable version for wintel platforms?



    You could compile it yourself.

    http://linux.maruhn.com/sec/cdecl.html
    --
    "It is important to remember that when it comes to law, computers
    never make copies, only human beings make copies. Computers are given
    commands, not permission. Only people can be given permission."
    -- Brad Templeton
     
    Walter Roberson, Apr 29, 2007
    #3
  4. "Ben Pfaff" <> wrote in message
    news:...
    > nospam <> writes:
    >
    >> 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
    >

    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.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
     
    Malcolm McLean, Apr 29, 2007
    #4
  5. "Malcolm McLean" <> writes:
    > "Ben Pfaff" <> wrote in message
    > news:...
    >> nospam <> writes:
    >>> 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
    >>

    > 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.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Apr 29, 2007
    #5
  6. nospam

    jaysome Guest

    On Sat, 28 Apr 2007 18:42:33 -0700, Ben Pfaff <>
    wrote:

    >nospam <> writes:
    >
    >> 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:


    > (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
    --
    jay
     
    jaysome, Apr 29, 2007
    #6
  7. In article <>,
    Malcolm McLean <> wrote:

    >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

    --
    Dave Vandervies
    From that simple premise, you have managed to demonstrate that, in the lab in
    which I had chemistry classes about 25 years ago, the teacher's lab stool was
    intelligent. --Richard Heathfield in comp.programming
     
    Dave Vandervies, Apr 29, 2007
    #7
  8. nospam

    Ben Pfaff Guest

    "Malcolm McLean" <> writes:

    > "Ben Pfaff" <> wrote in message
    > news:...
    >> nospam <> writes:
    >>
    >>> 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
    >>

    > 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.
    --
    Comp-sci PhD expected before end of 2007
    Seeking industrial or academic position *outside California* in 2008
     
    Ben Pfaff, Apr 29, 2007
    #8
  9. In article <f12j11$5h2$>,
    Dave Vandervies <> wrote:
    >In article <>,
    >Malcolm McLean <> wrote:


    >>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?


    I seem to recall that C99 has complex number support ;-)
    --
    I was very young in those days, but I was also rather dim.
    -- Christopher Priest
     
    Walter Roberson, Apr 29, 2007
    #9
  10. Ben Pfaff <> wrote:
    > nospam <> writes:


    >> 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.


    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.

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net
     
    Thomas Dickey, May 3, 2007
    #10
  11. nospam

    Ben Pfaff Guest

    Thomas Dickey <> writes:

    > Ben Pfaff <> wrote:
    >> nospam <> writes:

    >
    >>> 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.

    >
    > 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.
    --
    Ben Pfaff
    http://benpfaff.org
     
    Ben Pfaff, May 3, 2007
    #11
  12. Ben Pfaff <> wrote:
    > Thomas Dickey <> writes:


    >> Ben Pfaff <> wrote:
    >>> nospam <> writes:

    >>
    >>>> 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.

    >>
    >> The FAQ doesn't answer the question.


    > 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.

    --
    Thomas E. Dickey
    http://invisible-island.net
    ftp://invisible-island.net
     
    Thomas Dickey, May 3, 2007
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Weyoun the Dancing Bong

    LOL @ College course.

    Weyoun the Dancing Bong, Jan 20, 2004, in forum: HTML
    Replies:
    13
    Views:
    725
    Hywel Jenkins
    Jan 20, 2004
  2. Guest
    Replies:
    5
    Views:
    641
  3. SorceCode
    Replies:
    2
    Views:
    3,417
    Christian Jan├čen
    Jan 26, 2004
  4. geoffbache
    Replies:
    8
    Views:
    702
    Stefan Behnel
    Feb 11, 2008
  5. Alfredo Agosti
    Replies:
    3
    Views:
    377
    Aaron Bertrand - MVP
    Sep 19, 2003
Loading...

Share This Page