DtNlUtils.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: DtNlUtils.h /main/4 1996/06/21 17:22:30 ageorge $ */
  24. /*
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company *
  26. * (c) Copyright 1993, 1994 International Business Machines Corp. *
  27. * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
  28. * (c) Copyright 1993, 1994 Novell, Inc. *
  29. */
  30. /**************************************************************************/
  31. /* */
  32. /* Public include file for Dt localization functions. */
  33. /* */
  34. /**************************************************************************/
  35. #ifdef NLS16
  36. #include <stdlib.h>
  37. #include <locale.h>
  38. #include <string.h>
  39. #include <limits.h>
  40. #include <langinfo.h>
  41. #include <Dt/MsgCatP.h>
  42. #endif
  43. #include <ctype.h>
  44. #include <X11/Intrinsic.h>
  45. #ifdef NLS16
  46. #define is_multibyte _DtNl_is_multibyte
  47. extern Boolean _DtNl_is_multibyte;
  48. extern void Dt_nlInit( void ) ;
  49. extern char * Dt_strtok(
  50. char *s1,
  51. char *s2) ;
  52. extern char * Dt_strtok_r(
  53. char *s1,
  54. char *s2,
  55. char **ptr) ;
  56. extern int Dt_strspn(
  57. char *s1,
  58. char *s2) ;
  59. extern int Dt_strcspn(
  60. char *s1,
  61. char *s2) ;
  62. extern char * Dt_strchr(
  63. char *s,
  64. char c) ;
  65. extern char * Dt_strrchr(
  66. char *s,
  67. char c) ;
  68. extern void Dt_lastChar(
  69. char *s,
  70. char **cptr,
  71. int *lenptr) ;
  72. extern int Dt_charCount(
  73. char *s) ;
  74. extern char * _Dt_NextChar(char *s);
  75. extern char * _Dt_PrevChar(const char *start,char *s);
  76. extern int _Dt_isspace(char *s);
  77. extern int _Dt_isdigit(char *s);
  78. #define DtNlInitialize() (Dt_nlInit())
  79. #define DtStrtok(s1, s2) (Dt_strtok(s1, s2))
  80. #define DtStrtok_r(s1, s2, ptr) (Dt_strtok_r(s1, s2, ptr))
  81. #define DtStrspn(s1, s2) (Dt_strspn(s1, s2))
  82. #define DtStrcspn(s1, s2) (Dt_strcspn(s1, s2))
  83. #define DtStrchr(s1, c) (Dt_strchr(s1, c))
  84. #define DtStrrchr(s1, c) (Dt_strrchr(s1, c))
  85. #define DtLastChar(s1, cp, lp) (Dt_lastChar(s1, cp, lp))
  86. #define DtCharCount(s1) (Dt_charCount(s1))
  87. #define DtNextChar(s) (is_multibyte?_Dt_NextChar(s):((s)+1))
  88. #define DtPrevChar(st,s) (is_multibyte?_Dt_PrevChar(st,s):((s)-1))
  89. #define DtIsspace(s) (is_multibyte?_Dt_isspace(s):isspace(*(s)))
  90. #define DtIsdigit(s) (is_multibyte?_Dt_isdigit(s):isdigit(*(s)))
  91. #else /* NLS16 */
  92. #define DtNlInitialize()
  93. #define DtStrtok(s1, s2) (strtok(s1, s2))
  94. #define DtStrtok_r(s1, s2, ptr) (strtok_r(s1, s2, ptr))
  95. #define DtStrspn(s1, s2) (strspn(s1, s2))
  96. #define DtStrcspn(s1, s2) (strcspn(s1, s2))
  97. #define DtStrchr(s1, c) (strchr(s1, c))
  98. #define DtStrrchr(s1, c) (strrchr(s1, c))
  99. #define DtLastChar(s1, cp, lp) {(*cp = s1 + strlen(s1) - 1); *lp = 1;}
  100. #define DtCharCount(s1) (strlen(s1))
  101. #define DtNextChar(s) ((s)+1)
  102. #define DtPrevChar(st,s) ((s)-1)
  103. #define DtIsspace(s) (isspace(*s))
  104. #define DtIsdigit(s) (isdigit(*s))
  105. #endif /* NLS16 */
  106. extern char * _DtGetNthChar(
  107. char *s,
  108. int n) ;
  109. extern char * _dt_strpbrk(
  110. char *cs,
  111. char *ct);
  112. extern int _is_previous_single(
  113. char *s1,
  114. char *s2);