add casts to zune macros to silence some warnings
[tangerine.git] / workbench / libs / locale / locale_intern.h
blob69ada4fbcb61ebf012348fc97e8ef5dec283ff09
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Internal definitions for the locale.library.
6 Lang: english
7 */
9 #ifndef LOCALE_INTERN_H
10 #define LOCALE_INTERN_H
12 #ifndef EXEC_EXECBASE_H
13 #include <exec/execbase.h>
14 #endif
15 #ifndef EXEC_SEMAPHORES_H
16 #include <exec/semaphores.h>
17 #endif
18 #ifndef DOS_DOSEXTENS_H
19 #include <dos/dosextens.h>
20 #endif
21 #ifndef LIBRARIES_LOCALE_H
22 #include <libraries/locale.h>
23 #endif
24 #ifndef UTILITY_UTILITY_H
25 #include <utility/utility.h>
26 #endif
27 #ifdef __MORPHOS__
28 #include <aros/libcall.h>
29 #endif
31 /* aros_print_not_implemented() macro: */
32 #include <aros/debug.h>
33 #include <aros/asmcall.h>
34 /* Should the Loc???() replacement functions lock the default locale.
35 1 = yes. 0 = no. If you set this to 0, then you must make sure that
36 a Locale which was once set as default Locale never gets freed from
37 memory. */
39 #define REPLACEMENTFUNCS_LOCK_LOCALE 0
41 /* [New]FormatString: Allow %width.limit formatting in all format
42 tokens not just s and b. 1 = yes. 0 = no. exec.doc/RawDoFmt autodoc
43 is wrong %d and %x do support this, too, so this should be set to 1. */
45 #define USE_GLOBALLIMIT 1
47 /* [New]FormatString: Should formatting routine support 64bit formatting
48 %L<type> and %ll<type>. 1 = yes. 0 = no. Current implementation use
49 QUAD and UQUAD types. */
51 #ifdef __MORPHOS__
52 #define USE_QUADFMT 1
53 #else
54 #define USE_QUADFMT 0
55 #endif
57 struct IntLocaleBase
59 struct LocaleBase lb_LocaleBase;
61 struct IntLocale *lb_DefaultLocale;
62 struct IntLocale *lb_CurrentLocale;
63 struct SignalSemaphore lb_LocaleLock;
64 struct SignalSemaphore lb_CatalogLock;
65 struct MinList lb_CatalogList;
68 struct IntLocale
70 struct Locale il_Locale;
72 UWORD il_Count;
73 struct Library *il_CurrentLanguage;
74 struct Catalog *il_DosCatalog;
75 APTR il_LanguageFunctions[32];
77 /* Need to put all sorts of crap here later. */
78 UBYTE LocaleName[30];
79 UBYTE LanguageName[30];
81 UBYTE PreferredLanguages[10][30];
84 ** Don't change the order of the following field,
85 ** It's based on CountryPrefs structure in
86 ** <prefs/locale.h> and InitLocale() relies on this
87 ** as well!
90 UBYTE DateTimeFormat[80];
91 UBYTE DateFormat[40];
92 UBYTE TimeFormat[40];
93 UBYTE ShortDateTimeFormat[80];
94 UBYTE ShortDateFormat[40];
95 UBYTE ShortTimeFormat[40];
97 UBYTE DecimalPoint[10];
98 UBYTE GroupSeparator[10];
99 UBYTE FracGroupSeparator[10];
100 UBYTE Grouping[10];
101 UBYTE FracGrouping[10];
102 UBYTE MonDecimalPoint[10];
103 UBYTE MonGroupSeparator[10];
104 UBYTE MonFracGroupSeparator[10];
105 UBYTE MonGrouping[10];
106 UBYTE MonFracGrouping[10];
108 UBYTE MonCS[10];
109 UBYTE MonSmallCS[10];
110 UBYTE MonIntCS[10];
111 UBYTE MonPositiveSign[10];
113 UBYTE MonNegativeSign[10];
116 struct CatStr
118 STRPTR cs_String;
119 ULONG cs_Id; /* Really signed, but need it to be unsigned for ICF_INORDER */
122 /* see Amiga Developer CD 2.1:NDK/NDK_3.1/Examples1/locale/SelfLoad/catalog.c */
124 struct CodeSet
126 ULONG cs_CodeSet;
127 ULONG cs_Reserved[7];
130 struct IntCatalog
132 struct Catalog ic_Catalog;
133 struct CodeSet ic_CodeSet;
134 struct CatStr *ic_CatStrings;
135 UBYTE *ic_StringChunk;
136 ULONG ic_NumStrings;
137 ULONG ic_DataSize;
138 UWORD ic_UseCount;
139 ULONG ic_Flags;
140 UBYTE ic_LanguageName[30];
141 UBYTE ic_Name[0]; // name of the file as passed to OpenCatalogA
142 /* structure sizes depends on length of ic_Name string */
145 /* Catalog strings are in order, so we don't have to search them all */
146 #define ICF_INORDER (1L<<0)
148 /* Shortcuts to the internal structures */
149 #define IntLB(lb) ((struct IntLocaleBase *)(lb))
150 #define IntL(locale) ((struct IntLocale *)(locale))
151 #define IntCat(cat) ((struct IntCatalog *)(cat))
153 #if REPLACEMENTFUNCS_LOCK_LOCALE
154 #define REPLACEMENT_LOCK ObtainSemaphore(&IntLB(LocaleBase)->lb_LocaleLock)
155 #define REPLACEMENT_UNLOCK ReleaseSemaphore(&IntLB(LocaleBase)->lb_LocaleLock)
156 #else
157 #define REPLACEMENT_LOCK
158 #define REPLACEMENT_UNLOCK
159 #endif
161 #define ID_CTLG MAKE_ID('C','T','L','G')
162 #define ID_FVER MAKE_ID('F','V','E','R')
163 #define ID_LANG MAKE_ID('L','A','N','G')
164 #define ID_CSET MAKE_ID('C','S','E','T')
165 #define ID_STRS MAKE_ID('S','T','R','S')
168 void dispose_catalog(struct IntCatalog * cat,
169 struct LocaleBase * LocaleBase);
171 void SetLocaleLanguage(struct IntLocale *, struct LocaleBase *);
173 void InstallPatches(void);
175 extern const struct Locale defLocale;
177 #endif /* LOCALE_INTERN_H */