| 1 |
#ifndef __FUTURE_H__ |
| 2 |
#define __FUTURE_H__ |
| 3 |
|
| 4 |
#define future_boot() Future_boot(aTHX) |
| 5 |
void Future_boot(pTHX); |
| 6 |
|
| 7 |
#define future_new(cls) Future_new(aTHX_ cls) |
| 8 |
SV *Future_new(pTHX_ const char *cls); |
| 9 |
|
| 10 |
#define future_destroy(f) Future_destroy(aTHX_ f) |
| 11 |
void Future_destroy(pTHX_ SV *f); |
| 12 |
|
| 13 |
#define sv_is_future(sv) Future_sv_is_future(aTHX_ sv) |
| 14 |
bool Future_sv_is_future(pTHX_ SV *sv); |
| 15 |
|
| 16 |
#define future_is_ready(f) Future_is_ready(aTHX_ f) |
| 17 |
bool Future_is_ready(pTHX_ SV *f); |
| 18 |
|
| 19 |
#define future_is_done(f) Future_is_done(aTHX_ f) |
| 20 |
bool Future_is_done(pTHX_ SV *f); |
| 21 |
|
| 22 |
#define future_is_failed(f) Future_is_failed(aTHX_ f) |
| 23 |
bool Future_is_failed(pTHX_ SV *f); |
| 24 |
|
| 25 |
#define future_is_cancelled(f) Future_is_cancelled(aTHX_ f) |
| 26 |
bool Future_is_cancelled(pTHX_ SV *f); |
| 27 |
|
| 28 |
#define future_donev(f, svp, n) Future_donev(aTHX_ f, svp, n) |
| 29 |
void Future_donev(pTHX_ SV *f, SV **svp, size_t n); |
| 30 |
|
| 31 |
#define future_failv(f, svp, n) Future_failv(aTHX_ f, svp, n) |
| 32 |
void Future_failv(pTHX_ SV *f, SV **svp, size_t n); |
| 33 |
|
| 34 |
#define future_failp(f, s) Future_failp(aTHX_ f, s) |
| 35 |
void Future_failp(pTHX_ SV *f, const char *s); |
| 36 |
|
| 37 |
#define future_on_cancel(f, code) Future_on_cancel(aTHX_ f, code) |
| 38 |
void Future_on_cancel(pTHX_ SV *f, SV *code); |
| 39 |
|
| 40 |
#define future_on_ready(f, code) Future_on_ready(aTHX_ f, code) |
| 41 |
void Future_on_ready(pTHX_ SV *f, SV *code); |
| 42 |
|
| 43 |
#define future_on_done(f, code) Future_on_done(aTHX_ f, code) |
| 44 |
void Future_on_done(pTHX_ SV *f, SV *code); |
| 45 |
|
| 46 |
#define future_on_fail(f, code) Future_on_fail(aTHX_ f, code) |
| 47 |
void Future_on_fail(pTHX_ SV *f, SV *code); |
| 48 |
|
| 49 |
#define future_get_result_av(f, await) Future_get_result_av(aTHX_ f, await) |
| 50 |
AV *Future_get_result_av(pTHX_ SV *f, bool await); |
| 51 |
|
| 52 |
#define future_get_failure_av(f) Future_get_failure_av(aTHX_ f) |
| 53 |
AV *Future_get_failure_av(pTHX_ SV *f); |
| 54 |
|
| 55 |
#define future_cancel(f) Future_cancel(aTHX_ f) |
| 56 |
void Future_cancel(pTHX_ SV *f); |
| 57 |
|
| 58 |
#define future_without_cancel(f) Future_without_cancel(aTHX_ f) |
| 59 |
SV *Future_without_cancel(pTHX_ SV *f); |
| 60 |
|
| 61 |
enum { |
| 62 |
FUTURE_THEN_WITH_F = (1<<0), |
| 63 |
}; |
| 64 |
|
| 65 |
#define future_then(f, flags, thencode, elsecode) Future_then(aTHX_ f, flags, thencode, elsecode) |
| 66 |
SV *Future_then(pTHX_ SV *f, U32 flags, SV *thencode, SV *elsecode); |
| 67 |
|
| 68 |
#define future_thencatch(f, flags, thencode, catches, elsecode) Future_thencatch(aTHX_ f, flags, thencode, catches, elsecode) |
| 69 |
SV *Future_thencatch(pTHX_ SV *f, U32 flags, SV *thencode, HV *catches, SV *elsecode); |
| 70 |
|
| 71 |
#define future_followed_by(f, code) Future_followed_by(aTHX_ f, code) |
| 72 |
SV *Future_followed_by(pTHX_ SV *f, SV *code); |
| 73 |
|
| 74 |
/* convergent constructors */ |
| 75 |
#define future_new_waitallv(cls, subs, n) Future_new_waitallv(aTHX_ cls, subs, n) |
| 76 |
SV *Future_new_waitallv(pTHX_ const char *cls, SV **subs, size_t n); |
| 77 |
|
| 78 |
#define future_new_waitanyv(cls, subs, n) Future_new_waitanyv(aTHX_ cls, subs, n) |
| 79 |
SV *Future_new_waitanyv(pTHX_ const char *cls, SV **subs, size_t n); |
| 80 |
|
| 81 |
#define future_new_needsallv(cls, subs, n) Future_new_needsallv(aTHX_ cls, subs, n) |
| 82 |
SV *Future_new_needsallv(pTHX_ const char *cls, SV **subs, size_t n); |
| 83 |
|
| 84 |
#define future_new_needsanyv(cls, subs, n) Future_new_needsanyv(aTHX_ cls, subs, n) |
| 85 |
SV *Future_new_needsanyv(pTHX_ const char *cls, SV **subs, size_t n); |
| 86 |
|
| 87 |
enum FutureSubFilter { |
| 88 |
FUTURE_SUBS_PENDING, |
| 89 |
FUTURE_SUBS_READY, |
| 90 |
FUTURE_SUBS_DONE, |
| 91 |
FUTURE_SUBS_FAILED, |
| 92 |
FUTURE_SUBS_CANCELLED, |
| 93 |
}; |
| 94 |
#define future_mPUSH_subs(f, filter) Future_mPUSH_subs(aTHX_ f, filter) |
| 95 |
Size_t Future_mPUSH_subs(pTHX_ SV *f, enum FutureSubFilter filter); |
| 96 |
|
| 97 |
#define future_get_btime(f) Future_get_btime(aTHX_ f) |
| 98 |
struct timeval Future_get_btime(pTHX_ SV *f); |
| 99 |
|
| 100 |
#define future_get_rtime(f) Future_get_rtime(aTHX_ f) |
| 101 |
struct timeval Future_get_rtime(pTHX_ SV *f); |
| 102 |
|
| 103 |
#define future_set_label(f, label) Future_set_label(aTHX_ f, label) |
| 104 |
void Future_set_label(pTHX_ SV *f, SV *label); |
| 105 |
|
| 106 |
#define future_get_label(f) Future_get_label(aTHX_ f) |
| 107 |
SV *Future_get_label(pTHX_ SV *f); |
| 108 |
|
| 109 |
#define future_set_udata(f, key, value) Future_set_udata(aTHX_ f, key, value) |
| 110 |
void Future_set_udata(pTHX_ SV *f, SV *key, SV *value); |
| 111 |
|
| 112 |
#define future_get_udata(f, key) Future_get_udata(aTHX_ f, key) |
| 113 |
SV *Future_get_udata(pTHX_ SV *f, SV *key); |
| 114 |
|
| 115 |
void Future_reread_environment(pTHX); |
| 116 |
|
| 117 |
#endif |