| 
									
										
										
										
											2008-06-04 03:00:14 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2008-06-07 07:00:39 +00:00
										 |  |  |  * $Id: assert.c 194 2008-06-06 13:00:39Z baconevi $ | 
					
						
							| 
									
										
										
										
											2008-06-04 03:00:14 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-07 04:19:57 +00:00
										 |  |  | #include <ase/cmn/types.h>
 | 
					
						
							|  |  |  | #include <ase/cmn/macros.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-04 03:00:14 +00:00
										 |  |  | #ifndef NDEBUG
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-07 04:19:57 +00:00
										 |  |  | #include <ase/cmn/stdio.h>
 | 
					
						
							| 
									
										
										
										
											2008-06-04 03:00:14 +00:00
										 |  |  | #include <stdlib.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-07 04:19:57 +00:00
										 |  |  | int ase_assert_failed ( | 
					
						
							|  |  |  | 	const ase_char_t* expr, const ase_char_t* desc,  | 
					
						
							|  |  |  | 	const ase_char_t* file, ase_size_t line) | 
					
						
							| 
									
										
										
										
											2008-06-04 03:00:14 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-06-07 04:19:57 +00:00
										 |  |  | 	if (desc == ASE_NULL) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		ase_fprintf ( | 
					
						
							|  |  |  | 			ASE_STDERR, | 
					
						
							|  |  |  | 			ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n"), | 
					
						
							|  |  |  | 			file, (unsigned long)line, expr); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		ase_fprintf ( | 
					
						
							|  |  |  | 			ASE_STDERR, | 
					
						
							|  |  |  | 			ASE_T("ASSERTION FAILURE AT FILE %s LINE %lu\n%s\n\nDESCRIPTION:\n%s\n"), | 
					
						
							|  |  |  | 			file, (unsigned long)line, expr, desc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-04 03:00:14 +00:00
										 |  |  | 	abort (); | 
					
						
							| 
									
										
										
										
											2008-06-07 04:19:57 +00:00
										 |  |  | 	return 0; | 
					
						
							| 
									
										
										
										
											2008-06-04 03:00:14 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 |