New doc system done for core
[io.git] / libs / iovm / source / IoCoroutine.h
blob239ef5315775606dc5c84aae99832ebbd0aa4925
2 //metadoc Coroutine copyright Steve Dekorte 2002
3 //metadoc Coroutine license BSD revised
5 #ifndef IoCoroutine_DEFINED
6 #define IoCoroutine_DEFINED 1
7 #include "IoVMApi.h"
9 #include "IoState.h"
11 #include "Common.h"
12 #include "Coro.h"
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
18 #define ISCOROUTINE(self) IoObject_hasCloneFunc_(self, (IoTagCloneFunc *)IoCoroutine_rawClone)
20 typedef IoObject IoCoroutine;
22 typedef struct
24 Coro *cid;
25 Stack *ioStack;
26 int debuggingOn;
27 } IoCoroutineData;
29 IOVM_API IoCoroutine *IoCoroutine_proto(void *state);
30 IOVM_API void IoCoroutine_protoFinish(IoCoroutine *self);
31 IOVM_API IoCoroutine *IoCoroutine_rawClone(IoCoroutine *self);
32 IOVM_API IoCoroutine *IoCoroutine_new(void *state);
34 IOVM_API void IoCoroutine_free(IoCoroutine *self);
35 IOVM_API void IoCoroutine_mark(IoCoroutine *self);
36 Stack *IoCoroutine_rawIoStack(IoCoroutine *self);
37 IOVM_API void IoCoroutine_rawShow(IoCoroutine *self);
39 IOVM_API IoObject *IoCoroutine_main(IoCoroutine *self, IoObject *locals, IoMessage *m);
40 IOVM_API IoObject *IoCoroutine_freeStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
42 IOVM_API void *IoCoroutine_cid(IoCoroutine *self);
44 // label
46 //void IoCoroutine_rawSetLabel_(IoCoroutine *self, IoSymbol *s);
47 //IoObject *IoCoroutine_rawLabel(IoCoroutine *self);
49 IOVM_API IoObject *IoCoroutine_setLabel(IoCoroutine *self, IoObject *locals, IoMessage *m);
50 IOVM_API IoObject *IoCoroutine_label(IoCoroutine *self, IoObject *locals, IoMessage *m);
52 // runTarget
54 IOVM_API void IoCoroutine_rawSetRunTarget_(IoCoroutine *self, IoObject *v);
55 IOVM_API IoObject *IoCoroutine_rawRunTarget(IoCoroutine *self);
57 // runMessage
59 IOVM_API void IoCoroutine_rawSetRunMessage_(IoCoroutine *self, IoObject *v);
60 IOVM_API IoObject *IoCoroutine_rawRunMessage(IoCoroutine *self);
62 // runLocals
64 IOVM_API void IoCoroutine_rawSetRunLocals_(IoCoroutine *self, IoObject *v);
65 IOVM_API IoObject *IoCoroutine_rawRunLocals(IoCoroutine *self);
67 // parent
69 IOVM_API void IoCoroutine_rawSetParentCoroutine_(IoCoroutine *self, IoObject *v);
70 IOVM_API IoObject *IoCoroutine_rawParentCoroutine(IoCoroutine *self);
71 // exception
73 IOVM_API void IoCoroutine_rawSetResult_(IoCoroutine *self, IoObject *v);
74 IOVM_API IoObject *IoCoroutine_rawResult(IoCoroutine *self);
76 // exception
78 IOVM_API void IoCoroutine_rawRemoveException(IoCoroutine *self);
79 IOVM_API void IoCoroutine_rawSetException_(IoCoroutine *self, IoObject *v);
80 IOVM_API IoObject *IoCoroutine_rawException(IoCoroutine *self);
82 // ioStack
84 IOVM_API IoObject *IoCoroutine_ioStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
85 IOVM_API int IoCoroutine_rawIoStackSize(IoCoroutine *self);
87 // raw
89 IOVM_API void IoCoroutine_rawRun(IoCoroutine *self);
91 IOVM_API void IoCoroutine_clearStack(IoCoroutine *self);
93 IOVM_API void IoCoroutine_try(IoCoroutine *self, IoObject *target, IoObject *locals, IoMessage *message);
95 IOVM_API IoCoroutine *IoCoroutine_newWithTry(void *state,
96 IoObject *target,
97 IoObject *locals,
98 IoMessage *message);
100 IOVM_API void IoCoroutine_raiseError(IoCoroutine *self, IoSymbol *description, IoMessage *m);
102 // methods
104 IOVM_API IoObject *IoCoroutine_implementation(IoCoroutine *self, IoObject *locals, IoMessage *m);
106 IOVM_API IoObject *IoCoroutine_run(IoCoroutine *self, IoObject *locals, IoMessage *m);
107 IOVM_API IoObject *IoCoroutine_callStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
109 IOVM_API IoObject *IoCoroutine_isCurrent(IoCoroutine *self, IoObject *locals, IoMessage *m);
111 // runTarget
113 IOVM_API void IoCoroutine_rawSetRunTarget_(IoCoroutine *self, IoObject *v);
114 IOVM_API IoObject *IoCoroutine_rawRunTarget(IoCoroutine *self);
116 // message
118 IOVM_API void IoCoroutine_rawSetRunMessage_(IoCoroutine *self, IoObject *v);
119 IOVM_API IoObject *IoCoroutine_rawRunMessage(IoCoroutine *self);
121 // parent
123 IOVM_API void IoCoroutine_rawSetParentCoroutine_(IoCoroutine *self, IoObject *v);
124 IOVM_API IoObject *IoCoroutine_rawParentCoroutine(IoCoroutine *self);
126 // try
128 IOVM_API IoObject *IoCoroutine_start(IoCoroutine *self, IoObject *locals, IoMessage *m);
130 IOVM_API IoObject *IoCoroutine_rawResume(IoCoroutine *self);
131 IOVM_API IoObject *IoCoroutine_resume(IoCoroutine *self, IoObject *locals, IoMessage *m);
133 IOVM_API IoObject *IoCoroutine_isCurrent(IoCoroutine *self, IoObject *locals, IoMessage *m);
134 IOVM_API IoObject *IoCoroutine_currentCoroutine(IoCoroutine *self, IoObject *locals, IoMessage *m);
136 // stack trace
138 IOVM_API IoObject *IoObject_callStack(IoCoroutine *self);
140 IOVM_API void IoObject_appendStackEntryDescription(IoCoroutine *self, UArray *ba);
142 IOVM_API void IoCoroutine_rawPrint(IoCoroutine *self);
144 // debugging
146 IOVM_API int IoCoroutine_rawDebuggingOn(IoCoroutine *self);
148 IOVM_API IoObject *IoCoroutine_setMessageDebugging(IoCoroutine *self, IoObject *locals, IoMessage *m);
149 IOVM_API IoObject *IoObject_performWithDebugger(IoCoroutine *self, IoObject *locals, IoMessage *m);
151 IOVM_API IoObject *IoCoroutine_callStack(IoCoroutine *self, IoObject *locals, IoMessage *m);
153 IOVM_API void IoCoroutine_rawPrintBackTrace(IoCoroutine *self);
155 //error
157 IOVM_API IoObject *IoCoroutine_rawSetErrorDescription_(IoCoroutine *self, IoSymbol *description);
158 IOVM_API IoObject *IoCoroutine_setErrorDescription(IoCoroutine *self, IoObject *locals, IoMessage *m);
159 #ifdef __cplusplus
161 #endif
162 #endif