revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / locale / locale_intern.h
blobbac2eecd61c1ee1b28a01e242001cd2a2d04a355
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 struct IntLocaleBase
49 struct LocaleBase lb_LocaleBase;
51 struct IntLocale *lb_DefaultLocale;
52 struct IntLocale *lb_CurrentLocale;
53 struct SignalSemaphore lb_LocaleLock;
54 struct SignalSemaphore lb_CatalogLock;
55 struct MinList lb_CatalogList;
58 struct IntLocale
60 struct Locale il_Locale;
62 UWORD il_Count;
63 struct Library *il_CurrentLanguage;
64 struct Catalog *il_DosCatalog;
65 APTR il_LanguageFunctions[32];
67 /* Need to put all sorts of crap here later. */
68 UBYTE LocaleName[30];
69 UBYTE LanguageName[30];
71 UBYTE PreferredLanguages[10][30];
72 UBYTE LanguagesOnDiskNames[10][30];
75 ** Don't change the order of the following field,
76 ** It's based on CountryPrefs structure in
77 ** <prefs/locale.h> and InitLocale() relies on this
78 ** as well!
81 UBYTE DateTimeFormat[80];
82 UBYTE DateFormat[40];
83 UBYTE TimeFormat[40];
84 UBYTE ShortDateTimeFormat[80];
85 UBYTE ShortDateFormat[40];
86 UBYTE ShortTimeFormat[40];
88 UBYTE DecimalPoint[10];
89 UBYTE GroupSeparator[10];
90 UBYTE FracGroupSeparator[10];
91 UBYTE Grouping[10];
92 UBYTE FracGrouping[10];
93 UBYTE MonDecimalPoint[10];
94 UBYTE MonGroupSeparator[10];
95 UBYTE MonFracGroupSeparator[10];
96 UBYTE MonGrouping[10];
97 UBYTE MonFracGrouping[10];
99 UBYTE MonCS[10];
100 UBYTE MonSmallCS[10];
101 UBYTE MonIntCS[10];
102 UBYTE MonPositiveSign[10];
104 UBYTE MonNegativeSign[10];
107 struct CatStr
109 STRPTR cs_String;
110 ULONG cs_Id; /* Really signed, but needs to be unsigned for ICF_INORDER */
113 /* see Amiga Developer CD 2.1:NDK/NDK_3.1/Examples1/locale/SelfLoad/catalog.c */
115 struct CodeSet
117 ULONG cs_CodeSet;
118 ULONG cs_Reserved[7];
121 struct IntCatalog
123 struct Catalog ic_Catalog;
124 struct CodeSet ic_CodeSet;
125 struct CatStr *ic_CatStrings;
126 UBYTE *ic_StringChunk;
127 ULONG ic_NumStrings;
128 ULONG ic_DataSize;
129 UWORD ic_UseCount;
130 ULONG ic_Flags;
131 UBYTE ic_LanguageName[30];
132 UBYTE ic_Name[0]; // name of file passed to OpenCatalogA()
133 /* structure size depends on length of ic_Name string */
136 /* Catalog strings are in order, so we don't have to search them all */
137 #define ICF_INORDER (1L<<0)
139 /* Shortcuts to the internal structures */
140 #define IntLB(lb) ((struct IntLocaleBase *)(lb))
141 #define IntL(locale) ((struct IntLocale *)(locale))
142 #define IntCat(cat) ((struct IntCatalog *)(cat))
144 #if REPLACEMENTFUNCS_LOCK_LOCALE
145 #define REPLACEMENT_LOCK ObtainSemaphore(&IntLB(LocaleBase)->lb_LocaleLock)
146 #define REPLACEMENT_UNLOCK ReleaseSemaphore(&IntLB(LocaleBase)->lb_LocaleLock)
147 #else
148 #define REPLACEMENT_LOCK
149 #define REPLACEMENT_UNLOCK
150 #endif
152 #define ID_CTLG MAKE_ID('C','T','L','G')
153 #define ID_FVER MAKE_ID('F','V','E','R')
154 #define ID_LANG MAKE_ID('L','A','N','G')
155 #define ID_CSET MAKE_ID('C','S','E','T')
156 #define ID_STRS MAKE_ID('S','T','R','S')
158 void dispose_catalog(struct IntCatalog * cat,
159 struct LocaleBase * LocaleBase);
161 void SetLocaleLanguage(struct IntLocale *, struct LocaleBase *);
163 void InstallPatches(void);
165 APTR InternalFormatString(const struct Locale *locale,
166 CONST_STRPTR fmtTemplate, CONST_APTR dataStream,
167 ULONG *indexStream, const struct Hook *putCharFunc);
169 extern const struct Locale defLocale;
171 #endif /* LOCALE_INTERN_H */