Register | Login
Forum Index > Requests and Feedback > uncompleted parameter
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[983] uncompleted parameter - posted: 2011-12-09 17:44:17

i was playing with some code and needed to use wsprintf function , found it commented in
user32.zir file header , declared like this
Code:
function  wsprintfA(pointer output; pointer format): int32; cdecl;


then i want to call it with more than 2 parameters , ziron did not allow that, so i made this
macro to call it with any numbers of arguments
Code:
inline function wsprintf(;) 
{
  $i = $argc;  
  $to = $argc - 2;
  $repeat $to:  
     push $arg[$i];
     $i--;
  $end;
  wsprintfA($arg[0], $arg[1]);
  // Correct the stack 'cdecl'
  $arg =  $to * 4;
  Esp += $arg;
  $return eax;
}


so it would be better if ziron allow uncompleted parameters.

another workaround is telling zrion to did not check for the amount of parameters just
push all arguments and call the function.


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[987] - posted: 2011-12-09 21:42:26
i have implemented this, but for now it is only accepted for imported functions, i will add support for internal functions for next release if i get time...

Code:
  function wsprintf = wsprintfA(char* output; char* format[]): Int32; cdecl;


sample:

Code:
char myBuf[512];

wsprintf(@myBuf, '%i + %i = %i', 1, 1, 2);

print('mybuf = ', @myBuf, '\r\n');


output:
Code:
1 + 1 = 2


i've updated the beta

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
[989] - posted: 2011-12-09 21:46:36

very nice , thank you Mr. Colin.

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


Quick reply:

Message:



Currently Active Users:
There are currently 9 user(s) online. 0 member(s) and 9 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