Re: What we really need...
- Posted by euman at bellsouth.net Nov 12, 2002
- 483 views
----- Original Message ----- From: "Don Phillips" <EuNexus at yahoo.com> > > 10) And Don Phillips EuNexus Project or MEdit > > a) ofcource Don would need to get rid of that MSC .dll he uses > > a) <<-- Hah! Fat chance =) @# with a Y >Win32Lib does a superb job of hiding superb??? > the details of what is going on behind the scenes. API programming is > not for the faint of heart. Yeah atleast its your code and you can fix it to work like you want it to. >There are more constants, data types, and > structures than you can shake a stick at. I have one file at home > *one*, which is about 55k full of nothing but constants. Nothing else. AGREED. > Point? It is easier for me to code API in just about any other language > than Euphoria because of structure support. Heck, the top three > assembly languages I use all have structures. I find it unfortunate > that Windows is so reliant on these things. I find it even more so that > Euphoria does not directly support them. > > Trying to program API structures with Euphoria is like pulling teeth. > If done directly via peeks and pokes, its nice and fast. Its also hard > to read and maintain. Don, Ive been writting in C and using Masm32 myself and this Euphoria snippet is what I use to make code smaller and faster. Just a very small snipp.. constant sizeof_trm = 32 -- Size of trm structure atom trm trm = allocate(sizeof_trm) mem_set(trm,0,32) constant trm_Op = trm + 0, -- Tsunami operation number trm_File = trm + 4, -- Tsunami file handle trm_DataPtr = trm + 8, -- Address of data buffer trm_DataLen = trm + 12, -- Length of data buffer trm_KeyPtr = trm + 16, -- Address of key buffer trm_KeyLen = trm + 24, -- Length of key buffer trm_KeyNo = trm + 28 -- Key number ->>>> is definatly better than trm_Op = allocate(4) trm_File = allocate(4) trm_DataPtr = allocate(4) trm_DataLen = allocate(4) trm_KeyPtr = allocate(4) trm_KeyLen = allocate(4) trm_KeyNo = allocate(4) and then peek4( ) each time you need access to a particular part of the struct sucks. Also, when you peek or poke a value you eliminate the extra "addition" (+) required e.g, poke4(trm + trm_Op,val) -- why not do this only once at the start of your proggy. Maybe this is hard for some to understand but for me this seems easier and besides is obviously faster with less messy code. And if you really look at the code I presented you'll know Im well on my way to completing the wrappers for the Tsunami Record Managment system. BTW, I'll be using the EDS procedure names, so cross over into Tsunami will be a breeze if you choose to use it. Euman > > > >