Preprocessor



  • Long story, short question, probably a short answer, too -  which somehow seems to be eluding me. This may be due to the fact that English is not my native language.

    I am currently maintaining (yeah, what else) code that my predecessor was unable to finish. Currently we are scanning a so-called "index-file" which refers to every element in a structure by using the Section-Name (which turned out to be the type) and an index (Short:1122 would be the 1122th short in the structure. The result is an output of the selected elements. Bad thing: The "section-name" does not make any difference between "short abc" and "short [MAX_ROLL][MAX_SPEED] xyz", which means that - in a structure made of these two - short:595 would return one of the shorts in the array xyz.

    Which I want to change (obviously) to use the names instead, along with the dimensions etc.

    This information I have to store externally. I spent about 20 minutes writing a parser that would "digest" the header-file defining the structure (which is about 250 KB, just to give you an idea).

    I wrote this parser with the preprocessor in mind, which would previously strip the header-file of comments, replace the macros used to dimension the arrays, etc.

     

    THE QUESTION:

    How the frerk do I run the preprocessor - and ONLY the preprocessor - in VS 2003.NET. Is there a way to get my preprocessed header file or will I have to write "comment-stripping and replacement" myself?

     



  • 														Since English isn't your native language, I'd like to point out that you misspelled "fuck".<br>
    

    Returning to your original message, have you tried running "cl /?" from the command prompt?


    If that doesn't work, then note that VS.NET installs a file called
    "vsvars32.bat" (or something similar) -- this is a batch file that sets
    up environment variables (including PATH) such that the command-line
    tools will work. On my PC, the installer helpfully set up PATH so that
    the folder with "vsvars32.bat" was included; if that's not the case on
    your PC, then you'll have to search for it, and run it by hand.


    This information is apparently valid (but provided without warranty)
    for VS.NET 2002. I don't recall it's being any different for 2003.



  • A more helpful answer would be to look in the help file at the /P or /E options.



    Also, be prepared for a long file listing. (All includes are added to
    the content of the file, and for Windows applications this can be quite
    extensive)



  • Yes... sorry. I was righteously drunk that evening. But you know what they say about teaching a man to fish...



Log in to reply