add remtask before addtask
[AROS.git] / rom / exec / taggedopenlibrary.c
blobc0102028ce72db0885a08cd6ce4baab13277589c
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Shortcut OpenLibrary call for system modules (private!)
6 Lang: english
7 */
9 #include <aros/libcall.h>
10 #include <proto/exec.h>
12 static const char * const libnames[] =
14 "graphics.library",
15 "layers.library",
16 "intuition.library",
17 "dos.library",
18 "icon.library",
19 "expansion.library",
20 "utility.library",
21 "keymap.library",
22 "gadtools.library",
23 "workbench.library"
26 static const char * const copyrights[] =
28 "AROS Research Operating System (AROS)",
29 "Copyright © 1995-1997 ",
30 "AROS - The AROS Research OS ",
31 "Other parts © by respective owners.",
32 "ALPHA ",
33 "exec.library",
34 "exec 41.11 (27.09.1998)\r\n"
37 /*****i* exec.library/TaggedOpenLibrary **************************************
39 TaggedOpenLibrary -- open a library by tag (V39)
41 NAME */
42 AROS_LH1(APTR, TaggedOpenLibrary,
44 /* SYNOPSIS */
45 AROS_LHA(LONG, tag, D0),
47 /* LOCATION */
48 struct ExecBase *, SysBase, 135, Exec)
50 /* FUNCTION
51 Opens a library given by tag. This is mainly meant as a shortcut so
52 other system modules don't have to contain the complete library name
53 string, to save ROM space. Additionaly, this call can be used to get a
54 pointer to one of the system copyright notices and other strings.
56 All libraries will be opened with version number 0.
58 If the library cannot be opened the first try, this function calls
59 FindResident and InitResident on the library, and tries again.
61 INPUTS
62 tag - Which library or text string to return.
64 RESULT
65 Pointer to library or pointer to text string.
67 NOTES
68 This is an *INTERNAL* function, and is only meant to provide backwards
69 compatibility until all original Amiga system ROM modules that use it
70 have been implemented as part of AROS. This function *WILL BE REMOVED*
71 in the future. *DO NOT USE!* This can not be emhasized enough. This
72 also applies to AROS system programmers.
74 EXAMPLE
76 BUGS
78 SEE ALSO
79 OpenLibrary(), FindResident(), InitResident()
81 INTERNALS
82 No checks are made on the validity of the tag.
84 ******************************************************************************/
86 AROS_LIBFUNC_INIT
88 struct Library *lib;
89 struct Resident *res;
91 if(tag > 0)
94 Try to open the library. If it opened, return.
96 if((lib = OpenLibrary(libnames[tag-1], 0))) return (APTR)lib;
99 If it didn't open, FindResident(), InitResident(), and then
100 try to open it again.
102 if(!(res = FindResident(libnames[tag-1]))) return NULL;
103 InitResident(res, BNULL);
104 if((lib = OpenLibrary(libnames[tag-1], 0))) return (APTR)lib;
107 if(tag < 0) return( (APTR)copyrights[(-tag)-1] );
110 If we get here, tag must be 0, or the lib didn't open.
112 return NULL;
114 AROS_LIBFUNC_EXIT
115 } /* TaggedOpenLibrary */