4.10.8 nx
Keywords: onyx

Next: 4.10.9 nxa Up: 4.10 Classes Previous: 4.10.7 mtx Contents Index
Subsections

- 4.10.8.1 API

##
4.10.8 nx

The nx class encapsulates an Onyx interpreter instance. It contains a number of interpreter-global objects. The garbage collector is shared among all nx instances, so when an nx is destroyed, only the objects which no other nx references are destroyed.

### 4.10.8.1 API

void cw_thread_start_t(cw_nxo_t *a_thread, cw_op_t *a_start):

  Input(s):
    a_thread:
      Pointer to a thread nxo.
    a_start:
      Pointer to a start function.
  Output(s):
    None.
  Exception(s):
    Application dependent.
  Description:
    Type definition for a callback function that is called by nxo_thread_start(). This function must call a_start, which is the actual start function.

    The main use for a start callback function is to create a top level xep exception handling context for each thread.

cw_nx_t * nx_new(cw_nx_t *a_nx, cw_op_t *a_thread_init, cw_thread_start_t *a_thread_start):

  Input(s):
    a_nx:
      Pointer to space for an nx, or NULL.
    a_thread_init:
      Pointer to an initialization function to be called during thread initialization, or NULL.
    a_thread_start:
      Pointer to a thread start callback function to be called by nxo_thread_start(), or NULL. See the cw_thread_start_t documentation for details.
  Output(s):
    retval:
      Pointer to an nx.
  Exception(s):
    CW_ONYXX_OOM.
  Description:
    Constructor.

void nx_delete(cw_nx_t *a_nx):

  Input(s):
      Pointer to an nx.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Destructor.

cw_nxoi_t nx_maxestack_get(cw_nx_t *a_nx):

  Input(s):
    a_nx:
      Pointer to an nx.
  Output(s):
    retval:
      Default maximum estack depth.
  Exception(s):
    None.
  Description:
    Return the default maximum allowable estack depth. This value is used when creating new threads.

void nx_maxestack_set(cw_nx_t *a_nx, cw_nxoi_t a_maxestack):

  Input(s):
    a_nx:
      Pointer to an nx.
    a_maxestack:
      Default maximum estack depth.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Set a_nx's default maximum allowable estack depth to a_maxestack.

bool nx_tailopt_get(cw_nx_t *a_nx):

  Input(s):
    a_nx:
      Pointer to an nx.
  Output(s):
    retval:
      Default tail optimization setting.
  Exception(s):
    None.
  Description:
    Return the default tail optimization setting. This value is used when creating new threads.

void nx_tailopt_set(cw_nx_t *a_nx, bool a_tailopt):

  Input(s):
    a_nx:
      Pointer to an nx.
    a_tailopt:
      Default tail optimization setting.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Set a_nx's default tail optimization setting to a_tailopt.

cw_nxo_t * nx_systemdict_get(cw_nx_t *a_nx):

  Input(s):
    a_nx:
      Pointer to an nx.
  Output(s):
    retval:
      Pointer to the nxo corresponding to systemdict .
  Exception(s):
    None.
  Description:
    Return a pointer to the nxo corresponding to systemdict .

cw_nxo_t * nx_globaldict_get(cw_nx_t *a_nx):

  Input(s):
    a_nx:
      Pointer to an nx.
  Output(s):
    retval:
      Pointer to the nxo corresponding to globaldict .
  Exception(s):
    None.
  Description:
    Return a pointer to the nxo corresponding to globaldict .

cw_nxo_t * nx_stdin_get(cw_nx_t *a_nx):

  Input(s):
    a_nx:
      Pointer to an nx.
  Output(s):
    retval:
      Pointer to the nxo corresponding to stdin .
  Exception(s):
    None.
  Description:
    Return a pointer to the nxo corresponding to stdin .

void nx_stdin_set(cw_nx_t *a_nx, cw_nxo_t *a_stdin):

  Input(s):
    a_nx:
      Pointer to an nx.
    a_stdin:
      Pointer to a file nxo.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Set a_nx's stdin to a_stdin.

cw_nxo_t * nx_stdout_get(cw_nx_t *a_nx):

  Input(s):
    a_nx:
      Pointer to an nx.
  Output(s):
    retval:
      Pointer to the nxo corresponding to stdout .
  Exception(s):
    None.
  Description:
    Return a pointer to the nxo corresponding to stdout .

void nx_stdout_set(cw_nx_t *a_nx, cw_nxo_t *a_stdout):

  Input(s):
    a_nx:
      Pointer to an nx.
    a_stdout:
      Pointer to a file nxo.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Set a_nx's stdout to a_stdout.

cw_nxo_t * nx_stderr_get(cw_nx_t *a_nx):

  Input(s):
    a_nx:
      Pointer to an nx.
  Output(s):
    retval:
      Pointer to the nxo corresponding to stderr .
  Exception(s):
    None.
  Description:
    Return a pointer to the nxo corresponding to stderr .

void nx_stderr_set(cw_nx_t *a_nx, cw_nxo_t *a_stderr):

  Input(s):
    a_nx:
      Pointer to an nx.
    a_stderr:
      Pointer to a file nxo.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Set a_nx's stderr to a_stderr.

Next: 4.10.9 nxa Up: 4.10 Classes Previous: 4.10.7 mtx Contents Index