added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / libs / muimaster / mui_createcustomclass.c
blobed3cfdf556d9c01fbdf24800f9c912d63f6cf8cc
1 /*
2 Copyright © 2002-2007, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <proto/exec.h>
7 #include <proto/intuition.h>
8 #include <proto/graphics.h>
9 #include <proto/dos.h>
10 #include <proto/muimaster.h>
11 #include <proto/utility.h>
13 #include "mui.h"
14 #include "muimaster_intern.h"
15 #include "support.h"
16 #include "support_classes.h"
18 /*****************************************************************************
20 NAME */
21 AROS_LH5(struct MUI_CustomClass *, MUI_CreateCustomClass,
23 /* SYNOPSIS */
24 AROS_LHA(struct Library *, base, A0),
25 AROS_LHA(ClassID, supername, A1),
26 AROS_LHA(struct MUI_CustomClass *, supermcc, A2),
27 AROS_LHA(ULONG, datasize, D0),
28 AROS_LHA(APTR, dispatcher, A3),
30 /* LOCATION */
31 struct Library *, MUIMasterBase, 18, MUIMaster)
33 /* FUNCTION
35 INPUTS
37 RESULT
39 NOTES
41 EXAMPLE
43 BUGS
44 The function itself is a bug ;-) Remove it!
46 SEE ALSO
48 INTERNALS
50 HISTORY
52 *****************************************************************************/
54 AROS_LIBFUNC_INIT
56 struct MUI_CustomClass *mcc;
57 struct IClass *cl, *super;
58 ClassID id = NULL;
60 if ((supername == NULL) && (supermcc == NULL))
61 return NULL;
63 if (!supermcc)
65 super = MUI_GetClass(supername);
66 if (!super) return NULL;
68 else super = supermcc->mcc_Class;
70 if (!(mcc = mui_alloc_struct(struct MUI_CustomClass)))
71 return NULL;
73 if (base)
74 id = FilePart(((struct Node *)base)->ln_Name);
76 if (!(cl = MakeClass(id, NULL, super, datasize, 0)))
78 mui_free(mcc);
79 return NULL;
82 mcc->mcc_UtilityBase = (struct Library *)UtilityBase;
83 mcc->mcc_DOSBase = (struct Library *)DOSBase;
84 mcc->mcc_GfxBase = (struct Library *)GfxBase;
85 mcc->mcc_IntuitionBase = (struct Library *)IntuitionBase;
87 mcc->mcc_Class = cl;
88 mcc->mcc_Super = super;
89 mcc->mcc_Module = NULL; /* _zune_class_load() will set this */
91 #if defined(__MAXON__) || defined(__amigaos4__)
92 cl->cl_Dispatcher.h_Entry = (HOOKFUNC)dispatcher;
93 #else
94 cl->cl_Dispatcher.h_Entry = (HOOKFUNC)metaDispatcher;
95 cl->cl_Dispatcher.h_SubEntry = (HOOKFUNC)dispatcher;
96 #endif
97 cl->cl_Dispatcher.h_Data = base;
99 return mcc;
101 AROS_LIBFUNC_EXIT
102 } /* MUIA_CreateCustomClass */