Official website

Tuesday, February 26, 2013

Instruction Set anatomy

An instruction set is a collection of actions that has 3 basic forms and cast as follows.

Launchers allow modularity. A launcher is responsible to execute third party programs and making API calls against the framework. If any of the processes above has a returning output, then its associated to the final synthesis.
Third party programs are invoked with dot-slash (./) and API calls with the judo keyword.

IMPORTANT: Use with cause the dot-slash (./) method if you want to avoid deadlocks. It instructs the process component to wait indefinitely for the associated process to exit. In case of the example above with notepad, the process will completed when notepad will terminated. Purpose of this action is the expandability via custom scripts and programs that does a job, give an output and finally terminated.

Example in steps...

A simple shell script that returns 'john'

The launcher

The invoke method

Result of the launcher

Result of the method

In the above example we create a launcher of a program that returns a value in order to reproduce a new instruction set that also contains additional information. We can bypass this process if we just want to launch a program and not use its value for reproduction. Since everything is instruction sets, this can be achieved by a single task.

However run-calc cannot be called by another instruction set.

When you try to execute a program that takes arguments, you should use single or back quotes (' or `) to split the statement. It doesn't matter if the arguments contains double quotes (").
./'program.exe' '<arguments> "<arguments with quotes>"'
./'ffmpeg' '-t 00:00:20 -i "http://<cam ip>:<port>/videostream.asf?user=admin&pwd=xxx" "/home/%user%/Videos/IP-Cam/cam-%calendarday%-%calendarmonth%-%calendaryear%_%hour%-%minute%.asf"'


Events are very convenient because you can make multiple calls with a single command. This could be a sequence of different instruction sets, functions or API calls delimited by semicolon and can be triggered by another instruction set container like this...

%~><event handler id>%
In this particular example %~>demohandler%

To view events, go to terminal tab and type...
judo event list

Final Synthesis
A command (demo) is a sentence consisted by plain text, function calls and/or launchers. A launcher must be invoked by asterisk (*) token which it represents a pointer to the launcher.

Tip: You can have a number of instruction sets with the same name. Thus will give us the ability to trigger a sequence of events with ascending order.
Update: Use events instead for a more convenient way.

If instead of the (dummy) notepad example we are triggering a program or a script that has a returning value, then the wildcard *test will be replaced by it and associated to the final output. For example, if we request a sensor value from the microcontroller then the result should be synthesized like...

The temperature is <value returned from *temp>. This is a demo. has launched something that returns a value.

Check this post to see an example in action.

To view instruction sets, go to terminal tab and type...
judo inset list

Another feature we can include to expand functionality is the evaluation function. This allows us to evaluate one or more expressions and act accordingly.

In the next step, we create a simple notification when evaluation failed. Category and other fields are not essential since in this case we need just a notifier

Evaluate %day% function against string "Monday"

Test result

Indicators used within an instruction set when we need to call a launcher or an event handler. Wildcards used by the framework are...

Asterisk (*) pointer to a launcher or just a reflection of another Instruction Set.

%value% represents an internal function call.

%~>value% represents an event handler.

Essential Resources

Built-in finctions and API

No comments:

Post a Comment