Added smf reader routine.
[cantaveria.git] / util.h
bloba7a0feebff278613c8fbf5f39f3cadd8b1d71497
1 /*
2 Cantaveria - action adventure platform game
3 Copyright (C) 2009 Evan Rinehart
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to
18 The Free Software Foundation, Inc.
19 51 Franklin Street, Fifth Floor
20 Boston, MA 02110-1301, USA
23 void report_error(const char* format, ...);
24 void fatal_error(const char* format, ...);
25 void* xmalloc(size_t size);
26 char* strxcpy(const char* str);
27 void strmcat(char* dst, const char* src, size_t n);
28 void out_of_memory(const char*);
34 typedef unsigned long utf32;
36 typedef int rng_state;
37 rng_state pseed(int s);
38 int prand(rng_state* x);
39 int prandi(rng_state* x, int a, int b);
40 double prandr(rng_state* x, double a, double b);
41 int gcd(int u, int v);
43 int randint(int a, int b);
45 int unicode_getc(char* str, utf32* u);
48 typedef struct treenode treenode;
49 struct treenode {
50 treenode* l;
51 treenode* r;
52 void* key;
53 void* value;
56 void tree_insert(treenode* root,
57 int (*compare)(void* k1, void* k2),
58 void* key, void* value);
60 void* tree_search(treenode* root,
61 int (*compare)(void* k1, void* k2),
62 void* key);