298f57748a9aee42ce01e235973964668f203bfc
[scilab.git] / scilab / modules / core / src / c / GetExceptionCode.c
1 #include "GetExceptionCode.h"
2 /* Allan CORNET */
3 /* INRIA 2005 */
4 #include <string.h>
5 /*-----------------------------------------------------------------------------------*/
6 char *GetExceptionString(DWORD ExceptionCode)
7 {
8         char *StringOuput=(char *)MALLOC((strlen("EXCEPTION_NONCONTINUABLE_EXCEPTION")+1)*sizeof(char));
9                 
10         switch (ExceptionCode) 
11         {
12                 case EXCEPTION_ACCESS_VIOLATION:
13                         wsprintf(StringOuput,"%s","EXCEPTION_ACCESS_VIOLATION");
14                 break;
15                 case EXCEPTION_DATATYPE_MISALIGNMENT:
16                         wsprintf(StringOuput,"%s","EXCEPTION_DATATYPE_MISALIGNMENT");
17                 break;                  
18                 case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
19                         wsprintf(StringOuput,"%s","EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
20                 break;                  
21                 case EXCEPTION_IN_PAGE_ERROR:
22                         wsprintf(StringOuput,"%s","EXCEPTION_IN_PAGE_ERROR");
23                 break;                  
24                 case EXCEPTION_GUARD_PAGE:
25                         wsprintf(StringOuput,"%s","EXCEPTION_GUARD_PAGE");
26                         break;
27                 case EXCEPTION_STACK_OVERFLOW:
28                         wsprintf(StringOuput,"%s","EXCEPTION_STACK_OVERFLOW");
29                 break;                  
30                 case EXCEPTION_ILLEGAL_INSTRUCTION:
31                         wsprintf(StringOuput,"%s","EXCEPTION_ILLEGAL_INSTRUCTION");
32                 break;                  
33                 case EXCEPTION_PRIV_INSTRUCTION:
34                         wsprintf(StringOuput,"%s","EXCEPTION_PRIV_INSTRUCTION");
35                 break;                  
36                 case EXCEPTION_INVALID_DISPOSITION:
37                         wsprintf(StringOuput,"%s","EXCEPTION_INVALID_DISPOSITION");
38                 break;                  
39                 case EXCEPTION_NONCONTINUABLE_EXCEPTION:
40                         wsprintf(StringOuput,"%s","EXCEPTION_NONCONTINUABLE_EXCEPTION");
41                 break;                  
42                 case EXCEPTION_BREAKPOINT:
43                         wsprintf(StringOuput,"%s","EXCEPTION_BREAKPOINT");
44                 break;                  
45                 case EXCEPTION_SINGLE_STEP:
46                         wsprintf(StringOuput,"%s","EXCEPTION_SINGLE_STEP");
47                 break;                  
48                 case EXCEPTION_INVALID_HANDLE:
49                         wsprintf(StringOuput,"%s","EXCEPTION_INVALID_HANDLE");
50                 break;                  
51                 case EXCEPTION_INT_DIVIDE_BY_ZERO:
52                         wsprintf(StringOuput,"%s","EXCEPTION_INT_DIVIDE_BY_ZERO");
53                 break;                  
54                 case EXCEPTION_INT_OVERFLOW:
55                         wsprintf(StringOuput,"%s","EXCEPTION_INT_OVERFLOW");
56                 break;                  
57                 case EXCEPTION_FLT_DENORMAL_OPERAND:
58                         wsprintf(StringOuput,"%s","EXCEPTION_FLT_DENORMAL_OPERAND");
59                 break;                  
60                 case EXCEPTION_FLT_DIVIDE_BY_ZERO:
61                         wsprintf(StringOuput,"%s","EXCEPTION_FLT_DIVIDE_BY_ZERO");
62                 break;                  
63                 case EXCEPTION_FLT_INEXACT_RESULT:
64                         wsprintf(StringOuput,"%s","EXCEPTION_FLT_INEXACT_RESULT");
65                 break;                  
66                 case EXCEPTION_FLT_INVALID_OPERATION:
67                         wsprintf(StringOuput,"%s","EXCEPTION_FLT_INVALID_OPERATION");
68                 break;                  
69                 case EXCEPTION_FLT_OVERFLOW:
70                         wsprintf(StringOuput,"%s","EXCEPTION_FLT_OVERFLOW");
71                 break;                  
72                 case EXCEPTION_FLT_STACK_CHECK:
73                         wsprintf(StringOuput,"%s","EXCEPTION_FLT_STACK_CHECK");
74                 break;                  
75                 case EXCEPTION_FLT_UNDERFLOW:
76                         wsprintf(StringOuput,"%s","EXCEPTION_FLT_UNDERFLOW");
77                 break;
78                 default:
79                 wsprintf(StringOuput,"%s",_("Unknown exception"));
80                 break;                          
81   }
82
83         return StringOuput;
84 }
85 /*-----------------------------------------------------------------------------------*/