Register | Login
Forum Index > Source Help > detecting '\'
Author Message
Pages: 1 2 3 4 5
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1156] - posted: 2012-05-18 18:07:24
it is not possible, since i developed the macro system this way specifically for performance reasons.

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
[1157] - posted: 2012-05-18 18:09:06
btw i updated RTL macro strJoin to cover for eax

Code:
inline function strJoin(;) {
  $maxbuf = $argc - 1;
  
  $if deftype($arg[$maxbuf]) <> 'int':  
    $raise 'strJoin final argument must be maximum buffer length';
  $end
  
  $i = 1;  
  $to = $argc - 2;  
  
  $repeat $to: 
    $if $arg[$i] = 'eax':
      push eax;
    $end;
  $end;

  $repeat $to:  
    $if $arg[$i] = 'eax':
      pop eax
    $end;

    eax = strAppend($arg[0], $arg[$i], $arg[$maxbuf]);
    $i++;
  $end;
  
  $return eax;
}


but of course it would be better to use another free register, since its 1 less push/pop

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
[1158] - posted: 2012-05-18 18:11:15
sorry fixed a bug and made a little better:

Code:
inline function strJoin(;) {
  $maxbuf = $argc - 1;
  
  $if deftype($arg[$maxbuf]) <> 'int':  
    $raise 'strJoin final argument must be maximum buffer length';
  $end
  
  $i = 1;  
  $to = $argc - 2;  
  
  $repeat $to: 
    $if $i > 1:
      $if $arg[$i] = 'eax':
        push eax;
      $end;
    $end;
    $i++;
  $end;

  $i = 1;
  $repeat $to:  
    $if $i > 1:
      $if $arg[$i] = 'eax':
        pop eax
      $end;
    $end;

    eax = strAppend($arg[0], $arg[$i], $arg[$maxbuf]);
    $i++;
  $end;
  
  $return eax;
}


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
[1159] - posted: 2012-05-18 18:15:35

ok does ziron support string array, or not.

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

avatar

(send private message)

Posts: 639
Topics: 104

Location:
Alex, Egypt
[1160] - posted: 2012-05-18 18:16:49

sorry , i have to go now , if i have time i will post again tonight .

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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1161] - posted: 2012-05-18 19:05:26
firs you will need to make a fix to strlcpy in strings.zir, replace the whole strlcpy macro with:

Code:
//
// Copyright (c) 2012. OverHertz Ltd
//
inline procedure m_strcpy_std(dst, ssrc, ln) {
  push edi
  push esi
  push ecx
  
  edi = $dst;
  esi = $ssrc;
  ecx = $ln;
  shr ecx, 2
  rep movsd

  ecx = $ln;
  and ecx, 3
  rep movsb

  pop ecx
  pop esi
  pop edi
}
  
inline procedure m_strcpy_mmx(dst, ssrc, ln) {
  push edi
  push esi
  push ecx
  push edx

  edi = $dst;
  esi = $ssrc;  
  ecx = $ln;
  edx = ecx;
      
  shr ecx, 6
  if (ecx <> 0) {
    repeat {
      //$if defined(assembler_SSE_ON) == true:
      //$end
        
      movq mm0, qword[esi+0]
      movq mm1, qword[esi+8]
      movq mm2, qword[esi+16]
      movq mm3, qword[esi+24]
      movq mm4, qword[esi+32]
      movq mm5, qword[esi+40]
      movq mm6, qword[esi+48]
      movq mm7, qword[esi+56]
        
      movq qword[edi+0], mm0
      movq qword[edi+8], mm1
      movq qword[edi+16], mm2
      movq qword[edi+24], mm3
      movq qword[edi+32], mm4
      movq qword[edi+40], mm5
      movq qword[edi+48], mm6
      movq qword[edi+56], mm7
        
      esi += 64;
      edi += 64;
        
      edx -= 64;
    
      ecx -= 1;
    } until (ecx == 0);
  }
      
  ecx = edx;  
  shr edx, 3
      
  if (edx <> 0) {
    repeat {
      movq mm0, qword[esi]
      movq qword[edi], mm0
      
      esi += 8;
      edi += 8;
      
      ecx -= 8;    
      edx -= 1;
    } until (edx == 0);
  }
      
  rep movsb

  pop edx
  pop ecx
  pop esi
  pop edi
      
  emms  
}
  
inline procedure strlcpy(dest, source, len) {  
  $if defined(assembler_MMX_ON) == true:
    $if $len of 0:
      $if $len < 64:
        m_strcpy_std($dest, $source, $len);
      $else
        m_strcpy_mmx($dest, $source, $len);
      $end
    $else
      if ($len < 64) {
        m_strcpy_std($dest, $source, $len);
      } else {
        m_strcpy_mmx($dest, $source, $len);
      }
    $end;
  $else
    m_strcpy_std(dest, source, len);
  $end
}


ok now the fix is done, here is small string sample:

Code:
program WIN32CUI 'test';

#include 'ch.zir';

char* myArr[2];

//constant mem
myArr[0] = 'String 1';
myArr[1] = 'String 2';

print(myArr[0], '  ', myArr[1], '\r\n');

//dynamic
myArr[0] = malloc(16);
myArr[1] = malloc(16);

strlcpy(myArr[0], 'Test 1', sizeof 'Test 1');
strlcpy(myArr[1], 'Test 2', sizeof 'Test 2');

print(myArr[0], '  ', myArr[1], '\r\n');

delete myArr[0];
delete myArr[1];

wait_key();
ExitProcess(0);


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
[1162] - posted: 2012-05-18 21:41:04

ok , but this not allowed
Code:
for(ecx = 0 to 1)
{
  print(myArr[ecx], '\r\n');
}


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

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1163] - posted: 2012-05-18 23:33:40
i plan to add this but for now:

Code:
edi = @myArr;

for(ecx = 0 to 1) {
  print([edi+ecx*4], '\r\n');
}


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
Pages: 1 2 3 4 5
create new reply


Quick reply:

Message:



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