| 128 | *---------------------------------------------------------------------- |
| 129 | */ |
| 130 | |
| 131 | Tcl_Interp * |
| 132 | Tcl_CreateInterp() |
| 133 | { |
| 134 | register Interp *iPtr; |
| 135 | register Command *cmdPtr; |
| 136 | register CmdInfo *cmdInfoPtr; |
| 137 | int i; |
| 138 | |
| 139 | iPtr = (Interp *) ckalloc(sizeof(Interp)); |
| 140 | iPtr->result = iPtr->resultSpace; |
| 141 | iPtr->freeProc = 0; |
| 142 | iPtr->errorLine = 0; |
| 143 | Tcl_InitHashTable(&iPtr->commandTable, TCL_STRING_KEYS); |
| 144 | Tcl_InitHashTable(&iPtr->globalTable, TCL_STRING_KEYS); |
| 145 | iPtr->numLevels = 0; |
| 146 | iPtr->framePtr = NULL; |
| 147 | iPtr->varFramePtr = NULL; |
| 148 | iPtr->activeTracePtr = NULL; |
| 149 | iPtr->numEvents = 0; |
| 150 | iPtr->events = NULL; |
| 151 | iPtr->curEvent = 0; |
| 152 | iPtr->curEventNum = 0; |
| 153 | iPtr->revPtr = NULL; |
| 154 | iPtr->historyFirst = NULL; |
| 155 | iPtr->revDisables = 1; |
| 156 | iPtr->evalFirst = iPtr->evalLast = NULL; |
| 157 | iPtr->appendResult = NULL; |
| 158 | iPtr->appendAvl = 0; |
| 159 | iPtr->appendUsed = 0; |
| 160 | iPtr->numFiles = 0; |
| 161 | iPtr->filePtrArray = NULL; |
| 162 | for (i = 0; i < NUM_REGEXPS; i++) { |
| 163 | iPtr->patterns[i] = NULL; |
| 164 | iPtr->patLengths[i] = -1; |
| 165 | iPtr->regexps[i] = NULL; |
| 166 | } |
| 167 | iPtr->cmdCount = 0; |
| 168 | iPtr->noEval = 0; |
| 169 | iPtr->scriptFile = NULL; |
| 170 | iPtr->flags = 0; |
| 171 | iPtr->tracePtr = NULL; |
| 172 | iPtr->resultSpace[0] = 0; |
| 173 | |
| 174 | /* |
| 175 | * Create the built-in commands. Do it here, rather than calling |
| 176 | * Tcl_CreateCommand, because it's faster (there's no need to |
| 177 | * check for a pre-existing command by the same name). |
| 178 | */ |
| 179 | |
| 180 | for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) { |
| 181 | int new; |
| 182 | Tcl_HashEntry *hPtr; |
| 183 | |
| 184 | hPtr = Tcl_CreateHashEntry(&iPtr->commandTable, |
| 185 | cmdInfoPtr->name, &new); |
| 186 | if (new) { |
| 187 | cmdPtr = (Command *) ckalloc(sizeof(Command)); |