Annotation of OpenXM/src/kan96xx/Kan/Kclass/sample.c, Revision 1.3
1.3 ! takayama 1: /* $OpenXM: OpenXM/src/kan96xx/Kan/Kclass/sample.c,v 1.2 2000/01/16 07:55:45 takayama Exp $ */
1.1 maekawa 2: /* Kclass/sample.c sample new class. */
3: /* How to add a new class to sm1.
4: 1. create a new file Kclass/newclass-name.c and change
5: Makefile
6: 2. Define new tags in kclass.h and put your prototypes.
7: (Note. CMO is defined to be 1024 in stackm.h
8: So, CMO+cmotag is used for the etag for raw cmo object.
9: This should be changed near future.)
10: 3. Add entry points of your functions for newclass to kclass.c
11: */
12: #include <stdio.h>
13: #include "../datatype.h"
14: #include "../stackm.h"
15: #include "../extern.h"
16: #include "../gradedset.h"
17: #include "../extern2.h"
18: #include "../kclass.h"
19:
20:
21: /* Data conversion function : see KclassDataConversion*/
22: struct object KpoSampleClass(struct object *obp) {
1.3 ! takayama 23: struct object rob = OINIT;
1.1 maekawa 24: struct object *newobp;
25: rob.tag = Sclass;
26: rob.lc.ival = CLASSNAME_sampleClass;
27: newobp = (struct object *) sGC_malloc(sizeof(struct object));
28: /* Yes! You can call KpoSampleClass(&localVar) */
29: if (newobp == NULL) errorKan1("%s\n","Kclass/sample.c, no more memory.");
30: *newobp = *obp;
31: rob.rc.voidp = newobp;
32: return(rob);
33: }
34: /* cf. KopSampleClass() in kclass.h */
35:
36: /* Printing function : see fprintClass */
37: void fprintSampleClass(FILE *fp,struct object *op)
38: {
39: printObject(*op,0,fp);
40: }
41:
42: /* Comparison function : see classEqualQ */
43: int eqSampleClass(struct object *ob1, struct object *ob2)
44: {
45: return(KooEqualQ(*ob1,*ob2));
46: }
47:
48: /* Addition : see Kclass_ooAdd */
49:
50:
51:
52:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>