Register | Login
Forum Index > Bugs and Fixes > negative float parameter
Author Message
Pages: 1 2 3
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1296] negative float parameter - posted: 2012-12-28 13:44:54

Hi

it seems that zrion did not accept a negative float parameter

here is a prototype of the function
Code:
procedure PositionEntity=('_PositionEntity@16')(pointer Entity; single x,y,z); stdcall;


and here the calling
Code:
PositionEntity(ogrehead,0,0,-150);


any help please.

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1297] - posted: 2012-12-28 15:46:26
I have fixed this in latest beta,

here

don't forget that in your sample you are passing value as integer, Ziron does not do type checking on functions so you need to pass it as a real4 (single)

Code:
myProc(0.0, 0.0, -150.0);


also if you at some point need to pass real8 or real10, they would need variables created since they are passed by pointer.



Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1299] - posted: 2012-12-28 17:18:45

oh , i have just discover that.

the like is not found.


http://www.freewebs.com/ogremagic/index.htm
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1300] - posted: 2012-12-28 17:30:09

sorry the link is not found.

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1301] - posted: 2012-12-28 18:15:43
It's the usual beta link, anyways had a typo fixed the link, try again....

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1302] - posted: 2012-12-28 18:27:38

ok , downloaded and worked well , thanks.

about the real8 ,real10 parameter pathing , is there any work around or a trick to solve that
issue.

I have many functions with double parameters , such as Cairo library in my MagicPro library.

http://www.freewebs.com/ogremagic/index.htm
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1303] - posted: 2012-12-28 19:20:14
I have updated the beta again to fix a couple issues with doubles etc... so re-downlaod it.

i have an idea that may work but i will have to try around with it later...

else for now the normal way:

Code:
debugMB_Single(0, 2.6);

double dbVar = 2.6;
debugMB_Double(0, dbVar);

extended extVar = 2.6;
debugMB_Extended(0, extVar);



I may add type checking for floating values so we can easier get around this, but internally it technically would just be the same thing as above just without the extra var, it would still use the stack since it would pass it by ref.

For Ziron 2 i will come up with some better methods to overcome this. smile

btw i would suggest for performance reasons in your library to change your doubles to be double* this way you pass a pointer and can save size on the stack and make things quicker.

e.g.

Code:
procedure myProc(double* mydw) {
  //do something
}

double d = 5.0;
myProc(@d);


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1304] - posted: 2012-12-28 19:56:45

updating done, thanks.

i was thinking , make a macro or a plugin that will divide the extended value into 2 Dword
then push them in the stack.

something like that
Code:
inline procedure Dpl(extended x )
{
   divide x into X1 and X2
   push X2
   push X1
} 

then later

procedure myProc(double* mydw) {
  //do something
}

double d = 5.0;
myProc(Dpl(5.0));


so what do you think , and who to divide x ?

http://www.freewebs.com/ogremagic/index.htm
Pages: 1 2 3
create new reply


Quick reply:

Message:



Currently Active Users:
There are currently 18 user(s) online. 0 member(s) and 18 guest(s)
Most users ever online was 1046, January 28, 2022, 2:08 pm.


Statistics:
Threads: 225 | Posts: 1848 | Members: 51 | Active Members: 51
Welcome to our newest member, yecate
const Copyright = '2011-2024 © OverHertz Ltd. All rights reserved.';
Web development by OverHertz Ltd