Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / DtSvc / DtUtil2 / DtNlUtils.h
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 librararies 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
36 #ifdef NLS16
37
38 #include <stdlib.h>
39 #include <locale.h>
40 #include <string.h>
41 #include <limits.h>
42 #include <nl_types.h>
43 #include <langinfo.h>
44 #endif
45
46 #include <X11/Intrinsic.h>
47
48
49 #ifdef NLS16
50
51 #define is_multibyte    _DtNl_is_multibyte
52 extern Boolean _DtNl_is_multibyte;
53
54
55 extern void Dt_nlInit( void ) ;
56 extern char * Dt_strtok( 
57                         char *s1,
58                         char *s2) ;
59 extern char * Dt_strtok_r( 
60                         char *s1,
61                         char *s2,
62                         char **ptr) ;
63 extern int Dt_strspn( 
64                         char *s1,
65                         char *s2) ;
66 extern int Dt_strcspn( 
67                         char *s1,
68                         char *s2) ;
69 extern char * Dt_strchr( 
70                         char *s,
71                         char c) ;
72 extern char * Dt_strrchr( 
73                         char *s,
74                         char c) ;
75 extern void Dt_lastChar( 
76                         char *s,
77                         char **cptr,
78                         int *lenptr) ;
79 extern int Dt_charCount( 
80                         char *s) ;
81
82 extern char * _Dt_NextChar(char *s);
83 extern char * _Dt_PrevChar(const char *start,char *s);
84 extern int _Dt_isspace(char *s);
85 extern int _Dt_isdigit(char *s);
86
87 #define DtNlInitialize()     (Dt_nlInit())
88 #define DtStrtok(s1, s2)     (Dt_strtok(s1, s2))
89 #define DtStrtok_r(s1, s2, ptr)     (Dt_strtok_r(s1, s2, ptr))
90 #define DtStrspn(s1, s2)     (Dt_strspn(s1, s2))
91 #define DtStrcspn(s1, s2)    (Dt_strcspn(s1, s2))
92 #define DtStrchr(s1, c)      (Dt_strchr(s1, c))
93 #define DtStrrchr(s1, c)     (Dt_strrchr(s1, c))
94 #define DtLastChar(s1, cp, lp)   (Dt_lastChar(s1, cp, lp))
95 #define DtCharCount(s1)      (Dt_charCount(s1))
96 #define DtNextChar(s)        (is_multibyte?_Dt_NextChar(s):((s)+1))
97 #define DtPrevChar(st,s)     (is_multibyte?_Dt_PrevChar(st,s):((s)-1))
98 #define DtIsspace(s)         (is_multibyte?_Dt_isspace(s):isspace(*(s)))
99 #define DtIsdigit(s)         (is_multibyte?_Dt_isdigit(s):isdigit(*(s)))
100
101 #else   /* NLS16 */
102
103 #define DtNlInitialize()
104 #define DtStrtok(s1, s2)     (strtok(s1, s2))
105 #define DtStrtok_r(s1, s2, ptr)     (strtok_r(s1, s2, ptr))
106 #define DtStrspn(s1, s2)     (strspn(s1, s2))
107 #define DtStrcspn(s1, s2)    (strcspn(s1, s2))
108 #define DtStrchr(s1, c)      (strchr(s1, c))
109 #define DtStrrchr(s1, c)     (strrchr(s1, c))
110 #define DtLastChar(s1, cp, lp)   {(*cp = s1 + strlen(s1) - 1); *lp = 1;}
111 #define DtCharCount(s1)      (strlen(s1))
112 #define DtNextChar(s)        ((s)+1)
113 #define DtPrevChar(st,s)     ((s)-1)
114 #define DtIsspace(s)         (isspace(*s))
115 #define DtIsdigit(s)         (isdigit(*s))
116 #endif /* NLS16 */
117
118 extern char * _DtGetNthChar( 
119                         char *s,
120                         int n) ;
121 extern char * _dt_strpbrk(
122                         char *cs,
123                         char *ct);
124 extern int _is_previous_single(
125                         char *s1,
126                         char *s2);
127