Made to Order Software Corporation Logo

pointer

Safely Processing a Queue of Jobs

What is a Queue

In software a queue is a container which is used to add items on one side and remove them on the other in a very efficient manner.

Sorted Queues

When used by a Journal, a queue is often going to support some kind of sorted order. Some jobs are more important than others and these should be built sooner. In other words, we give those jobs a higher priority and we sort the queue by priority first then using the time at which the job gets inserted.

Note that the C++ std::queue and std::unque containers do not offer anyway to support a priority. Instead you have to use ...

Start Drag

SWF Action
Action Category: 
Movie
Action Details: 
0
Action Identifier: 
39
Action Structure: 
<n.a.>
Action Length: 
0 byte(s)
Action Stack: 
pop 1 (s), pop 2 (b), if (b3) { pop 4 (n) }
Action Operation: 
s1 := pop();
b2 := pop();
b3 := pop();
if(b3) {
    n4 := pop();
    n5 := pop();
    n6 := pop();
    n7 := pop();
    s1.start_drag(b2, n4, n5, n6, n7);
}
else {
    s1.start_drag(b2);
}
Action Flash Version: 
4
See Also: 

Pop a target (sprite, movie, thread) name s1.

Pop a first Boolean b2, which, when true, means that the mouse pointer is locked to the center of the object being dragged.

Pop a second Boolean b3, which when true means that the mouse pointer is constrained to the specified rectangle1 (n4 to n7, representing y2, x2, y1, x1.)

Once this function was called, the object attached to the mouse pointer will follow the mouse until a Stop Drag action is applied or another object is defined as the object being dragged with another Start Drag.

  • 1. The rectangle is not defined when b3 is false.

Push Data

SWF Action
Action Category: 
Stack
Action Details: 
0
Action Identifier: 
150
Action Structure: 
struct {
	unsigned char   f_type
	<type>          f_data
} f_push_data[<variable>];
Action Length: 
-1 byte(s)
Action Stack: 
push <variable> (a)
Action Operation: 
a1 = f_data[0];1
push(a1);
a2 = f_data[1];
push(a2);
a3 = f_data[2];
push(a3);
...
an = f_data[n];
push(an);
  • 1. Notice that the first data in the action is the last accessible on your stack.
Action Flash Version: 
4
See Also: 

Push some immediate data on the stack. This action was introduced in V4.0. The supported data types vary depending on the version of the player you have. As many values as necessary can be pushed at once. The f_push_data structure will be repeated multiple times as required. For instance, to push two strings on the stack at once, you would use the following code:

Sprite Properties

The following is the list of currently accepted properties or fields for the Get Property and the Set Property actions. Note that the properties can be specified with either an integer (type 7, requires V5.0+) or a single precision floating point (type 1, V4.0 compatible). And since strings are automatically transformed in a value when required, one can use a string to represent the property number (type 0).

Branch If True

SWF Action
Action Category: 
Control
Action Details: 
0
Action Identifier: 
157
Action Structure: 
signed short   f_offset;
Action Length: 
2 byte(s)
Action Stack: 
pop 1 (b)
Action Operation: 
b1 := pop();
if(b1) {
    ip += f_offset;   // ip past the branch action
}
Action Flash Version: 
4
See Also: 

Pop a Boolean value; if true then jump to the specified action; otherwise continue with the following actions.

There is no Branch If False action. Instead, first use the Logical Not, then Branch If True.

IMPORTANT NOTES

Branch Always

SWF Action
Action Category: 
Control
Action Details: 
0
Action Identifier: 
153
Action Structure: 
signed short   f_offset;
Action Length: 
2 byte(s)
Action Stack: 
n.a.
Action Operation: 
ip += f_offset;   // ip past the branch action
Action Flash Version: 
4
See Also: 

Jump to the specified action. The offset is added to the current execution pointer as it is after reading the branch instruction.

IMPORTANT NOTES

The offset must be such that when added to the current execution pointer it points to a valid action (i.e. you cannot jump in the middle of a Push Data or any other multi-byte action.)

Pointers and proper exception handling...

Many C++ programmers have been C programmers first. Therefore, a lot of times, you find statements written this way:

ptr = new type;

if(ptr == 0) // handle error...

This is a C programmer that does not yet know that the new operator will throw an error if the allocation cannot happen. This makes a lot of sense, but what does that mean to the C++ programmer?