this is just a little project I'm working on for my converter

I'll be asking for C++ to Py conversion since IDK C++ well enough to do it myself...
but the project involves converting the current functions as well as writing opposite functions...
(since the SDK only worries about writing the files, and not reading them)

to start off, I just need to know what to do to convert this small code to py:

#ifndef BUG_XF_STALL
#define BUG_XF_STALL
#endif // BUG_XF_STALL

feel free to ask if you have any Q's :)

Recommended Answers

All 9 Replies

Python doesn't use a preprocessor, so you'll have to keep some kind of list to see what is defined in the current context, i.e. insert "BUG_XF_STALL" in to it when it is defined. Essentially, you'll need to write your own preprocessor.

Then later on in your code you can use the variables in the list to perform the same functions of the preprocessor.

- Joe

I suggest creating a module or an object named pp (like preprocessor) and create methods that stick to the C preprocessor

if pp.ndef("BUG_XF_STALL"):
    pp.define("BUG_XF_STALL")
    # etc

The implementation shouldn't be too difficult as there is only one namespace involved. If your intention is to replace portions of code with the preprocessor, it's another matter. Use python functions instead of cpp macros.

thanx guys, but I was an idiot XDD

I'm going to have to completely rewrite it anyways... eh-heh
(alot of stuff isn't needed)

I'll get back to this thread later though...

I've got something I need a little help on...

no it's not from the SDK, BUT it's from a program built using the SDK.

I need the code in this post converted to Py:
http://forums.kc-mm.com/topic=17547.msg778687
(C-type FOR loops confuse the crap outta me) XP

thanx.

as for the topic, I'll more than likely have something to post once I can learn to program in PyOpenGL.

Your link gives a 404 error

Well, Im sorry you had to see this...
...but this page doest exist. Does that even make SENSE? Try it again. If that doest work, falcon punch your computer - especially if its a Macboo--*shot*.

*sigh* why does it take ~15 hrs to convert a simple 7-line function??

is there a better forum anyone can refer me to??

commented: You're whining that volunteers on a forum aren't doing your work for you fast enough? -4

I have only basic skills in C/C++, and do not know where you can get more help on that, but I am ready to help you make your final Python code nicer, of course the docstring stuff you should do yourself well as well as naming of the variables. Prepare your code self documenting so you can quickly adapt it if you want to change it later. Readable code is propably one of the main points of using Python, and you should use it to your best benefit. BTW vegaseat seams quite knowledgable in C++.

I have only basic skills in C/C++, and do not know where you can get more help on that, but I am ready to help you make your final Python code nicer, of course the docstring stuff you should do yourself well as well as naming of the variables. Prepare your code self documenting so you can quickly adapt it if you want to change it later. Readable code is propably one of the main points of using Python, and you should use it to your best benefit. BTW vegaseat seams quite knowledgable in C++.

I prbly should've mentioned, the 7-lines of code I need converted is written in C#... :af:
eh heh... sry bout that :P

well, thanx for the tip anyways...

btw my friend, I officially invite you to my forum:
(and Jcao if I can get a hold of him)
http://tcll5850.proboards.com

I'm currently working on putting up a chatbox compatible with my wii so it'll be easier to discuss what we need >_>
I'll have that pending for private thread discussions later...
(just so we won't have to crowd a single chatbo... you undermean what I stand. :P )

anyways yea, you and Jcao have been the biggest help to me here ;)

and I'll give Vega a hit now that I know that...
thanx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.