Branching is a better way of hancdling this. But I'm not in favour of creating another branch at the moment. We are already running 2 branches and introducing another one may complicate the scenario. I prefer to put it in trunk at the moment.
Any kind help would be welcome.
I'd also urge all to test it on 32 bit platform, if possible.
At the moment I just want make sure Code::Blocks compiles fine on Win 64 bit. Porting to Linux shouldn't be an issue as porting is much easier on Linux and I believe current code well on 64 bit Linux at the moment. I'm ok with introducing updated Squirrel to trunk.
I'm posting an updated patch. This patch should allow anyone to build Code::Blocks (on Win 64) upto wxScintilla target. I'm getting an ICE (Internal Compiler Error) while compiling the SDK target. Previous patch was not clean as some of our source file had inconsistent line endings (now fixed in trunk). This patch is much cleaner to apply.
Index: src/include/scripting/include/squirrel.h
===================================================================
--- src/include/scripting/include/squirrel.h (revision 5953)
+++ src/include/scripting/include/squirrel.h (working copy)
@@ -40,27 +40,33 @@
#endif
// C::B patch: so it builds on 64bit
-#ifdef _LP64
+#if defined(_LP64) || defined(_WIN64)
#define _SQ64
#endif
-#ifdef _SQ64
-#ifdef _MSC_VER
-typedef __int64 SQInteger;
-typedef unsigned __int64 SQUnsignedInteger;
-typedef unsigned __int64 SQHash; /*should be the same size of a pointer*/
+#if defined(_SQ64)
+ #if defined(__WXMSW__) /* Win specific code */
+ #ifdef _MSC_VER
+ typedef __int64 SQInteger;
+ typedef unsigned __int64 SQUnsignedInteger;
+ typedef unsigned __int64 SQHash; /*should be the same size of a pointer*/
+ #else
+ typedef long long SQInteger;
+ typedef unsigned long long SQUnsignedInteger;
+ typedef unsigned long long SQHash; /*should be the same size of a pointer*/
+ #endif
+ #else
+ typedef long SQInteger;
+ typedef unsigned long SQUnsignedInteger;
+ typedef unsigned long SQHash; /*should be the same size of a pointer*/
+ #endif
+ typedef int SQInt32;
#else
-typedef long SQInteger;
-typedef unsigned long SQUnsignedInteger;
-typedef unsigned long SQHash; /*should be the same size of a pointer*/
+ typedef int SQInteger;
+ typedef int SQInt32; /*must be 32 bits(also on 64bits processors)*/
+ typedef unsigned int SQUnsignedInteger;
+ typedef unsigned int SQHash; /*should be the same size of a pointer*/
#endif
-typedef int SQInt32;
-#else
-typedef int SQInteger;
-typedef int SQInt32; /*must be 32 bits(also on 64bits processors)*/
-typedef unsigned int SQUnsignedInteger;
-typedef unsigned int SQHash; /*should be the same size of a pointer*/
-#endif
typedef float SQFloat;
typedef void* SQUserPointer;
Index: src/include/scripting/sqplus/sqplus.h
===================================================================
--- src/include/scripting/sqplus/sqplus.h (revision 5953)
+++ src/include/scripting/sqplus/sqplus.h (working copy)
@@ -1,6 +1,6 @@
// SqPlus.h
// Created by John Schultz 9/05/05, major update 10/05/05.
-// Template function call design from LuaPlusCD by Joshua C. Jensen,
+// Template function call design from LuaPlusCD by Joshua C. Jensen,
// inspired by luabind which was inspired by boost::python.
// Const argument, const member functions, and Mac OS-X changes by Simon Michelmore.
// DECLARE_INSTANCE_TYPE_NAME changes by Ben (Project5) from http://www.squirrel-lang.org/forums/.
@@ -23,7 +23,7 @@
#endif
#endif
#include <memory.h>
-#if defined(_MSC_VER) || defined(__BORLANDC__)
+#if defined(_MSC_VER) || defined(__BORLANDC__)
#include <tchar.h>
#ifndef UNICODE
#define SCSNPRINTF _snprintf
@@ -50,13 +50,21 @@
#include "squirrel.h"
// C::B patch: so it builds on 64bit, ecapsulate bool/int/float using Squirrel types
-#ifndef _WINDEF_
+/*#ifndef _WINDEF_
typedef SQInteger BOOL;
typedef SQInteger INT;
typedef SQFloat FLOAT;
#define TRUE 1
#define FALSE 0
-#endif
+#endif*/
+ #if defined(BOOL)
+ #undef BOOL
+ #endif
+ #define BOOL SQInteger
+ #define INT SQInteger
+ typedef SQFloat FLOAT;
+ #define TRUE 1
+ #define FALSE 0
#include "SquirrelObject.h"
#include "SquirrelVM.h"
@@ -476,7 +484,7 @@
sq_remove(v,-3); // Remove the root table.
sq_push(v,1); // Push the 'this'.
#else // Kamaitati's change. 5/28/06 jcs.
- sq_remove(v,-2); // Remove the root table.
+ sq_remove(v,-2); // Remove the root table.
sq_pushroottable(v); // Push the 'this'.
#endif
if (SQ_FAILED(sq_call(v,1,SQTrue,SQ_CALL_RAISE_ERROR))) { // Call ClassName(): creates new instance and calls constructor (instead of sq_createinstance() where constructor is not called).
@@ -1580,8 +1588,8 @@
template<typename T>
struct ReleaseClassPtrPtr {
static SQInteger release(SQUserPointer up,SQInteger size) {
- if (up) {
- T ** self = (T **)up;
+ if (up) {
+ T ** self = (T **)up;
delete *self;
} // if
return 0;
@@ -1591,8 +1599,8 @@
template<typename T>
struct ReleaseClassPtr {
static SQInteger release(SQUserPointer up,SQInteger size) {
- if (up) {
- T * self = (T *)up;
+ if (up) {
+ T * self = (T *)up;
delete self;
} // if
return 0;
@@ -1628,7 +1636,7 @@
SQUserPointer typeTag;
sq_gettypetag(v,-1,&typeTag);
newObjectTable.SetUserPointer(INT(size_t(typeTag)),newClass);
- sq_poptop(v);
+ sq_poptop(v);
#else
instance.SetValue(SQ_ANCESTOR_CLASS_INDEX,i); // Store ancestor class index for recursive constructor calls to come.
INT top = sq_gettop(v);
@@ -1699,7 +1707,7 @@
} // if
classHierArray.ArrayAppend(newClass); // Add the class to the hierarchy array. The array values will be released and replaced with UserData to free created ancestor classes.
// C::B patch for 64bit builds
- newClass.SetValue(SQ_ANCESTOR_CLASS_INDEX,(SQInteger)-1); // When the class hierarchy is created, this var will be used to help in recursively creating ancestor classes.
+ //newClass.SetValue(SQ_ANCESTOR_CLASS_INDEX,(SQInteger)-1); // When the class hierarchy is created, this var will be used to help in recursively creating ancestor classes.
#endif
} // if
sq_settop(v,top);
Index: src/include/scripting/sqplus/SquirrelBindingsUtilsWin32.h
===================================================================
--- src/include/scripting/sqplus/SquirrelBindingsUtilsWin32.h (revision 5953)
+++ src/include/scripting/sqplus/SquirrelBindingsUtilsWin32.h (working copy)
@@ -10,6 +10,8 @@
#include <unknwn.h>
#endif
+#include "sqplus.h"
+
#ifndef SQUIRREL_BINDINGS_UTILS_H
#include "SquirrelBindingsUtils.h"
#endif
Index: src/include/wxscintilla/include/wx/wxscintilla.h
===================================================================
--- src/include/wxscintilla/include/wx/wxscintilla.h (revision 5953)
+++ src/include/wxscintilla/include/wx/wxscintilla.h (working copy)
@@ -2145,7 +2145,9 @@
//----------------------------------------------------------------------
+#if !wxCHECK_VERSION(2, 9, 0) && !defined(__WIN64)
typedef long wxIntPtr; // FIXME: back-port from wx29 (svn) to wx289
+#endif
class WXDLLIMPEXP_SCI wxScintilla : public wxControl {
public:
Index: src/sdk/scripting/sqplus/SquirrelBindingsUtilsWin32.cpp
===================================================================
--- src/sdk/scripting/sqplus/SquirrelBindingsUtilsWin32.cpp (revision 5953)
+++ src/sdk/scripting/sqplus/SquirrelBindingsUtilsWin32.cpp (working copy)
@@ -1,4 +1,4 @@
-#include "sqplus.h"
+//#include "sqplus.h"
//#include "SquirrelObject.h"
//#include "SquirrelVM.h"
Index: src/sdk/scripting/sqplus/SquirrelVM.cpp
===================================================================
--- src/sdk/scripting/sqplus/SquirrelVM.cpp (revision 5953)
+++ src/sdk/scripting/sqplus/SquirrelVM.cpp (working copy)
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
+#include <string.h>
#define _DEBUG_DUMP
@@ -21,7 +22,7 @@
SQInteger SquirrelVM::_CallState = -1;
SquirrelObject * SquirrelVM::_root = NULL;
-SquirrelError::SquirrelError()
+SquirrelError::SquirrelError()
{
const SQChar *s;
sq_getlasterror(SquirrelVM::_VM);
@@ -131,7 +132,7 @@
}
sq_pop(_VM,1);
throw SquirrelError();
-
+
}
@@ -204,7 +205,7 @@
SquirrelObject SquirrelVM::EndCall()
{
SquirrelObject ret;
- if(_CallState >= 0) {
+ if(_CallState >= 0) {
SQInteger oldtop = sq_gettop(_VM);
SQInteger nparams = _CallState;
_CallState = -1;
@@ -215,7 +216,7 @@
sq_settop(_VM,oldtop-(nparams+1));
throw SquirrelError();
}
-
+
}
return ret;
}
Index: src/sdk/wxscintilla/src/PlatWX.cpp
===================================================================
--- src/sdk/wxscintilla/src/PlatWX.cpp (revision 5953)
+++ src/sdk/wxscintilla/src/PlatWX.cpp (working copy)
@@ -1383,7 +1383,11 @@
void *lParam) {
wxScintilla* sci = (wxScintilla*)w;
+ #if defined(_WIN64)
+ return sci->SendMsg(msg, wParam, (long long)lParam);
+ #else
return sci->SendMsg(msg, wParam, (long)lParam);
+ #endif
}
Index: src/sdk/wxscintilla/src/scintilla/include/Scintilla.h
===================================================================
--- src/sdk/wxscintilla/src/scintilla/include/Scintilla.h (revision 5953)
+++ src/sdk/wxscintilla/src/scintilla/include/Scintilla.h (working copy)
@@ -29,8 +29,8 @@
#include <BaseTsd.h>
#endif
#ifdef MAXULONG_PTR
-typedef ULONG_PTR uptr_t;
-typedef LONG_PTR sptr_t;
+typedef UINT_PTR uptr_t;
+typedef INT_PTR sptr_t;
#else
typedef unsigned long uptr_t;
typedef long sptr_t;
@@ -122,8 +122,8 @@
#define SC_MARK_AVAILABLE 28
#define SC_MARK_CHARACTER 10000
/* CHANGEBAR begin */
-#define SC_MARKNUM_CHANGEUNSAVED 23
-#define SC_MARKNUM_CHANGESAVED 24
+#define SC_MARKNUM_CHANGEUNSAVED 23
+#define SC_MARKNUM_CHANGESAVED 24
/* CHANGEBAR end */
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@@ -133,7 +133,7 @@
#define SC_MARKNUM_FOLDER 30
#define SC_MARKNUM_FOLDEROPEN 31
/* CHANGEBAR begin */
-#define SC_MASK_FOLDERS 0xFF800000
+#define SC_MASK_FOLDERS 0xFF800000
/* CHANGEBAR end */
#define SCI_MARKERDEFINE 2040
#define SCI_MARKERSETFORE 2041
Index: src/sdk/wxscintilla/src/ScintillaWX.cpp
===================================================================
--- src/sdk/wxscintilla/src/ScintillaWX.cpp (revision 5953)
+++ src/sdk/wxscintilla/src/ScintillaWX.cpp (working copy)
@@ -727,7 +727,7 @@
//----------------------------------------------------------------------
-long ScintillaWX::DefWndProc(unsigned int /*iMessage*/, unsigned long /*wParam*/, long /*lParam*/) {
+sptr_t ScintillaWX::DefWndProc(unsigned int /*iMessage*/, uptr_t /*wParam*/, sptr_t /*lParam*/) {
return 0;
}
Index: src/sdk/wxscintilla/src/ScintillaWX.h
===================================================================
--- src/sdk/wxscintilla/src/ScintillaWX.h (revision 5953)
+++ src/sdk/wxscintilla/src/ScintillaWX.h (working copy)
@@ -117,9 +117,9 @@
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
virtual void ClaimSelection();
- virtual long DefWndProc(unsigned int iMessage,
- unsigned long wParam,
- long lParam);
+ virtual sptr_t DefWndProc(unsigned int iMessage,
+ uptr_t wParam,
+ sptr_t lParam);
virtual long WndProc(unsigned int iMessage,
unsigned long wParam,
long lParam);
Index: src/sdk/wxscintilla/src/wxscintilla.cpp
===================================================================
--- src/sdk/wxscintilla/src/wxscintilla.cpp (revision 5953)
+++ src/sdk/wxscintilla/src/wxscintilla.cpp (working copy)
@@ -1079,7 +1079,7 @@
// Define a set of character that when typed cancel the auto-completion list.
void wxScintilla::AutoCompStops (const wxString& characterSet)
{
- SendMsg(SCI_AUTOCSTOPS, 0, (long)(const char*)wx2sci(characterSet));
+ SendMsg(SCI_AUTOCSTOPS, 0, (wxIntPtr)(const char*)wx2sci(characterSet));
}
// Change the separator character in the string setting up an auto-completion list.
@@ -1760,7 +1760,7 @@
// Show a call tip containing a definition near position pos.
void wxScintilla::CallTipShow (int pos, const wxString& definition)
{
- SendMsg(SCI_CALLTIPSHOW, pos, (long)(const char*)wx2sci(definition));
+ SendMsg(SCI_CALLTIPSHOW, pos, (wxIntPtr)(const char*)wx2sci(definition));
}
// Remove the call tip from the screen.