Skip to content

mdal

[module] mdal

Output generation

[procedure] (write-mmod MOD #!optional (PORT (current-output-port)))

[procedure] (mmod->file MOD FILENAME)

Write the MDAL module MOD to an .mdal file.

[procedure] (mod-compile MOD ORIGIN #!key OUTPUT-ASM (EXTRA-SYMBOLS '()))

Compile a module to an onode tree.

[procedure] (mod->bin MOD #!key (ORIGIN (mdef-default-origin (mmod-mdef mod))) (EXTRA-SYMBOLS '()))

Compile the MDAL module MOD into a list of byte values, starting at the target memory address ORIGIN. Optionally, EXTRA-SYMBOLS may be a list of additional key,value pairs to be passed to the compiler.

[procedure] (mod->asm MOD #!key (ORIGIN (mdef-default-origin (mmod-mdef mod))) (EXTRA-SYMBOLS '()))

Transpile the MDAL module MOD into assembly source code. ORIGIN may specify the initial target memory address. If not given, the default origin specified by the module's engine definition is used. EXTRA-SYMBOLS may be a list of additional key,value pairs to be passed to the compiler.

[procedure] (mod-export-asm FILENAME MOD #!optional (ORIGIN (mdef-default-origin (mmod-mdef mod))))

Compile the given module to a binary file.

[procedure] (mod-export-bin FILENAME MOD #!optional (ORIGIN (mdef-default-origin (mmod-mdef mod))))

Compile the given module to a binary file.

Additional accessors

[procedure] (mod-get-group-instance-blocks IGROUP-INSTANCE IGROUP-ID MDEF)

Returns the group instance's block nodes, except the order node. The order node can be retrieved with mod-get-group-instance-order instead.

[procedure] (mod-get-block-field-value BLOCK-INSTANCE ROW FIELD-ID MDEF)

Get the value of field FIELD-ID in ROW of BLOCK-INSTANCE.

[procedure] (mod-get-current-label-row BLOCK-INSTANCE FIELD-ID MDEF)

Get the row of BLOCK-INSTANCE that has the label field FIELD-ID set.

[procedure] (md-command-info FIELD-ID MDEF)

Set the active MD command info string from the given mdef config-inode FIELD-ID.

[procedure] (mod-get-row-values GROUP-INSTANCE BLOCK-INSTANCE-IDS ROW MDEF)

Returns the values of all field node instances of the given ROW of the given non-order block-instances in the given GROUP-INSTANCE as a flat list. BLOCK-INSTANCE-IDS must be a list containing the requested numerical block instance IDs for each non-order block in the group. Values are returned as strings, except for trigger fields. Empty (unset) instance values will be returned as #f.

[procedure] (mod-get-block-values GROUP-INSTANCE ORDER-POS GROUP-ID MDEF)

Returns the values of all field node instances of the non-order block instances in the given group-instance, as a list of row value sets. Effectively calls md-mod-get-row-values on each row of the relevant blocks.

[procedure] (mod-get-group-instance-order IGROUP-INSTANCE IGROUP-ID)

Returns the group instance's order node (instance 0).

[procedure] (mod-get-order-values GROUP-INSTANCE GROUP-ID MDEF #!key ONLY-BASE-FIELDS)

Returns the values of all order fields as a list of row value sets. Values are normalized, ie. empty positions are replaced with repeated values from an earlier row. If ONLY-BASE-FIELDS is given and #t, returns only the Length and block reference fields.

Inode mutators

[procedure] (node-set! PARENT-NODE-INSTANCE NODE-ID INSTANCES MOD)

Set one or more INSTANCES of the node with NODE-ID. INSTANCES must be an alist containing the node instance id in car, and the new value in cdr.

[procedure] (node-remove! PARENT-INSTANCE-PATH NODE-ID INSTANCES MOD)

Delete one or more INSTANCES from the node with NODE-ID.

[procedure] (node-insert! PARENT-INSTANCE-PATH NODE-ID INSTANCES MOD)

Insert one or more INSTANCES into the node with NODE-ID. INSTANCES must be a list of node-instance-id, value pairs.

[procedure] (block-row-insert! PARENT-INSTANCE-PATH BLOCK-ID INSTANCES MOD)

Insert one or more rows into the block instance at BLOCK-INSTANCE-PATH. Rows shall be a list of lists, where each sublist contains a row number in car, and a list of field values in cdr.

[procedure] (block-row-remove! PARENT-INSTANCE-PATH BLOCK-ID INSTANCES MOD)

Remove one or more rows from a block node instance. PARENT-INSTANCE-PATH must be a node path to the parent group node instance. BLOCK-ID must be the ID of the block node, and INSTANCES must be an alist, where the keys are the IDs of the block instances to change, and the values are lists containing a row number in car.

Generators

[procedure] (generate-new-mmod MDEF BLOCK-LENGTH)

Generate a new, empty mmod based on the MDAL engine definition MDEF. Block instances are generated with length BLOCK-LENGTH by default, unless other constraints apply from the mdef.

[procedure] (derive-single-row-mmod MOD GROUP-ID ORDER-POS ROW)

Derive a new MDAL module from the module MOD, which contains a single row of block data in the group with GROUP-ID. The row is composed from position ROW in the set of patterns represented by ORDER-POS.

[procedure] (derive-single-pattern-mmod MOD GROUP-ID ORDER-POS)

Derive a new MDAL module from the module MOD, with the order list of group GROUP-ID modified to only contain the step ORDER-POS.

Utility Procedures

[procedure] (transpose-notes FIELD-VALUES COMMAND OFFSET)

Transpose notes in the list of field values by OFFSET.