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