Stunt: get codesetslib from its own Sourceforge repository.
[cake.git] / workbench / libs / codesetslib / src / libinit-aros.c
blob4aed9e02731d77dc05be43f2b96d3f6992c2b663
1 /***************************************************************************
3 codesets.library - Amiga shared library for handling different codesets
4 Copyright (C) 2001-2005 by Alfonso [alfie] Ranieri <alforan@tin.it>.
5 Copyright (C) 2005-2007 by codesets.library Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 codesets.library project: http://sourceforge.net/projects/codesetslib/
19 $Id$
21 ***************************************************************************/
23 #include "lib.h"
24 #include "version.h"
26 #include <aros/symbolsets.h>
27 #include <exec/resident.h>
28 #include <proto/exec.h>
30 #include "debug.h"
32 /****************************************************************************/
34 // define the base to avoid recursion when opening the library
35 struct LibraryHeader * CodesetsBase;
37 /****************************************************************************/
39 BOOL LibInit(struct LibraryHeader *base)
41 BOOL success = FALSE;
43 // Init global library base
44 CodesetsBase = base;
46 InitSemaphore(&base->libSem);
47 InitSemaphore(&base->poolSem);
49 base->sysBase = (APTR)SysBase;
50 base->pool = NULL;
51 base->flags = 0;
52 base->systemCodeset = NULL;
54 // protect access to initBase()
55 ObtainSemaphore(&base->libSem);
57 success = initBase(base);
59 // unprotect initBase()
60 ReleaseSemaphore(&base->libSem);
62 return success;
65 /****************************************************************************/
67 void LibExpunge(struct LibraryHeader *base)
69 // free all our private data and stuff.
70 ObtainSemaphore(&base->libSem);
72 freeBase(base);
74 // unprotect
75 ReleaseSemaphore(&base->libSem);
77 CodesetsBase = NULL;
80 /****************************************************************************/
82 ADD2INITLIB(LibInit, 0);
83 ADD2EXPUNGELIB(LibExpunge, 0);
85 /***********************************************************************/