示例#1
0
static int
vgpane(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[])
{
    char vbuf[30];
    vgpane_t *vgp;

    vgp = (vgpane_t *) malloc(sizeof(vgpane_t));
    *(vgpane_t **) tclhandleAlloc(vgpaneTable, vbuf, NULL) = vgp;

    vgp->vc = (vconfig_t *) 0;
    vgp->Npoly = 0;
    vgp->N_poly_alloc = 250;
    vgp->poly = malloc(vgp->N_poly_alloc * sizeof(poly));
    vgp->interp = interp;
    vgp->triangle_cmd = (char *) NULL;

    Tcl_CreateCommand(interp, vbuf, vgpanecmd,
		      (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_AppendResult(interp, vbuf, (char *) NULL);
    return TCL_OK;
}
示例#2
0
int Tclpathplan_Init(Tcl_Interp * interp)
{
#ifdef USE_TCL_STUBS
    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
	return TCL_ERROR;
    }
#else
    if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) {
	return TCL_ERROR;
    }
#endif
    if (Tcl_PkgProvide(interp, "Tclpathplan", VERSION) != TCL_OK) {
	return TCL_ERROR;
    }

    Tcl_CreateCommand(interp, "vgpane", vgpane,
		      (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);

    vgpaneTable = tclhandleInit("vgpane", sizeof(vgpane_t), 10);

    return TCL_OK;
}
示例#3
0
int main (int argc, char *argv[])
{
  /* some variables */
  char *mycvar, *params;
  const char *mytclvar;
  int x;

  /* initialize Tcl Interpreter */
  Tcl_Interp *interp;
  interp = Tcl_CreateInterp ();
  Tcl_Init (interp);

  /* Set example variable and insert command */
  mycvar = "this is my cvar";
  Tcl_CreateCommand (interp, "mycout", tcl_mycout, 0, 0);
  Tcl_SetVar (interp, "mycvar", mycvar, TCL_GLOBAL_ONLY);

  /* exec example.tcl */
  printf("Evaluating: example.tcl\n");
  Tcl_EvalFile (interp, "./example.tcl");

  /* you should see output from mycout now */

  /* now read mytclvar from the script */
  mytclvar = Tcl_GetVar (interp, "mytclvar", TCL_GLOBAL_ONLY);
  printf("mytclvar = %s\n", mytclvar);

  /* now try to execute mytclproc */
  params = " see me";
  x = Tcl_VarEval (interp, "mytclproc", params, 0);
  if (x == TCL_ERROR)
    printf("Tcl Error: %s\n", interp->result);
  else
    printf("Tcl Said: %s\n", interp->result);

  return 0;
}
示例#4
0
/*
** Register commands with the TCL interpreter.
*/
int Sqlitetest2_Init(Tcl_Interp *interp){
  static struct {
    char *zName;
    Tcl_CmdProc *xProc;
  } aCmd[] = {
    { "pager_open",              (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_close",             (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_commit",            (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_rollback",          (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_stmt_begin",        (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_stmt_commit",       (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_stmt_rollback",     (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_stats",             (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_pagecount",         (Tcl_CmdProc*)t2_tcl_function_stub },
    { "page_get",                (Tcl_CmdProc*)t2_tcl_function_stub },
    { "page_lookup",             (Tcl_CmdProc*)t2_tcl_function_stub },
    { "page_unref",              (Tcl_CmdProc*)t2_tcl_function_stub },
    { "page_read",               (Tcl_CmdProc*)t2_tcl_function_stub },
    { "page_write",              (Tcl_CmdProc*)t2_tcl_function_stub },
    { "page_number",             (Tcl_CmdProc*)t2_tcl_function_stub },
    { "pager_truncate",          (Tcl_CmdProc*)t2_tcl_function_stub },
#ifndef SQLITE_OMIT_DISKIO
    { "fake_big_file",           (Tcl_CmdProc*)fake_big_file       },
#endif
    { "sqlite3BitvecBuiltinTest",(Tcl_CmdProc*)testBitvecBuiltinTest     },
    { "sqlite3_test_control_pending_byte", (Tcl_CmdProc*)t2_tcl_function_stub },
  };
  int i;
  for(i=0; i<sizeof(aCmd)/sizeof(aCmd[0]); i++){
    Tcl_CreateCommand(interp, aCmd[i].zName, aCmd[i].xProc, 0, 0);
  }
#ifndef SQLITE_OMIT_WSD
  Tcl_LinkVar(interp, "sqlite_pending_byte",
     (char*)&sqlite3PendingByte, TCL_LINK_INT | TCL_LINK_READ_ONLY);
#endif
  return TCL_OK;
}
示例#5
0
PyObject *install(PyObject *s, PyObject *arg) {
    Tcl_Interp *trp = get_interpreter(arg);
    if(!trp) {
        PyErr_SetString(PyExc_TypeError, "get_interpreter() returned NULL");
        return NULL;
    }
    if (Tcl_InitStubs(trp, "8.1", 0) == NULL) 
    {
        PyErr_SetString(PyExc_RuntimeError, "Tcl_InitStubs returned NULL");
        return NULL;
    }
    if (Tk_InitStubs(trp, "8.1", 0) == NULL) 
    {
        PyErr_SetString(PyExc_RuntimeError, "Tk_InitStubs returned NULL");
        return NULL;
    }
    if (Tcl_PkgPresent(trp, "Togl", TOGL_VERSION, 0)) {
        Py_INCREF(Py_None);
        return Py_None;
    }
    if (Tcl_PkgProvide(trp, "Togl", TOGL_VERSION) != TCL_OK) {
        PyErr_Format(PyExc_RuntimeError, "Tcl_PkgProvide failed: %s", Tcl_GetStringResult(trp));
        return NULL;
    }

    Tcl_CreateCommand(trp, "togl", (Tcl_CmdProc *)Togl_Cmd,
                      (ClientData) Tk_MainWindow(trp), NULL);

    if(first_time) {
        Tcl_InitHashTable(&CommandTable, TCL_STRING_KEYS);
        first_time = 0;
    }

    Py_INCREF(Py_None);
    return Py_None;
}
示例#6
0
文件: tcltk.c 项目: kmillar/rho
void tcltk_init(int *TkUp)
{
    int code;

    *TkUp = 0;

    /* Absence of the following line is said to be an error with
     * tcl >= 8.4 on all platforms, and is known to cause crashes under
     * Windows */

    Tcl_FindExecutable(NULL);

    RTcl_interp = Tcl_CreateInterp();
    code = Tcl_Init(RTcl_interp);
    if (code != TCL_OK) error(Tcl_GetStringResult(RTcl_interp));

/* HAVE_AQUA is not really right here.
   On Mac OS X we might be using Aqua Tcl/Tk or X11 Tcl/Tk, and that
   is in principle independent of whether we want quartz() built.
*/
#if !defined(Win32) && !defined(HAVE_AQUA)
    char *p= getenv("DISPLAY");
    if(p && p[0])  /* exclude DISPLAY = "" */
#endif
    {
	code = Tk_Init(RTcl_interp);  /* Load Tk into interpreter */
	if (code != TCL_OK) {
	    warning(Tcl_GetStringResult(RTcl_interp));
	} else {
	    Tcl_StaticPackage(RTcl_interp, "Tk", Tk_Init, Tk_SafeInit);

	    code = Tcl_Eval(RTcl_interp, "wm withdraw .");  /* Hide window */
	    if (code != TCL_OK) error(Tcl_GetStringResult(RTcl_interp));
	    *TkUp = 1;
	}
    }
#if !defined(Win32) && !defined(HAVE_AQUA)
    else
	warningcall(R_NilValue, _("no DISPLAY variable so Tk is not available"));
#endif

    Tcl_CreateCommand(RTcl_interp,
		      "R_eval",
		      R_eval,
		      (ClientData) NULL,
		      (Tcl_CmdDeleteProc *) NULL);

    Tcl_CreateCommand(RTcl_interp,
		      "R_call",
		      R_call,
		      (ClientData) NULL,
		      (Tcl_CmdDeleteProc *) NULL);

    Tcl_CreateCommand(RTcl_interp,
		      "R_call_lang",
		      R_call_lang,
		      (ClientData) NULL,
		      (Tcl_CmdDeleteProc *) NULL);

#ifndef Win32
    Tcl_unix_setup();
#endif
    Tcl_SetServiceMode(TCL_SERVICE_ALL);

/*** We may want to revive this at some point ***/

#if 0
  code = Tcl_EvalFile(RTcl_interp, "init.tcl");
  if (code != TCL_OK)
    error("%s\n", Tcl_GetStringResult(RTcl_interp));
#endif

}
示例#7
0
int
run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("TkReactor_Test"));

  tcl_interp   = Tcl_CreateInterp ();

  if (init (tcl_interp) != TCL_OK) {
    ACE_OS::exit (1);
  }

  Tk_Window tk = 0;
  tk = Tk_MainWindow(tcl_interp);
  if (tk == 0)
    {
      ACE_ERROR_RETURN ((LM_ERROR, "Tk_Reactor_Test: %s\n", tcl_interp->result),1);
    }

  char tcl_cmd[] = "source TkReactor_Test.tcl";
  if (Tcl_Eval (tcl_interp, tcl_cmd) != TCL_OK) {
    ACE_OS::exit (1);
  }
  // set up callback
  char label_var_name[] = "label_var";
  char pressme[] = "pressme";
  Tcl_CreateCommand (tcl_interp,
                     pressme,
                     inc_count,
                     label_var_name,
                     0);

  // Register callback for X Timer
  (void) Tk_CreateTimerHandler (1000,
                                inc_tmo,
                                label_var_name);

  // It will perform Tk Main Loop
  ACE_TkReactor reactor;
  ACE_Reactor r (&reactor);

  //Event Handler for ACE Timer.
  EV_handler evh;

  ACE_Acceptor <Connection_Handler, ACE_SOCK_ACCEPTOR> acceptor;

  if (acceptor.open (ACE_INET_Addr ((u_short) SERV_TCP_PORT),
                     &r) == -1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       "%p\n",
                       "open"),
                      -1);

  if (reactor.schedule_timer (&evh,
                              (const void *) "label_var",
                              ACE_Time_Value (2),
                              ACE_Time_Value (2))==-1)
    ACE_ERROR_RETURN ((LM_ERROR,
                       " (%P|%t) can't register with reactor\n"),
                      -1);

  ACE_Thread_Manager::instance ()->spawn ((ACE_THR_FUNC) client,
                                          0,
                                          THR_NEW_LWP | THR_DETACHED);

  while (!quit)
    {
      int result = reactor.handle_events ();
      switch (result)
        {
        case 0:
          //          ACE_DEBUG ((LM_DEBUG,"handle_events timed out\n"));
          break;
        case -1:
          ACE_DEBUG ((LM_DEBUG,"handle_events returned -1\n"));
          quit = 1;
          break;
        }
    }

  ACE_END_TEST;
  return 0;
}
示例#8
0
文件: init.c 项目: NautiluX/geomview
int ndutils_init(Tcl_Interp * interp)
{
  Tk_Window w = Tk_MainWindow(interp);

/*Used by all three*/
  Tcl_CreateCommand(interp, "ObjExistCheck", ObjExistCheck, (ClientData) w,
		    NULL);

/*Used by slicer*/
  Tcl_CreateCommand(interp, "GetData", GetData, (ClientData) w, NULL);
  Tcl_CreateCommand(interp, "GetDim", GetDim, (ClientData) w, NULL);
  Tcl_CreateCommand(interp, "CreateClipPlane", CreateClipPlane,
		    (ClientData) w, NULL);
  Tcl_CreateCommand(interp, "UpdatePicture", UpdatePicture, (ClientData) w,
		    NULL);
  Tcl_CreateCommand(interp, "GetFocusCam", GetFocusCam, (ClientData) w,
		    NULL);
  Tcl_CreateCommand(interp, "SliceNDice", SliceNDice, (ClientData) w,
		    NULL);

/*used by colormap*/
  Tcl_CreateCommand(interp, "GeomExDir", GeomExDir, (ClientData) w, NULL);
  Tcl_CreateCommand(interp, "setphoto", setphotoCmd, (ClientData) w, NULL);
  Tcl_CreateCommand(interp, "colors", colorsCmd, (ClientData) w, NULL);
  Tcl_CreateCommand(interp, "setmin", minCmd, (ClientData) w, NULL);
  Tcl_CreateCommand(interp, "setmax", maxCmd, (ClientData) w, NULL);

/*used by colormap and 3dsnapshot*/
  Tcl_CreateCommand(interp, "DoProjection", DoProjection, (ClientData) w,
		    NULL);

  infile = iobfileopen(stdin);

  initSlicer();

  return TCL_OK;
}
示例#9
0
/* implement new commands */
void tclcmd_rfshape(Tcl_Interp* interp) {
 
   Tcl_CreateCommand(interp,"load_shape",tclLoadShape,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"save_shape",tclSaveShape,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"rand_shape",tclRandShape,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"free_shape",tclFreeShape,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"free_all_shapes",tclFreeAllShapes,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_len",tclShapeLen,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_index",tclShapeIndex,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"list2shape",tclList2Shape,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape2list",tclShape2List,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_join",tclShapeJoin,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_dup",tclShapeDup,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_ampl",tclShapeAmpl,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_energy",tclShapeEnergy,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_manipulate",tclShapeManipulate,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_create",tclShapeCreate,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
   Tcl_CreateCommand(interp,"shape_index_set",tclShapeIndexSet,(ClientData)NULL,(Tcl_CmdDeleteProc*)NULL);
 }
示例#10
0
void register_sound_tcl_callbacks( Tcl_Interp *ip )
{
	DPRINTF("register_sound_tcl_callbacks\n");
    Tcl_CreateCommand (ip, "tux_bind_sounds", bind_sounds_cb,  0,0);
    Tcl_CreateCommand (ip, "tux_bind_music", bind_music_cb,  0,0);
}
示例#11
0
int UUTCLEXPORT UUTCLFUNC
Uu_Init (Tcl_Interp *interp)
{
  char tmp[32];

  /*
   * Check whether we are already initialized
   */

  if (uu_AlreadyInitialized++)
    return TCL_OK;

  /*
   * Initialize decoding engine
   */

  if (UUInitialize () != UURET_OK) {
    Tcl_SetResult (interp, "Error initializing decoding engine", TCL_STATIC);
    return TCL_ERROR;
  }

  /*
   * register commands
   */

  Tcl_CreateCommand (interp, "uu_Info",          uutcl_Info, NULL, NULL);
  Tcl_CreateCommand (interp, "uu_SetMessageProc",uutcl_SetMessageProc,
		     NULL, NULL);
  Tcl_CreateCommand (interp, "uu_SetBusyProc",   uutcl_SetBusyProc,NULL,NULL);
  Tcl_CreateCommand (interp, "uu_GetProgressInfo",uutcl_GetProgressInfo,
		     NULL, NULL);
  Tcl_CreateCommand (interp, "uu_GetListOfFiles",uutcl_GetListOfFiles,
		     NULL, NULL);
  Tcl_CreateCommand (interp, "uu_LoadFile",      uutcl_LoadFile, NULL, NULL);
  Tcl_CreateCommand (interp, "uu_DecodeFile",    uutcl_DecodeFile, NULL, NULL);
  Tcl_CreateCommand (interp, "uu_GetTempFile",   uutcl_GetTempFile,NULL,NULL);
  Tcl_CreateCommand (interp, "uu_InfoFile",      uutcl_InfoFile, NULL, NULL);
  Tcl_CreateCommand (interp, "uu_ListFile",      uutcl_ListFile, NULL, NULL);
  Tcl_CreateCommand (interp, "uu_Rename",        uutcl_Rename, NULL, NULL);
  Tcl_CreateCommand (interp, "uu_CleanUp",       uutcl_CleanUp, NULL, NULL);
  Tcl_CreateCommand (interp, "uu_EncodeToFile",  uutcl_EncodeToFile,NULL,NULL);
  Tcl_CreateCommand (interp, "uu_EncodeToMail",  uutcl_EncodeToMail,NULL,NULL);
  Tcl_CreateCommand (interp, "uu_EncodeToNews",  uutcl_EncodeToNews,NULL,NULL);

  /*
   * our message-handling function and busy callback
   */

  theDMcbdata.interp       = NULL;
  theDMcbdata.tclproc[0]   = '\0';
  UUSetMsgCallback (&theDMcbdata, uutcl_DisplayMessage);

  theBusycbdata.interp     = NULL;
  theBusycbdata.tclproc[0] = '\0';
  UUSetBusyCallback (&theBusycbdata, uutcl_BusyCallback, 1000);

  /*
   * only set variables if they aren't set already
   */

  sprintf (tmp, "%d", UUGetOption (UUOPT_FAST, NULL, NULL, 0));
  if (Tcl_GetVar (interp, "OptionFast", TCL_GLOBAL_ONLY) == NULL)
    Tcl_SetVar (interp, "OptionFast", tmp, TCL_GLOBAL_ONLY);

  sprintf (tmp, "%d", UUGetOption (UUOPT_BRACKPOL, NULL, NULL, 0));
  if (Tcl_GetVar (interp, "OptionBracket", TCL_GLOBAL_ONLY) == NULL)
    Tcl_SetVar (interp, "OptionBracket", tmp, TCL_GLOBAL_ONLY);

  sprintf (tmp, "%d", UUGetOption (UUOPT_DESPERATE, NULL, NULL, 0));
  if (Tcl_GetVar (interp, "OptionDesperate", TCL_GLOBAL_ONLY) == NULL)
    Tcl_SetVar (interp, "OptionDesperate", tmp, TCL_GLOBAL_ONLY);

  sprintf (tmp, "%d", UUGetOption (UUOPT_DEBUG, NULL, NULL, 0));
  if (Tcl_GetVar (interp, "OptionDebug", TCL_GLOBAL_ONLY) == NULL)
    Tcl_SetVar (interp, "OptionDebug", tmp, TCL_GLOBAL_ONLY);

  sprintf (tmp, "%d", UUGetOption (UUOPT_USETEXT, NULL, NULL, 0));
  if (Tcl_GetVar (interp, "OptionUsetext", TCL_GLOBAL_ONLY) == NULL)
    Tcl_SetVar (interp, "OptionUsetext", tmp, TCL_GLOBAL_ONLY);

  return TCL_OK;
}
示例#12
0
int
Tcl_AppInit(Tcl_Interp *interp)
{
	Tk_Window main_window;
	const char * _tkinter_skip_tk_init;

#ifdef TK_AQUA
#ifndef MAX_PATH_LEN
#define MAX_PATH_LEN 1024
#endif
	char tclLibPath[MAX_PATH_LEN], tkLibPath[MAX_PATH_LEN];
	Tcl_Obj*	pathPtr;

        /* pre- Tcl_Init code copied from tkMacOSXAppInit.c */
	Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tcllibrary",
       	tclLibPath, MAX_PATH_LEN, 0);

	if (tclLibPath[0] != '\0') {
       	Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY);
		Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY);
		Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY);
	}
	
   	if (tclLibPath[0] != '\0') {
		Tcl_SetVar(interp, "tcl_library", tclLibPath, TCL_GLOBAL_ONLY);
		Tcl_SetVar(interp, "tclDefaultLibrary", tclLibPath, TCL_GLOBAL_ONLY);
		Tcl_SetVar(interp, "tcl_pkgPath", tclLibPath, TCL_GLOBAL_ONLY);
	}
#endif
	if (Tcl_Init (interp) == TCL_ERROR)
		return TCL_ERROR;

#ifdef TK_AQUA
        /* pre- Tk_Init code copied from tkMacOSXAppInit.c */
	Tk_MacOSXOpenBundleResources (interp, "com.tcltk.tklibrary",
            tkLibPath, MAX_PATH_LEN, 1);

	if (tclLibPath[0] != '\0') {
		pathPtr = Tcl_NewStringObj(tclLibPath, -1);
	} else {
		Tcl_Obj *pathPtr = TclGetLibraryPath();
	}

	if (tkLibPath[0] != '\0') {
		Tcl_Obj *objPtr;

		Tcl_SetVar(interp, "tk_library", tkLibPath, TCL_GLOBAL_ONLY);
		objPtr = Tcl_NewStringObj(tkLibPath, -1);
		Tcl_ListObjAppendElement(NULL, pathPtr, objPtr);
	}

	TclSetLibraryPath(pathPtr);
#endif

#ifdef WITH_XXX
		// Initialize modules that don't require Tk
#endif

	_tkinter_skip_tk_init =	Tcl_GetVar(interp, "_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
	if (_tkinter_skip_tk_init != NULL && strcmp(_tkinter_skip_tk_init, "1")	== 0) {
		return TCL_OK;
	}
	if (Tk_Init(interp) == TCL_ERROR)
		return TCL_ERROR;

	main_window = Tk_MainWindow(interp);

#ifdef TK_AQUA
	TkMacOSXInitAppleEvents(interp);
	TkMacOSXInitMenus(interp);
#endif
    
#ifdef WITH_MOREBUTTONS
	{
		extern Tcl_CmdProc studButtonCmd;
		extern Tcl_CmdProc triButtonCmd;

		Tcl_CreateCommand(interp, "studbutton", studButtonCmd,
				  (ClientData) main_window, NULL);
		Tcl_CreateCommand(interp, "tributton", triButtonCmd,
				  (ClientData) main_window, NULL);
	}
#endif

#ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */
	{
		extern void TkImaging_Init(Tcl_Interp *);
		TkImaging_Init(interp);
		/* XXX TkImaging_Init() doesn't have the right return type */
		/*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
	}
#endif

#ifdef WITH_PIL_OLD /* 0.2b4 and earlier */
	{
		extern void TkImaging_Init(void);
		/* XXX TkImaging_Init() doesn't have the right prototype */
		/*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
	}
#endif

#ifdef WITH_TIX
        {
                extern int Tix_Init(Tcl_Interp *interp);
                extern int Tix_SafeInit(Tcl_Interp *interp);
                Tcl_StaticPackage(NULL, "Tix", Tix_Init, Tix_SafeInit);
        }
#endif

#ifdef WITH_BLT
	{
		extern int Blt_Init(Tcl_Interp *);
		extern int Blt_SafeInit(Tcl_Interp *);
		Tcl_StaticPackage(NULL, "Blt", Blt_Init, Blt_SafeInit);
	}
#endif

#ifdef WITH_TOGL
	{
		/* XXX I've heard rumors that this doesn't work */
		extern int Togl_Init(Tcl_Interp *);
		/* XXX Is there no Togl_SafeInit? */
		Tcl_StaticPackage(NULL, "Togl", Togl_Init, NULL);
	}
#endif

#ifdef WITH_XXX

#endif
	return TCL_OK;
}
示例#13
0
int Savetiff_Init( Tcl_Interp *interp ) {
  Tcl_CreateCommand( interp, "savetiff", (Tcl_CmdProc *)SaveTIFF,
		     (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL );
  return TCL_OK;
}
示例#14
0
/*
 *----------------------------------------------------------------------
 *
 * Commands_Init -- Commands initialisation routine.
 *
 * Results:
 *  TCL_OK - if sucsess, or TCL_ERROR
 *
 *----------------------------------------------------------------------
 */
int
Commands_Init(Tcl_Interp *interp)
{
    Tcl_CreateCommand (interp, "pInitCamera", Init_Camera,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pStartCamera", Start_Camera,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pCloseCamera", Close_Camera,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pStopCamera", Stop_Camera,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pSetTrack", Set_Track,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pResetTrack", Reset_Track,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pSetNight", Set_Night,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pResetNight", Reset_Night,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pSetVideo", Set_Video,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pButtonPress", Button_Press,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pButtonRelease", Button_Release,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pMotion", Motion,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pSetCameraOpt", Set_CameraOpt,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    Tcl_CreateCommand (interp, "pConfigure", Configure,
        (ClientData *) NULL, (Tcl_CmdDeleteProc *) NULL);
    
    
    return TCL_OK;
}
示例#15
0
void register_key_frame_callbacks( Tcl_Interp *ip )
{
    Tcl_CreateCommand (ip, "tux_key_frame", key_frame_cb,  0,0);
}
示例#16
0
void
FogPlane::registerCallbacks( Tcl_Interp *ip )
{
    Tcl_CreateCommand (ip, "tux_fog", fog_cb,  0,0);
}
示例#17
0
/*
 * Init.
 */
int EdNames_Init(Tcl_Interp *interp) {
    Tcl_CreateCommand(interp, "ednames", NamesCmd,
		      NULL, (Tcl_CmdDeleteProc *)NULL);

    return TCL_OK;
}
示例#18
0
文件: parse.c 项目: scottg/nsdci
int
DciParseTclInit(Tcl_Interp *interp)
{
    Tcl_CreateCommand(interp, "dci.getprocs", GetProcsCmd, NULL, NULL);
    return TCL_OK;
}
示例#19
0
/********************************************************************************************
 * CreateTclCommands
 * purpose : Create all tcl commands that was written in c language.
 * input   : interp - interpreter for tcl commands
 * output  : none
 * return  : none
 ********************************************************************************************/
void CreateTclCommands(Tcl_Interp* interp)
{
    /******************
     * CALLS: Creation
     ******************/
    CREATE_COMMAND("Call.Dial", Call_Dial);
    CREATE_COMMAND("Call.Make", Call_Make);
    CREATE_COMMAND("Call.FastStartDial", Call_FastStartDial);
    CREATE_COMMAND("Call.FastStartMake", Call_FastStartMake);
    CREATE_COMMAND("Call.Accept", Call_Accept);
    CREATE_COMMAND("Call.Drop", Call_Drop);
    CREATE_COMMAND("Call.SendAlerting", Call_SendAlerting);
    CREATE_COMMAND("Call.SendCallProceeding", Call_SendCallProceeding);
    CREATE_COMMAND("Call.SendConnect", Call_SendConnect);

    /*******************
     * CALLS: Faststart
     *******************/
    CREATE_COMMAND("Call.OpenOutgoingFaststart", Call_OpenOutgoingFaststart);
    CREATE_COMMAND("Call.BuildOutgoingFaststart", Call_BuildOutgoingFaststart);
    CREATE_COMMAND("Call.ApproveFaststart", Call_ApproveFaststart);
    CREATE_COMMAND("Call.RefuseFaststart", Call_RefuseFaststart);
    CREATE_COMMAND("Call.ConnectControl", Call_ConnectControl);

    /**************
     * CALLS: Misc
     **************/
    CREATE_COMMAND("Call.SetRate", Call_SetRate);
    CREATE_COMMAND("Call.SendStatusInquiry", Call_SendStatusInquiry);
    CREATE_COMMAND("Call.SendProgress", Call_SendProgress);
    CREATE_COMMAND("Call.SendNotify", Call_SendNotify);
    CREATE_COMMAND("Call.SendUserInformation", Call_SendUserInformation);
    CREATE_COMMAND("Call.SendFacility", Call_SendFacility);
    CREATE_COMMAND("Call.SeperateControl", Call_SeperateControl);
    CREATE_COMMAND("Call.CloseControl", Call_CloseControl);
    CREATE_COMMAND("Call.SendCaps", Call_SendCaps);
    CREATE_COMMAND("Call.SendEmptyCaps", Call_SendEmptyCaps);
    CREATE_COMMAND("Call.SendCapsAck", Call_SendCapsAck);
    CREATE_COMMAND("Call.SendMSD", Call_SendMSD);
    CREATE_COMMAND("Call.CreateH245", Call_CreateH245);
    CREATE_COMMAND("Call.UII", Call_UII);
    CREATE_COMMAND("Call.LoopOff", Call_LoopOff);
    CREATE_COMMAND("Multiplex.Update", Multiplex_Update);
    CREATE_COMMAND("RAS.SendBRQ", RAS_SendBRQ);
    CREATE_COMMAND("RAS.SendNSM", RAS_SendNSM);
    CREATE_COMMAND("RAS.SendRAI", RAS_SendRAI);

    /*************************
     * CALLS: Overlap sending
     *************************/
    CREATE_COMMAND("Call.IncompleteAddress", Call_IncompleteAddress);
    CREATE_COMMAND("Call.AddressComplete", Call_AddressComplete);
    CREATE_COMMAND("Call.SendAdditionalAddr", Call_SendAdditionalAddr);

    /*********************
     * CALLS: GUI Display
     *********************/
    CREATE_COMMAND("Call.GetWindowHandle", Call_GetWindowHandle);
    CREATE_COMMAND("Call.DisplayInfo", Call_DisplayInfo);

    /***********
     * CHANNELS
     ***********/
    CREATE_COMMAND("Channel.ConnectOutgoing", Channel_ConnectOutgoing);
    CREATE_COMMAND("Channel.OpenOutgoingWindow", Channel_OpenOutgoingWindow);
    CREATE_COMMAND("Channel.DisplayChannelList", Channel_DisplayChannelList);
    CREATE_COMMAND("Channel.ResponseForOLC", Channel_ResponseForOLC);
    CREATE_COMMAND("Channel.ResponseForCLC", Channel_ResponseForCLC);
    CREATE_COMMAND("Channel.Drop", Channel_Drop);
    CREATE_COMMAND("Channel.Answer", Channel_Answer);
    CREATE_COMMAND("Channel.MediaLoop", Channel_MediaLoop);
    CREATE_COMMAND("Channel.Rate", Channel_Rate);
    
    /********
     * TOOLS
     ********/
    CREATE_COMMAND("test.Quit", test_Quit);
    CREATE_COMMAND("test.Restart", test_Restart);
    CREATE_COMMAND("test.Init", test_Init);
    CREATE_COMMAND("test.RtpSupported", test_Support);
    CREATE_COMMAND("test.SnmpSupported", test_Support);
    CREATE_COMMAND("test.SecSupported", test_Support);
    CREATE_COMMAND("test.H450Supported", test_Support);
#if 0
    CREATE_COMMAND("Log.FetchFilter", Log_FetchFilter);
    CREATE_COMMAND("Log.SetFilter", Log_SetFilter);
#endif
    CREATE_COMMAND("Options.GetLocalIP", Options_GetLocalIP);
    CREATE_COMMAND("Status.Display", Status_Display);
    CREATE_COMMAND("setIcon", setIcon);

    /******
     * H450
     ******/
    CREATE_COMMAND("H450.callTransfer", H450_callTransfer);
    CREATE_COMMAND("H450.callReroute", H450_callReroute);
    CREATE_COMMAND("H450.forwardActivate", H450_forwardActivate);
    CREATE_COMMAND("H450.forwardDeactivate", H450_forwardDeactivate);
    CREATE_COMMAND("H450.forwardInterrogate", H450_forwardInterrogate);
    CREATE_COMMAND("H450.callHold", H450_callHold);
    CREATE_COMMAND("H450.callHoldRtrv", H450_callHoldRtrv);
    CREATE_COMMAND("H450.HoldSendNonDefaultResponse", H450_HoldSendNonDefaultResponse);
    CREATE_COMMAND("H450.callWait", H450_callWait);
    CREATE_COMMAND("H450.MC.ActivateMessage", H450_MC_ActivateMessage);
    CREATE_COMMAND("H450.MC.ActivateCallBack", H450_MC_ActivateCallBack);
    CREATE_COMMAND("H450.MC.Deactivate", H450_MC_Deactivate);
    CREATE_COMMAND("H450.SU.Interogate", H450_SU_Interogate);
    CREATE_COMMAND("H450.MWISendNonDefaultResponse", H450_MWISendNonDefaultResponse);
    CREATE_COMMAND("H450.callCompletion", H450_callCompletion);
    CREATE_COMMAND("H450.callCompletionAction", H450_callCompletionAction);
    CREATE_COMMAND("H450.callOffer", H450_callOffer);
    CREATE_COMMAND("H450.remoteUserAlerting", H450_remoteUserAlerting);
    CREATE_COMMAND("H450.callIntrusion", H450_callIntrusion);
    CREATE_COMMAND("H450.getCallID", H450_getCallID);
    CREATE_COMMAND("H450.callPark", H450_callPark);
    CREATE_COMMAND("H450.callPick", H450_callPick);
    
    /**********
     * Security
     **********/

    CREATE_COMMAND("SEC.notifyModeChange", SEC_notifyModeChange);

    /************************
     * WRAPPER API FUNCTIONS
     ************************/
    Tcl_CreateCommand(interp, (char *)"script:cb", CallbackFunc, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);

    WRAPPER_COMMAND("api:cm:CallNew", api_cm_CallNew);
    WRAPPER_COMMAND("api:cm:CallDial", api_cm_CallDial);
    WRAPPER_COMMAND("api:cm:CallProceeding", api_cm_CallProceeding);
    WRAPPER_COMMAND("api:cm:CallAccept", api_cm_CallAccept);
    WRAPPER_COMMAND("api:cm:CallDrop", api_cm_CallDrop);
    WRAPPER_COMMAND("api:cm:CallAccept", api_cm_CallAccept);
    WRAPPER_COMMAND("api:cm:CallAnswer", api_cm_CallAnswer);
    WRAPPER_COMMAND("api:cm:CallClose", api_cm_CallClose);
    WRAPPER_COMMAND("api:cm:CallSetParam", api_cm_CallSetParam);
    WRAPPER_COMMAND("api:cm:CallGetParam", api_cm_CallGetParam);
    WRAPPER_COMMAND("api:cm:CallForward", api_cm_CallForward);
    WRAPPER_COMMAND("api:cm:CallStatusInquiry", api_cm_CallStatusInquiry);
    WRAPPER_COMMAND("api:cm:CallConnectControl", api_cm_CallConnectControl);
    WRAPPER_COMMAND("api:cm:FastStartBuild", api_cm_FastStartBuild);
    WRAPPER_COMMAND("api:cm:CallAddFastStartMessage", api_cm_CallAddFastStartMessage);
    WRAPPER_COMMAND("api:cm:FastStartChannelsAck", api_cm_FastStartChannelsAck);
    WRAPPER_COMMAND("api:cm:FastStartChannelsAckIndex", api_cm_FastStartChannelsAckIndex);
    WRAPPER_COMMAND("api:cm:FastStartChannelsReady", api_cm_FastStartChannelsReady);
    WRAPPER_COMMAND("api:cm:CallSendSupplementaryService", api_cm_CallSendSupplementaryService);
    WRAPPER_COMMAND("api:cm:CallSimulateMessage", api_cm_CallSimulateMessage);

    WRAPPER_COMMAND("api:cm:ChannelNew", api_cm_ChannelNew);
    WRAPPER_COMMAND("api:cm:ChannelOpen", api_cm_ChannelOpen);
    WRAPPER_COMMAND("api:cm:ChannelAnswer", api_cm_ChannelAnswer);
    WRAPPER_COMMAND("api:cm:ChannelDrop", api_cm_ChannelDrop);
    WRAPPER_COMMAND("api:cm:ChannelRequestCloseReject", api_cm_ChannelRequestCloseReject);
    WRAPPER_COMMAND("api:cm:ChannelClose", api_cm_ChannelClose);
    WRAPPER_COMMAND("api:cm:ChannelGetCallHandle", api_cm_ChannelGetCallHandle);
    WRAPPER_COMMAND("api:cm:ChannelGetDependency", api_cm_ChannelGetDependency);
    WRAPPER_COMMAND("api:cm:ChannelGetDuplexAddress", api_cm_ChannelGetDuplexAddress);
    WRAPPER_COMMAND("api:cm:ChannelGetNumber", api_cm_ChannelGetNumber);
    WRAPPER_COMMAND("api:cm:ChannelGetOrigin", api_cm_ChannelGetOrigin);
    WRAPPER_COMMAND("api:cm:ChannelGetSource", api_cm_ChannelGetSource);
    WRAPPER_COMMAND("api:cm:ChannelGetIsDuplex", api_cm_ChannelIsDuplex);
    WRAPPER_COMMAND("api:cm:H245DeleteCapabilityMessage", api_cm_H245DeleteCapabilityMessage);

    /* Automatic RAS */
    WRAPPER_COMMAND("api:cm:Register", api_cm_Register);
    WRAPPER_COMMAND("api:cm:Unregister", api_cm_Unregister);

    /* Manual RAS */
    WRAPPER_COMMAND("api:cmras:StartTransaction", api_cmras_StartTransaction);
    WRAPPER_COMMAND("api:cmras:SetParam", api_cmras_SetParam);
    WRAPPER_COMMAND("api:cmras:GetParam", api_cmras_GetParam);
    WRAPPER_COMMAND("api:cmras:GetNumOfParams", api_cmras_GetNumOfParams);
    WRAPPER_COMMAND("api:cmras:Request", api_cmras_Request);
    WRAPPER_COMMAND("api:cmras:DummyRequest", api_cmras_DummyRequest);
    WRAPPER_COMMAND("api:cmras:Confirm", api_cmras_Confirm);
    WRAPPER_COMMAND("api:cmras:Reject", api_cmras_Reject);
    WRAPPER_COMMAND("api:cmras:InProgress", api_cmras_InProgress);
    WRAPPER_COMMAND("api:cmras:Close", api_cmras_Close);
    WRAPPER_COMMAND("api:cmras:GetTransaction", api_cmras_GetTransaction);

    /* General functions */
    WRAPPER_COMMAND("api:cm:Start", api_cm_Start);
    WRAPPER_COMMAND("api:cm:Stop", api_cm_Stop);
    WRAPPER_COMMAND("api:cm:GetVersion", api_cm_GetVersion);
    WRAPPER_COMMAND("api:cm:Vt2Alias", api_cm_Vt2Alias);
    WRAPPER_COMMAND("api:cm:Alias2Vt", api_cm_Alias2Vt);
    WRAPPER_COMMAND("api:cm:GetProperty", api_cm_GetProperty);
    WRAPPER_COMMAND("api:cm:GetValTree", api_cm_GetValTree);
    WRAPPER_COMMAND("api:cm:GetRASConfigurationHandle", api_cm_GetRASConfigurationHandle);
    WRAPPER_COMMAND("api:cm:GetLocalRASAddress", api_cm_GetLocalRASAddress);
    WRAPPER_COMMAND("api:cm:GetLocalCallSignalAddress", api_cm_GetLocalCallSignalAddress);
    WRAPPER_COMMAND("api:cm:GetLocalAnnexEAddress", api_cm_GetLocalAnnexEAddress);
    WRAPPER_COMMAND("api:cm:LogMessage", api_cm_LogMessage);
    WRAPPER_COMMAND("api:cm:Encode", api_cm_Encode);
    WRAPPER_COMMAND("api:cm:Decode", api_cm_Decode);

    /* PVT functions */
    WRAPPER_COMMAND("api:pvt:AddRoot", api_pvt_AddRoot);
    WRAPPER_COMMAND("api:pvt:GetByPath", api_pvt_GetByPath);
    WRAPPER_COMMAND("api:pvt:BuildByPath", api_pvt_BuildByPath);
    WRAPPER_COMMAND("api:pvt:Delete", api_pvt_Delete);
    WRAPPER_COMMAND("api:pvt:GetString", api_pvt_GetString);
    WRAPPER_COMMAND("api:pvt:Print", api_pvt_Print);

    /* Application functions */
    WRAPPER_COMMAND("api:app:SetCallMode", api_app_SetCallMode);
    WRAPPER_COMMAND("api:app:SetChannelMode", api_app_SetChannelMode);
    WRAPPER_COMMAND("api:app:GetDataTypes", api_app_GetDataTypes);
    WRAPPER_COMMAND("api:app:LoadMessage", api_app_LoadMessage);
    WRAPPER_COMMAND("api:app:ChannelKill", api_app_ChannelKill);
    WRAPPER_COMMAND("api:app:GetChannelList", api_app_GetChannelList);
    WRAPPER_COMMAND("api:app:Vt2Address", api_app_Vt2Address);
    WRAPPER_COMMAND("api:app:Address2Vt", api_app_Address2Vt);
    WRAPPER_COMMAND("api:app:FSGetChanNum", api_app_FSGetChanNum);
    WRAPPER_COMMAND("api:app:FSGetAltChanNum", api_app_FSGetAltChanNum);
    WRAPPER_COMMAND("api:app:FSGetChanIndex", api_app_FSGetChanIndex);
    WRAPPER_COMMAND("api:app:FSGetChanName", api_app_FSGetChanName);
    WRAPPER_COMMAND("api:app:FSGetChanRTCP", api_app_FSGetChanRTCP);
    WRAPPER_COMMAND("api:app:FSGetChanRTP", api_app_FSGetChanRTP);

    /* Annexes */
    WRAPPER_COMMAND("api:app:CallCreateAnnexMMessage", api_cm_CallCreateAnnexMMessage);
    WRAPPER_COMMAND("api:app:CallSendAnnexMMessage", api_cm_CallSendAnnexMMessage);
    WRAPPER_COMMAND("api:app:CallCreateAnnexLMessage", api_cm_CallCreateAnnexLMessage);
    WRAPPER_COMMAND("api:app:CallSendAnnexLMessage", api_cm_CallSendAnnexLMessage);
}
示例#20
0
static void register_tux_callbacks( Tcl_Interp *ip )
{
    Tcl_CreateCommand (ip, "tux_root_node", root_node_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_left_shoulder",  left_shoulder_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_right_shoulder",  right_shoulder_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_left_hip",  left_hip_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_right_hip",  right_hip_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_left_knee",  left_knee_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_right_knee",  right_knee_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_left_ankle",  left_ankle_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_right_ankle",  right_ankle_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_neck",  neck_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_head", head_cb,  0,0);
    Tcl_CreateCommand (ip, "tux_tail", tail_cb,  0,0);
}
示例#21
0
文件: mpsa_Init.c 项目: xia2/trashcan
int mpsa_InitCmd(
    ClientData dummy,
    Tcl_Interp *interp,
    int argc,
    char **argv
)
{
    Tcl_CreateCommand(interp, "::mpsa::ListCreate", mpsa_CreateListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ListDelete", mpsa_DeleteListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::SimCreate", mpsa_CreateSimulationCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::SimDelete", mpsa_DeleteSimulationCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleCreate", mpsa_CreatePclCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleRegister", mpsa_RegisterNewPcltypeCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleDelete", mpsa_DeletePclCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ListAppendBasic", mpsa_AppendToListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ListClear", mpsa_ListClearCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ListAppend", mpsa_FlexibleAppendToListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticlePositionUpdate", mpsa_PclPosUpdateCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleVelocityUpdate", mpsa_PclVelUpdateCmd,
                      (ClientData) NULL, (void (*)()) NULL);

    /* non user commands -> `old-style' */

    Tcl_CreateCommand(interp, "::mpsa::ListWrite", mpsa_WritePclListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleRead", mpsa_ReadPclListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::SimulationWrite", mpsa_WriteSimulationCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::PipCheck", mpsa_CheckPipDefinedCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::SetPlatform", mpsa_SetPlatformCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::IDConversionCreate", mpsa_CreateConversionTableCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::IDConversionDelete", mpsa_DeleteConversionTableCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::IDConversionWrite",
                      mpsa_WriteConversionTableElementCmd, (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::PipNameWrite", mpsa_WritePipListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleNameWrite", mpsa_WriteParticleIDListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleDefnWrite", mpsa_WriteParticleDefinitionCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::ParticleDefnCheck", mpsa_CheckParticleDefinedCmd,
                      (ClientData) NULL, (void (*)()) NULL);

    /* `new-style' user commands */

    Tcl_CreateCommand(interp, "::mpsa::pcl", mpsa_ParticleCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::lst", mpsa_ListCmd,
                      (ClientData) NULL, (void (*)()) NULL);
    Tcl_CreateCommand(interp, "::mpsa::sim", mpsa_SimCmd,
                      (ClientData) NULL, (void (*)()) NULL);

    return TCL_OK;
}
示例#22
0
/* Erweiterung initialisieren */
int Counter_Init (Tcl_Interp *interp) {
	/* counter-Kommando erzeugen */
	Tcl_CreateCommand (interp, "counter", CounterCmd, NULL, NULL);
	return TCL_OK;
}
示例#23
0
文件: modtcl.cpp 项目: jakoch/znc
	void Start() {
		CString sMyArgs = GetArgs();

		interp = Tcl_CreateInterp();
		Tcl_Init(interp);
		Tcl_CreateCommand(interp, "Binds::ProcessPubm", tcl_Bind, this, NULL);
		Tcl_CreateCommand(interp, "Binds::ProcessTime", tcl_Bind, this, NULL);
		Tcl_CreateCommand(interp, "Binds::ProcessEvnt", tcl_Bind, this, NULL);
		Tcl_CreateCommand(interp, "Binds::ProcessNick", tcl_Bind, this, NULL);
		Tcl_CreateCommand(interp, "Binds::ProcessKick", tcl_Bind, this, NULL);
		Tcl_CreateCommand(interp, "PutIRC", tcl_PutIRC, this, NULL);
		Tcl_CreateCommand(interp, "PutModule", tcl_PutModule, this, NULL);
		Tcl_CreateCommand(interp, "PutStatus", tcl_PutStatus, this, NULL);
		Tcl_CreateCommand(interp, "PutStatusNotice", tcl_PutStatusNotice, this, NULL);
		Tcl_CreateCommand(interp, "PutUser", tcl_PutUser, this, NULL);

		Tcl_CreateCommand(interp, "GetCurNick", tcl_GetCurNick, this, NULL);
		Tcl_CreateCommand(interp, "GetUsername", tcl_GetUsername, this, NULL);
		Tcl_CreateCommand(interp, "GetRealName", tcl_GetRealName, this, NULL);
		Tcl_CreateCommand(interp, "GetVHost", tcl_GetBindHost, this, NULL);
		Tcl_CreateCommand(interp, "GetBindHost", tcl_GetBindHost, this, NULL);
		Tcl_CreateCommand(interp, "GetChans", tcl_GetChans, this, NULL);
		Tcl_CreateCommand(interp, "GetChannelUsers", tcl_GetChannelUsers, this, NULL);
		Tcl_CreateCommand(interp, "GetChannelModes", tcl_GetChannelModes, this, NULL);
		Tcl_CreateCommand(interp, "GetServer", tcl_GetServer, this, NULL);
		Tcl_CreateCommand(interp, "GetServerOnline", tcl_GetServerOnline, this, NULL);
		Tcl_CreateCommand(interp, "GetModules", tcl_GetModules, this, NULL);

		Tcl_CreateCommand(interp, "exit", tcl_exit, this, NULL);

		if (!sMyArgs.empty()) {
			i = Tcl_EvalFile(interp, sMyArgs.c_str());
			if (i != TCL_OK) {
				PutModule(Tcl_GetStringResult(interp));
			}
		}

		AddTimer(new CModTclTimer(this, 1, 0, "ModTclUpdate", "Timer for modtcl to process pending events and idle callbacks."));
	}
示例#24
0
/* Initialize internal NVIZ commands */
int init_commands(Tcl_Interp * interp, Nv_data * data)
{
    /* Disabled security version of send */
    /*  Tcl_CreateCommand(interp, "send", Tk_SendCmd,
       (ClientData) mainWindow, (void (*)()) NULL); */

    /* Scripting commands */
    Tcl_CreateCommand(interp, "Nv_set_script_file",
                      (Tcl_CmdProc *) SetScriptFile_Cmd,
                      (ClientData) mainWindow, (void (*)())NULL);
    Tcl_CreateCommand(interp, "Nv_set_script_state",
                      (Tcl_CmdProc *) SetState_Cmd, (ClientData) mainWindow,
                      (void (*)())NULL);
    Tcl_CreateCommand(interp, "Nv_close_scripting",
                      (Tcl_CmdProc *) CloseScripting_Cmd,
                      (ClientData) mainWindow, (void (*)())NULL);
    Tcl_CreateCommand(interp, "Nv_script_add_string",
                      (Tcl_CmdProc *) ScriptAddString_Cmd,
                      (ClientData) mainWindow, (void (*)())NULL);

    /* Add the cancel function command */
    Tcl_CreateCommand(interp, "Nset_cancel_func",
                      (Tcl_CmdProc *) Nset_cancel_func_cmd,
                      (ClientData) mainWindow, (void (*)())NULL);
    Tcl_CreateCommand(interp, "Nunset_cancel_func",
                      (Tcl_CmdProc *) Nunset_cancel_func_cmd,
                      (ClientData) mainWindow, (void (*)())NULL);

    /* Add the special tkwait command */
    /* REMOVED 26-Feb-2000 by Philip Warner. Replaced with an Idle handler */
    /*
     *  Tcl_CreateCommand(interp, "tkspecial_wait", Tk_Tkspecial_waitCmd,
     *                  (ClientData) mainWindow, (void (*)()) NULL);
     */

    /* Commands for handling logical names */
    Tcl_CreateCommand(interp, "Nliteral_from_logical",
                      (Tcl_CmdProc *) Nliteral_from_logical_cmd,
                      (ClientData) mainWindow, (void (*)())NULL);
    Tcl_CreateCommand(interp, "Nlogical_from_literal",
                      (Tcl_CmdProc *) Nlogical_from_literal_cmd,
                      (ClientData) mainWindow, (void (*)())NULL);

    /* Commands for generating lists of map objects */
    Tcl_CreateCommand(interp, "Nget_surf_list",
                      (Tcl_CmdProc *) Nget_surf_list_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_vect_list",
                      (Tcl_CmdProc *) Nget_vect_list_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_site_list",
                      (Tcl_CmdProc *) Nget_site_list_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_vol_list",
                      (Tcl_CmdProc *) Nget_vol_list_cmd, data, NULL);

    Tcl_CreateCommand(interp, "Nbackground",
                      (Tcl_CmdProc *) Nset_background_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nresize", (Tcl_CmdProc *) Nresize_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nchange_position",
                      (Tcl_CmdProc *) Nchange_position_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_position",
                      (Tcl_CmdProc *) Nget_position_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nchange_persp",
                      (Tcl_CmdProc *) Nchange_persp_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nchange_twist",
                      (Tcl_CmdProc *) Nchange_twist_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nchange_height",
                      (Tcl_CmdProc *) Nchange_height_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_first_exag",
                      (Tcl_CmdProc *) Nget_first_exag_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_height", (Tcl_CmdProc *) Nget_height_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nchange_exag",
                      (Tcl_CmdProc *) Nchange_exag_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ngl_finish", (Tcl_CmdProc *) Nfinish_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nlights", (Tcl_CmdProc *) Nlights_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nnew_light", (Tcl_CmdProc *) Nnew_light_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ninit_view", (Tcl_CmdProc *) Ninit_view_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nlibinit", (Tcl_CmdProc *) Nlibinit_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nhas_transparency",
                      (Tcl_CmdProc *) Nhas_transparency_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ntransp_is_set",
                      (Tcl_CmdProc *) Ntransp_is_set_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nis_masked", (Tcl_CmdProc *) Nis_masked_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_def_color",
                      (Tcl_CmdProc *) Nget_def_color_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nclear", (Tcl_CmdProc *) Nclear_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nset_cancel", (Tcl_CmdProc *) Nset_cancel_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_cancel", (Tcl_CmdProc *) Nget_cancel_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nset_draw", (Tcl_CmdProc *) Nset_draw_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nready_draw", (Tcl_CmdProc *) Nready_draw_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ndone_draw", (Tcl_CmdProc *) Ndone_draw_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nnew_map_obj",
                      (Tcl_CmdProc *) Nnew_map_obj_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_to", (Tcl_CmdProc *) Nget_to_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nget_from", (Tcl_CmdProc *) Nget_from_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nlook_here", (Tcl_CmdProc *) Nlook_here_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nhas_focus", (Tcl_CmdProc *) Nhas_focus_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_focus", (Tcl_CmdProc *) Nget_focus_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nset_focus", (Tcl_CmdProc *) Nset_focus_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nset_focus_real",
                      (Tcl_CmdProc *) Nset_focus_real_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_focus_top",
                      (Tcl_CmdProc *) Nset_focus_top_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_focus_gui",
                      (Tcl_CmdProc *) Nset_focus_gui_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_focus_gui",
                      (Tcl_CmdProc *) Nget_focus_gui_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_real_position",
                      (Tcl_CmdProc *) Nget_real_position_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_focus_map",
                      (Tcl_CmdProc *) Nset_focus_map_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_focus_state",
                      (Tcl_CmdProc *) Nset_focus_state_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nmove_to", (Tcl_CmdProc *) Nmove_to_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nmove_to_real",
                      (Tcl_CmdProc *) Nmove_to_real_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_fov", (Tcl_CmdProc *) Nset_fov_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nget_fov", (Tcl_CmdProc *) Nget_fov_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nset_twist", (Tcl_CmdProc *) Nset_twist_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_twist", (Tcl_CmdProc *) Nget_twist_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_region", (Tcl_CmdProc *) Nget_region_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_point_on_surf",
                      (Tcl_CmdProc *) Nget_point_on_surf_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_point_on_vect",
                      (Tcl_CmdProc *) Nget_point_on_surf_vect, data, NULL);
    Tcl_CreateCommand(interp, "Nget_longdim",
                      (Tcl_CmdProc *) Nget_longdim_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_zrange", (Tcl_CmdProc *) Nget_zrange_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_zextents",
                      (Tcl_CmdProc *) Nget_zextents_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_exag", (Tcl_CmdProc *) Nget_exag_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nset_exag", (Tcl_CmdProc *) Nset_exag_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nquick_draw", (Tcl_CmdProc *) Nquick_draw_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nauto_draw", (Tcl_CmdProc *) Nauto_draw_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_all",
                      (Tcl_CmdProc *) Ndraw_all_together_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nsurf_draw_all",
                      (Tcl_CmdProc *) Nsurf_draw_all_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nsurf_draw_one",
                      (Tcl_CmdProc *) Nsurf_draw_one_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nvect_draw_all",
                      (Tcl_CmdProc *) Nvect_draw_all_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nvect_draw_one",
                      (Tcl_CmdProc *) Nvect_draw_one_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nsite_draw_all",
                      (Tcl_CmdProc *) Nsite_draw_all_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nsite_draw_one",
                      (Tcl_CmdProc *) Nsite_draw_one_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nvol_draw_all",
                      (Tcl_CmdProc *) Nvol_draw_all_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nvol_draw_one",
                      (Tcl_CmdProc *) Nvol_draw_one_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_line_on_surf",
                      (Tcl_CmdProc *) Ndraw_line_on_surf_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_model", (Tcl_CmdProc *) Ndraw_model_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_wire", (Tcl_CmdProc *) Ndraw_wire_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_X", (Tcl_CmdProc *) Ndraw_X_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Nset_Narrow", (Tcl_CmdProc *) Nset_Narrow_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_Narrow",
                      (Tcl_CmdProc *) Ndraw_Narrow_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_ScaleBar", (Tcl_CmdProc *) Nset_Narrow_cmd, data, NULL);	/* reuse Narrow as it's the same */
    Tcl_CreateCommand(interp, "Ndraw_ScaleBar",
                      (Tcl_CmdProc *) Ndraw_ScaleBar_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_legend",
                      (Tcl_CmdProc *) Ndraw_legend_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ndraw_fringe",
                      (Tcl_CmdProc *) Ndraw_fringe_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_viewport",
                      (Tcl_CmdProc *) Nset_viewport_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ndelete_list",
                      (Tcl_CmdProc *) Ndelete_list_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Ndone_draw", (Tcl_CmdProc *) Ndone_draw_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nready_draw", (Tcl_CmdProc *) Nready_draw_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nget_dist_along_surf",
                      (Tcl_CmdProc *) Nget_dist_along_surf_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_cat_at_xy",
                      (Tcl_CmdProc *) Nget_cat_at_xy_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_val_at_xy",
                      (Tcl_CmdProc *) Nget_val_at_xy_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_light_to_view",
                      (Tcl_CmdProc *) Nset_light_to_view_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_SDsurf", (Tcl_CmdProc *) Nset_SDsurf_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nunset_SDsurf",
                      (Tcl_CmdProc *) Nunset_SDsurf_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_SDscale",
                      (Tcl_CmdProc *) Nset_SDscale_cmd, data, NULL);

    /* Keyframe Animation */
    Tcl_CreateCommand(interp, "Nset_interp_mode",
                      (Tcl_CmdProc *) Nset_interp_mode_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_tension",
                      (Tcl_CmdProc *) Nset_tension_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nshowtension_start",
                      (Tcl_CmdProc *) Nshowtension_start_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nupdate_tension",
                      (Tcl_CmdProc *) Nupdate_tension_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nshowtension_stop",
                      (Tcl_CmdProc *) Nshowtension_stop_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nupdate_frames",
                      (Tcl_CmdProc *) Nupdate_frames_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_numsteps",
                      (Tcl_CmdProc *) Nset_numsteps_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nclear_keys", (Tcl_CmdProc *) Nclear_keys_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nadd_key", (Tcl_CmdProc *) Nadd_key_cmd, data,
                      NULL);
    Tcl_CreateCommand(interp, "Ndo_framestep",
                      (Tcl_CmdProc *) Ndo_framestep_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nshow_path", (Tcl_CmdProc *) Nshow_path_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nshow_site", (Tcl_CmdProc *) Nshow_site_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nshow_vect", (Tcl_CmdProc *) Nshow_vect_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nshow_vol", (Tcl_CmdProc *) Nshow_vol_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nshow_lab", (Tcl_CmdProc *) Nshow_lab_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ndelete_key", (Tcl_CmdProc *) Ndelete_key_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nmove_key", (Tcl_CmdProc *) Nmove_key_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nprint_keys", (Tcl_CmdProc *) Nprint_keys_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nwrite_ppm", (Tcl_CmdProc *) Nwrite_ppm_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nwrite_tif", (Tcl_CmdProc *) Nwrite_tif_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Ninit_mpeg", (Tcl_CmdProc *) Ninit_mpeg_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nwrite_mpeg_frame",
                      (Tcl_CmdProc *) Nwrite_mpeg_frame_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nclose_mpeg", (Tcl_CmdProc *) Nclose_mpeg_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Nstart_zoom", (Tcl_CmdProc *) Nstart_zoom_cmd,
                      data, NULL);
    Tcl_CreateCommand(interp, "Noff_screen", (Tcl_CmdProc *) Noff_screen_cmd,
                      data, NULL);

    /* Cutplane Junk */
    Tcl_CreateCommand(interp, "Ncutplane_obj",
                      (Tcl_CmdProc *) Ncutplane_obj_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nnew_cutplane_obj",
                      (Tcl_CmdProc *) Nnew_cutplane_obj_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nnum_cutplane_obj",
                      (Tcl_CmdProc *) Nnum_cutplane_obj_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_current_cutplane",
                      (Tcl_CmdProc *) Nset_current_cutplane_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_current_cutplane",
                      (Tcl_CmdProc *) Nget_current_cutplane_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_cutplane_list",
                      (Tcl_CmdProc *) Nget_cutplane_list_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nset_fence_color",
                      (Tcl_CmdProc *) Nset_fence_color_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_fence_color",
                      (Tcl_CmdProc *) Nget_fence_color_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nget_xyrange",
                      (Tcl_CmdProc *) Nget_xyrange_cmd, data, NULL);

    /* Miscellanious */
    Tcl_CreateCommand(interp, "Nsave_3dview",
                      (Tcl_CmdProc *) Nsave_3dview_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nload_3dview",
                      (Tcl_CmdProc *) Nload_3dview_cmd, data, NULL);
    Tcl_CreateCommand(interp, "Nplace_label",
                      (Tcl_CmdProc *) Nplace_label_cmd, data, NULL);

    return (TCL_OK);
}
示例#25
0
文件: fb_obj.c 项目: cciechad/brlcad
/*
 * Open/create a framebuffer object.
 *
 * Usage:
 *	  fb_open [name device [args]]
 */
HIDDEN int
fbo_open_tcl(ClientData clientData, Tcl_Interp *interp, int argc, char **argv)
{
    struct fb_obj *fbop;
    FBIO *ifp;
    int width = 512;
    int height = 512;
    register int c;
    struct bu_vls vls;

    if (argc == 1) {
	/* get list of framebuffer objects */
	for (BU_LIST_FOR(fbop, fb_obj, &HeadFBObj.l))
	    Tcl_AppendResult(interp, bu_vls_addr(&fbop->fbo_name), " ", (char *)NULL);

	return TCL_OK;
    }

    if (argc < 3) {
	bu_vls_init(&vls);
	bu_vls_printf(&vls, "helplib fb_open");
	Tcl_Eval(interp, bu_vls_addr(&vls));
	bu_vls_free(&vls);
	return TCL_ERROR;
    }

    /* process args */
    bu_optind = 3;
    bu_opterr = 0;
    while ((c = bu_getopt(argc, argv, "w:W:s:S:n:N:")) != EOF)  {
	switch (c) {
	    case 'W':
	    case 'w':
		width = atoi(bu_optarg);
		break;
	    case 'N':
	    case 'n':
		height = atoi(bu_optarg);
		break;
	    case 'S':
	    case 's':
		width = atoi(bu_optarg);
		height = width;
		break;
	    case '?':
	    default:
		Tcl_AppendResult(interp, "fb_open: bad option - ",
				 bu_optarg, (char *)NULL);
		return TCL_ERROR;
	}
    }

    if ((ifp = fb_open(argv[2], width, height)) == FBIO_NULL) {
	Tcl_AppendResult(interp, "fb_open: bad device - ",
			 argv[2], (char *)NULL);
    }

    if (fb_ioinit(ifp) != 0) {
	Tcl_AppendResult(interp, "fb_open: fb_ioinit() failed.", (char *) NULL);
	return TCL_ERROR;
    }

    BU_GETSTRUCT(fbop, fb_obj);
    bu_vls_init(&fbop->fbo_name);
    bu_vls_strcpy(&fbop->fbo_name, argv[1]);
    fbop->fbo_fbs.fbs_fbp = ifp;
    fbop->fbo_fbs.fbs_listener.fbsl_fbsp = &fbop->fbo_fbs;
    fbop->fbo_fbs.fbs_listener.fbsl_fd = -1;
    fbop->fbo_fbs.fbs_listener.fbsl_port = -1;

    /* append to list of fb_obj's */
    BU_LIST_APPEND(&HeadFBObj.l, &fbop->l);

    (void)Tcl_CreateCommand(interp,
			    bu_vls_addr(&fbop->fbo_name),
			    (Tcl_CmdProc *)fbo_cmd,
			    (ClientData)fbop,
			    fbo_deleteProc);

    /* Return new function name as result */
    Tcl_ResetResult(interp);
    Tcl_AppendResult(interp, bu_vls_addr(&fbop->fbo_name), (char *)NULL);
    return TCL_OK;
}
示例#26
0
int InitializeModuleCommands( Tcl_Interp* interp)
{

#if WITH_DEBUGGING_INIT
    ErrorLogger( NO_ERR_START, LOC, _proc_InitializeModuleCommands, NULL);
#endif

    /**
     **  General initialization of the Tcl interpreter
     **/
    if( Tcl_Init( interp) == TCL_ERROR)
	if( OK != ErrorLogger( ERR_INIT_TCL, LOC, NULL))
	    goto unwind0;

#ifdef  HAS_TCLXLIBS

    /**
     **  Extended Tcl initialization if configured so ...
     **/

#if (TCL_MAJOR_VERSION > 8 || TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION > 3)
    if( Tclx_Init( interp) == TCL_ERROR)
#elif (TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION > 5)
    if( Tclxcmd_Init( interp) == TCL_ERROR)
#else
    if( TclXCmd_Init( interp) == TCL_ERROR)
#endif
    {
	if( OK != ErrorLogger( ERR_INIT_TCLX, LOC, NULL))
	    goto unwind0;
    }

#endif  /* HAS_TCLXLIBS */

#ifdef	AUTOLOADPATH

    /**
     ** Extend autoload path
     **/
    if( TCL_OK != Tcl_Eval( interp,
	"if [info exists auto_path] { "
		"set auto_path [linsert $auto_path 0 " AUTOLOADPATH
	"]} else {"
		"set auto_path \"" AUTOLOADPATH "\" }"))
	if( OK != ErrorLogger( ERR_INIT_ALPATH, LOC, NULL))
	    goto unwind0;

#endif	/* AUTOLOADPATH */

    /**
     **   Now for each module command a callback routine has to be specified
     **/
    Tcl_CreateCommand( interp, "exit", Module_Tcl_ExitCmd,
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "setenv", cmdSetEnv, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "unsetenv", cmdUnsetEnv, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
  
    Tcl_CreateCommand( interp, "prepend-path", cmdSetPath, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "append-path", cmdSetPath, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "remove-path", cmdRemovePath, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "module-info", cmdModuleInfo, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "module", cmdModule, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "module-whatis", cmdModuleWhatis, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "module-verbosity", cmdModuleVerbose, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "module-user", cmdModuleUser, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "module-log", cmdModuleLog, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "module-trace", cmdModuleTrace, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "module-alias", cmdModuleAlias, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "module-version", cmdModuleVersion, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "module-set", cmdModuleSet, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
  
    Tcl_CreateCommand( interp, "set-alias", cmdSetAlias, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "unset-alias", cmdSetAlias, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "conflict", cmdConflict, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "prereq", cmdPrereq, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "is-loaded", cmdIsLoaded, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "chdir", cmdChDir,
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "system", cmdSystem, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);
    Tcl_CreateCommand( interp, "uname", cmdUname, 
		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    Tcl_CreateCommand( interp, "x-resource", cmdXResource,
 		       (ClientData) shell_derelict,(void (*)(ClientData)) NULL);

    return( TCL_OK);			/** -------- EXIT (SUCCESS) -------> **/

unwind0:
    return( TCL_ERROR);			/** -------- EXIT (FAILURE) -------> **/

} /** End of 'InitializeModuleCommands' **/
示例#27
0
void register_game_config_callbacks( Tcl_Interp *ip )
{
    Tcl_CreateCommand (ip, "tux_get_param", get_param_cb,   0,0);
    Tcl_CreateCommand (ip, "tux_set_param", set_param_cb,   0,0);
}
示例#28
0
int
Tcl_AppInit(Tcl_Interp *interp)
{
   char *lib, buf[1025];

    /*
     * Redefine TCL_LIBRARY and TK_LIBRARY to the staden package versions
     * in $STADLIB/{tcl,tk}.
     */
#ifndef _WIN32 /* 11/1/98 johnt - not required for WIN32 */
    if (NULL != (lib = getenv("STADLIB"))) {
        sprintf(buf, "TCL_LIBRARY=%s/tcl", lib);
        Tcl_PutEnv(buf);
        sprintf(buf, "TK_LIBRARY=%s/tk", lib);
        Tcl_PutEnv(buf);
    }
#endif

#ifdef TRAP_SIGNALS
    /*
     * Use the BSD signal() command to trap probable program crashes.
     * This then adds a debug message to make sure that we tell people
     * to email us.
     */
#if defined(SIGBUS) /* 11/1/99 johnt - SIGBUS not defined under WINNT */
    signal(SIGBUS,  error_sig);
#endif
    signal(SIGSEGV, error_sig);
    signal(SIGILL,  error_sig);
    signal(SIGFPE,  error_sig);
#if defined(SIGSYS)
    signal(SIGSYS,  error_sig);
#endif /* SIGSYS */
#endif /* TRAP_SIGNALS */

    if (Tcl_Init(interp) == TCL_ERROR) {
	WishPanic(interp->result);
	return TCL_ERROR;
    }

#ifdef _WIN32

    if( needConsole ){
	/* running in Windows mode, so initialise TK, and Init console */
	if (Tk_Init(interp) == TCL_ERROR) {
	    WishPanic(interp->result);
	    return TCL_ERROR;
	}
	Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);

        if (TkConsoleInit(interp) == TCL_ERROR) {
	    WishPanic(interp->result);
	    return TCL_ERROR;
	}
    }

    /* modified Windows Save Dialog, to set save type, based on user selection and file extension */
    Tcl_CreateCommand(interp,"sp_getSaveFile",Tk_CustomGetSaveFileCmd,(ClientData)NULL,NULL);
    /* modified Windows Open Dialog, to allow multiple file opens */
    Tcl_CreateCommand(interp,"sp_getOpenFile",Tk_CustomGetOpenFileCmd,(ClientData)NULL,NULL);

#endif


    /*
    Tcl_CreateCommand(interp, "tkinit", tkinit,
		      (ClientData)NULL, NULL);
    */

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

    /* Library init routines */
    if (Tk_utils_Init(interp) == TCL_ERROR) {
	WishPanic(interp->result);
	return TCL_ERROR;
    }

    /*
     * 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", "~/.stashrc", TCL_GLOBAL_ONLY);
    return TCL_OK;
}
示例#29
0
/* Initialisation, based on tkMain.c */
value camltk_opentk(value argv) /* ML */
{
  /* argv must contain argv[0], the application command name */
  value tmp = Val_unit;
  char *argv0;

  Begin_root(tmp);

  if ( argv == Val_int(0) ){
    failwith("camltk_opentk: argv is empty");
  }
  argv0 = String_val( Field( argv, 0 ) );

  if (!cltk_slave_mode) {
    /* Create an interpreter, dies if error */
#if TCL_MAJOR_VERSION >= 8
    Tcl_FindExecutable(String_val(argv0));
#endif
    cltclinterp = Tcl_CreateInterp();

    if (Tcl_Init(cltclinterp) != TCL_OK)
      tk_error(cltclinterp->result);
    Tcl_SetVar(cltclinterp, "argv0", String_val (argv0), TCL_GLOBAL_ONLY);

    { /* Sets argv if needed */
      int argc = 0;

      tmp = Field(argv, 1); /* starts from argv[1] */
      while ( tmp != Val_int(0) ) {
	argc++;
	tmp = Field(tmp, 1);
      }

      if( argc != 0 ){
	int i;
	char *args;
	char **tkargv;
	char argcstr[256];

	tkargv = malloc( sizeof( char* ) * argc );

	tmp = Field(argv, 1); /* starts from argv[1] */
	i = 0;
	while ( tmp != Val_int(0) ) {
	  tkargv[i] = String_val(Field(tmp, 0));
	  tmp = Field(tmp, 1);
	  i++;
	}
	
	sprintf( argcstr, "%d", argc );

        Tcl_SetVar(cltclinterp, "argc", argcstr, TCL_GLOBAL_ONLY);
        args = Tcl_Merge(argc, tkargv); /* args must be freed by Tcl_Free */
        Tcl_SetVar(cltclinterp, "argv", args, TCL_GLOBAL_ONLY);
        Tcl_Free(args);
	free( tkargv );
      }
    }
    if (Tk_Init(cltclinterp) != TCL_OK)
      tk_error(cltclinterp->result);

    /* Retrieve the main window */
    cltk_mainWindow = Tk_MainWindow(cltclinterp);

    if (NULL == cltk_mainWindow)
      tk_error(cltclinterp->result);
  
    Tk_GeometryRequest(cltk_mainWindow,200,200);
  }

  /* Create the camlcallback command */
  Tcl_CreateCommand(cltclinterp,
                    CAMLCB, CamlCBCmd, 
                    (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);

  /* This is required by "unknown" and thus autoload */
  Tcl_SetVar(cltclinterp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
  /* Our hack for implementing break in callbacks */
  Tcl_SetVar(cltclinterp, "BreakBindingsSequence", "0", TCL_GLOBAL_ONLY);

  /* Load the traditional rc file */
  {
    char *home = getenv("HOME");
    if (home != NULL) {
      char *f = stat_alloc(strlen(home)+strlen(RCNAME)+2);
      f[0]='\0';
      strcat(f, home);
      strcat(f, "/");
      strcat(f, RCNAME);
      if (0 == access(f,R_OK)) 
        if (TCL_OK != Tcl_EvalFile(cltclinterp,f)) {
          stat_free(f);
          tk_error(cltclinterp->result);
        };
      stat_free(f);
    }
  }

  End_roots();
  return Val_unit;
}
示例#30
0
void setup_message_commands(Tcl_Interp *interp, filter_context_t *context)
{
    Tcl_CreateCommand(interp, "msg", cmd_msg, context, NULL);
    Tcl_CreateCommand(interp, "tag", cmd_tag_message, context, NULL);
    Tcl_CreateCommand(interp, "move", cmd_move_message, context, NULL);
}