[25] | 1 | '\" |
---|
| 2 | '\" Copyright (c) 1989-1993 The Regents of the University of California. |
---|
| 3 | '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
---|
| 4 | '\" |
---|
| 5 | '\" See the file "license.terms" for information on usage and redistribution |
---|
| 6 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 7 | '\" |
---|
| 8 | '\" RCS: @(#) $Id: SetRecLmt.3,v 1.3 1999/04/16 00:46:33 stanton Exp $ |
---|
| 9 | '\" |
---|
| 10 | .so man.macros |
---|
| 11 | .TH Tcl_SetRecursionLimit 3 7.0 Tcl "Tcl Library Procedures" |
---|
| 12 | .BS |
---|
| 13 | .SH NAME |
---|
| 14 | Tcl_SetRecursionLimit \- set maximum allowable nesting depth in interpreter |
---|
| 15 | .SH SYNOPSIS |
---|
| 16 | .nf |
---|
| 17 | \fB#include <tcl.h>\fR |
---|
| 18 | .sp |
---|
| 19 | int |
---|
| 20 | \fBTcl_SetRecursionLimit\fR(\fIinterp, depth\fR) |
---|
| 21 | .SH ARGUMENTS |
---|
| 22 | .AS Tcl_Interp *interp |
---|
| 23 | .AP Tcl_Interp *interp in |
---|
| 24 | Interpreter whose recursion limit is to be set. |
---|
| 25 | Must be greater than zero. |
---|
| 26 | .AP int depth in |
---|
| 27 | New limit for nested calls to \fBTcl_Eval\fR for \fIinterp\fR. |
---|
| 28 | .BE |
---|
| 29 | |
---|
| 30 | .SH DESCRIPTION |
---|
| 31 | .PP |
---|
| 32 | At any given time Tcl enforces a limit on the number of recursive |
---|
| 33 | calls that may be active for \fBTcl_Eval\fR and related procedures |
---|
| 34 | such as \fBTcl_GlobalEval\fR. |
---|
| 35 | Any call to \fBTcl_Eval\fR that exceeds this depth is aborted with |
---|
| 36 | an error. |
---|
| 37 | By default the recursion limit is 1000. |
---|
| 38 | .PP |
---|
| 39 | \fBTcl_SetRecursionLimit\fR may be used to change the maximum |
---|
| 40 | allowable nesting depth for an interpreter. |
---|
| 41 | The \fIdepth\fR argument specifies a new limit for \fIinterp\fR, |
---|
| 42 | and \fBTcl_SetRecursionLimit\fR returns the old limit. |
---|
| 43 | To read out the old limit without modifying it, invoke |
---|
| 44 | \fBTcl_SetRecursionLimit\fR with \fIdepth\fR equal to 0. |
---|
| 45 | .PP |
---|
| 46 | The \fBTcl_SetRecursionLimit\fR only sets the size of the Tcl |
---|
| 47 | call stack: it cannot by itself prevent stack overflows on the |
---|
| 48 | C stack being used by the application. If your machine has a |
---|
| 49 | limit on the size of the C stack, you may get stack overflows |
---|
| 50 | before reaching the limit set by \fBTcl_SetRecursionLimit\fR. |
---|
| 51 | If this happens, see if there is a mechanism in your system for |
---|
| 52 | increasing the maximum size of the C stack. |
---|
| 53 | |
---|
| 54 | .SH KEYWORDS |
---|
| 55 | nesting depth, recursion |
---|