Batch Simple Plugin System Concept

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Re: Batch Simple Plugin System Concept

#46 Post by Adrianvdh » 15 Jan 2014 08:46

penpen wrote:
Adrianvdh wrote:Oh yeah...
But those are names of languages you know right? I want to know the programming languages you can code in.
You should reread the second link (and your post in that topic above).

Adrianvdh wrote:

Code: Select all

   set "PluginFunctions[Pluginable1]=2"
:: ...
   set "PluginFunctions[1]=call :Pluginable3"

The first line is a mapping from the pluginable functions to the indices of the next mapping.
The last line is a mapping from pluginable functions indices to the command to call them; without params, as they are added later in code.

Adrianvdh wrote:

Code: Select all

:processParams
   if /I .%1 == ./noPlugins set "usePlugins=false"
   goto :pluginManager

This is an option to not load any plugins.

Adrianvdh wrote:(... code)
I know this but to make sure... The plugin manager contains all the plugins batch file within the 'plugins' folder and stores the names in an array or a list I forget the differences. (I am still learning C# but I am also leaning Java at school, just starting)
In batch the most datatypes are all simulated, so you can see it as a list or as an array, as you want or need it.
The only datatype batch supports is a hash map on strings (key and value): The key is the name of the variabel (and the value is its value).

Adrianvdh wrote:(... code)
calls the services(s) used by 'main.bat'

(... code)
The "callfunction" is used to call function(s) within plugins to be replaced by the default function(s)

(... code)
These are the functions built into the main batch file.

e.g. 'getWinkey'
1. Yes
2. I'm sure you mean it in right way.
3. I thought this was your example of a function called from the plugin; if yes, then: No, it should be placed within the batch-dll.

Adrianvdh wrote:

Code: Select all

:mainlabel
echo =================================================================
::2
::3
::4
call :callfunction :Pluginable1, mainlabel 5 n
echo =================================================================

:default
::1
call :callfunction :Pluginable2, default 2 n
echo =================================================================

:settings
::1
::2
call :callfunction :Pluginable3, settings 2 n
::4
::5
echo =================================================================
pause
   exit /b 0

I don't understand how this works... Sorry, and the parameter (just checking) arguments are normal because some functions can have them right, like (e.g.):

Code: Select all

:header
echo %~1
pause

This should be just the simulating of a complex program, but it is much more easier:
It just processed top down.
The lines ":", "::" just don't do anything.
So it echoes "===..." lines and call the pluginable functions with some parameters.

Adrianvdh wrote:You need to explain this to me, the code I know the consept:
(... code)
What do you want to know? (The @'s are just to avoid the default command echo.)

Adrianvdh wrote:What do these mean in "SamplePlugin.bat":

Code: Select all

@rem MY_BATCH_FILE_NAME_TEXT ------> :Pluginable2 

This tells the plugin manager to be called the replaceable function ":Pluginable2"

Adrianvdh wrote:and of course this:

Code: Select all

@echo MY_BATCH_FILE_NAME_TEXT MY_BATCH_FILE_NAME_TEXT2 MY_BATCH_FILE_NAME_TEXT3

This is an example of a batch file in plugins folder that is not a plugin of SampleMain.bat.

penpen


No, what does the "call", "list", "help" etc do. Are thy just dummy functions?
Sorry I seem to be very difficult, well I am not. I just seem to be missing something.

penpen wrote:The "callfunction" is used to call function(s) within plugins to be replaced by the default function(s)


Well, the "callfunction" is the function that is used to call functions within the plugins, those functions replace the functions within "batch-dll"

penpen wrote:This tells the plugin manager to be called the replaceable function ":Pluginable2"


Are you saying that the plugin manager will be replace by the plugin's function?

Please for give me for being so retarded and having such a difficult time with you, unlike you I don't have all that experience you have (lucky). Ahh I wish I knew all that.

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch Simple Plugin System Concept

#47 Post by penpen » 15 Jan 2014 13:16

Adrianvdh wrote:No, what does the "call", "list", "help" etc do. Are thy just dummy functions?
Sorry I seem to be very difficult, well I am not. I just seem to be missing something.
I think you mean the batch-dll:
- ":call"; no function but needed label; is the part that calls a special service: "Sample.dll.bat /call :SampleFunction"
- ":SampleFunction"; a function; executes the service "SampleFunction"
- ":list"; no function but needed label; part that returns a list of all: "Sample.dll.bat /list"
- ":help"; no function but needed label; part that displays the help info screen: "Sample.dll.bat /help"

Adrianvdh wrote:
penpen wrote:The "callfunction" is used to call function(s) within plugins to be replaced by the default function(s)

Well, the "callfunction" is the function that is used to call functions within the plugins, those functions replace the functions within "batch-dll"
NO:
thll, the "callfunction" is the function that is used to call plugins (if possible), those functions replace the functions within "SampleMain.bat"

Adrianvdh wrote:
penpen wrote:This tells the plugin manager to be called the replaceable function ":Pluginable2"

Are you saying that the plugin manager will be replace by the plugin's function?
Sorry, i've "redesiged" the sentence, adding bad grammar; it should be:
This tells the plugin manager to call the plugin instead of the pluginable function ":Pluginable2".
(I will correct that in the post above.)

penpen

Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Re: Batch Simple Plugin System Concept

#48 Post by Adrianvdh » 18 Jan 2014 05:02

So just to be sure (sorry) 'Pluginable2' is the functions within main.bat that is a private function and the public functions are within "batch-dll"?

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch Simple Plugin System Concept

#49 Post by penpen » 18 Jan 2014 14:47

Yes.

penpen

Post Reply