[gvd-users] New to gvd. Problem displaying certain structures
gvd-users@lists.act-europe.fr
gvd-users@lists.act-europe.fr
Sat, 10 May 2003 18:37:58 +0100 (WEST)
hi
first of all, you've done a great job with gvd. keep up the good/great work.
Now my problem.
I have a structure and when i double click in it's pointer, it's doesn't
show the structure.
my structure is the following:
typedef struct typeNode {
NodeType type; /* type of node */
void *user; /* pointer to any user data */
int attrib; /* user defined attributes */
union {
int i; /* value of literal integer */
double r; /* value of literal real number */
char *s; /* value of literal string (null
terminated) */
struct {
int size; /* size of data */
void *data; /* pointer to data */
} d; /* value of any opaque data (untyped) */
struct {
int num; /* number os subnode in this node */
struct typeNode *n[1]; /* subnodes (expandable) */
} sub;
} value;
} Node;
For example, in this function,
Node *subNode(int oper, int nops, ...) {
va_list ap;
Node *p = newNode(nodeOpr, oper, nops);
int i;
if (p == NULL) return 0;
va_start(ap, nops);
for (i = 0; i < nops; i++)
p->value.sub.n[i] = va_arg(ap, Node*);
va_end(ap);
return p;
}
When i do "graph display (*p)" after the node is created its doesn't show
anything in canvas.
But when i do "print *p" it shows this:
$8 = |type = nodeStr, usr = 0x0, attrib =43, value =|i =0, r=0, s=0x0, d=
| size = 0, data = 0x0|, sub = |num =0, n = |0x0||||
I've made a simple test program with a diferent structure but with typedef
and a union a it worked fine.
What could be the problem? If it can help i can put my program on-line.
I tried ddd and it showed the structure correctly.
Thanks in advanced.
Joel