Mercurial > molko
annotate src/libmlk-core/core/util.h @ 341:0c18acf4517e
js: add music bindings
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 16 Oct 2021 09:45:45 +0200 |
parents | 8f9937403749 |
children | 19782ea1cf4a |
rev | line source |
---|---|
39
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
1 /* |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
2 * util.h -- utilities |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
3 * |
314 | 4 * Copyright (c) 2020-2021 David Demelier <markand@malikania.fr> |
39
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
5 * |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
6 * Permission to use, copy, modify, and/or distribute this software for any |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
7 * purpose with or without fee is hereby granted, provided that the above |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
8 * copyright notice and this permission notice appear in all copies. |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
9 * |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
17 */ |
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
18 |
243
71b3b7036de7
misc: lot of cleanups,
David Demelier <markand@malikania.fr>
parents:
236
diff
changeset
|
19 #ifndef MOLKO_CORE_UTIL_H |
71b3b7036de7
misc: lot of cleanups,
David Demelier <markand@malikania.fr>
parents:
236
diff
changeset
|
20 #define MOLKO_CORE_UTIL_H |
39
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
21 |
292
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
261
diff
changeset
|
22 #include "core.h" |
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
261
diff
changeset
|
23 |
261
bfde372bf152
core: prefix utilities with util_
David Demelier <markand@malikania.fr>
parents:
253
diff
changeset
|
24 #define UTIL_SIZE(x) sizeof ((x)) / sizeof ((x)[0]) |
47
f053a9f38c0e
core: implement basic scrolling, closes #2459
David Demelier <markand@malikania.fr>
parents:
39
diff
changeset
|
25 |
292
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
261
diff
changeset
|
26 CORE_BEGIN_DECLS |
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
261
diff
changeset
|
27 |
39
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
28 void |
298
196264679079
misc: remove usage of bool
David Demelier <markand@malikania.fr>
parents:
292
diff
changeset
|
29 util_delay(unsigned int); |
39
9d1421c09dfb
core: add more utilities to improve code simplicity
David Demelier <markand@malikania.fr>
parents:
diff
changeset
|
30 |
236
4896bb07a8db
core: add pprintf function
David Demelier <markand@malikania.fr>
parents:
234
diff
changeset
|
31 const char * |
298
196264679079
misc: remove usage of bool
David Demelier <markand@malikania.fr>
parents:
292
diff
changeset
|
32 util_pathf(const char *, ...); |
236
4896bb07a8db
core: add pprintf function
David Demelier <markand@malikania.fr>
parents:
234
diff
changeset
|
33 |
185
7103d6574062
core: add nrand function
David Demelier <markand@malikania.fr>
parents:
182
diff
changeset
|
34 unsigned int |
298
196264679079
misc: remove usage of bool
David Demelier <markand@malikania.fr>
parents:
292
diff
changeset
|
35 util_nrand(unsigned int, unsigned int); |
185
7103d6574062
core: add nrand function
David Demelier <markand@malikania.fr>
parents:
182
diff
changeset
|
36 |
292
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
261
diff
changeset
|
37 CORE_END_DECLS |
08ab73b32832
misc: add extern "C" {} blocks for C++ friends
David Demelier <markand@malikania.fr>
parents:
261
diff
changeset
|
38 |
243
71b3b7036de7
misc: lot of cleanups,
David Demelier <markand@malikania.fr>
parents:
236
diff
changeset
|
39 #endif /* !MOLKO_CORE_UTIL_H */ |