revert between 56095 -> 55830 in arch
[AROS.git] / tools / flexcat / src / openlibs.c
blobcc75cd7fc542409039fbd856a0ad5a739eae0a35
1 /*
2 * $Id$
4 * Copyright (C) 1993-1999 by Jochen Wiedmann and Marcin Orlowski
5 * Copyright (C) 2002-2015 FlexCat Open Source Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #if defined(AMIGA)
24 #include "flexcat.h"
25 #include "openlibs.h"
26 #include "utils.h"
27 #define __NOLIBBASE__
28 #include <proto/exec.h>
29 #include <proto/utility.h>
30 #include <proto/intuition.h>
31 #include <proto/locale.h>
32 #include <proto/codesets.h>
34 #if defined(__amigaos3__) || defined(__MORPHOS__) || defined(__AROS__)
35 #if defined(__AROS__)
36 struct UtilityBase *UtilityBase = NULL;
37 #else
38 struct Library *UtilityBase = NULL;
39 #endif
40 struct IntuitionBase *IntuitionBase = NULL;
41 #if defined(__MORPHOS__)
42 struct Library *LocaleBase = NULL;
43 #else
44 struct LocaleBase *LocaleBase = NULL;
45 #endif
46 #endif
47 struct Library *CodesetsBase = NULL;
49 #if defined(__amigaos4__)
50 struct CodesetsIFace *ICodesets = NULL;
51 #endif
54 BOOL OpenLibs(void)
56 #if defined(__amigaos3__) || defined(__MORPHOS__) || defined(__AROS__)
57 if(
58 #if defined(__AROS__)
59 (UtilityBase = (struct UtilityBase *)OpenLibrary("utility.library", 37)) != NULL &&
60 #else
61 (UtilityBase = OpenLibrary("utility.library", 37)) != NULL &&
62 #endif
63 (IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 37)) != NULL &&
64 #if defined(__MORPHOS__)
65 (LocaleBase = (struct Library *)OpenLibrary("locale.library", 37)) != NULL)
66 #else
67 (LocaleBase = (struct LocaleBase *)OpenLibrary("locale.library", 37)) != NULL)
68 #endif
69 #endif
71 if((CodesetsBase = OpenLibrary(CODESETSNAME, CODESETSVER)) &&
72 GETINTERFACE(ICodesets, CodesetsBase))
74 return TRUE;
78 return FALSE;
81 void CloseLibs(void)
83 #if defined(__amigaos3__) || defined(__MORPHOS__) || defined(__AROS__)
84 if(UtilityBase != NULL)
86 CloseLibrary((struct Library *)UtilityBase);
87 UtilityBase = NULL;
89 if(IntuitionBase != NULL)
91 CloseLibrary((struct Library *)IntuitionBase);
92 IntuitionBase = NULL;
94 if(LocaleBase != NULL)
96 CloseLibrary((struct Library *)LocaleBase);
97 LocaleBase = NULL;
99 #endif
101 if(CodesetsBase != NULL)
103 DROPINTERFACE(ICodesets);
104 CloseLibrary(CodesetsBase);
105 CodesetsBase = NULL;
109 #endif // AMIGA