Greg %!s(int64=7) %!d(string=hai) anos
pai
achega
ac4a8c9475

+ 3 - 0
gmsrc/doc/ChangeLog.txt

@@ -8,6 +8,9 @@ Note that very minor changes like a renamed variable or
 modified comment may not appear in this list.
 modified comment may not appear in this list.
 -----------------------------------------------------------
 -----------------------------------------------------------
 
 
+10 Oct 2018
+o Fix foreach, 64bit related. Thanks bavoha.
+
 22 Dec 2017
 22 Dec 2017
 o Fix some type casts. 
 o Fix some type casts. 
 o Integrate some changes from DrEvil's gmscripex.
 o Integrate some changes from DrEvil's gmscripex.

+ 1 - 1
gmsrc/src/gm/gmByteCode.cpp

@@ -55,7 +55,7 @@ void gmByteCodePrint(FILE * a_fp, const void * a_byteCode, int a_byteCodeLength)
       case BC_CALL : cp = "call"; opiptr = true; break;
       case BC_CALL : cp = "call"; opiptr = true; break;
       case BC_RET : cp = "ret"; break;
       case BC_RET : cp = "ret"; break;
       case BC_RETV : cp = "retv"; break;
       case BC_RETV : cp = "retv"; break;
-      case BC_FOREACH : cp = "foreach"; opiptr = true; break;
+      case BC_FOREACH : cp = "foreach"; opi32 = true; break;
       
       
       case BC_POP : cp = "pop"; break;
       case BC_POP : cp = "pop"; break;
       case BC_POP2 : cp = "pop2"; break;
       case BC_POP2 : cp = "pop2"; break;

+ 2 - 2
gmsrc/src/gm/gmFunctionObject.cpp

@@ -149,8 +149,8 @@ bool gmFunctionObject::Init(gmMachine * a_machine, bool a_debug, gmFunctionInfo
         case BC_SETGLOBAL :
         case BC_SETGLOBAL :
         case BC_GETTHIS :
         case BC_GETTHIS :
         case BC_SETTHIS : instruction += sizeof(gmptr); break;
         case BC_SETTHIS : instruction += sizeof(gmptr); break;
-        case BC_FOREACH :
-		case BC_PUSHINT : instruction += sizeof(gmint); break;
+        case BC_FOREACH : instruction += sizeof(gmuint32); break;
+        case BC_PUSHINT : instruction += sizeof(gmint); break;
         case BC_PUSHFP : instruction += sizeof(gmfloat); break;
         case BC_PUSHFP : instruction += sizeof(gmfloat); break;
       
       
         case BC_CALL :
         case BC_CALL :

+ 11 - 9
gmsrc/src/gm/gmIterator.h

@@ -26,7 +26,15 @@
 // bool IsValid() const
 // bool IsValid() const
 //
 //
 
 
-#define GM_INCLUDE_ITERATOR_KERNEL(T)                                \
+// NOTE: Rearranged macro due to VS2017: fatal error C1001: An internal error has occurred in the compiler.
+
+#define GM_INCLUDE_ITERATOR_KERNEL(T)\
+private:                                                             \
+inline operator unsigned int(void) { return 0xDEADBEEF; }            \
+inline operator int(void) { return 0xDEADBEEF; }                     \
+inline operator unsigned int(void) const { return 0xDEADBEEF; }      \
+inline operator int(void) const { return 0xDEADBEEF; }               \
+public:                                                              \
 inline void operator++() { Inc(); }                                  \
 inline void operator++() { Inc(); }                                  \
 inline void operator--() { Dec(); }                                  \
 inline void operator--() { Dec(); }                                  \
 inline void operator++(int) { Inc(); }                               \
 inline void operator++(int) { Inc(); }                               \
@@ -39,13 +47,7 @@ inline const T* operator->(void) const { return Resolve(); }         \
 inline operator bool(void) { return IsValid(); }                     \
 inline operator bool(void) { return IsValid(); }                     \
 inline operator bool(void) const { return IsValid(); }               \
 inline operator bool(void) const { return IsValid(); }               \
 inline bool operator !(void) { return !IsValid(); }                  \
 inline bool operator !(void) { return !IsValid(); }                  \
-inline bool operator !(void) const { return !IsValid(); }            \
-                                                                     \
-private:                                                             \
-inline operator unsigned int(void) { return 0xDEADBEEF; }            \
-inline operator int(void) { return 0xDEADBEEF; }                     \
-inline operator unsigned int(void) const { return 0xDEADBEEF; }      \
-inline operator int(void) const { return 0xDEADBEEF; }               \
-public:
+inline bool operator !(void) const { return !IsValid(); }
+
 
 
 #endif // _GMITERATOR_H_
 #endif // _GMITERATOR_H_

+ 1 - 1
gmsrc/src/gm/gmLibHooks.cpp

@@ -314,7 +314,7 @@ gmFunctionObject * gmLibHooks::BindLib(gmMachine &a_machine, gmStream &a_stream,
         case BC_BRNZ :
         case BC_BRNZ :
         case BC_BRZK :
         case BC_BRZK :
         case BC_BRNZK :
         case BC_BRNZK :
-        case BC_FOREACH : instruction += sizeof(gmptr); break;
+        case BC_FOREACH : instruction += sizeof(gmuint32); break;
         case BC_PUSHINT : instruction += sizeof(gmint); break;
         case BC_PUSHINT : instruction += sizeof(gmint); break;
         case BC_PUSHFP : instruction += sizeof(gmfloat); break;
         case BC_PUSHFP : instruction += sizeof(gmfloat); break;
 
 

+ 1 - 1
gmsrc/src/gml/main.cpp

@@ -94,7 +94,7 @@ static void PrintByteCode(FILE * a_fp, const void * a_byteCode, int a_byteCodeLe
       case BC_CALL : cp = "call"; opiptr = true; break;
       case BC_CALL : cp = "call"; opiptr = true; break;
       case BC_RET : cp = "ret"; break;
       case BC_RET : cp = "ret"; break;
       case BC_RETV : cp = "retv"; break;
       case BC_RETV : cp = "retv"; break;
-      case BC_FOREACH : cp = "foreach"; opiptr = true; break;
+      case BC_FOREACH : cp = "foreach"; opi32 = true; break;
       
       
       case BC_POP : cp = "pop"; break;
       case BC_POP : cp = "pop"; break;
       case BC_POP2 : cp = "pop2"; break;
       case BC_POP2 : cp = "pop2"; break;