-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.h
More file actions
42 lines (36 loc) · 939 Bytes
/
Copy pathcommon.h
File metadata and controls
42 lines (36 loc) · 939 Bytes
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
#ifndef BRD_COMMON_H
#define BRD_COMMON_H
#define _POSIX_C_SOURCE 200809L
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include <ctype.h>
#include <math.h>
/*
* global variables for the parser
*/
extern int skip_newlines;
extern int line_number;
extern int found_eof;
extern const char *error_message;
extern char bad_character[2];
#ifdef DEBUG
#define BARFA(fmt, ...) do { \
fprintf(stderr, "Error: " fmt "\n", __VA_ARGS__); \
fprintf(stderr, "\tat line %d\n", __LINE__); \
fprintf(stderr, "\tin function %s\n", __func__); \
fprintf(stderr, "\tin file %s\n", __FILE__); \
exit(EXIT_FAILURE); \
} while (0)
#else
#define BARFA(fmt, ...) do { \
fprintf(stderr, "Error: " fmt "\n", __VA_ARGS__); \
exit(EXIT_FAILURE); \
} while (0)
#endif
#define BARF(str) BARFA("%s", str)
#endif