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