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
|
-
+
|
/*
* tclCompExpr.c --
*
* This file contains the code to compile Tcl expressions.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
* Copyright (c) 1998-2000 by Scriptics Corporation.
* Contributions from Don Porter, NIST, 2006. (not subject to US copyright)
*
* 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.35 2006/11/09 16:52:30 dgp Exp $
* RCS: @(#) $Id: tclCompExpr.c,v 1.36 2006/11/13 08:23:07 das Exp $
*/
#include "tclInt.h"
#include "tclCompile.h"
/*
* The ExprNode structure represents one node of the parse tree produced
|
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
|
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
|
-
+
|
int i;
Tcl_InitHashTable(&opHashTable, TCL_STRING_KEYS);
for (i = 0; operatorTable[i].name != NULL; i++) {
int new;
Tcl_HashEntry *hPtr = Tcl_CreateHashEntry(&opHashTable,
operatorTable[i].name, &new);
if (new) {
Tcl_SetHashValue(hPtr, (ClientData) i);
Tcl_SetHashValue(hPtr, (ClientData) INT2PTR(i));
}
}
opTableInitialized = 1;
}
Tcl_MutexUnlock(&opMutex);
}
|
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
|
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
|
-
+
|
hPtr = Tcl_FindHashEntry(&opHashTable, operator);
if (hPtr == NULL) {
CompileMathFuncCall(interp, exprTokenPtr, operator, envPtr);
Tcl_DStringFree(&opBuf);
break;
}
Tcl_DStringFree(&opBuf);
opIndex = (int) Tcl_GetHashValue(hPtr);
opIndex = PTR2INT(Tcl_GetHashValue(hPtr));
opDescPtr = &(operatorTable[opIndex]);
/*
* If the operator is "normal", compile it using information from the
* operator table.
*/
|