diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/LuaJIT-1.1.7/src/lcoco.h | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/libraries/LuaJIT-1.1.7/src/lcoco.h b/libraries/LuaJIT-1.1.7/src/lcoco.h deleted file mode 100644 index 9fb6207..0000000 --- a/libraries/LuaJIT-1.1.7/src/lcoco.h +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* | ||
2 | ** Lua/Coco glue. | ||
3 | ** Copyright (C) 2004-2011 Mike Pall. See copyright notice in lcoco.c | ||
4 | */ | ||
5 | |||
6 | #ifndef lcoco_h | ||
7 | #define lcoco_h | ||
8 | |||
9 | #define LUACOCO_VERSION "Coco 1.1.6" | ||
10 | #define LUACOCO_VERSION_NUM 10106 | ||
11 | |||
12 | /* Exported C API to add a C stack to a coroutine. */ | ||
13 | LUA_API lua_State *lua_newcthread(lua_State *L, int cstacksize); | ||
14 | |||
15 | /* Internal support routines. */ | ||
16 | LUAI_FUNC void luaCOCO_free(lua_State *L); | ||
17 | LUAI_FUNC int luaCOCO_resume(lua_State *L, int nargs); | ||
18 | LUAI_FUNC int luaCOCO_yield(lua_State *L); | ||
19 | LUAI_FUNC int luaCOCO_cstacksize(int cstacksize); | ||
20 | |||
21 | /* Forward declaration. */ | ||
22 | typedef struct coco_State coco_State; | ||
23 | |||
24 | /* These are redefined below. */ | ||
25 | #undef LUAI_EXTRASPACE | ||
26 | #undef luai_userstateopen | ||
27 | /* luai_userstateclose unused */ | ||
28 | #undef luai_userstatethread | ||
29 | #undef luai_userstatefree | ||
30 | #undef luai_userstateresume | ||
31 | #undef luai_userstateyield | ||
32 | |||
33 | /* Use Windows Fibers (Win98+). */ | ||
34 | #if defined(_WIN32) | ||
35 | |||
36 | /* Fibers allocate their own stack. The whole Coco state is in front of L. */ | ||
37 | struct coco_State { | ||
38 | void *fib; /* Own fiber (if any). */ | ||
39 | void *back; /* Fiber to switch back to. */ | ||
40 | int nargs; /* Number of arguments to pass. */ | ||
41 | int dummy_align; | ||
42 | }; | ||
43 | |||
44 | #define L2COCO(L) (&((coco_State *)(L))[-1]) | ||
45 | #define LHASCOCO(L) (L2COCO(L)->fib) | ||
46 | #define LUAI_EXTRASPACE sizeof(coco_State) | ||
47 | #define luai_userstateopen(L) L2COCO(L)->fib = NULL | ||
48 | #define luai_userstatethread(L,L1) L2COCO(L1)->fib = NULL | ||
49 | #define COCO_USE_FIBERS | ||
50 | |||
51 | #else /* !defined(_WIN32) */ | ||
52 | |||
53 | /* The Coco state depends on the context switch method used. See lcoco.c. */ | ||
54 | /* It's stored at the end of the stack. Only need a pointer in front of L. */ | ||
55 | #define L2COCO(L) (((coco_State **)(L))[-1]) | ||
56 | #define LHASCOCO(L) (L2COCO(L)) | ||
57 | /* This wastes some space on 32 bit systems, but gets better alignment. */ | ||
58 | #define LUAI_EXTRASPACE sizeof(LUAI_USER_ALIGNMENT_T) | ||
59 | #define luai_userstateopen(L) L2COCO(L) = NULL | ||
60 | #define luai_userstatethread(L,L1) L2COCO(L1) = NULL | ||
61 | |||
62 | #endif /* !defined(_WIN32) */ | ||
63 | |||
64 | #define luai_userstatefree(L) if (LHASCOCO(L)) luaCOCO_free(L) | ||
65 | #define luai_userstateresume(L, nargs) \ | ||
66 | if (LHASCOCO(L)) return luaCOCO_resume(L, nargs) | ||
67 | #define luai_userstateyield(L, nresults) \ | ||
68 | do { if (LHASCOCO(L)) { \ | ||
69 | L->base = L->top - (nresults); /* Protect stack slots below. */ \ | ||
70 | return luaCOCO_yield(L); } } while (0) | ||
71 | |||
72 | #endif | ||