[Patches] [ python-Patches-459442 ] Fix small Tools/bgen problems

noreply@sourceforge.net noreply@sourceforge.net
Thu, 15 Nov 2001 13:00:07 -0800


Patches item #459442, was opened at 2001-09-07 00:32
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=459442&group_id=5470

Category: None
Group: None
Status: Closed
Resolution: None
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Jack Jansen (jackjansen)
Summary: Fix small Tools/bgen problems

Initial Comment:
Fix some small problems with bgen: Remove some 
(debugging?) print statements. Fix the initialization 
code for generated types. They are initialized twice, 
which does not harm, but the code doesn't compile with 
MSVC 6 in C source code.

----------------------------------------------------------------------

>Comment By: Jack Jansen (jackjansen)
Date: 2001-11-15 13:00

Message:
Logged In: YES 
user_id=45365

Exporting int and float with other names would defeat the point! When the Python code generated from the header 
file (customarily called something like dlggen.py) is read these names are in scope, and thereby the C int 
parameters are handled correctly in the glue routines. This is the mechanism by which C type names are mapped 
to the Python objects that know how to create the glue code for PyArg_ParseTuple and Py_BuildValue (or any 
other means to get these C objects to/from Python).

It does mean that if you want to get at the builtin function "int" from within a begn parser you'll have to use 
__builtin__.int. This is a bit of a nuisance, but on the other hand I don't the situation will occur often, if at all.


----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2001-11-15 11:37

Message:
Logged In: YES 
user_id=11105

Thanks, Jack. The prints are a minor problem, if any.

There are, however, other points in bgen which probably 
should be fixed, but maybe it's too much work because it 
also has other consequences.

bgen exports symbols like int and float, maybe also others 
which I cannot remember at the moment, which is not good 
IMO. Do you think these could be changed to c_int and 
c_float (or whatever names you like)?

----------------------------------------------------------------------

Comment By: Jack Jansen (jackjansen)
Date: 2001-11-14 07:50

Message:
Logged In: YES 
user_id=45365

I fixed the initialization problem. I left the prints in,
they could be seen as debug output, but they're really
handy, as they provide feedback on what is actually parsed
and generated. I.e. if no <-- is printed you know parsing
went wrong, and if bgen crashes in the --> process you know
where the problem is.

If you think these should be optional: reopen the patch (and
preferrably supply the code to make the prints optional:-)

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=459442&group_id=5470