Re: Win4Eu update
- Posted by Bernard Ryan <xotron at bluefrog.com> Oct 26, 2004
- 695 views
Tommy Carlier wrote: > The difference with w32Engine and Win32Lib, will not be what it can do, > but the programming interface, the architecture. Win4Eu is a (limited) > object-oriented architecture, with inheritance, properties and events. > One other difference: I'm trying to hide the technical details of Al Getz's WinClass OO Library uses object-oriented architecture > }}} <eucode> > constant POINT = defineStructure("POINT", { > {"x", Int}, > {"y", Int} > }) > > integer pt, size > atom address > pt = create(POINT, "pt", {}) > pokeField(pt, "x", 0, 100) > pokeField(pt, "y", 0, 100) > size = getStructureSize(pt) -- get the size in bytes > address = getStructureAddress(pt) -- get the physical address > > destroy(pt) -- release the memory > </eucode> {{{ structures can be done by using my mixedlib.e in DOS or w32engin.ew in Windows.
-- the point structure is already predefine so -- all you need to do to use it. include w32engin.ew atom pt -- create a point structure -- which will be initailize to all zeros pt = struc("POINT") poke4s(pt,{0,100}) -- or use put(pt,"x", 0) put(pt,"y",100) -- or you can create a point structure -- and initialize it to some values pt = struc({"POINT",{0,100}}) -- or you can define and create a structure -- it can contain unions and nested structures. -- describe it: record("MY_SPECIAL_STRUCT", "field_1 : int : 1 "& "field_2 : string : 25"& "union_1 : UNION : * "& "field_1 : long : . "& "field_2 : byte : . "& "field_3 : short : . "& "pt_1 : STRUCT : POINT "& "pt_2 : STRUCT : POINT ") -- create it atom ptr ptr = struc("MY_SPECIAL_STRUCT") -- put(ptr,"field_1", 100) put(ptr,"union_1->field_3",27) put(ptr,"pt_1->x",0) put(ptr,"pt_1->y",100) put(ptr,"pt_2->x",10) put(ptr,"pt_2->y",300) -- to get the size of a structure ? sizeof(pt) -- or ? sizeof("MY_SPECIAL_STRUCT")
Bernie My files in archive: http://www.rapideuphoria.com/w32engin.zip http://www.rapideuphoria.com/mixedlib.zip http://www.rapideuphoria.com/eu_engin.zip http://www.rapideuphoria.com/win32eru.zip