diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-22 21:24:09 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2010-02-22 21:24:09 +0000 |
commit | 0b7dcd69c801a7439de5bfc53ae4005ec3846634 (patch) | |
tree | 42e62d3eec4ec49c7fd95ff01d5ca7d015c6fd45 | |
parent | 3f5f3524d478743a4c2f470f0baf7b767ce8d1c2 (diff) | |
download | rockbox-0b7dcd69c801a7439de5bfc53ae4005ec3846634.tar.gz rockbox-0b7dcd69c801a7439de5bfc53ae4005ec3846634.zip |
Remove tabs in firmware path (taking into account the original spacing).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24864 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/common/memchr.c | 50 | ||||
-rw-r--r-- | firmware/common/memcmp.c | 48 | ||||
-rw-r--r-- | firmware/common/memcpy.c | 14 | ||||
-rw-r--r-- | firmware/common/memmove.c | 60 | ||||
-rw-r--r-- | firmware/common/memset.c | 36 | ||||
-rw-r--r-- | firmware/common/qsort.c | 252 | ||||
-rw-r--r-- | firmware/common/strchr.c | 32 | ||||
-rw-r--r-- | firmware/common/strcmp.c | 42 | ||||
-rw-r--r-- | firmware/common/strcpy.c | 30 | ||||
-rw-r--r-- | firmware/common/strlcat.c | 40 | ||||
-rw-r--r-- | firmware/common/strlcpy.c | 38 | ||||
-rw-r--r-- | firmware/common/strlen.c | 30 | ||||
-rw-r--r-- | firmware/common/strnatcmp.c | 112 | ||||
-rw-r--r-- | firmware/common/strncmp.c | 52 | ||||
-rw-r--r-- | firmware/common/strrchr.c | 42 | ||||
-rw-r--r-- | firmware/include/_ansi.h | 56 | ||||
-rw-r--r-- | firmware/include/assert.h | 4 | ||||
-rw-r--r-- | firmware/include/ctype.h | 46 | ||||
-rw-r--r-- | firmware/include/errno.h | 216 | ||||
-rw-r--r-- | firmware/include/math.h | 30 | ||||
-rw-r--r-- | firmware/include/stdio.h | 14 | ||||
-rw-r--r-- | firmware/include/stdlib.h | 2 | ||||
-rw-r--r-- | firmware/include/string.h | 56 | ||||
-rw-r--r-- | firmware/include/time.h | 18 |
24 files changed, 660 insertions, 660 deletions
diff --git a/firmware/common/memchr.c b/firmware/common/memchr.c index a7ff222a61..26bdb9eea3 100644 --- a/firmware/common/memchr.c +++ b/firmware/common/memchr.c | |||
@@ -1,28 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<memchr>>---search for character in memory | 3 | <<memchr>>---search for character in memory |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | memchr | 6 | memchr |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | void * memchr(const void *<[s1]>, int <[c]>, size_t <[n]>); | 10 | void * memchr(const void *<[s1]>, int <[c]>, size_t <[n]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | void * memchr(<[s1]>, <[c]>, <[n]>); | 14 | void * memchr(<[s1]>, <[c]>, <[n]>); |
15 | void *<[string]>; | 15 | void *<[string]>; |
16 | int *<[c]>; | 16 | int *<[c]>; |
17 | size_t *<[n]>; | 17 | size_t *<[n]>; |
18 | 18 | ||
19 | DESCRIPTION | 19 | DESCRIPTION |
20 | This function scans the first <[n]> bytes of the memory pointed | 20 | This function scans the first <[n]> bytes of the memory pointed |
21 | to by <[s1]> for the character <[c]> (converted to a char). | 21 | to by <[s1]> for the character <[c]> (converted to a char). |
22 | 22 | ||
23 | RETURNS | 23 | RETURNS |
24 | Returns a pointer to the matching byte, or a null pointer if | 24 | Returns a pointer to the matching byte, or a null pointer if |
25 | <[c]> does not occur in <[s1]>. | 25 | <[c]> does not occur in <[s1]>. |
26 | 26 | ||
27 | PORTABILITY | 27 | PORTABILITY |
28 | <<memchr>> is ANSI C. | 28 | <<memchr>> is ANSI C. |
@@ -30,7 +30,7 @@ PORTABILITY | |||
30 | <<memchr>> requires no supporting OS subroutines. | 30 | <<memchr>> requires no supporting OS subroutines. |
31 | 31 | ||
32 | QUICKREF | 32 | QUICKREF |
33 | memchr ansi pure | 33 | memchr ansi pure |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <string.h> | 36 | #include <string.h> |
@@ -59,8 +59,8 @@ QUICKREF | |||
59 | 59 | ||
60 | void * | 60 | void * |
61 | _DEFUN (memchr, (s1, i, n), | 61 | _DEFUN (memchr, (s1, i, n), |
62 | _CONST void *s1 _AND | 62 | _CONST void *s1 _AND |
63 | int i _AND size_t n) | 63 | int i _AND size_t n) |
64 | { | 64 | { |
65 | _CONST unsigned char *s = (_CONST unsigned char *)s1; | 65 | _CONST unsigned char *s = (_CONST unsigned char *)s1; |
66 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 66 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
@@ -69,9 +69,9 @@ _DEFUN (memchr, (s1, i, n), | |||
69 | while (n-- > 0) | 69 | while (n-- > 0) |
70 | { | 70 | { |
71 | if (*s == c) | 71 | if (*s == c) |
72 | { | 72 | { |
73 | return (void *)s; | 73 | return (void *)s; |
74 | } | 74 | } |
75 | s++; | 75 | s++; |
76 | } | 76 | } |
77 | 77 | ||
@@ -89,15 +89,15 @@ _DEFUN (memchr, (s1, i, n), | |||
89 | 89 | ||
90 | aligned_addr = (unsigned long*)s; | 90 | aligned_addr = (unsigned long*)s; |
91 | while ((!DETECTCHAR (*aligned_addr, mask)) && (n>LBLOCKSIZE)) | 91 | while ((!DETECTCHAR (*aligned_addr, mask)) && (n>LBLOCKSIZE)) |
92 | { | 92 | { |
93 | aligned_addr++; | 93 | aligned_addr++; |
94 | n -= LBLOCKSIZE; | 94 | n -= LBLOCKSIZE; |
95 | } | 95 | } |
96 | 96 | ||
97 | /* The block of bytes currently pointed to by aligned_addr | 97 | /* The block of bytes currently pointed to by aligned_addr |
98 | may contain the target character or there may be less than | 98 | may contain the target character or there may be less than |
99 | LBLOCKSIZE bytes left to search. We check the last few | 99 | LBLOCKSIZE bytes left to search. We check the last few |
100 | bytes using the bytewise search. */ | 100 | bytes using the bytewise search. */ |
101 | 101 | ||
102 | s = (unsigned char*)aligned_addr; | 102 | s = (unsigned char*)aligned_addr; |
103 | } | 103 | } |
@@ -105,9 +105,9 @@ _DEFUN (memchr, (s1, i, n), | |||
105 | while (n-- > 0) | 105 | while (n-- > 0) |
106 | { | 106 | { |
107 | if (*s == c) | 107 | if (*s == c) |
108 | { | 108 | { |
109 | return (void *)s; | 109 | return (void *)s; |
110 | } | 110 | } |
111 | s++; | 111 | s++; |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/firmware/common/memcmp.c b/firmware/common/memcmp.c index 4a871fa601..1535fcf5b5 100644 --- a/firmware/common/memcmp.c +++ b/firmware/common/memcmp.c | |||
@@ -1,31 +1,31 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<memcmp>>---compare two memory areas | 3 | <<memcmp>>---compare two memory areas |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | memcmp | 6 | memcmp |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); | 10 | int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | int memcmp(<[s1]>, <[s2]>, <[n]>) | 14 | int memcmp(<[s1]>, <[s2]>, <[n]>) |
15 | void *<[s1]>; | 15 | void *<[s1]>; |
16 | void *<[s2]>; | 16 | void *<[s2]>; |
17 | size_t <[n]>; | 17 | size_t <[n]>; |
18 | 18 | ||
19 | DESCRIPTION | 19 | DESCRIPTION |
20 | This function compares not more than <[n]> characters of the | 20 | This function compares not more than <[n]> characters of the |
21 | object pointed to by <[s1]> with the object pointed to by <[s2]>. | 21 | object pointed to by <[s1]> with the object pointed to by <[s2]>. |
22 | 22 | ||
23 | 23 | ||
24 | RETURNS | 24 | RETURNS |
25 | The function returns an integer greater than, equal to or | 25 | The function returns an integer greater than, equal to or |
26 | less than zero according to whether the object pointed to by | 26 | less than zero according to whether the object pointed to by |
27 | <[s1]> is greater than, equal to or less than the object | 27 | <[s1]> is greater than, equal to or less than the object |
28 | pointed to by <[s2]>. | 28 | pointed to by <[s2]>. |
29 | 29 | ||
30 | PORTABILITY | 30 | PORTABILITY |
31 | <<memcmp>> is ANSI C. | 31 | <<memcmp>> is ANSI C. |
@@ -33,7 +33,7 @@ PORTABILITY | |||
33 | <<memcmp>> requires no supporting OS subroutines. | 33 | <<memcmp>> requires no supporting OS subroutines. |
34 | 34 | ||
35 | QUICKREF | 35 | QUICKREF |
36 | memcmp ansi pure | 36 | memcmp ansi pure |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include <string.h> | 39 | #include <string.h> |
@@ -51,9 +51,9 @@ QUICKREF | |||
51 | 51 | ||
52 | int | 52 | int |
53 | _DEFUN (memcmp, (m1, m2, n), | 53 | _DEFUN (memcmp, (m1, m2, n), |
54 | _CONST _PTR m1 _AND | 54 | _CONST _PTR m1 _AND |
55 | _CONST _PTR m2 _AND | 55 | _CONST _PTR m2 _AND |
56 | size_t n) | 56 | size_t n) |
57 | { | 57 | { |
58 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 58 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
59 | unsigned char *s1 = (unsigned char *) m1; | 59 | unsigned char *s1 = (unsigned char *) m1; |
@@ -62,9 +62,9 @@ _DEFUN (memcmp, (m1, m2, n), | |||
62 | while (n--) | 62 | while (n--) |
63 | { | 63 | { |
64 | if (*s1 != *s2) | 64 | if (*s1 != *s2) |
65 | { | 65 | { |
66 | return *s1 - *s2; | 66 | return *s1 - *s2; |
67 | } | 67 | } |
68 | s1++; | 68 | s1++; |
69 | s2++; | 69 | s2++; |
70 | } | 70 | } |
@@ -87,7 +87,7 @@ _DEFUN (memcmp, (m1, m2, n), | |||
87 | while (n >= LBLOCKSIZE) | 87 | while (n >= LBLOCKSIZE) |
88 | { | 88 | { |
89 | if (*a1 != *a2) | 89 | if (*a1 != *a2) |
90 | break; | 90 | break; |
91 | a1++; | 91 | a1++; |
92 | a2++; | 92 | a2++; |
93 | n -= LBLOCKSIZE; | 93 | n -= LBLOCKSIZE; |
@@ -102,7 +102,7 @@ _DEFUN (memcmp, (m1, m2, n), | |||
102 | while (n--) | 102 | while (n--) |
103 | { | 103 | { |
104 | if (*s1 != *s2) | 104 | if (*s1 != *s2) |
105 | return *s1 - *s2; | 105 | return *s1 - *s2; |
106 | s1++; | 106 | s1++; |
107 | s2++; | 107 | s2++; |
108 | } | 108 | } |
diff --git a/firmware/common/memcpy.c b/firmware/common/memcpy.c index b77f27379d..a89ac3c557 100644 --- a/firmware/common/memcpy.c +++ b/firmware/common/memcpy.c | |||
@@ -30,7 +30,7 @@ PORTABILITY | |||
30 | 30 | ||
31 | QUICKREF | 31 | QUICKREF |
32 | memcpy ansi pure | 32 | memcpy ansi pure |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include "config.h" | 35 | #include "config.h" |
36 | #include <_ansi.h> | 36 | #include <_ansi.h> |
@@ -51,15 +51,15 @@ QUICKREF | |||
51 | 51 | ||
52 | _PTR | 52 | _PTR |
53 | _DEFUN (memcpy, (dst0, src0, len0), | 53 | _DEFUN (memcpy, (dst0, src0, len0), |
54 | _PTR dst0 _AND | 54 | _PTR dst0 _AND |
55 | _CONST _PTR src0 _AND | 55 | _CONST _PTR src0 _AND |
56 | size_t len0) ICODE_ATTR; | 56 | size_t len0) ICODE_ATTR; |
57 | 57 | ||
58 | _PTR | 58 | _PTR |
59 | _DEFUN (memcpy, (dst0, src0, len0), | 59 | _DEFUN (memcpy, (dst0, src0, len0), |
60 | _PTR dst0 _AND | 60 | _PTR dst0 _AND |
61 | _CONST _PTR src0 _AND | 61 | _CONST _PTR src0 _AND |
62 | size_t len0) | 62 | size_t len0) |
63 | { | 63 | { |
64 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 64 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
65 | char *dst = (char *) dst0; | 65 | char *dst = (char *) dst0; |
diff --git a/firmware/common/memmove.c b/firmware/common/memmove.c index 599cbc9c01..5f423964bb 100644 --- a/firmware/common/memmove.c +++ b/firmware/common/memmove.c | |||
@@ -1,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<memmove>>---move possibly overlapping memory | 3 | <<memmove>>---move possibly overlapping memory |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | memmove | 6 | memmove |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | void *memmove(void *<[dst]>, const void *<[src]>, size_t <[length]>); | 10 | void *memmove(void *<[dst]>, const void *<[src]>, size_t <[length]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | void *memmove(<[dst]>, <[src]>, <[length]>) | 14 | void *memmove(<[dst]>, <[src]>, <[length]>) |
15 | void *<[dst]>; | 15 | void *<[dst]>; |
16 | void *<[src]>; | 16 | void *<[src]>; |
17 | size_t <[length]>; | 17 | size_t <[length]>; |
18 | 18 | ||
19 | DESCRIPTION | 19 | DESCRIPTION |
20 | This function moves <[length]> characters from the block of | 20 | This function moves <[length]> characters from the block of |
21 | memory starting at <<*<[src]>>> to the memory starting at | 21 | memory starting at <<*<[src]>>> to the memory starting at |
22 | <<*<[dst]>>>. <<memmove>> reproduces the characters correctly | 22 | <<*<[dst]>>>. <<memmove>> reproduces the characters correctly |
23 | at <<*<[dst]>>> even if the two areas overlap. | 23 | at <<*<[dst]>>> even if the two areas overlap. |
24 | 24 | ||
25 | 25 | ||
26 | RETURNS | 26 | RETURNS |
27 | The function returns <[dst]> as passed. | 27 | The function returns <[dst]> as passed. |
28 | 28 | ||
29 | PORTABILITY | 29 | PORTABILITY |
30 | <<memmove>> is ANSI C. | 30 | <<memmove>> is ANSI C. |
@@ -32,7 +32,7 @@ PORTABILITY | |||
32 | <<memmove>> requires no supporting OS subroutines. | 32 | <<memmove>> requires no supporting OS subroutines. |
33 | 33 | ||
34 | QUICKREF | 34 | QUICKREF |
35 | memmove ansi pure | 35 | memmove ansi pure |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include "config.h" | 38 | #include "config.h" |
@@ -54,15 +54,15 @@ QUICKREF | |||
54 | 54 | ||
55 | _PTR | 55 | _PTR |
56 | _DEFUN (memmove, (dst_void, src_void, length), | 56 | _DEFUN (memmove, (dst_void, src_void, length), |
57 | _PTR dst_void _AND | 57 | _PTR dst_void _AND |
58 | _CONST _PTR src_void _AND | 58 | _CONST _PTR src_void _AND |
59 | size_t length) ICODE_ATTR; | 59 | size_t length) ICODE_ATTR; |
60 | 60 | ||
61 | _PTR | 61 | _PTR |
62 | _DEFUN (memmove, (dst_void, src_void, length), | 62 | _DEFUN (memmove, (dst_void, src_void, length), |
63 | _PTR dst_void _AND | 63 | _PTR dst_void _AND |
64 | _CONST _PTR src_void _AND | 64 | _CONST _PTR src_void _AND |
65 | size_t length) | 65 | size_t length) |
66 | { | 66 | { |
67 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 67 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
68 | char *dst = dst_void; | 68 | char *dst = dst_void; |
@@ -74,16 +74,16 @@ _DEFUN (memmove, (dst_void, src_void, length), | |||
74 | src += length; | 74 | src += length; |
75 | dst += length; | 75 | dst += length; |
76 | while (length--) | 76 | while (length--) |
77 | { | 77 | { |
78 | *--dst = *--src; | 78 | *--dst = *--src; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | else | 81 | else |
82 | { | 82 | { |
83 | while (length--) | 83 | while (length--) |
84 | { | 84 | { |
85 | *dst++ = *src++; | 85 | *dst++ = *src++; |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | return dst_void; | 89 | return dst_void; |
@@ -100,9 +100,9 @@ _DEFUN (memmove, (dst_void, src_void, length), | |||
100 | src += len; | 100 | src += len; |
101 | dst += len; | 101 | dst += len; |
102 | while (len--) | 102 | while (len--) |
103 | { | 103 | { |
104 | *--dst = *--src; | 104 | *--dst = *--src; |
105 | } | 105 | } |
106 | } | 106 | } |
107 | else | 107 | else |
108 | { | 108 | { |
diff --git a/firmware/common/memset.c b/firmware/common/memset.c index c370191cda..6c4a66bf13 100644 --- a/firmware/common/memset.c +++ b/firmware/common/memset.c | |||
@@ -1,28 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<memset>>---set an area of memory | 3 | <<memset>>---set an area of memory |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | memset | 6 | memset |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | void *memset(const void *<[dst]>, int <[c]>, size_t <[length]>); | 10 | void *memset(const void *<[dst]>, int <[c]>, size_t <[length]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | void *memset(<[dst]>, <[c]>, <[length]>) | 14 | void *memset(<[dst]>, <[c]>, <[length]>) |
15 | void *<[dst]>; | 15 | void *<[dst]>; |
16 | int <[c]>; | 16 | int <[c]>; |
17 | size_t <[length]>; | 17 | size_t <[length]>; |
18 | 18 | ||
19 | DESCRIPTION | 19 | DESCRIPTION |
20 | This function converts the argument <[c]> into an unsigned | 20 | This function converts the argument <[c]> into an unsigned |
21 | char and fills the first <[length]> characters of the array | 21 | char and fills the first <[length]> characters of the array |
22 | pointed to by <[dst]> to the value. | 22 | pointed to by <[dst]> to the value. |
23 | 23 | ||
24 | RETURNS | 24 | RETURNS |
25 | <<memset>> returns the value of <[m]>. | 25 | <<memset>> returns the value of <[m]>. |
26 | 26 | ||
27 | PORTABILITY | 27 | PORTABILITY |
28 | <<memset>> is ANSI C. | 28 | <<memset>> is ANSI C. |
@@ -30,7 +30,7 @@ PORTABILITY | |||
30 | <<memset>> requires no supporting OS subroutines. | 30 | <<memset>> requires no supporting OS subroutines. |
31 | 31 | ||
32 | QUICKREF | 32 | QUICKREF |
33 | memset ansi pure | 33 | memset ansi pure |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <string.h> | 36 | #include <string.h> |
@@ -41,9 +41,9 @@ QUICKREF | |||
41 | 41 | ||
42 | _PTR | 42 | _PTR |
43 | _DEFUN (memset, (m, c, n), | 43 | _DEFUN (memset, (m, c, n), |
44 | _PTR m _AND | 44 | _PTR m _AND |
45 | int c _AND | 45 | int c _AND |
46 | size_t n) | 46 | size_t n) |
47 | { | 47 | { |
48 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 48 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
49 | char *s = (char *) m; | 49 | char *s = (char *) m; |
@@ -78,7 +78,7 @@ _DEFUN (memset, (m, c, n), | |||
78 | { | 78 | { |
79 | buffer = 0; | 79 | buffer = 0; |
80 | for (i = 0; i < LBLOCKSIZE; i++) | 80 | for (i = 0; i < LBLOCKSIZE; i++) |
81 | buffer = (buffer << 8) | c; | 81 | buffer = (buffer << 8) | c; |
82 | } | 82 | } |
83 | 83 | ||
84 | while (n >= LBLOCKSIZE*4) | 84 | while (n >= LBLOCKSIZE*4) |
diff --git a/firmware/common/qsort.c b/firmware/common/qsort.c index b2071d447f..8c4d1ad511 100644 --- a/firmware/common/qsort.c +++ b/firmware/common/qsort.c | |||
@@ -3,20 +3,20 @@ FUNCTION | |||
3 | <<qsort>>---sort an array | 3 | <<qsort>>---sort an array |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | qsort | 6 | qsort |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | void qsort(void *<[base]>, size_t <[nmemb]>, size_t <[size]>, | 10 | void qsort(void *<[base]>, size_t <[nmemb]>, size_t <[size]>, |
11 | int (*<[compar]>)(const void *, const void *) ); | 11 | int (*<[compar]>)(const void *, const void *) ); |
12 | 12 | ||
13 | TRAD_SYNOPSIS | 13 | TRAD_SYNOPSIS |
14 | #include <stdlib.h> | 14 | #include <stdlib.h> |
15 | qsort(<[base]>, <[nmemb]>, <[size]>, <[compar]> ) | 15 | qsort(<[base]>, <[nmemb]>, <[size]>, <[compar]> ) |
16 | char *<[base]>; | 16 | char *<[base]>; |
17 | size_t <[nmemb]>; | 17 | size_t <[nmemb]>; |
18 | size_t <[size]>; | 18 | size_t <[size]>; |
19 | int (*<[compar]>)(); | 19 | int (*<[compar]>)(); |
20 | 20 | ||
21 | DESCRIPTION | 21 | DESCRIPTION |
22 | <<qsort>> sorts an array (beginning at <[base]>) of <[nmemb]> objects. | 22 | <<qsort>> sorts an array (beginning at <[base]>) of <[nmemb]> objects. |
@@ -43,7 +43,7 @@ PORTABILITY | |||
43 | 43 | ||
44 | /*- | 44 | /*- |
45 | * Copyright (c) 1992, 1993 | 45 | * Copyright (c) 1992, 1993 |
46 | * The Regents of the University of California. All rights reserved. | 46 | * The Regents of the University of California. All rights reserved. |
47 | * | 47 | * |
48 | * Redistribution and use in source and binary forms, with or without | 48 | * Redistribution and use in source and binary forms, with or without |
49 | * modification, are permitted provided that the following conditions | 49 | * modification, are permitted provided that the following conditions |
@@ -55,8 +55,8 @@ PORTABILITY | |||
55 | * documentation and/or other materials provided with the distribution. | 55 | * documentation and/or other materials provided with the distribution. |
56 | * 3. All advertising materials mentioning features or use of this software | 56 | * 3. All advertising materials mentioning features or use of this software |
57 | * must display the following acknowledgement: | 57 | * must display the following acknowledgement: |
58 | * This product includes software developed by the University of | 58 | * This product includes software developed by the University of |
59 | * California, Berkeley and its contributors. | 59 | * California, Berkeley and its contributors. |
60 | * 4. Neither the name of the University nor the names of its contributors | 60 | * 4. Neither the name of the University nor the names of its contributors |
61 | * may be used to endorse or promote products derived from this software | 61 | * may be used to endorse or promote products derived from this software |
62 | * without specific prior written permission. | 62 | * without specific prior written permission. |
@@ -81,142 +81,142 @@ PORTABILITY | |||
81 | #define inline | 81 | #define inline |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | static inline char *med3 _PARAMS((char *, char *, char *, int (*cmp)(const _PTR,const _PTR))); | 84 | static inline char *med3 _PARAMS((char *, char *, char *, int (*cmp)(const _PTR,const _PTR))); |
85 | static inline void swapfunc _PARAMS((char *, char *, int, int)); | 85 | static inline void swapfunc _PARAMS((char *, char *, int, int)); |
86 | 86 | ||
87 | #define min(a, b) (a) < (b) ? a : b | 87 | #define min(a, b) (a) < (b) ? a : b |
88 | 88 | ||
89 | /* | 89 | /* |
90 | * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". | 90 | * Qsort routine from Bentley & McIlroy's "Engineering a Sort Function". |
91 | */ | 91 | */ |
92 | #define swapcode(TYPE, parmi, parmj, n) { \ | 92 | #define swapcode(TYPE, parmi, parmj, n) { \ |
93 | long i = (n) / sizeof (TYPE); \ | 93 | long i = (n) / sizeof (TYPE); \ |
94 | register TYPE *pi = (TYPE *) (parmi); \ | 94 | register TYPE *pi = (TYPE *) (parmi); \ |
95 | register TYPE *pj = (TYPE *) (parmj); \ | 95 | register TYPE *pj = (TYPE *) (parmj); \ |
96 | do { \ | 96 | do { \ |
97 | register TYPE t = *pi; \ | 97 | register TYPE t = *pi; \ |
98 | *pi++ = *pj; \ | 98 | *pi++ = *pj; \ |
99 | *pj++ = t; \ | 99 | *pj++ = t; \ |
100 | } while (--i > 0); \ | 100 | } while (--i > 0); \ |
101 | } | 101 | } |
102 | 102 | ||
103 | #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ | 103 | #define SWAPINIT(a, es) swaptype = ((char *)a - (char *)0) % sizeof(long) || \ |
104 | es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; | 104 | es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; |
105 | 105 | ||
106 | static inline void | 106 | static inline void |
107 | _DEFUN(swapfunc, (a, b, n, swaptype), | 107 | _DEFUN(swapfunc, (a, b, n, swaptype), |
108 | char *a _AND | 108 | char *a _AND |
109 | char *b _AND | 109 | char *b _AND |
110 | int n _AND | 110 | int n _AND |
111 | int swaptype) | 111 | int swaptype) |
112 | { | 112 | { |
113 | if(swaptype <= 1) | 113 | if(swaptype <= 1) |
114 | swapcode(long, a, b, n) | 114 | swapcode(long, a, b, n) |
115 | else | 115 | else |
116 | swapcode(char, a, b, n) | 116 | swapcode(char, a, b, n) |
117 | } | 117 | } |
118 | 118 | ||
119 | #define swap(a, b) \ | 119 | #define swap(a, b) \ |
120 | if (swaptype == 0) { \ | 120 | if (swaptype == 0) { \ |
121 | long t = *(long *)(a); \ | 121 | long t = *(long *)(a); \ |
122 | *(long *)(a) = *(long *)(b); \ | 122 | *(long *)(a) = *(long *)(b); \ |
123 | *(long *)(b) = t; \ | 123 | *(long *)(b) = t; \ |
124 | } else \ | 124 | } else \ |
125 | swapfunc(a, b, es, swaptype) | 125 | swapfunc(a, b, es, swaptype) |
126 | 126 | ||
127 | #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) | 127 | #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) |
128 | 128 | ||
129 | static inline char * | 129 | static inline char * |
130 | _DEFUN(med3, (a, b, c, cmp), | 130 | _DEFUN(med3, (a, b, c, cmp), |
131 | char *a _AND | 131 | char *a _AND |
132 | char *b _AND | 132 | char *b _AND |
133 | char *c _AND | 133 | char *c _AND |
134 | int (*cmp)(const _PTR,const _PTR)) | 134 | int (*cmp)(const _PTR,const _PTR)) |
135 | { | 135 | { |
136 | return cmp(a, b) < 0 ? | 136 | return cmp(a, b) < 0 ? |
137 | (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) | 137 | (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) |
138 | :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c )); | 138 | :(cmp(b, c) > 0 ? b : (cmp(a, c) < 0 ? a : c )); |
139 | } | 139 | } |
140 | 140 | ||
141 | void | 141 | void |
142 | _DEFUN(qsort, (a, n, es, cmp), | 142 | _DEFUN(qsort, (a, n, es, cmp), |
143 | void *a _AND | 143 | void *a _AND |
144 | size_t n _AND | 144 | size_t n _AND |
145 | size_t es _AND | 145 | size_t es _AND |
146 | int (*cmp)(const _PTR,const _PTR)) | 146 | int (*cmp)(const _PTR,const _PTR)) |
147 | { | 147 | { |
148 | char *pa, *pb, *pc, *pd, *pl, *pm, *pn; | 148 | char *pa, *pb, *pc, *pd, *pl, *pm, *pn; |
149 | int d, r, swaptype, swap_cnt; | 149 | int d, r, swaptype, swap_cnt; |
150 | 150 | ||
151 | loop: SWAPINIT(a, es); | 151 | loop: SWAPINIT(a, es); |
152 | swap_cnt = 0; | 152 | swap_cnt = 0; |
153 | if (n < 7) { | 153 | if (n < 7) { |
154 | for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es) | 154 | for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es) |
155 | for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; | 155 | for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; |
156 | pl -= es) | 156 | pl -= es) |
157 | swap(pl, pl - es); | 157 | swap(pl, pl - es); |
158 | return; | 158 | return; |
159 | } | 159 | } |
160 | pm = (char *) a + (n / 2) * es; | 160 | pm = (char *) a + (n / 2) * es; |
161 | if (n > 7) { | 161 | if (n > 7) { |
162 | pl = a; | 162 | pl = a; |
163 | pn = (char *) a + (n - 1) * es; | 163 | pn = (char *) a + (n - 1) * es; |
164 | if (n > 40) { | 164 | if (n > 40) { |
165 | d = (n / 8) * es; | 165 | d = (n / 8) * es; |
166 | pl = med3(pl, pl + d, pl + 2 * d, cmp); | 166 | pl = med3(pl, pl + d, pl + 2 * d, cmp); |
167 | pm = med3(pm - d, pm, pm + d, cmp); | 167 | pm = med3(pm - d, pm, pm + d, cmp); |
168 | pn = med3(pn - 2 * d, pn - d, pn, cmp); | 168 | pn = med3(pn - 2 * d, pn - d, pn, cmp); |
169 | } | 169 | } |
170 | pm = med3(pl, pm, pn, cmp); | 170 | pm = med3(pl, pm, pn, cmp); |
171 | } | 171 | } |
172 | swap(a, pm); | 172 | swap(a, pm); |
173 | pa = pb = (char *) a + es; | 173 | pa = pb = (char *) a + es; |
174 | 174 | ||
175 | pc = pd = (char *) a + (n - 1) * es; | 175 | pc = pd = (char *) a + (n - 1) * es; |
176 | for (;;) { | 176 | for (;;) { |
177 | while (pb <= pc && (r = cmp(pb, a)) <= 0) { | 177 | while (pb <= pc && (r = cmp(pb, a)) <= 0) { |
178 | if (r == 0) { | 178 | if (r == 0) { |
179 | swap_cnt = 1; | 179 | swap_cnt = 1; |
180 | swap(pa, pb); | 180 | swap(pa, pb); |
181 | pa += es; | 181 | pa += es; |
182 | } | 182 | } |
183 | pb += es; | 183 | pb += es; |
184 | } | 184 | } |
185 | while (pb <= pc && (r = cmp(pc, a)) >= 0) { | 185 | while (pb <= pc && (r = cmp(pc, a)) >= 0) { |
186 | if (r == 0) { | 186 | if (r == 0) { |
187 | swap_cnt = 1; | 187 | swap_cnt = 1; |
188 | swap(pc, pd); | 188 | swap(pc, pd); |
189 | pd -= es; | 189 | pd -= es; |
190 | } | 190 | } |
191 | pc -= es; | 191 | pc -= es; |
192 | } | 192 | } |
193 | if (pb > pc) | 193 | if (pb > pc) |
194 | break; | 194 | break; |
195 | swap(pb, pc); | 195 | swap(pb, pc); |
196 | swap_cnt = 1; | 196 | swap_cnt = 1; |
197 | pb += es; | 197 | pb += es; |
198 | pc -= es; | 198 | pc -= es; |
199 | } | 199 | } |
200 | if (swap_cnt == 0) { /* Switch to insertion sort */ | 200 | if (swap_cnt == 0) { /* Switch to insertion sort */ |
201 | for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es) | 201 | for (pm = (char *) a + es; pm < (char *) a + n * es; pm += es) |
202 | for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; | 202 | for (pl = pm; pl > (char *) a && cmp(pl - es, pl) > 0; |
203 | pl -= es) | 203 | pl -= es) |
204 | swap(pl, pl - es); | 204 | swap(pl, pl - es); |
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | 207 | ||
208 | pn = (char *) a + n * es; | 208 | pn = (char *) a + n * es; |
209 | r = min(pa - (char *)a, pb - pa); | 209 | r = min(pa - (char *)a, pb - pa); |
210 | vecswap(a, pb - r, r); | 210 | vecswap(a, pb - r, r); |
211 | r = min((unsigned int)(pd - pc), pn - pd - es); | 211 | r = min((unsigned int)(pd - pc), pn - pd - es); |
212 | vecswap(pb, pn - r, r); | 212 | vecswap(pb, pn - r, r); |
213 | if ((unsigned int)(r = pb - pa) > es) | 213 | if ((unsigned int)(r = pb - pa) > es) |
214 | qsort(a, r / es, es, cmp); | 214 | qsort(a, r / es, es, cmp); |
215 | if ((unsigned int)(r = pd - pc) > es) { | 215 | if ((unsigned int)(r = pd - pc) > es) { |
216 | /* Iterate rather than recurse to save stack space */ | 216 | /* Iterate rather than recurse to save stack space */ |
217 | a = pn - r; | 217 | a = pn - r; |
218 | n = r / es; | 218 | n = r / es; |
219 | goto loop; | 219 | goto loop; |
220 | } | 220 | } |
221 | /* qsort(pn - r, r / es, es, cmp);*/ | 221 | /* qsort(pn - r, r / es, es, cmp);*/ |
222 | } | 222 | } |
diff --git a/firmware/common/strchr.c b/firmware/common/strchr.c index de4585f758..96acf5edf6 100644 --- a/firmware/common/strchr.c +++ b/firmware/common/strchr.c | |||
@@ -1,28 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<strchr>>---search for character in string | 3 | <<strchr>>---search for character in string |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | strchr | 6 | strchr |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | char * strchr(const char *<[string]>, int <[c]>); | 10 | char * strchr(const char *<[string]>, int <[c]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | char * strchr(<[string]>, <[c]>); | 14 | char * strchr(<[string]>, <[c]>); |
15 | char *<[string]>; | 15 | char *<[string]>; |
16 | int *<[c]>; | 16 | int *<[c]>; |
17 | 17 | ||
18 | DESCRIPTION | 18 | DESCRIPTION |
19 | This function finds the first occurence of <[c]> (converted to | 19 | This function finds the first occurence of <[c]> (converted to |
20 | a char) in the string pointed to by <[string]> (including the | 20 | a char) in the string pointed to by <[string]> (including the |
21 | terminating null character). | 21 | terminating null character). |
22 | 22 | ||
23 | RETURNS | 23 | RETURNS |
24 | Returns a pointer to the located character, or a null pointer | 24 | Returns a pointer to the located character, or a null pointer |
25 | if <[c]> does not occur in <[string]>. | 25 | if <[c]> does not occur in <[string]>. |
26 | 26 | ||
27 | PORTABILITY | 27 | PORTABILITY |
28 | <<strchr>> is ANSI C. | 28 | <<strchr>> is ANSI C. |
@@ -30,7 +30,7 @@ PORTABILITY | |||
30 | <<strchr>> requires no supporting OS subroutines. | 30 | <<strchr>> requires no supporting OS subroutines. |
31 | 31 | ||
32 | QUICKREF | 32 | QUICKREF |
33 | strchr ansi pure | 33 | strchr ansi pure |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <string.h> | 36 | #include <string.h> |
@@ -59,8 +59,8 @@ QUICKREF | |||
59 | 59 | ||
60 | char * | 60 | char * |
61 | _DEFUN (strchr, (s1, i), | 61 | _DEFUN (strchr, (s1, i), |
62 | _CONST char *s1 _AND | 62 | _CONST char *s1 _AND |
63 | int i) | 63 | int i) |
64 | { | 64 | { |
65 | _CONST unsigned char *s = (_CONST unsigned char *)s1; | 65 | _CONST unsigned char *s = (_CONST unsigned char *)s1; |
66 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 66 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
diff --git a/firmware/common/strcmp.c b/firmware/common/strcmp.c index 81d65272ec..bbbf4b174a 100644 --- a/firmware/common/strcmp.c +++ b/firmware/common/strcmp.c | |||
@@ -1,30 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<strcmp>>---character string compare | 3 | <<strcmp>>---character string compare |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | strcmp | 6 | strcmp |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | int strcmp(const char *<[a]>, const char *<[b]>); | 10 | int strcmp(const char *<[a]>, const char *<[b]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | int strcmp(<[a]>, <[b]>) | 14 | int strcmp(<[a]>, <[b]>) |
15 | char *<[a]>; | 15 | char *<[a]>; |
16 | char *<[b]>; | 16 | char *<[b]>; |
17 | 17 | ||
18 | DESCRIPTION | 18 | DESCRIPTION |
19 | <<strcmp>> compares the string at <[a]> to | 19 | <<strcmp>> compares the string at <[a]> to |
20 | the string at <[b]>. | 20 | the string at <[b]>. |
21 | 21 | ||
22 | RETURNS | 22 | RETURNS |
23 | If <<*<[a]>>> sorts lexicographically after <<*<[b]>>>, | 23 | If <<*<[a]>>> sorts lexicographically after <<*<[b]>>>, |
24 | <<strcmp>> returns a number greater than zero. If the two | 24 | <<strcmp>> returns a number greater than zero. If the two |
25 | strings match, <<strcmp>> returns zero. If <<*<[a]>>> | 25 | strings match, <<strcmp>> returns zero. If <<*<[a]>>> |
26 | sorts lexicographically before <<*<[b]>>>, <<strcmp>> returns a | 26 | sorts lexicographically before <<*<[b]>>>, <<strcmp>> returns a |
27 | number less than zero. | 27 | number less than zero. |
28 | 28 | ||
29 | PORTABILITY | 29 | PORTABILITY |
30 | <<strcmp>> is ANSI C. | 30 | <<strcmp>> is ANSI C. |
@@ -32,7 +32,7 @@ PORTABILITY | |||
32 | <<strcmp>> requires no supporting OS subroutines. | 32 | <<strcmp>> requires no supporting OS subroutines. |
33 | 33 | ||
34 | QUICKREF | 34 | QUICKREF |
35 | strcmp ansi pure | 35 | strcmp ansi pure |
36 | */ | 36 | */ |
37 | 37 | ||
38 | #include <string.h> | 38 | #include <string.h> |
@@ -59,8 +59,8 @@ QUICKREF | |||
59 | 59 | ||
60 | int | 60 | int |
61 | _DEFUN (strcmp, (s1, s2), | 61 | _DEFUN (strcmp, (s1, s2), |
62 | _CONST char *s1 _AND | 62 | _CONST char *s1 _AND |
63 | _CONST char *s2) | 63 | _CONST char *s2) |
64 | { | 64 | { |
65 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 65 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
66 | while (*s1 != '\0' && *s1 == *s2) | 66 | while (*s1 != '\0' && *s1 == *s2) |
@@ -83,9 +83,9 @@ _DEFUN (strcmp, (s1, s2), | |||
83 | while (*a1 == *a2) | 83 | while (*a1 == *a2) |
84 | { | 84 | { |
85 | /* To get here, *a1 == *a2, thus if we find a null in *a1, | 85 | /* To get here, *a1 == *a2, thus if we find a null in *a1, |
86 | then the strings must be equal, so return zero. */ | 86 | then the strings must be equal, so return zero. */ |
87 | if (DETECTNULL (*a1)) | 87 | if (DETECTNULL (*a1)) |
88 | return 0; | 88 | return 0; |
89 | 89 | ||
90 | a1++; | 90 | a1++; |
91 | a2++; | 91 | a2++; |
diff --git a/firmware/common/strcpy.c b/firmware/common/strcpy.c index 0580d88cb8..077ae73cc6 100644 --- a/firmware/common/strcpy.c +++ b/firmware/common/strcpy.c | |||
@@ -1,27 +1,27 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<strcpy>>---copy string | 3 | <<strcpy>>---copy string |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | strcpy | 6 | strcpy |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | char *strcpy(char *<[dst]>, const char *<[src]>); | 10 | char *strcpy(char *<[dst]>, const char *<[src]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | char *strcpy(<[dst]>, <[src]>) | 14 | char *strcpy(<[dst]>, <[src]>) |
15 | char *<[dst]>; | 15 | char *<[dst]>; |
16 | char *<[src]>; | 16 | char *<[src]>; |
17 | 17 | ||
18 | DESCRIPTION | 18 | DESCRIPTION |
19 | <<strcpy>> copies the string pointed to by <[src]> | 19 | <<strcpy>> copies the string pointed to by <[src]> |
20 | (including the terminating null character) to the array | 20 | (including the terminating null character) to the array |
21 | pointed to by <[dst]>. | 21 | pointed to by <[dst]>. |
22 | 22 | ||
23 | RETURNS | 23 | RETURNS |
24 | This function returns the initial value of <[dst]>. | 24 | This function returns the initial value of <[dst]>. |
25 | 25 | ||
26 | PORTABILITY | 26 | PORTABILITY |
27 | <<strcpy>> is ANSI C. | 27 | <<strcpy>> is ANSI C. |
@@ -29,7 +29,7 @@ PORTABILITY | |||
29 | <<strcpy>> requires no supporting OS subroutines. | 29 | <<strcpy>> requires no supporting OS subroutines. |
30 | 30 | ||
31 | QUICKREF | 31 | QUICKREF |
32 | strcpy ansi pure | 32 | strcpy ansi pure |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #include <string.h> | 35 | #include <string.h> |
@@ -59,8 +59,8 @@ QUICKREF | |||
59 | 59 | ||
60 | char* | 60 | char* |
61 | _DEFUN (strcpy, (dst0, src0), | 61 | _DEFUN (strcpy, (dst0, src0), |
62 | char *dst0 _AND | 62 | char *dst0 _AND |
63 | _CONST char *src0) | 63 | _CONST char *src0) |
64 | { | 64 | { |
65 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 65 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
66 | char *s = dst0; | 66 | char *s = dst0; |
diff --git a/firmware/common/strlcat.c b/firmware/common/strlcat.c index 0a113dd134..da0d253e79 100644 --- a/firmware/common/strlcat.c +++ b/firmware/common/strlcat.c | |||
@@ -29,28 +29,28 @@ | |||
29 | size_t | 29 | size_t |
30 | strlcat(char *dst, const char *src, size_t siz) | 30 | strlcat(char *dst, const char *src, size_t siz) |
31 | { | 31 | { |
32 | char *d = dst; | 32 | char *d = dst; |
33 | const char *s = src; | 33 | const char *s = src; |
34 | size_t n = siz; | 34 | size_t n = siz; |
35 | size_t dlen; | 35 | size_t dlen; |
36 | 36 | ||
37 | /* Find the end of dst and adjust bytes left but don't go past end */ | 37 | /* Find the end of dst and adjust bytes left but don't go past end */ |
38 | while (n-- != 0 && *d != '\0') | 38 | while (n-- != 0 && *d != '\0') |
39 | d++; | 39 | d++; |
40 | dlen = d - dst; | 40 | dlen = d - dst; |
41 | n = siz - dlen; | 41 | n = siz - dlen; |
42 | 42 | ||
43 | if (n == 0) | 43 | if (n == 0) |
44 | return(dlen + strlen(s)); | 44 | return(dlen + strlen(s)); |
45 | while (*s != '\0') { | 45 | while (*s != '\0') { |
46 | if (n != 1) { | 46 | if (n != 1) { |
47 | *d++ = *s; | 47 | *d++ = *s; |
48 | n--; | 48 | n--; |
49 | } | 49 | } |
50 | s++; | 50 | s++; |
51 | } | 51 | } |
52 | *d = '\0'; | 52 | *d = '\0'; |
53 | 53 | ||
54 | return(dlen + (s - src)); /* count does not include NUL */ | 54 | return(dlen + (s - src)); /* count does not include NUL */ |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/firmware/common/strlcpy.c b/firmware/common/strlcpy.c index ac30ef01fe..6e06eb81d2 100644 --- a/firmware/common/strlcpy.c +++ b/firmware/common/strlcpy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ | 1 | /* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> | 4 | * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> |
@@ -27,26 +27,26 @@ | |||
27 | size_t | 27 | size_t |
28 | strlcpy(char *dst, const char *src, size_t siz) | 28 | strlcpy(char *dst, const char *src, size_t siz) |
29 | { | 29 | { |
30 | char *d = dst; | 30 | char *d = dst; |
31 | const char *s = src; | 31 | const char *s = src; |
32 | size_t n = siz; | 32 | size_t n = siz; |
33 | 33 | ||
34 | /* Copy as many bytes as will fit */ | 34 | /* Copy as many bytes as will fit */ |
35 | if (n != 0) { | 35 | if (n != 0) { |
36 | while (--n != 0) { | 36 | while (--n != 0) { |
37 | if ((*d++ = *s++) == '\0') | 37 | if ((*d++ = *s++) == '\0') |
38 | break; | 38 | break; |
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | /* Not enough room in dst, add NUL and traverse rest of src */ | 42 | /* Not enough room in dst, add NUL and traverse rest of src */ |
43 | if (n == 0) { | 43 | if (n == 0) { |
44 | if (siz != 0) | 44 | if (siz != 0) |
45 | *d = '\0'; /* NUL-terminate dst */ | 45 | *d = '\0'; /* NUL-terminate dst */ |
46 | while (*s++) | 46 | while (*s++) |
47 | ; | 47 | ; |
48 | } | 48 | } |
49 | 49 | ||
50 | return(s - src - 1); /* count does not include NUL */ | 50 | return(s - src - 1); /* count does not include NUL */ |
51 | } | 51 | } |
52 | 52 | ||
diff --git a/firmware/common/strlen.c b/firmware/common/strlen.c index 2e2c62eb75..4d33eafce6 100644 --- a/firmware/common/strlen.c +++ b/firmware/common/strlen.c | |||
@@ -1,26 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<strlen>>---character string length | 3 | <<strlen>>---character string length |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | strlen | 6 | strlen |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | size_t strlen(const char *<[str]>); | 10 | size_t strlen(const char *<[str]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | size_t strlen(<[str]>) | 14 | size_t strlen(<[str]>) |
15 | char *<[src]>; | 15 | char *<[src]>; |
16 | 16 | ||
17 | DESCRIPTION | 17 | DESCRIPTION |
18 | The <<strlen>> function works out the length of the string | 18 | The <<strlen>> function works out the length of the string |
19 | starting at <<*<[str]>>> by counting chararacters until it | 19 | starting at <<*<[str]>>> by counting chararacters until it |
20 | reaches a <<NULL>> character. | 20 | reaches a <<NULL>> character. |
21 | 21 | ||
22 | RETURNS | 22 | RETURNS |
23 | <<strlen>> returns the character count. | 23 | <<strlen>> returns the character count. |
24 | 24 | ||
25 | PORTABILITY | 25 | PORTABILITY |
26 | <<strlen>> is ANSI C. | 26 | <<strlen>> is ANSI C. |
@@ -28,7 +28,7 @@ PORTABILITY | |||
28 | <<strlen>> requires no supporting OS subroutines. | 28 | <<strlen>> requires no supporting OS subroutines. |
29 | 29 | ||
30 | QUICKREF | 30 | QUICKREF |
31 | strlen ansi pure | 31 | strlen ansi pure |
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "config.h" | 34 | #include "config.h" |
@@ -56,11 +56,11 @@ QUICKREF | |||
56 | 56 | ||
57 | size_t | 57 | size_t |
58 | _DEFUN (strlen, (str), | 58 | _DEFUN (strlen, (str), |
59 | _CONST char *str) ICODE_ATTR; | 59 | _CONST char *str) ICODE_ATTR; |
60 | 60 | ||
61 | size_t | 61 | size_t |
62 | _DEFUN (strlen, (str), | 62 | _DEFUN (strlen, (str), |
63 | _CONST char *str) | 63 | _CONST char *str) |
64 | { | 64 | { |
65 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 65 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
66 | _CONST char *start = str; | 66 | _CONST char *start = str; |
diff --git a/firmware/common/strnatcmp.c b/firmware/common/strnatcmp.c index 93a649358f..0084ff3582 100644 --- a/firmware/common/strnatcmp.c +++ b/firmware/common/strnatcmp.c | |||
@@ -75,26 +75,26 @@ compare_right(char const *a, char const *b) | |||
75 | int ca, cb; | 75 | int ca, cb; |
76 | 76 | ||
77 | /* The longest run of digits wins. That aside, the greatest | 77 | /* The longest run of digits wins. That aside, the greatest |
78 | value wins, but we can't know that it will until we've scanned | 78 | value wins, but we can't know that it will until we've scanned |
79 | both numbers to know that they have the same magnitude, so we | 79 | both numbers to know that they have the same magnitude, so we |
80 | remember it in BIAS. */ | 80 | remember it in BIAS. */ |
81 | for (;; a++, b++) { | 81 | for (;; a++, b++) { |
82 | ca = to_int(*a); | 82 | ca = to_int(*a); |
83 | cb = to_int(*b); | 83 | cb = to_int(*b); |
84 | if (!nat_isdigit(ca) && !nat_isdigit(cb)) | 84 | if (!nat_isdigit(ca) && !nat_isdigit(cb)) |
85 | return bias; | 85 | return bias; |
86 | else if (!nat_isdigit(ca)) | 86 | else if (!nat_isdigit(ca)) |
87 | return -1; | 87 | return -1; |
88 | else if (!nat_isdigit(cb)) | 88 | else if (!nat_isdigit(cb)) |
89 | return +1; | 89 | return +1; |
90 | else if (ca < cb) { | 90 | else if (ca < cb) { |
91 | if (!bias) | 91 | if (!bias) |
92 | bias = -1; | 92 | bias = -1; |
93 | } else if (ca > cb) { | 93 | } else if (ca > cb) { |
94 | if (!bias) | 94 | if (!bias) |
95 | bias = +1; | 95 | bias = +1; |
96 | } else if (!ca && !cb) | 96 | } else if (!ca && !cb) |
97 | return bias; | 97 | return bias; |
98 | } | 98 | } |
99 | 99 | ||
100 | return 0; | 100 | return 0; |
@@ -107,18 +107,18 @@ compare_left(char const *a, char const *b) | |||
107 | /* Compare two left-aligned numbers: the first to have a | 107 | /* Compare two left-aligned numbers: the first to have a |
108 | different value wins. */ | 108 | different value wins. */ |
109 | for (;; a++, b++) { | 109 | for (;; a++, b++) { |
110 | if (!nat_isdigit(*a) && !nat_isdigit(*b)) | 110 | if (!nat_isdigit(*a) && !nat_isdigit(*b)) |
111 | return 0; | 111 | return 0; |
112 | else if (!nat_isdigit(*a)) | 112 | else if (!nat_isdigit(*a)) |
113 | return -1; | 113 | return -1; |
114 | else if (!nat_isdigit(*b)) | 114 | else if (!nat_isdigit(*b)) |
115 | return +1; | 115 | return +1; |
116 | else if (*a < *b) | 116 | else if (*a < *b) |
117 | return -1; | 117 | return -1; |
118 | else if (*a > *b) | 118 | else if (*a > *b) |
119 | return +1; | 119 | return +1; |
120 | } | 120 | } |
121 | 121 | ||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
@@ -134,39 +134,39 @@ static int strnatcmp0(char const *a, char const *b, int fold_case) | |||
134 | ca = to_int(a[ai]); | 134 | ca = to_int(a[ai]); |
135 | cb = to_int(b[bi]); | 135 | cb = to_int(b[bi]); |
136 | 136 | ||
137 | /* process run of digits */ | 137 | /* process run of digits */ |
138 | if (nat_isdigit(ca) && nat_isdigit(cb)) { | 138 | if (nat_isdigit(ca) && nat_isdigit(cb)) { |
139 | fractional = (ca == '0' || cb == '0'); | 139 | fractional = (ca == '0' || cb == '0'); |
140 | 140 | ||
141 | if (fractional) { | 141 | if (fractional) { |
142 | if ((result = compare_left(a+ai, b+bi)) != 0) | 142 | if ((result = compare_left(a+ai, b+bi)) != 0) |
143 | return result; | 143 | return result; |
144 | } else { | 144 | } else { |
145 | if ((result = compare_right(a+ai, b+bi)) != 0) | 145 | if ((result = compare_right(a+ai, b+bi)) != 0) |
146 | return result; | 146 | return result; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | if (!ca && !cb) { | 150 | if (!ca && !cb) { |
151 | /* The strings compare the same. Call str[case]cmp() to ensure | 151 | /* The strings compare the same. Call str[case]cmp() to ensure |
152 | consistent results. */ | 152 | consistent results. */ |
153 | if(fold_case) | 153 | if(fold_case) |
154 | return strcasecmp(a,b); | 154 | return strcasecmp(a,b); |
155 | else | 155 | else |
156 | return strcmp(a,b); | 156 | return strcmp(a,b); |
157 | } | 157 | } |
158 | 158 | ||
159 | if (fold_case) { | 159 | if (fold_case) { |
160 | ca = nat_unify_case(ca); | 160 | ca = nat_unify_case(ca); |
161 | cb = nat_unify_case(cb); | 161 | cb = nat_unify_case(cb); |
162 | } | 162 | } |
163 | 163 | ||
164 | if (ca < cb) | 164 | if (ca < cb) |
165 | return -1; | 165 | return -1; |
166 | else if (ca > cb) | 166 | else if (ca > cb) |
167 | return +1; | 167 | return +1; |
168 | 168 | ||
169 | ++ai; ++bi; | 169 | ++ai; ++bi; |
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
diff --git a/firmware/common/strncmp.c b/firmware/common/strncmp.c index 9801b7d924..b1d8d9d43a 100644 --- a/firmware/common/strncmp.c +++ b/firmware/common/strncmp.c | |||
@@ -1,31 +1,31 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<strncmp>>---character string compare | 3 | <<strncmp>>---character string compare |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | strncmp | 6 | strncmp |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | int strncmp(const char *<[a]>, const char * <[b]>, size_t <[length]>); | 10 | int strncmp(const char *<[a]>, const char * <[b]>, size_t <[length]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | int strncmp(<[a]>, <[b]>, <[length]>) | 14 | int strncmp(<[a]>, <[b]>, <[length]>) |
15 | char *<[a]>; | 15 | char *<[a]>; |
16 | char *<[b]>; | 16 | char *<[b]>; |
17 | size_t <[length]> | 17 | size_t <[length]> |
18 | 18 | ||
19 | DESCRIPTION | 19 | DESCRIPTION |
20 | <<strncmp>> compares up to <[length]> characters | 20 | <<strncmp>> compares up to <[length]> characters |
21 | from the string at <[a]> to the string at <[b]>. | 21 | from the string at <[a]> to the string at <[b]>. |
22 | 22 | ||
23 | RETURNS | 23 | RETURNS |
24 | If <<*<[a]>>> sorts lexicographically after <<*<[b]>>>, | 24 | If <<*<[a]>>> sorts lexicographically after <<*<[b]>>>, |
25 | <<strncmp>> returns a number greater than zero. If the two | 25 | <<strncmp>> returns a number greater than zero. If the two |
26 | strings are equivalent, <<strncmp>> returns zero. If <<*<[a]>>> | 26 | strings are equivalent, <<strncmp>> returns zero. If <<*<[a]>>> |
27 | sorts lexicographically before <<*<[b]>>>, <<strncmp>> returns a | 27 | sorts lexicographically before <<*<[b]>>>, <<strncmp>> returns a |
28 | number less than zero. | 28 | number less than zero. |
29 | 29 | ||
30 | PORTABILITY | 30 | PORTABILITY |
31 | <<strncmp>> is ANSI C. | 31 | <<strncmp>> is ANSI C. |
@@ -33,7 +33,7 @@ PORTABILITY | |||
33 | <<strncmp>> requires no supporting OS subroutines. | 33 | <<strncmp>> requires no supporting OS subroutines. |
34 | 34 | ||
35 | QUICKREF | 35 | QUICKREF |
36 | strncmp ansi pure | 36 | strncmp ansi pure |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #include <string.h> | 39 | #include <string.h> |
@@ -60,9 +60,9 @@ QUICKREF | |||
60 | 60 | ||
61 | int | 61 | int |
62 | _DEFUN (strncmp, (s1, s2, n), | 62 | _DEFUN (strncmp, (s1, s2, n), |
63 | _CONST char *s1 _AND | 63 | _CONST char *s1 _AND |
64 | _CONST char *s2 _AND | 64 | _CONST char *s2 _AND |
65 | size_t n) | 65 | size_t n) |
66 | { | 66 | { |
67 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) | 67 | #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) |
68 | if (n == 0) | 68 | if (n == 0) |
@@ -71,7 +71,7 @@ _DEFUN (strncmp, (s1, s2, n), | |||
71 | while (n-- != 0 && *s1 == *s2) | 71 | while (n-- != 0 && *s1 == *s2) |
72 | { | 72 | { |
73 | if (n == 0 || *s1 == '\0') | 73 | if (n == 0 || *s1 == '\0') |
74 | break; | 74 | break; |
75 | s1++; | 75 | s1++; |
76 | s2++; | 76 | s2++; |
77 | } | 77 | } |
@@ -95,9 +95,9 @@ _DEFUN (strncmp, (s1, s2, n), | |||
95 | n -= sizeof (long); | 95 | n -= sizeof (long); |
96 | 96 | ||
97 | /* If we've run out of bytes or hit a null, return zero | 97 | /* If we've run out of bytes or hit a null, return zero |
98 | since we already know *a1 == *a2. */ | 98 | since we already know *a1 == *a2. */ |
99 | if (n == 0 || DETECTNULL (*a1)) | 99 | if (n == 0 || DETECTNULL (*a1)) |
100 | return 0; | 100 | return 0; |
101 | 101 | ||
102 | a1++; | 102 | a1++; |
103 | a2++; | 103 | a2++; |
@@ -111,9 +111,9 @@ _DEFUN (strncmp, (s1, s2, n), | |||
111 | while (n-- > 0 && *s1 == *s2) | 111 | while (n-- > 0 && *s1 == *s2) |
112 | { | 112 | { |
113 | /* If we've run out of bytes or hit a null, return zero | 113 | /* If we've run out of bytes or hit a null, return zero |
114 | since we already know *s1 == *s2. */ | 114 | since we already know *s1 == *s2. */ |
115 | if (n == 0 || *s1 == '\0') | 115 | if (n == 0 || *s1 == '\0') |
116 | return 0; | 116 | return 0; |
117 | s1++; | 117 | s1++; |
118 | s2++; | 118 | s2++; |
119 | } | 119 | } |
diff --git a/firmware/common/strrchr.c b/firmware/common/strrchr.c index 4f903afe2b..31b0d049b3 100644 --- a/firmware/common/strrchr.c +++ b/firmware/common/strrchr.c | |||
@@ -1,28 +1,28 @@ | |||
1 | /* | 1 | /* |
2 | FUNCTION | 2 | FUNCTION |
3 | <<strrchr>>---reverse search for character in string | 3 | <<strrchr>>---reverse search for character in string |
4 | 4 | ||
5 | INDEX | 5 | INDEX |
6 | strrchr | 6 | strrchr |
7 | 7 | ||
8 | ANSI_SYNOPSIS | 8 | ANSI_SYNOPSIS |
9 | #include <string.h> | 9 | #include <string.h> |
10 | char * strrchr(const char *<[string]>, int <[c]>); | 10 | char * strrchr(const char *<[string]>, int <[c]>); |
11 | 11 | ||
12 | TRAD_SYNOPSIS | 12 | TRAD_SYNOPSIS |
13 | #include <string.h> | 13 | #include <string.h> |
14 | char * strrchr(<[string]>, <[c]>); | 14 | char * strrchr(<[string]>, <[c]>); |
15 | char *<[string]>; | 15 | char *<[string]>; |
16 | int *<[c]>; | 16 | int *<[c]>; |
17 | 17 | ||
18 | DESCRIPTION | 18 | DESCRIPTION |
19 | This function finds the last occurence of <[c]> (converted to | 19 | This function finds the last occurence of <[c]> (converted to |
20 | a char) in the string pointed to by <[string]> (including the | 20 | a char) in the string pointed to by <[string]> (including the |
21 | terminating null character). | 21 | terminating null character). |
22 | 22 | ||
23 | RETURNS | 23 | RETURNS |
24 | Returns a pointer to the located character, or a null pointer | 24 | Returns a pointer to the located character, or a null pointer |
25 | if <[c]> does not occur in <[string]>. | 25 | if <[c]> does not occur in <[string]>. |
26 | 26 | ||
27 | PORTABILITY | 27 | PORTABILITY |
28 | <<strrchr>> is ANSI C. | 28 | <<strrchr>> is ANSI C. |
@@ -30,30 +30,30 @@ PORTABILITY | |||
30 | <<strrchr>> requires no supporting OS subroutines. | 30 | <<strrchr>> requires no supporting OS subroutines. |
31 | 31 | ||
32 | QUICKREF | 32 | QUICKREF |
33 | strrchr ansi pure | 33 | strrchr ansi pure |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include <string.h> | 36 | #include <string.h> |
37 | 37 | ||
38 | char * | 38 | char * |
39 | _DEFUN (strrchr, (s, i), | 39 | _DEFUN (strrchr, (s, i), |
40 | _CONST char *s _AND | 40 | _CONST char *s _AND |
41 | int i) | 41 | int i) |
42 | { | 42 | { |
43 | _CONST char *last = NULL; | 43 | _CONST char *last = NULL; |
44 | 44 | ||
45 | if (i) | 45 | if (i) |
46 | { | 46 | { |
47 | while ((s=strchr(s, i))) | 47 | while ((s=strchr(s, i))) |
48 | { | 48 | { |
49 | last = s; | 49 | last = s; |
50 | s++; | 50 | s++; |
51 | } | 51 | } |
52 | } | 52 | } |
53 | else | 53 | else |
54 | { | 54 | { |
55 | last = strchr(s, i); | 55 | last = strchr(s, i); |
56 | } | 56 | } |
57 | 57 | ||
58 | return (char *) last; | 58 | return (char *) last; |
59 | } | 59 | } |
diff --git a/firmware/include/_ansi.h b/firmware/include/_ansi.h index 00028169c0..17d8e6f1a4 100644 --- a/firmware/include/_ansi.h +++ b/firmware/include/_ansi.h | |||
@@ -9,8 +9,8 @@ | |||
9 | "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header | 9 | "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header |
10 | files aren't affected). */ | 10 | files aren't affected). */ |
11 | 11 | ||
12 | #ifndef _ANSIDECL_H_ | 12 | #ifndef _ANSIDECL_H_ |
13 | #define _ANSIDECL_H_ | 13 | #define _ANSIDECL_H_ |
14 | 14 | ||
15 | /* First try to figure out whether we really are in an ANSI C environment. */ | 15 | /* First try to figure out whether we really are in an ANSI C environment. */ |
16 | /* FIXME: This probably needs some work. Perhaps sys/config.h can be | 16 | /* FIXME: This probably needs some work. Perhaps sys/config.h can be |
@@ -21,46 +21,46 @@ | |||
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef _HAVE_STDC | 23 | #ifdef _HAVE_STDC |
24 | #define _PTR void * | 24 | #define _PTR void * |
25 | #define _AND , | 25 | #define _AND , |
26 | #define _NOARGS void | 26 | #define _NOARGS void |
27 | #define _CONST const | 27 | #define _CONST const |
28 | #define _VOLATILE volatile | 28 | #define _VOLATILE volatile |
29 | #define _SIGNED signed | 29 | #define _SIGNED signed |
30 | #define _DOTS , ... | 30 | #define _DOTS , ... |
31 | #define _VOID void | 31 | #define _VOID void |
32 | #ifdef __CYGWIN__ | 32 | #ifdef __CYGWIN__ |
33 | #define _EXFUN(name, proto) __cdecl name proto | 33 | #define _EXFUN(name, proto) __cdecl name proto |
34 | #define _EXPARM(name, proto) (* __cdecl name) proto | 34 | #define _EXPARM(name, proto) (* __cdecl name) proto |
35 | #else | 35 | #else |
36 | #define _EXFUN(name, proto) name proto | 36 | #define _EXFUN(name, proto) name proto |
37 | #define _EXPARM(name, proto) (* name) proto | 37 | #define _EXPARM(name, proto) (* name) proto |
38 | #endif | 38 | #endif |
39 | #define _DEFUN(name, arglist, args) name(args) | 39 | #define _DEFUN(name, arglist, args) name(args) |
40 | #define _DEFUN_VOID(name) name(_NOARGS) | 40 | #define _DEFUN_VOID(name) name(_NOARGS) |
41 | #define _CAST_VOID (void) | 41 | #define _CAST_VOID (void) |
42 | #ifndef _LONG_DOUBLE | 42 | #ifndef _LONG_DOUBLE |
43 | #define _LONG_DOUBLE long double | 43 | #define _LONG_DOUBLE long double |
44 | #endif | 44 | #endif |
45 | #ifndef _PARAMS | 45 | #ifndef _PARAMS |
46 | #define _PARAMS(paramlist) paramlist | 46 | #define _PARAMS(paramlist) paramlist |
47 | #endif | 47 | #endif |
48 | #else | 48 | #else |
49 | #define _PTR char * | 49 | #define _PTR char * |
50 | #define _AND ; | 50 | #define _AND ; |
51 | #define _NOARGS | 51 | #define _NOARGS |
52 | #define _CONST | 52 | #define _CONST |
53 | #define _VOLATILE | 53 | #define _VOLATILE |
54 | #define _SIGNED | 54 | #define _SIGNED |
55 | #define _DOTS | 55 | #define _DOTS |
56 | #define _VOID void | 56 | #define _VOID void |
57 | #define _EXFUN(name, proto) name() | 57 | #define _EXFUN(name, proto) name() |
58 | #define _DEFUN(name, arglist, args) name arglist args; | 58 | #define _DEFUN(name, arglist, args) name arglist args; |
59 | #define _DEFUN_VOID(name) name() | 59 | #define _DEFUN_VOID(name) name() |
60 | #define _CAST_VOID | 60 | #define _CAST_VOID |
61 | #define _LONG_DOUBLE double | 61 | #define _LONG_DOUBLE double |
62 | #ifndef _PARAMS | 62 | #ifndef _PARAMS |
63 | #define _PARAMS(paramlist) () | 63 | #define _PARAMS(paramlist) () |
64 | #endif | 64 | #endif |
65 | #endif | 65 | #endif |
66 | 66 | ||
diff --git a/firmware/include/assert.h b/firmware/include/assert.h index ba22a9777b..2bf3aeb6c3 100644 --- a/firmware/include/assert.h +++ b/firmware/include/assert.h | |||
@@ -1,11 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | assert.h | 2 | assert.h |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #undef assert | 5 | #undef assert |
6 | 6 | ||
7 | #ifdef NDEBUG /* required by ANSI standard */ | 7 | #ifdef NDEBUG /* required by ANSI standard */ |
8 | #define assert(p) ((void)0) | 8 | #define assert(p) ((void)0) |
9 | #else | 9 | #else |
10 | 10 | ||
11 | #ifdef __STDC__ | 11 | #ifdef __STDC__ |
diff --git a/firmware/include/ctype.h b/firmware/include/ctype.h index 3a04e29ee0..648e06dc5c 100644 --- a/firmware/include/ctype.h +++ b/firmware/include/ctype.h | |||
@@ -27,14 +27,14 @@ int _EXFUN(_tolower, (int __c)); | |||
27 | int _EXFUN(_toupper, (int __c)); | 27 | int _EXFUN(_toupper, (int __c)); |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #define _U 01 | 30 | #define _U 01 |
31 | #define _L 02 | 31 | #define _L 02 |
32 | #define _N 04 | 32 | #define _N 04 |
33 | #define _S 010 | 33 | #define _S 010 |
34 | #define _P 020 | 34 | #define _P 020 |
35 | #define _C 040 | 35 | #define _C 040 |
36 | #define _X 0100 | 36 | #define _X 0100 |
37 | #define _B 0200 | 37 | #define _B 0200 |
38 | 38 | ||
39 | #ifdef PLUGIN | 39 | #ifdef PLUGIN |
40 | #define _ctype_ (rb->_rbctype_) | 40 | #define _ctype_ (rb->_rbctype_) |
@@ -43,30 +43,30 @@ extern const unsigned char _ctype_[257]; | |||
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #ifndef __cplusplus | 45 | #ifndef __cplusplus |
46 | #define isalpha(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L)) | 46 | #define isalpha(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L)) |
47 | #define isupper(c) ((_ctype_+1)[(unsigned char)(c)]&_U) | 47 | #define isupper(c) ((_ctype_+1)[(unsigned char)(c)]&_U) |
48 | #define islower(c) ((_ctype_+1)[(unsigned char)(c)]&_L) | 48 | #define islower(c) ((_ctype_+1)[(unsigned char)(c)]&_L) |
49 | #define isdigit(c) ((_ctype_+1)[(unsigned char)(c)]&_N) | 49 | #define isdigit(c) ((_ctype_+1)[(unsigned char)(c)]&_N) |
50 | #define isxdigit(c) ((_ctype_+1)[(unsigned char)(c)]&(_X|_N)) | 50 | #define isxdigit(c) ((_ctype_+1)[(unsigned char)(c)]&(_X|_N)) |
51 | #define isspace(c) ((_ctype_+1)[(unsigned char)(c)]&_S) | 51 | #define isspace(c) ((_ctype_+1)[(unsigned char)(c)]&_S) |
52 | #define ispunct(c) ((_ctype_+1)[(unsigned char)(c)]&_P) | 52 | #define ispunct(c) ((_ctype_+1)[(unsigned char)(c)]&_P) |
53 | #define isalnum(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L|_N)) | 53 | #define isalnum(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L|_N)) |
54 | #define isprint(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N|_B)) | 54 | #define isprint(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N|_B)) |
55 | #define isgraph(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N)) | 55 | #define isgraph(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N)) |
56 | #define iscntrl(c) ((_ctype_+1)[(unsigned char)(c)]&_C) | 56 | #define iscntrl(c) ((_ctype_+1)[(unsigned char)(c)]&_C) |
57 | /* Non-gcc versions will get the library versions, and will be | 57 | /* Non-gcc versions will get the library versions, and will be |
58 | slightly slower */ | 58 | slightly slower */ |
59 | #ifdef __GNUC__ | 59 | #ifdef __GNUC__ |
60 | # define toupper(c) \ | 60 | # define toupper(c) \ |
61 | __extension__ ({ int __x = (unsigned char) (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) | 61 | __extension__ ({ int __x = (unsigned char) (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) |
62 | # define tolower(c) \ | 62 | # define tolower(c) \ |
63 | __extension__ ({ int __x = (unsigned char) (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) | 63 | __extension__ ({ int __x = (unsigned char) (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) |
64 | #endif | 64 | #endif |
65 | #endif /* !__cplusplus */ | 65 | #endif /* !__cplusplus */ |
66 | 66 | ||
67 | #ifndef __STRICT_ANSI__ | 67 | #ifndef __STRICT_ANSI__ |
68 | #define isascii(c) ((unsigned char)(c)<=0177) | 68 | #define isascii(c) ((unsigned char)(c)<=0177) |
69 | #define toascii(c) ((c)&0177) | 69 | #define toascii(c) ((c)&0177) |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | #ifdef __cplusplus | 72 | #ifdef __cplusplus |
diff --git a/firmware/include/errno.h b/firmware/include/errno.h index 3a923238fc..6a24a1938f 100644 --- a/firmware/include/errno.h +++ b/firmware/include/errno.h | |||
@@ -16,130 +16,130 @@ | |||
16 | extern int errno; | 16 | extern int errno; |
17 | #endif | 17 | #endif |
18 | 18 | ||
19 | #define EPERM 1 /* Not super-user */ | 19 | #define EPERM 1 /* Not super-user */ |
20 | #define ENOENT 2 /* No such file or directory */ | 20 | #define ENOENT 2 /* No such file or directory */ |
21 | #define ESRCH 3 /* No such process */ | 21 | #define ESRCH 3 /* No such process */ |
22 | #define EINTR 4 /* Interrupted system call */ | 22 | #define EINTR 4 /* Interrupted system call */ |
23 | #define EIO 5 /* I/O error */ | 23 | #define EIO 5 /* I/O error */ |
24 | #define ENXIO 6 /* No such device or address */ | 24 | #define ENXIO 6 /* No such device or address */ |
25 | #define E2BIG 7 /* Arg list too long */ | 25 | #define E2BIG 7 /* Arg list too long */ |
26 | #define ENOEXEC 8 /* Exec format error */ | 26 | #define ENOEXEC 8 /* Exec format error */ |
27 | #define EBADF 9 /* Bad file number */ | 27 | #define EBADF 9 /* Bad file number */ |
28 | #define ECHILD 10 /* No children */ | 28 | #define ECHILD 10 /* No children */ |
29 | #define EAGAIN 11 /* No more processes */ | 29 | #define EAGAIN 11 /* No more processes */ |
30 | #define ENOMEM 12 /* Not enough core */ | 30 | #define ENOMEM 12 /* Not enough core */ |
31 | #define EACCES 13 /* Permission denied */ | 31 | #define EACCES 13 /* Permission denied */ |
32 | #define EFAULT 14 /* Bad address */ | 32 | #define EFAULT 14 /* Bad address */ |
33 | #define ENOTBLK 15 /* Block device required */ | 33 | #define ENOTBLK 15 /* Block device required */ |
34 | #define EBUSY 16 /* Mount device busy */ | 34 | #define EBUSY 16 /* Mount device busy */ |
35 | #define EEXIST 17 /* File exists */ | 35 | #define EEXIST 17 /* File exists */ |
36 | #define EXDEV 18 /* Cross-device link */ | 36 | #define EXDEV 18 /* Cross-device link */ |
37 | #define ENODEV 19 /* No such device */ | 37 | #define ENODEV 19 /* No such device */ |
38 | #define ENOTDIR 20 /* Not a directory */ | 38 | #define ENOTDIR 20 /* Not a directory */ |
39 | #define EISDIR 21 /* Is a directory */ | 39 | #define EISDIR 21 /* Is a directory */ |
40 | #define EINVAL 22 /* Invalid argument */ | 40 | #define EINVAL 22 /* Invalid argument */ |
41 | #define ENFILE 23 /* Too many open files in system */ | 41 | #define ENFILE 23 /* Too many open files in system */ |
42 | #define EMFILE 24 /* Too many open files */ | 42 | #define EMFILE 24 /* Too many open files */ |
43 | #define ENOTTY 25 /* Not a typewriter */ | 43 | #define ENOTTY 25 /* Not a typewriter */ |
44 | #define ETXTBSY 26 /* Text file busy */ | 44 | #define ETXTBSY 26 /* Text file busy */ |
45 | #define EFBIG 27 /* File too large */ | 45 | #define EFBIG 27 /* File too large */ |
46 | #define ENOSPC 28 /* No space left on device */ | 46 | #define ENOSPC 28 /* No space left on device */ |
47 | #define ESPIPE 29 /* Illegal seek */ | 47 | #define ESPIPE 29 /* Illegal seek */ |
48 | #define EROFS 30 /* Read only file system */ | 48 | #define EROFS 30 /* Read only file system */ |
49 | #define EMLINK 31 /* Too many links */ | 49 | #define EMLINK 31 /* Too many links */ |
50 | #define EPIPE 32 /* Broken pipe */ | 50 | #define EPIPE 32 /* Broken pipe */ |
51 | #define EDOM 33 /* Math arg out of domain of func */ | 51 | #define EDOM 33 /* Math arg out of domain of func */ |
52 | #define ERANGE 34 /* Math result not representable */ | 52 | #define ERANGE 34 /* Math result not representable */ |
53 | #define ENOMSG 35 /* No message of desired type */ | 53 | #define ENOMSG 35 /* No message of desired type */ |
54 | #define EIDRM 36 /* Identifier removed */ | 54 | #define EIDRM 36 /* Identifier removed */ |
55 | #define ECHRNG 37 /* Channel number out of range */ | 55 | #define ECHRNG 37 /* Channel number out of range */ |
56 | #define EL2NSYNC 38 /* Level 2 not synchronized */ | 56 | #define EL2NSYNC 38 /* Level 2 not synchronized */ |
57 | #define EL3HLT 39 /* Level 3 halted */ | 57 | #define EL3HLT 39 /* Level 3 halted */ |
58 | #define EL3RST 40 /* Level 3 reset */ | 58 | #define EL3RST 40 /* Level 3 reset */ |
59 | #define ELNRNG 41 /* Link number out of range */ | 59 | #define ELNRNG 41 /* Link number out of range */ |
60 | #define EUNATCH 42 /* Protocol driver not attached */ | 60 | #define EUNATCH 42 /* Protocol driver not attached */ |
61 | #define ENOCSI 43 /* No CSI structure available */ | 61 | #define ENOCSI 43 /* No CSI structure available */ |
62 | #define EL2HLT 44 /* Level 2 halted */ | 62 | #define EL2HLT 44 /* Level 2 halted */ |
63 | #define EDEADLK 45 /* Deadlock condition */ | 63 | #define EDEADLK 45 /* Deadlock condition */ |
64 | #define ENOLCK 46 /* No record locks available */ | 64 | #define ENOLCK 46 /* No record locks available */ |
65 | #define EBADE 50 /* Invalid exchange */ | 65 | #define EBADE 50 /* Invalid exchange */ |
66 | #define EBADR 51 /* Invalid request descriptor */ | 66 | #define EBADR 51 /* Invalid request descriptor */ |
67 | #define EXFULL 52 /* Exchange full */ | 67 | #define EXFULL 52 /* Exchange full */ |
68 | #define ENOANO 53 /* No anode */ | 68 | #define ENOANO 53 /* No anode */ |
69 | #define EBADRQC 54 /* Invalid request code */ | 69 | #define EBADRQC 54 /* Invalid request code */ |
70 | #define EBADSLT 55 /* Invalid slot */ | 70 | #define EBADSLT 55 /* Invalid slot */ |
71 | #define EDEADLOCK 56 /* File locking deadlock error */ | 71 | #define EDEADLOCK 56 /* File locking deadlock error */ |
72 | #define EBFONT 57 /* Bad font file fmt */ | 72 | #define EBFONT 57 /* Bad font file fmt */ |
73 | #define ENOSTR 60 /* Device not a stream */ | 73 | #define ENOSTR 60 /* Device not a stream */ |
74 | #define ENODATA 61 /* No data (for no delay io) */ | 74 | #define ENODATA 61 /* No data (for no delay io) */ |
75 | #define ETIME 62 /* Timer expired */ | 75 | #define ETIME 62 /* Timer expired */ |
76 | #define ENOSR 63 /* Out of streams resources */ | 76 | #define ENOSR 63 /* Out of streams resources */ |
77 | #define ENONET 64 /* Machine is not on the network */ | 77 | #define ENONET 64 /* Machine is not on the network */ |
78 | #define ENOPKG 65 /* Package not installed */ | 78 | #define ENOPKG 65 /* Package not installed */ |
79 | #define EREMOTE 66 /* The object is remote */ | 79 | #define EREMOTE 66 /* The object is remote */ |
80 | #define ENOLINK 67 /* The link has been severed */ | 80 | #define ENOLINK 67 /* The link has been severed */ |
81 | #define EADV 68 /* Advertise error */ | 81 | #define EADV 68 /* Advertise error */ |
82 | #define ESRMNT 69 /* Srmount error */ | 82 | #define ESRMNT 69 /* Srmount error */ |
83 | #define ECOMM 70 /* Communication error on send */ | 83 | #define ECOMM 70 /* Communication error on send */ |
84 | #define EPROTO 71 /* Protocol error */ | 84 | #define EPROTO 71 /* Protocol error */ |
85 | #define EMULTIHOP 74 /* Multihop attempted */ | 85 | #define EMULTIHOP 74 /* Multihop attempted */ |
86 | #define ELBIN 75 /* Inode is remote (not really error) */ | 86 | #define ELBIN 75 /* Inode is remote (not really error) */ |
87 | #define EDOTDOT 76 /* Cross mount point (not really error) */ | 87 | #define EDOTDOT 76 /* Cross mount point (not really error) */ |
88 | #define EBADMSG 77 /* Trying to read unreadable message */ | 88 | #define EBADMSG 77 /* Trying to read unreadable message */ |
89 | #define ENOTUNIQ 80 /* Given log. name not unique */ | 89 | #define ENOTUNIQ 80 /* Given log. name not unique */ |
90 | #define EBADFD 81 /* f.d. invalid for this operation */ | 90 | #define EBADFD 81 /* f.d. invalid for this operation */ |
91 | #define EREMCHG 82 /* Remote address changed */ | 91 | #define EREMCHG 82 /* Remote address changed */ |
92 | #define ELIBACC 83 /* Can't access a needed shared lib */ | 92 | #define ELIBACC 83 /* Can't access a needed shared lib */ |
93 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ | 93 | #define ELIBBAD 84 /* Accessing a corrupted shared lib */ |
94 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ | 94 | #define ELIBSCN 85 /* .lib section in a.out corrupted */ |
95 | #define ELIBMAX 86 /* Attempting to link in too many libs */ | 95 | #define ELIBMAX 86 /* Attempting to link in too many libs */ |
96 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ | 96 | #define ELIBEXEC 87 /* Attempting to exec a shared library */ |
97 | #define ENOSYS 88 /* Function not implemented */ | 97 | #define ENOSYS 88 /* Function not implemented */ |
98 | #define ENMFILE 89 /* No more files */ | 98 | #define ENMFILE 89 /* No more files */ |
99 | #define ENOTEMPTY 90 /* Directory not empty */ | 99 | #define ENOTEMPTY 90 /* Directory not empty */ |
100 | #define ENAMETOOLONG 91 /* File or path name too long */ | 100 | #define ENAMETOOLONG 91 /* File or path name too long */ |
101 | #define ELOOP 92 /* Too many symbolic links */ | 101 | #define ELOOP 92 /* Too many symbolic links */ |
102 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ | 102 | #define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ |
103 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ | 103 | #define EPFNOSUPPORT 96 /* Protocol family not supported */ |
104 | #define ECONNRESET 104 /* Connection reset by peer */ | 104 | #define ECONNRESET 104 /* Connection reset by peer */ |
105 | #define ENOBUFS 105 /* No buffer space available */ | 105 | #define ENOBUFS 105 /* No buffer space available */ |
106 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ | 106 | #define EAFNOSUPPORT 106 /* Address family not supported by protocol family */ |
107 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ | 107 | #define EPROTOTYPE 107 /* Protocol wrong type for socket */ |
108 | #define ENOTSOCK 108 /* Socket operation on non-socket */ | 108 | #define ENOTSOCK 108 /* Socket operation on non-socket */ |
109 | #define ENOPROTOOPT 109 /* Protocol not available */ | 109 | #define ENOPROTOOPT 109 /* Protocol not available */ |
110 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ | 110 | #define ESHUTDOWN 110 /* Can't send after socket shutdown */ |
111 | #define ECONNREFUSED 111 /* Connection refused */ | 111 | #define ECONNREFUSED 111 /* Connection refused */ |
112 | #define EADDRINUSE 112 /* Address already in use */ | 112 | #define EADDRINUSE 112 /* Address already in use */ |
113 | #define ECONNABORTED 113 /* Connection aborted */ | 113 | #define ECONNABORTED 113 /* Connection aborted */ |
114 | #define ENETUNREACH 114 /* Network is unreachable */ | 114 | #define ENETUNREACH 114 /* Network is unreachable */ |
115 | #define ENETDOWN 115 /* Network interface is not configured */ | 115 | #define ENETDOWN 115 /* Network interface is not configured */ |
116 | #define ETIMEDOUT 116 /* Connection timed out */ | 116 | #define ETIMEDOUT 116 /* Connection timed out */ |
117 | #define EHOSTDOWN 117 /* Host is down */ | 117 | #define EHOSTDOWN 117 /* Host is down */ |
118 | #define EHOSTUNREACH 118 /* Host is unreachable */ | 118 | #define EHOSTUNREACH 118 /* Host is unreachable */ |
119 | #define EINPROGRESS 119 /* Connection already in progress */ | 119 | #define EINPROGRESS 119 /* Connection already in progress */ |
120 | #define EALREADY 120 /* Socket already connected */ | 120 | #define EALREADY 120 /* Socket already connected */ |
121 | #define EDESTADDRREQ 121 /* Destination address required */ | 121 | #define EDESTADDRREQ 121 /* Destination address required */ |
122 | #define EMSGSIZE 122 /* Message too long */ | 122 | #define EMSGSIZE 122 /* Message too long */ |
123 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ | 123 | #define EPROTONOSUPPORT 123 /* Unknown protocol */ |
124 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ | 124 | #define ESOCKTNOSUPPORT 124 /* Socket type not supported */ |
125 | #define EADDRNOTAVAIL 125 /* Address not available */ | 125 | #define EADDRNOTAVAIL 125 /* Address not available */ |
126 | #define ENETRESET 126 | 126 | #define ENETRESET 126 |
127 | #define EISCONN 127 /* Socket is already connected */ | 127 | #define EISCONN 127 /* Socket is already connected */ |
128 | #define ENOTCONN 128 /* Socket is not connected */ | 128 | #define ENOTCONN 128 /* Socket is not connected */ |
129 | #define ETOOMANYREFS 129 | 129 | #define ETOOMANYREFS 129 |
130 | #define EPROCLIM 130 | 130 | #define EPROCLIM 130 |
131 | #define EUSERS 131 | 131 | #define EUSERS 131 |
132 | #define EDQUOT 132 | 132 | #define EDQUOT 132 |
133 | #define ESTALE 133 | 133 | #define ESTALE 133 |
134 | #define ENOTSUP 134 /* Not supported */ | 134 | #define ENOTSUP 134 /* Not supported */ |
135 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ | 135 | #define ENOMEDIUM 135 /* No medium (in tape drive) */ |
136 | #define ENOSHARE 136 /* No such host or network path */ | 136 | #define ENOSHARE 136 /* No such host or network path */ |
137 | #define ECASECLASH 137 /* Filename exists with different case */ | 137 | #define ECASECLASH 137 /* Filename exists with different case */ |
138 | 138 | ||
139 | /* From cygwin32. */ | 139 | /* From cygwin32. */ |
140 | #define EWOULDBLOCK EAGAIN /* Operation would block */ | 140 | #define EWOULDBLOCK EAGAIN /* Operation would block */ |
141 | 141 | ||
142 | #define __ELASTERROR 2000 /* Users can add values starting here */ | 142 | #define __ELASTERROR 2000 /* Users can add values starting here */ |
143 | 143 | ||
144 | #endif /* _SYS_ERRNO_H */ | 144 | #endif /* _SYS_ERRNO_H */ |
145 | #endif /* !SIMULATOR */ | 145 | #endif /* !SIMULATOR */ |
diff --git a/firmware/include/math.h b/firmware/include/math.h index d4b6715b3b..5415e43f86 100644 --- a/firmware/include/math.h +++ b/firmware/include/math.h | |||
@@ -23,25 +23,25 @@ extern "C" { | |||
23 | 23 | ||
24 | /* Useful constants. */ | 24 | /* Useful constants. */ |
25 | 25 | ||
26 | #define M_E 2.7182818284590452354 | 26 | #define M_E 2.7182818284590452354 |
27 | #define M_LOG2E 1.4426950408889634074 | 27 | #define M_LOG2E 1.4426950408889634074 |
28 | #define M_LOG10E 0.43429448190325182765 | 28 | #define M_LOG10E 0.43429448190325182765 |
29 | #define M_LN2 0.69314718055994530942 | 29 | #define M_LN2 0.69314718055994530942 |
30 | #define M_LN10 2.30258509299404568402 | 30 | #define M_LN10 2.30258509299404568402 |
31 | #define M_PI 3.14159265358979323846 | 31 | #define M_PI 3.14159265358979323846 |
32 | #define M_TWOPI (M_PI * 2.0) | 32 | #define M_TWOPI (M_PI * 2.0) |
33 | #define M_PI_2 1.57079632679489661923 | 33 | #define M_PI_2 1.57079632679489661923 |
34 | #define M_PI_4 0.78539816339744830962 | 34 | #define M_PI_4 0.78539816339744830962 |
35 | #define M_3PI_4 2.3561944901923448370E0 | 35 | #define M_3PI_4 2.3561944901923448370E0 |
36 | #define M_SQRTPI 1.77245385090551602792981 | 36 | #define M_SQRTPI 1.77245385090551602792981 |
37 | #define M_1_PI 0.31830988618379067154 | 37 | #define M_1_PI 0.31830988618379067154 |
38 | #define M_2_PI 0.63661977236758134308 | 38 | #define M_2_PI 0.63661977236758134308 |
39 | #define M_2_SQRTPI 1.12837916709551257390 | 39 | #define M_2_SQRTPI 1.12837916709551257390 |
40 | #define M_SQRT2 1.41421356237309504880 | 40 | #define M_SQRT2 1.41421356237309504880 |
41 | #define M_SQRT1_2 0.70710678118654752440 | 41 | #define M_SQRT1_2 0.70710678118654752440 |
42 | #define M_LN2LO 1.9082149292705877000E-10 | 42 | #define M_LN2LO 1.9082149292705877000E-10 |
43 | #define M_LN2HI 6.9314718036912381649E-1 | 43 | #define M_LN2HI 6.9314718036912381649E-1 |
44 | #define M_SQRT3 1.73205080756887719000 | 44 | #define M_SQRT3 1.73205080756887719000 |
45 | #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ | 45 | #define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */ |
46 | #define M_LOG2_E 0.693147180559945309417 | 46 | #define M_LOG2_E 0.693147180559945309417 |
47 | #define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ | 47 | #define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */ |
diff --git a/firmware/include/stdio.h b/firmware/include/stdio.h index 968bd59aab..6ae2ff603a 100644 --- a/firmware/include/stdio.h +++ b/firmware/include/stdio.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef _STDIO_H_ | 1 | #ifndef _STDIO_H_ |
2 | #define _STDIO_H_ | 2 | #define _STDIO_H_ |
3 | 3 | ||
4 | #include <_ansi.h> | 4 | #include <_ansi.h> |
5 | 5 | ||
@@ -10,22 +10,22 @@ | |||
10 | #include <stdarg.h> | 10 | #include <stdarg.h> |
11 | 11 | ||
12 | #ifndef NULL | 12 | #ifndef NULL |
13 | #define NULL 0 | 13 | #define NULL 0 |
14 | #endif | 14 | #endif |
15 | 15 | ||
16 | #define EOF (-1) | 16 | #define EOF (-1) |
17 | 17 | ||
18 | #ifndef SEEK_SET | 18 | #ifndef SEEK_SET |
19 | #define SEEK_SET 0 /* set file offset to offset */ | 19 | #define SEEK_SET 0 /* set file offset to offset */ |
20 | #endif | 20 | #endif |
21 | #ifndef SEEK_CUR | 21 | #ifndef SEEK_CUR |
22 | #define SEEK_CUR 1 /* set file offset to current plus offset */ | 22 | #define SEEK_CUR 1 /* set file offset to current plus offset */ |
23 | #endif | 23 | #endif |
24 | #ifndef SEEK_END | 24 | #ifndef SEEK_END |
25 | #define SEEK_END 2 /* set file offset to EOF plus offset */ | 25 | #define SEEK_END 2 /* set file offset to EOF plus offset */ |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #define TMP_MAX 26 | 28 | #define TMP_MAX 26 |
29 | 29 | ||
30 | #ifdef __GNUC__ | 30 | #ifdef __GNUC__ |
31 | #define __VALIST __gnuc_va_list | 31 | #define __VALIST __gnuc_va_list |
diff --git a/firmware/include/stdlib.h b/firmware/include/stdlib.h index a287889c6a..6de00c816d 100644 --- a/firmware/include/stdlib.h +++ b/firmware/include/stdlib.h | |||
@@ -23,7 +23,7 @@ extern "C" { | |||
23 | #define EXIT_FAILURE 1 | 23 | #define EXIT_FAILURE 1 |
24 | #define EXIT_SUCCESS 0 | 24 | #define EXIT_SUCCESS 0 |
25 | 25 | ||
26 | _VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); | 26 | _VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, int(*_compar)(const _PTR, const _PTR))); |
27 | 27 | ||
28 | void *malloc(size_t); | 28 | void *malloc(size_t); |
29 | void *calloc (size_t nmemb, size_t size); | 29 | void *calloc (size_t nmemb, size_t size); |
diff --git a/firmware/include/string.h b/firmware/include/string.h index c647178ffe..1a2e056717 100644 --- a/firmware/include/string.h +++ b/firmware/include/string.h | |||
@@ -5,7 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef _STRING_H_ | 7 | #ifndef _STRING_H_ |
8 | #define _STRING_H_ | 8 | #define _STRING_H_ |
9 | 9 | ||
10 | #ifdef __cplusplus | 10 | #ifdef __cplusplus |
11 | extern "C" { | 11 | extern "C" { |
@@ -20,45 +20,45 @@ extern "C" { | |||
20 | #define NULL ((void*)0) | 20 | #define NULL ((void*)0) |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | _PTR _EXFUN(memchr,(const _PTR, int, size_t)); | 23 | _PTR _EXFUN(memchr,(const _PTR, int, size_t)); |
24 | int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); | 24 | int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); |
25 | _PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t)); | 25 | _PTR _EXFUN(memcpy,(_PTR, const _PTR, size_t)); |
26 | _PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); | 26 | _PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); |
27 | _PTR _EXFUN(memset,(_PTR, int, size_t)); | 27 | _PTR _EXFUN(memset,(_PTR, int, size_t)); |
28 | char *_EXFUN(strcat,(char *, const char *)); | 28 | char *_EXFUN(strcat,(char *, const char *)); |
29 | char *_EXFUN(strchr,(const char *, int)); | 29 | char *_EXFUN(strchr,(const char *, int)); |
30 | int _EXFUN(strcmp,(const char *, const char *)); | 30 | int _EXFUN(strcmp,(const char *, const char *)); |
31 | int _EXFUN(strcoll,(const char *, const char *)); | 31 | int _EXFUN(strcoll,(const char *, const char *)); |
32 | char *_EXFUN(strcpy,(char *, const char *)); | 32 | char *_EXFUN(strcpy,(char *, const char *)); |
33 | size_t _EXFUN(strcspn,(const char *, const char *)); | 33 | size_t _EXFUN(strcspn,(const char *, const char *)); |
34 | char *_EXFUN(strerror,(int)); | 34 | char *_EXFUN(strerror,(int)); |
35 | size_t _EXFUN(strlen,(const char *)); | 35 | size_t _EXFUN(strlen,(const char *)); |
36 | char *_EXFUN(strncat,(char *, const char *, size_t)); | 36 | char *_EXFUN(strncat,(char *, const char *, size_t)); |
37 | int _EXFUN(strncmp,(const char *, const char *, size_t)); | 37 | int _EXFUN(strncmp,(const char *, const char *, size_t)); |
38 | char *_EXFUN(strpbrk,(const char *, const char *)); | 38 | char *_EXFUN(strpbrk,(const char *, const char *)); |
39 | char *_EXFUN(strrchr,(const char *, int)); | 39 | char *_EXFUN(strrchr,(const char *, int)); |
40 | size_t _EXFUN(strspn,(const char *, const char *)); | 40 | size_t _EXFUN(strspn,(const char *, const char *)); |
41 | char *_EXFUN(strstr,(const char *, const char *)); | 41 | char *_EXFUN(strstr,(const char *, const char *)); |
42 | char *_EXFUN(strcasestr,(const char *, const char *)); | 42 | char *_EXFUN(strcasestr,(const char *, const char *)); |
43 | 43 | ||
44 | size_t strlcpy(char *dst, const char *src, size_t siz); | 44 | size_t strlcpy(char *dst, const char *src, size_t siz); |
45 | size_t strlcat(char *dst, const char *src, size_t siz); | 45 | size_t strlcat(char *dst, const char *src, size_t siz); |
46 | 46 | ||
47 | #ifndef _REENT_ONLY | 47 | #ifndef _REENT_ONLY |
48 | char *_EXFUN(strtok,(char *, const char *)); | 48 | char *_EXFUN(strtok,(char *, const char *)); |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | size_t _EXFUN(strxfrm,(char *, const char *, size_t)); | 51 | size_t _EXFUN(strxfrm,(char *, const char *, size_t)); |
52 | 52 | ||
53 | #ifndef __STRICT_ANSI__ | 53 | #ifndef __STRICT_ANSI__ |
54 | char *_EXFUN(strtok_r,(char *, const char *, char **)); | 54 | char *_EXFUN(strtok_r,(char *, const char *, char **)); |
55 | 55 | ||
56 | _PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t)); | 56 | _PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t)); |
57 | int _EXFUN(strcasecmp,(const char *, const char *)); | 57 | int _EXFUN(strcasecmp,(const char *, const char *)); |
58 | int _EXFUN(strncasecmp,(const char *, const char *, size_t)); | 58 | int _EXFUN(strncasecmp,(const char *, const char *, size_t)); |
59 | 59 | ||
60 | #ifdef __CYGWIN__ | 60 | #ifdef __CYGWIN__ |
61 | #ifndef DEFS_H /* Kludge to work around problem compiling in gdb */ | 61 | #ifndef DEFS_H /* Kludge to work around problem compiling in gdb */ |
62 | const char *_EXFUN(strsignal, (int __signo)); | 62 | const char *_EXFUN(strsignal, (int __signo)); |
63 | #endif | 63 | #endif |
64 | int _EXFUN(strtosigno, (const char *__name)); | 64 | int _EXFUN(strtosigno, (const char *__name)); |
diff --git a/firmware/include/time.h b/firmware/include/time.h index 9010d99cc2..28680494f9 100644 --- a/firmware/include/time.h +++ b/firmware/include/time.h | |||
@@ -14,15 +14,15 @@ | |||
14 | 14 | ||
15 | struct tm | 15 | struct tm |
16 | { | 16 | { |
17 | int tm_sec; | 17 | int tm_sec; |
18 | int tm_min; | 18 | int tm_min; |
19 | int tm_hour; | 19 | int tm_hour; |
20 | int tm_mday; | 20 | int tm_mday; |
21 | int tm_mon; | 21 | int tm_mon; |
22 | int tm_year; | 22 | int tm_year; |
23 | int tm_wday; | 23 | int tm_wday; |
24 | int tm_yday; | 24 | int tm_yday; |
25 | int tm_isdst; | 25 | int tm_isdst; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | #if !defined(_TIME_T_DEFINED) && !defined(_TIME_T_DECLARED) | 28 | #if !defined(_TIME_T_DEFINED) && !defined(_TIME_T_DECLARED) |