w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
testtclsh.cpp
Go to the documentation of this file.
1// $Id: testtclsh.cpp 1185 2019-07-12 17:29:12Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2013-2018 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2013-02-10 485 1.0 Initial version
8// ---------------------------------------------------------------------------
9
10#include <stdlib.h>
11#include <stdio.h>
12#include <readline/readline.h>
13#include <readline/history.h>
14
15#include "tcl.h"
16
17#include <iostream>
18
19using namespace std;
20
21extern "C" int Rutiltpp_Init(Tcl_Interp* interp);
22extern "C" int Rlinktpp_Init(Tcl_Interp* interp);
23//extern "C" int Rusbtpp_Init(Tcl_Interp* interp);
24extern "C" int Rwxxtpp_Init(Tcl_Interp* interp);
25
26int main(int /*argc*/, const char* /*argv*/[])
27{
28 cout << "testtclsh starting..." << endl;
29
30 Tcl_Interp* interp = Tcl_CreateInterp();
31 if (!interp) {
32 cout << "Tcl_CreateInterp() failed" << endl;
33 return 1;
34 }
35
36 Rutiltpp_Init(interp);
37 Rlinktpp_Init(interp);
38 // Rusbtpp_Init(interp);
39 Rwxxtpp_Init(interp);
40
41 char* line;
42 while ((line = readline("testtclsh> "))) {
43 if (line[0]!=0) add_history(line);
44 int rc = Tcl_Eval(interp, line);
45 if (rc != TCL_OK) {
46 cout << "command '" << line << "' failed" << endl;
47 }
48 const char* res = Tcl_GetStringResult(interp);
49 if (res && res[0])
50 cout << Tcl_GetStringResult(interp) << endl;
51 free(line);
52 }
53
54 Tcl_DeleteInterp(interp);
55 Tcl_Finalize();
56
57 cout << "testtclsh exit..." << endl;
58 return 0;
59}
int Rlinktpp_Init(Tcl_Interp *interp)
int main(int, const char *[])
Definition: testtclsh.cpp:26
int Rutiltpp_Init(Tcl_Interp *interp)
int Rwxxtpp_Init(Tcl_Interp *interp)