You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							97 lines
						
					
					
						
							3.0 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							97 lines
						
					
					
						
							3.0 KiB
						
					
					
				| <HTML> | |
| <HEAD> | |
| <!-- Created by texi2html 1.56k from cln.texi on 14 January 2000 --> | |
| 
 | |
| <TITLE>CLN, a Class Library for Numbers - 12. Customizing</TITLE> | |
| </HEAD> | |
| <BODY> | |
| 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>. | |
| <P><HR><P> | |
| 
 | |
| 
 | |
| <H1><A NAME="SEC68" HREF="cln_toc.html#TOC68">12. Customizing</A></H1> | |
| 
 | |
| 
 | |
| 
 | |
| <H2><A NAME="SEC69" HREF="cln_toc.html#TOC69">12.1 Error handling</A></H2> | |
| 
 | |
| <P> | |
| When a fatal error occurs, an error message is output to the standard error | |
| output stream, and the function <CODE>cl_abort</CODE> is called. The default | |
| version of this function (provided in the library) terminates the application. | |
| To catch such a fatal error, you need to define the function <CODE>cl_abort</CODE> | |
| yourself, with the prototype | |
| 
 | |
| <PRE> | |
| #include <cl_abort.h> | |
| void cl_abort (void); | |
| </PRE> | |
| 
 | |
| <P> | |
| This function must not return control to its caller. | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <H2><A NAME="SEC70" HREF="cln_toc.html#TOC70">12.2 Floating-point underflow</A></H2> | |
| 
 | |
| <P> | |
| Floating point underflow denotes the situation when a floating-point number | |
| is to be created which is so close to <CODE>0</CODE> that its exponent is too | |
| low to be represented internally. By default, this causes a fatal error. | |
| If you set the global variable | |
| 
 | |
| <PRE> | |
| cl_boolean cl_inhibit_floating_point_underflow | |
| </PRE> | |
| 
 | |
| <P> | |
| to <CODE>cl_true</CODE>, the error will be inhibited, and a floating-point zero | |
| will be generated instead. | |
| The default value of <CODE>cl_inhibit_floating_point_underflow</CODE> is | |
| <CODE>cl_false</CODE>. | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <H2><A NAME="SEC71" HREF="cln_toc.html#TOC71">12.3 Customizing I/O</A></H2> | |
| 
 | |
| <P> | |
| The output of the function <CODE>fprint</CODE> may be customized by changing the | |
| value of the global variable <CODE>cl_default_print_flags</CODE>. | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| <H2><A NAME="SEC72" HREF="cln_toc.html#TOC72">12.4 Customizing the memory allocator</A></H2> | |
| 
 | |
| <P> | |
| Every memory allocation of CLN is done through the function pointer | |
| <CODE>cl_malloc_hook</CODE>. Freeing of this memory is done through the function | |
| pointer <CODE>cl_free_hook</CODE>. The default versions of these functions, | |
| provided in the library, call <CODE>malloc</CODE> and <CODE>free</CODE> and check | |
| the <CODE>malloc</CODE> result against <CODE>NULL</CODE>. | |
| If you want to provide another memory allocator, you need to define | |
| the variables <CODE>cl_malloc_hook</CODE> and <CODE>cl_free_hook</CODE> yourself, | |
| like this: | |
| 
 | |
| <PRE> | |
| #include <cl_malloc.h> | |
| void* (*cl_malloc_hook) (size_t size) = ...; | |
| void (*cl_free_hook) (void* ptr)      = ...; | |
| </PRE> | |
| 
 | |
| <P> | |
| The <CODE>cl_malloc_hook</CODE> function must not return a <CODE>NULL</CODE> pointer. | |
| 
 | |
| 
 | |
| <P> | |
| It is not possible to change the memory allocator at runtime, because | |
| it is already called at program startup by the constructors of some | |
| global variables. | |
| 
 | |
| 
 | |
| <P><HR><P> | |
| 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>. | |
| </BODY> | |
| </HTML>
 |