Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
Lists

Lists are chains of atoms (including sublists). List atoms are actually the nodes which connect other atoms (called list elements).

Structures

Every list node keeps track of the data atom associated with the node and the next node of the chain. List atoms are used to represent Logo lists [...]. The number of nodes in a list is limited only by the available memory. Use IS_LIST() macro to check whether the atom is list node. Lists for which the FLAG_EXPRESSION flag is set are considered as expressions and are printed framed in parentheses (...).

Use IS_LIST() macro to check whether the atom is a list node. Use IS_EMPTY() and IS_NOT_EMPTY() to check whether a list is (or is not) the empty list. Use CAR() to get the atom associated with te node and CDR() to get the next node of the list.

lists_structure.png
LIST atom structure

Some list atoms use larger blocks. These list atoms have their FLAG_EXTENDED_NODE. Use IS_EXTENDED() macro to check for such atoms. The first 16 bytes of an extended atom have the same structure as the notmal list atoms. The extra pointer can be access with the POS() macro. The info node for each sublist is an extended list atom. Its POS() points to a subword containing the source of the sublist including initial [ and final ]. This can be used for reporting errors at the correct position.

lists_ex_structure.png
LIST atom structure

Flags

List atoms have bitmask flags which provides additional information about the data node. The following flags are used for data nodes containing words and subwords:

  • FLAG_NEWLINE - the data node is the first one in the current line
  • FLAG_AFTER_SPACE - the data node is after a whitespace
  • FLAG_BEFORE_SPACE - the data node is before a whitespace
  • FLAG_EXPRESSION - the data node starts an expression. Expressions are list which are printed out with parentheses ( ) instead of square brackets [ ].
  • FLAG_TOKENIZED_DATA - the data node is already tokenized as data. Note that this flag refers to the data node, but is stored in the list node.
  • FLAG_TOKENIZED_COMMANDS - the data node is already tokenized as commands. Note that this flag refers to the data node, but is stored in the list node.
  • FLAG_EXTENDED_NODE - the list node uses an extended atom.

[ HOME | INDEX | ATOMS | VARS | REFERENCE ]
Lhogho Developer's Documentation
Wed Jul 10 2013