added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / generic / hidd / parallel / parallel_init.c
blob098b262fb498f5e2ce07eee1bc371e064b66fb1d
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Serial hidd initialization code.
6 Lang: English.
7 */
8 #include <stddef.h>
9 #include <exec/types.h>
11 #include <proto/exec.h>
13 #include "parallel_intern.h"
16 #undef SysBase
18 /* Customize libheader.c */
19 #define LC_SYSBASE_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_SysBase)
20 #define LC_SEGLIST_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_SegList)
21 #define LC_RESIDENTNAME hiddparallel_resident
22 #define LC_RESIDENTFLAGS RTF_AUTOINIT
23 #define LC_RESIDENTPRI 0
24 #define LC_LIBBASESIZE sizeof(LIBBASETYPE)
25 #define LC_LIBHEADERTYPEPTR LIBBASETYPEPTR
26 #define LC_LIB_FIELD(lib) (((LIBBASETYPEPTR)(lib))->hdg_LibNode)
28 #define LC_NO_OPENLIB
29 #define LC_NO_CLOSELIB
31 /* to avoid removing the parallelhiddclass from memory add #define NOEXPUNGE */
33 #include <libcore/libheader.c>
35 #undef SDEBUG
36 #undef DEBUG
37 #define DEBUG 1
38 #include <aros/debug.h>
40 #define sysBase (LC_SYSBASE_FIELD(lh))
42 struct ExecBase * SysBase;
44 ULONG SAVEDS STDARGS LC_BUILDNAME(L_InitLib) (LC_LIBHEADERTYPEPTR lh)
46 struct class_static_data *csd; /* ParallelHidd static data */
48 SysBase = sysBase;
49 EnterFunc(bug("ParallelHIDD_Init()\n"));
52 We map the memory into the shared memory space, because it is
53 to be accessed by many processes, eg searching for a HIDD etc.
55 Well, maybe once we've got MP this might help...:-)
57 csd = AllocVec(sizeof(struct class_static_data), MEMF_CLEAR|MEMF_PUBLIC);
58 lh->hdg_csd = csd;
59 if(csd)
61 csd->sysbase = sysBase;
63 D(bug(" Got csd\n"));
65 csd->oopbase = OpenLibrary(AROSOOP_NAME, 0);
66 if (csd->oopbase)
68 D(bug(" Got OOPBase\n"));
69 csd->utilitybase = OpenLibrary("utility.library", 37);
70 if (csd->utilitybase)
72 D(bug(" Got UtilityBase\n"));
74 csd->parallelhiddclass = init_parallelhiddclass(csd);
76 D(bug(" ParallelHiddClass: %p\n", csd->parallelhiddclass));
78 if(csd->parallelhiddclass)
80 D(bug(" Got ParallelHIDDClass\n"));
81 ReturnInt("ParallelHIDD_Init", ULONG, TRUE);
84 CloseLibrary(csd->utilitybase);
86 CloseLibrary(csd->oopbase);
89 FreeVec(csd);
90 lh->hdg_csd = NULL;
94 ReturnInt("ParallelHIDD_Init", ULONG, FALSE);
99 void SAVEDS STDARGS LC_BUILDNAME(L_ExpungeLib) (LC_LIBHEADERTYPEPTR lh)
101 EnterFunc(bug("ParallelHIDD_Expunge()\n"));
103 if(lh->hdg_csd)
105 free_parallelhiddclass(lh->hdg_csd);
107 CloseLibrary(lh->hdg_csd->utilitybase);
108 CloseLibrary(lh->hdg_csd->oopbase);
110 FreeVec(lh->hdg_csd);
113 ReturnVoid("ParallelHIDD_Expunge");