instructions.texi (4779B)
1 @node instructions 2 @chapter Instructions 3 4 5 @section Data types 6 7 8 @anchor{node_type} 9 @subsection node 10 11 A node name is a string. 12 13 Both regular and special node names exist. 14 15 @subsubsection Regular node 16 17 Must be one or more characters long. 18 19 Starts with a 7-bit alphabetical character ([a-zA-Z]). 20 21 The remainder of the string may contain 7-bit alphanumeric characters or underscore. 22 23 24 @subsubsection Special node 25 26 Special node names are a single character. 27 28 See @ref{node_names, Node names} for details. 29 30 31 @subsection label 32 33 Same rules as for @ref{symbol_type, symbol}. 34 35 36 @subsection size 37 38 Numerical value of any size. 39 40 41 @subsection selector 42 43 The selector @code{*} is used to catch any input. 44 45 Apart from that, a valid selector is a string of 7-bit alphanumeric characters. 46 47 48 @anchor{symbol_type} 49 @subsection symbol 50 51 Same rules as for @ref{node_type, regular node names}. 52 53 54 @subsection signal 55 56 Numerical value of any size. 57 58 59 @subsection matchmode 60 61 Binary numeric value, 0 or 1. 62 63 64 @section Instruction list 65 66 @subsection CATCH <node> <signal> <matchmode> 67 68 Control flow using signal checking. 69 70 If @code{matchmode} is 1, then jump to @code{node} if @code{signal} is @emph{set}. 71 72 If @code{matchmode} is 0, then jump to @code{node} if @code{signal} is @emph{not set}. 73 74 Existing bytecode in buffer is cleared before the jump. 75 76 77 @subsection CROAK <signal> <matchmode> 78 79 Clear state and restart execution from top if signal is matched. 80 81 Signal match is the same as for @code{CATCH}. 82 83 Existing bytecode in buffer is cleared before the jump. 84 85 86 @subsection HALT 87 88 Halt execution and yield control to client. 89 90 Any remaining bytecode is kept in buffer. 91 92 93 @subsection INCMP <node> <selector> 94 95 Compare registered input to @code{selector}. 96 97 If match, it has the same side-effects as @code{MOVE}. 98 99 In addition, any consecutive @code{INCMP} matches will be ignored until next @code{HALT} is encountered. 100 101 102 @subsection LOAD <symbol> <size> 103 104 Execute the code symbol @code{symbol} and cache the result. 105 106 Result must be constrained to the given @code{size}. 107 108 This is a noop if symbol has already been loaded in the current scope. 109 110 111 @subsection MAP <symbol> 112 113 Expose result from @code{symbol} previously loaded by @code{LOAD} to the renderer. 114 115 116 @subsection MNEXT <label> <selector> 117 118 Activate the "next" part of lateral navigation. 119 120 Define how to display the menu choice for advancing to the next page. 121 122 123 @subsection MOUT <label> <selector> 124 125 Add menu entry. 126 127 Each entry should have a corresponding `INCMP` with matching @code{selector}. 128 129 Attempt to resolve @code{label} to a language-enabled string to use as menu title, or by default use the @code{label} directly. 130 131 132 @subsection MOVE <node> 133 134 Load bytecode and template corresponding to @code{node}. 135 136 The loaded bytecode is appended to existing bytecode in buffer. 137 138 Invalidates effects of all preceding @code{MAP} calls. 139 140 141 @subsection MPREV <label> <selector> 142 143 Activate the "previous" part of lateral navigation. 144 145 Define how to display the menu choice for going back to the previous page. 146 147 148 @subsection MSINK 149 150 If set, the menu is defined as the multi-page content sink. 151 152 Cannot be used with an active @code{MAP} of a symbol with @code{LOAD} size @code{0}. 153 154 155 @subsection RELOAD <symbol> 156 157 Execute a code symbol already loaded by @code{LOAD} and overwrite the existing cache with the new results. 158 159 Constrained to the previously given size for the same symbol. 160 161 162 163 @section Batch instructions 164 165 Some convenience instructions are made available for defining menus. 166 167 There instruction @strong{MUST} be used at the @emph{end} of the node's assembly code, as they expand to code on either side of a @code{HALT} instruction. 168 169 @table @code 170 @item DOWN <symbol> <selector> <label> 171 Descend to next frame and move to @code{symbol}. 172 @item UP <selector> <label> 173 Return to the previous frame. 174 @item NEXT <selector> <label> 175 Activate and set @emph{next} menu option for browsing multiple-page renders. 176 @item PREVIOUS <selector> <label> 177 Activate and set @emph{previuos} menu option for browsing multiple-page renders. (If @code{MNEXT}/@code{NEXT} has not been defined this will not be rendered). 178 @end table 179 180 181 @subsection Batch menu expansion 182 183 @multitable @columnfractions .50 .50 184 @headitem Batch instruction 185 @tab Expanded instruction 186 @item @example 187 DOWN foo 0 to_foo 188 @end example 189 @tab @example 190 MOUT to_foo 0 191 HALT 192 INCMP foo 0 193 @end example 194 @item @example 195 UP 1 back 196 @end example 197 @tab @example 198 MOUT back 1 199 HALT 200 INCMP _ 1 201 @end example 202 @item @example 203 NEXT 2 fwd 204 @end example 205 @tab @example 206 MNEXT fwd 2 207 HALT 208 INCMP > 2 209 @end example 210 @item @example 211 PREVIOUS 3 back 212 @end example 213 @tab @example 214 MPREV back 3 215 HALT 216 INCMP < 3 217 @end example 218 @item @example 219 DOWN foo 0 to_foo 220 UP 1 back 221 @end example 222 @tab @example 223 MOUT to_foo 0 224 MOUT back 1 225 HALT 226 INCMP foo 0 227 INCMP _ 1 228 @end example 229 @end multitable