1. poke4 won't accept my 32bit values
- Posted by Chris Bensler <bensler at mailops.com> Mar 18, 2001
- 576 views
- Last edited Mar 19, 2001
Hi all, OK,let's see if i can try to explain this.. As you might know, I'm working on the wrapper lib for exotica. I've encountered a major hurdle though. With exotica, when one writes code for it, it is wrapped in a function and passed to WinMain.. with my lib, I've managed to inline the code, removing the need for WinMain. This works fine and dandy for most things... Except when I try the 3d demos.. they require poking 32bit color values directly to memory.. when the code does not pass through WinMain, it doesn't allow me to poke4 the values, resulting in incorrect colors.. I probably didn't get my point across, but PLEASE, if someone is willing to help me, or knows something about the workings of exotica, or even my exoticaX lib, PLEASE reply.. I can't post my code here as it is much too involved. The problem itself is relatively straight forward though.. PLEASE, PLEASE,PLEASE HELP!! I've been stuck on this for ages now.. I have made a workaround, but I don't like it.. TIA Chris
2. Re: poke4 won't accept my 32bit values
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 18, 2001
- 524 views
- Last edited Mar 19, 2001
Chris Bensler writes: > ...when the code does not pass through WinMain, > it doesn't allow me to poke4 the values, resulting > in incorrect colors.. I'm not sure what you are doing, but keep in mind that Euphoria routines, such as poke4(), deal with data in Euphoria's internal format. Euphoria integers and C integers are the same, as long as you are in the range of (roughly) -1 billion to +1 billion. Outside of this range a Euphoria library routine will interpret the number to be a kind of pointer to a double or a sequence. To pass a 32-bit integer, outside of the range, you would have to create a pointer to a double, like what NewDouble() returns, and pass that. This is very tricky, not for the faint of heart. Also, WinMain() causes a lot of necessary stuff to be initialized. If you skip it, some things won't work right. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
3. Re: poke4 won't accept my 32bit values
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 19, 2001
- 529 views
> > C_INT, what should it be? > > But even if this is the problem.. it is exclusive to my code.. No > problems in the original Exotica demos.. > I'm not sure, maybe Robert can chip in here, but C_UINT is a 32-bit unsigned integer and C_INT is a 32-bit signed integer. Maybe when Euphoria invokes the c_func() routine it converts the supplied parameters based on these signatures. If it uses C_INT, it might be chopping off the high bits. This is just a guess. I'm also guessing that its Euphoria interpreter you are having trouble with. Is it? Or is this the translated C code? ------ Derek Parnell Melbourne, Australia "To finish a job quickly, go slower."
4. Re: poke4 won't accept my 32bit values
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 19, 2001
- 518 views
Hi, > This works fine as long as I don't need to poke the color values > directly to memory.. > But when I do try to poke the values, it says the value is not 32bit. > > I hope this helps you to understand my dilemna.. Not a bit, Chris. Clear as mud. All you gave us was some code that works. Why d'ya bother? How about showing us the code that actually fails! Show the line(s) of code that you are using to POKE color values with. Exactly what is telling you the "value is not 32bit"? Is there an ex.err file you can send us? Is it the poke4() routine? I've seen a similar message with that. How about printing/displaying the value using sprintf("%g", colorvalue)? Just to verify that what you think is being poked is in fact a 32-bit integer. What is the exact message? Can you duplicate the error using a tiny bit of code? Are there any colour values that work, or does every colour value fail it. Why are you poking values anyhow? ------ Derek Parnell Melbourne, Australia "To finish a job quickly, go slower."
5. Re: poke4 won't accept my 32bit values
- Posted by Chris Bensler <godsgift at saintly.com> Mar 19, 2001
- 514 views
--383970696.985010192502.JavaMail.root@web577-mc I was trying to explain how I've modified the WinMain Procedure.. but here is the exact error.. This is Main module code, not wrapped in anything.. atom Color_Value Color_Value= allocate(4) poke4(Color_Value,#FFFFFFFF) this is the error message in EX.ERR... poke4 is limited to 32 bit numbers The code works fine in the exotica demo, and it is unchanged in my demo. Shall I send you my code Derek? EX.ERR attached Chris ----- Original Message ----- From: Derek Parnell <ddparnell at bigpond.com> To: EUforum <EUforum at topica.com> Sent: Monday, March 19, 2001 8:30 PM Subject: Re: poke4 won't accept my 32bit values > Not a bit, Chris. Clear as mud. All you gave us was some code that works. > Why d'ya bother? How about showing us the code that actually fails! > > Show the line(s) of code that you are using to POKE color values with. > > Exactly what is telling you the "value is not 32bit"? > > Is there an ex.err file you can send us? > > Is it the poke4() routine? I've seen a similar message with that. > > How about printing/displaying the value using sprintf("%g", colorvalue)? > Just to verify that what you think is being poked is in fact a 32-bit > integer. > > What is the exact message? > > Can you duplicate the error using a tiny bit of code? > > Are there any colour values that work, or does every colour value fail it. > > Why are you poking values anyhow? > > ------ > Derek Parnell > Melbourne, Australia > "To finish a job quickly, go slower."
6. Re: poke4 won't accept my 32bit values
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 19, 2001
- 566 views
Chris Bensler writes: > test = 4294967296 <<<<<<<<< this is the value being > poked... (#FFFFFFFF) Not quite.... #FFFFFFFF = 4294967295 Your "test" variable is 1 higher than the maximum 32-bit (unsigned) integer, so poke4() gives you an error. To get the low-order 32-bits you could do: test = remainder(test, 4294967296) which in this case is 0. In general you'll get the low-order 32-bits, which is what a C program would give you, since C doesn't worry about integer overflow. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
7. Re: poke4 won't accept my 32bit values
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 19, 2001
- 509 views
Hi Chris, I suspect that you have a bug in your code. Somehow the valriable called 'test' is being set to #FFFFFFFF and later getting 1 added to it before you do the poke. ----- Original Message ----- From: "Chris Bensler" <godsgift at saintly.com> To: "EUforum" <EUforum at topica.com> Sent: Tuesday, March 20, 2001 1:35 AM Subject: Re: poke4 won't accept my 32bit values > atom Color_Value Color_Value= allocate(4) > poke4(Color_Value,#FFFFFFFF) This example you gave works fine. Are you saying you have the line ... > poke4(Color_Value,#FFFFFFFF) in two programs. It works in one and fails in the other? According to the ex.err file, there is a variable called 'test' involved. How about you scan for each use of 'test' and double(triple!) check that it really does have the correct value in it JUST before getting poked. The value in the ex.err file is #100000000 and NOT #FFFFFFFF You can send me the source code if you wish me to debug it. ------ Derek Parnell Melbourne, Australia "To finish a job quickly, go slower."
8. Re: poke4 won't accept my 32bit values
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 20, 2001
- 516 views
Chris Bensler writes: > Rob, I think maybe you should take a look at this one.. > I can send you the code, it's pretty straight forward.. I don't know what you are trying to do, but I think you mentioned something about skipping WinMain(), and I warned that you can't necessarily do that, since WinMain() calls eu_startup() and other routines which initialize a bunch of important data structures. Data structures that you might not need for integer (31-bit) calculations, but you will definitely need for larger numbers. If that's not what you are doing, then please send me the code. Thanks, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com
9. Re: poke4 won't accept my 32bit values
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 20, 2001
- 537 views
How about chnaging the code like this ... FROM: poke4(pvCube+16, {#FFFFFFFF,0}) TO: atom spareatom . . . spareatom = #FFFFFFFF poke4(pvCube+16, {spareatopm, 0}) just as an experiment. ------ Derek Parnell Melbourne, Australia "To finish a job quickly, go slower."
10. Re: poke4 won't accept my 32bit values
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 21, 2001
- 517 views
Hi Al, it's still early yet, but just before you posted this I'd tracked down the location of the problem. Superficially it appears to be a bug in the direct draw library (create3d_device) that is corrupting a part of the interpreter. I found this out but placing the offending line of code in various parts of the program until I isolated the line of code that was causing the effect. I appears that once the call to create3d_device has been executed, poke4() would no longer work for any values between #FFFFFF01 and #FFFFFFFF. Instead it would also convert these to #100000000, even if the values were in variables or expressions (eg. #FFFFFF00 + #FF). The workaround was to place all the code containing the poke4() statements physically before the create3d_device function was executed. Of course, none of this is conclusive yet. I've given this info to Robert as well and maybe he can confirm it or find a deeper reason. ----- Original Message ----- From: "Al Getz" <Xaxo at aol.com> To: "EUforum" <EUforum at topica.com> Sent: Wednesday, March 21, 2001 4:39 PM Subject: RE: poke4 won't accept my 32bit values [big snip] > > Good luck with it. > --Al > ------ Derek Parnell Melbourne, Australia "To finish a job quickly, go slower."
11. Re: poke4 won't accept my 32bit values
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 21, 2001
- 507 views
> > Thanks Derek, but it still doesn't explain why it would work for the > original Exotica Demos, and not for ExoticaX.. Tells me it has something > to do with my code, but I can't find it.. > > I even used the original Exotica demo, and changed only the necessities > to ExoticaX.. that would be: exotica_init(), and exotica_error(). > That's why I looked there.. > > create3D_device doesn't cause the program to fail, only when I change > the lines.. c_proc(EXOTICA_INIT,{NULL}) to exotica_init(), and > c_func(ON_ERROR,{NULL}) to exotica_error().. the respective ExoticaX > counterparts.. does the program give me that error.. > Only when I split the WinMain function like I have in ExoticaX do I get > that error.. > Well, except that the problem seems to start happening if create3d_device() is EXECUTED before Euphoria intepreter has PROCESSED (but not executed) the FrameMove() procedure definition. And this is the case in the original demo but in your modified demo. In the original demo, the Init_Loop function, which contains the create3d_device() call is processed by the interpreter, then the FrameMove procedure is processed etc... and the create3d_device() function only gets executed after Euphoria finally gets to the end of the file at the exotica_execute() function. But, in your demo, the Init_Loop function has been converted to inline code and is executed prior to Euphoria interpreter getting to the FrameMove() procedure definition. If one moves the FrameMove procedure definition nearer to the front of the file and before the create3d_device() invocation, your demo works just fine. Move it to just AFTER the create3d_device() call and your demo fails. The key to it seems to be that if the create3d_device is EXECUTED prior to Euphoria processing the definition of FrameMove() then the problem begins to happen. If create3d_device() is EXECUTED after Euphoria processes the procedure definition then the problem doesn't happen. Try it yourself. In the original (working) demo, move the first few lines up to, and including, the create3d_device() call, out of the Init_Loop() function to somewhere before the FrameMove() definition. Make sure these moved lines are executed before the FrameMove() definition is seen by the interpreter. The problem is now in the original demo too. ------ Derek Parnell Melbourne, Australia "To finish a job quickly, go slower."
12. Re: poke4 won't accept my 32bit values
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> Mar 21, 2001
- 509 views
--- Derek Parnell <ddparnell at bigpond.com> wrote: > Well, except that the problem seems to start happening if create3d_device() > is EXECUTED before Euphoria intepreter has PROCESSED (but not executed) the > FrameMove() procedure definition. And this is the case in the original demo > but in your modified demo. This all reminds me of the problems I had with GetChildFromWindow. Probably no one remembers, but this function used to fail if you had allocated memory (and not released it) before calling GetChildFromWindow. Some strange things seem to happen sometimes... Matt Lewis
13. Re: poke4 won't accept my 32bit values
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 21, 2001
- 534 views
------=_NextPart_000_0074_01C0B24E.6CCAD800 charset="iso-8859-1" Chris: I finally got around to trying your program. Since you aren't using Win32Lib, I tried your program using safe.e in place of the regular machine.e. I did the following: copy \euphoria\include\safe.e . rename safe.e machine.e Then I ran Derek's "working demo.exw". After a few seconds safe.e reported a call to poke() that is poking out of bounds, and it gave me an ex.err dump (attached). Here's what's happening. In poke_words() in exotica_api.ew you have a loop that is poking values. On the final iteration of the loop you (or Todd?) are stepping out of bounds. Although you are storing 2-byte values, you are actually poking 4-bytes at a time (from int_to_bytes()), while advancing the address only by 2. This is strange, but it works, except that on the final iteration you write 2 bytes out of bounds. pwCubeIndices is allocated a block that's 2-bytes too small. I gave it a couple of extra bytes and the safe.e report went away. However, I think I have an old version of directx, so my system hangs beyond that point. What does this have to do with poke4 and FFFFFFFF? Well, the interpreter can't store FFFFFFFF as a Euphoria 31-bit integer, so it allocates a place in the heap memory for a double. It's just possible that you are overwriting this double, thereby changing the value of this literal "constant" in the program. Any change to the program, such as shuffling statements around, do things in a slightly different way, could possibly change what is stored just after your block of memory, and could make the program either work or not. This naturally leads to all sorts of wild theories as to what might be happening. Anyway, fix this bug and carry on. There may be other bugs. I can't tell. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com ------=_NextPart_000_0074_01C0B24E.6CCAD800 name="save.err"
14. Re: poke4 won't accept my 32bit values
- Posted by Igor Kachan <kinz at peterlink.ru> Mar 22, 2001
- 533 views
------=_NextPart_000_01C0B300.97F101A0 Chris Bensler wrote: > Thank you Robert, > I fixed that bug.. > instead of poking all four bytes, I changed it to only poke the first > two bytes from int_to_bytes.. This works with Safe.e > But like you said, after this fix, the system hangs on Safe.e > When I run the fixed demo with Machine.e, I get the same error.. > poke4 is limited to 32-bit numbers > I think what you found was just ANOTHER bug, not the one I'm trying to > solve.. On my favourite 386-25 8M RAM Win95 machine, win32lib.ew v0.45r works wery well. But v 0.50c++ can not open comctl32.dll, if I run both standard machine.e or save.e. In this case, error message appeas in the Win's crash message box without ex.err file(!), and, in this box, text is "Win32lib Error Common controls could not be initialized!" I think for day and night - Why not ? My mainframe-386? But, if I use machine.e then v 0.55.1 crashes whith the next message: "Win32lib App Window - Fatal Error Error code 498 Common controls could not be initialized! Win32lib v 0.55.1" And if I run v 0.55.1 with save.e then save.e says me about incorrect *poke* and gives ex.err before this message above as well (See attachment). Then I begin to understand that 8M RAM of my mainframe may be full of starting win32lib. And I think - what about virtual memory? Note, I run pure win32lib.ew whithout any app, without just one button. And again I love very much the simplest solution - 386+Eu_DOS32. Can you say me what RAM I need to have 500 buttons (at all) in 5 windows on Win32 ? Just interesting to know without programming :::---))) Regards, Igor Kachan kinz at peterlink.ru ------=_NextPart_000_01C0B300.97F101A0 Content-Description: Ex-55-1.err (ERR )
15. Re: poke4 won't accept my 32bit values
- Posted by Fabio Ramirez <faramire at nemo.univalle.edu.co> Mar 23, 2001
- 512 views
-------Phoenix-Boundary-07081998- Hola, Igor Kachan escribi=F3 el 22/03/2001 10:57:39 a.m.: >On my favourite 386-25 8M RAM Win95 machine, >win32lib.ew v0.45r works wery well. > >But v 0.50c++ can not open comctl32.dll, >if I run both standard machine.e or save.e. >In this case, error message appeas in the >Win's crash message box without ex.err file(!), >and, in this box, text is >"Win32lib Error >Common controls could not be initialized!" > Igor, Theres an update for common controls that let you run the last win32lib progs even with 8MB of ram. The update is: 50comupd.exe It is 499K, and I've used on a 486DX2 66MHZ and a Laptop AMD 486 in both I've been able to run the last version of the IDE (XIDE) Good luck, Fabio ------------------------------------- Fabio Ramirez R. Administrador de Redes - CSI ------------------------------------- -------Phoenix-Boundary-07081998---
16. Re: poke4 won't accept my 32bit values
- Posted by Igor Kachan <kinz at peterlink.ru> Mar 23, 2001
- 501 views
Hi Fabio, >Theres an update for common controls that >let you run the last >win32lib >progs even with 8MB of ram. >The update is: >50comupd.exe >It is 499K, and I've used on a 486DX2 66MHZ >and a Laptop AMD 486 in both >I've been able to run the last version >of the IDE (XIDE) >Good luck, >Fabio >------------------------------------- >Fabio Ramirez R. >Administrador de Redes - CSI >------------------------------------- Thank you very much! No problem! Win32lib 0.55.1 works VERY WELL on 386-25 8M RAM with updated comctl32.dll Regards, Igor Kachan kinz at peterlink.ru
17. Re: poke4 won't accept my 32bit values
- Posted by Igor Kachan <kinz at peterlink.ru> Mar 24, 2001
- 522 views
Dear Eu users: I wrote: > Hi Fabio, > > >Theres an update for common controls that > >let you run the last >win32lib > >progs even with 8MB of ram. > >The update is: > > >50comupd.exe > > >It is 499K, and I've used on a 486DX2 66MHZ > >and a Laptop AMD 486 in both > >I've been able to run the last version > >of the IDE (XIDE) > > Thank you very much! > No problem! > > Win32lib 0.55.1 works VERY WELL > on 386-25 8M RAM with updated comctl32.dll And I can to continue. Lib comctl32.dll v.5.80 for ie 5 is much *slower* than my old ones for ie 3 and ie 4 that was on my machine in the past. This new dll looks like my progs developed on 386 for 486 with delays turned on on 386 ---- is this passage clear-cut? So, I wanted just to have 3 different comctl32.dll in my directory D:\windows\system\ under the different names for the different jobs, rename needed one into comctl32.dll on *plain* DOS and then run win command to make the needed job. (It seems comctl32.dll for ie 4 was the fastest one on my old and kind mainframe-386). But MS doesn't allow this tric ***(!!! See EULA !!!)***. (Or I don't understand that refined English?) And I have decided to delete new .dll and just copy my Win95's old one from CD cab onto my HD. Do you notice what kind of problems we all are solveing with Eu now ? Old and white bugs in the old C's dlls ? But new dll is just *slower* ! My 386 ? There are no bad hardware in the World. All hardware is good. I can not to throw out my old BK-0010-01 (like PDP-10), Poisk-1.06 (like 8088), 286-20, 386SX-33, 386DX-25 - all work as new ones. And again I love very much my simplest, powerful and kind friends -- 386 & Eu. Regards, Igor Kachan kinz at peterlink.ru