]> www.ginac.de Git - cln.git/blob - doc/cln_12.html
- Added lots of @cindex to produce an index.
[cln.git] / doc / cln_12.html
1 <HTML>
2 <HEAD>
3 <!-- Created by texi2html 1.56k from cln.texi on 4 May 2000 -->
4
5 <TITLE>CLN, a Class Library for Numbers - 12. Customizing</TITLE>
6 </HEAD>
7 <BODY>
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>.
9 <P><HR><P>
10
11
12 <H1><A NAME="SEC68" HREF="cln_toc.html#TOC68">12. Customizing</A></H1>
13 <P>
14 <A NAME="IDX316"></A>
15
16
17
18
19 <H2><A NAME="SEC69" HREF="cln_toc.html#TOC69">12.1 Error handling</A></H2>
20
21 <P>
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
27
28 <PRE>
29 #include &#60;cl_abort.h&#62;
30 void cl_abort (void);
31 </PRE>
32
33 <P>
34 <A NAME="IDX317"></A>
35 This function must not return control to its caller.
36
37
38
39
40 <H2><A NAME="SEC70" HREF="cln_toc.html#TOC70">12.2 Floating-point underflow</A></H2>
41 <P>
42 <A NAME="IDX318"></A>
43
44
45 <P>
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
50
51 <PRE>
52 cl_boolean cl_inhibit_floating_point_underflow
53 </PRE>
54
55 <P>
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>.
59
60
61
62
63 <H2><A NAME="SEC71" HREF="cln_toc.html#TOC71">12.3 Customizing I/O</A></H2>
64
65 <P>
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>.
68 <A NAME="IDX319"></A>
69
70
71
72
73 <H2><A NAME="SEC72" HREF="cln_toc.html#TOC72">12.4 Customizing the memory allocator</A></H2>
74
75 <P>
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,
83 like this:
84
85 <PRE>
86 #include &#60;cl_malloc.h&#62;
87 void* (*cl_malloc_hook) (size_t size) = ...;
88 void (*cl_free_hook) (void* ptr)      = ...;
89 </PRE>
90
91 <P>
92 <A NAME="IDX320"></A>
93 <A NAME="IDX321"></A>
94 The <CODE>cl_malloc_hook</CODE> function must not return a <CODE>NULL</CODE> pointer.
95
96
97 <P>
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
100 global variables.
101
102
103 <P><HR><P>
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>.
105 </BODY>
106 </HTML>