-
Notifications
You must be signed in to change notification settings - Fork 2
/
shift0.h
43 lines (35 loc) · 1.26 KB
/
shift0.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Declarations for the shift0/reset0 control operators
* shift0.h
*
* Copyright (c) 2011, Marek Materzok <[email protected]>
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* The software is provided 'as is', without any warranty.
*/
#ifndef _SHIFT0_H
#define _SHIFT0_H
#include <features.h>
#include <sys/types.h>
__BEGIN_DECLS
struct cont {};
typedef void* (*resettable_t)();
typedef void* (*resettable_arg_t)(void*);
typedef void* (*shiftable_t)(struct cont*);
typedef void* (*shiftable_arg_t)(struct cont*, void*);
void* reset_arg(resettable_arg_t fun, void* arg);
void* reset(resettable_t fun);
#define reset(f) reset_arg((resettable_arg_t)f,0)
void* shift0_arg(shiftable_arg_t fun, void* a);
void* shift0(shiftable_t fun);
#define shift0(f) shift0_arg((shiftable_arg_t)f,0)
void* shift_arg(shiftable_arg_t fun, void *a);
void* shift(shiftable_t fun);
void* runcont(struct cont *fun, void* val);
void freecont(struct cont *fun);
__END_DECLS
#endif