Debian Codegraph @

texk/web2c/luatexdir/tex/errors.h

raw
1 /* errors.h
2
3 Copyright 2009 Taco Hoekwater <[email protected]>
4
5 This file is part of LuaTeX.
6
7 LuaTeX is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
11
12 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 License for more details.
16
17 You should have received a copy of the GNU General Public License along
18 with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
19
20
21 #ifndef ERRORS_H
22 # define ERRORS_H
23
24 /*
25 The global variable |interaction| has four settings, representing increasing
26 amounts of user interaction:
27 */
28
29 typedef enum {
30 batch_mode = 0, /* omits all stops and omits terminal output */
31 nonstop_mode = 1, /* omits all stops */
32 scroll_mode = 2, /* omits error stops */
33 error_stop_mode = 3, /* stops at every opportunity to interact */
34 unspecified_mode = 4, /* extra value for command-line switch */
35 } interaction_settings;
36
37 extern int interaction; /* current level of interaction */
38 extern int interactionoption; /* set from command line */
39
40 extern int defaultexitcode; /* the exit code can be overloaded */
41
42 extern void initialize_errors(void);
43
44 extern char *last_error;
45 extern char *last_lua_error;
46 extern char *last_warning_tag;
47 extern char *last_warning_str;
48 extern char *last_error_context;
49
50 extern void set_last_error_context(void);
51
52 extern void print_err(const char *s);
53 extern void print_ignored_err(const char *s);
54
55 extern void fixup_selector(boolean log_opened);
56
57 extern boolean deletions_allowed;
58 extern boolean set_box_allowed;
59 extern int history;
60 extern int error_count;
61 extern int interrupt;
62 extern boolean OK_to_interrupt;
63
64 typedef enum {
65 spotless = 0, /* |history| value when nothing has been amiss yet */
66 warning_issued = 1, /* |history| value when |begin_diagnostic| has been called */
67 error_message_issued = 2, /* |history| value when |error| has been called */
68 fatal_error_stop = 3, /* |history| value when termination was premature */
69 } error_states;
70
71 extern const char *help_line[7]; /* helps for the next |error| */
72 extern boolean use_err_help; /* should the |err_help| list be shown? */
73
74 /* these macros are just temporary, until everything is in C */
75
76 # define hlp1(A) help_line[0]=A
77 # define hlp2(A,B) help_line[1]=A; hlp1(B)
78 # define hlp3(A,B,C) help_line[2]=A; hlp2(B,C)
79 # define hlp4(A,B,C,D) help_line[3]=A; hlp3(B,C,D)
80 # define hlp5(A,B,C,D,E) help_line[4]=A; hlp4(B,C,D,E)
81 # define hlp6(A,B,C,D,E,F) help_line[5]=A; hlp5(B,C,D,E,F)
82
83 # define help0() help_line[0]=NULL /* sometimes there might be no help */
84 # define help1(A) do { help_line[1]=NULL; hlp1(A); } while (0)
85 # define help2(A,B) do { help_line[2]=NULL; hlp2(B,A); } while (0)
86 # define help3(A,B,C) do { help_line[3]=NULL; hlp3(C,B,A); } while (0)
87 # define help4(A,B,C,D) do { help_line[4]=NULL; hlp4(D,C,B,A); } while (0)
88 # define help5(A,B,C,D,E) do { help_line[5]=NULL; hlp5(E,D,C,B,A); } while (0)
89 # define help6(A,B,C,D,E,F) do { help_line[6]=NULL; hlp6(F,E,D,C,B,A); } while (0)
90
91 extern void do_final_end(void);
92 extern void jump_out(void);
93 extern void error(void);
94 extern void int_error(int n);
95 extern void normalize_selector(void);
96 extern void succumb(void);
97 extern void fatal_error(const char *s);
98 extern void overflow(const char *s, unsigned int n);
99 extern void confusion(const char *s);
100 extern void check_interrupt(void);
101 extern void pause_for_instructions(void);
102
103 extern void tex_error(const char *msg, const char **hlp);
104 extern void normal_error(const char *t, const char *p);
105 extern void normal_warning(const char *t, const char *p);
106 extern void formatted_error(const char *t, const char *fmt, ...);
107 extern void formatted_warning(const char *t, const char *fmt, ...);
108
109 extern void back_error(void);
110 extern void ins_error(void);
111 extern void flush_err(void);
112
113 extern void char_warning(internal_font_number f, int c);
114
115 extern void wrapup_backend(void);
116
117 #endif