home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
581b.lha
/
skeleton
/
dispatch.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-26
|
1KB
|
67 lines
/*
* dispatch.c - C source file for Class dispatcher function.
*
*
* Public Domain
*
*/
#include <skeleton_internal.h>
#include <skeleton.h>
#include <classglue.h>
ULONG __saveds __asm Skeleton_dispatch( register __a0 Class * class,
register __a2 Object *obj,
register __a1 Msg msg )
{
Object *newobj;
ULONG retval;
switch(msg->MethodID) {
case OM_NEW:
/*
* pass this to the superclass first, and when it comes back,
* we will have all our data allocated (instance data).
*/
if( newobj = (Object *) DSM(class, obj, msg) ) {
/*
* Initialize instance data and parse the attribute list.
*/
Skeleton_setattrs(class, newobj, (struct opSet *) msg);
}
/*
* return the new object (we may be a superclass to someone.)
*/
retval = (ULONG) newobj;
break;
case OM_SET:
/*
* call the set attributes function.
*/
retval = Skeleton_setattrs(class, newobj, (struct opSet *)msg);
break;
case OM_GET:
/*
* call the getattr function if needed. This funciton should
* default to the superclass _IF_ it cannot handle the request.
*/
case OM_DISPOSE:
/*
* Dispose of any extra objects or allocations made on the
* OM_NEW call.
*/
default:
/*
* unknown method, send it up to the superclass.
*/
retval = DSM(class, obj, msg);
}
return(retval);
}