Exemplo n.º 1
0
int
TnmInit(Tcl_Interp *interp, int safe)
{

#ifdef USE_TCL_STUBS
    if (Tcl_InitStubs(interp, "8.4", 0) == NULL) {
	return TCL_ERROR;
    }
#endif
    
    if (Tcl_PkgRequire(interp, "Tcl", TCL_VERSION, 0) == NULL) {
        return TCL_ERROR;
    }

    if (Tcl_PkgProvide(interp, "Tnm", TNM_VERSION) != TCL_OK) {
        return TCL_ERROR;
    }

    Tcl_RegisterObjType(&tnmUnsigned64Type);
    Tcl_RegisterObjType(&tnmUnsigned32Type);
    Tcl_RegisterObjType(&tnmOctetStringType);
    Tcl_RegisterObjType(&tnmIpAddressType);

    InitVars(interp);
    TnmInitDns(interp);
    if (InitCmds(interp, safe) != TCL_OK) {
	return TCL_ERROR;
    }
    if (TnmSmxInit(interp) != TCL_OK) {
	return TCL_ERROR;
    }

    return SourceInitFiles(interp);
}
Exemplo n.º 2
0
Arquivo: chantest.c Projeto: aosm/tcl
EXTERN int
Chantest_Init(Tcl_Interp *interp)
{
    int r = TCL_OK;
    const char *tcl = NULL;
    const char *memchan = NULL;

#ifdef USE_TCL_STUBS
    tcl = Tcl_InitStubs(interp, "8.4", 0);
#endif

#ifdef USE_MEMCHAN_STUBS
    memchan = Memchan_InitStubs(interp, "2.2", 0);
#endif

    if (tcl == NULL || memchan == NULL) {
        Tcl_SetResult(interp, "error loading memchan via stubs", TCL_STATIC);
        r = TCL_ERROR;
    } else {
        Tcl_CreateObjCommand(interp, "chantest", TestObjCmd, 
                             (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
        r = Tcl_PkgProvide(interp, "Chantest", "0.1");
    }
    return r;
}
Exemplo n.º 3
0
/*
 * Tclduktape_Init -- Called when Tcl loads the extension.
 */
int DLLEXPORT
Tclduktape_Init(Tcl_Interp *interp)
{
    Tcl_Namespace *nsPtr;
    struct DuktapeData *duktape_data;

#ifdef USE_TCL_STUBS
    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
        return TCL_ERROR;
    }
#endif

    duktape_data = (struct DuktapeData *) ckalloc(sizeof(struct DuktapeData));

    /* Create the namespace. */
    if (Tcl_FindNamespace(interp, NS, NULL, 0) == NULL) {
        nsPtr = Tcl_CreateNamespace(interp, NS, NULL, NULL);
        if (nsPtr == NULL) {
            return TCL_ERROR;
        }
    }

    duktape_data->counter = 0;
    Tcl_InitHashTable(&duktape_data->table, TCL_STRING_KEYS);

    Tcl_CreateObjCommand(interp, NS INIT, Init_Cmd, duktape_data, NULL);
    Tcl_CreateObjCommand(interp, NS CLOSE, Close_Cmd, duktape_data, NULL);
    Tcl_CreateObjCommand(interp, NS EVAL, Eval_Cmd, duktape_data, NULL);
    Tcl_CreateObjCommand(interp, NS CALL_METHOD,
            CallMethod_Cmd, duktape_data, NULL);
    Tcl_CallWhenDeleted(interp, cleanup_interp, duktape_data);
    Tcl_PkgProvide(interp, PACKAGE, VERSION);

    return TCL_OK;
}
Exemplo n.º 4
0
Arquivo: tcl.c Projeto: kanzure/brlcad
int
Dm_Init(void *interpreter)
{
    Tcl_Interp *interp = (Tcl_Interp *)interpreter;

    static struct bu_cmdtab cmdtab[] = {
	{"dm_validXType", dm_validXType_tcl},
	{"dm_bestXType", dm_bestXType_tcl},
	{(const char *)NULL, BU_CMD_NULL}
    };

    struct bu_vls vls = BU_VLS_INIT_ZERO;

    /* register commands */
    register_cmds(interp, cmdtab);

    bu_vls_strcpy(&vls, "vectorThreshold");
    Tcl_LinkVar(interp, bu_vls_addr(&vls), (char *)&vectorThreshold,
		TCL_LINK_INT);
    bu_vls_free(&vls);

    /* initialize display manager object code */
    Dmo_Init(interp);

    Tcl_PkgProvide(interp,  "Dm", brlcad_version());

    return TCL_OK;
}
Exemplo n.º 5
0
EXTERN int
Pkgua_Init(
    Tcl_Interp *interp)		/* Interpreter in which the package is to be
				 * made available. */
{
    int code, cmdIndex = 0;
    Tcl_Command *cmdTokens;

    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
	return TCL_ERROR;
    }

    /*
     * Initialise our Hash table, where we store the registered command tokens
     * for each interpreter.
     */

    PkguaInitTokensHashTable();

    code = Tcl_PkgProvide(interp, "Pkgua", "1.0");
    if (code != TCL_OK) {
	return code;
    }

    Tcl_SetVar(interp, "::pkgua_loaded", ".", TCL_APPEND_VALUE);

    cmdTokens = PkguaInterpToTokens(interp);
    cmdTokens[cmdIndex++] =
	    Tcl_CreateObjCommand(interp, "pkgua_eq", PkguaEqObjCmd, NULL,
		    NULL);
    cmdTokens[cmdIndex++] =
	    Tcl_CreateObjCommand(interp, "pkgua_quote", PkguaQuoteObjCmd,
		    NULL, NULL);
    return TCL_OK;
}
Exemplo n.º 6
0
int
Registry_Init(
    Tcl_Interp *interp)
{
    Tcl_CreateObjCommand(interp, "registry", RegistryObjCmd, NULL, NULL);
    return Tcl_PkgProvide(interp, "registry", "1.0");
}
Exemplo n.º 7
0
MODULE_SCOPE
void TtkElements_Init(Tcl_Interp *interp)
{
    Ttk_Theme theme =  Ttk_GetDefaultTheme(interp);

    /*
     * Elements:
     */
    Ttk_RegisterElement(interp, theme, "background",
	    &BackgroundElementSpec,NULL);

    Ttk_RegisterElement(interp, theme, "fill", &FillElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "padding", &PaddingElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "Checkbutton.indicator",
	    &CheckbuttonIndicatorElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "Radiobutton.indicator",
	    &RadiobuttonIndicatorElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "Menubutton.indicator",
	    &MenuIndicatorElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "indicator", &ttkNullElementSpec,NULL);

    Ttk_RegisterElement(interp, theme, "uparrow",
	    &ArrowElementSpec, &ArrowElements[0]);
    Ttk_RegisterElement(interp, theme, "downarrow",
	    &ArrowElementSpec, &ArrowElements[1]);
    Ttk_RegisterElement(interp, theme, "leftarrow",
	    &ArrowElementSpec, &ArrowElements[2]);
    Ttk_RegisterElement(interp, theme, "rightarrow",
	    &ArrowElementSpec, &ArrowElements[3]);
    Ttk_RegisterElement(interp, theme, "arrow",
	    &ArrowElementSpec, &ArrowElements[0]);

    Ttk_RegisterElement(interp, theme, "trough", &TroughElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "thumb", &ThumbElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "separator",
	    &SeparatorElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "hseparator",
	    &HorizontalSeparatorElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "vseparator",
	    &VerticalSeparatorElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "sizegrip", &SizegripElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "tab", &TabElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "client", &ClientElementSpec, NULL);

    /*
     * Register "default" as a user-loadable theme (for now):
     */
    Tcl_PkgProvide(interp, "ttk::theme::default", TTK_VERSION);
}
Exemplo n.º 8
0
/** \brief initialize the tclmsgque package
 *
 * The tclmsgque package is created and one new command "msgque"
 * is added to the Tcl interpreter.
 * \param[in] interp the current interpreter
 * \return Tcl error-code
 */
TCLMQ_EXTERN int
Tclmsgque_Init (
  Tcl_Interp * interp
)
{
  // check for the reight tcl
  if (Tcl_InitStubs (interp, "8.5", 0) == NULL) {
    return TCL_ERROR;
  }

  // announce my package
  TclErrorCheck (Tcl_PkgProvide (interp, "TclMsgque", LIBMSGQUE_VERSION));

  // provide "msgque" as only public cammand of the package
  Tcl_CreateObjCommand (interp, "tclmsgque", NS(MsgqueCmd), (ClientData) NULL,
                        (Tcl_CmdDeleteProc *) NULL);

  // init libmsgque global data
  if (MqInitGet() == NULL && Tcl_GetNameOfExecutable() != NULL) {
    struct MqBufferLS * initB = MqInitCreate();

    if (Tcl_Eval(interp, "info script") == TCL_ERROR)
      return TCL_ERROR;

    MqBufferLAppendC(initB, Tcl_GetNameOfExecutable());
    MqBufferLAppendC(initB, Tcl_GetStringResult(interp));
  }

  // create the default-factory
  if (!strcmp(MqFactoryDefaultIdent(),"libmsgque")) {
    MqFactoryDefault("tclmsgque", NS(FactoryCreate), NULL, NULL, NS(FactoryDelete), NULL, NULL);
  }

  return TCL_OK;
}
Exemplo n.º 9
0
int Fftcmds_Init(Tcl_Interp *interp)   

#endif
{
  Tcl_CreateObjCommand(interp,"r2cfft_1d",tcl_rfft_1d,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"c2rfft_1d",tcl_rfft_1d,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftf_1d",tcl_cfft_1d,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftb_1d",tcl_cfft_1d,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftf_2d",tcl_cfft_nd,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftb_2d",tcl_cfft_nd,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftf_3d",tcl_cfft_nd,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftb_3d",tcl_cfft_nd,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftf_4d",tcl_cfft_nd,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"cfftb_4d",tcl_cfft_nd,
        (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);

  Tcl_PkgProvide(interp, "fftcmds", "1.1");

  check_thread_count(interp,"fftcmds");

  return TCL_OK;
}
Exemplo n.º 10
0
/*******************************************************************************
 * dhstcl_Init ( ... )
 *******************************************************************************/
int Dhstcl_Init ( Tcl_Interp *interp ) {
 /* declare local scope variable and initialize them */
 int nc=0;
 /* initialize static variables */
 (void) memset(response,'\0',MAXMSG);
 (void) memset(result,'\0',DHS_RESULT_LEN);
 /* write banner */
 nc = sprintf(result,"\nDHS Package v%s by %s.\n%s\nThis release: %s\n",_dhsTcl_S_,_dhsTcl_A_,_dhsTcl_C_,_dhsTcl_D_);
 (void) Tcl_SetResult(interp,result,TCL_STATIC);
 /* make the wrapper(s) available to Tcl/tk */
 if ( Tcl_InitStubs(interp,TCL_STUB_VERSION,0) == (char *)NULL ) return TCL_ERROR;
 Tcl_CreateCommand(interp,"dhs::help",        (Tcl_CmdProc *)dhsHelpTcl,        (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::version",     (Tcl_CmdProc *)dhsVersionTcl,     (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::SysOpen",     (Tcl_CmdProc *)dhsSysOpenTcl,     (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::SysClose",    (Tcl_CmdProc *)dhsSysCloseTcl,    (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::OpenConnect", (Tcl_CmdProc *)dhsOpenConnectTcl, (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::CloseConnect",(Tcl_CmdProc *)dhsCloseConnectTcl,(ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::OpenExp",     (Tcl_CmdProc *)dhsOpenExpTcl,     (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::CloseExp",    (Tcl_CmdProc *)dhsCloseExpTcl,    (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::IOctl",       (Tcl_CmdProc *)dhsIOctlTcl,       (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::ReadImage",   (Tcl_CmdProc *)dhsReadImageTcl,   (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::PixelData",   (Tcl_CmdProc *)dhsPixelDataTcl,   (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 Tcl_CreateCommand(interp,"dhs::MetaData",    (Tcl_CmdProc *)dhsMetaDataTcl,    (ClientData)NULL,(Tcl_CmdDeleteProc *)NULL);
 /* provide the package */
 return Tcl_PkgProvide(interp,"dhs",_dhsTcl_S_);
}
Exemplo n.º 11
0
int Sqlite_vtable_Init(Tcl_Interp *interp)
{
    VTableInterpContext *vticP;

#ifdef USE_TCL_STUBS
    Tcl_InitStubs(interp, "8.5", 0);
#endif

    /*
     * Initialize the cache of Tcl type pointers (used when converting
     * to sqlite types). It's OK if any of these return NULL.
     */
    gTclBooleanTypeP = Tcl_GetObjType("boolean");
    gTclBooleanStringTypeP = Tcl_GetObjType("booleanString");
    gTclByteArrayTypeP = Tcl_GetObjType("bytearray");
    gTclDoubleTypeP = Tcl_GetObjType("double");
    gTclWideIntTypeP = Tcl_GetObjType("wideInt");
    gTclIntTypeP = Tcl_GetObjType("int");


    vticP = VTICNew(interp);
    VTICRef(vticP, 1); // VTIC is passed to interpreter commands as ClientData

    Tcl_CreateObjCommand(interp, PACKAGE_NAME "::attach_connection",
                         AttachConnectionObjCmd, vticP, 0);

    Tcl_CallWhenDeleted(interp, DetachFromInterp, vticP);


    Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION);
    return TCL_OK;
}
Exemplo n.º 12
0
EXTERN int Pmepot_Init(Tcl_Interp *interp) {

#else

int Pmepot_Init(Tcl_Interp *interp) {

#endif

  int *countptr;
  countptr = (int *)malloc(sizeof(int));
  Tcl_SetAssocData(interp, "Pmepot_count", count_delete_proc, 
				(ClientData)countptr);
  *countptr = 0;

  Tcl_CreateObjCommand(interp,"pmepot_create",tcl_pmepot_create,
	(ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"pmepot_add",tcl_pmepot_add,
	(ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"pmepot_writedx",tcl_pmepot_writedx,
	(ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
  Tcl_CreateObjCommand(interp,"pmepot_destroy",tcl_pmepot_destroy,
	(ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
 
  Tcl_PkgProvide(interp, "pmepot_core", "1.0.0");

  return TCL_OK;
}
Exemplo n.º 13
0
int Funtools_Init (void *vinterp)
{
  Tcl_Interp *interp = (Tcl_Interp *)vinterp;

  Tcl_CreateObjCommand(interp, "funcen", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "funcnts", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "fundisp", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "funhead", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "funhist", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "funimage", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "funmerge", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "funtable", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
  Tcl_CreateObjCommand(interp, "funcalc", MainLib_Tcl,
    (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);

  Tcl_PkgProvide(interp, "funtools", "1.0");
  return(TCL_OK);
}
Exemplo n.º 14
0
DLLEXPORT int Rechan_Init(Tcl_Interp* interp)
{
  if (!Tcl_InitStubs(interp, "8.4", 0))
    return TCL_ERROR;
  Tcl_CreateObjCommand(interp, "rechan", cmd_rechan, 0, 0);
  return Tcl_PkgProvide(interp, "rechan", "1.0");
}
Exemplo n.º 15
0
TTK_END_LAYOUT_TABLE

/*------------------------------------------------------------------------
 * +++ Initialization.
 */

MODULE_SCOPE int
TtkClamTheme_Init(Tcl_Interp *interp)
{
    Ttk_Theme theme = Ttk_CreateTheme(interp, "clam", 0);

    if (!theme) {
        return TCL_ERROR;
    }

    Ttk_RegisterElement(interp,
	theme, "border", &BorderElementSpec, NULL);
    Ttk_RegisterElement(interp,
	theme, "field", &FieldElementSpec, NULL);
    Ttk_RegisterElement(interp,
	theme, "Combobox.field", &ComboboxFieldElementSpec, NULL);
    Ttk_RegisterElement(interp,
	theme, "trough", &TroughElementSpec, NULL);
    Ttk_RegisterElement(interp,
	theme, "thumb", &ThumbElementSpec, NULL);
    Ttk_RegisterElement(interp,
	theme, "uparrow", &ArrowElementSpec, &ArrowElements[0]);
    Ttk_RegisterElement(interp,
	theme, "downarrow", &ArrowElementSpec, &ArrowElements[1]);
    Ttk_RegisterElement(interp,
	theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]);
    Ttk_RegisterElement(interp,
	theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]);

    Ttk_RegisterElement(interp,
	theme, "Radiobutton.indicator", &RadioIndicatorElementSpec, NULL);
    Ttk_RegisterElement(interp,
	theme, "Checkbutton.indicator", &CheckIndicatorElementSpec, NULL);
    Ttk_RegisterElement(interp,
	theme, "Menubutton.indicator", &MenuIndicatorElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "tab", &TabElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "client", &ClientElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "slider", &SliderElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "bar", &PbarElementSpec, NULL);
    Ttk_RegisterElement(interp, theme, "pbar", &PbarElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "hgrip",
	    &GripElementSpec,  &GripClientData[0]);
    Ttk_RegisterElement(interp, theme, "vgrip",
	    &GripElementSpec,  &GripClientData[1]);

    Ttk_RegisterLayouts(theme, LayoutTable);

    Tcl_PkgProvide(interp, "ttk::theme::clam", TTK_VERSION);

    return TCL_OK;
}
Exemplo n.º 16
0
/*LINTLIBRARY*/
int
Blt_x_Init(Tcl_Interp *interp) /* Interpreter to add extra commands */
{
    Tcl_Namespace *nsPtr;
    Tcl_AppInitProc **p;
    const int isExact = 1;

#ifdef USE_TCL_STUBS
    if (Tcl_InitStubs(interp, TCL_VERSION_LOADED, isExact) == NULL) {
	return TCL_ERROR;
    };
#endif
    if (Tcl_PkgRequire(interp, "blt_core", BLT_VERSION, isExact) == NULL) {
	return TCL_ERROR;
    }

#if (_TCL_VERSION >= _VERSION(8,1,0)) 
#ifdef USE_TK_STUBS
    if (Tk_InitStubs(interp, TK_VERSION_LOADED, isExact) == NULL) {
	return TCL_ERROR;
    };
#endif
    if (Tcl_PkgPresent(interp, "Tk", TK_VERSION_LOADED, isExact) == NULL) {
	return TCL_OK;
    } 
#else
    if (Tcl_PkgRequire(interp, "Tk", TK_VERSION_LOADED, isExact) == NULL) {
	Tcl_ResetResult(interp);
	return TCL_OK;
    } 
#endif
    nsPtr = Tcl_CreateNamespace(interp, "::blt::tk", NULL, NULL);
    if (nsPtr == NULL) {
	return TCL_ERROR;
    }
    nsPtr = Tcl_FindNamespace(interp, "::blt", NULL, TCL_LEAVE_ERR_MSG);
    if (nsPtr == NULL) {
	return TCL_ERROR;
    }
    Blt_RegisterPictureImageType(interp);
    Blt_RegisterEpsCanvasItem();
    Blt_InitXRandrConfig(interp);

    /* Initialize the BLT commands that only use Tk. */
    for (p = cmdProcs; *p != NULL; p++) {
	if ((**p) (interp) != TCL_OK) {
	    Tcl_DeleteNamespace(nsPtr);
	    return TCL_ERROR;
	}
    }
    if (Tcl_PkgProvide(interp, "blt_extra", BLT_VERSION) != TCL_OK) {
	return TCL_ERROR;
    }
    return TCL_OK;
}
Exemplo n.º 17
0
/**
   Called when Tcl loads this extension
 */
int
Tclpython_Init(Tcl_Interp *interp)
{
  if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL)
    return TCL_ERROR;

  if (Tcl_PkgProvide(interp, "python", "0.1") == TCL_ERROR)
    return TCL_ERROR;

  return TCL_OK;
}
Exemplo n.º 18
0
int
Macports_Init(Tcl_Interp *interp)
{
	if (Tcl_InitStubs(interp, "8.4", 0) == NULL)
		return TCL_ERROR;
	Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
	Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
	if (Tcl_PkgProvide(interp, "macports", "1.0") != TCL_OK)
		return TCL_ERROR;
	return TCL_OK;
}
Exemplo n.º 19
0
static int ALSProlog_Package_Init(Tcl_Interp *interp, AP_World *w)
{
  if (!Tcl_PkgRequire(interp, (char *)"Tcl", (char *)"8.0", 0)
      || !Tcl_CreateObjCommand(interp, (char *)"prolog", Tcl_ALS_Prolog_ObjCmd, w, NULL)
      || !Tcl_CreateObjCommand(interp, (char *)"dooneevent", Tcl_DoOneEventCmd, w, NULL))
    {
      return TCL_ERROR;
    }
  
  return Tcl_PkgProvide(interp, (char *)"ALSProlog", (char *)VERSION_STRING);
}
Exemplo n.º 20
0
int Dbus_Init(Tcl_Interp *interp)
{
   if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
      return TCL_ERROR;
   }
   if (Tcl_PkgRequire(interp, "Tcl", "8.5", 0) == NULL) {
      return TCL_ERROR;
   }

   Tcl_MutexLock(&dbusMutex);
   if (!initialized) {
      Tcl_InitObjHashTable(&bus);
      Tcl_CreateEventSource(DBus_SetupProc, DBus_CheckProc, interp);
      initialized = TRUE;
   }
   Tcl_MutexUnlock(&dbusMutex);
   TclInitDBusCmd(interp);
   /* Provide the historical name for compatibility */
   Tcl_PkgProvide(interp, "dbus-tcl", PACKAGE_VERSION);
   return Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION);
}
Exemplo n.º 21
0
TTK_END_LAYOUT_TABLE

/* POSSIBLY: include Scale layouts w/focus border
 */

/*------------------------------------------------------------------------
 * TtkClassicTheme_Init --
 * 	Install classic theme.
 */

MODULE_SCOPE int TtkClassicTheme_Init(Tcl_Interp *interp)
{
    Ttk_Theme theme =  Ttk_CreateTheme(interp, "classic", NULL);

    if (!theme) {
	return TCL_ERROR;
    }

    /*
     * Register elements:
     */
    Ttk_RegisterElement(interp, theme, "highlight",
	    &HighlightElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "Button.border",
	    &ButtonBorderElementSpec, NULL);

    Ttk_RegisterElement(interp, theme, "uparrow",
	    &ArrowElementSpec, &ArrowElements[0]);
    Ttk_RegisterElement(interp, theme, "downarrow",
	    &ArrowElementSpec, &ArrowElements[1]);
    Ttk_RegisterElement(interp, theme, "leftarrow",
	    &ArrowElementSpec, &ArrowElements[2]);
    Ttk_RegisterElement(interp, theme, "rightarrow",
	    &ArrowElementSpec, &ArrowElements[3]);
    Ttk_RegisterElement(interp, theme, "arrow",
	    &ArrowElementSpec, &ArrowElements[0]);

    Ttk_RegisterElement(interp, theme, "hsash", 
	    &SashElementSpec, &SashClientData[0]);
    Ttk_RegisterElement(interp, theme, "vsash",
	    &SashElementSpec, &SashClientData[1]);

    /*
     * Register layouts:
     */
    Ttk_RegisterLayouts(theme, LayoutTable);

    Tcl_PkgProvide(interp, "ttk::theme::classic", TTK_VERSION);

    return TCL_OK;
}
Exemplo n.º 22
0
int Hal_Init(Tcl_Interp *interp) {
    int result = init();
    if(result < 0) {
	Tcl_ResetResult(interp);
	halError(interp, result);
	return TCL_ERROR;
    }

    Tcl_CreateCommand(interp, "hal", halCmd, 0, halExit);

    Tcl_PkgProvide(interp, "Hal", "1.0");
    return TCL_OK;
}
Exemplo n.º 23
0
int
Pgtcl_Init(Tcl_Interp *interp)
{
    PgCmd *cmdPtr;

#ifdef WIN32
    WSADATA wsaData;
#endif

#ifdef USE_TCL_STUBS
    if (Tcl_InitStubs(interp, "8.1", 0) == NULL)
        return TCL_ERROR;
#endif

#ifdef WIN32
    /*
     * Load the socket DLL and initialize the function table.
     */
    if (WSAStartup(MAKEWORD(1, 1), &wsaData)) {
        /*
         * No really good way to do error handling here, since we
         * don't know how we were loaded
         */
        return FALSE;
    }
#endif

    /*
     * Tcl versions >= 8.1 use UTF-8 for their internal string
     * representation. Therefore PGCLIENTENCODING must be set to UNICODE
     * for these versions.
     */

    Tcl_PutEnv("PGCLIENTENCODING=UNICODE");

    /*
     * register all pgtcl commands
     */

    for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
        Tcl_CreateObjCommand(interp, cmdPtr->name,
            cmdPtr->objProc, (ClientData) "::", NULL);
        Tcl_CreateObjCommand(interp, cmdPtr->altname,
            cmdPtr->objProc, (ClientData) "::pg::", NULL);
    }

    if (Tcl_Eval(interp, "namespace eval ::pg namespace export *") == TCL_ERROR)
        return TCL_ERROR;

    return Tcl_PkgProvide(interp, "Pgtcl", PACKAGE_VERSION);
}
Exemplo n.º 24
0
static int
NsPerl2InitInterp(Tcl_Interp *interp, void *context)
{
    Tcl_Namespace *nsPtr;

    nsPtr = Tcl_CreateNamespace(interp, "perl", NULL, NULL);
    if(!nsPtr)
        return TCL_ERROR;
    Tcl_CreateObjCommand(interp,"perl::call",NsPerl2CallCmd, NULL, NULL);

    Tcl_PkgProvide(interp, "nsperl2", "0.1");
     
    return TCL_OK;
}
Exemplo n.º 25
0
int
Ucp_Init(Tcl_Interp *interp)
{
    Tk_Window main;

    Tcl_PkgProvide(interp, "Ucp", "3.0" ) ; 

    main = Tk_MainWindow(interp);
    Tcl_CreateCommand(interp, "dpadm", dpadmCmd, main, NULL) ; 
    Tcl_CreateCommand(interp, "dcrt", dcrtCmd, main, NULL) ; 
    Tcl_CreateCommand(interp, "dprt", dprtCmd, main, NULL) ; 
    Tcl_CreateCommand(interp, "dcc", dccCmd, main, NULL) ; 

    return TCL_OK;
}
Exemplo n.º 26
0
// ################################################################
// 4. Rename the function using the name of the library + _Init
// ################################################################
// example edfnfll_init for edfnfll
int Edfnf_Init(Tcl_Interp *interp)
{
	DBG("\nEdfnf_Init TCL v[%s]", TCL_VERSION);
	
    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
		DBG("\nerror ");
		return TCL_ERROR;
    }
	
	DBG("\nCreating command [%s]\n",COMMAND_NAME);
	//once it receives the command from TCL COMMAND_NAME,is sent the function call SimulatorCmd
    Tcl_CreateObjCommand(interp, COMMAND_NAME, (void*)SimulatorCmd, NULL, NULL);
    Tcl_PkgProvide(interp, COMMAND_NAME, "1.1");

	return TCL_OK;
}
Exemplo n.º 27
0
int Viewimage_Init(Tcl_Interp *interp) {
	/* initialize the stub table interface */
	if (Tcl_InitStubs(interp,"8.1",0)==NULL) {
		return TCL_ERROR;
	}
	if (Tk_InitStubs(interp,"8.1",0)==NULL) {
		return TCL_ERROR;
	}
	if (Tcl_PkgRequire(interp,"Tk","8.1",0)==NULL) {
		return TCL_ERROR;
	}
	if (Tcl_PkgRequire(interp,"mvthimage","1.0",0)==NULL) {
		return TCL_ERROR;
	}
	
	/* initialize the new, alternative image context handling code */
	MvthImageState_Init(interp);

	/* Initialize the Tcl script for viewing images in a Tk window.*/
	char buff[1024];
	snprintf(buff,sizeof(buff),"%s/viewimage.tcl",TCLSCRIPTDIR);
	fprintf(stdout,"viewimage.tcl should be located at: %s\n",buff);
	Tcl_EvalFile(interp,buff);
	Tcl_VarEval(interp,
			"puts stdout {viewimage Copyright (C) 2009 Sam Bromley};",
			"puts stdout {This software comes with ABSOLUTELY NO WARRANTY.};",
			"puts stdout {This is free software, and you are welcome to};",
			"puts stdout {redistribute it under certain conditions.};",
			"puts stdout {For details, see the GNU Lesser Public License V.3 <http://www.gnu.org/licenses>.};",
			NULL);
	Tcl_VarEval(interp,
			"proc miexpand {w} {"
				"foreach {wo ho do bo} [mi size $w] break;"
				"set c [::viewimage::canvasNameFromImg $w];"
				"set wi [winfo width $c];"
				"set hi [winfo height $c];"
				"set wi [expr {$wi-3}];"
				"set hi [expr {$hi-3}];"
				"if {$wi<=0} {set wi 10};"
				"if {$hi<=0} {set hi 10};"
				"mi size $w [list $wi $hi $bo];"
				"xblitimage $w;"
			"}",NULL);
	/* Declare that we provide the buriedtargets package */
	Tcl_PkgProvide(interp,"viewimage","1.0");
	return TCL_OK;
}
Exemplo n.º 28
0
//--------------------------------------------------------------------------
extern "C" HQP_API int Hqp_Init(Tcl_Interp *interp) 
{
  // provide Tcl package Hqp
  if (Tcl_InitStubs(interp, "8.1", 0) == NULL ||
      Tcl_PkgProvide(interp, "Hqp", (char *)Hqp_Version) != TCL_OK) {
    return TCL_ERROR;
  }

  // initialize global reference to Tcl interpreter
  theInterp = interp;

  // disable Meschach's error counting
  // (otherwise program would exit if counter reaches 100)
  count_errs(0);

  // allocate interface modules
# ifdef IF_CLASS_STATIC
  Hqp_ClassAlloc();
# endif

  // create initial state
  theSqpProgram = NULL;
  theSqpSolver = new Hqp_SqpPowell;

  _ifList.append(new IF_MODULE("prg_name", &theSqpProgram, Hqp_SqpProgram));
  _ifList.append(new IF_MODULE("sqp_solver", &theSqpSolver, Hqp_SqpSolver));
  _ifList.append(new IF_MODULE("mip_solver", &theMipSolver, Hqp_MipSolver));
  _ifList.append(new If_String("hqp_version", &Hqp_Version));
  _ifList.append(new If_Procedure("m_version", &m_version_cmd));

  // evaluate hqp_solve.tcl
  extern char *hqp_solve;
  if (Tcl_Eval(interp, hqp_solve) == TCL_ERROR) {
    fprintf(stderr,
	    "Evaluation of built-in code failed: %s\n", Tcl_GetStringResult(interp));
  }

  // evaluate file ~/.hqprc if it exists
  if (Tcl_Eval(interp, "if {[file exists ~/.hqprc]} {source ~/.hqprc}")
      != TCL_OK) {
    fprintf(stderr,
	    "Evaluation of ~/.hqprc failed: %s\n", Tcl_GetStringResult(interp));
  }

  return TCL_OK;
}
Exemplo n.º 29
0
    /*
     * Load the extension in normal execution mode
     */
    int DLLEXPORT Tclliquid_Init(Tcl_Interp *interp)
    {
        // Initialize the stubs and verify the result
        if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL)
            return TCL_ERROR;

        // Initialize the package provided by this extension
        if (Tcl_PkgProvide(interp, "liquid", "0.1.0") == TCL_ERROR)
            return TCL_ERROR;

        // Initialize commands
        Tcl_CreateObjCommand(interp, LiquidNamespace"validate", LiquidValidate_Command, NULL, NULL);
        Tcl_CreateObjCommand(interp, LiquidNamespace"render", LiquidRender_Command, NULL, NULL);

        // All set!
        return TCL_OK;
    }
Exemplo n.º 30
0
EXTERN int
Pkgd_SafeInit(
    Tcl_Interp *interp)		/* Interpreter in which the package is to be
				 * made available. */
{
    int code;

    if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL) {
	return TCL_ERROR;
    }
    code = Tcl_PkgProvide(interp, "Pkgd", "7.3");
    if (code != TCL_OK) {
	return code;
    }
    Tcl_CreateObjCommand(interp, "pkgd_sub", Pkgd_SubObjCmd, NULL, NULL);
    return TCL_OK;
}