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

Function EntryWidgetCmd

micropolis-activity/src/tk/tkentry.c:372–594  ·  view source on GitHub ↗
(clientData, interp, argc, argv)

Source from the content-addressed store, hash-verified

370 *
371 *--------------------------------------------------------------
372 */
373
374static int
375EntryWidgetCmd(clientData, interp, argc, argv)
376 ClientData clientData; /* Information about entry widget. */
377 Tcl_Interp *interp; /* Current interpreter. */
378 int argc; /* Number of arguments. */
379 char **argv; /* Argument strings. */
380{
381 register Entry *entryPtr = (Entry *) clientData;
382 int result = TCL_OK;
383 int length;
384 char c;
385
386 if (argc < 2) {
387 Tcl_AppendResult(interp, "wrong # args: should be \"",
388 argv[0], " option ?arg arg ...?\"", (char *) NULL);
389 return TCL_ERROR;
390 }
391 Tk_Preserve((ClientData) entryPtr);
392 c = argv[1][0];
393 length = strlen(argv[1]);
394 if ((c == 'c') && (strncmp(argv[1], "configure", length) == 0)
395 && (length >= 2)) {
396 if (argc == 2) {
397 result = Tk_ConfigureInfo(interp, entryPtr->tkwin, configSpecs,
398 (char *) entryPtr, (char *) NULL, 0);
399 } else if (argc == 3) {
400 result = Tk_ConfigureInfo(interp, entryPtr->tkwin, configSpecs,
401 (char *) entryPtr, argv[2], 0);
402 } else {
403 result = ConfigureEntry(interp, entryPtr, argc-2, argv+2,
404 TK_CONFIG_ARGV_ONLY);
405 }
406 } else if ((c == 'c') && (strncmp(argv[1], "cursor", length) == 0)
407 && (length >= 2)) {
408 if (argc != 3) {
409 Tcl_AppendResult(interp, "wrong # args: should be \"",
410 argv[0], " cursor pos\"",
411 (char *) NULL);
412 goto error;
413 }
414 if (GetEntryIndex(interp, entryPtr, argv[2], &entryPtr->cursorPos)
415 != TCL_OK) {
416 goto error;
417 }
418 EventuallyRedraw(entryPtr);
419 } else if ((c == 'd') && (strncmp(argv[1], "delete", length) == 0)) {
420 int first, last;
421
422 if ((argc < 3) || (argc > 4)) {
423 Tcl_AppendResult(interp, "wrong # args: should be \"",
424 argv[0], " delete firstIndex ?lastIndex?\"",
425 (char *) NULL);
426 goto error;
427 }
428 if (GetEntryIndex(interp, entryPtr, argv[2], &first) != TCL_OK) {
429 goto error;

Callers

nothing calls this directly

Calls 13

Tcl_AppendResultFunction · 0.85
Tk_PreserveFunction · 0.85
Tk_ConfigureInfoFunction · 0.85
ConfigureEntryFunction · 0.85
GetEntryIndexFunction · 0.85
Tcl_GetIntFunction · 0.85
EntryScanToFunction · 0.85
EntrySelectToFunction · 0.85
EntryUpdateScrollbarFunction · 0.85
Tk_ReleaseFunction · 0.85
EventuallyRedrawFunction · 0.70
DeleteCharsFunction · 0.70

Tested by

no test coverage detected