/* Cycript - Optimizing JavaScript Compiler/Runtime
- * Copyright (C) 2009-2014 Jay Freeman (saurik)
+ * Copyright (C) 2009-2015 Jay Freeman (saurik)
*/
/* GNU Affero General Public License, Version 3 {{{ */
#ifndef CYCRIPT_EXCEPTION_HPP
#define CYCRIPT_EXCEPTION_HPP
+#include <cstdlib>
+
#ifdef CY_EXECUTE
#include <JavaScriptCore/JSBase.h>
#endif
_value; })
#define _trace() do { \
- fprintf(stderr, "_trace():%u\n", __LINE__); \
+ fprintf(stderr, "_trace(%s:%u)\n", __FILE__, __LINE__); \
} while (false)
static _finline bool CYContains(int value, size_t many, const int *okay) {
return false;
}
-#define _syscall_(expr, many, okay) ({ \
+#define _syscall_(expr, many, ...) ({ \
__typeof__(expr) _value; \
do if ((long) (_value = (expr)) != -1) \
break; \
- else if (CYContains(errno, many, ((const int [many]) okay))) \
+ else if (CYContains(errno, many, ((const int [many + 1]) {0, ##__VA_ARGS__} + 1))) \
break; \
else \
_assert_("syscall", errno == EINTR, #expr, " [errno=%d]", errno); \
})
#define _syscall(expr) \
- _syscall_(expr, 0, {})
-
-#define _krncall(expr) \
- do { \
- kern_return_t _krnstatus((expr)); \
- _assert_("krncall", _krnstatus == KERN_SUCCESS, #expr, " [return=0x%x]", _krnstatus); \
- } while (false)
+ _syscall_(expr, 0)
#define _sqlcall(expr) ({ \
__typeof__(expr) _value = (expr); \