OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [src/] [testtclsh/] [testtclsh.cpp] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 19 wfjm
// $Id: testtclsh.cpp 504 2013-04-13 15:37:24Z mueller $
2
//
3
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16
// 2013-02-10   485   1.0    Initial version
17
// ---------------------------------------------------------------------------
18
 
19
#include <stdlib.h>
20
#include <stdio.h>
21
#include <readline/readline.h>
22
#include <readline/history.h>
23
 
24
#include "tcl.h"
25
 
26
#include <iostream>
27
 
28
using namespace std;
29
 
30
extern "C" int Rutiltpp_Init(Tcl_Interp* interp);
31
extern "C" int Rlinktpp_Init(Tcl_Interp* interp);
32
//extern "C" int Rusbtpp_Init(Tcl_Interp* interp);
33
extern "C" int Rwxxtpp_Init(Tcl_Interp* interp);
34
 
35
int main(int argc, const char* argv[])
36
{
37
  cout << "testtclsh starting..." << endl;
38
 
39
  Tcl_Interp* interp = Tcl_CreateInterp();
40
  if (!interp) {
41
    cout << "Tcl_CreateInterp() failed" << endl;
42
    return 1;
43
  }
44
 
45
  Rutiltpp_Init(interp);
46
  Rlinktpp_Init(interp);
47
  // Rusbtpp_Init(interp);
48
  Rwxxtpp_Init(interp);
49
 
50
  char* line;
51
  while ((line = readline("testtclsh> "))) {
52
    if (line[0]!=0) add_history(line);
53
    int rc = Tcl_Eval(interp, line);
54
    if (rc != TCL_OK) {
55
      cout << "command '" << line << "' failed" << endl;
56
    }
57
    const char* res = Tcl_GetStringResult(interp);
58
    if (res && res[0])
59
      cout << Tcl_GetStringResult(interp) << endl;
60
    free(line);
61
  }
62
 
63
  Tcl_DeleteInterp(interp);
64
  Tcl_Finalize();
65
 
66
  cout << "testtclsh exit..." << endl;
67
  return 0;
68
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.