MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Tcl_CreateInterp

Function Tcl_CreateInterp

micropolis-activity/src/tcl/tclbasic.c:130–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128 *----------------------------------------------------------------------
129 */
130
131Tcl_Interp *
132Tcl_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));

Callers 6

mainFunction · 0.70
BitmapInitFunction · 0.50
Tk_RegisterInterpFunction · 0.50
OptionInitFunction · 0.50
PixmapInitFunction · 0.50
mainFunction · 0.50

Calls 2

Tcl_InitHashTableFunction · 0.85
TclSetupEnvFunction · 0.85

Tested by 1

mainFunction · 0.56