当前位置: 首页>>代码示例>>C++>>正文


C++ Tcl_Init函数代码示例

本文整理汇总了C++中Tcl_Init函数的典型用法代码示例。如果您正苦于以下问题:C++ Tcl_Init函数的具体用法?C++ Tcl_Init怎么用?C++ Tcl_Init使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Tcl_Init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NpInitInterp

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;
}
开发者ID:Pidbip,项目名称:egtkwave,代码行数:35,代码来源:tcl_np.c

示例2: Tcl_AppInit

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;
}
开发者ID:behollis,项目名称:brlcad-svn-rev65072-gsoc2015,代码行数:30,代码来源:unixMain.c

示例3: Tcl_CreateInterp

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);
}
开发者ID:iivvoo-abandoned,项目名称:circus,代码行数:32,代码来源:kit.c

示例4: TclX_AppInit

/*-----------------------------------------------------------------------------
 * 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;
}
开发者ID:flightaware,项目名称:tclx,代码行数:37,代码来源:tclXAppInit.c

示例5: Tcl_AppInit

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;
}
开发者ID:mweiguo,项目名称:sgt,代码行数:32,代码来源:tcltkconsole.cpp

示例6: ui_init

/* 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;
}
开发者ID:uclmediatools,项目名称:reflector,代码行数:34,代码来源:ui-controller.c

示例7: main

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;
}
开发者ID:JohnPJenkins,项目名称:swift-t,代码行数:35,代码来源:ptasks-1.c

示例8: turbine_run_string

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;
}
开发者ID:bnikolic,项目名称:swift-t,代码行数:60,代码来源:run.c

示例9: Tcl_AppInit

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;
}
开发者ID:dmk793,项目名称:k11-player,代码行数:28,代码来源:dport.c

示例10: Tcl_AppInit

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;
}
开发者ID:fmckenna,项目名称:OpenSees,代码行数:35,代码来源:TclInterpreter.cpp

示例11: Tcl_AppInit

/*
 * 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;

}
开发者ID:kywe665,项目名称:ECEn-324,代码行数:28,代码来源:ssim.c

示例12: my_init

/*
 * 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;
}
开发者ID:discoverykid,项目名称:pyobjc,代码行数:62,代码来源:index.c

示例13: Tcl_AppInit

 int Tcl_AppInit(Tcl_Interp *interp) 
 {
    if(Tcl_Init(interp) == TCL_ERROR) 
    {
       return TCL_ERROR;
    }
    return TCL_OK;
 }
开发者ID:radiganm,项目名称:system,代码行数:8,代码来源:tcl.cpp

示例14: Tcl_AppInit

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;
}
开发者ID:demize,项目名称:shroudbnc,代码行数:9,代码来源:tickle.cpp

示例15: init

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;
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:9,代码来源:TkReactor_Test.cpp


注:本文中的Tcl_Init函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。