1. C struct

Did I wrap this C structure right. I get Windows error when trying to use
function from
dll.

MAXP = 5
typedef struct node {
  char name[8];
  struct node *parm[MAXP];
  short tag;
  double value;
  short sx,sy;       /* size */
  short px,py;      /* location on scrn */
  short ay;         /* adjust y */
  short kind;
  short nump;
  char *msg;
  struct node *next;
} node;

node_name   = allot( {8, Strz} ),
node_parm   = allot( {MAXP * 4, Strz} ),
node_tag    = allot( Word ),
node_value  = allot( DWord ),
node_sx     = allot( Word ),
node_sy     = allot( Word ),
node_px     = allot( Word ),
node_py     = allot( Word ),
node_ay     = allot( Word ),
node_kind   = allot( Word ),
node_nump   = allot( Word ),
node_msg    = allot( Lpsz ),
node_next   = allot( Ptr ),
sizeof_node = allotted_size(),

new topic     » topic index » view message » categorize

2. Re: C struct

<html>
<head>
</head>
<body>
*parm[MAXP] is an array of pointers with MAXP elements.  The [] has precendence
over *<br>
<br>
Derek Parnell wrote:<br>
<blockquote type="cite" cite="mid:0.1700008810.319761465-1463792126-1024361351
at topica.com">
<pre wrap="">-----Original Message-----<br>From: Derek Parnell <br>Sent:
    Tuesday, 18 June 2002 10:37<br>To: EUforum<br>Subject: RE: C
    struct<br><br><br><br>  node_parm = allot(Ptr),   -- struct node *parm[MAXP]
    means <br>a pointer to an array of MAXP node structures.<br></pre>
    </blockquote>
<pre wrap=""><!----><br>Or am I wrong with this one? Maybe it should be
    ...<br><br>  node_parm = allot({MAXP, Ptr}), <br><br>I'm unsure now if <br> 
    struct node *parm[MAXP] <br>means a single pointer to MAXP node
    structures<br><br>or  MAXP pointers to node structures.<br><br>Sorry. But I don't
    have a C manual handy at the
    moment.<br><br><br>-----------<br>Derek.<br><br>==================================================================<br>De
    informatie opgenomen in dit bericht kan vertrouwelijk zijn en <br>is uitsluitend
    bestemd voor de geadresseerde. Indien u dit bericht <br>onterecht ontvangt wordt
    u verzocht de inhoud niet te gebruiken en <br>de afzender direct te informeren
    door het bericht te retourneren.
    <br>==================================================================<br>The
    information contained in this message may be confidential <br>and is intended to
    be exclusively for the addressee. Should you <br>receive this message
    unintentionally, please do not use th

new topic     » goto parent     » topic index » view message » categorize

3. Re: C struct

----- Original Message ----- 
From: "Derek Parnell" <Derek.Parnell at SYD.RABOBANK.COM>

>   node_parm = allot({MAXP, Ptr}), 

How do I store() to node_parm[3]?
The only way, it seems to me, is this way:

tmp = node_parm
tmp [1] += 4*2
store (p, tmp, val)

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu