2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Desc: Initialisation for the locale.library.
9 #define AROS_ALMOST_COMPATIBLE
10 #include <exec/types.h>
11 #include <exec/lists.h>
12 #include <exec/memory.h>
13 #include <exec/resident.h>
14 #include <aros/symbolsets.h>
15 #include <exec/semaphores.h>
17 #include <proto/exec.h>
19 #include "locale_intern.h"
20 #include LC_LIBDEFS_FILE
22 /* This global variable is needed for LocRawDoFmt */
24 struct LocaleBase
*globallocalebase
= NULL
;
26 /* Avoid using nasty #defines if we can :-) */
27 AROS_MAKE_ALIAS(globallocalebase
, LocaleBase
);
29 static int Init(LIBBASETYPEPTR LIBBASE
)
31 struct IntLocale
*def
;
33 /* A few internal functions need to access a global LocaleBase pointer,
34 because they're used to patch dos.library functions, and thus don't
35 directly get a LocaleBase pointer. Someday, with TLS, this will go away. */
36 globallocalebase
= (struct LocaleBase
*) LIBBASE
;
38 /* Do whatever static initialisation you need here */
39 InitSemaphore(&((struct IntLocaleBase
*)LIBBASE
)->lb_LocaleLock
);
40 InitSemaphore(&((struct IntLocaleBase
*)LIBBASE
)->lb_CatalogLock
);
42 NEWLIST(&((struct IntLocaleBase
*)LIBBASE
)->lb_CatalogList
);
44 IntLB(LIBBASE
)->lb_DefaultLocale
= def
= AllocMem(sizeof(struct IntLocale
), MEMF_CLEAR
|MEMF_ANY
);
47 /* Copy the defaults to our new structure */
48 CopyMem(&defLocale
, def
, sizeof(struct Locale
));
50 /* Set lb_CurrentLocale *BEFORE* SetLocaleLanguage */
51 IntLB(LIBBASE
)->lb_CurrentLocale
= def
;
53 /* Setup the languages - will not fail here. */
54 SetLocaleLanguage(def
, (struct LocaleBase
*) LIBBASE
);