Fixed a lazySlot bug where lazy slots in different objects end up pointing to the...
[io/quag.git] / libs / iovm / source / IoCoroutine.h
blob5ef12175b5cda1a09df53563fb6067bc448cf51f
1 /*#io
2 docCopyright("Steve Dekorte", 2002)
3 docLicense("BSD revised")
4 */
6 #ifndef IoCoroutine_DEFINED
7 #define IoCoroutine_DEFINED 1
8 #include "IoVMApi.h"
10 #include "IoState.h"
12 #include "Common.h"
13 #include "Coro.h"
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
19 #define ISCOROUTINE(self) IoObject_hasCloneFunc_(self, (IoTagCloneFunc *)IoCoroutine_rawClone)
21 typedef IoObject IoCoroutine;
23 typedef struct
25 Coro *cid;
26 Stack *ioStack;
27 int debuggingOn;
28 } IoCoroutineData;
30 IOVM_API IoCoroutine *IoCoroutine_proto(void *state);
31 IOVM_API void IoCoroutine_protoFinish(IoCoroutine *self);
32 IOVM_API IoCoroutine *IoCoroutine_rawClone(IoCoroutine *self);
33 IOVM_API IoCoroutine *IoCoroutine_new(void *state);
35 IOVM_API void IoCoroutine_free(IoCoroutine *self);
36 IOVM_API void IoCoroutine_mark(IoCoroutine *self);
37 Stack *IoCoroutine_rawIoStack(IoCoroutine *self);
38 IOVM_API void IoCoroutine_rawShow(IoCoroutine *self);
40 IOVM_API IoObject *IoCoroutine_main(IoCoroutine *self, IoObject *locals, IoMessage *m);
41 IOVM_API IoObject *IoCoroutine_freeStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
43 IOVM_API void *IoCoroutine_cid(IoCoroutine *self);
45 // label
47 //void IoCoroutine_rawSetLabel_(IoCoroutine *self, IoSymbol *s);
48 //IoObject *IoCoroutine_rawLabel(IoCoroutine *self);
50 IOVM_API IoObject *IoCoroutine_setLabel(IoCoroutine *self, IoObject *locals, IoMessage *m);
51 IOVM_API IoObject *IoCoroutine_label(IoCoroutine *self, IoObject *locals, IoMessage *m);
53 // runTarget
55 IOVM_API void IoCoroutine_rawSetRunTarget_(IoCoroutine *self, IoObject *v);
56 IOVM_API IoObject *IoCoroutine_rawRunTarget(IoCoroutine *self);
58 // runMessage
60 IOVM_API void IoCoroutine_rawSetRunMessage_(IoCoroutine *self, IoObject *v);
61 IOVM_API IoObject *IoCoroutine_rawRunMessage(IoCoroutine *self);
63 // runLocals
65 IOVM_API void IoCoroutine_rawSetRunLocals_(IoCoroutine *self, IoObject *v);
66 IOVM_API IoObject *IoCoroutine_rawRunLocals(IoCoroutine *self);
68 // parent
70 IOVM_API void IoCoroutine_rawSetParentCoroutine_(IoCoroutine *self, IoObject *v);
71 IOVM_API IoObject *IoCoroutine_rawParentCoroutine(IoCoroutine *self);
72 // exception
74 IOVM_API void IoCoroutine_rawSetResult_(IoCoroutine *self, IoObject *v);
75 IOVM_API IoObject *IoCoroutine_rawResult(IoCoroutine *self);
77 // exception
79 IOVM_API void IoCoroutine_rawRemoveException(IoCoroutine *self);
80 IOVM_API void IoCoroutine_rawSetException_(IoCoroutine *self, IoObject *v);
81 IOVM_API IoObject *IoCoroutine_rawException(IoCoroutine *self);
83 // ioStack
85 IOVM_API IoObject *IoCoroutine_ioStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
86 IOVM_API int IoCoroutine_rawIoStackSize(IoCoroutine *self);
88 // raw
90 IOVM_API void IoCoroutine_rawRun(IoCoroutine *self);
92 IOVM_API void IoCoroutine_clearStack(IoCoroutine *self);
94 IOVM_API void IoCoroutine_try(IoCoroutine *self, IoObject *target, IoObject *locals, IoMessage *message);
96 IOVM_API IoCoroutine *IoCoroutine_newWithTry(void *state,
97 IoObject *target,
98 IoObject *locals,
99 IoMessage *message);
101 IOVM_API void IoCoroutine_raiseError(IoCoroutine *self, IoSymbol *description, IoMessage *m);
103 // methods
105 IOVM_API IoObject *IoCoroutine_implementation(IoCoroutine *self, IoObject *locals, IoMessage *m);
107 IOVM_API IoObject *IoCoroutine_run(IoCoroutine *self, IoObject *locals, IoMessage *m);
108 IOVM_API IoObject *IoCoroutine_callStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
110 IOVM_API IoObject *IoCoroutine_isCurrent(IoCoroutine *self, IoObject *locals, IoMessage *m);
112 // runTarget
114 IOVM_API void IoCoroutine_rawSetRunTarget_(IoCoroutine *self, IoObject *v);
115 IOVM_API IoObject *IoCoroutine_rawRunTarget(IoCoroutine *self);
117 // message
119 IOVM_API void IoCoroutine_rawSetRunMessage_(IoCoroutine *self, IoObject *v);
120 IOVM_API IoObject *IoCoroutine_rawRunMessage(IoCoroutine *self);
122 // parent
124 IOVM_API void IoCoroutine_rawSetParentCoroutine_(IoCoroutine *self, IoObject *v);
125 IOVM_API IoObject *IoCoroutine_rawParentCoroutine(IoCoroutine *self);
127 // try
129 IOVM_API IoObject *IoCoroutine_start(IoCoroutine *self, IoObject *locals, IoMessage *m);
131 IOVM_API IoObject *IoCoroutine_rawResume(IoCoroutine *self);
132 IOVM_API IoObject *IoCoroutine_resume(IoCoroutine *self, IoObject *locals, IoMessage *m);
134 IOVM_API IoObject *IoCoroutine_isCurrent(IoCoroutine *self, IoObject *locals, IoMessage *m);
135 IOVM_API IoObject *IoCoroutine_currentCoroutine(IoCoroutine *self, IoObject *locals, IoMessage *m);
137 // stack trace
139 IOVM_API IoObject *IoObject_callStack(IoCoroutine *self);
141 IOVM_API void IoObject_appendStackEntryDescription(IoCoroutine *self, UArray *ba);
143 IOVM_API void IoCoroutine_rawPrint(IoCoroutine *self);
145 // debugging
147 IOVM_API int IoCoroutine_rawDebuggingOn(IoCoroutine *self);
149 IOVM_API IoObject *IoCoroutine_setMessageDebugging(IoCoroutine *self, IoObject *locals, IoMessage *m);
150 IOVM_API IoObject *IoObject_performWithDebugger(IoCoroutine *self, IoObject *locals, IoMessage *m);
152 IOVM_API IoObject *IoCoroutine_callStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
154 IOVM_API void IoCoroutine_rawPrintBackTrace(IoCoroutine *self);
156 #ifdef __cplusplus
158 #endif
159 #endif