Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

uncompleted parameter

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

uncompleted parameter

i was playing with some code and needed to use wsprintf function , found it commented in

user32.zir file header , declared like this

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

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

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...

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

sample:

char myBuf[512];

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

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

output:

1 + 1 = 2

i've updated the beta

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

very nice , thank you Mr. Colin.

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