2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Internal definitions for the locale.library.
9 #ifndef LOCALE_INTERN_H
10 #define LOCALE_INTERN_H
12 #ifndef EXEC_EXECBASE_H
13 #include <exec/execbase.h>
15 #ifndef EXEC_SEMAPHORES_H
16 #include <exec/semaphores.h>
18 #ifndef DOS_DOSEXTENS_H
19 #include <dos/dosextens.h>
21 #ifndef LIBRARIES_LOCALE_H
22 #include <libraries/locale.h>
24 #ifndef UTILITY_UTILITY_H
25 #include <utility/utility.h>
28 #include <aros/libcall.h>
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
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. */
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
;
66 struct Locale il_Locale
;
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. */
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
86 UBYTE DateTimeFormat
[80];
89 UBYTE ShortDateTimeFormat
[80];
90 UBYTE ShortDateFormat
[40];
91 UBYTE ShortTimeFormat
[40];
93 UBYTE DecimalPoint
[10];
94 UBYTE GroupSeparator
[10];
95 UBYTE FracGroupSeparator
[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];
105 UBYTE MonSmallCS
[10];
107 UBYTE MonPositiveSign
[10];
109 UBYTE MonNegativeSign
[10];
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 */
123 ULONG cs_Reserved
[7];
128 struct Catalog ic_Catalog
;
129 struct CodeSet ic_CodeSet
;
130 struct CatStr
*ic_CatStrings
;
131 UBYTE
*ic_StringChunk
;
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)
153 #define REPLACEMENT_LOCK
154 #define REPLACEMENT_UNLOCK
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 */