1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
-
+
|
/*
* tclProc.c --
*
* This file contains routines that implement Tcl procedures,
* including the "proc" and "uplevel" commands.
*
* Copyright (c) 1987-1993 The Regents of the University of California.
* Copyright (c) 1994-1996 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* SCCS: %Z% $Id: tclProc.c,v 1.8 1998/07/20 16:44:02 welch Exp $
* SCCS: %Z% $Id: tclProc.c,v 1.9 1998/07/21 15:58:44 surles Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
-
+
-
-
+
-
|
ClientData dummy; /* Not used. */
Tcl_Interp *interp; /* Current interpreter. */
int objc; /* Number of arguments. */
Tcl_Obj *CONST objv[]; /* Argument objects. */
{
register Interp *iPtr = (Interp *) interp;
Proc *procPtr;
char *fullName, *procName, *args, *bytes, *p;
char *fullName, *procName;
char **argArray = NULL;
Namespace *nsPtr, *altNsPtr, *cxtNsPtr;
Tcl_Obj *defPtr, *bodyPtr;
Tcl_Command cmd;
Tcl_DString ds;
int numArgs, length, result, i;
int result;
register CompiledLocal *localPtr;
if (objc != 4) {
Tcl_WrongNumArgs(interp, 1, objv, "name args body");
return TCL_ERROR;
}
/*
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
-
+
|
Interp *iPtr = (Interp*)interp;
char **argArray = NULL;
register Proc *procPtr;
int i, length, result, numArgs;
char *args, *bytes, *p;
register CompiledLocal *localPtr;
Tcl_Obj *defPtr, *resultPtr;
Tcl_Obj *defPtr;
/*
* If the procedure's body object is shared because its string value is
* identical to, e.g., the body of another procedure, we must create a
* private copy for this procedure to use. Such sharing of procedure
* bodies is rare but can cause problems. A procedure body is compiled
* in a context that includes the number of compiler-allocated "slots"
|