00001 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00002 * 00003 * Redistribution and use in source and binary forms, with or without 00004 * modification, are permitted provided that the following conditions are met: 00005 * 00006 * 1. Redistributions of source code must retain the above copyright notice, this 00007 * list of conditions and the following disclaimer. 00008 * 00009 * 2. Redistributions in binary form must reproduce the above copyright notice, 00010 * this list of conditions and the following disclaimer in the documentation 00011 * and/or other materials provided with the distribution. 00012 * 00013 * 3. The name of Atmel may not be used to endorse or promote products derived 00014 * from this software without specific prior written permission. 00015 * 00016 * 4. This software may only be redistributed and used in connection with an Atmel 00017 * AVR product. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00020 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00021 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00022 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00023 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00026 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00028 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00029 * 00030 */ 00031 #include <stdio.h> 00032 #include "error_management.h" 00033 00034 // private function to set an error 00035 void gestion_erreurs_set(int line, char *_file, char *_msg) 00036 { 00037 char _temp[1024]; 00038 00039 // Print the line, the file where the error come from 00040 // Also print the message 00041 sprintf(_temp, "Error !\nFile: %s\nLine: %i\n%s", _file, line, _msg); 00042 printf(_temp); 00043 // press enter... 00044 system("PAUSE"); 00045 // Exit the program 00046 exit(0); 00047 } 00048 00049 // private function to set an error with an argument (works likes a printf) 00050 void gestion_erreurs_set1(int line, char *_file, char *_msg, void *_arg1) 00051 { 00052 char _temp[1024]; 00053 00054 sprintf(_temp, _msg, _arg1); 00055 gestion_erreurs_set(line, _file, _temp); 00056 }