File: error_routines.c

package info (click to toggle)
texlive-bin 2016.20160513.41080.dfsg-2+deb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 155,060 kB
  • sloc: ansic: 702,862; cpp: 222,090; perl: 76,014; sh: 23,402; makefile: 8,078; lex: 4,710; pascal: 3,782; python: 3,614; java: 3,569; yacc: 2,905; exp: 2,031; xml: 800; tcl: 670; ruby: 620; lisp: 397; sed: 351; asm: 140; csh: 48; awk: 30
file content (171 lines) | stat: -rw-r--r-- 3,904 bytes parent folder | download
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/* error_routines.c: General error routines.

This file is part of Omega,
which is based on the web2c distribution of TeX,

Copyright (c) 1994--2001 John Plaice and Yannis Haralambous

Omega is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

Omega is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Omega; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

*/

#include "cpascal.h"
#include "parser.h"
#include "error_routines.h"

int num_errors = 0;

/* Error routines:

All of the routines in this file have the same general format.
They 

*/

void
lex_error_1(const_string fmt, int item)
{
    fprintf(stderr, "line %d (lexing): ", line_number);
    fprintf(stderr, fmt, item);
    fprintf(stderr, "\n");
}

void
lex_error_s(const_string fmt, const_string item)
{
    fprintf(stderr, "line %d (lexing): ", line_number);
    fprintf(stderr, fmt, item);
    fprintf(stderr, "\n");
}

void
lex_error_s_1(const_string fmt, const_string item, int item1)
{
    fprintf(stderr, "line %d (lexing): ", line_number);
    fprintf(stderr, fmt, item, item1);
    fprintf(stderr, "\n");
}

void
yyerror(const_string fmt)
{
    fprintf(stderr, "line %d (parsing): ", line_number);
    fprintf(stderr, "%s", fmt);
    fprintf(stderr, "\n");
    num_errors++;
}


void
warning_0(const_string fmt)
{
    fprintf(stderr, "line %d (warning): ", line_number);
    fprintf(stderr, "%s", fmt);
    fprintf(stderr, "\n");
}

void
warning_1(const_string fmt, int item)
{
    fprintf(stderr, "line %d (warning): ", line_number);
    fprintf(stderr, fmt, item);
    fprintf(stderr, "\n");
}

void
warning_2(const_string fmt, int item, int item2)
{
    fprintf(stderr, "line %d (warning): ", line_number);
    fprintf(stderr, fmt, item, item2);
    fprintf(stderr, "\n");
}

void
warning_s(const_string fmt, const_string item)
{
    fprintf(stderr, "line %d (warning): ", line_number);
    fprintf(stderr, fmt, item);
    fprintf(stderr, "\n");
}

void
warning_s_1(const_string fmt, const_string item, int item1)
{
    fprintf(stderr, "line %d (warning): ", line_number);
    fprintf(stderr, fmt, item, item1);
    fprintf(stderr, "\n");
}

void
warning_s_2(const_string fmt, const_string item, int item1, int item2)
{
    fprintf(stderr, "line %d (warning): ", line_number);
    fprintf(stderr, fmt, item, item1, item2);
    fprintf(stderr, "\n");
}

void
fatal_error_0(const_string fmt)
{
    fprintf(stderr, "line %d (fatal): ", line_number);
    fprintf(stderr, "%s", fmt);
    fprintf(stderr, "\n");
    exit(1);
}

void
fatal_error_1(const_string fmt, int item)
{
    fprintf(stderr, "line %d (fatal): ", line_number);
    fprintf(stderr, fmt, item);
    fprintf(stderr, "\n");
    exit(1);
}

void
fatal_error_2(const_string fmt, int item, int item2)
{
    fprintf(stderr, "line %d (fatal): ", line_number);
    fprintf(stderr, fmt, item, item2);
    fprintf(stderr, "\n");
    exit(1);
}

void
fatal_error_s(const_string fmt, const_string  item)
{
    fprintf(stderr, "line %d (fatal): ", line_number);
    fprintf(stderr, fmt, item);
    fprintf(stderr, "\n");
    exit(1);
}

void
internal_error_0(const_string fmt)
{
    fprintf(stderr, "line %d (internal): ", line_number);
    fprintf(stderr, "%s", fmt);
    fprintf(stderr, "\n");
    exit(2);
}

void
internal_error_1(const_string fmt, int item)
{
    fprintf(stderr, "line %d (internal): ", line_number);
    fprintf(stderr, fmt, item);
    fprintf(stderr, "\n");
    exit(2);
}