Scripter

Anyone know how to write a script ( or knows a script/program/tool ) to:

  1. strip all comments // /* */
  2. straight-line up function headers, eg.

void
function
( param p1,
param p2)
{
…etc…
}

convert to:

void function ( param p1, param p2)
{
…etc…
}

Anyone know how to write a script ( or knows a script/program/tool ) to:

Indent?

–>Neil-------------------------------------------------------------------------------
Neil Bradley "Your mistletoe is no match for my T.O.W. missile!"
Synthcom Systems, Inc. - Santabot - Futurama
ICQ #29402898

This is definitely off topic as this is a list for using SDL.

Here’s a quick answer to comment stripping, though:
http://utcc.utoronto.ca/~cks/programs/entab.c

I found that in a minute or two by going to google and entering:
strip comments from C code

I gave you a bad link before for code to strip comments. Try this:
http://wiw.org/~ams/code/comment.c

Better yet, use Google, it’s more reliable than I am for this kind of thing. :slight_smile:

Anyone know how to write a script ( or knows a script/program/tool ) to:

  1. strip all comments // /* */
  2. straight-line up function headers, eg.

void
function
( param p1,
param p2)
{
…etc…
}

convert to:

void function ( param p1, param p2)
{
…etc…
}

If you want to write it by yourself (instead of use something else), you can use flex (or lex) and byson (or yacc), them are included in pratically all the linux distribution (also cygwin), and maybe them ar also available for win32.
These program are a parser and a grammar analyser and produce C-code from a set of rule you have to write.
Really easy to use.
Anyway it has nothing to do with SDL (over the fact you can use the code in a SDL application)

P.S.: anyone can send me a simple example (a main.c file with only the SDL_Init is sufficient) that work with a dinamically link to the SDL library over visualC? Thanks, I’m in trouble with it.–
Emanuele Dalmasso
email: @Emanuele_Dalmasso
site: http://digilander.libero.it/knightmare