Subversion Repositories Kolibri OS

Rev

Rev 7597 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7597 Rev 7693
Line 5... Line 5...
5
    All rights reserved.
5
    All rights reserved.
6
*)
6
*)
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
MODULE ERRORS;
8
MODULE ERRORS;
Line 9... Line 9...
9
 
9
 
10
IMPORT C := CONSOLE, UTILS;
10
IMPORT C := CONSOLE, UTILS, mConst := CONSTANTS;
11
 
11
 
12
 
12
 
13
PROCEDURE hintmsg* (name: ARRAY OF CHAR; line, col, hint: INTEGER);
13
PROCEDURE HintMsg* (name: ARRAY OF CHAR; line, col, hint: INTEGER);
14
BEGIN
14
BEGIN
15
    IF hint = 0 THEN
15
    IF hint = 0 THEN
Line -... Line 16...
-
 
16
        C.String("  hint ("); C.Int(line); C.String(":"); C.Int(col); C.String(") ");
-
 
17
        C.String("variable '"); C.String(name); C.StringLn("' never used")
-
 
18
    END
-
 
19
END HintMsg;
-
 
20
 
-
 
21
 
-
 
22
PROCEDURE WarningMsg* (line, col, warning: INTEGER);
-
 
23
BEGIN
-
 
24
    C.String("  warning ("); C.Int(line); C.String(":"); C.Int(col); C.String(") ");
-
 
25
    CASE warning OF
16
        C.String("  hint ("); C.Int(line); C.String(":"); C.Int(col); C.String(")");
26
    |0: C.StringLn("passing a string value as a fixed array")
17
        C.String(" variable '"); C.String(name); C.StringLn("' never used")
27
    |1: C.StringLn("endless FOR loop")
18
    END
28
    END
Line 19... Line 29...
19
END hintmsg;
29
END WarningMsg;
20
 
30
 
21
 
31
 
Line 22... Line 32...
22
PROCEDURE errormsg* (fname: ARRAY OF CHAR; line, col, errno: INTEGER);
32
PROCEDURE ErrorMsg* (fname: ARRAY OF CHAR; line, col, errno: INTEGER);
23
VAR
33
VAR
24
    str: ARRAY 80 OF CHAR;
34
    str: ARRAY 80 OF CHAR;
25
 
35
 
26
BEGIN
36
BEGIN
27
    C.Ln;
37
    C.Ln;
28
    C.String("  error ("); C.Int(line); C.String(":"); C.Int(col); C.String(") ");
38
    C.String("  error  ("); C.Int(errno); C.String(") ("); C.Int(line); C.String(":"); C.Int(col); C.String(") ");
29
 
39
 
30
    CASE errno OF
40
    CASE errno OF
-
 
41
    |  1: str := "missing 'H' or 'X'"
Line 31... Line 42...
31
    |  1: str := "missing 'H' or 'X'"
42
    |  2: str := "missing scale"
32
    |  2: str := "missing scale"
43
    |  3: str := "unclosed string"
33
    |  3: str := "unclosed string"
44
    |  4: str := "illegal character"
34
    |  4: str := "illegal character"
45
    |  5: str := "string too long"
Line 77... Line 88...
77
    | 58: str := "not a record type"
88
    | 58: str := "not a record type"
78
    | 59: str := "this expression cannot be a procedure"
89
    | 59: str := "this expression cannot be a procedure"
79
    | 60: str := "identifier does not match procedure name"
90
    | 60: str := "identifier does not match procedure name"
80
    | 61: str := "illegally marked identifier"
91
    | 61: str := "illegally marked identifier"
81
    | 62: str := "expression should be constant"
92
    | 62: str := "expression should be constant"
82
    | 63: str := "'stdcall', 'ccall', 'ccall16', 'windows' or 'linux' expected"
93
    | 63: str := "not enough RAM"
83
    | 64: str := "'(' expected"
94
    | 64: str := "'(' expected"
84
    | 65: str := "',' expected"
95
    | 65: str := "',' expected"
85
    | 66: str := "incompatible parameter"
96
    | 66: str := "incompatible parameter"
86
    | 67: str := "'OF' expected"
97
    | 67: str := "'OF' expected"
87
    | 68: str := "type expected"
98
    | 68: str := "type expected"
Line 124... Line 135...
124
    |105: str := "access to intermediate variables not allowed"
135
    |105: str := "access to intermediate variables not allowed"
125
    |106: str := "qualified identifier expected"
136
    |106: str := "qualified identifier expected"
126
    |107: str := "too large parameter of CHR"
137
    |107: str := "too large parameter of CHR"
127
    |108: str := "a variable or a procedure expected"
138
    |108: str := "a variable or a procedure expected"
128
    |109: str := "expression should be constant"
139
    |109: str := "expression should be constant"
129
    |110: str := "'noalign' expected"
-
 
-
 
140
 
130
    |111: str := "record [noalign] cannot have a base type"
141
    |111: str := "record [noalign] cannot have a base type"
131
    |112: str := "record [noalign] cannot be a base type"
142
    |112: str := "record [noalign] cannot be a base type"
132
    |113: str := "result type of procedure should not be REAL"
143
    |113: str := "result type of procedure should not be REAL"
133
    |114: str := "identifiers 'lib_init' and 'version' are reserved"
144
    |114: str := "identifiers 'lib_init' and 'version' are reserved"
134
    |115: str := "recursive constant definition"
145
    |115: str := "recursive constant definition"
135
    |116: str := "procedure too deep nested"
146
    |116: str := "procedure too deep nested"
136
    |117: str := "'stdcall64', 'win64', 'systemv', 'windows' or 'linux' expected"
-
 
137
    |118: str := "this flag for Windows only"
-
 
138
    |119: str := "this flag for Linux only"
-
 
-
 
147
 
139
    |120: str := "too many formal parameters"
148
    |120: str := "too many formal parameters"
-
 
149
 
-
 
150
    |122: str := "negative divisor"
-
 
151
    |123: str := "illegal flag"
-
 
152
    |124: str := "unknown flag"
-
 
153
    |125: str := "flag not supported"
140
    END;
154
    END;
141
    C.StringLn(str);
155
    C.StringLn(str);
142
    C.String("  file:  ");  C.StringLn(fname);
156
    C.String("  file:  ");  C.StringLn(fname);
143
    UTILS.Exit(1)
157
    UTILS.Exit(1)
144
END errormsg;
158
END ErrorMsg;
Line 145... Line 159...
145
 
159
 
146
 
160
 
147
PROCEDURE error1* (s1: ARRAY OF CHAR);
161
PROCEDURE Error1 (s1: ARRAY OF CHAR);
148
BEGIN
162
BEGIN
149
    C.Ln;
163
    C.Ln;
150
    C.StringLn(s1);
164
    C.StringLn(s1);
Line 151... Line 165...
151
    UTILS.Exit(1)
165
    UTILS.Exit(1)
152
END error1;
166
END Error1;
153
 
167
 
154
 
168
 
155
PROCEDURE error3* (s1, s2, s3: ARRAY OF CHAR);
169
PROCEDURE Error3 (s1, s2, s3: ARRAY OF CHAR);
156
BEGIN
170
BEGIN
Line 157... Line 171...
157
    C.Ln;
171
    C.Ln;
158
    C.String(s1); C.String(s2); C.StringLn(s3);
172
    C.String(s1); C.String(s2); C.StringLn(s3);
159
    UTILS.Exit(1)
173
    UTILS.Exit(1)
160
END error3;
174
END Error3;
161
 
175
 
162
 
176
 
-
 
177
PROCEDURE Error5 (s1, s2, s3, s4, s5: ARRAY OF CHAR);
-
 
178
BEGIN
-
 
179
    C.Ln;
-
 
180
    C.String(s1); C.String(s2); C.String(s3); C.String(s4); C.StringLn(s5);
-
 
181
    UTILS.Exit(1)
-
 
182
END Error5;
-
 
183
 
-
 
184
 
-
 
185
PROCEDURE WrongRTL* (ProcName: ARRAY OF CHAR);
-
 
186
BEGIN
-
 
187
    Error5("procedure ", mConst.RTL_NAME, ".", ProcName, " not found")
-
 
188
END WrongRTL;
-
 
189
 
-
 
190
 
-
 
191
PROCEDURE BadParam* (param: ARRAY OF CHAR);
-
 
192
BEGIN
-
 
193
    Error3("bad parameter: ", param, "")
-
 
194
END BadParam;
-
 
195
 
-
 
196
 
-
 
197
PROCEDURE FileNotFound* (Path, Name, Ext: ARRAY OF CHAR);
-
 
198
BEGIN
-
 
199
    Error5("file ", Path, Name, Ext, " not found")
-
 
200
END FileNotFound;
-
 
201
 
-
 
202
 
-
 
203
PROCEDURE Error* (n: INTEGER);
-
 
204
BEGIN
-
 
205
    CASE n OF
-
 
206
    |201: Error1("writing file error")
-
 
207
    |202: Error1("too many relocations")
-
 
208
    |203: Error1("size of program is too large")
Line 163... Line 209...
163
PROCEDURE error5* (s1, s2, s3, s4, s5: ARRAY OF CHAR);
209
    |204: Error1("size of global variables is too large")
164
BEGIN
210
    |205: Error1("not enough parameters")