MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / Prompt

Function Prompt

SRC/tcl/tkMain.cpp:490–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488 */
489
490static void
491Prompt(Tcl_Interp *interp, int partial)
492{
493
494#ifdef _TCL84
495 const char *promptCmd;
496 const char one[12] = "tcl_prompt1";
497 const char two[12] = "tcl_prompt2";
498#elif _TCL85
499 const char *promptCmd;
500 const char one[12] = "tcl_prompt1";
501 const char two[12] = "tcl_prompt2";
502#else
503 char *promptCmd;
504 char one[12] = "tcl_prompt1";
505 char two[12] = "tcl_prompt2";
506#endif
507
508 int code;
509 Tcl_Channel outChannel, errChannel;
510
511 promptCmd = Tcl_GetVar(interp, partial ? two : one, TCL_GLOBAL_ONLY);
512
513 if (promptCmd == NULL) {
514 defaultPrompt:
515 if (!partial) {
516
517 /*
518 * We must check that outChannel is a real channel - it
519 * is possible that someone has transferred stdout out of
520 * this interpreter with "interp transfer".
521 */
522
523 outChannel = Tcl_GetChannel(interp, "stdout", NULL);
524 if (outChannel != (Tcl_Channel) NULL) {
525 Tcl_WriteChars(outChannel, "OpenSees > ", 11);
526 }
527 }
528 } else {
529 code = Tcl_Eval(interp, promptCmd);
530 if (code != TCL_OK) {
531 Tcl_AddErrorInfo(interp,
532 "\n (script that generates prompt)");
533 /*
534 * We must check that errChannel is a real channel - it
535 * is possible that someone has transferred stderr out of
536 * this interpreter with "interp transfer".
537 */
538
539 errChannel = Tcl_GetChannel(interp, "stderr", NULL);
540 if (errChannel != (Tcl_Channel) NULL) {
541 Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp));
542 Tcl_WriteChars(errChannel, "\n", 1);
543 }
544 goto defaultPrompt;
545 }
546 }
547 outChannel = Tcl_GetChannel(interp, "stdout", NULL);

Callers 2

Tk_MainOpenSeesFunction · 0.70
StdinProcFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected