示例#1
0
文件: tcl_np.c 项目: Pidbip/egtkwave
int NpInitInterp(Tcl_Interp *interp, int install_tk) {
  Tcl_Preserve((ClientData) interp);
  
  /*
   * Set sharedlib in interp while we are here.  This will be used to
   * base the location of the default pluginX.Y package in the stardll
   * usage scenario.
   */
  if (Tcl_SetVar2(interp, "plugin", "sharedlib", dllName, TCL_GLOBAL_ONLY)
      == NULL) {
    NpPlatformMsg("Failed to set plugin(sharedlib)!", "NpInitInterp");
    return TCL_ERROR;
  }
  
  /*
   * The plugin doesn't directly call Tk C APIs - it's all managed at
   * the Tcl level, so we can just pkg req Tk here instead of calling
   * Tk_InitStubs.
   */
  if (TCL_OK != Tcl_Init(interp)) {
    CONST char *msg = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
    fprintf(stderr, "GTKWAVE | Tcl_Init error: %s\n", msg) ;
    exit(EXIT_FAILURE);
  }
  if (install_tk) {
    NpLog("Tcl_PkgRequire(\"Tk\", \"%s\", 0)\n", TK_VERSION);
    if (1 && Tcl_PkgRequire(interp, "Tk", TK_VERSION, 0) == NULL) {
      CONST char *msg = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);      
      NpPlatformMsg(msg, "NpInitInterp Tcl_PkgRequire(Tk)");
      NpPlatformMsg("Failed to create initialize Tk", "NpInitInterp");
      return TCL_ERROR;
    }
  }
  return TCL_OK;
}
int
Tcl_AppInit(Tcl_Interp *interp)
{
    if (Tcl_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }

#ifdef BWISH
    if (Tk_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
#endif

    Cad_AppInit(interp);

    /*
     * Specify a user-specific startup file to invoke if the application is
     * run interactively. Typically the startup file is "~/.apprc" where "app"
     * is the name of the application. If this line is deleted then no user-
     * -specific startup file will be run under any conditions.
     */

#ifdef BWISH
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.bwishrc", TCL_GLOBAL_ONLY);
#else
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.btclshrc", TCL_GLOBAL_ONLY);
#endif

    return TCL_OK;
}
示例#3
0
kit::kit()
{
	created++;

	if(interp != NULL)	// already initialized?
		return;

	interp = Tcl_CreateInterp();
	if (Tcl_Init(interp) == TCL_ERROR)
	{
		cerr << "Tcl_Init(interp) failed: " << interp->result << endl;
		exit(1);
	}
	if (Tk_Init(interp) == TCL_ERROR)
	{
		cerr << "Tk_Init(interp) failed: " << interp->result << endl;
		exit(1);
	}
	if (Tix_Init(interp) == TCL_ERROR) 
	{
		cerr << "Tix_Init(interp) failed: " << interp->result << endl;
		exit(1);
	}
	Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);

	/*
	 * We need more X event information that tk can provide, so install
	 * a handler for *each* event, to store a pointer to the Xevent
	 * structure, which has the information we need 
	 */
	Tk_CreateGenericHandler(dispatchX, NULL);
}
示例#4
0
/*-----------------------------------------------------------------------------
 * TclX_AppInit --
 *
 * This procedure performs application-specific initialization.  Most
 * applications, especially those that incorporate additional packages, will
 * have their own version of this procedure.
 *
 * Results:
 *   Returns a standard Tcl completion code, and leaves an error message in
 *  interp result if an error occurs.
 *-----------------------------------------------------------------------------
 */
int
TclX_AppInit (Tcl_Interp *interp)
{
    if (Tcl_Init (interp) == TCL_ERROR) {
        return TCL_ERROR;
    }
    if (Tclx_Init (interp) == TCL_ERROR) {
        return TCL_ERROR;
    }
    Tcl_StaticPackage (interp, "Tclx", Tclx_Init, Tclx_SafeInit);

    /*
     * Call Tcl_CreateCommand for application-specific commands, if
     * they weren't already created by the init procedures called above.
     */

    /*
     * Specify a user-specific startup file to invoke if the application
     * is run interactively.  Typically the startup file is "~/.apprc"
     * where "app" is the name of the application.  If this line is deleted
     * then no user-specific startup file will be run under any conditions.
     */
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclrc", TCL_GLOBAL_ONLY);
    return TCL_OK;
}
示例#5
0
int Tcl_AppInit( Tcl_Interp *interp)
{
//    Tcl_Eval (interp, "set tcl_library \"C:/Tcl/lib/tcl8.5\"" );
    try
    {
        if ( TCL_OK != Tcl_Init(interp) )
            throw std::logic_error ( Tcl_GetStringResult ( interp ));

        if ( TCL_OK != Tk_Init(interp) )
            throw std::logic_error ( Tcl_GetStringResult ( interp ));

        Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);

        Tk_InitConsoleChannels(interp);
        if ( TCL_OK != Tk_CreateConsoleWindow(interp) )
            throw std::logic_error ( Tcl_GetStringResult ( interp ));

        if ( TCL_OK != Tcl_Eval (interp, "wm withdraw ." ) )
            throw std::logic_error ( Tcl_GetStringResult ( interp ));
        if ( TCL_OK != Tcl_Eval (interp, "console show" ) )
            throw std::logic_error ( Tcl_GetStringResult ( interp ));

        register_tclcmds ( interp );
        Tcl_SetVar(interp, "tcl_rcFileName", "./.rc", TCL_GLOBAL_ONLY);
    }
    catch ( std::exception& ex )
    {
        const char* errinfo = ex.what();
        return TCL_ERROR;
    }
    return TCL_OK;
}
示例#6
0
/* ui admin functions                                                        */
int
ui_init(struct queue_s *channels)
{
    interp = Tcl_CreateInterp();

    priv_c = channels;
 
    if (Tcl_Init(interp) == TCL_ERROR) {
        printf("Failed to initialise Tcl interpreter:\n%s\n",
               (interp)->result);
        return TCL_ERROR;
    }

    if (Tk_Init(interp)  == TCL_ERROR) {
        printf("Failed to initialise Tk package:\n%s\n", 
               (interp)->result);
        return TCL_ERROR;
    }
       
    Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);

    Tcl_CreateCommand(interp, "get_ports", get_ports, NULL, NULL);
    Tcl_CreateCommand(interp, "update_engine", update_engine, NULL, NULL);
    Tcl_CreateCommand(interp, "query_engine", query_engine, NULL, NULL);
    Tcl_CreateCommand(interp, "ui_exit", ui_exit, NULL, NULL);

    if (Tcl_Eval(interp, &tclscript[0]) != TCL_OK) {
        printf("Failed to run tcl command, error: %s\n", (interp)->result);
        return 0;
    }

    return 1;
}
示例#7
0
int
main()
{
  int mpi_argc = 0;
  char** mpi_argv = NULL;

  MPI_Init(&mpi_argc, &mpi_argv);

  // Create communicator for ADLB
  MPI_Comm comm;
  MPI_Comm_dup(MPI_COMM_WORLD, &comm);

  // Build up arguments
  int argc = 3;
  const char* argv[argc];
  argv[0] = "howdy";
  argv[1] = "ok";
  argv[2] = "bye";

  Tcl_Interp* interp = Tcl_CreateInterp();
  Tcl_Init(interp);

  Tcl_CreateObjCommand(interp, "ptasks_1_c", ptasks_1,
                       NULL, NULL);

  // Run Turbine
  turbine_code rc =
    turbine_run_interp(comm, "tests/ptasks-1.tcl", argc, argv, NULL,
                       interp);
  assert(rc == TURBINE_SUCCESS);

  MPI_Comm_free(&comm);
  MPI_Finalize();
  return 0;
}
示例#8
0
文件: run.c 项目: bnikolic/swift-t
turbine_code turbine_run_string(MPI_Comm comm, const char* script,
                                int argc, const char** argv, char* output,
                                Tcl_Interp* interp)
{
  bool created_interp = false;
  if (interp == NULL)
  {
    // Create Tcl interpreter:
    interp = Tcl_CreateInterp();
    Tcl_Init(interp);
    created_interp = true;
  }
  
  if (comm != MPI_COMM_NULL)
  {
    // Store communicator pointer in Tcl variable for turbine::init
    MPI_Comm* comm_ptr = &comm;
    Tcl_Obj* TURBINE_ADLB_COMM =
        Tcl_NewStringObj("TURBINE_ADLB_COMM", -1);
    Tcl_Obj* adlb_comm_ptr = Tcl_NewLongObj((long) comm_ptr);
    Tcl_ObjSetVar2(interp, TURBINE_ADLB_COMM, NULL, adlb_comm_ptr, 0);
  }

  // Render argc/argv for Tcl
  turbine_tcl_set_integer(interp, "argc", argc);
  Tcl_Obj* argv_obj     = Tcl_NewStringObj("argv", -1);
  Tcl_Obj* argv_val_obj;
  if (argc > 0)
    argv_val_obj = turbine_tcl_list_new(argc, argv);
  else
    argv_val_obj = Tcl_NewStringObj("", 0);
  Tcl_ObjSetVar2(interp, argv_obj, NULL, argv_val_obj, 0);

  if (output != NULL)
    turbine_tcl_set_wideint(interp, "turbine_run_output",
                            (ptrdiff_t) output);

  // Run the user script
  int rc = Tcl_Eval(interp, script);

  // Check for errors
  if (rc != TCL_OK)
  {
    Tcl_Obj* error_dict = Tcl_GetReturnOptions(interp, rc);
    Tcl_Obj* error_info = Tcl_NewStringObj("-errorinfo", -1);
    Tcl_Obj* error_msg;
    Tcl_DictObjGet(interp, error_dict, error_info, &error_msg);
    char* msg_string = Tcl_GetString(error_msg);
    printf("turbine_run(): Tcl error: %s\n", msg_string);
    return TURBINE_ERROR_UNKNOWN;
  }

  if (created_interp)
  {
    // Clean up
    Tcl_DeleteInterp(interp);
  }

  return TURBINE_SUCCESS;
}
示例#9
0
文件: dport.c 项目: dmk793/k11-player
int Tcl_AppInit(Tcl_Interp *interp)
{
    if (Tcl_Init(interp) == TCL_ERROR)
        return TCL_ERROR;

    if (tcl_interface_init(interp, &debug) != TCL_OK)
    {
        fprintf(stderr, "%s, tcl interface init error", __FUNCTION__);
        return TCL_ERROR;
    }

    if (strlen(script) && Tcl_EvalFile(interp, script) != TCL_OK)
    {
        char *result;

        result = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), NULL);
        if (result)
        {
            printf("*************\n");
            Tcl_Eval(interp, "puts $::errorInfo");
            printf("*************\n");
        }

        return TCL_ERROR;
    }

    return TCL_OK;
}
示例#10
0
int Tcl_AppInit(Tcl_Interp *interp)
{
  if (Tcl_Init(interp) == TCL_ERROR) {
    return TCL_ERROR;
  }
  
  /*
   * Call the init procedures for included packages.  Each call should
   * look like this:
   *
   * if (Mod_Init(interp) == TCL_ERROR) {
   *     return TCL_ERROR;
   * }
   *
   * where "Mod" is the name of the module.
   */
  
  /*
   * Call Tcl_CreateCommand for application-specific commands, if
   * they weren't already created by the init procedures called above.
   */
  
  //  if (OpenSeesAppInit(interp) < 0)
  //    return TCL_ERROR;
  
  /*
   * Specify a user-specific startup file to invoke if the application
   * is run interactively.  Typically the startup file is "~/.apprc"
   * where "app" is the name of the application.  If this line is deleted
   * then no user-specific startup file will be run under any conditions.
   */
  
  Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
  return TCL_OK;
}
示例#11
0
文件: ssim.c 项目: kywe665/ECEn-324
/*
 * Tcl_AppInit - Called by TCL to perform application-specific initialization.
 */
int Tcl_AppInit(Tcl_Interp *interp)
{
    /* Tell TCL about the name of the simulator so it can  */
    /* use it as the title of the main window */
    Tcl_SetVar(interp, "simname", simname, TCL_GLOBAL_ONLY);

    if (Tcl_Init(interp) == TCL_ERROR)
	return TCL_ERROR;
    if (Tk_Init(interp) == TCL_ERROR)
	return TCL_ERROR;
    Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);

    /* Call procedure to add new commands */
    addAppCommands(interp);

    /*
     * Specify a user-specific startup file to invoke if the application
     * is run interactively.  Typically the startup file is "~/.apprc"
     * where "app" is the name of the application.  If this line is deleted
     * then no user-specific startup file will be run under any conditions.
     */
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
    return TCL_OK;

}
示例#12
0
/*
 * Called by Tk_Main() to let me initialize the modules (Togl) I will need.
 */
int my_init( Tcl_Interp *interp )
{
   /*
    * Initialize Tcl, Tk, and the Togl widget module.
    */
   if (Tcl_Init(interp) == TCL_ERROR) {
      return TCL_ERROR;
   }
   if (Tk_Init(interp) == TCL_ERROR) {
      return TCL_ERROR;
   }

#ifdef WIN32
    /*
     * Set up a console window. Delete the following statement if you do not need that.
     */
    if (TkConsoleInit(interp) == TCL_ERROR) {
	   return TCL_ERROR;
    }
#endif /* WIN32 */

   if (Togl_Init(interp) == TCL_ERROR) {
      return TCL_ERROR;
   }

   /*
    * Specify the C callback functions for widget creation, display,
    * and reshape.
    */
   Togl_CreateFunc( create_cb );
   Togl_DisplayFunc( display_cb );
   Togl_ReshapeFunc( reshape_cb );
   Togl_TimerFunc( timer_cb );

   /*
    * Make a new Togl widget command so the Tcl code can set a C variable.
    */
   /* NONE */

   /*
    * Call Tcl_CreateCommand for application-specific commands, if
    * they weren't already created by the init procedures called above.
    */
   /*NOTHING*/

   /*
    * Specify a user-specific startup file to invoke if the application
    * is run interactively.  Typically the startup file is "~/.apprc"
    * where "app" is the name of the application.  If this line is deleted
    * then no user-specific startup file will be run under any conditions.
    */
#if (TCL_MAJOR_VERSION * 100 + TCL_MINOR_VERSION) >= 705
   Tcl_SetVar( interp, "tcl_rcFileName", "./index.tcl", TCL_GLOBAL_ONLY );
#else
   tcl_RcFileName = "./index.tcl";
#endif

   return TCL_OK;
}
示例#13
0
文件: tcl.cpp 项目: radiganm/system
 int Tcl_AppInit(Tcl_Interp *interp) 
 {
    if(Tcl_Init(interp) == TCL_ERROR) 
    {
       return TCL_ERROR;
    }
    return TCL_OK;
 }
示例#14
0
int Tcl_AppInit(Tcl_Interp *interp) {
	if (Tcl_Init(interp) == TCL_ERROR)
		return TCL_ERROR;

	if (Tcl_ProcInit(interp) == TCL_ERROR)
		return TCL_ERROR;

	return TCL_OK;
}
示例#15
0
int
init (Tcl_Interp *interp)
{
  if (Tcl_Init (interp) == TCL_ERROR)
    return TCL_ERROR;
  if (Tk_Init (interp) == TCL_ERROR)
    return TCL_ERROR;
  return TCL_OK;
}
示例#16
0
tcl::tcl()
{
	tcl_int = Tcl_CreateInterp();
	curid = 0;

	Tcl_Init(tcl_int);
	Tcl_SetVar(tcl_int, "argv0", "psotnic", TCL_GLOBAL_ONLY);
	addCommands();
}
示例#17
0
文件: tk-gui.c 项目: adh/dfsch
dfsch_object_t* dfsch_tcl_create_interpreter(){
  Tcl_Interp* i = Tcl_CreateInterp();
  if (Tcl_Init(i) == TCL_ERROR){
    dfsch_tcl_error(i);
  }
  if (Tk_Init(i) == TCL_ERROR){
    dfsch_tcl_error(i);
  }
  return dfsch_tcl_make_interpreter(i);
}
示例#18
0
int
Tcl_AppInit(
    Tcl_Interp *interp)		/* Interpreter for application. */
{
    if (Tcl_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }

#ifdef TCL_TEST
    if (Tcltest_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
            (Tcl_PackageInitProc *) NULL);
    if (TclObjTest_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
    if (Procbodytest_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
            Procbodytest_SafeInit);
#endif /* TCL_TEST */

    /*
     * Call the init procedures for included packages.  Each call should
     * look like this:
     *
     * if (Mod_Init(interp) == TCL_ERROR) {
     *     return TCL_ERROR;
     * }
     *
     * where "Mod" is the name of the module.
     */

    /*
     * Call Tcl_CreateCommand for application-specific commands, if
     * they weren't already created by the init procedures called above.
     * Each call would loo like this:
     *
     * Tcl_CreateCommand(interp, "tclName", CFuncCmd, NULL, NULL);
     */

    /*
     * Specify a user-specific startup script to invoke if the application
     * is run interactively.  On the Mac we can specifiy either a TEXT resource
     * which contains the script or the more UNIX like file location
     * may also used.  (I highly recommend using the resource method.)
     */

    Tcl_SetVar(interp, "tcl_rcRsrcName", "tclshrc", TCL_GLOBAL_ONLY);
    /* Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY); */

    return TCL_OK;
}
commandsManager::commandsManager(Tcl_Interp* _interp)
{
	 createdInterp = false;
	 if (!_interp)
	 {
			//Initialize the Tcl interpreter
			interp = Tcl_CreateInterp();
			Tcl_Init(interp);
			createdInterp = true;
	 } else
			interp = _interp;
}
示例#20
0
文件: main.c 项目: jokaICS/testbench
int AppInit(Tcl_Interp *interp) {
  if(Tcl_Init(interp) == TCL_ERROR)
    return TCL_ERROR;
  //if(Tk_Init(interp) == TCL_ERROR)
  //  return TCL_ERROR;


  ossm_scade_Interface *iface = init();
  ossm_tclcmd_register(iface,interp);

  return TCL_OK;
}
示例#21
0
int
Tcl_AppInit(
	    Tcl_Interp *interp)		/* Interpreter for application. */
{
    if (Tcl_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }

    Cad_AppInit(interp);

    Tcl_SetVar(interp, "tcl_rcFileName", "~/tclshrc.tcl", TCL_GLOBAL_ONLY);
    return TCL_OK;
}
示例#22
0
/*
 * NAME:	Tcl->AppInit()
 * DESCRIPTION:	initialize interpreter
 */
int Tcl_AppInit(Tcl_Interp *interp)
{
  Tcl_SetVar(interp, "hfs_interactive",
	     isatty(STDIN_FILENO) ? "1" : "0", TCL_GLOBAL_ONLY);

  if (Tcl_Init(interp) == TCL_ERROR)
    return TCL_ERROR;

  if (Hfs_Init(interp) == TCL_ERROR)
    return TCL_ERROR;

  return TCL_OK;
}
示例#23
0
//The main entry
int main( int argc, char ** argv )
{
#ifdef FIX__CTYPE_
    ctSetup();
#endif


    //init tcl
    Tcl_FindExecutable(argv[0]);
    Tcl_Interp * interp = Tcl_CreateInterp();
    Tcl_Init( interp );

    QTextCodec* codec = QTextCodec::codecForName("UTF-8");
    QTextCodec::setCodecForTr(codec);
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForLocale(codec);

    //Qt application
    QApplication a( argc, argv );
    Tcl_SetServiceMode (TCL_SERVICE_ALL);
    Qtk_InitNotifier( &a );
    //Register the msgbox command
    commandsManager::getInstance(interp)->registerFunction("msgbox" , (commandsManager::commandType) CallQMessageBox, "Shows the Qt message box");
    //Create and show the main window
    QMainWindow mw;
    const QString str = "hello";

    mw.setWindowTitle("Memory compiler SOI018");
    mw.setMinimumSize(640, 480);
    //Instantiate and set the focus to the QtclConsole
/*    QtclConsole *console = QtclConsole::getInstance(&mw,
   	                                                     "Welcome to <b>Qt / Tcl console</b> !<br>"
   	                                                     "For any remarks, please mail me at: <font color=blue>[email protected]</font><br><br>");
*/


    // Run config reading




    memwindow window((QWidget*)&mw);
 //   window.show();
    //   mw.setFocusProxy((QWidget*)console);
  //  mw.setCentralWidget((QWidget*)console);
    mw.setCentralWidget(&window);
    mw.show();

    return a.exec();
}
示例#24
0
文件: iftest.C 项目: m-sonntag/hqp
int
Tcl_AppInit(Tcl_Interp *interp)
{
  if (Tcl_InitStubs(interp, "8.1", 0) == NULL) {
    return TCL_ERROR;
  }

  if (Tcl_Init(interp) == TCL_ERROR) {
    return TCL_ERROR;
  }

  theInterp = interp;

  new If_Int("if_int", &if_int);
  new If_Int("if_intCb",
	     new If_GetCb<int, A>(&A::i, &a));

  new If_Bool("if_bool", &if_bool);
  new If_Real("if_real", &if_real);

  if_realVec = v_get(5);
  new If_RealVec("if_realVec", &if_realVec);

  if_realMat = m_get(2,3);
  new If_RealMat("if_realMat", &if_realMat);

  if_intVec = iv_get(3);
  new If_IntVec("if_intVec", &if_intVec);

  new If_IntVec("if_intVecp",
                new If_GetCb<const IVECP, A>(&A::intVecp, &a),
                new If_SetCb<const IVECP, A>(&A::set_intVecp, &a));

  new If_String("if_string", &if_string);
		
  new If_String("if_stringCb",
		new If_GetCb<const char *, A>(&A::string, &a),
		new If_SetCb<const char *, A>(&A::set_string, &a));

  new If_StdString("if_stdString",
		   new If_GetCb<const std::string&, A>(&A::stdString, &a),
		   new If_SetCb<const std::string&, A>(&A::set_stdString, &a));

  new If_Procedure("if_procedure", &if_procedure);

  new If_Method<A>("if_method", &A::if_method, &a);

  Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
  return TCL_OK;
}
示例#25
0
文件: tk_c.c 项目: avm/timidity
static int AppInit(Tcl_Interp *interp)
{
#include "bitmaps/back.xbm"
#include "bitmaps/fwrd.xbm"
#include "bitmaps/next.xbm"
#include "bitmaps/pause.xbm"
#include "bitmaps/play.xbm"
#include "bitmaps/prev.xbm"
#include "bitmaps/quit.xbm"
#include "bitmaps/stop.xbm"
#include "bitmaps/timidity.xbm"

#define DefineBitmap(Bitmap) do { \
	Tk_DefineBitmap (interp, Tk_GetUid(#Bitmap), Bitmap##_bits, \
			 Bitmap##_width, Bitmap##_height); \
	} while(0)

	my_interp = interp;

	if (Tcl_Init(interp) == TCL_ERROR) {
		return TCL_ERROR;
	}
	if (Tk_Init(interp) == TCL_ERROR) {
		return TCL_ERROR;
	}

	Tcl_CreateCommand(interp, "TraceCreate", (Tcl_CmdProc*) TraceCreate,
			  (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
	Tcl_CreateCommand(interp, "TraceUpdate", (Tcl_CmdProc*) TraceUpdate,
			  (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
	Tcl_CreateCommand(interp, "TraceReset", (Tcl_CmdProc*) TraceReset,
			  (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
	Tcl_CreateCommand(interp, "ExitAll", (Tcl_CmdProc*) ExitAll,
			  (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
	Tcl_CreateCommand(interp, "TraceUpdate", (Tcl_CmdProc*) TraceUpdate,
			  (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);

	DefineBitmap(back);
	DefineBitmap(fwrd);
	DefineBitmap(next);
	DefineBitmap(pause);
	DefineBitmap(play);
	DefineBitmap(prev);
	DefineBitmap(quit);
	DefineBitmap(stop);
	DefineBitmap(timidity);

	return TCL_OK;
#undef DefineBitmap
}
示例#26
0
int Tcl_AppInit(Tcl_Interp *pintrp)
{

    if (Tcl_InitStubs(pintrp, TCL_VERSION, 1) == NULL)
        Panic (pintrp,"Tcl stub's initialisation failed!");
        
    if (Tcl_Init(pintrp) == TCL_ERROR)
        Panic (pintrp,"Tcl's initialisation failed!");
    
    if (Tk_Init(pintrp) == TCL_ERROR)
        Panic (pintrp,"Tk's initialisation failed!");

    return TCL_OK;
}
示例#27
0
void tcl_init(void) {
	tcl_startup = 1;
	SDL_Log("Init TCL...\n");
	tcl_interp = Tcl_CreateInterp();
	if (Tcl_Init(tcl_interp) != TCL_OK) {
		SDL_Log("...failed (%s)\n", Tcl_GetStringResult(tcl_interp));
		return;
	}
	Tcl_CreateObjCommand(tcl_interp, "hello", Hello_Cmd, NULL, NULL);
	Tcl_CreateObjCommand(tcl_interp, "ModelData", ModelData_Cmd, NULL, NULL);
	tcl_draw_init(tcl_interp);
	tcl_gl_draw_init(tcl_interp);
	SDL_Log("...done\n");
	return;
}
示例#28
0
文件: tcl.cpp 项目: radiganm/system
 int main(int argc, char *argv[])
 {
   Tcl_Interp *tcl;
   Tcl_FindExecutable(argv[0]);
   tcl = Tcl_CreateInterp();
   if(TCL_OK != Tcl_Init(tcl))
   {
     std::cerr << "error: " 
          << "Could not initialize TCL interpreter." 
          << std::endl;
     exit(EXIT_FAILURE);
   }
   Tcl_Main(argc, argv, Tcl_AppInit);
   return EXIT_SUCCESS;
 }
示例#29
0
int appinit(Tcl_Interp *interp)
{
  if (Tcl_Init(interp) == TCL_ERROR)
    return (TCL_ERROR);
  Tcl_CreateExitHandler(exitHandler, 0);

#ifdef TK
  if (Tk_Init(interp) == TCL_ERROR)
    return (TCL_ERROR);
#endif

  if (on_program_start(interp) == TCL_ERROR)
    return (TCL_ERROR);
  return (TCL_OK);
}
示例#30
0
int
main(int argc, char** argv)
{
  int port = 8123;
  GNetXmlRpcServer *server;
  GMainLoop* main_loop;

  Tcl_FindExecutable(argv[0]);
  gnet_init ();

  if (argc > 1)
      port = atoi(argv[1]);

  /* Create the main loop */
  main_loop = g_main_new (FALSE);

  server = gnet_xmlrpc_server_new(port);

  printf("port = %d\n", port);
  
  if (!server)
    {
      fprintf (stderr, "Error: Could not start server\n");
      exit (EXIT_FAILURE);
    }

  tcl_interp = Tcl_CreateInterp();
  Tcl_Init(tcl_interp);
  Tcl_CreateCommand(tcl_interp, "ping",
                    tcl_ping, (ClientData) NULL,
                    (Tcl_CmdDeleteProc *) NULL);

  gnet_xmlrpc_server_register_command(server,
				      "ping",
				      xmlrpc_cmd_ping,
				      NULL);

  gnet_xmlrpc_server_register_command(server,
				      "cmd",
				      xmlrpc_cmd_tcl,
				      NULL);

  /* Start the main loop */
  g_main_run(main_loop);

  exit (EXIT_SUCCESS);
  return 0;
}