[BACK]Return to sample.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan / Kclass

Annotation of OpenXM/src/kan96xx/Kan/Kclass/sample.c, Revision 1.2

1.2     ! takayama    1: /* $OpenXM$ */
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) {
                     23:   struct object rob;
                     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>