8.4. File tom/Block

class tom.Block

inherits

State supers: State, Conditions, Enumerator

variables

static boolean check_block_selectors;

methods


void
  load Array arguments;

Initialize the static control variables (only check_block_selectors up to now).

instance tom.Block

variables

pointer code;

Pointer to the actual code (a C function).

selector arguments;

The selector of the eval method of this block, which includes the formal argument and return types.

pointer variables;

If this block employs block variables, the variables points to a struct holding those variables.

pointer environment;

Pointer to the local variables of the enclosing method that are referenced from this block. This is not set when the block does not reference its environment; it is cleared when the environment is exited. A block that uses its environment checks upon entry to its eval method that the environment is still available.

pointer block_description;

A description of the variables in variables.

methods


id (self)
  initWithCode pointer block_c_function
       trigger selector full_arguments
       context pointer context
     variables (pointer, pointer) (vars, desc);

Designated initializer.


protected boolean (mismatch)
  arguments_fail (selector, selector) (formal, actual)
pre
  formal != actual;

Return FALSE if the arguments in the formal and actual selectors match, or match enough. Raise a program-condition for a mismatch (and return TRUE). The precondition dictates that the fast check should be done autonomously.


dynamic
  eval dynamic arguments;

Generic eval method. Faster versions, which are specialized on their arguments, are below.


void
  eval;

The first of many (similar) type-specific eval methods.


int (result)
  eval int a1;

Undocumented.


void
  eval int a1;

Undocumented.


Any (result)
  eval All a1;

Undocumented.


Any (result)
  eval;

Undocumented.


(boolean, Any) (remaining, value)
  next;

Undocumented.


void
  dealloc;

Release the memory used by this block.


void
  gc_mark_elements;

Mark the block variables if needed.


void
  invalidate;

Be informed that the block is going out of scope, invalidating the environment.