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-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclProc.c,v 1.48 2003/10/21 20:42:05 dgp Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
* Prototypes for static functions in this file
|
|
|
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-1998 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclProc.c,v 1.49 2003/12/24 04:18:20 davygrvy Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
* Prototypes for static functions in this file
|
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
|
numArgs = procPtr->numArgs;
varPtr = framePtr->compiledLocals;
localPtr = procPtr->firstLocalPtr;
argCt = objc;
for (i = 1, argCt -= 1; i <= numArgs; i++, argCt--) {
if (!TclIsVarArgument(localPtr)) {
panic("TclObjInterpProc: local variable %s is not argument but should be",
localPtr->name);
return TCL_ERROR;
}
if (TclIsVarTemporary(localPtr)) {
panic("TclObjInterpProc: local variable %d is temporary but should be an argument", i);
return TCL_ERROR;
}
/*
* Handle the special case of the last formal being "args". When
* it occurs, assign it a list consisting of all the remaining
* actual arguments.
|
|
|
|
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
|
numArgs = procPtr->numArgs;
varPtr = framePtr->compiledLocals;
localPtr = procPtr->firstLocalPtr;
argCt = objc;
for (i = 1, argCt -= 1; i <= numArgs; i++, argCt--) {
if (!TclIsVarArgument(localPtr)) {
Tcl_Panic("TclObjInterpProc: local variable %s is not argument but should be",
localPtr->name);
return TCL_ERROR;
}
if (TclIsVarTemporary(localPtr)) {
Tcl_Panic("TclObjInterpProc: local variable %d is temporary but should be an argument", i);
return TCL_ERROR;
}
/*
* Handle the special case of the last formal being "args". When
* it occurs, assign it a list consisting of all the remaining
* actual arguments.
|
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
|
/*
*----------------------------------------------------------------------
*
* ProcBodySetFromAny --
*
* Tcl_ObjType's SetFromAny function for the proc body object.
* Calls panic.
*
* Results:
* Theoretically returns a TCL result code.
*
* Side effects:
* Calls panic, since we can't set the value of the object from a string
* representation (or any other internal ones).
*
*----------------------------------------------------------------------
*/
static int
ProcBodySetFromAny(interp, objPtr)
Tcl_Interp *interp; /* current interpreter */
Tcl_Obj *objPtr; /* object pointer */
{
panic("called ProcBodySetFromAny");
/*
* this to keep compilers happy.
*/
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* ProcBodyUpdateString --
*
* Tcl_ObjType's UpdateString function for the proc body object.
* Calls panic.
*
* Results:
* None.
*
* Side effects:
* Calls panic, since we this type has no string representation.
*
*----------------------------------------------------------------------
*/
static void
ProcBodyUpdateString(objPtr)
Tcl_Obj *objPtr; /* the object to update */
{
panic("called ProcBodyUpdateString");
}
/*
*----------------------------------------------------------------------
*
* TclCompileNoOp --
|
|
|
|
|
|
|
|
|
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
|
/*
*----------------------------------------------------------------------
*
* ProcBodySetFromAny --
*
* Tcl_ObjType's SetFromAny function for the proc body object.
* Calls Tcl_Panic.
*
* Results:
* Theoretically returns a TCL result code.
*
* Side effects:
* Calls Tcl_Panic, since we can't set the value of the object from a
* string representation (or any other internal ones).
*
*----------------------------------------------------------------------
*/
static int
ProcBodySetFromAny(interp, objPtr)
Tcl_Interp *interp; /* current interpreter */
Tcl_Obj *objPtr; /* object pointer */
{
Tcl_Panic("called ProcBodySetFromAny");
/*
* this to keep compilers happy.
*/
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
* ProcBodyUpdateString --
*
* Tcl_ObjType's UpdateString function for the proc body object.
* Calls Tcl_Panic.
*
* Results:
* None.
*
* Side effects:
* Calls Tcl_Panic, since we this type has no string representation.
*
*----------------------------------------------------------------------
*/
static void
ProcBodyUpdateString(objPtr)
Tcl_Obj *objPtr; /* the object to update */
{
Tcl_Panic("called ProcBodyUpdateString");
}
/*
*----------------------------------------------------------------------
*
* TclCompileNoOp --
|