C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-07-2008, 12:30 AM   #1
Registered User
 
Join Date: Jun 2008
Posts: 8
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
lordmule is offline   Reply With Quote
Old 07-07-2008, 02:25 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
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.
matsp is offline   Reply With Quote
Reply

Tags
c code, code generation, parse, precompile header

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Proposal: Code colouring Perspective General Discussions 28 05-14-2007 07:23 AM
Values changing without reason? subtled C Programming 2 04-19-2007 10:20 AM
Obfuscated Code Contest Stack Overflow Contests Board 51 01-21-2005 04:17 PM
Updated sound engine code Bubba Game Programming 8 11-18-2004 12:38 PM
Interface Question smog890 C Programming 11 06-03-2002 05:06 PM


All times are GMT -6. The time now is 07:46 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22