Skip to content

Instantly share code, notes, and snippets.

@earl
Created January 14, 2015 03:19
Show Gist options
  • Save earl/4c77430ff27b62147883 to your computer and use it in GitHub Desktop.
Save earl/4c77430ff27b62147883 to your computer and use it in GitHub Desktop.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 241c8a8..6488064 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -424,6 +424,10 @@ elseif(RUNTIME STREQUAL "rebol")
add_definitions(-DOS_DEFS) # Kill warning about IS_ERROR redefinition.
add_definitions(-DUNICODE)
+ elseif(APPLE)
+
+ add_definitions(-DTO_OSXI)
+
else()
add_definitions(-DTO_LINUX)
diff --git a/include/rencpp/common.hpp b/include/rencpp/common.hpp
index cb33030..60cd3fb 100644
--- a/include/rencpp/common.hpp
+++ b/include/rencpp/common.hpp
@@ -71,44 +71,6 @@
///
-/// BRIDGES TO FIXED-SIZE CONVERSIONS
-///
-
-//
-// Although 64-bit builds of Rebol do exist, Red is currently focusing on
-// 32-bit architectures for the most part. Hence there are some places
-// where pointers can't be used and need to be converted to. Hopefully not
-// too many of these will creep in; but right now there are some by matter
-// of necessity and it's good to point them out.
-//
-
-static_assert(
- sizeof(void *) == sizeof(int32_t),
- "building rencpp binding with non 32-bit pointers..."
- "see evilPointerToInt32Cast in include/rencpp/common.hpp"
-);
-
-static_assert(
- sizeof(size_t) == sizeof(int32_t),
- "building rencpp binding with non 32-bit size_t..."
- "see remarks in include/rencpp/common.hpp"
-);
-
-inline int32_t evilPointerToInt32Cast(void const * somePointer) {
- return reinterpret_cast<int32_t>(somePointer);
-}
-
-template<class T>
-inline T evilInt32ToPointerCast(int32_t someInt) {
- static_assert(
- std::is_pointer<T>::value,
- "evilInt32ToPointer cast used on non-ptr"
- );
- return reinterpret_cast<T>(someInt);
-}
-
-
-///
/// UNREACHABLE CODE MACRO
///
diff --git a/src/rebol-binding/rebol-hooks.cpp b/src/rebol-binding/rebol-hooks.cpp
index 483ffc8..02e4502 100644
--- a/src/rebol-binding/rebol-hooks.cpp
+++ b/src/rebol-binding/rebol-hooks.cpp
@@ -468,7 +468,7 @@ public:
// get through transcode which returns [foo bar] and
// [[foo bar]] that discern the cases
- auto loadText = reinterpret_cast<REBYTE*>(cell->data.integer);
+ auto loadText = reinterpret_cast<REBYTE*>(VAL_HANDLE(cell));
REBSER * transcoded = Scan_Source(
loadText, LEN_BYTES(loadText)
diff --git a/src/rebol-binding/rebol-runtime.cpp b/src/rebol-binding/rebol-runtime.cpp
index c3893aa..1d2ba4a 100644
--- a/src/rebol-binding/rebol-runtime.cpp
+++ b/src/rebol-binding/rebol-runtime.cpp
@@ -27,7 +27,8 @@ Loadable::Loadable (char const * sourceCstr) :
{
// using REB_END as our "alien"
VAL_SET(&cell, REB_END);
- cell.data.integer = evilPointerToInt32Cast(sourceCstr);
+ VAL_HANDLE(&cell) =
+ reinterpret_cast<ANYFUNC>(const_cast<char *>(sourceCstr));
refcountPtr = nullptr;
origin = REN_ENGINE_HANDLE_INVALID;
@@ -107,12 +108,12 @@ RebolRuntime::RebolRuntime (bool) :
bounds = STACK_BOUNDS;
#ifdef OS_STACK_GROWS_UP
- Stack_Limit = (REBCNT)(&marker) + bounds;
+ Stack_Limit = (REBUPT)(&marker) + bounds;
#else
- if (bounds > (REBCNT)(&marker))
+ if (bounds > (REBUPT)(&marker))
Stack_Limit = 100;
else
- Stack_Limit = (REBCNT)(&marker) - bounds;
+ Stack_Limit = (REBUPT)(&marker) - bounds;
#endif
// Rebytes, version numbers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment