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, as well as the garbage collector. Reclamation of all objects associated with an nx instance is managed by a garbage collector, so when an nx is destroyed, all associated objects are deallocated.

### 4.10.8.1 API

cw_nx_t * nx_new(cw_nx_t *a_nx, cw_op_t *a_thread_init, int a_argc, char **a_argv, char **a_envp):

  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_argc:
      Number of command line arguments.
    a_argv:
      Pointer to an array of command line argument strings.
    a_envp:
      Pointer to an array of environment variable strings.
  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_nxa_t * nx_nxa_get(cw_nx_t *a_nx):

  Input(s):
      Pointer to an nx.
  Output(s):
    retval:
      Pointer to an nxa.
  Exception(s):
    None.
  Description:
    Return a pointer to the garbage collector.

cw_mema_t * nx_mema_get(cw_nx_t *a_nx):

  Input(s):
      Pointer to an nx.
  Output(s):
    retval:
      Pointer to an mema.
  Exception(s):
    None.
  Description:
    Return a pointer to a memory allocator that encapsulates the garbage collector allocator functions.

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_envdict_get(cw_nx_t *a_nx):

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

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