-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_codes.h
More file actions
35 lines (31 loc) · 1.08 KB
/
Copy patherror_codes.h
File metadata and controls
35 lines (31 loc) · 1.08 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
/**
* @project IFJ17
* @file error_codes.h
* @author Petr Sopf (xsopfp00)
* @author Tomas Odehnal (xodehn08)
* @brief Constants for error codes and function for printing error message.
*/
#ifndef IFJ_ERROR_CODES_H
#define IFJ_ERROR_CODES_H
#include <stdarg.h>
#include <stdio.h>
#include "garbage_collector.h"
/**
*
*/
enum ERROR_CODES {
ERROR_SCANNER = 1, /* Lexical analysis error */
ERROR_SYNTAX = 2, /* Syntax error */
ERROR_PROG_SEM = 3, /* Semantic error in program (undefined function/variable,...) */
ERROR_TYPE_SEM = 4, /* Semantic error of type compatibility in arithmetic, string, relational,... expressions */
ERROR_OTHER_SEM = 6, /* Other semantic errors */
ERROR_INTERNAL = 99 /* Internal errors (opening files, allocating memory,...) */
};
/**
* @brief Printf error message with error code (number) and exit program.
* @param err_code Code (number) of error.
* @param msg String literal to print.
* @param ... Any number of parameters, same functionality as printf.
*/
void printErrAndExit (enum ERROR_CODES errCode, const char *msg, ...);
#endif //IFJ_ERROR_CODES_H