Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall MODNAME(choice, routine, [line][, file_number])
An expression that determines which routine’s name is returned: (n)
0 = Current routine
1 = Previous routine
2 = Routine before the previous routine
and so on…
The variable that will be loaded with the name of the specified routine. (a)
(optional) The variable that will be loaded with the line number of the XCALL statement in the specified routine. (n)
(optional) The variable that will be loaded with the number of the .INCLUDEd source file that contains the XCALL statement in the specified routine. (n)
The MODNAME subroutine returns the name of the current or a previous routine. If the name returned is that of the main routine, it is in the form “MAIN$name,” where name is the name of the main routine.
Routine is returned with blanks if you specify a nonexistent routine in choice. For example, if choice is 10 but the current call chain only has six routines, MODNAME returns blanks. With objects, the method signature is returned, and it can be quite large.
If choice is 0, line is the line number of the MODNAME statement. If choice is 1, line is the line number (in the previous routine) of the XCALL statement that called the current routine; and so forth.
On Universal Windows Platform, MODNAME always returns a line value of 0.
When using the .INCLUDE compiler directive to include source code, use file_number in addition to line to uniquely identify the source file in which line exists. Because the file that contains the MODNAME routine is number 1, the first .INCLUDEd file is number 2, the second is number 3, and so forth. Each new file that is processed gets a new file number, even if it has been .INCLUDEd previously. (On .NET, file_number is always returned 0.)
With Synergy .NET, line has the following restrictions:
With Synergy .NET, the file_number argument for MODNAME is always returned as 0.
The following subroutine provides the same type of traceback information that you’d get using the TRACE command in the debugger.
subroutine showtrace .define TTCHN ,1 record i ,d4 modnam ,a32 blanks ,a32 line ,d5 proc writes(TTCHN, "Calling chain is:") ;TTCHN opened by calling routine xcall modname(i, modnam, line) ;Start with current routine do begin writes(TTCHN, "in routine " + modnam) incr i xcall modname(i, modnam, line) if (modnam .ne. blanks) display(TTCHN, "at line " + %string(line)) end until(modnam .eq. blanks) xreturn endsubroutine