Allow multiple volumes with the same name if their creation dates differ.
[AROS.git] / workbench / libs / locale / locale_init.c
blobeb71cc708aa62d75724af3ad6ae93b51f64763c8
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Initialisation for the locale.library.
6 Lang: english
7 */
9 #include <aros/debug.h>
11 #define AROS_ALMOST_COMPATIBLE
12 #include <exec/types.h>
13 #include <exec/lists.h>
14 #include <exec/memory.h>
15 #include <exec/resident.h>
16 #include <aros/symbolsets.h>
17 #include <exec/semaphores.h>
19 #include <proto/exec.h>
21 #include "locale_intern.h"
22 #include LC_LIBDEFS_FILE
24 /* This global variable is needed for LocRawDoFmt */
25 struct LocaleBase *globallocalebase = NULL;
27 AROS_MAKE_ALIAS(globallocalebase, LocaleBase);
29 static int Init(LIBBASETYPEPTR LIBBASE)
31 /* A few internal functions need to access a global LocaleBase pointer,
32 because they're used to patch dos.library functions, and thus don't
33 directly get a LocaleBase pointer. Someday, with TLS, this will go away. */
34 globallocalebase = (struct LocaleBase *)LIBBASE;
36 /* perform static initialisation */
37 InitSemaphore(&((struct IntLocaleBase *)LIBBASE)->lb_LocaleLock);
38 InitSemaphore(&((struct IntLocaleBase *)LIBBASE)->lb_CatalogLock);
40 NEWLIST(&((struct IntLocaleBase *)LIBBASE)->lb_CatalogList);
42 if ((IntLB(LIBBASE)->lb_DefaultLocale = AllocMem(sizeof(struct IntLocale), MEMF_CLEAR | MEMF_ANY)) != NULL)
44 /* Copy the defaults to our new structure */
45 CopyMem(&defLocale, IntLB(LIBBASE)->lb_DefaultLocale, sizeof(struct Locale));
47 /* Set lb_CurrentLocale *BEFORE* SetLocaleLanguage */
48 IntLB(LIBBASE)->lb_CurrentLocale = IntLB(LIBBASE)->lb_DefaultLocale;
50 /* Setup the languages - will not fail here. */
51 SetLocaleLanguage(IntLB(LIBBASE)->lb_DefaultLocale, (struct LocaleBase *)LIBBASE);
53 IntLB(LIBBASE)->lb_DefaultLocale->il_Count = 0;
54 InstallPatches();
56 return TRUE;
59 return FALSE;
62 ADD2INITLIB(Init, 0);