HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EX_Error.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: Error handling for EXPR (EXPR Library, C++)
7  *
8  * COMMENTS: Functions in this file are implemented in evparse.C
9  */
10 
11 #ifndef __EX_ERROR_H__
12 #define __EX_ERROR_H__
13 
14 #include "EXPR_API.h"
16 
17 
18 #define EV_NOERROR 0 /* No error */
19 #define EV_ERRSYNTAX 1 /* Syntax error */
20 #define EV_ERRBRACING 2 /* Bracing error */
21 #define EV_ERRNOFUNC 3 /* Unknown function */
22 #define EV_ERRNOOP 4 /* Unknown operator */
23 #define EV_ERRBADTYPE 5 /* Unknown operator */
24 #define EV_ERRBADARGS 6 /* Invalid number of arguments */
25 #define EV_ERRUNKNOWN 7 /* Unknown error */
26 #define EV_ERRRECURSION 8 /* Recursion too deep */
27 #define EV_ERRSTACK 9 /* Stack error */
28 #define EV_ERRBADVAR 10 /* Undefined variable */
29 #define EV_NAN 11 // Divide by zero or something like that
30 #define EV_ERREXTRAJUNK 12 // Extra junk at end of expression
31 #define EV_ERRUNSAFEFUNC 13 // Unsafe function
32 #define EV_ERRINLINEFUNC 14 // Error in inline function
33 #define EV_ERRDEADLOCK 15 // Deadlock
34 #define EV_ERRCUSTOM 16 // Custom error text
35 
36 
37 // Simply create a namespace to hide the global TLS variable. We're doing
38 // things like this in order to allow the compiler to inline.
39 namespace EXPR
40 {
42 };
43 
44 /// Set the current errno, returning the old value
45 static inline void
46 ev_SetErrNo(int err, int thread)
47 {
48  EXPR::theErrNo.getValueForThread(thread) = err;
49 }
50 
51 /// Retrieve the errno for the given thread
52 static inline int
53 ev_GetErrNo(int thread)
54 {
55  return EXPR::theErrNo.getValueForThread(thread);
56 }
57 
58 /// Retrieve a string representing the error
59 EXPR_API extern const char *ev_GetErrorText(int error_number);
60 /// Sets an error, EV_ERRCUSTOM, using the given custom message as the text
61 EXPR_API extern void ev_SetCustomErrorMessage(const char *message,
62  int thread);
63 /// Clears the cycle detected flag for a particular thread. This will force
64 /// a more expensive check for cycles next time, but allows us to clear away
65 /// recursion errors that we dont care about.
66 EXPR_API extern void ev_ClearCycles(int thread);
67 
68 #endif // __EX_ERROR_H__
EXPR_API const char * ev_GetErrorText(int error_number)
Retrieve a string representing the error.
T & getValueForThread(int thread_index)
EXPR_API void ev_SetCustomErrorMessage(const char *message, int thread)
Sets an error, EV_ERRCUSTOM, using the given custom message as the text.
EXPR_API UT_ThreadSpecificValue< int > theErrNo
GLuint GLsizei const GLchar * message
Definition: glcorearb.h:2542
#define EXPR_API
Definition: EXPR_API.h:10
EXPR_API void ev_ClearCycles(int thread)