Graphics.UsingTheDougDynamicPluginLoadingCommands - lordmundi/wikidoctest GitHub Wiki

Using the Dynamic Plugin Loading Commands

« Using the doug view command | EDGE User’s Guide | Using the doug cmd tcl command »

EDGE provides an extensive tcl scripting ability to DSP.

There is a capability in EDGE to load and unload plugins at runtime, although this is rarely used in the community.

Simple Directions

The commands to load and unload plugins are best explained via examples. The following example commands should illustrate most of the usage:

doug.plugin_version             <plugin_name>
doug.plugin_status              <plugin_name>
doug.plugin_message_log         <plugin_name>
doug.plugin_status_messages     <plugin_name>
doug.plugin_warning_messages    <plugin_name>
doug.plugin_status		dsp_caminfo
doug.load_plugin 		dsp_cctv
doug.unload_plugin 		dsp_groundtrack

What's really going on

If the above examples are not enough info, or you need more information about a particular option, the source code implementing the dynamic plugin loading commands is below:

[Show DOUG_MISC_cmd source code][4]

int
DOUG_MISC_cmd( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] )
{
#if 0
doug.plugin_status		dsp_caminfo
doug.load_plugin 		dsp_cctv
doug.unload_plugin 		dsp_groundtrack
#endif
	char *cmd, *name;
	DSS_PLUGIN *plug;
	static char buff[30];

    Tcl_ResetResult( interp );
    cmd = Tcl_GetString( objv[0] );

	if( !strcmp( cmd, "doug.plugin_status" ) )
	{
		name = Tcl_GetString( objv[1] );

		/* FIND PLUGIN */
		plug = DSV_plugin_list;
		while( plug )
		{
			if( !strcmp( plug->name, name ) )
				break;
			plug = plug->pnext;
		}

		/* IF FOUND */
		if( plug )
		{
			sprintf( buff, "%d", plug->initialized );
			Tcl_SetResult( interp, buff, TCL_VOLATILE );
		}
	}
	else if( !strcmp( cmd, "doug.load_plugin" ) )
	{
		int retval = 0;
		name = Tcl_GetString( objv[1] );
		if( plug = DSF_LoadPlugin( name ) )
		{
			retval = DSF_InitializePlugin( plug );
		}

		sprintf( buff, "%d", retval );
		Tcl_SetResult( interp, buff, TCL_VOLATILE );

		DOUG_GetPluginList();
	}
	else if( !strcmp( cmd, "doug.unload_plugin" ) )
	{
		name = Tcl_GetString( objv[1] );

		/* FIND PLUGIN */
		plug = DSV_plugin_list;
		while( plug )
		{
			if( !strcmp( plug->name, name ) )
				break;
			plug = plug->pnext;
		}

		/* IF FOUND */
		if( plug )
		{
			DSF_UnloadPlugin( plug );
		}

		DOUG_GetPluginList();
	}

	return TCL_OK;
}

« Using the doug view command | EDGE User’s Guide | Using the doug cmd tcl command »

[4]: javascript:toggleObj('togglecode_id0','hide','Show DOUG_MISC_cmd source code','Show DOUG_MISC_cmd source code','')