Synopsis
typedef enum {
NB_TYPE_INTEGER,
NB_TYPE_FLOAT,
NB_TYPE_COMPLEX,
NB_TYPE_QUATERNION,
NB_TYPE_STRING,
NB_TYPE_ARRAY,
NB_TYPE_PROC,
NB_TYPE_OBJECT,
NB_TYPE_REF,
NB_TYPE_DEFER,
NB_TYPE_MATRIX,
NB_TYPE_PROGRAM,
NB_TYPE_FREE,
NB_TYPE_SENTINEL
} nb_cell_type_t;
Integer, float, and reference objects take one cell and can
be held on the evaluation stack. Other objects (array, string,
and program) are only held in memory and can span multiple
object cells. Free cells are set to NB_TYPE_FREE so that the
garbage collector can skip over them.
The ordering of these is specific in that the four language-level
types that the user sees come first so that dispatching of operators
based on type can be done by indexing a table of function pointers.
-
NB_TYPE_INTEGER
- A 32-bit signed integer.
-
NB_TYPE_FLOAT
- A 32-bit floating point value.
-
NB_TYPE_COMPLEX
- A complex number spanning two cells.
-
NB_TYPE_QUATERNION
- A quaternion spanning four cells.
-
NB_TYPE_STRING
- A multi-cell string value.
-
NB_TYPE_ARRAY
- A multi-cell array value.
-
NB_TYPE_PROC
- A procedure. This isn't directly accessible.
-
NB_TYPE_OBJECT
- An object. This isn't directly accessible.
-
NB_TYPE_REF
- A reference to string, array, complex, or quaternion.
-
NB_TYPE_DEFER
- A deferred expression.
-
NB_TYPE_MATRIX
- A two-dimensional array of real values. This type is internal, has a short
life, and and is not exposed to the user.
-
NB_TYPE_PROGRAM
- The application program stored in object array. There is exactly one
of these over the whole object array.
-
NB_TYPE_FREE
- An unused run of cells in the heap.
-
NB_TYPE_SENTINEL
- The sentinel marker. There is exactly one sentinel cell, the last cell
of the memory array, with index NB_SENTINEL_INDEX. This cell marks
the end of the cell array.