-
Notifications
You must be signed in to change notification settings - Fork 0
/
bfi.h
34 lines (29 loc) · 969 Bytes
/
bfi.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
/*
* __ _ __ _____ _ _ ____ ____ ____
* \ \ | | / / | ___| | \ | | / __ \ / __ \ / __ \
* \ \ | | / / | |__ | \ | | | | | | | | | | | | | |
* \ \ | |/ / | __| | \ | | | | | | | | | | | | | |
* / / | |\ \ | | | |\ \| | | | | | | | | | | | | |
* / / | | \ \ | |___ | | \ | | |__| | | |__| | | |__| |
* /_/ |_| \_\ |_____| |_| \__| \____/ \____/ \____/
* /
*
* (there's no way that can be right) */
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
#include<string.h>
#include<sys/time.h>
#include<unistd.h>
#define MEM_SIZE 30000
#define MAX_PROGBUF 1048576
#define FILE_INPUT 1
/*Error definitions. */
#define ERR_BOUNDS 1
#define ERR_MEM 2
typedef struct {
char *pc;
uint8_t *base;
size_t mem_size;
} bfstate_t;
uint8_t *bf_interpret(uint8_t *mem, bfstate_t *state);