Author |
Message |
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Wed Mar 11, 2009 9:43 pm Post subject: Python Interfaces |
|
|
|
|
Hello all. I have another (probably newbie-ish) question.
I am making a python module, but I want a C interface to it. I am looking at D1st0rt's Optparser module, and that is helping out a lot. I was wondering if there was anything else I should know, because the ioptparser module doesn't really use ASSS as opposed to the optparser library/builtins that much. Also, I was wondering what this meant on the top of most includes:
Another question, but I don't think it is possible. Could you make a person "shoot" L5 bullets (burst rounds) the same way HS does it?
Thanks for your time.[/code] |
|
Back to top |
|
|
Cheese Wow Cheese is so helpful!
Joined: Mar 18 2007 Posts: 1017 Offline
|
Posted: Thu Mar 12, 2009 2:30 am Post subject: |
|
|
|
|
lv5 doesnt exist, but lv4s, the purple ones, do... _________________ SSC Distension Owner
SSCU Trench Wars Developer |
|
Back to top |
|
|
Dr Brain Flip-flopping like a wind surfer
Age:38 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Thu Mar 12, 2009 6:53 am Post subject: |
|
|
|
|
The /* dist: public */ is used by an automated packaging script to pick out the files that need to be included with asss when it gets shipped out. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Thu Mar 12, 2009 6:55 pm Post subject: |
|
|
|
|
Thanks.
Another question: what is the difference between pyint: use and pyint: impl in the interface? |
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Fri Mar 13, 2009 11:10 am Post subject: |
|
|
|
|
Use is for an interface you want to be able to use from python, impl is for an interface you want to be able to implement in python. You can also specify both with pyint: use, impl _________________
|
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Sat Mar 14, 2009 4:00 pm Post subject: |
|
|
|
|
Oh, so If I use impl, I can write python code for the interface?
Thanks a lot. This is probably the last question. How do I use pytype? |
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Mon Mar 16, 2009 2:01 pm Post subject: |
|
|
|
|
There are a couple of different ways you can use pytype. It follows the general pattern of pytype: <mode>, <what it is in c>, <what you are going to call it in pyint declarations>
If you just want to be able to hold onto an arbitrary pointer to the object, you use opaque. name2 is what you will use in future pyint declarations: /* pytype: opaque, typename *, name2 */ | This won't have any functions you can call, and you wont be able to access any of the members, it's just for when you need to pass it back to a c module.
If you define a struct that contains only members pymod knows how to process (int, Player *, Arena *, etc) you can use that struct in python as an object. For example, from hgcore.h: /* pytype: struct, struct HGTeam, hgteam */ |
For enums, you need to set up a naming convention in the c code where all entries within a struct have a consistent prefix. For example, from hgcore.h: /* pyconst: enum, "HGS_*" */ | This will create these constants in the asss namespace under their full name. |
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
Posted: Tue Mar 17, 2009 10:54 am Post subject: |
|
|
|
|
Thanks a lot. That should be the last question. |
|
Back to top |
|
|
Initrd.gz Seasoned Helper
Joined: Sep 18 2008 Posts: 134 Location: Over there ---> Offline
|
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Tue Mar 24, 2009 4:33 pm Post subject: |
|
|
|
|
I am not sure if you can use generated structures within structures, it might have to be one of the hardcoded types. |
|
Back to top |
|
|
|