Local symbols ....
Local symbols are available for Data Labels, Equates names and Code Labels. They begin with a leading ''@''. When encountering, for example ''@Var'', RosAsm replaces this symbol by:
'PreviousPlainLabel@Var':
[MainDataLabel: @Var1: 12 @Var2: 66] ; Data
... ; No plain Label between !!!!!!!
mov eax D@Var2 ; eax = 66
...
[AnotherOne: @Var1: 24 @Var2: 77]
... ; No plain Label between !!!!!!!
mov eax D@Var2 ; eax = 77
MyRoutine:
[@Var1 2 @Var2 5] ; Equates
...
mov eax @Var2 ; eax = 5 same as:
mov eax MyRoutine_@Var2 ; eax = 5
mov eax D§MainDataLabel_@Var2 ; eax = 66
...
@Label: ; Label
....
jmp @Label
Note: You should refrain from using Local Symbols for Code Labels. For this, you have Local_Labels, that are more appropriate, and HLL Constructs, that make the Sources more readable. The Right-Click feature, and the Tree-View will most often fail at pointing these Local Symbols correctly.
When addressing the Value of a Local symbol, you can as well write:
'mov eax D$@Var1', or easier 'mov eax D@Var1'
The Local scope is between two main Labels.
Example of Win Structure notation:
MyRoutine:
[RECT: @left: D$ 0 @top: D$ 0 @right: D$ 0 @bottom: D$ 0]
mov D§@Left 10 ; or the short form:
mov D@left 10 ; same
But:
[RECT: @left: D§ 0 @top: D§ 0 @right: D§ 0 @bottom: D§ 0]
MyRoutine:
mov D$Rect@Left 10 ; here, ''mov D@left'' would be ''D$MyRoutine@Left''.
Local Symbols inside Macros
Before V.2.004, it was simply not possible to have Local Symbols inside a Macros Declaration. There is no real use of this, anyway, in usual Programming. This possibility has been made available for an advanced HLL Macros Set, like the one required by the BCX Port Project.
Local Symbols are computed in the earlier computings of the compilation. The ones declared in Macros Declarations are computed after the Macros Job. There are some limitations with this usage of Local Symbols inside a Macro.
Example of mis-use:
[macro | pop D@Local]
Main:
[@Local: ?]
[Data: @Local: ?]
push D@Local | macro
The first Statement will push D$Data@Local , whereas the second one will pop D$Main@Local , which is, of course not what you could expect it to do, when writing this. The problem, here, comes from the order of the Assembler computations:
First it computes all Local @Symbol into PlainLabel@Symbol. At that time, it does not consider the macros Declarations.
Second, the user Source is re-organized for further computations: The Data are moved into a given area, the Macro and Equates are stored, and removed from the Source, and so on...
Third, after the Macros job, a second pass of the Local Symbols computation is run, in order to assume the Local Symbol unfolded by the Macros. At that time, the above [Data:] Declaration is no longer inside the Source, so that the above push D@Local is becoming D$Main@Local instead of D$Data@Local.
So, it is important to respect the coherency of the Local Symbols usage, and to definitively refrain from using any Plain Label inside Procedures, where you make use of Local Symbols.
~~~~~~~