Exemple #1
0
/*
  Function : Cximage_Init

  Description :	The Init function that will be called when the extension is loaded to your tk shell

  Arguments   :	Tcl_Interp *interp    :	This is the interpreter from which the load was made and to
  which we'll add the new command


  Return value : TCL_OK in case everything is ok, or TCL_ERROR in case there is an error (Tk version < 8.3)

  Comments     : hummmm... not much, it's simple :)

*/
int Tkcximage_Init (Tcl_Interp *interp ) {

    int i;

    INITLOGS(); //
    LOG("---------------------------------"); //

    //Check Tcl version is 8.3 or higher
    if (Tcl_InitStubs(interp, TCL_VERSION, 1) == NULL) {
        return TCL_ERROR;
    }

    LOG("Tcl stub initialized"); //

    //Check TK version is 8.3 or higher
    if (Tk_InitStubs(interp, TK_VERSION, 1) == NULL) {
        return TCL_ERROR;
    }

    LOG("Tk stub initialized"); //


    LOG("Creating commands"); //

    // Create the wrapping commands in the CxImage namespace linked to custom functions with a NULL clientdata and
    // no deleteproc inside the current interpreter
    Tcl_CreateObjCommand(interp, "::CxImage::Convert", Tk_Convert,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "::CxImage::Resize", Tk_Resize,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "::CxImage::Colorize", Tk_Colorize,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "::CxImage::Thumbnail", Tk_Thumbnail,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "::CxImage::IsAnimated", Tk_IsAnimated,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);

#if ANIMATE_GIFS
    Tcl_CreateObjCommand(interp, "::CxImage::StopAnimation", Tk_DisableAnimation,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "::CxImage::StartAnimation", Tk_EnableAnimation,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "::CxImage::NumberOfFrames", Tk_NumberOfFrames,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    Tcl_CreateObjCommand(interp, "::CxImage::JumpToFrame", Tk_JumpToFrame,
                         (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
    if (PlaceHook(interp) != TCL_OK) return TCL_ERROR;
#endif

    LOG("Adding format : "); //
    for (i = 0; i < AVAILABLE_FORMATS; i++) {
        Tk_CreatePhotoImageFormat(&cximageFormats[i]);
        APPENDLOG(cximageFormats[i].name); //
    }

    // end of Initialisation
    return TCL_OK;
}
Exemple #2
0
void PatchEngine( void )
{
	#ifdef PATCH_ENGINE
		int i;

		Com_Printf( "Installing engine patches (GAME)\n" );

		#ifdef HOOK_Q3INFOBOOM
			PATCH( Q3IB_MSGPATCH, unsigned int, 0x3FF );
		#endif

		for ( i=0; i<numHooks; i++ )
			PlaceHook( &hooks[i] );
	
		level.security.isPatched = qtrue;
	#else
		Com_Printf( "Engine modifications are disabled\n" );
	#endif // PATCH_ENGINE
}