Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | /* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh |
2 | * Jagannathan, and Stephen Weeks. | |
3 | * Copyright (C) 1997-2000 NEC Research Institute. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | */ | |
8 | ||
9 | #ifndef _C_COMMON_H_ | |
10 | #define _C_COMMON_H_ | |
11 | ||
12 | #ifndef DEBUG_CCODEGEN | |
13 | #define DEBUG_CCODEGEN FALSE | |
14 | #endif | |
15 | ||
16 | #include "export.h" | |
17 | ||
18 | struct cont { | |
19 | void *nextChunk; | |
20 | }; | |
21 | ||
22 | PRIVATE extern uintptr_t nextFun; | |
23 | PRIVATE extern int returnToC; | |
24 | PRIVATE extern struct cont (*nextChunks []) (void); | |
25 | ||
26 | #define ChunkName(n) Chunk ## n | |
27 | ||
28 | #define DeclareChunk(n) \ | |
29 | PRIVATE struct cont ChunkName(n)(void) | |
30 | ||
31 | #define Chunkp(n) &(ChunkName(n)) | |
32 | ||
33 | #define PrepFarJump(n, l) \ | |
34 | do { \ | |
35 | cont.nextChunk = (void*)ChunkName(n); \ | |
36 | nextFun = l; \ | |
37 | } while (0) | |
38 | ||
39 | #endif /* #ifndef _C_COMMON_H_ */ |