-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfumoutil.h
45 lines (34 loc) · 1.01 KB
/
fumoutil.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
45
// -- fumosay: fumoutil.h --
// like cowsay, but with funky fumos!
// Fumo Utilities: Search, expressions, and other fumo related stuff
#ifndef FUMO_UTIL_H
#define FUMO_UTIL_H
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define ALPHABET 128
#define WORDLEN 63
#ifndef __COSMOCC__
// we use arc4random because FAIRNESS (also fancy)
#define random_clamped(x) arc4random_uniform(x)
#else
// cosmos doesn't have it, so good ol' random() will do
#define random_clamped(x) (random() % (x))
#endif
typedef struct color {
short R; short G; short B;
} color;
typedef struct fumo_data {
char *fumo; // fumo ascii art
color color; // [object Object]
char *name[]; // all the names
} fumo_data;
typedef int fumo_who;
fumo_who fumo_picker(char *str);
void fumo_expr(fumo_who fm, char ex, char *custom);
void fumo_list();
void fumo_fumo(fumo_who fm, int (*fumo_say)(const char *, FILE *));
void fumo_panic(char *, char, char *);
int bitap(char *haystack, char *needle, int max_dist);
#endif