Register | Login
Forum Index > RTL > CharClass
Author Message
Pages: 1 2 3 4
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1615] - posted: 2015-02-03 22:49:11
Seems I forgot to add a type for the operand when none is present.

Code:
inline function IsDigit($symbol) {
  $tt = tokentype($_operand);
  $if $tt == TOKEN_EOF:
    $tt = TOKEN_FLAG;
  $end;
  
  $C = CHAR_DIGIT; gp_ax = 0; al = $symbol;
  $if $tt == TOKEN_FLAG:
    test CHAR_TABLE[gp_ax], $C;
    $res = ZF;
  $else
    al = CHAR_TABLE[gp_ax]; al &= $C;
    $res = gp_ax;
  $end;
  $return $res;
}


try this for now, on next release this will be corrected and instead will receive type TOKEN_FLAG on conditional statements.

TOKEN_EOF will be received when the macro is just present without any conditions. e.g.

Code:
IsDigit(ord('1'));  // $_operand = TOKEN_EOF type
if (IsDigit(...     // $_operand = TOKEN_FLAG type
//etc


Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1665] - posted: 2015-02-11 10:57:55
I tried use changed 'charclass.zir' as i posted above.

This for test:
Code:
program RAW_IMAGE 'test';

#set bits 32;

#include 'charclass.zir';

  eax = IsDigit(ord('5')); nop;
   //ax = IsDigit(ord('5')); nop; // Operand is invalid
   //ah = IsDigit(ord('5')); nop; // Operand is invalid
   //al = IsDigit(ord('5')); nop; // Operand is invalid
  
  if              (IsDigit(ord('5')) == true) {} ; nop;
  while           (IsDigit(ord('5')) == true) {} ; nop;
  repeat {} until (IsDigit(ord('5')) == true)    ; nop;
  
  case (true) {
  state IsDigit(ord('5')):      break;
  state IsWhiteSpace(ord('5')): break;
  state IsLetter(ord('5')):     break;
  default:
  }


Result(i post only part without table):
Code:
00000000  33C0              xor eax,eax
00000002  B035              mov al,0x35
00000004  8A806F000000      mov al,[eax+0x6f]
0000000A  2401              and al,0x1
0000000C  90                nop
0000000D  33C0              xor eax,eax
0000000F  B035              mov al,0x35
00000011  F6806F00000001    test byte [eax+0x6f],0x1
00000018  7400              jz 0x1a
0000001A  90                nop
0000001B  33C0              xor eax,eax
0000001D  B035              mov al,0x35
0000001F  F6806F00000001    test byte [eax+0x6f],0x1
00000026  7402              jz 0x2a
00000028  EBF1              jmp short 0x1b
0000002A  90                nop
0000002B  33C0              xor eax,eax
0000002D  B035              mov al,0x35
0000002F  F6806F00000001    test byte [eax+0x6f],0x1
00000036  74F3              jz 0x2b
00000038  90                nop
00000039  33C0              xor eax,eax
0000003B  B035              mov al,0x35
0000003D  8A806F000000      mov al,[eax+0x6f]
00000043  2401              and al,0x1
00000045  85C0              test eax,eax
00000047  740E              jz 0x57
00000049  EB24              jmp short 0x6f
0000004B  33C0              xor eax,eax
0000004D  B035              mov al,0x35
0000004F  8A806F000000      mov al,[eax+0x6f]
00000055  2410              and al,0x10
00000057  85C0              test eax,eax
00000059  750E              jnz 0x69
0000005B  EB12              jmp short 0x6f
0000005D  33C0              xor eax,eax
0000005F  B035              mov al,0x35
00000061  8A806F000000      mov al,[eax+0x6f]
00000067  2406              and al,0x6
00000069  85C0              test eax,eax
0000006B  7502              jnz 0x6f
0000006D  EB00              jmp short 0x6f
; .........................................................


Seems that "case" statement not use "just test" i.e.
Code:
0000001B  33C0              xor eax,eax
0000001D  B035              mov al,0x35
0000001F  F6806F00000001    test byte [eax+0x6f],0x1
00000026  7402              jz 0x2a

it use "and + test"
Code:
0000005D  33C0              xor eax,eax
0000005F  B035              mov al,0x35
00000061  8A806F000000      mov al,[eax+0x6f]
00000067  2406              and al,0x6
00000069  85C0              test eax,eax
0000006B  7502              jnz 0x6f

Is it possible to do "case" statement such as others?
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1667] - posted: 2015-02-11 13:43:54
Should be fixed in next release, case states was not passing the flag operand.

Download Ziron
Get free hosting for Ziron related fan-sites and Ziron projects, contact me in private message.
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1671] - posted: 2015-02-11 14:50:18
My test example above cannot be compiled:
Instruction usage is not supported!


0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1672] - posted: 2015-02-11 14:52:37
Also i use new version(as above) of 'charclass.zir' but currently still included old version.

Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1677] - posted: 2015-02-11 23:06:57
Both fixed for next release.

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


Quick reply:

Message:



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