[C++-sig] pygccxml and multidimensional arrays
Davidson, Josh
josh.davidson at lmco.com
Wed Apr 22 22:43:03 CEST 2009
Is this a confirmed bug?
Thanks,
Josh
-----Original Message-----
From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Davidson, Josh
Sent: Thursday, April 16, 2009 10:04 AM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] pygccxml and multidimensional arrays
Sure.
1) Put the following into a file named mdim.h:
#ifndef MDIM_H_
#define MDIM_H_
#include <stdint.h>
typedef struct {
uint16_t a[4][2][3];
} blah;
#endif
2) Put the following into a file named parse.py:
#!/usr/bin/env python
import os
import sys
from pygccxml import parser
from pygccxml import declarations
includePaths = []
defineSymbols = []
config = parser.config_t(gccxml_path="gccxml")
decls = parser.parse(["mdim.h"])
xml = declarations.get_global_namespace(decls)
cls = xml.classes()[0]
for var in cls.variables():
print var.name, var.type
3) Execute: python parse.py
Observe the following print statement: "a uint16_t[3][2][4]"
-----Original Message-----
From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko
Sent: Wednesday, April 15, 2009 11:04 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] pygccxml and multidimensional arrays
On Tue, Apr 14, 2009 at 11:30 PM, Davidson, Josh <josh.davidson at lmco.com> wrote:
> Machine: x86_64 running RH EL 5.0
>
> Pygccxml version 1.0.0
>
> Gcc-xml version 0.9.0
>
>
>
> If I create a struct similar to:
>
>
>
> typedef struct {
>
> uint16_t a[4][2][3];
>
> } blah;
>
>
>
> And use pygccxml to parse it, the type attribute for the field "a" is set
> to: uint16_t[3][2][4]. Does anyone know why the dimensions are reversed?
I guess this is Py++/pygccxml bug.
Can you create small test case of what you are trying to do.
Thanks
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
More information about the Cplusplus-sig
mailing list