strings.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /****************************************************************************
  2. * include/strings.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. #ifndef __INCLUDE_STRINGS_H
  21. #define __INCLUDE_STRINGS_H
  22. /****************************************************************************
  23. * Included Files
  24. ****************************************************************************/
  25. #include <nuttx/config.h>
  26. #include <string.h>
  27. /****************************************************************************
  28. * Pre-processor Definitions
  29. ****************************************************************************/
  30. /* Compatibility definitions
  31. *
  32. * Marked LEGACY in Open Group Base Specifications Issue 6/
  33. * IEEE Std 1003.1-2004
  34. * Removed from Open Group Base Specifications Issue 7/
  35. * IEEE Std 1003.1-2008
  36. */
  37. #ifndef bcmp /* See mm/README.txt */
  38. #define bcmp(b1,b2,len) memcmp(b1,b2,(size_t)len)
  39. #endif
  40. #ifndef bcopy /* See mm/README.txt */
  41. #define bcopy(b1,b2,len) (void)memmove(b2,b1,len)
  42. #endif
  43. #ifndef bzero /* See mm/README.txt */
  44. #define bzero(s,n) (void)memset(s,0,n)
  45. #endif
  46. /****************************************************************************
  47. * Inline Functions
  48. ****************************************************************************/
  49. #undef EXTERN
  50. #if defined(__cplusplus)
  51. #define EXTERN extern "C"
  52. extern "C"
  53. {
  54. #else
  55. #define EXTERN extern
  56. #endif
  57. /****************************************************************************
  58. * Public Function Prototypes
  59. ****************************************************************************/
  60. int ffs(int j);
  61. int ffsl(long j);
  62. #ifdef CONFIG_HAVE_LONG_LONG
  63. int ffsll(long long j);
  64. #endif
  65. int fls(int j);
  66. int flsl(long j);
  67. #ifdef CONFIG_HAVE_LONG_LONG
  68. int flsll(long long j);
  69. #endif
  70. unsigned int popcount(unsigned int j);
  71. unsigned int popcountl(unsigned long j);
  72. unsigned int popcountll(unsigned long long j);
  73. FAR char *index(FAR const char *s, int c);
  74. FAR char *rindex(FAR const char *s, int c);
  75. int strcasecmp(FAR const char *, FAR const char *);
  76. int strncasecmp(FAR const char *, FAR const char *, size_t);
  77. #undef EXTERN
  78. #if defined(__cplusplus)
  79. }
  80. #endif
  81. #endif /* __INCLUDE_STRINGS_H */