1. A C to Euphoria Question: struct -Reply

My 'guess' would be:

constant x=1,
         y=2,
         Direction=3,
         MovePixels=4,
         CurrFrame=5,
         NumFrames=6,
         FrameRate=7,
         FrameCount=8,
         data=9

type MainData(sequence s)
        if atom(s[x]) = 0 then
                return 0
        elsif atom(s[y]) = 0 then
                return 0
        elsif atom(s[Direction]) = 0 then
                return 0
        elsif atom(s[MovePixels]) = 0 then
                return 0
        elsif atom(s[CurrFrame]) = 0 then
                return 0
        elsif atom(s[NumFrames]) = 0 then
                return 0
        elsif atom(s[FrameRate]) = 0 then
                return 0
        elsif atom(s[FrameCount]) = 0 then
                return 0
        elsif sequence(s[data]) = 0  or length(s[data]) != 20 then
                return 0
        end if
        return 1
end type

new MainData ourVariable

--of course you can't use pointers in Eu...
--but at least you can now access
--ourVariable[Direction], etc. etc.
--Jay

>>> Cox Family <cox.family at SK.SYMPATICO.CA> 11/11/98 06:16pm >>>
Dear Euphorians,

I saw an interesting piece of code the other day in
C, and was wondering how one would do the same thing
in Euphoria. (I think Qbasic has something like it too
with TYPE) Here's the code :


struct {
 int x, y;
 char Direction;
 char MovePixels;
 char CurrFrame;
 char NumFrames;
 char FrameRate;
 char FrameCount;
 unsigned char *data[20];
} MainChar;


I think that's about it. (just a small bit of C -- don't want to be
a burden or anything) I haven't seen anything looking like :
"MainChar.Direction = ...." in Euphoria before. If anyone could clear
this up for me, it would be much appreciated. Thank you very much.


Chris Cox
cox.family at sk.sympatico.ca

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu