summaryrefslogtreecommitdiff
path: root/lib/rbcodec/rbcodecplatform-unix.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/rbcodecplatform-unix.h')
-rw-r--r--lib/rbcodec/rbcodecplatform-unix.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/rbcodec/rbcodecplatform-unix.h b/lib/rbcodec/rbcodecplatform-unix.h
new file mode 100644
index 0000000000..c9c8a29642
--- /dev/null
+++ b/lib/rbcodec/rbcodecplatform-unix.h
@@ -0,0 +1,77 @@
1#ifndef RBCODECPLATFORM_H_INCLUDED
2#define RBCODECPLATFORM_H_INCLUDED
3
4/* assert */
5#include <assert.h>
6
7/* O_RDONLY, O_WRONLY, O_CREAT, O_APPEND */
8#include <fcntl.h>
9
10/* isdigit, islower, isprint, isspace, toupper */
11#include <ctype.h>
12
13/* memchr, memcmp, memcpy, memmove, memset, strcat, strchr, strcmp, strcpy,
14 * strlen, strncmp, strrchr */
15#include <string.h>
16
17/* strcasecmp */
18#include <strings.h>
19
20/* abs, atoi, labs, rand */
21#include <stdlib.h>
22
23/* swap16, swap32 */
24#include <byteswap.h>
25#ifndef swap16
26#define swap16(x) bswap_16(x)
27#endif
28#ifndef swap32
29#define swap32(x) bswap_32(x)
30#endif
31
32/* hto{be,le}{16,32}, {be,le}toh{16,32}, ROCKBOX_{BIG,LITTLE}_ENDIAN */
33#include <endian.h>
34#ifndef betoh16
35#define betoh16 be16toh
36#endif
37#ifndef betoh32
38#define betoh32 be32toh
39#endif
40#ifndef letoh16
41#define letoh16 le16toh
42#endif
43#ifndef letoh32
44#define letoh32 le32toh
45#endif
46#if BYTE_ORDER == LITTLE_ENDIAN
47#define ROCKBOX_LITTLE_ENDIAN 1
48#else
49#define ROCKBOX_BIG_ENDIAN 1
50#endif
51
52/* filesize */
53#include <sys/stat.h>
54off_t filesize(int fd);
55/*
56static inline off_t filesize(int fd) {
57 struct stat st;
58 fstat(fd, &st);
59 return st.st_size;
60}
61*/
62
63/* snprintf */
64#include <stdio.h>
65
66/* debugf, logf */
67/*
68#ifdef DEBUG
69#define debugf(...) fprintf(stderr, __VA_ARGS__)
70#ifndef logf
71#define logf(...) do { fprintf(stderr, __VA_ARGS__); \
72 putc('\n', stderr); \
73 } while (0)
74#endif
75#endif
76*/
77#endif