Fujitsu F2 MC-16 Computer Accessories User Manual


 
28
CHAPTER 1 BASIC FUNCTIONS
1.17.1 Referring to Local Symbols
This section describes referring to local symbols and Scope.
Scope
When a local symbol is referred to, Scope is used to indicate the module and function to which the local
symbol to be referred belongs.
SOFTUNE Workbench automatically scopes the current module and function to refer to local symbols in the
current module with preference. This is called the Auto-scope function, and the module and function
currently being scoped are called the Current Scope.
When specifying a local variable outside the Current Scope, the variable name should be specified by the
module and function to which the variable belongs. This method of specifying a variable is called a symbol
path name or a Search Scope.
Moving Scope
As explained earlier, there are two ways to specify the reference to a variable: by adding a Search Scope
when specifying the variable name, and by moving the Current Scope to the function with the symbol to be
referred to. The Current Scope can be changed by displaying the Call Stack dialog and selecting the parent
function. For further details of this operation, refer to "4.6.7 Stack" in "SOFTUNE Workbench Operation
Manual". Changing the Current Scope as described above does not affect the value of the PC.
By moving the current scope in this way, you can search a local symbol in parent function with precedence.
Specifying Symbol and Search Procedure
A symbol is specified as follows:
When a symbol is specified using the module and function names, the symbol is searched. However, when
only the symbol name is specified, the search is made as follows:
1. Local symbols in function in Current Scope
2. Static symbols in module in Current Scope
3. Global symbols
If a global symbol has the same name as a local symbol in the Current Scope, specify "\" or "::" at the start of
global symbol. By doing so, you can explicitly show that is a global symbol.
An automatic variable can be referred to only when the variable is in memory. Otherwise, specifying an
automatic variable causes an error.
[[Module Name] [\Function Name] \] Symbol Name