Register | Login
Forum Index > Source Help > H_join Error
Author Message
Pages: 1
Emil_halim
Ziron Beta Tester

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[390] H_join Error - posted: 2011-11-06 11:52:19

Hi

i have made a simple macro to make thing is more easy , but got access violation

here is the macro
Code:
function H_strcat(Dword dst,src) 
{ 
  Eax = dst; 
  Edx = src;
  push Eax;
  while (byte [Eax] != 0) { Eax++; } 
  while (byte [Edx] != 0)  
   { 
      BL =  [Edx]; 
      [Eax] = BL;  
      Edx++; Eax++; 
   } 
  [Eax] = 0;
  pop Eax;
} 

inline procedure  H_join(;)
{
  $temp = 1;
  $repeat $argc:  
     H_strcat($arg[0],$arg[$temp]);  
  $temp++;
  $end
}


and here is the calling that make the error
Code:
H_join(@buf,eax,' ',@var,';');


any help please?

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[392] - posted: 2011-11-06 14:35:10
because you are repeating still the amount of args that exist

Code:
$repeat $argc:


try:

Code:
inline procedure  H_join(;)
{
  $temp = 1;
  $to = $argc-1;  //minus the first argument
  $repeat $to:  
    H_strcat($arg[0],$arg[$temp]);  
    $temp++;
  $end
}


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
[397] - posted: 2011-11-06 15:13:42
i do as you said , but have this error

Invalid macro variable casting
Code:
H_strcat($arg[0],$arg[$temp]); 


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[398] - posted: 2011-11-06 17:10:31
I have just compiled this

Code:
program WIN32CUI 'test';

#include 'ch.zir';

function H_strcat(Dword dst,src) 
{ 
  Eax = dst; 
  Edx = src;
  push Eax;
  while (byte [Eax] != 0) { Eax++; } 
  while (byte [Edx] != 0)  
   { 
      BL =  [Edx]; 
      [Eax] = BL;  
      Edx++; Eax++; 
   } 
  [Eax] = 0;
  pop Eax;
} 

inline procedure  H_join(;)
{
  $temp = 1;
  $to = $argc-1;
  $repeat $to:  
    H_strcat($arg[0],$arg[$temp]);  
    $temp++;
  $end
}


wait_key(nil);
ExitProcess(0);


and it compiled without an error, can you try this ^ sample to see if it compiles.

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
[401] - posted: 2011-11-06 18:12:06

i have already post the error of this with Basic.zip file.

any way this refused to compile
Code:
program WIN32CUI 'test';

#include 'console.zir';
#include 'ch.zir';

function H_strcat(Dword dst,src) 
{ 
  Eax = dst; 
  Edx = src;
  push Eax;
  while (byte [Eax] != 0) { Eax++; } 
  while (byte [Edx] != 0)  
   { 
      BL =  [Edx]; 
      [Eax] = BL;  
      Edx++; Eax++; 
   } 
  [Eax] = 0;
  pop Eax;
} 

inline procedure  H_join(;)
{
  $temp = 1;
  $to = $argc-1;
  $repeat $to:  
    H_strcat($arg[0],$arg[$temp]);  
    $temp++;
  $end
}

char tmp[1048];

H_join(@tmp , 'Emil', ' ', 'Halim');
print(@tmp);

wait_key(nil);
ExitProcess(0);


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[404] - posted: 2011-11-06 18:25:17
ok i see it has to do with the call, i will look into this now smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[405] - posted: 2011-11-06 18:37:09
ok i have re-uploaded a temporary fix, i need to spend some more time working on the macro engine - it needs a-lot of work, but this will fix it for now smile

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
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