Registering the new type

Once a STk_extended_scheme_type structure is defined, the new type can be registered into the interpreter. Registering a new type is done by the STk_add_new_type function. The prototype of this function is given below
\begin{Code}
\begin{listing}[200]{2}
int STk_add_new_type(STk_extended_scheme_type *p)
\end{listing}\end{Code}
The integer returned by this function is the (unique) key associated to the new type. This key is stored in each cell of the new type.

We have now enough material to define the STk_extended_scheme_type for the new type stack. This declaration can be done in the following way:
\begin{Code}
\begin{listing}[200]{2}
static void mark_stack(SCM p);
static void ...
...y_stack(SCM s, SCM port, int mode);
static int tc_stack;
\end{listing}\end{Code}

\begin{Code}
\begin{listing}[200]{2}
static STk_extended_scheme_type stack_type ...
...ULL, /* apply_fct */
display_stack /* display_fct */
};
\end{listing}\end{Code}

This definition tells the interpreter that the new type is not a procedure (field is_procp is set to 0). Consequently, the apply_fct is set to NULL. Note that a display function is provided here. It permits to used a customized printing function.