fix size of PtrInt. enable tests for pas2c (all passing now)
authorsheepluva
Thu, 11 Dec 2014 17:50:05 +0100
changeset 10660 79fa79c77c38
parent 10659 79e466c393f7
child 10661 0da243c01bde
fix size of PtrInt. enable tests for pas2c (all passing now)
CMakeLists.txt
hedgewars/uScript.pas
project_files/hwc/rtl/pas2c.h
--- a/CMakeLists.txt	Thu Dec 11 15:20:23 2014 +0100
+++ b/CMakeLists.txt	Thu Dec 11 17:50:05 2014 +0100
@@ -230,9 +230,8 @@
 
 include(${CMAKE_MODULE_PATH}/cpackvars.cmake)
 
-if(NOT BUILD_ENGINE_C)
 enable_testing()
-endif(NOT BUILD_ENGINE_C)
+
 add_custom_target(test         COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random)
 add_custom_target(test_verbose COMMAND ${CMAKE_CTEST_COMMAND} -E '^todo/' --timeout 300 --schedule-random -V)
 
--- a/hedgewars/uScript.pas	Thu Dec 11 15:20:23 2014 +0100
+++ b/hedgewars/uScript.pas	Thu Dec 11 17:50:05 2014 +0100
@@ -2277,17 +2277,17 @@
 
 
 function lc_addPoint(L : Plua_State) : LongInt; Cdecl;
-var np, param: integer;
+var np, param: LongInt;
 begin
     if CheckAndFetchParamCountRange(L, 2, 4, 'AddPoint', 'x, y [, width [, erase] ]', np) then
         begin
         // x
-        param:= lua_tointeger(L,1);
-        PointsBuffer:= PointsBuffer + char((param and $FF00) shr 8);
+        param:= LongInt(lua_tointeger(L,1));
+        PointsBuffer:= PointsBuffer + char((param shr 8) and $FF);
         PointsBuffer:= PointsBuffer + char((param and $FF));
         // y
-        param:= lua_tointeger(L,2);
-        PointsBuffer:= PointsBuffer + char((param and $FF00) shr 8);
+        param:= LongInt(lua_tointeger(L,2));
+        PointsBuffer:= PointsBuffer + char((param shr 8) and $FF);
         PointsBuffer:= PointsBuffer + char((param and $FF));
         // width
         if np > 2 then
--- a/project_files/hwc/rtl/pas2c.h	Thu Dec 11 15:20:23 2014 +0100
+++ b/project_files/hwc/rtl/pas2c.h	Thu Dec 11 17:50:05 2014 +0100
@@ -61,7 +61,7 @@
 typedef LongInt * PLongInt;
 typedef LongWord * PLongWord;
 typedef Integer * PInteger;
-typedef int PtrInt;
+typedef ptrdiff_t PtrInt;
 typedef wchar_t widechar;
 typedef wchar_t* PWideChar;
 typedef char Char;