1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
-
+
|
/*
* tclCompExpr.c --
*
* This file contains the code to compile Tcl expressions.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclCompExpr.c,v 1.25.4.2 2005/03/13 13:57:34 msofer Exp $
* RCS: @(#) $Id: tclCompExpr.c,v 1.25.4.3 2005/03/19 18:26:38 msofer Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
* The stuff below is a bit of a hack so that this file can be used in
|
| ︙ | | |
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
|
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
|
-
+
|
TclEmitPush(TclRegisterNewLiteral(envPtr, "1", 1), envPtr);
}
TclSetJumpTarget(envPtr, endOffset);
*endPtrPtr = tokenPtr;
done:
envPtr->currStackDepth = savedStackDepth + 1;
TclSetStackDepth((savedStackDepth+1), envPtr);
return code;
}
/*
*----------------------------------------------------------------------
*
* CompileCondExpr --
|
| ︙ | | |
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
|
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
|
-
+
-
+
|
TclSetJumpTarget(envPtr, jumpAroundThenOffset);
/*
* Compile the "else" expression.
*/
envPtr->currStackDepth = savedStackDepth;
TclSetStackDepth((savedStackDepth), envPtr);
elseCodeOffset = (envPtr->codeNext - envPtr->codeStart);
infoPtr->hasOperators = 0;
code = CompileSubExpr(tokenPtr, infoPtr, envPtr);
if (code != TCL_OK) {
goto done;
}
tokenPtr += (tokenPtr->numComponents + 1);
if (!infoPtr->hasOperators) {
TclEmitInst0(INST_TRY_CVT_TO_NUMERIC, envPtr);
}
/*
* Fix up the second jump around the "else" expression.
*/
TclSetJumpTarget(envPtr, jumpAroundElseOffset);
*endPtrPtr = tokenPtr;
done:
envPtr->currStackDepth = savedStackDepth + 1;
TclSetStackDepth((savedStackDepth+1), envPtr);
return code;
}
/*
*----------------------------------------------------------------------
*
* CompileMathFuncCall --
|
| ︙ | | |
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
|
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
|
-
+
|
*/
if (envPtr->maxStackDepth < envPtr->currStackDepth) {
envPtr->maxStackDepth = envPtr->currStackDepth;
}
TclEmitInst1(INST_CALL_BUILTIN_FUNC,
mathFuncPtr->builtinFuncIndex, envPtr);
envPtr->currStackDepth -= mathFuncPtr->numArgs;
TclAdjustStackDepth(-mathFuncPtr->numArgs, envPtr);
} else {
TclEmitInst1(INST_CALL_FUNC, (mathFuncPtr->numArgs+1), envPtr);
}
*endPtrPtr = afterSubexprPtr;
done:
return code;
|
| ︙ | | |