Added AROS port of all shell applications:
[cake.git] / rom / boopsi / newobjecta.c
blob1841dc651b403279a56a62f6aeb5aeecaae38d65
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Create a new BOOPSI object
6 Lang: english
7 */
8 #include <exec/lists.h>
9 #include <intuition/classes.h>
10 #include <proto/exec.h>
11 #include <proto/alib.h>
12 #include <clib/intuition_protos.h>
14 #include "intern.h"
16 #undef SDEBUG
17 #define SDEBUG 0
18 #undef DEBUG
19 #define DEBUG 0
20 #include <aros/debug.h>
22 /*****************************************************************************
24 NAME */
25 #include <intuition/classusr.h>
26 #include <proto/boopsi.h>
28 AROS_LH3(APTR, NewObjectA,
30 /* SYNOPSIS */
31 AROS_LHA(struct IClass *, classPtr, A0),
32 AROS_LHA(UBYTE *, classID, A1),
33 AROS_LHA(struct TagItem *, tagList, A2),
35 /* LOCATION */
36 struct Library *, BOOPSIBase, 11, BOOPSI)
38 /* FUNCTION
39 Use this function to create BOOPSI objects (BOOPSI stands for
40 "Basic Object Oriented Programming System for Intuition).
42 You may specify a class either by it's name (if it's a public class)
43 or by a pointer to its definition (if it's a private class). If
44 classPtr is NULL, classID is used.
46 INPUTS
47 classPtr - Pointer to a private class (or a public class if you
48 happen to have a pointer to it)
49 classID - Name of a public class
50 tagList - Initial attributes. Read the documentation of the class
51 carefully to find out which attributes must be specified
52 here and which can.
54 RESULT
55 A BOOPSI object which can be manipulated with general functions and
56 which must be disposed with DisposeObject() later.
58 NOTES
59 This functions send OM_NEW to the dispatcher of the class.
61 EXAMPLE
63 BUGS
65 SEE ALSO
66 DisposeObject(), SetAttrsA(), GetAttr(), MakeClass(),
67 "Basic Object-Oriented Programming System for Intuition" and
68 "boopsi Class Reference" Dokument.
70 INTERNALS
72 HISTORY
73 29-10-95 digulla automatically created from
74 intuition_lib.fd and clib/intuition_protos.h
76 *****************************************************************************/
78 AROS_LIBFUNC_INIT
79 Object * object;
81 EnterFunc(bug("intuition::NewObjectA()\n"));
83 /* No classPtr ? */
84 if (!classPtr)
85 classPtr = FindClass (classID);
87 if (!classPtr)
88 return (NULL); /* Nothing found */
90 D(bug("classPtr: %p\n", classPtr));
92 /* Try to create a new object */
93 if ((object = (Object *) CoerceMethod (classPtr, (Object *)classPtr, OM_NEW,
94 tagList, NULL)))
95 classPtr->cl_ObjectCount ++;
97 ReturnPtr("intuition::NewObjectA()", Object *, object);
98 AROS_LIBFUNC_EXIT
99 } /* NewObjectA */