Skip to content

Op Codes

Shane Isbell edited this page Nov 9, 2017 · 1 revision

Operations

Within a document file, there is a stack of operations that can be used to construct the document view. They are applied in order to the document. These operations will add and delete text/media as well as setup links and document formatting. This page gives an outline of these operations.

ApplyOverlay

Applies an overlay over a region of text or media. An overlay can be formatting (bold, italic), jump links or other types of links.

APPLY_OVERLAY 16 = 0x10
long variant span start
long variant span width
int link size count
intarray array of link type indexes

Description

The variant span start and width gives the document region that this overlay covers. intarray references the overlay types such as styling and jump links. More than one type may cover the same region. These are indexes into the tumblerPool. From the tumblers, you can determine link type.

CopyVariant

Copies a region of text or media to a new location with a document.

COPY_VARIANT 2 = 0x2
long to position
long variant span start
long variant span width

Description

The to position references the position to copy the variant span to. This operation copies the text and appends it to the invariant stream.

DeleteVariant

Deletes a region of text or media.

DELETE_VARIANT 3 = 0x3
long variant span start
long variant span width

MoveVariant

Movies a region of text or media from one location to another location.

MOVE_VARIANT 7 = 0x7
long to position
long variant span start
long variant span width

Description

The to position references the position to move the variant span to. This operation does not append text to the invariant stream, its merely moving the position.

PutInvariantMedia

Puts a media object in the document. This operation will reference the index of hash of a media object (like an image). The hash is stored in a mediaPool within the document.

PUT_IN_MEDIA 6 = 0x6
long to position
int media pool index
int tumbler pool index

Description

A document file has a media pool that has a list of hashed values of media objects used in the file. The media pool index points to one of these hashes. The tumbler pool index points to a tumbler address that references the media meta-data.

PutInvariantSpan

Puts an invariant span into a variant stream.

PUT_INVARIANT_SPAN 1 = 0x1
long to position
long invariant span start
long invariant span width
int tumbler pool index

Description

This operation puts span of text from the invariant stream to the to position within the document. The tumbler pool index points to an index in the tumbler pool. This tumbler is the home document of the invariant stream.

PutOverlayMedia

Overlays a media object with styling and links.

PUT_OVERLAY_MEDIA 19 = 0x13
long to position
int media pool index
int tumbler pool index
int link size count
intarray array of link type indexes

PutOverlay

Adds an overlay over a region of text and media. The linkTypes reference things like styling and links to apply to the region.

PUT_OVERLAY 18 = 0x12
long variant span start
long variant span width
int link size count
intarray array of link type indexes

SwapVariant

Swaps the text and media in one document region with the text and media of another document region.

SWAP_VARIANT 17 = 0x11
long variant span start 1
long variant span width 1
long variant span start 2
long variant span width 2

Description

The operation will swap the text/media in [start 1, width 1] with the text/media in [start 2, width 2]. These regions can't overlap or the operation will be rejected by the document.

ToggleOverlay

Toggles one overlay of a region by flipping the overlay on/off.

TOGGLE_OVERLAY 17 = 0x11
long variant span start
long variant span width
int link type index