- Tabs to spaces.
[AROS.git] / workbench / libs / locale / locale_intern.h
blob5edb7aeff78f31b7d0555ae4b3ef4b24c89e091f
1 /*
2 Copyright © 1995-2011, 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 #define USE_QUADFMT 1
53 struct IntLocaleBase
55 struct LocaleBase lb_LocaleBase;
57 struct IntLocale *lb_DefaultLocale;
58 struct IntLocale *lb_CurrentLocale;
59 struct SignalSemaphore lb_LocaleLock;
60 struct SignalSemaphore lb_CatalogLock;
61 struct MinList lb_CatalogList;
64 struct IntLocale
66 struct Locale il_Locale;
68 UWORD il_Count;
69 struct Library *il_CurrentLanguage;
70 struct Catalog *il_DosCatalog;
71 APTR il_LanguageFunctions[32];
73 /* Need to put all sorts of crap here later. */
74 UBYTE LocaleName[30];
75 UBYTE LanguageName[30];
77 UBYTE PreferredLanguages[10][30];
80 ** Don't change the order of the following field,
81 ** It's based on CountryPrefs structure in
82 ** <prefs/locale.h> and InitLocale() relies on this
83 ** as well!
86 UBYTE DateTimeFormat[80];
87 UBYTE DateFormat[40];
88 UBYTE TimeFormat[40];
89 UBYTE ShortDateTimeFormat[80];
90 UBYTE ShortDateFormat[40];
91 UBYTE ShortTimeFormat[40];
93 UBYTE DecimalPoint[10];
94 UBYTE GroupSeparator[10];
95 UBYTE FracGroupSeparator[10];
96 UBYTE Grouping[10];
97 UBYTE FracGrouping[10];
98 UBYTE MonDecimalPoint[10];
99 UBYTE MonGroupSeparator[10];
100 UBYTE MonFracGroupSeparator[10];
101 UBYTE MonGrouping[10];
102 UBYTE MonFracGrouping[10];
104 UBYTE MonCS[10];
105 UBYTE MonSmallCS[10];
106 UBYTE MonIntCS[10];
107 UBYTE MonPositiveSign[10];
109 UBYTE MonNegativeSign[10];
112 struct CatStr
114 STRPTR cs_String;
115 ULONG cs_Id; /* Really signed, but needs to be unsigned for ICF_INORDER */
118 /* see Amiga Developer CD 2.1:NDK/NDK_3.1/Examples1/locale/SelfLoad/catalog.c */
120 struct CodeSet
122 ULONG cs_CodeSet;
123 ULONG cs_Reserved[7];
126 struct IntCatalog
128 struct Catalog ic_Catalog;
129 struct CodeSet ic_CodeSet;
130 struct CatStr *ic_CatStrings;
131 UBYTE *ic_StringChunk;
132 ULONG ic_NumStrings;
133 ULONG ic_DataSize;
134 UWORD ic_UseCount;
135 ULONG ic_Flags;
136 UBYTE ic_LanguageName[30];
137 UBYTE ic_Name[0]; // name of file passed to OpenCatalogA()
138 /* structure size depends on length of ic_Name string */
141 /* Catalog strings are in order, so we don't have to search them all */
142 #define ICF_INORDER (1L<<0)
144 /* Shortcuts to the internal structures */
145 #define IntLB(lb) ((struct IntLocaleBase *)(lb))
146 #define IntL(locale) ((struct IntLocale *)(locale))
147 #define IntCat(cat) ((struct IntCatalog *)(cat))
149 #if REPLACEMENTFUNCS_LOCK_LOCALE
150 #define REPLACEMENT_LOCK ObtainSemaphore(&IntLB(LocaleBase)->lb_LocaleLock)
151 #define REPLACEMENT_UNLOCK ReleaseSemaphore(&IntLB(LocaleBase)->lb_LocaleLock)
152 #else
153 #define REPLACEMENT_LOCK
154 #define REPLACEMENT_UNLOCK
155 #endif
157 #define ID_CTLG MAKE_ID('C','T','L','G')
158 #define ID_FVER MAKE_ID('F','V','E','R')
159 #define ID_LANG MAKE_ID('L','A','N','G')
160 #define ID_CSET MAKE_ID('C','S','E','T')
161 #define ID_STRS MAKE_ID('S','T','R','S')
164 void dispose_catalog(struct IntCatalog * cat,
165 struct LocaleBase * LocaleBase);
167 void SetLocaleLanguage(struct IntLocale *, struct LocaleBase *);
169 void InstallPatches(void);
171 APTR InternalFormatString(const struct Locale *locale,
172 CONST_STRPTR fmtTemplate, CONST_APTR dataStream,
173 const struct Hook *putCharFunc, va_list VaListStream);
175 extern const struct Locale defLocale;
177 #endif /* LOCALE_INTERN_H */