1 2 //metadoc Tag copyright Steve Dekorte 2002 3 //metadoc Tag license BSD revised 4 5 #ifndef IOTAG_DEFINED 6 #define IOTAG_DEFINED 1 7 8 #include "Common.h" 9 //#include "Stack.h" 10 #include "BStream.h" 11 12 #include "IoVMApi.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 typedef void * (IoTagCloneFunc)(void *); // self 19 typedef void (IoTagFreeFunc)(void *); // self 20 typedef void (IoTagMarkFunc)(void *); // self 21 typedef void (IoTagNotificationFunc)(void *, void *); // self, notification 22 typedef void (IoTagCleanupFunc)(void *); // self 23 24 /* 25 typedef struct 26 { 27 IoTagCursorFirstFunc *nextFunc; 28 IoTagCursorNextFunc *nextFunc; 29 IoTagCursorPreviousFunc *nextFunc; 30 IoTagCursorJumpFunc *nextFunc; 31 IoTagCursorLastFunc *nextFunc; 32 } 33 */ 34 35 /* 36 typedef void * (IoTagGetFunc)(void *, void *); // self, symbol -> object or 0x0 37 typedef void (IoTagSetFunc)(void *, void *, void *); // self, symbol, object 38 typedef void (IoTagGetAfterFunc)(void *, void *); // self, symbol -> object or 0x0 39 40 typedef void * (IoTagGetMetaFunc)(void *, void *); // self, symbol -> object or 0x0 41 typedef void (IoTagSetMetaFunc)(void *, void *, void *); // self, symbol, object 42 */ 43 44 typedef void * (IoTagPerformFunc)(void *, void *, void *); // self, locals, message 45 typedef void * (IoTagActivateFunc)(void *, void *, void *, void *, void *); // self, target, locals, message, slotContext 46 typedef int (IoTagCompareFunc)(void *, void *); // self and another IoObject 47 48 typedef void (IoTagWriteToStreamFunc)(void *, BStream *); // self, store, stream 49 typedef void * (IoTagAllocFromStreamFunc)(void *, BStream *); // self, store, stream 50 typedef void (IoTagReadFromStreamFunc)(void *, BStream *); // self, store, stream 51 52 typedef struct 53 { 54 void *state; 55 char *name; 56 57 // memory management 58 59 IoTagCloneFunc *cloneFunc; 60 IoTagFreeFunc *freeFunc; 61 IoTagCleanupFunc *tagCleanupFunc; 62 IoTagMarkFunc *markFunc; 63 IoTagNotificationFunc *notificationFunc; 64 65 // actions 66 67 //IoTagTouchFunc *touchFunc; // if present, call before type check 68 IoTagPerformFunc *performFunc; // lookup and activate, return result 69 IoTagActivateFunc *activateFunc; // return the receiver or compute and return a value 70 IoTagCompareFunc *compareFunc; 71 72 /* 73 IoTagSetFunc *setFunc 74 IoTagGetFunc *getFunc 75 IoTagCursorFunc *cursorFunc 76 */ 77 78 // persistence 79 80 IoTagWriteToStreamFunc *writeToStreamFunc; 81 IoTagAllocFromStreamFunc *allocFromStreamFunc; 82 IoTagReadFromStreamFunc *readFromStreamFunc; 83 84 // Stack *recyclableInstances; 85 // int maxRecyclableInstances; 86 int referenceCount; 87 } IoTag; 88 89 IOVM_API IoTag *IoTag_new(void); 90 IOVM_API IoTag *IoTag_newWithName_(const char *name); 91 IOVM_API void IoTag_free(IoTag *self); 92 IOVM_API int IoTag_reference(IoTag *self); 93 94 IOVM_API void IoTag_name_(IoTag *self, const char *name); 95 IOVM_API const char *IoTag_name(IoTag *self); 96 97 IOVM_API void IoTag_mark(IoTag *self); 98 99 #include "IoTag_inline.h" 100 101 #ifdef __cplusplus 102 } 103 #endif 104 #endif 105