Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ cc_binary(
visibility = ["//visibility:public"],
deps = [
":opensta_lib",
"//:tcl_readline_setup",
"//bazel:tcl_library_init",
"@rules_cc//cc/runfiles",
"@tcl_lang//:tcl",
Expand Down
14 changes: 9 additions & 5 deletions app/Main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#ifdef BAZEL_CURRENT_REPOSITORY
#include "bazel/tcl_library_init.h"
#include "src/tcl_readline_setup.h"
#endif

#if TCL_READLINE
Expand Down Expand Up @@ -124,12 +125,18 @@ staTclAppInit(int argc,
if (Tcl_Init(interp) == TCL_ERROR)
return TCL_ERROR;

bool has_readline = false;
#ifdef BAZEL_CURRENT_REPOSITORY
has_readline = (ord::SetupTclReadlineLibrary(interp) == TCL_OK);
#endif
#if TCL_READLINE
if (Tclreadline_Init(interp) == TCL_ERROR)
return TCL_ERROR;
Tcl_StaticPackage(interp, "tclreadline", Tclreadline_Init, Tclreadline_SafeInit);
if (Tcl_EvalFile(interp, TCLRL_LIBRARY "/tclreadlineInit.tcl") != TCL_OK)
printf("Failed to load tclreadline.tcl\n");
else
has_readline = true;
#endif

initStaApp(argc, argv, interp);
Expand Down Expand Up @@ -167,11 +174,8 @@ staTclAppInit(int argc,
}
}
}
#if TCL_READLINE
return Tcl_Eval(interp, "::tclreadline::Loop");
#else
return TCL_OK;
#endif

return has_readline ? Tcl_Eval(interp, "::tclreadline::Loop") : TCL_OK;
}

static void
Expand Down