tclish_init_callback.c 886 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * tclish_init_callback.c
  3. *
  4. * Callback to set the initialise the terminal
  5. * - set raw mode (block for a single character)
  6. */
  7. #ifdef HAVE_CONFIG_H
  8. #include "config.h"
  9. #endif /* HAVE_CONFIG_H */
  10. #ifdef HAVE_LIBTCL
  11. #include <assert.h>
  12. #include <tcl.h>
  13. #include "tcl_private.h"
  14. /*--------------------------------------------------------- */
  15. bool_t tclish_init_callback(const clish_shell_t * shell)
  16. {
  17. int result;
  18. tclish_cookie_t *this = clish_shell__get_client_cookie(shell);
  19. /* initialise the TCL interpreter */
  20. this->interp = Tcl_CreateInterp();
  21. assert(NULL != this->interp);
  22. /* initialise the memory */
  23. Tcl_InitMemory(interp);
  24. result = Tcl_Init(this->interp);
  25. if (TCL_OK != result) {
  26. tclish_show_result(this->interp);
  27. }
  28. Tcl_Preserve(this->interp);
  29. return BOOL_TRUE;
  30. }
  31. /*--------------------------------------------------------- */
  32. #endif /* HAVE_LIBTCL */