OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v5/] [software/] [CC64/] [source/] [err.cpp] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2012-2018  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
// CC64 - 'C' derived language compiler
9
//  - 64 bit CPU
10
//
11
// This source file is free software: you can redistribute it and/or modify 
12
// it under the terms of the GNU Lesser General Public License as published 
13
// by the Free Software Foundation, either version 3 of the License, or     
14
// (at your option) any later version.                                      
15
//                                                                          
16
// This source file is distributed in the hope that it will be useful,      
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
19
// GNU General Public License for more details.                             
20
//                                                                          
21
// You should have received a copy of the GNU General Public License        
22
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
23
//                                                                          
24
// ============================================================================
25
//
26
#include "stdafx.h"
27
 
28
extern int numerrs;
29
extern int total_errors;
30
extern int my_errno[80];
31
extern void closefiles();
32
 
33
static char *errtextstr[] = {
34
        "E Syntax error",
35
        "E Illegal character",
36
        "E Floating point",
37
        "E Illegal type",
38
        "E Undefined symbol",
39
        "E Duplicate symbol",
40
        "E Bad punctuation",
41
        "E Identifier expected",
42
        "E No initializer",
43
        "E Incomplete statement",
44
        "E Illegal initializer",
45
        "E Initializer size",
46
        "E Illegal class",
47
        "E block",
48
        "E No pointer",
49
        "E No function",
50
        "E No member",
51
        "E LValue required",
52
        "E Dereference",
53
        "E Mismatch",
54
        "E Expression expected",
55
        "E While/Until expected",
56
        "E Missing case statement",
57
        "E Duplicate case statement",
58
        "E Bad label",
59
        "E Preprocessor error",
60
        "E Include file",
61
        "E Can't open",
62
        "E Define",
63
        "E Expecting a catch statement",
64
        "E Bad bitfield width",
65
        "E Expression too complex",
66
        "E Asm statement too long - break into multiple statements",
67
        "E Too many case constants",
68
        "E Attempting to catch a structure - aggregates may not be caught - use a pointer to struct",
69
        "E Semaphore increment / decrement limited to 1 to 15.",
70
        "E Semaphore address must be 16 byte aligned.",
71
        "E Operator is not defined for float/double type.",
72
        "E Integer constant required.",
73
        "E Bad switch expression.",
74
        "E Not in a loop.",
75
        "E Check expression invalid",
76
        "E Bad array index",
77
        "E Too many dimensions",
78
        "E Out of predicate registers",
79
        "E Parameter list doesn't match prototype",
80
        "E Can't access private member",
81
        "E The function call signature doesn't match any of the class methods",
82
        "E Method not found",
83
        "E Out of memory",
84
        "E Too many symbols",
85
        "E Too many parameters - the compiler is limited to 20 or less",
86
        "E The 'this' pointer may only be used in a class method.",
87
        "E Bad function argument.",
88
        "E CSE Table full.",
89
        "W Unsigned branch if less than zero is always false.",
90
        "W Unsigned branch greater or equal to zero is always true.",
91
        "W Forever Infinite loop",
92
        "E Too many initilization elements for aggregate",
93
        "E Constant required.",
94
        "E A suitable type was not found initializing union.",
95
        "W Precision is being lost in the type conversion.",
96
        "E Compiler limit reached: too many trees.",
97
        "E Compiler limit reached: optimization stack full.",
98
        "E Compiler: stack empty.",
99
        "E Compiler: i-graph nodes in wrong order."
100
};
101
 
102
char *errtext(int errnum)
103
{
104
        if (errnum < 1000)
105
                return errtextstr[errnum];
106
        return "";
107
}
108
 
109
//
110
// error - print error information
111
//
112
void error(int n)
113
{
114
        if (numerrs < 80) {
115
                my_errno[numerrs++] = n;
116
                ++total_errors;
117
        }
118
        else {
119
                closefiles();
120
                exit(1);
121
        }
122
}
123
 
124
void fatal(char *str)
125
{
126
        printf(str);
127
        closefiles();
128
        getchar();
129
        exit(2);
130
}
131
 
132
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.