summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/hitexdir/hintview/src/error.h
blob: 53401a44e055fed1eaa8cf48b50854e8ef7dd62b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*358:*/
#line 7163 "hint.w"

#ifndef _ERROR_H
#define _ERROR_H
#include <stdlib.h> 
#include <stdio.h> 
#include <setjmp.h> 
#define MAX_HERROR 1024
extern char herror_string[MAX_HERROR];
extern FILE*hlog;
extern void hint_end(void);
extern jmp_buf error_exit;

#ifdef _MSC_VER 
#define snprintf(S,N,F,...) _snprintf(S,N,F,__VA_ARGS__)
#ifndef _CONSOLE
#pragma warning(disable : 4996)
extern void hmessage(char*title,char*format,...);
#define MESSAGE(...)  hmessage("HINT",__VA_ARGS__)

extern int herror(char*title,char*msg);
#define ERROR_MESSAGE  herror("HINT ERROR",herror_string)
#endif
#endif

#ifdef __ANDROID__ 
#include <android/log.h> 

#define LOG(...)      __android_log_print(ANDROID_LOG_DEBUG,__FILE__,__VA_ARGS__)
#define MESSAGE(...)  __android_log_print(ANDROID_LOG_INFO,__FILE__, __VA_ARGS__)
#define ERROR_MESSAGE __android_log_print(ANDROID_LOG_ERROR,__FILE__,"ERROR: %s\n", herror_string)

#endif

#ifndef LOG
#define LOG(...) (fprintf(hlog,__VA_ARGS__),fflush(hlog))
#endif

#ifndef MESSAGE
#define MESSAGE(...)  (fprintf(stderr,__VA_ARGS__),fflush(stderr))
#endif

#ifndef ERROR_MESSAGE
#define ERROR_MESSAGE        fprintf(stderr,"ERROR: %s\n",herror_string)
#endif

#ifndef QUIT
#define QUIT(...)    (snprintf(herror_string,MAX_HERROR-1,__VA_ARGS__),\
                     ERROR_MESSAGE,hint_end(),longjmp(error_exit,1))
#endif


#ifndef HINT_TRY
#define HINT_TRY if ((herror_string[0]= 0,setjmp(error_exit)==0))
#endif

#endif
/*:358*/