Browse Source

* synchronize with trunk

git-svn-id: branches/unicodekvm@41890 -
nickysn 6 years ago
parent
commit
cf200296a3

+ 2 - 0
.gitattributes

@@ -7321,6 +7321,8 @@ packages/ptc/src/win32/base/win32windowd.inc svneol=native#text/plain
 packages/ptc/src/win32/base/windows.ico -text
 packages/ptc/src/win32/base/windows.ico -text
 packages/ptc/src/win32/directx/p_ddraw.pp svneol=native#text/plain
 packages/ptc/src/win32/directx/p_ddraw.pp svneol=native#text/plain
 packages/ptc/src/win32/directx/p_dinput.pp svneol=native#text/plain
 packages/ptc/src/win32/directx/p_dinput.pp svneol=native#text/plain
+packages/ptc/src/win32/directx/t_ddraw.h2paschk svneol=native#text/plain
+packages/ptc/src/win32/directx/t_dinput.h2paschk svneol=native#text/plain
 packages/ptc/src/win32/directx/win32directxcheck.inc svneol=native#text/plain
 packages/ptc/src/win32/directx/win32directxcheck.inc svneol=native#text/plain
 packages/ptc/src/win32/directx/win32directxconsoled.inc svneol=native#text/plain
 packages/ptc/src/win32/directx/win32directxconsoled.inc svneol=native#text/plain
 packages/ptc/src/win32/directx/win32directxconsolei.inc svneol=native#text/plain
 packages/ptc/src/win32/directx/win32directxconsolei.inc svneol=native#text/plain

+ 7 - 1
compiler/arm/aoptcpu.pas

@@ -1968,6 +1968,7 @@ Implementation
                       strb reg1,[...]
                       strb reg1,[...]
                     }
                     }
                     if MatchInstruction(p, taicpu(p).opcode, [C_None], [PF_None]) and
                     if MatchInstruction(p, taicpu(p).opcode, [C_None], [PF_None]) and
+                      (taicpu(p).ops=2) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       MatchInstruction(hp1, A_STR, [C_None], [PF_B]) and
                       MatchInstruction(hp1, A_STR, [C_None], [PF_B]) and
                       assigned(FindRegDealloc(taicpu(p).oper[0]^.reg,tai(hp1.Next))) and
                       assigned(FindRegDealloc(taicpu(p).oper[0]^.reg,tai(hp1.Next))) and
@@ -1993,6 +1994,7 @@ Implementation
                       uxtb reg3,reg1
                       uxtb reg3,reg1
                     }
                     }
                     else if MatchInstruction(p, A_UXTB, [C_None], [PF_None]) and
                     else if MatchInstruction(p, A_UXTB, [C_None], [PF_None]) and
+                      (taicpu(p).ops=2) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       MatchInstruction(hp1, A_UXTH, [C_None], [PF_None]) and
                       MatchInstruction(hp1, A_UXTH, [C_None], [PF_None]) and
                       (taicpu(hp1).ops = 2) and
                       (taicpu(hp1).ops = 2) and
@@ -2016,6 +2018,7 @@ Implementation
                       uxtb reg3,reg1
                       uxtb reg3,reg1
                     }
                     }
                     else if MatchInstruction(p, A_UXTB, [C_None], [PF_None]) and
                     else if MatchInstruction(p, A_UXTB, [C_None], [PF_None]) and
+                      (taicpu(p).ops=2) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       MatchInstruction(hp1, A_UXTB, [C_None], [PF_None]) and
                       MatchInstruction(hp1, A_UXTB, [C_None], [PF_None]) and
                       (taicpu(hp1).ops = 2) and
                       (taicpu(hp1).ops = 2) and
@@ -2039,8 +2042,8 @@ Implementation
                       uxtb reg3,reg1
                       uxtb reg3,reg1
                     }
                     }
                     else if MatchInstruction(p, A_UXTB, [C_None], [PF_None]) and
                     else if MatchInstruction(p, A_UXTB, [C_None], [PF_None]) and
-                      GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       (taicpu(p).ops=2) and
                       (taicpu(p).ops=2) and
+                      GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       MatchInstruction(hp1, A_AND, [C_None], [PF_None]) and
                       MatchInstruction(hp1, A_AND, [C_None], [PF_None]) and
                       (taicpu(hp1).ops=3) and
                       (taicpu(hp1).ops=3) and
                       (taicpu(hp1).oper[2]^.typ=top_const) and
                       (taicpu(hp1).oper[2]^.typ=top_const) and
@@ -2075,6 +2078,7 @@ Implementation
                       strh reg1,[...]
                       strh reg1,[...]
                     }
                     }
                     if MatchInstruction(p, taicpu(p).opcode, [C_None], [PF_None]) and
                     if MatchInstruction(p, taicpu(p).opcode, [C_None], [PF_None]) and
+                      (taicpu(p).ops=2) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       MatchInstruction(hp1, A_STR, [C_None], [PF_H]) and
                       MatchInstruction(hp1, A_STR, [C_None], [PF_H]) and
                       RegEndofLife(taicpu(p).oper[0]^.reg,taicpu(hp1)) and
                       RegEndofLife(taicpu(p).oper[0]^.reg,taicpu(hp1)) and
@@ -2100,6 +2104,7 @@ Implementation
                       uxth reg3,reg1
                       uxth reg3,reg1
                     }
                     }
                     else if MatchInstruction(p, A_UXTH, [C_None], [PF_None]) and
                     else if MatchInstruction(p, A_UXTH, [C_None], [PF_None]) and
+                      (taicpu(p).ops=2) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       MatchInstruction(hp1, A_UXTH, [C_None], [PF_None]) and
                       MatchInstruction(hp1, A_UXTH, [C_None], [PF_None]) and
                       (taicpu(hp1).ops=2) and
                       (taicpu(hp1).ops=2) and
@@ -2126,6 +2131,7 @@ Implementation
                       uxth reg3,reg1
                       uxth reg3,reg1
                     }
                     }
                     else if MatchInstruction(p, A_UXTH, [C_None], [PF_None]) and
                     else if MatchInstruction(p, A_UXTH, [C_None], [PF_None]) and
+                      (taicpu(p).ops=2) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       GetNextInstructionUsingReg(p,hp1,taicpu(p).oper[0]^.reg) and
                       MatchInstruction(hp1, A_AND, [C_None], [PF_None]) and
                       MatchInstruction(hp1, A_AND, [C_None], [PF_None]) and
                       (taicpu(hp1).ops=3) and
                       (taicpu(hp1).ops=3) and

+ 10 - 15
compiler/hlcgobj.pas

@@ -4475,24 +4475,23 @@ implementation
 
 
   procedure thlcgobj.gen_proc_symbol(list: TAsmList);
   procedure thlcgobj.gen_proc_symbol(list: TAsmList);
     var
     var
-      item,
-      previtem : TCmdStrListItem;
+      firstitem,
+      item: TCmdStrListItem;
     begin
     begin
-      previtem:=nil;
-      item := TCmdStrListItem(current_procinfo.procdef.aliasnames.first);
+      item:=TCmdStrListItem(current_procinfo.procdef.aliasnames.first);
+      firstitem:=item;
       while assigned(item) do
       while assigned(item) do
         begin
         begin
 {$ifdef arm}
 {$ifdef arm}
           if GenerateThumbCode or GenerateThumb2Code then
           if GenerateThumbCode or GenerateThumb2Code then
             list.concat(tai_directive.create(asd_thumb_func,''));
             list.concat(tai_directive.create(asd_thumb_func,''));
 {$endif arm}
 {$endif arm}
-          { "double link" all procedure entry symbols via .reference }
-          { directives on darwin, because otherwise the linker       }
-          { sometimes strips the procedure if only on of the symbols }
-          { is referenced                                            }
-          if assigned(previtem) and
+          { alias procedure entry symbols via ".set" on Darwin, otherwise
+            they can be interpreted as all different starting symbols of
+            subsections and be reordered }
+          if (item<>firstitem) and
              (target_info.system in systems_darwin) then
              (target_info.system in systems_darwin) then
-            list.concat(tai_directive.create(asd_reference,item.str));
+            list.concat(tai_symbolpair.create(spk_set,item.str,firstitem.str));
           if (cs_profile in current_settings.moduleswitches) or
           if (cs_profile in current_settings.moduleswitches) or
              { smart linking using a library requires to promote
              { smart linking using a library requires to promote
                all non-nested procedures to AB_GLOBAL
                all non-nested procedures to AB_GLOBAL
@@ -4503,13 +4502,9 @@ implementation
             list.concat(Tai_symbol.createname_global(item.str,AT_FUNCTION,0,current_procinfo.procdef))
             list.concat(Tai_symbol.createname_global(item.str,AT_FUNCTION,0,current_procinfo.procdef))
           else
           else
             list.concat(Tai_symbol.createname(item.str,AT_FUNCTION,0,current_procinfo.procdef));
             list.concat(Tai_symbol.createname(item.str,AT_FUNCTION,0,current_procinfo.procdef));
-          if assigned(previtem) and
-             (target_info.system in systems_darwin) then
-            list.concat(tai_directive.create(asd_reference,previtem.str));
           if not(af_stabs_use_function_absolute_addresses in target_asm.flags) then
           if not(af_stabs_use_function_absolute_addresses in target_asm.flags) then
             list.concat(Tai_function_name.create(item.str));
             list.concat(Tai_function_name.create(item.str));
-          previtem:=item;
-          item := TCmdStrListItem(item.next);
+          item:=TCmdStrListItem(item.next);
         end;
         end;
       current_procinfo.procdef.procstarttai:=tai(list.last);
       current_procinfo.procdef.procstarttai:=tai(list.last);
     end;
     end;

+ 0 - 2
compiler/jvm/pjvm.pas

@@ -322,7 +322,6 @@ implementation
         vmtbuilder:=TVMTBuilder.Create(enumclass);
         vmtbuilder:=TVMTBuilder.Create(enumclass);
         vmtbuilder.generate_vmt;
         vmtbuilder.generate_vmt;
         vmtbuilder.free;
         vmtbuilder.free;
-        insert_struct_hidden_paras(enumclass);
 
 
         restore_after_new_class(sstate,islocal,oldsymtablestack);
         restore_after_new_class(sstate,islocal,oldsymtablestack);
         current_structdef:=old_current_structdef;
         current_structdef:=old_current_structdef;
@@ -433,7 +432,6 @@ implementation
         vmtbuilder:=TVMTBuilder.Create(pvclass);
         vmtbuilder:=TVMTBuilder.Create(pvclass);
         vmtbuilder.generate_vmt;
         vmtbuilder.generate_vmt;
         vmtbuilder.free;
         vmtbuilder.free;
-        insert_struct_hidden_paras(pvclass);
 
 
         restore_after_new_class(sstate,islocal,oldsymtablestack);
         restore_after_new_class(sstate,islocal,oldsymtablestack);
       end;
       end;

+ 3 - 1
compiler/nobj.pas

@@ -60,7 +60,8 @@ implementation
        globals,verbose,systems,
        globals,verbose,systems,
        node,
        node,
        symbase,symtable,symconst,symtype,symcpu,
        symbase,symtable,symconst,symtype,symcpu,
-       defcmp;
+       defcmp,
+       pparautl;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -922,6 +923,7 @@ implementation
                   add_new_vmt_entry(tprocdef(def),overridesclasshelper);
                   add_new_vmt_entry(tprocdef(def),overridesclasshelper);
               end;
               end;
           end;
           end;
+        insert_struct_hidden_paras(_class);
         build_interface_mappings;
         build_interface_mappings;
         if assigned(_class.ImplementedInterfaces) and
         if assigned(_class.ImplementedInterfaces) and
            not(is_objc_class_or_protocol(_class)) and
            not(is_objc_class_or_protocol(_class)) and

+ 0 - 1
compiler/pdecl.pas

@@ -888,7 +888,6 @@ implementation
                         vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef));
                         vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef));
                         vmtbuilder.generate_vmt;
                         vmtbuilder.generate_vmt;
                         vmtbuilder.free;
                         vmtbuilder.free;
-                        insert_struct_hidden_paras(tobjectdef(hdef));
                       end;
                       end;
 
 
                     { In case of an objcclass, verify that all methods have a message
                     { In case of an objcclass, verify that all methods have a message

+ 0 - 1
compiler/pgenutil.pas

@@ -1059,7 +1059,6 @@ uses
                       vmtbuilder:=TVMTBuilder.Create(tobjectdef(result));
                       vmtbuilder:=TVMTBuilder.Create(tobjectdef(result));
                       vmtbuilder.generate_vmt;
                       vmtbuilder.generate_vmt;
                       vmtbuilder.free;
                       vmtbuilder.free;
-                      insert_struct_hidden_paras(tobjectdef(result));
                     end;
                     end;
                   { handle params, calling convention, etc }
                   { handle params, calling convention, etc }
                   procvardef:
                   procvardef:

+ 497 - 0
packages/ptc/src/win32/directx/t_ddraw.h2paschk

@@ -0,0 +1,497 @@
+@Pascal uses p_ddraw;
+@Pascal begin
+
+@C #include <ddraw.h>
+@C #include <stdio.h>
+@C #include <stddef.h>
+@C #include <tchar.h>
+@C int _tmain(int argc, _TCHAR* argv[])
+@C {
+
+@record TDDARGB,DDARGB
+.blue
+.green
+.red
+.alpha
+
+@record TDDRGBA,DDRGBA
+.red
+.green
+.blue
+.alpha
+
+@record TDDCOLORKEY,DDCOLORKEY
+.dwColorSpaceLowValue
+.dwColorSpaceHighValue
+
+@record TDDBLTFX,DDBLTFX
+.dwSize
+.dwDDFX
+.dwROP
+.dwDDROP
+.dwRotationAngle
+.dwZBufferOpCode
+.dwZBufferLow
+.dwZBufferHigh
+.dwZBufferBaseDest
+.dwZDestConstBitDepth
+.dwZDestConst
+.lpDDSZBufferDest
+.dwZSrcConstBitDepth
+.dwZSrcConst
+.lpDDSZBufferSrc
+.dwAlphaEdgeBlendBitDepth
+.dwAlphaEdgeBlend
+.dwReserved
+.dwAlphaDestConstBitDepth
+.dwAlphaDestConst
+.lpDDSAlphaDest
+.dwAlphaSrcConstBitDepth
+.dwAlphaSrcConst
+.lpDDSAlphaSrc
+.dwFillColor
+.dwFillDepth
+.dwFillPixel
+.lpDDSPattern
+.ddckDestColorkey
+.ddckSrcColorkey
+
+@record TDDSCAPS,DDSCAPS
+.dwCaps
+
+@record TDDOSCAPS,DDOSCAPS
+.dwCaps
+
+@record TDDSCAPSEX,DDSCAPSEX
+.dwCaps2
+.dwCaps3
+.dwCaps4
+.dwVolumeDepth
+
+@record TDDSCAPS2,DDSCAPS2
+.dwCaps
+.dwCaps2
+.dwCaps3
+.dwCaps4
+.dwVolumeDepth
+
+@record TDDCAPS_DX1,DDCAPS_DX1
+.dwSize
+.dwCaps
+.dwCaps2
+.dwCKeyCaps
+.dwFXCaps
+.dwFXAlphaCaps
+.dwPalCaps
+.dwSVCaps
+.dwAlphaBltConstBitDepths
+.dwAlphaBltPixelBitDepths
+.dwAlphaBltSurfaceBitDepths
+.dwAlphaOverlayConstBitDepths
+.dwAlphaOverlayPixelBitDepths
+.dwAlphaOverlaySurfaceBitDepths
+.dwZBufferBitDepths
+.dwVidMemTotal
+.dwVidMemFree
+.dwMaxVisibleOverlays
+.dwCurrVisibleOverlays
+.dwNumFourCCCodes
+.dwAlignBoundarySrc
+.dwAlignSizeSrc
+.dwAlignBoundaryDest
+.dwAlignSizeDest
+.dwAlignStrideAlign
+.dwRops
+.ddsCaps
+.dwMinOverlayStretch
+.dwMaxOverlayStretch
+.dwMinLiveVideoStretch
+.dwMaxLiveVideoStretch
+.dwMinHwCodecStretch
+.dwMaxHwCodecStretch
+.dwReserved1
+.dwReserved2
+.dwReserved3
+
+@record TDDCAPS_DX3,DDCAPS_DX3
+.dwSize
+.dwCaps
+.dwCaps2
+.dwCKeyCaps
+.dwFXCaps
+.dwFXAlphaCaps
+.dwPalCaps
+.dwSVCaps
+.dwAlphaBltConstBitDepths
+.dwAlphaBltPixelBitDepths
+.dwAlphaBltSurfaceBitDepths
+.dwAlphaOverlayConstBitDepths
+.dwAlphaOverlayPixelBitDepths
+.dwAlphaOverlaySurfaceBitDepths
+.dwZBufferBitDepths
+.dwVidMemTotal
+.dwVidMemFree
+.dwMaxVisibleOverlays
+.dwCurrVisibleOverlays
+.dwNumFourCCCodes
+.dwAlignBoundarySrc
+.dwAlignSizeSrc
+.dwAlignBoundaryDest
+.dwAlignSizeDest
+.dwAlignStrideAlign
+.dwRops
+.ddsCaps
+.dwMinOverlayStretch
+.dwMaxOverlayStretch
+.dwMinLiveVideoStretch
+.dwMaxLiveVideoStretch
+.dwMinHwCodecStretch
+.dwMaxHwCodecStretch
+.dwReserved1
+.dwReserved2
+.dwReserved3
+.dwSVBCaps
+.dwSVBCKeyCaps
+.dwSVBFXCaps
+.dwSVBRops
+.dwVSBCaps
+.dwVSBCKeyCaps
+.dwVSBFXCaps
+.dwVSBRops
+.dwSSBCaps
+.dwSSBCKeyCaps
+.dwSSBFXCaps
+.dwSSBRops
+.dwReserved4
+.dwReserved5
+.dwReserved6
+
+@record TDDCAPS_DX5,DDCAPS_DX5
+.dwSize
+.dwCaps
+.dwCaps2
+.dwCKeyCaps
+.dwFXCaps
+.dwFXAlphaCaps
+.dwPalCaps
+.dwSVCaps
+.dwAlphaBltConstBitDepths
+.dwAlphaBltPixelBitDepths
+.dwAlphaBltSurfaceBitDepths
+.dwAlphaOverlayConstBitDepths
+.dwAlphaOverlayPixelBitDepths
+.dwAlphaOverlaySurfaceBitDepths
+.dwZBufferBitDepths
+.dwVidMemTotal
+.dwVidMemFree
+.dwMaxVisibleOverlays
+.dwCurrVisibleOverlays
+.dwNumFourCCCodes
+.dwAlignBoundarySrc
+.dwAlignSizeSrc
+.dwAlignBoundaryDest
+.dwAlignSizeDest
+.dwAlignStrideAlign
+.dwRops
+.ddsCaps
+.dwMinOverlayStretch
+.dwMaxOverlayStretch
+.dwMinLiveVideoStretch
+.dwMaxLiveVideoStretch
+.dwMinHwCodecStretch
+.dwMaxHwCodecStretch
+.dwReserved1
+.dwReserved2
+.dwReserved3
+.dwSVBCaps
+.dwSVBCKeyCaps
+.dwSVBFXCaps
+.dwSVBRops
+.dwVSBCaps
+.dwVSBCKeyCaps
+.dwVSBFXCaps
+.dwVSBRops
+.dwSSBCaps
+.dwSSBCKeyCaps
+.dwSSBFXCaps
+.dwSSBRops
+.dwMaxVideoPorts
+.dwCurrVideoPorts
+.dwSVBCaps2
+.dwNLVBCaps
+.dwNLVBCaps2
+.dwNLVBCKeyCaps
+.dwNLVBFXCaps
+.dwNLVBRops
+
+@record TDDCAPS_DX6,DDCAPS_DX6
+.dwSize
+.dwCaps
+.dwCaps2
+.dwCKeyCaps
+.dwFXCaps
+.dwFXAlphaCaps
+.dwPalCaps
+.dwSVCaps
+.dwAlphaBltConstBitDepths
+.dwAlphaBltPixelBitDepths
+.dwAlphaBltSurfaceBitDepths
+.dwAlphaOverlayConstBitDepths
+.dwAlphaOverlayPixelBitDepths
+.dwAlphaOverlaySurfaceBitDepths
+.dwZBufferBitDepths
+.dwVidMemTotal
+.dwVidMemFree
+.dwMaxVisibleOverlays
+.dwCurrVisibleOverlays
+.dwNumFourCCCodes
+.dwAlignBoundarySrc
+.dwAlignSizeSrc
+.dwAlignBoundaryDest
+.dwAlignSizeDest
+.dwAlignStrideAlign
+.dwRops
+.ddsOldCaps
+.dwMinOverlayStretch
+.dwMaxOverlayStretch
+.dwMinLiveVideoStretch
+.dwMaxLiveVideoStretch
+.dwMinHwCodecStretch
+.dwMaxHwCodecStretch
+.dwReserved1
+.dwReserved2
+.dwReserved3
+.dwSVBCaps
+.dwSVBCKeyCaps
+.dwSVBFXCaps
+.dwSVBRops
+.dwVSBCaps
+.dwVSBCKeyCaps
+.dwVSBFXCaps
+.dwVSBRops
+.dwSSBCaps
+.dwSSBCKeyCaps
+.dwSSBFXCaps
+.dwSSBRops
+.dwMaxVideoPorts
+.dwCurrVideoPorts
+.dwSVBCaps2
+.dwNLVBCaps
+.dwNLVBCaps2
+.dwNLVBCKeyCaps
+.dwNLVBFXCaps
+.dwNLVBRops
+.ddsCaps
+
+@record TDDCAPS_DX7,DDCAPS_DX7
+.dwSize
+.dwCaps
+.dwCaps2
+.dwCKeyCaps
+.dwFXCaps
+.dwFXAlphaCaps
+.dwPalCaps
+.dwSVCaps
+.dwAlphaBltConstBitDepths
+.dwAlphaBltPixelBitDepths
+.dwAlphaBltSurfaceBitDepths
+.dwAlphaOverlayConstBitDepths
+.dwAlphaOverlayPixelBitDepths
+.dwAlphaOverlaySurfaceBitDepths
+.dwZBufferBitDepths
+.dwVidMemTotal
+.dwVidMemFree
+.dwMaxVisibleOverlays
+.dwCurrVisibleOverlays
+.dwNumFourCCCodes
+.dwAlignBoundarySrc
+.dwAlignSizeSrc
+.dwAlignBoundaryDest
+.dwAlignSizeDest
+.dwAlignStrideAlign
+.dwRops
+.ddsOldCaps
+.dwMinOverlayStretch
+.dwMaxOverlayStretch
+.dwMinLiveVideoStretch
+.dwMaxLiveVideoStretch
+.dwMinHwCodecStretch
+.dwMaxHwCodecStretch
+.dwReserved1
+.dwReserved2
+.dwReserved3
+.dwSVBCaps
+.dwSVBCKeyCaps
+.dwSVBFXCaps
+.dwSVBRops
+.dwVSBCaps
+.dwVSBCKeyCaps
+.dwVSBFXCaps
+.dwVSBRops
+.dwSSBCaps
+.dwSSBCKeyCaps
+.dwSSBFXCaps
+.dwSSBRops
+.dwMaxVideoPorts
+.dwCurrVideoPorts
+.dwSVBCaps2
+.dwNLVBCaps
+.dwNLVBCaps2
+.dwNLVBCKeyCaps
+.dwNLVBFXCaps
+.dwNLVBRops
+.ddsCaps
+
+@record TDDPIXELFORMAT,DDPIXELFORMAT
+.dwSize
+.dwFlags
+.dwFourCC
+.dwRGBBitCount
+.dwYUVBitCount
+.dwZBufferBitDepth
+.dwAlphaBitDepth
+.dwLuminanceBitCount
+.dwBumpBitCount
+.dwPrivateFormatBitCount
+.dwRBitMask
+.dwYBitMask
+.dwStencilBitDepth
+.dwLuminanceBitMask
+.dwBumpDuBitMask
+.dwOperations
+.dwGBitMask
+.dwUBitMask
+.dwZBitMask
+.dwBumpDvBitMask
+.MultiSampleCaps
+.MultiSampleCaps.wFlipMSTypes
+.MultiSampleCaps.wBltMSTypes
+.dwBBitMask
+.dwVBitMask
+.dwStencilBitMask
+.dwBumpLuminanceBitMask
+.dwRGBAlphaBitMask
+.dwYUVAlphaBitMask
+.dwLuminanceAlphaBitMask
+.dwRGBZBitMask
+.dwYUVZBitMask
+
+@record TDDOVERLAYFX,DDOVERLAYFX
+.dwSize
+.dwAlphaEdgeBlendBitDepth
+.dwAlphaEdgeBlend
+.dwReserved
+.dwAlphaDestConstBitDepth
+.dwAlphaDestConst
+.lpDDSAlphaDest
+.dwAlphaSrcConstBitDepth
+.dwAlphaSrcConst
+.lpDDSAlphaSrc
+.dckDestColorkey
+.dckSrcColorkey
+.dwDDFX
+.dwFlags
+
+@record TDDBLTBATCH,DDBLTBATCH
+.lprDest
+.lpDDSSrc
+.lprSrc
+.dwFlags
+.lpDDBltFx
+
+@record TDDGAMMARAMP,DDGAMMARAMP
+.red
+.green
+.blue
+
+@record TDDDEVICEIDENTIFIER,DDDEVICEIDENTIFIER
+.szDriver
+.szDescription
+.liDriverVersion
+.dwVendorId
+.dwDeviceId
+.dwSubSysId
+.dwRevision
+.guidDeviceIdentifier
+
+@record TDDDEVICEIDENTIFIER2,DDDEVICEIDENTIFIER2
+.szDriver
+.szDescription
+.liDriverVersion
+.dwVendorId
+.dwDeviceId
+.dwSubSysId
+.dwRevision
+.guidDeviceIdentifier
+.dwWHQLLevel
+
+@record TDDSURFACEDESC,DDSURFACEDESC
+.dwSize
+.dwFlags
+.dwHeight
+.dwWidth
+.lPitch
+.dwLinearSize
+.dwBackBufferCount
+.dwMipMapCount
+.dwZBufferBitDepth
+.dwRefreshRate
+.dwAlphaBitDepth
+.dwReserved
+.lpSurface
+.ddckCKDestOverlay
+.ddckCKDestBlt
+.ddckCKSrcOverlay
+.ddckCKSrcBlt
+.ddpfPixelFormat
+.ddsCaps
+
+@record TDDSURFACEDESC2,DDSURFACEDESC2
+.dwSize
+.dwFlags
+.dwHeight
+.dwWidth
+.lPitch
+.dwLinearSize
+.dwBackBufferCount
+.dwDepth
+.dwMipMapCount
+.dwRefreshRate
+.dwSrcVBHandle
+.dwAlphaBitDepth
+.dwReserved
+.lpSurface
+.dwEmptyFaceColor
+.ddckCKDestOverlay
+.ddckCKDestBlt
+.ddckCKSrcOverlay
+.ddckCKSrcBlt
+.dwFVF
+.ddpfPixelFormat
+.ddsCaps
+.dwTextureStage
+
+@record TDDOPTSURFACEDESC,DDOPTSURFACEDESC
+.dwSize
+.dwFlags
+.ddSCaps
+.ddOSCaps
+.guid
+.dwCompressionRatio
+
+@record TDDCOLORCONTROL,DDCOLORCONTROL
+.dwSize
+.dwFlags
+.lBrightness
+.lContrast
+.lHue
+.lSaturation
+.lSharpness
+.lGamma
+.lColorEnable
+.dwReserved1
+
+@C   return 0;
+@C }
+
+@Pascal end.

+ 475 - 0
packages/ptc/src/win32/directx/t_dinput.h2paschk

@@ -0,0 +1,475 @@
+@Pascal uses p_dinput;
+@Pascal begin
+
+@C #include <dinput.h>
+@C #include <stdio.h>
+@C #include <stddef.h>
+@C #include <tchar.h>
+@C int _tmain(int argc, _TCHAR* argv[])
+@C {
+
+@record TDICONSTANTFORCE,DICONSTANTFORCE
+.lMagnitude
+
+@record TDIRAMPFORCE,DIRAMPFORCE
+.lStart
+.lEnd
+
+@record TDIPERIODIC,DIPERIODIC
+.dwMagnitude
+.lOffset
+.dwPhase
+.dwPeriod
+
+@record TDICONDITION,DICONDITION
+.lOffset
+.lPositiveCoefficient
+.lNegativeCoefficient
+.dwPositiveSaturation
+.dwNegativeSaturation
+.lDeadBand
+
+@record TDICUSTOMFORCE,DICUSTOMFORCE
+.cChannels
+.dwSamplePeriod
+.cSamples
+.rglForceData
+
+@record TDIENVELOPE,DIENVELOPE
+.dwSize
+.dwAttackLevel
+.dwAttackTime
+.dwFadeLevel
+.dwFadeTime
+
+@record TDIEFFECT_DX5,DIEFFECT_DX5
+.dwSize
+.dwFlags
+.dwDuration
+.dwSamplePeriod
+.dwGain
+.dwTriggerButton
+.dwTriggerRepeatInterval
+.cAxes
+.rgdwAxes
+.rglDirection
+.lpEnvelope
+.cbTypeSpecificParams
+.lpvTypeSpecificParams
+
+@record TDIEFFECT,DIEFFECT
+.dwSize
+.dwFlags
+.dwDuration
+.dwSamplePeriod
+.dwGain
+.dwTriggerButton
+.dwTriggerRepeatInterval
+.cAxes
+.rgdwAxes
+.rglDirection
+.lpEnvelope
+.cbTypeSpecificParams
+.lpvTypeSpecificParams
+.dwStartDelay
+
+@record TDIFILEEFFECT,DIFILEEFFECT
+.dwSize
+.GuidEffect
+.lpDiEffect
+.szFriendlyName
+
+@record TDIEFFESCAPE,DIEFFESCAPE
+.dwSize
+.dwCommand
+.lpvInBuffer
+.cbInBuffer
+.lpvOutBuffer
+.cbOutBuffer
+
+@record TDIDEVCAPS_DX3,DIDEVCAPS_DX3
+.dwSize
+.dwFlags
+.dwDevType
+.dwAxes
+.dwButtons
+.dwPOVs
+
+@record TDIDEVCAPS,DIDEVCAPS
+.dwSize
+.dwFlags
+.dwDevType
+.dwAxes
+.dwButtons
+.dwPOVs
+.dwFFSamplePeriod
+.dwFFMinTimeResolution
+.dwFirmwareRevision
+.dwHardwareRevision
+.dwFFDriverVersion
+
+@record TDIOBJECTDATAFORMAT,DIOBJECTDATAFORMAT
+.pguid
+.dwOfs
+.dwType
+.dwFlags
+
+@record TDIDATAFORMAT,DIDATAFORMAT
+.dwSize
+.dwObjSize
+.dwFlags
+.dwDataSize
+.dwNumObjs
+.rgodf
+
+@record TDIACTIONA,DIACTIONA
+.uAppData
+.dwSemantic
+.dwFlags
+.lptszActionName
+.guidInstance
+.dwObjID
+.dwHow
+.uResIdString
+
+@record TDIACTIONW,DIACTIONW
+.uAppData
+.dwSemantic
+.dwFlags
+.lptszActionName
+.guidInstance
+.dwObjID
+.dwHow
+.uResIdString
+
+@record TDIACTIONFORMATA,DIACTIONFORMATA
+.dwSize
+.dwActionSize
+.dwDataSize
+.dwNumActions
+.rgoAction
+.guidActionMap
+.dwGenre
+.dwBufferSize
+.lAxisMin
+.lAxisMax
+.hInstString
+.ftTimeStamp
+.dwCRC
+.tszActionMap
+
+@record TDIACTIONFORMATW,DIACTIONFORMATW
+.dwSize
+.dwActionSize
+.dwDataSize
+.dwNumActions
+.rgoAction
+.guidActionMap
+.dwGenre
+.dwBufferSize
+.lAxisMin
+.lAxisMax
+.hInstString
+.ftTimeStamp
+.dwCRC
+.tszActionMap
+
+@record TDICOLORSET,DICOLORSET
+.dwSize
+.cTextFore
+.cTextHighlight
+.cCalloutLine
+.cCalloutHighlight
+.cBorder
+.cControlFill
+.cHighlightFill
+.cAreaFill
+
+@record TDICONFIGUREDEVICESPARAMSA,DICONFIGUREDEVICESPARAMSA
+.dwSize
+.dwcUsers
+.lptszUserNames
+.dwcFormats
+.lprgFormats
+.hwnd
+.dics
+.lpUnkDDSTarget
+
+@record TDICONFIGUREDEVICESPARAMSW,DICONFIGUREDEVICESPARAMSW
+.dwSize
+.dwcUsers
+.lptszUserNames
+.dwcFormats
+.lprgFormats
+.hwnd
+.dics
+.lpUnkDDSTarget
+
+@record TDIDEVICEIMAGEINFOA,DIDEVICEIMAGEINFOA
+.tszImagePath
+.dwFlags
+.dwViewID
+.rcOverlay
+.dwObjID
+.dwcValidPts
+.rgptCalloutLine
+.rcCalloutRect
+.dwTextAlign
+
+@record TDIDEVICEIMAGEINFOW,DIDEVICEIMAGEINFOW
+.tszImagePath
+.dwFlags
+.dwViewID
+.rcOverlay
+.dwObjID
+.dwcValidPts
+.rgptCalloutLine
+.rcCalloutRect
+.dwTextAlign
+
+@record TDIDEVICEIMAGEINFOHEADERA,DIDEVICEIMAGEINFOHEADERA
+.dwSize
+.dwSizeImageInfo
+.dwcViews
+.dwcButtons
+.dwcAxes
+.dwcPOVs
+.dwBufferSize
+.dwBufferUsed
+.lprgImageInfoArray
+
+@record TDIDEVICEIMAGEINFOHEADERW,DIDEVICEIMAGEINFOHEADERW
+.dwSize
+.dwSizeImageInfo
+.dwcViews
+.dwcButtons
+.dwcAxes
+.dwcPOVs
+.dwBufferSize
+.dwBufferUsed
+.lprgImageInfoArray
+
+@record TDIDEVICEOBJECTINSTANCE_DX3A,DIDEVICEOBJECTINSTANCE_DX3A
+.dwSize
+.guidType
+.dwOfs
+.dwType
+.dwFlags
+.tszName
+
+@record TDIDEVICEOBJECTINSTANCE_DX3W,DIDEVICEOBJECTINSTANCE_DX3W
+.dwSize
+.guidType
+.dwOfs
+.dwType
+.dwFlags
+.tszName
+
+@record TDIDEVICEOBJECTINSTANCEA,DIDEVICEOBJECTINSTANCEA
+.dwSize
+.guidType
+.dwOfs
+.dwType
+.dwFlags
+.tszName
+.dwFFMaxForce
+.dwFFForceResolution
+.wCollectionNumber
+.wDesignatorIndex
+.wUsagePage
+.wUsage
+.dwDimension
+.wExponent
+.wReportId
+
+@record TDIDEVICEOBJECTINSTANCEW,DIDEVICEOBJECTINSTANCEW
+.dwSize
+.guidType
+.dwOfs
+.dwType
+.dwFlags
+.tszName
+.dwFFMaxForce
+.dwFFForceResolution
+.wCollectionNumber
+.wDesignatorIndex
+.wUsagePage
+.wUsage
+.dwDimension
+.wExponent
+.wReportId
+
+@record TDIPROPHEADER,DIPROPHEADER
+.dwSize
+.dwHeaderSize
+.dwObj
+.dwHow
+
+@record TDIPROPDWORD,DIPROPDWORD
+.diph
+.dwData
+
+@record TDIPROPPOINTER,DIPROPPOINTER
+.diph
+.uData
+
+@record TDIPROPRANGE,DIPROPRANGE
+.diph
+.lMin
+.lMax
+
+@record TDIPROPCAL,DIPROPCAL
+.diph
+.lMin
+.lCenter
+.lMax
+
+@record TDIPROPCALPOV,DIPROPCALPOV
+.diph
+.lMin
+.lMax
+
+@record TDIPROPGUIDANDPATH,DIPROPGUIDANDPATH
+.diph
+.guidClass
+.wszPath
+
+@record TDIPROPSTRING,DIPROPSTRING
+.diph
+.wsz
+
+@record TCPOINT,CPOINT
+.lP
+.dwLog
+
+@record TDIPROPCPOINTS,DIPROPCPOINTS
+.diph
+.dwCPointsNum
+.cp
+
+@record TDIDEVICEOBJECTDATA_DX3,DIDEVICEOBJECTDATA_DX3
+.dwOfs
+.dwData
+.dwTimeStamp
+.dwSequence
+
+@record TDIDEVICEOBJECTDATA,DIDEVICEOBJECTDATA
+.dwOfs
+.dwData
+.dwTimeStamp
+.dwSequence
+.uAppData
+
+@record TDIDEVICEINSTANCE_DX3A,DIDEVICEINSTANCE_DX3A
+.dwSize
+.guidInstance
+.guidProduct
+.dwDevType
+.tszInstanceName
+.tszProductName
+
+@record TDIDEVICEINSTANCE_DX3W,DIDEVICEINSTANCE_DX3W
+.dwSize
+.guidInstance
+.guidProduct
+.dwDevType
+.tszInstanceName
+.tszProductName
+
+@record TDIDEVICEINSTANCEA,DIDEVICEINSTANCEA
+.dwSize
+.guidInstance
+.guidProduct
+.dwDevType
+.tszInstanceName
+.tszProductName
+.guidFFDriver
+.wUsagePage
+.wUsage
+
+@record TDIDEVICEINSTANCEW,DIDEVICEINSTANCEW
+.dwSize
+.guidInstance
+.guidProduct
+.dwDevType
+.tszInstanceName
+.tszProductName
+.guidFFDriver
+.wUsagePage
+.wUsage
+
+@record TDIEFFECTINFOA,DIEFFECTINFOA
+.dwSize
+.guid
+.dwEffType
+.dwStaticParams
+.dwDynamicParams
+.tszName
+
+@record TDIEFFECTINFOW,DIEFFECTINFOW
+.dwSize
+.guid
+.dwEffType
+.dwStaticParams
+.dwDynamicParams
+.tszName
+
+@record TDIMOUSESTATE,DIMOUSESTATE
+.lX
+.lY
+.lZ
+.rgbButtons
+
+@record TDIMOUSESTATE2,DIMOUSESTATE2
+.lX
+.lY
+.lZ
+.rgbButtons
+
+@record TDIJOYSTATE,DIJOYSTATE
+.lX
+.lY
+.lZ
+.lRx
+.lRy
+.lRz
+.rglSlider
+.rgdwPOV
+.rgbButtons
+
+@record TDIJOYSTATE2,DIJOYSTATE2
+.lX
+.lY
+.lZ
+.lRx
+.lRy
+.lRz
+.rglSlider
+.rgdwPOV
+.rgbButtons
+.lVX
+.lVY
+.lVZ
+.lVRx
+.lVRy
+.lVRz
+.rglVSlider
+.lAX
+.lAY
+.lAZ
+.lARx
+.lARy
+.lARz
+.rglASlider
+.lFX
+.lFY
+.lFZ
+.lFRx
+.lFRy
+.lFRz
+.rglFSlider
+
+@C   return 0;
+@C }
+
+@Pascal end.

+ 4 - 2
rtl/inc/heaptrc.pp

@@ -509,8 +509,6 @@ var
 begin
 begin
   loc_info := @heap_info;
   loc_info := @heap_info;
   try_finish_heap_free_todo_list(loc_info);
   try_finish_heap_free_todo_list(loc_info);
-  inc(loc_info^.getmem_size,size);
-  inc(loc_info^.getmem8_size,(size+7) and not 7);
 { Do the real GetMem, but alloc also for the info block }
 { Do the real GetMem, but alloc also for the info block }
 {$ifdef cpuarm}
 {$ifdef cpuarm}
   allocsize:=(size + 3) and not 3+sizeof(theap_mem_info)+extra_info_size;
   allocsize:=(size + 3) and not 3+sizeof(theap_mem_info)+extra_info_size;
@@ -529,6 +527,10 @@ begin
     end;
     end;
   pp:=pheap_mem_info(p);
   pp:=pheap_mem_info(p);
   inc(p,sizeof(theap_mem_info));
   inc(p,sizeof(theap_mem_info));
+  { Update getmem_size and getmem8_size only after successful call 
+    to SysGetMem }
+  inc(loc_info^.getmem_size,size);
+  inc(loc_info^.getmem8_size,(size+7) and not 7);
 { Create the info block }
 { Create the info block }
   pp^.sig:=longword(AllocateSig);
   pp^.sig:=longword(AllocateSig);
   pp^.todolist:=@loc_info^.heap_free_todo;
   pp^.todolist:=@loc_info^.heap_free_todo;

+ 1 - 1
rtl/objpas/sysutils/syshelph.inc

@@ -523,7 +523,7 @@ Type
   public
   public
     const
     const
       MaxValue = High(NativeInt);
       MaxValue = High(NativeInt);
-      MinValue = Low(NativeUInt);
+      MinValue = Low(NativeInt);
   Public
   Public
     Class Function Parse(const AString: string): NativeInt; inline; static;
     Class Function Parse(const AString: string): NativeInt; inline; static;
     Class Function Size: Integer; inline; static;
     Class Function Size: Integer; inline; static;

+ 7 - 1
tests/webtbs/tw17430.pp

@@ -6,7 +6,13 @@ var
   p:pointer;
   p:pointer;
 begin
 begin
   returnnilifgrowheapfails:=true;
   returnnilifgrowheapfails:=true;
-  GetMem(p,ptruint(-128));
+  { Use a bigger absoulte value to avoid
+    getting a overflow inside heaptrc
+    if compiled with -gh option:
+    -128 changed to -1024,
+    which should be larger than typical
+    size of extra memory used by heaptrc }
+  GetMem(p,ptruint(-1024));
   if assigned(p) then
   if assigned(p) then
     halt(1);
     halt(1);
 end.
 end.

+ 3 - 3
utils/h2pas/h2paschk.pas

@@ -131,15 +131,15 @@ procedure TH2PasCheckerCodeGen.StartRecord(RecordID: TIdentifier);
 begin
 begin
   FCurrentRecord := RecordID;
   FCurrentRecord := RecordID;
   Writeln(FLangOutput[lPascal], '  Writeln(''SizeOf(', RecordID[CommLangID], ')='',SizeOf(', RecordID[lPascal], '));');
   Writeln(FLangOutput[lPascal], '  Writeln(''SizeOf(', RecordID[CommLangID], ')='',SizeOf(', RecordID[lPascal], '));');
-  Writeln(FLangOutput[lC], '  printf("SizeOf(', RecordID[CommLangID], ')=%u\n",sizeof(', RecordID[lC], '));');
+  Writeln(FLangOutput[lC], '  printf("SizeOf(', RecordID[CommLangID], ')=%lu\n",sizeof(', RecordID[lC], '));');
 end;
 end;
 
 
 procedure TH2PasCheckerCodeGen.ProcessField(FieldID: TIdentifier);
 procedure TH2PasCheckerCodeGen.ProcessField(FieldID: TIdentifier);
 begin
 begin
   Writeln(FLangOutput[lPascal], '  Writeln(''SizeOf(', FCurrentRecord[CommLangID], '.', FieldID[CommLangID], ')='',SizeOf(', FCurrentRecord[lPascal], '.', FieldID[lPascal], '));');
   Writeln(FLangOutput[lPascal], '  Writeln(''SizeOf(', FCurrentRecord[CommLangID], '.', FieldID[CommLangID], ')='',SizeOf(', FCurrentRecord[lPascal], '.', FieldID[lPascal], '));');
   Writeln(FLangOutput[lPascal], '  Writeln(''OffsetOf(', FCurrentRecord[CommLangID], ',', FieldID[CommLangID], ')='',PtrUInt(@', FCurrentRecord[lPascal], '(nil^).', FieldID[lPascal], '));');
   Writeln(FLangOutput[lPascal], '  Writeln(''OffsetOf(', FCurrentRecord[CommLangID], ',', FieldID[CommLangID], ')='',PtrUInt(@', FCurrentRecord[lPascal], '(nil^).', FieldID[lPascal], '));');
-  Writeln(FLangOutput[lC], '  printf("SizeOf(', FCurrentRecord[CommLangID], '.', FieldID[CommLangID], ')=%u\n",sizeof(((', FCurrentRecord[lC], '*)0)->', FieldID[lC], '));');
-  Writeln(FLangOutput[lC], '  printf("OffsetOf(', FCurrentRecord[CommLangID], ',', FieldID[CommLangID], ')=%u\n",offsetof(', FCurrentRecord[lC], ',', FieldID[lC], '));');
+  Writeln(FLangOutput[lC], '  printf("SizeOf(', FCurrentRecord[CommLangID], '.', FieldID[CommLangID], ')=%lu\n",sizeof(((', FCurrentRecord[lC], '*)0)->', FieldID[lC], '));');
+  Writeln(FLangOutput[lC], '  printf("OffsetOf(', FCurrentRecord[CommLangID], ',', FieldID[CommLangID], ')=%lu\n",offsetof(', FCurrentRecord[lC], ',', FieldID[lC], '));');
 end;
 end;
 
 
 destructor TH2PasCheckerCodeGen.Destroy;
 destructor TH2PasCheckerCodeGen.Destroy;