Thread: parsing C code

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    15

    Lightbulb parsing C code

    Hi everyone,
    I would like to know if there is any way to parse C code so I can automatically generate template code (such as header files). For example I would like to generate enums for each global variable and have them modified through a single function as follows:
    Code:
    // set the variable 'vname' to the specified value
    int s_set_option( enum s_opt    vname, void *new_value);
    
    // return the variable 'vname' value
    void *s_get_option( enum s_opt    vname);
    then generate the appropriate GUI function so I can manipulate them. I'm sure someone at some point would have done this to account for the numerous amount of variables one might have.

    such a tool would make a lovely addition to my make file for future projects.

    I am working with Ubuntu
    Thanks

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You should have a "protoize", which is part of the gcc package.

    Here's some info:
    http://gcc.gnu.org/onlinedocs/gcc/Running-Protoize.html

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  2. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Updated sound engine code
    By VirtualAce in forum Game Programming
    Replies: 8
    Last Post: 11-18-2004, 12:38 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

Tags for this Thread