Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

prototyping C struct in Clarion

56 views
Skip to first unread message

Thiago Luiz

unread,
Aug 16, 2002, 10:10:34 AM8/16/02
to
Hi,

I need to prototype a C++ struct in Clarion, but the problem is that the
struct has
a UNION inside, for example...

typedef struct { // smiVALUE portion of VarBind
smiUINT32 syntax; // Insert SYNTAX_<type>
union {
smiINT sNumber; // SYNTAX_INT
smiUINT32 uNumber; // SYNTAX_UINT32
} value; // union
} smiVALUE, *smiLPVALUE;

thanx in advance..
Thiago


Ray Goudie

unread,
Aug 16, 2002, 10:31:39 AM8/16/02
to
Try it like this:

---

!!! I assume the following data type equates:
smiINT equate(short)
smiUINT32 equate(ulong)

smiVALUE group,type
value group
sNumber smiINT
uNumber smiUINT32
end
syntax smiUINT32,over(value)
end

---

-Ray.


"Thiago Luiz" <thiag...@icqmail.com> wrote in message
news:3d5d...@news.softvelocity.com...

Gustavo Pinsard

unread,
Aug 16, 2002, 11:13:42 AM8/16/02
to
Ray,

The question here is that the UNION apparently sets the inner variables
values when the outer variables values changes, automatically.

These guys are trying to achieve kinda same functionality from Clarion. This
prototype will be used on an SNMP automation process.

Any ideas?

TIA


Ray Goudie

unread,
Aug 16, 2002, 12:35:09 PM8/16/02
to
*sigh* I have an error in my structure conversion. Here is what it should
have been. I wonder if your question is still appropriate, Gustavo?

---

!!! I assume the following data type equates:
smiINT equate(short)
smiUINT32 equate(ulong)

smiVALUE group,type
syntax smiUINT32
value group
uNumber smiUINT32
sNumber smiINT,over(uNumber)
end
end

---

-Ray.


"Gustavo Pinsard" <pin...@hotmail.com> wrote in message
news:3d5d...@news.softvelocity.com...

Gustavo Pinsard

unread,
Aug 16, 2002, 1:50:50 PM8/16/02
to
Simple, isn't it? LOL

Now let's just hope that sNumber isn't assigned the result of a calculation
involving uNumber.

Thanks a lot.


Edward Loh

unread,
Aug 17, 2002, 5:57:09 PM8/17/02
to
Hi Ray,

My guess for switching the declaration order of uNumber and sNumber is
because Clarion does will not overlay a variable with more memory storage (4
byte) over one with less (2 byte). By switching the order, you are
overlaying sNumber (2-byte) over uNumber which is 4-byte.

Edward


"Ray Goudie" <rgo...@yahoo.com> wrote in message
news:3d5d29b8$1...@news.softvelocity.com...

Ray Goudie

unread,
Aug 18, 2002, 1:20:28 PM8/18/02
to
Yes, this is exactly why I switched the order.

-Ray.


"Edward Loh" <Edwa...@email.msn.com> wrote in message
news:3d5ec69e$1...@news.softvelocity.com...

0 new messages