preparing for release of 2.2.3a
[Samba.git] / source / include / charset.h
blob5a683e09683f450e65969a80919f9b3b203fa79b
1 #ifndef _CHARSET_H
2 #define _CHARSET_H
4 /*
5 Unix SMB/Netbios implementation.
6 Version 1.9.
7 Character set handling
8 Copyright (C) Andrew Tridgell 1992-1998
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifndef CHARSET_C
27 extern char *dos_char_map;
28 extern char *upper_char_map;
29 extern char *lower_char_map;
30 extern void add_char_string(char *s);
31 extern void charset_initialise(void);
33 #ifdef toupper
34 #undef toupper
35 #endif
37 #ifdef tolower
38 #undef tolower
39 #endif
41 #ifdef isupper
42 #undef isupper
43 #endif
45 #ifdef islower
46 #undef islower
47 #endif
49 #ifdef isdoschar
50 #undef isdoschar
51 #endif
53 #ifdef isspace
54 #undef isspace
55 #endif
57 #define toupper(c) (upper_char_map[((c)&0xff)] & 0xff)
58 #define tolower(c) (lower_char_map[((c)&0xff)] & 0xff)
59 #define isupper(c) (((c)&0xff) != tolower((c)&0xff))
60 #define islower(c) (((c)&0xff) != toupper((c)&0xff))
61 #define isdoschar(c) (dos_char_map[((c)&0xff)] != 0)
62 #define isspace(c) ((c)==' ' || (c) == '\t')
64 /* this is used to determine if a character is safe to use in
65 something that may be put on a command line */
66 #define issafe(c) (isalnum((c&0xff)) || strchr("-._",c))
67 #endif
69 /* Dynamic codepage files defines. */
71 /* Version id for dynamically loadable codepage files. */
72 #define CODEPAGE_FILE_VERSION_ID 0x1
73 /* Version 1 codepage file header size. */
74 #define CODEPAGE_HEADER_SIZE 8
75 /* Offsets for codepage file header entries. */
76 #define CODEPAGE_VERSION_OFFSET 0
77 #define CODEPAGE_CLIENT_CODEPAGE_OFFSET 2
78 #define CODEPAGE_LENGTH_OFFSET 4
80 /* Version id for dynamically loadable unicode map files. */
81 #define UNICODE_MAP_FILE_VERSION_ID 0x8001
82 /* Version 0x80000001 unicode map file header size. */
83 #define UNICODE_MAP_HEADER_SIZE 30
84 #define UNICODE_MAP_CODEPAGE_ID_SIZE 20
85 /* Offsets for unicode map file header entries. */
86 #define UNICODE_MAP_VERSION_OFFSET 0
87 #define UNICODE_MAP_CLIENT_CODEPAGE_OFFSET 2
88 #define UNICODE_MAP_CP_TO_UNICODE_LENGTH_OFFSET 22
89 #define UNICODE_MAP_UNICODE_TO_CP_LENGTH_OFFSET 26
91 #endif /* _CHARSET_H */