… | |
… | |
4 | INPUT |
4 | INPUT |
5 | |
5 | |
6 | T_STATE_OR_HASHREF |
6 | T_STATE_OR_HASHREF |
7 | { |
7 | { |
8 | SV *arg = $arg; |
8 | SV *arg = $arg; |
|
|
9 | |
9 | if (SvROK (arg) && SvTYPE(SvRV(arg)) == SVt_PVHV) |
10 | if (SvROK(arg) && SvTYPE(SvRV(arg)) == SVt_PVHV) |
10 | { |
11 | { |
11 | SV **state = hv_fetch((HV *)SvRV(arg), \"_coro_state\", 11, 0); |
12 | HE *he = hv_fetch_ent((HV *)SvRV(arg), ucoro_state_sv, 0, ucoro_state_hash); |
|
|
13 | |
12 | if (!state) |
14 | if (!he) |
13 | croak (\"${Package}::$func_name() -- $var is a hashref but lacks the _coro_state key\"); |
15 | croak (\"${Package}::$func_name() -- $var is a hashref but lacks the \" UCORO_STATE \" key\"); |
|
|
16 | |
14 | arg = *state; |
17 | arg = HeVAL(he); |
15 | } |
18 | } |
16 | |
19 | |
17 | /* must also be changed inside Coro::Cont::result */ |
20 | /* must also be changed inside Coro::Cont::yield */ |
18 | if (sv_derived_from (arg, \"Coro::State\")) |
21 | if (SvROK(arg) && SvSTASH(SvRV(arg)) == coro_state_stash) |
19 | $var = ($type) SvIV((SV*)SvRV(arg)); |
22 | $var = ($type) SvIV((SV*)SvRV(arg)); |
20 | else |
23 | else |
21 | croak (\"${Package}::$func_name() -- $var is not (and contains not) a Coro::State object\"); |
24 | croak (\"${Package}::$func_name() -- $var is not (and contains not) a Coro::State object\"); |
22 | } |
25 | } |
23 | |
26 | |