-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcommon.h
43 lines (34 loc) · 941 Bytes
/
common.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
#ifndef _BEAN_COMMON_H
#define _BEAN_COMMON_H
#include <stdlib.h>
#include <stdint.h>
#include <limits.h>
#include "bean.h"
#define bool char
#define byte char
#define bean_Number double
typedef unsigned char bu_byte;
typedef signed char bs_byte;
#define true 1
#define false 0
#define UNUSED __attribute__ ((unused))
typedef struct parser Parser;
typedef struct vm VM;
#define cast(t, exp) ((t)(exp))
#define cast_int(i) cast(int, (i))
#define cast_char(i) cast(char, (i))
#define cast_charp(i) cast(char *, (i))
#define cast_uchar(i) cast(unsigned char, (i))
#define cast_uint(i) cast(unsigned int, (i))
#define cast_byte(i) cast(bu_byte, (i))
#define cast_sizet(i) cast(size_t, (i))
#define MAX_SIZET (~cast_sizet(0))
#define BEAN_IDSIZE 60
#define COMMON_POINTER_SIZE sizeof(void *)
#if defined(DEBUG)
#include <assert.h>
#define bean_assert(c) assert(c)
#else
#define bean_assert(c) ((void)0)
#endif
#endif