Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Bugs and Fixes

inline function problem

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

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

inline function problem

Hi ,

this code give error

  inline function Absi(x){eax =  $x ; cdq ; xor eax , edx ; eax -= edx ; $return eax }

  print( Absi(-100)  , '\r\n');    

error is

Expected , or ) but found 100 in [test_def.zir] Code: print( Absi(-100) , '\r\n');

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

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

I have fixed this in latest beta :)

program WIN32CUI 'Test';

#include 'ch.zir';

inline function Absi($x) {
	eax = $x;
	test eax, eax
	jns @notsigned;
	neg eax
	@notsigned:
	$return eax;
}

print(-100, ' ', Absi(-100)  , ' ', Absi(100), '\r\n'); 

wait_key();

ExitProcess(0);
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

works well.

thank you for fixing it.

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

0CodErr member
Posts
201
Threads
37
Location
Unknown

This seems works

program RAW_IMAGE 'test';
#set bits 32;

inline procedure test($a){
  $a = eax;
}
Dword a;
test(a);

But this not(just changed name $a to $p1)

program RAW_IMAGE 'test';
#set bits 32;

inline procedure test($p1){
  $p1 = eax;
}
Dword a;
test(a);
Instruction usage is not supported!
Colin admin
Posts
928
Threads
49
Location
Bulgaria

This was actually part of a much bigger problem which is now fixed for next release. Thanks.