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

Function ConfigureMessage

micropolis-activity/src/tk/tkmsg.c:361–458  ·  view source on GitHub ↗
(interp, msgPtr, argc, argv, flags)

Source from the content-addressed store, hash-verified

359 * etc. get set for msgPtr; old resources get freed, if there
360 * were any.
361 *
362 *----------------------------------------------------------------------
363 */
364
365static int
366ConfigureMessage(interp, msgPtr, argc, argv, flags)
367 Tcl_Interp *interp; /* Used for error reporting. */
368 register Message *msgPtr; /* Information about widget; may or may
369 * not already have values for some fields. */
370 int argc; /* Number of valid entries in argv. */
371 char **argv; /* Arguments. */
372 int flags; /* Flags to pass to Tk_ConfigureWidget. */
373{
374 XGCValues gcValues;
375 GC newGC;
376
377 /*
378 * Eliminate any existing trace on a variable monitored by the message.
379 */
380
381 if (msgPtr->textVarName != NULL) {
382 Tcl_UntraceVar(interp, msgPtr->textVarName,
383 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
384 MessageTextVarProc, (ClientData) msgPtr);
385 }
386
387 if (Tk_ConfigureWidget(interp, msgPtr->tkwin, configSpecs,
388 argc, argv, (char *) msgPtr, flags) != TCL_OK) {
389 return TCL_ERROR;
390 }
391
392 /*
393 * If the message is to display the value of a variable, then set up
394 * a trace on the variable's value, create the variable if it doesn't
395 * exist, and fetch its current value.
396 */
397
398 if (msgPtr->textVarName != NULL) {
399 char *value;
400
401 value = Tcl_GetVar(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY);
402 if (value == NULL) {
403 Tcl_SetVar(interp, msgPtr->textVarName, msgPtr->string,
404 TCL_GLOBAL_ONLY);
405 } else {
406 if (msgPtr->string != NULL) {
407 ckfree(msgPtr->string);
408 }
409 msgPtr->string = ckalloc((unsigned) (strlen(value) + 1));
410 strcpy(msgPtr->string, value);
411 }
412 Tcl_TraceVar(interp, msgPtr->textVarName,
413 TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS,
414 MessageTextVarProc, (ClientData) msgPtr);
415 }
416
417 /*
418 * A few other options need special processing, such as setting

Callers 2

Tk_MessageCmdFunction · 0.85
MessageWidgetCmdFunction · 0.85

Calls 8

Tcl_UntraceVarFunction · 0.85
Tk_ConfigureWidgetFunction · 0.85
Tcl_TraceVarFunction · 0.85
Tk_GetGCFunction · 0.85
Tk_FreeGCFunction · 0.85
ComputeMessageGeometryFunction · 0.85
Tk_DoWhenIdleFunction · 0.70

Tested by

no test coverage detected