AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Library Reference FAQ Alphabetical Index Example Projects

string.h

このファイルのドキュメントを参照する
00001 /* Copyright (c) 2002,2007 Marek Michalkiewicz
00002    All rights reserved.
00003 
00004    Redistribution and use in source and binary forms, with or without
00005    modification, are permitted provided that the following conditions are met:
00006 
00007    * Redistributions of source code must retain the above copyright
00008      notice, this list of conditions and the following disclaimer.
00009 
00010    * Redistributions in binary form must reproduce the above copyright
00011      notice, this list of conditions and the following disclaimer in
00012      the documentation and/or other materials provided with the
00013      distribution.
00014 
00015    * Neither the name of the copyright holders nor the names of
00016      contributors may be used to endorse or promote products derived
00017      from this software without specific prior written permission.
00018 
00019   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029   POSSIBILITY OF SUCH DAMAGE. */
00030 
00031 /* $Id: string.h 1831 2008-12-21 02:27:49Z dmix $ */
00032 
00033 /*
00034    string.h
00035 
00036    Contributors:
00037      Created by Marek Michalkiewicz <marekm@linux.org.pl>
00038  */
00039 
00040 #ifndef _STRING_H_
00041 #define _STRING_H_ 1
00042 
00043 #define __need_NULL
00044 #define __need_size_t
00045 #include <stddef.h>
00046 
00047 #ifndef __ATTR_PURE__
00048 #define __ATTR_PURE__ __attribute__((__pure__))
00049 #endif
00050 
00051 #ifndef __ATTR_CONST__
00052 # define __ATTR_CONST__ __attribute__((__const__))
00053 #endif
00054 
00055 #ifdef __cplusplus
00056 extern "C" {
00057 #endif
00058 
00059 /** \file */
00060 /** \defgroup avr_string <string.h>: Strings
00061     \code #include <string.h> \endcode
00062 
00063     The string functions perform string operations on NULL terminated
00064     strings. 
00065 
00066     \note If the strings you are working on resident in program space (flash),
00067     you will need to use the string functions described in \ref avr_pgmspace. */
00068 
00069 
00070 /** \ingroup avr_string
00071 
00072     This macro finds the first (least significant) bit set in the
00073     input value.
00074 
00075     This macro is very similar to the function ffs() except that
00076     it evaluates its argument at compile-time, so it should only
00077     be applied to compile-time constant expressions where it will
00078     reduce to a constant itself.
00079     Application of this macro to expressions that are not constant
00080     at compile-time is not recommended, and might result in a huge
00081     amount of code generated.
00082 
00083     \returns The _FFS() macro returns the position of the first
00084     (least significant) bit set in the word val, or 0 if no bits are set.
00085     The least significant bit is position 1.  Only 16 bits of argument
00086     are evaluted.
00087 */
00088 #if defined(__DOXYGEN__)
00089 #define _FFS(x)
00090 #else  /* !DOXYGEN */
00091 #define _FFS(x) \
00092         (1                              \
00093          + (((x) & 1) == 0)             \
00094          + (((x) & 3) == 0)             \
00095          + (((x) & 7) == 0)             \
00096          + (((x) & 017) == 0)           \
00097          + (((x) & 037) == 0)           \
00098          + (((x) & 077) == 0)           \
00099          + (((x) & 0177) == 0)          \
00100          + (((x) & 0377) == 0)          \
00101          + (((x) & 0777) == 0)          \
00102          + (((x) & 01777) == 0)         \
00103          + (((x) & 03777) == 0)         \
00104          + (((x) & 07777) == 0)         \
00105          + (((x) & 017777) == 0)        \
00106          + (((x) & 037777) == 0)        \
00107          + (((x) & 077777) == 0)        \
00108          - (((x) & 0177777) == 0) * 16)
00109 #endif /* DOXYGEN */
00110 
00111 extern int ffs (int __val) __ATTR_CONST__;
00112 extern int ffsl (long __val) __ATTR_CONST__;
00113 extern int ffsll (long long __val) __ATTR_CONST__;
00114 extern void *memccpy(void *, const void *, int, size_t);
00115 extern void *memchr(const void *, int, size_t) __ATTR_PURE__;
00116 extern int memcmp(const void *, const void *, size_t) __ATTR_PURE__;
00117 extern void *memcpy(void *, const void *, size_t);
00118 extern void *memmem(const void *, size_t, const void *, size_t) __ATTR_PURE__;
00119 extern void *memmove(void *, const void *, size_t);
00120 extern void *memrchr(const void *, int, size_t) __ATTR_PURE__;
00121 extern void *memset(void *, int, size_t);
00122 extern char *strcat(char *, const char *);
00123 extern char *strchr(const char *, int) __ATTR_PURE__;
00124 extern char *strchrnul(const char *, int) __ATTR_PURE__;
00125 extern int strcmp(const char *, const char *) __ATTR_PURE__;
00126 extern char *strcpy(char *, const char *);
00127 extern int strcasecmp(const char *, const char *) __ATTR_PURE__;
00128 extern char *strcasestr(const char *, const char *) __ATTR_PURE__;
00129 extern size_t strcspn(const char *__s, const char *__reject) __ATTR_PURE__;
00130 extern char *strdup(const char *s1);
00131 extern size_t strlcat(char *, const char *, size_t);
00132 extern size_t strlcpy(char *, const char *, size_t);
00133 extern size_t strlen(const char *) __ATTR_PURE__;
00134 extern char *strlwr(char *);
00135 extern char *strncat(char *, const char *, size_t);
00136 extern int strncmp(const char *, const char *, size_t) __ATTR_PURE__;
00137 extern char *strncpy(char *, const char *, size_t);
00138 extern int strncasecmp(const char *, const char *, size_t) __ATTR_PURE__;
00139 extern size_t strnlen(const char *, size_t) __ATTR_PURE__;
00140 extern char *strpbrk(const char *__s, const char *__accept) __ATTR_PURE__;
00141 extern char *strrchr(const char *, int) __ATTR_PURE__;
00142 extern char *strrev(char *);
00143 extern char *strsep(char **, const char *);
00144 extern size_t strspn(const char *__s, const char *__accept) __ATTR_PURE__;
00145 extern char *strstr(const char *, const char *) __ATTR_PURE__;
00146 extern char *strtok(char *, const char *);
00147 extern char *strtok_r(char *, const char *, char **);
00148 extern char *strupr(char *);
00149 
00150 #ifdef __cplusplus
00151 }
00152 #endif
00153 
00154 #endif /* _STRING_H_ */
00155 

Automatically generated by Doxygen 1.7.2 on Wed Feb 16 2011.

翻訳更新:2011年10月8日 by cega