Index: doc/current.3 =================================================================== diff -u -r0228cdf0ec65ab129536c20196a05d593ceb59b4 -rd49b5f90fec18930612d4fe2a36463226e94eb3b --- doc/current.3 (.../current.3) (revision 0228cdf0ec65ab129536c20196a05d593ceb59b4) +++ doc/current.3 (.../current.3) (revision d49b5f90fec18930612d4fe2a36463226e94eb3b) @@ -1,6 +1,6 @@ '\" '\" Generated from file 'current\&.man' by tcllib/doctools with format 'nroff' -'\" Copyright (c) 2014 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3\&.0 Austria license (CC BY 3\&.0 AT)\&. +'\" Copyright (c) 2014-2016 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3\&.0 Austria license (CC BY 3\&.0 AT)\&. '\" .TH "nx::current" 3 2\&.1\&.0 current "NX API" .\" The -*- nroff -*- definitions below are for supplemental macros used @@ -283,9 +283,12 @@ This introspection command provides information about various details, to be identified using \fIoption\fR, on the callstack\&. The command is invoked from a method body\&. If \fIoption\fR is not provided, \fBnx::current\fR will -default to option \fBobject\fR (see below)\&. \fBnx::current\fR operates on the -Tcl callstack and is aware of NX-specific callstack and stackframe -details\&. \fIoption\fR can be any of the following: +default to option \fBobject\fR (see +below)\&. \fBnx::current\fR operates on the Tcl callstack and is aware +of NX-specific callstack and stackframe details\&. Except for the +options \fBcallinglevel\fR and \fBlevel\fR, calling \fBnx::current\fR outside +an NX object or method will result in an error\&. \fIoption\fR can be +any of the following: .RS .IP \(bu \fBactivelevel\fR returns the actual callstack level which @@ -315,7 +318,8 @@ (e\&.g\&., filters) and by method combination (\fBnx::next\fR) are ignored\&. The level is reported as an absolute level number (\fB#\fR followed by a digit) to be directly used as the first argument to \fBuplevel\fR -or \fBupvar\fR\&. See also \fBactivelevel\fR\&. +or \fBupvar\fR\&. See also \fBactivelevel\fR\&. If called outside NX, +\fB1\fR is returned (which is the default for \fBupvar\fR and \fBuplevel\fR)\&. .IP \(bu \fBcallingobject\fR returns the name of the object which is calling into the currently executing method\&. See also \fBcallingclass\fR\&. @@ -333,6 +337,12 @@ \fBisnextcall\fR will return 1, if the currently executing method implementation was invoked via \fBnx::next\fR; 0 otherwise\&. .IP \(bu +\fBlevel\fR will return a number indicating the stack +level of the invoking method or script, or an empty string when +executed outside an NX context (e\&.g\&., in a Tcl proc or a namespace +script)\&. The resulting value can be directly passed as \fIlevel\fR to +\fBinfo level\fR)\&. +.IP \(bu \fBmethod\fR returns the name of the currently executing method\&. If an ensemble-method call, the name of the bottom-most ("leaf") method is returned\&. @@ -351,6 +361,6 @@ .PP .SH COPYRIGHT .nf -Copyright (c) 2014 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3\&.0 Austria license (CC BY 3\&.0 AT)\&. +Copyright (c) 2014-2016 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3\&.0 Austria license (CC BY 3\&.0 AT)\&. .fi \ No newline at end of file Index: doc/current.man =================================================================== diff -u -r0228cdf0ec65ab129536c20196a05d593ceb59b4 -rd49b5f90fec18930612d4fe2a36463226e94eb3b --- doc/current.man (.../current.man) (revision 0228cdf0ec65ab129536c20196a05d593ceb59b4) +++ doc/current.man (.../current.man) (revision d49b5f90fec18930612d4fe2a36463226e94eb3b) @@ -3,7 +3,7 @@ [include version.inc] [manpage_begin nx::current 3 [vset VERSION]] -[copyright { 2014 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3.0 Austria license (CC BY 3.0 AT).}] +[copyright { 2014-2016 Stefan Sobernig , Gustaf Neumann ; available under the Creative Commons Attribution 3.0 Austria license (CC BY 3.0 AT).}] [titledesc {Return information about the method callstack}] [moddesc {NX API}] @@ -17,12 +17,13 @@ This introspection command provides information about various details, to be identified using [arg option], on the callstack. The command is invoked from a method body. If [arg option] is not provided, [cmd nx::current] will -default to option [option "object"] (see below). [cmd nx::current] operates on the -Tcl callstack and is aware of NX-specific callstack and stackframe -details. [arg option] can be any of the following: +default to option [option "object"] (see +below). [cmd nx::current] operates on the Tcl callstack and is aware +of NX-specific callstack and stackframe details. Except for the +options [option callinglevel] and [option level], calling [cmd "nx::current"] outside +an NX object or method will result in an error. [arg option] can be +any of the following: -[comment {activelevel activemixin args calledclass calledmethod calledproc callingclass callinglevel callingmethod callingobject callingproc class filterreg isnextcall method methodpath nextmethod object proc}] - [list_begin itemized] [item] [option "activelevel"] returns the actual callstack level which @@ -54,7 +55,8 @@ (e.g., filters) and by method combination ([cmd nx::next]) are ignored. The level is reported as an absolute level number ([const #] followed by a digit) to be directly used as the first argument to [cmd uplevel] -or [cmd upvar]. See also [option "activelevel"]. +or [cmd upvar]. See also [option "activelevel"]. If called outside NX, +[const 1] is returned (which is the default for [cmd upvar] and [cmd uplevel]). [item] [option "callingobject"] returns the name of the object which is calling into the currently executing method. See also [option "callingclass"]. @@ -72,6 +74,12 @@ [item] [option "isnextcall"] will return 1, if the currently executing method implementation was invoked via [cmd nx::next]; 0 otherwise. +[item] [option "level"] will return a number indicating the stack +level of the invoking method or script, or an empty string when +executed outside an NX context (e.g., in a Tcl proc or a namespace +script). The resulting value can be directly passed as [arg "level"] to +[cmd "info level"]). + [item] [option method] returns the name of the currently executing method. If an ensemble-method call, the name of the bottom-most ("leaf") method is returned.