-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.c
More file actions
54 lines (45 loc) · 1.46 KB
/
Copy patherrors.c
File metadata and controls
54 lines (45 loc) · 1.46 KB
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
#include "errors.h"
#include "types.h"
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
void err_undeclared(const char *symbol, uint32_t line)
{
fprintf(stderr, "ERROR: The symbol \"%s\" from line %" PRIu32 " was not declared\n", symbol, line);
exit(ERR_UNDECLARED);
}
void err_declared(const char *symbol, uint32_t line)
{
fprintf(stderr, "ERROR: The symbol \"%s\" from line %" PRIu32 " was already used\n", symbol, line);
exit(ERR_DECLARED);
}
void err_variable(const char *symbol, uint32_t line)
{
fprintf(stderr, "ERROR: The symbol \"%s\" from line %" PRIu32 " is not a function\n", symbol, line);
exit(ERR_VARIABLE);
}
void err_function(const char *symbol, uint32_t line)
{
fprintf(stderr, "ERROR: The symbol \"%s\" from line %" PRIu32 " is a function\n", symbol, line);
exit(ERR_FUNCTION);
}
void err_wrong_type(const char *symbol, uint32_t line)
{
fprintf(stderr, "ERROR: The symbol \"%s\" from line %" PRIu32 " does not match the type\n", symbol, line);
exit(ERR_WRONG_TYPE);
}
void err_missing_args()
{
fprintf(stderr, "ERROR: There are missing args in this function call\n");
exit(ERR_MISSING_ARGS);
}
void err_excess_args()
{
fprintf(stderr, "ERROR: This function call has too many args\n");
exit(ERR_EXCESS_ARGS);
}
void err_wrong_type_args(Type type)
{
fprintf(stderr, "ERROR: The type \"%s\" does not match the expected function argument type\n", TYPE_LOOKUP[type]);
exit(ERR_WRONG_TYPE_ARGS);
}