-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassert.C
executable file
·45 lines (34 loc) · 1.24 KB
/
assert.C
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
/*
File: assert.C
Author: R. Bettati
Department of Computer Science
Texas A&M University
Date : 05/01/23
Implementation of the assert() function.
*/
/*--------------------------------------------------------------------------*/
/* DEFINES */
/*--------------------------------------------------------------------------*/
/* -- (none) -- */
/*--------------------------------------------------------------------------*/
/* INCLUDES */
/*--------------------------------------------------------------------------*/
#include "assert.H"
#include "utils.H"
#include "console.H"
/*--------------------------------------------------------------------------*/
/* _assert() FUNCTION: gets called when assert() macro fails. */
/*--------------------------------------------------------------------------*/
void _assert (const char* _file, const int _line, const char* _message ) {
/* Prints current file, line number, and failed assertion. */
char temp[15];
Console::puts("Assertion failed at file: ");
Console::puts(_file);
Console::puts(" line: ");
int2str(_line, temp);
Console::puts(temp);
Console::puts(" assertion: ");
Console::puts(_message);
Console::puts("\n");
abort();
}/* end _assert */