tclquadcode

Check-in [bcbfa13992]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added documentation.
Timelines: family | ancestors | descendants | both | minor change | info-level
Files: files | file ages | folders
SHA3-256:bcbfa139927eca9867ca564eb7c9512ad7114648dd55c8b73af6e67f6b16e787
User & Date: dkf 2017-10-31 15:36:00
Context
2017-10-31
15:36
Implementation of [info level]. check-in: a8a6795c88 user: dkf tags: trunk
15:36
Added documentation. Closed-Leaf check-in: bcbfa13992 user: dkf tags: minor change, info-level
14:43
Support no-argument [info level] as well. check-in: d74cb2ac95 user: dkf tags: info-level
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to codegen/build.tcl.

300
301
302
303
304
305
306















307
308
309













310
311
312
313
314
315
316
    # Results:
    #	An LLVM value reference.

    method frame.value {callframetuple {name ""}} {
	my extract $callframetuple 1 $name
    }
















    method frame.args(INT) {depth callframe {name ""}} {
	my call ${tcl.callframe.getarglist} [list $callframe $depth] $name
    }














    method frame.depth {callframe {name ""}} {
	my call ${tcl.callframe.depth} [list $callframe] $name
    }

    # Builder:frame.create --
    #







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>







300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
    # Results:
    #	An LLVM value reference.

    method frame.value {callframetuple {name ""}} {
	my extract $callframetuple 1 $name
    }

    # Builder:frame.args(INT) --
    #
    #	Extract the list of arguments from a callframe. Part of [info level].
    #
    # Parameters:
    #	depth -	An INT saying which frame to get the arguments from, with the
    #		value interpretation as used in [info frame].
    #	callframetuple -
    #		The CALLFRAME-tuple LLVM value reference.
    #	name (optional) -
    #		A name to give to the result value.
    #
    # Results:
    #	An LLVM FAIL STRING reference.

    method frame.args(INT) {depth callframe {name ""}} {
	my call ${tcl.callframe.getarglist} [list $callframe $depth] $name
    }

    # Builder:frame.depth --
    #
    #	Extract the call depth from a callframe. Part of [info level].
    #
    # Parameters:
    #	callframetuple -
    #		The CALLFRAME-tuple LLVM value reference.
    #	name (optional) -
    #		A name to give to the result value.
    #
    # Results:
    #	An LLVM INT reference.

    method frame.depth {callframe {name ""}} {
	my call ${tcl.callframe.depth} [list $callframe] $name
    }

    # Builder:frame.create --
    #

Changes to codegen/varframe.tcl.

121
122
123
124
125
126
127







128
129
130
131
132
133
134
...
172
173
174
175
176
177
178






179
180
181
182
183
184
185
	    set rcPtr [my gep $proc 0 Proc.refCount]
	    my store [my sub [my load $rcPtr] $1] $rcPtr
	    # TODO: ought to theoretically delete the Proc when it has a
	    # refcount of 0. But we can actually postpone that until the
	    # library is deleted. And we don't do that anyway...
	    my ret
	}








	set f [$m local "tcl.callframe.getarglist" STRING?<-CALLFRAME,INT]
	params frame level
	build {
	    nonnull $frame
	    set interp [$api tclInterp]
	    set level0 [my cast(int) [my getInt64 $level] "level"]
................................................................................
	    $api Tcl_SetErrorCode $interp \
		[my constString TCL] [my constString LOOKUP] \
		[my constString STACK_LEVEL] $levelstr {}
	    $api Tcl_DecrRefCount $levelobj
	    my ret [my fail STRING]
	}







	set f [$m local "tcl.callframe.depth" INT<-CALLFRAME]
	params frame
	build {
	    nonnull $frame
	    my ret [my packInt32 [my dereference $frame 0 CallFrame.level]]
	}








>
>
>
>
>
>
>







 







>
>
>
>
>
>







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
...
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
	    set rcPtr [my gep $proc 0 Proc.refCount]
	    my store [my sub [my load $rcPtr] $1] $rcPtr
	    # TODO: ought to theoretically delete the Proc when it has a
	    # refcount of 0. But we can actually postpone that until the
	    # library is deleted. And we don't do that anyway...
	    my ret
	}

	##### tcl.callframe.getarglist #####
	#
	# Type signature: frame:CALLFRAME * depth:INT -> STRING?
	#
	# Get the list of arguments to a callframe (depth says which frame,
	# given the curren context frame).

	set f [$m local "tcl.callframe.getarglist" STRING?<-CALLFRAME,INT]
	params frame level
	build {
	    nonnull $frame
	    set interp [$api tclInterp]
	    set level0 [my cast(int) [my getInt64 $level] "level"]
................................................................................
	    $api Tcl_SetErrorCode $interp \
		[my constString TCL] [my constString LOOKUP] \
		[my constString STACK_LEVEL] $levelstr {}
	    $api Tcl_DecrRefCount $levelobj
	    my ret [my fail STRING]
	}

	##### tcl.callframe.depth #####
	#
	# Type signature: frame:CALLFRAME -> INT
	#
	# Get the call depth (see [info level]) of the given call frame.

	set f [$m local "tcl.callframe.depth" INT<-CALLFRAME]
	params frame
	build {
	    nonnull $frame
	    my ret [my packInt32 [my dereference $frame 0 CallFrame.level]]
	}