-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.h
44 lines (38 loc) · 859 Bytes
/
errors.h
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
#ifndef DEVILVAL_H
#define DEVILVAL_H
#include <stdio.h>
#include <stdlib.h>
typedef struct devilval {
int type;
union {
long l;
double dec;
} data;
char* err;
char* sym;
int count;
struct devilval** cell; // Correctly reference the struct using the typedef
} devilval;
enum {
DEVILVAL_NUM,
DEVILVAL_DEC,
DEVILVAL_ERR,
DEVILVAL_SYM,
DEVILVAL_SEXPR
};
enum {
DERR_DIV_ZERO,
DERR_BAD_OP,
DERR_BAD_NUM
};
// Function declarations
devilval* devilval_num(long x);
devilval* devilval_dec(double x);
devilval* devilval_err(char* m);
devilval* devilval_sym(char* s);
devilval* devilval_sexpr(void);
void devilval_del(devilval* v);
void devilval_print(devilval* v);
void devilval_println(devilval* v);
void devilval_expr_print(devilval* v, char open, char close);
#endif // DEVILVAL_H