Instruction Stack

Instruction stack is a javascript array which handles the instructions sent from the ajax layer or keyboard. (Actually you don't have to know the structure of the instruction stack but I explain it for the ones who may have reasons to change the code for special needs.)

The instructions are array of JSON objects. The script embedded in SVG reads the instruction stack with a user defined frequency. When the last instruction is read and executed, it's removed from the queue. An instruction stack row may include several instructions at a time. This is defined by the svgAjaxAdapter object in the ajax layer.

For more,
(see:svgAjaxAdapter)
(see:Keyboard Control)

Actions

All the instructions are in JSON format and have a field called "action".

For example an instruction which inserts a circle to the scene group is like
{action:"insert", elementId:"scene", shapeType"circle", ...}

All the actions are tied to a javascript function. (see: js/svgdreams-canvas.js).

Methods and functions related with instruction stack

1. The javascript file svgdreams-ajax.js handles the data sent from the ajax layer and pushes it into the instruction stack.
2. The javascript file svgdreams-keyboard.js may insert the keyboard data directly into the instruction stack.

3. In the javascript file svgdreams-canvas.js, there're functions called getInstruction and resolveInstruction which dispatch to the right javascript function.

4. In svg class (see: library/svg.class.php), there're some properties which define how instruction stack works.
public $instructionStackConnectorFlag: If this flag is false, the script will never check for the new instructions.
public $instructionStackConnectorInterval: This is the time between two instruction process. 1sec = 1000msec by default.

All rights reserved. See license