Register | Login
Forum Index > Bugs and Fixes > global variable redeclared
Author Message
Pages: 1 2 3
0CodErr
Ziron Guru
(send private message)

Posts: 199
Topics: 37

Location:
[1629] - posted: 2015-02-04 22:05:18
Could you also make this for labels?
Code:
program RAW_IMAGE 'test';

#set bits 32;

inline function SomeInlineFunction1() {
SomeInlineFunction2();
next:
}

inline function SomeInlineFunction2() {
next:
}

SomeInlineFunction1();
next:
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1630] - posted: 2015-02-04 23:47:49
Macros must allow placing already used label since it is an inline piece of code.

If you want to create unique labels, you must use the macro function $uniquelabel. Please check ziron.zir under emacro try() { ...

It has a good example of unique labels.

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:
[1631] - posted: 2015-02-05 18:01:02
If you want to create unique labels, you must use the macro function $uniquelabel.
I actually want specific label but not only unique.
For better explanation i mean macro-local labels like in NASM.
I think that it way will make code more easy to understand and readable. Instead of write like: Code:
$exceptlbl = $_uniquelabel; 
$_e($exceptlbl):
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1635] - posted: 2015-02-05 22:26:57
OK, I will add this to my todo list. Thanks.

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:
[1642] - posted: 2015-02-06 22:27:57
Actually $_uniquelabel not so unique smile
Because it is possible to write:
Code:
program RAW_IMAGE 'test';

#set bits 32;

const REP_COUNT = 1024*16;

___7777___0:

$repeat REP_COUNT: 
  $a = $_uniquelabel; 
  $_e($a): 
$end

And after that we get error:
Reserved label ___7777___0


In our documentation nothing about that. It would be better if there will written about format such labels to prevent use them.
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1648] - posted: 2015-02-07 17:30:19
I've fixed issue with unique label and I have made it possible to declare global variables locally.

I have also added localized macro labels:

Code:
$mylabel:
  nop
goto $mylabel


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:
[1673] - posted: 2015-02-11 21:34:26
I have also added localized macro labels

Cannot compile:
Code:
program RAW_IMAGE 'test';

#set bits 32;

inline procedure Test_labels() {  
  eax = $l1; 
$l1:  
}

$repeat 64:
  Test_labels();
$end

Unexpected symbol $
Admin
Site Admin

avatar

(send private message)

Posts: 933
Topics: 55

Location:
OverHertz Studio
[1675] - posted: 2015-02-11 22:48:08
I have added new function $labelref() for next release which allows macros to have forward declaration labels.

e.g.

Code:
inline procedure Test_labels() {  
  $l1 = $labelref();

  eax = $l1; 
$l1:  
}


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


Quick reply:

Message:



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