source: proiecte/swift/trunk/include/swift_common.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 1.2 KB
Line 
1/*
2 * swift_common.h
3 *
4 * (c) 2009 Ionut Rosoiu <ionut.rosoiu@gmail.com>
5 *
6 */
7
8#ifndef SWIFT_COMMON_H_
9#define SWIFT_COMMON_H_
10
11#define SWIFT_SUCCESS                    0
12#define SWIFT_FAILURE                   -1
13#define SWIFT_INVALID_PARAM     -2
14#define SWIFT_LAST_STATUS_NO    SWIFT_INVALID_PARAM
15
16typedef int                             swift_status_t;
17typedef unsigned int            swift_size_t;
18typedef unsigned char           swift_id_t;
19
20/*
21#define SWIFT_USE_CUSTOM_ALLOCATOR      1
22#undef SWIFT_USE_CUSTOM_ALLOCATOR
23
24#define SWIFT_USE_CUSTOM_THREAD_ALLOCATOR 1
25#undef SWIFT_USE_CUSTOM_THREAD_ALLOCATOR
26
27#define LOGGING_ON 1
28#undef LOGGING_ON
29*/
30
31#define SWIFT_KB                                        1024
32#define SWIFT_MB                                        (SWIFT_KB * SWIFT_KB)
33#define SWIFT_HEAP_SIZE                         (100 * SWIFT_MB)
34
35typedef swift_size_t            swift_word_t;
36typedef unsigned long long      swift_dword_t;
37
38#define SWIFT_CHECK(cond, exec) \
39        do {                                            \
40                if (!(cond)) { exec; }  \
41        } while (0)
42
43#define SWIFT_RETURN_WITH_STATUS(val)   \
44        do {                                                            \
45                *status = val;                                  \
46                return;                                                 \
47        } while (0)
48
49#define SWIFT_CHECK_SUCCESS()   \
50        SWIFT_CHECK(SWIFT_SUCCESS == *status, return)
51
52#define SWIFT_CHECK_SUCCESS_RETURN(val) \
53        SWIFT_CHECK(SWIFT_SUCCESS == *status, SWIFT_RETURN_WITH_STATUS(val))
54
55
56#endif /* SWIFT_COMMON_H_ */
Note: See TracBrowser for help on using the repository browser.