3 <!-- Created by texi2html 1.56k from cln.texi on 4 May 2000 -->
5 <TITLE>CLN, a Class Library for Numbers - 12. Customizing</TITLE>
8 Go to the <A HREF="cln_1.html">first</A>, <A HREF="cln_11.html">previous</A>, <A HREF="cln_13.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.
12 <H1><A NAME="SEC68" HREF="cln_toc.html#TOC68">12. Customizing</A></H1>
19 <H2><A NAME="SEC69" HREF="cln_toc.html#TOC69">12.1 Error handling</A></H2>
22 When a fatal error occurs, an error message is output to the standard error
23 output stream, and the function <CODE>cl_abort</CODE> is called. The default
24 version of this function (provided in the library) terminates the application.
25 To catch such a fatal error, you need to define the function <CODE>cl_abort</CODE>
26 yourself, with the prototype
29 #include <cl_abort.h>
35 This function must not return control to its caller.
40 <H2><A NAME="SEC70" HREF="cln_toc.html#TOC70">12.2 Floating-point underflow</A></H2>
46 Floating point underflow denotes the situation when a floating-point number
47 is to be created which is so close to <CODE>0</CODE> that its exponent is too
48 low to be represented internally. By default, this causes a fatal error.
49 If you set the global variable
52 cl_boolean cl_inhibit_floating_point_underflow
56 to <CODE>cl_true</CODE>, the error will be inhibited, and a floating-point zero
57 will be generated instead. The default value of
58 <CODE>cl_inhibit_floating_point_underflow</CODE> is <CODE>cl_false</CODE>.
63 <H2><A NAME="SEC71" HREF="cln_toc.html#TOC71">12.3 Customizing I/O</A></H2>
66 The output of the function <CODE>fprint</CODE> may be customized by changing the
67 value of the global variable <CODE>cl_default_print_flags</CODE>.
73 <H2><A NAME="SEC72" HREF="cln_toc.html#TOC72">12.4 Customizing the memory allocator</A></H2>
76 Every memory allocation of CLN is done through the function pointer
77 <CODE>cl_malloc_hook</CODE>. Freeing of this memory is done through the function
78 pointer <CODE>cl_free_hook</CODE>. The default versions of these functions,
79 provided in the library, call <CODE>malloc</CODE> and <CODE>free</CODE> and check
80 the <CODE>malloc</CODE> result against <CODE>NULL</CODE>.
81 If you want to provide another memory allocator, you need to define
82 the variables <CODE>cl_malloc_hook</CODE> and <CODE>cl_free_hook</CODE> yourself,
86 #include <cl_malloc.h>
87 void* (*cl_malloc_hook) (size_t size) = ...;
88 void (*cl_free_hook) (void* ptr) = ...;
94 The <CODE>cl_malloc_hook</CODE> function must not return a <CODE>NULL</CODE> pointer.
98 It is not possible to change the memory allocator at runtime, because
99 it is already called at program startup by the constructors of some
104 Go to the <A HREF="cln_1.html">first</A>, <A HREF="cln_11.html">previous</A>, <A HREF="cln_13.html">next</A>, <A HREF="cln_13.html">last</A> section, <A HREF="cln_toc.html">table of contents</A>.