Printer:-GetScopeName - get name of current enclosing procedure or module
|
Calling Sequence
|
|
Printer:-GetScopeName()
|
|
Description
|
|
•
|
When called during the printing of intermediate code, the GetScopeName command returns the Name or GeneratedName corresponding to the name of the innermost enclosing procedure or module. For example, during the printing of a procedure body, GetScopeName returns the procedure's name.
|
•
|
If the enclosing scope does not have a name associated with it (for example, when the input is a single expression or a computation sequence) then NULL is returned.
|
|
|
Examples
|
|
Define a sample language GetScopeNameExample, using GetScopeName to obtain the name of a procedure during the printing phase.
>
|
|
>
|
LanguageDefinition[Define]( "GetScopeNameExample",
SetLanguageAttribute(
"Procedure_Begin" = proc(rettype, paramseq)
local procedure_name;
procedure_name := Printer:-GetScopeName();
("procedure ", procedure_name, " ", paramseq, " : ", rettype,"\n")
end proc,
"Procedure_End" = proc(rettype)
("end procedure;\n");
end proc,
"Procedure_ParametersInBody" = false
)
):
|
>
|
p := proc(x,y) 2*x end proc:
|
>
|
|
procedure p (integer x, double y) : integer
Return(2 * x);
end procedure;
| |
|
|
Download Help Document
Copyright © MathResources Inc. All Rights Reserved.
www.mathresources.com