Browse Source

merge with trunk

git-svn-id: branches/tg74/avx1@22757 -
tg74 12 years ago
parent
commit
aa158110cc
85 changed files with 1918 additions and 769 deletions
  1. 9 0
      .gitattributes
  2. 102 3
      Makefile
  3. 13 2
      Makefile.fpc
  4. 2 2
      compiler/aasmtai.pas
  5. 1 2
      compiler/aggas.pas
  6. 7 0
      compiler/arm/cpupi.pas
  7. 9 4
      compiler/assemble.pas
  8. 4 3
      compiler/m68k/aasmcpu.pas
  9. 2 2
      compiler/m68k/ag68kgas.pas
  10. 242 40
      compiler/m68k/cgcpu.pas
  11. 3 3
      compiler/m68k/cpubase.pas
  12. 8 1
      compiler/m68k/cpupara.pas
  13. 24 1
      compiler/m68k/cpupi.pas
  14. 35 10
      compiler/m68k/n68kcnv.pas
  15. 6 6
      compiler/m68k/n68kmat.pas
  16. 5 4
      compiler/m68k/ra68kmot.pas
  17. 9 3
      compiler/mips/cpupi.pas
  18. 2 2
      compiler/ncal.pas
  19. 6 0
      compiler/ncgutil.pas
  20. 5 2
      compiler/rgobj.pas
  21. 4 1
      compiler/sparc/cpupi.pas
  22. 18 5
      packages/Makefile
  23. 11 5
      packages/Makefile.fpc
  24. 6 3
      packages/fcl-base/src/base64.pp
  25. 1 1
      packages/fcl-db/Makefile.fpc.fpcmake
  26. 17 1
      packages/fcl-db/fpmake.pp
  27. 13 11
      packages/fcl-db/src/base/xmldatapacketreader.pp
  28. 83 183
      packages/fcl-db/src/datadict/Makefile
  29. 16 16
      packages/fcl-db/src/datadict/Makefile.fpc
  30. 74 0
      packages/fcl-db/src/datadict/fpddmysql51.pp
  31. 74 0
      packages/fcl-db/src/datadict/fpddmysql55.pp
  32. 5 5
      packages/fcl-db/src/sqldb/interbase/ibconnection.pp
  33. 11 0
      packages/fcl-db/tests/database.ini.txt
  34. 7 4
      packages/fcl-db/tests/sqldbtoolsunit.pas
  35. 34 11
      packages/fcl-db/tests/testfieldtypes.pas
  36. 77 54
      packages/fcl-registry/src/regini.inc
  37. 82 261
      packages/fcl-registry/src/registry.pp
  38. 19 12
      packages/fcl-registry/src/winreg.inc
  39. 24 4
      packages/fcl-registry/tests/testbasics.pp
  40. 113 0
      packages/fcl-registry/tests/tregistry2.pp
  41. 15 9
      packages/fpmkunit/Makefile
  42. 6 8
      packages/fpmkunit/Makefile.fpc
  43. 2 2
      packages/libndsfpc/examples/filesystem/nitrofs/nitrodir/Makefile.fpc
  44. 1 1
      packages/libndsfpc/examples/gl2d/2Dplus3D/Makefile.fpc
  45. 1 1
      packages/libndsfpc/examples/gl2d/dual_screen/Makefile.fpc
  46. 1 1
      packages/libndsfpc/examples/gl2d/fonts/Makefile.fpc
  47. 1 1
      packages/libndsfpc/examples/gl2d/primitives/Makefile.fpc
  48. 1 1
      packages/libndsfpc/examples/gl2d/scrolling/Makefile.fpc
  49. 1 1
      packages/libndsfpc/examples/gl2d/sprites/Makefile.fpc
  50. 6 1
      packages/libndsfpc/examples/graphics/Backgrounds/256_color_bmp/256ColorBmp.pp
  51. 3 1
      packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp
  52. 50 0
      packages/libndsfpc/examples/graphics/Backgrounds/all_in_one/Advanced.pp
  53. 2 0
      packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp
  54. 4 1
      packages/libndsfpc/examples/graphics/Sprites/animate_simple/AnimateSimple.pp
  55. 3 1
      packages/libndsfpc/examples/input/Touch_Pad/touch_test/touchTest.pp
  56. 19 0
      packages/libndsfpc/src/fat/fat.inc
  57. 13 5
      packages/libndsfpc/src/nds/card.inc
  58. 14 0
      packages/libndsfpc/src/nds/libversion.inc
  59. 2 1
      packages/libndsfpc/src/nds/ndsinclude.inc
  60. 6 2
      packages/univint/src/MacTypes.pas
  61. 1 1
      packages/winunits-base/src/activex.pp
  62. 31 27
      packages/winunits-base/src/comobj.pp
  63. 1 1
      packages/winunits-base/src/comserv.pp
  64. 32 6
      packages/winunits-base/src/typelib.pas
  65. 31 8
      rtl/i386/cpu.pp
  66. 6 0
      rtl/inc/systemh.inc
  67. 6 0
      rtl/linux/m68k/prt0.as
  68. 2 0
      rtl/linux/m68k/sighnd.inc
  69. 42 3
      rtl/linux/m68k/syscall.inc
  70. 0 2
      rtl/linux/m68k/syscallh.inc
  71. 4 4
      rtl/linux/m68k/sysnr.inc
  72. 0 1
      rtl/linux/system.pp
  73. 239 0
      rtl/linux/termios.inc
  74. 25 0
      rtl/m68k/m68k.inc
  75. 26 0
      rtl/m68k/mathu.inc
  76. 24 0
      rtl/m68k/mathuh.inc
  77. 4 1
      rtl/m68k/set.inc
  78. 1 5
      rtl/mips/mips.inc
  79. 4 2
      rtl/objpas/sysutils/dati.inc
  80. 28 0
      rtl/x86_64/cpu.pp
  81. 1 1
      tests/tbs/tb0072.pp
  82. 28 0
      tests/test/tnostackframe.pp
  83. 24 0
      tests/test/tnostackframe2.pp
  84. 19 0
      tests/test/tnostackframe3.pp
  85. 5 3
      utils/importtl/importtl.pas

+ 9 - 0
.gitattributes

@@ -1932,6 +1932,8 @@ packages/fcl-db/src/datadict/fpddfb.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddmysql40.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddmysql40.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddmysql41.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddmysql41.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddmysql50.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddmysql50.pp svneol=native#text/plain
+packages/fcl-db/src/datadict/fpddmysql51.pp svneol=native#text/plain
+packages/fcl-db/src/datadict/fpddmysql55.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddodbc.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddodbc.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddoracle.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddoracle.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddpq.pp svneol=native#text/plain
 packages/fcl-db/src/datadict/fpddpq.pp svneol=native#text/plain
@@ -2389,6 +2391,7 @@ packages/fcl-registry/tests/Makefile svneol=native#text/plain
 packages/fcl-registry/tests/Makefile.fpc -text
 packages/fcl-registry/tests/Makefile.fpc -text
 packages/fcl-registry/tests/regtestframework.pp -text
 packages/fcl-registry/tests/regtestframework.pp -text
 packages/fcl-registry/tests/testbasics.pp svneol=native#text/plain
 packages/fcl-registry/tests/testbasics.pp svneol=native#text/plain
+packages/fcl-registry/tests/tregistry2.pp svneol=native#text/plain
 packages/fcl-res/Makefile svneol=native#text/plain
 packages/fcl-res/Makefile svneol=native#text/plain
 packages/fcl-res/Makefile.fpc svneol=native#text/plain
 packages/fcl-res/Makefile.fpc svneol=native#text/plain
 packages/fcl-res/Makefile.fpc.fpcmake svneol=native#text/plain
 packages/fcl-res/Makefile.fpc.fpcmake svneol=native#text/plain
@@ -4964,6 +4967,7 @@ packages/libndsfpc/src/nds/input.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/interrupts.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/interrupts.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/ipc.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/ipc.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/jtypes.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/jtypes.inc svneol=native#text/plain
+packages/libndsfpc/src/nds/libversion.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/memory.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/memory.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/nds.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/nds.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/ndsinclude.inc svneol=native#text/plain
 packages/libndsfpc/src/nds/ndsinclude.inc svneol=native#text/plain
@@ -7931,6 +7935,8 @@ rtl/m68k/lowmath.inc svneol=native#text/plain
 rtl/m68k/m68k.inc svneol=native#text/plain
 rtl/m68k/m68k.inc svneol=native#text/plain
 rtl/m68k/makefile.cpu svneol=native#text/plain
 rtl/m68k/makefile.cpu svneol=native#text/plain
 rtl/m68k/math.inc svneol=native#text/plain
 rtl/m68k/math.inc svneol=native#text/plain
+rtl/m68k/mathu.inc svneol=native#text/plain
+rtl/m68k/mathuh.inc svneol=native#text/plain
 rtl/m68k/readme -text
 rtl/m68k/readme -text
 rtl/m68k/set.inc svneol=native#text/plain
 rtl/m68k/set.inc svneol=native#text/plain
 rtl/m68k/setjump.inc svneol=native#text/plain
 rtl/m68k/setjump.inc svneol=native#text/plain
@@ -10974,6 +10980,9 @@ tests/test/tnoext4.pp svneol=native#text/plain
 tests/test/tnonlocalgoto1.pp svneol=native#text/pascal
 tests/test/tnonlocalgoto1.pp svneol=native#text/pascal
 tests/test/tnonlocalgoto2.pp svneol=native#text/pascal
 tests/test/tnonlocalgoto2.pp svneol=native#text/pascal
 tests/test/tnonlocalgoto3.pp svneol=native#text/pascal
 tests/test/tnonlocalgoto3.pp svneol=native#text/pascal
+tests/test/tnostackframe.pp svneol=native#text/pascal
+tests/test/tnostackframe2.pp svneol=native#text/pascal
+tests/test/tnostackframe3.pp svneol=native#text/pascal
 tests/test/tobjc1.pp svneol=native#text/plain
 tests/test/tobjc1.pp svneol=native#text/plain
 tests/test/tobjc10.pp svneol=native#text/plain
 tests/test/tobjc10.pp svneol=native#text/plain
 tests/test/tobjc11.pp svneol=native#text/plain
 tests/test/tobjc11.pp svneol=native#text/plain

+ 102 - 3
Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/09/27]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/10/11]
 #
 #
 default: help
 default: help
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
@@ -304,6 +304,7 @@ endif
 endif
 endif
 override PACKAGE_NAME=fpc
 override PACKAGE_NAME=fpc
 override PACKAGE_VERSION=2.7.1
 override PACKAGE_VERSION=2.7.1
+REQUIREDVERSION=2.6.0
 ifndef inOS2
 ifndef inOS2
 override FPCDIR:=$(BASEDIR)
 override FPCDIR:=$(BASEDIR)
 export FPCDIR
 export FPCDIR
@@ -2311,6 +2312,51 @@ TARGET_DIRS_PACKAGES=1
 TARGET_DIRS_IDE=1
 TARGET_DIRS_IDE=1
 TARGET_DIRS_INSTALLER=1
 TARGET_DIRS_INSTALLER=1
 endif
 endif
+ifdef TARGET_DIRS_TARGET_DIRS
+TARGET_DIRS_all:
+	$(MAKE) -C TARGET_DIRS all
+TARGET_DIRS_debug:
+	$(MAKE) -C TARGET_DIRS debug
+TARGET_DIRS_smart:
+	$(MAKE) -C TARGET_DIRS smart
+TARGET_DIRS_release:
+	$(MAKE) -C TARGET_DIRS release
+TARGET_DIRS_units:
+	$(MAKE) -C TARGET_DIRS units
+TARGET_DIRS_examples:
+	$(MAKE) -C TARGET_DIRS examples
+TARGET_DIRS_shared:
+	$(MAKE) -C TARGET_DIRS shared
+TARGET_DIRS_install:
+	$(MAKE) -C TARGET_DIRS install
+TARGET_DIRS_sourceinstall:
+	$(MAKE) -C TARGET_DIRS sourceinstall
+TARGET_DIRS_exampleinstall:
+	$(MAKE) -C TARGET_DIRS exampleinstall
+TARGET_DIRS_distinstall:
+	$(MAKE) -C TARGET_DIRS distinstall
+TARGET_DIRS_zipinstall:
+	$(MAKE) -C TARGET_DIRS zipinstall
+TARGET_DIRS_zipsourceinstall:
+	$(MAKE) -C TARGET_DIRS zipsourceinstall
+TARGET_DIRS_zipexampleinstall:
+	$(MAKE) -C TARGET_DIRS zipexampleinstall
+TARGET_DIRS_zipdistinstall:
+	$(MAKE) -C TARGET_DIRS zipdistinstall
+TARGET_DIRS_clean:
+	$(MAKE) -C TARGET_DIRS clean
+TARGET_DIRS_distclean:
+	$(MAKE) -C TARGET_DIRS distclean
+TARGET_DIRS_cleanall:
+	$(MAKE) -C TARGET_DIRS cleanall
+TARGET_DIRS_info:
+	$(MAKE) -C TARGET_DIRS info
+TARGET_DIRS_makefiles:
+	$(MAKE) -C TARGET_DIRS makefiles
+TARGET_DIRS:
+	$(MAKE) -C TARGET_DIRS all
+.PHONY: TARGET_DIRS_all TARGET_DIRS_debug TARGET_DIRS_smart TARGET_DIRS_release TARGET_DIRS_units TARGET_DIRS_examples TARGET_DIRS_shared TARGET_DIRS_install TARGET_DIRS_sourceinstall TARGET_DIRS_exampleinstall TARGET_DIRS_distinstall TARGET_DIRS_zipinstall TARGET_DIRS_zipsourceinstall TARGET_DIRS_zipexampleinstall TARGET_DIRS_zipdistinstall TARGET_DIRS_clean TARGET_DIRS_distclean TARGET_DIRS_cleanall TARGET_DIRS_info TARGET_DIRS_makefiles TARGET_DIRS
+endif
 ifdef TARGET_DIRS_COMPILER
 ifdef TARGET_DIRS_COMPILER
 compiler_all:
 compiler_all:
 	$(MAKE) -C compiler all
 	$(MAKE) -C compiler all
@@ -2581,6 +2627,51 @@ installer:
 	$(MAKE) -C installer all
 	$(MAKE) -C installer all
 .PHONY: installer_all installer_debug installer_smart installer_release installer_units installer_examples installer_shared installer_install installer_sourceinstall installer_exampleinstall installer_distinstall installer_zipinstall installer_zipsourceinstall installer_zipexampleinstall installer_zipdistinstall installer_clean installer_distclean installer_cleanall installer_info installer_makefiles installer
 .PHONY: installer_all installer_debug installer_smart installer_release installer_units installer_examples installer_shared installer_install installer_sourceinstall installer_exampleinstall installer_distinstall installer_zipinstall installer_zipsourceinstall installer_zipexampleinstall installer_zipdistinstall installer_clean installer_distclean installer_cleanall installer_info installer_makefiles installer
 endif
 endif
+ifdef TARGET_EXAMPLEDIRS_TARGET_EXAMPLEDIRS
+TARGET_EXAMPLEDIRS_all:
+	$(MAKE) -C TARGET_EXAMPLEDIRS all
+TARGET_EXAMPLEDIRS_debug:
+	$(MAKE) -C TARGET_EXAMPLEDIRS debug
+TARGET_EXAMPLEDIRS_smart:
+	$(MAKE) -C TARGET_EXAMPLEDIRS smart
+TARGET_EXAMPLEDIRS_release:
+	$(MAKE) -C TARGET_EXAMPLEDIRS release
+TARGET_EXAMPLEDIRS_units:
+	$(MAKE) -C TARGET_EXAMPLEDIRS units
+TARGET_EXAMPLEDIRS_examples:
+	$(MAKE) -C TARGET_EXAMPLEDIRS examples
+TARGET_EXAMPLEDIRS_shared:
+	$(MAKE) -C TARGET_EXAMPLEDIRS shared
+TARGET_EXAMPLEDIRS_install:
+	$(MAKE) -C TARGET_EXAMPLEDIRS install
+TARGET_EXAMPLEDIRS_sourceinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS sourceinstall
+TARGET_EXAMPLEDIRS_exampleinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS exampleinstall
+TARGET_EXAMPLEDIRS_distinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS distinstall
+TARGET_EXAMPLEDIRS_zipinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipinstall
+TARGET_EXAMPLEDIRS_zipsourceinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipsourceinstall
+TARGET_EXAMPLEDIRS_zipexampleinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipexampleinstall
+TARGET_EXAMPLEDIRS_zipdistinstall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS zipdistinstall
+TARGET_EXAMPLEDIRS_clean:
+	$(MAKE) -C TARGET_EXAMPLEDIRS clean
+TARGET_EXAMPLEDIRS_distclean:
+	$(MAKE) -C TARGET_EXAMPLEDIRS distclean
+TARGET_EXAMPLEDIRS_cleanall:
+	$(MAKE) -C TARGET_EXAMPLEDIRS cleanall
+TARGET_EXAMPLEDIRS_info:
+	$(MAKE) -C TARGET_EXAMPLEDIRS info
+TARGET_EXAMPLEDIRS_makefiles:
+	$(MAKE) -C TARGET_EXAMPLEDIRS makefiles
+TARGET_EXAMPLEDIRS:
+	$(MAKE) -C TARGET_EXAMPLEDIRS all
+.PHONY: TARGET_EXAMPLEDIRS_all TARGET_EXAMPLEDIRS_debug TARGET_EXAMPLEDIRS_smart TARGET_EXAMPLEDIRS_release TARGET_EXAMPLEDIRS_units TARGET_EXAMPLEDIRS_examples TARGET_EXAMPLEDIRS_shared TARGET_EXAMPLEDIRS_install TARGET_EXAMPLEDIRS_sourceinstall TARGET_EXAMPLEDIRS_exampleinstall TARGET_EXAMPLEDIRS_distinstall TARGET_EXAMPLEDIRS_zipinstall TARGET_EXAMPLEDIRS_zipsourceinstall TARGET_EXAMPLEDIRS_zipexampleinstall TARGET_EXAMPLEDIRS_zipdistinstall TARGET_EXAMPLEDIRS_clean TARGET_EXAMPLEDIRS_distclean TARGET_EXAMPLEDIRS_cleanall TARGET_EXAMPLEDIRS_info TARGET_EXAMPLEDIRS_makefiles TARGET_EXAMPLEDIRS
+endif
 debug: $(addsuffix _debug,$(TARGET_DIRS))
 debug: $(addsuffix _debug,$(TARGET_DIRS))
 smart: $(addsuffix _smart,$(TARGET_DIRS))
 smart: $(addsuffix _smart,$(TARGET_DIRS))
 release: $(addsuffix _release,$(TARGET_DIRS))
 release: $(addsuffix _release,$(TARGET_DIRS))
@@ -2619,12 +2710,20 @@ compiler_cycle:
 	$(MAKE) -C compiler cycle
 	$(MAKE) -C compiler cycle
 BUILDSTAMP=build-stamp.$(FULL_TARGET)
 BUILDSTAMP=build-stamp.$(FULL_TARGET)
 .PHONY: all clean distclean build buildbase install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
 .PHONY: all clean distclean build buildbase install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
+versioncheckstartingcompiler: 
+ifndef CROSSCOMPILE
+ifndef OVERRIDEVERSIONCHECK
+ifneq ($(FPC_VERSION),$(REQUIREDVERSION))
+	$(error The only supported starting compiler version is $(REQUIREDVERSION). You try to build with $(FPC_VERSION). If you are absolutely sure that the current compiler is built from the exact same version/revision, you can try to use OVERRIDEVERSIONCHECK=1 to override )
+endif
+endif
+endif
 ifeq ($(findstring $(CPU_TARGET),$(BuildOnlyBaseCPUs)),)
 ifeq ($(findstring $(CPU_TARGET),$(BuildOnlyBaseCPUs)),)
-all: build
+all: versioncheckstartingcompiler build
 install: installall
 install: installall
 zipinstall: zipinstallall
 zipinstall: zipinstallall
 else
 else
-all: buildbase
+all: versioncheckstartingcompiler buildbase
 install: installbase
 install: installbase
 zipinstall: zipinstallbase
 zipinstall: zipinstallbase
 endif
 endif

+ 13 - 2
Makefile.fpc

@@ -20,6 +20,9 @@ fpcdir=.
 rule=help
 rule=help
 
 
 [prerules]
 [prerules]
+REQUIREDVERSION=2.6.0
+
+
 # make versions < 3.77 (OS2 version) are buggy
 # make versions < 3.77 (OS2 version) are buggy
 ifndef inOS2
 ifndef inOS2
 override FPCDIR:=$(BASEDIR)
 override FPCDIR:=$(BASEDIR)
@@ -236,13 +239,21 @@ BUILDSTAMP=build-stamp.$(FULL_TARGET)
 
 
 .PHONY: all clean distclean build buildbase install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
 .PHONY: all clean distclean build buildbase install installbase installother zipinstallbase zipinstallotherzipinstall singlezipinstall
 
 
+versioncheckstartingcompiler: 
+ifndef CROSSCOMPILE
+ifndef OVERRIDEVERSIONCHECK
+ifneq ($(FPC_VERSION),$(REQUIREDVERSION))
+	$(error The only supported starting compiler version is $(REQUIREDVERSION). You are trying to build with $(FPC_VERSION). If you are absolutely sure that the current compiler is built from the exact same version/revision, you can try to use OVERRIDEVERSIONCHECK=1 to override )
+endif
+endif
+endif
 
 
 ifeq ($(findstring $(CPU_TARGET),$(BuildOnlyBaseCPUs)),)
 ifeq ($(findstring $(CPU_TARGET),$(BuildOnlyBaseCPUs)),)
-all: build
+all: versioncheckstartingcompiler build
 install: installall
 install: installall
 zipinstall: zipinstallall
 zipinstall: zipinstallall
 else
 else
-all: buildbase
+all: versioncheckstartingcompiler buildbase
 install: installbase
 install: installbase
 zipinstall: zipinstallbase
 zipinstall: zipinstallbase
 endif
 endif

+ 2 - 2
compiler/aasmtai.pas

@@ -2464,14 +2464,14 @@ implementation
         { When the generic RA is used this needs to be overridden, we don't use
         { When the generic RA is used this needs to be overridden, we don't use
           virtual;abstract; to prevent a lot of warnings of unimplemented abstract methods
           virtual;abstract; to prevent a lot of warnings of unimplemented abstract methods
           when tai_cpu is created (PFV) }
           when tai_cpu is created (PFV) }
-        internalerror(200404091);
+        internalerror(2004040901);
         result:=false;
         result:=false;
       end;
       end;
 
 
 
 
     function tai_cpu_abstract.spilling_get_operation_type(opnr: longint): topertype;
     function tai_cpu_abstract.spilling_get_operation_type(opnr: longint): topertype;
       begin
       begin
-        internalerror(200404091);
+        internalerror(2004040902);
         result:=operand_readwrite;
         result:=operand_readwrite;
       end;
       end;
 
 

+ 1 - 2
compiler/aggas.pas

@@ -518,8 +518,7 @@ implementation
         case target_info.system of
         case target_info.system of
          system_i386_OS2,
          system_i386_OS2,
          system_i386_EMX,
          system_i386_EMX,
-         system_m68k_amiga,  { amiga has old GNU AS (2.14), which blews up from .section (KB) }
-         system_m68k_linux: ;
+         system_m68k_amiga: ; { amiga has old GNU AS (2.14), which blews up from .section (KB) }
          system_powerpc_darwin,
          system_powerpc_darwin,
          system_i386_darwin,
          system_i386_darwin,
          system_i386_iphonesim,
          system_i386_iphonesim,

+ 7 - 0
compiler/arm/cpupi.pas

@@ -63,6 +63,13 @@ unit cpupi;
           is especially a problem when taking the address of a local. For now,
           is especially a problem when taking the address of a local. For now,
           this extra memory should hurt less than generating all local contants with offsets
           this extra memory should hurt less than generating all local contants with offsets
           >256 as non shifter constants }
           >256 as non shifter constants }
+        if (po_nostackframe in procdef.procoptions) then
+          begin
+             { maxpushedparasize sghould be zero,
+               if not we will get an error later. }
+             tg.setfirsttemp(maxpushedparasize);
+             exit;
+          end;
         if tg.direction = -1 then
         if tg.direction = -1 then
           begin
           begin
             if (target_info.system<>system_arm_darwin) then
             if (target_info.system<>system_arm_darwin) then

+ 9 - 4
compiler/assemble.pas

@@ -580,10 +580,15 @@ Implementation
       begin
       begin
         result:=target_asm.asmcmd;
         result:=target_asm.asmcmd;
 {$ifdef m68k}
 {$ifdef m68k}
-        if current_settings.cputype = cpu_MC68020 then
-          result:='-m68020 '+result
-        else
-          result:='-m68000 '+result;
+        { TODO: use a better approach for this }
+        case current_settings.cputype of
+          cpu_MC68000:
+            result:='-march=68000 '+result;
+          cpu_MC68020:
+            result:='-march=68020 '+result;
+          cpu_Coldfire:
+            result:='-march=cfv4e '+result;
+        end;
 {$endif}
 {$endif}
 {$ifdef arm}
 {$ifdef arm}
         if (target_info.system=system_arm_darwin) then
         if (target_info.system=system_arm_darwin) then

+ 4 - 3
compiler/m68k/aasmcpu.pas

@@ -512,8 +512,9 @@ type
     function taicpu.spilling_get_operation_type(opnr: longint): topertype;
     function taicpu.spilling_get_operation_type(opnr: longint): topertype;
       begin
       begin
         case opcode of
         case opcode of
-          A_MOVE, A_MOVEQ, A_ADD, A_ADDQ, A_ADDX, A_SUB, A_SUBQ,
-          A_AND, A_LSR, A_LSL, A_ASR, A_ASL, A_EOR, A_EORI, A_OR:
+          A_MOVE, A_MOVEQ, A_ADD, A_ADDQ, A_ADDX, A_SUB, A_SUBQ, A_SUBX,
+          A_AND, A_LSR, A_LSL, A_ASR, A_ASL, A_EOR, A_EORI, A_OR,
+          A_MULS, A_MULU:
             if opnr=1 then begin
             if opnr=1 then begin
               result:=operand_write;
               result:=operand_write;
             end else begin
             end else begin
@@ -528,7 +529,7 @@ type
           else begin
           else begin
 { TODO: FIX ME!!! remove ugly debug code ... }
 { TODO: FIX ME!!! remove ugly debug code ... }
             writeln('M68K: unknown opcode when spilling: ',gas_op2str[opcode]);
             writeln('M68K: unknown opcode when spilling: ',gas_op2str[opcode]);
-            internalerror(200404091);
+            internalerror(2004040903);
           end;
           end;
         end;
         end;
       end;
       end;

+ 2 - 2
compiler/m68k/ag68kgas.pas

@@ -151,9 +151,9 @@ interface
                if (index<>NR_NO) and (base=NR_NO) and (direction=dir_none) then
                if (index<>NR_NO) and (base=NR_NO) and (direction=dir_none) then
                 begin
                 begin
                   if (scalefactor = 1) or (scalefactor = 0) then
                   if (scalefactor = 1) or (scalefactor = 0) then
-                    s:=s+'(,'+indexstr+'.l)'
+                    s:=s+'('+indexstr+'.l)'
                   else
                   else
-                    s:=s+'(,'+indexstr+'.l*'+tostr(scalefactor)+')'
+                    s:=s+'('+indexstr+'.l*'+tostr(scalefactor)+')'
                 end
                 end
                 else if (index=NR_NO) and (base<>NR_NO) and (direction=dir_inc) then
                 else if (index=NR_NO) and (base<>NR_NO) and (direction=dir_inc) then
                 begin
                 begin

+ 242 - 40
compiler/m68k/cgcpu.pas

@@ -76,6 +76,7 @@ unit cgcpu;
         procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : tcgint;reg : tregister;
         procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : tcgint;reg : tregister;
           l : tasmlabel);override;
           l : tasmlabel);override;
         procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
         procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override;
+        procedure a_jmp_name(list : TAsmList;const s : string); override;
         procedure a_jmp_always(list : TAsmList;l: tasmlabel); override;
         procedure a_jmp_always(list : TAsmList;l: tasmlabel); override;
         procedure a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); override;
         procedure a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); override;
         procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: tresflags; reg: TRegister); override;
         procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: tresflags; reg: TRegister); override;
@@ -187,7 +188,7 @@ unit cgcpu;
          if ref.index <> NR_NO then
          if ref.index <> NR_NO then
            begin
            begin
              if ref.base <> NR_NO then
              if ref.base <> NR_NO then
-                internalerror(20020814);
+                internalerror(2002081401);
              if (ref.offset < low(shortint)) or (ref.offset > high(shortint)) then
              if (ref.offset < low(shortint)) or (ref.offset > high(shortint)) then
                 isvalidrefoffset := false
                 isvalidrefoffset := false
            end
            end
@@ -316,6 +317,7 @@ unit cgcpu;
           { Push the data starting at ofs }
           { Push the data starting at ofs }
           href:=r;
           href:=r;
           inc(href.offset,ofs);
           inc(href.offset,ofs);
+          fixref(list,href);
           if tcgsize2size[paraloc^.size]>cgpara.alignment then
           if tcgsize2size[paraloc^.size]>cgpara.alignment then
             pushsize:=paraloc^.size
             pushsize:=paraloc^.size
           else
           else
@@ -413,41 +415,114 @@ unit cgcpu;
 
 
 
 
     function tcg68k.fixref(list: TAsmList; var ref: treference): boolean;
     function tcg68k.fixref(list: TAsmList; var ref: treference): boolean;
-
+       var
+         hreg,idxreg : tregister;
+         href : treference;
        begin
        begin
          result:=false;
          result:=false;
-         { The Coldfire and MC68020+ have extended
+         { The MC68020+ has extended
            addressing capabilities with a 32-bit
            addressing capabilities with a 32-bit
            displacement.
            displacement.
          }
          }
-         if (current_settings.cputype<>cpu_MC68000) then
+         if (current_settings.cputype=cpu_MC68020) then
            exit;
            exit;
-         if (ref.base<>NR_NO) then
-           begin
-             if (ref.index <> NR_NO) and assigned(ref.symbol) then
-                internalerror(20020814);
-             { base + reg }
-             if ref.index <> NR_NO then
-                begin
-                   { base + reg + offset }
-                   if (ref.offset < low(shortint)) or (ref.offset > high(shortint)) then
+         { ToDo: check which constraints of Coldfire also apply to MC68000 }
+         case current_settings.cputype of
+           cpu_MC68000:
+             begin
+               if (ref.base<>NR_NO) then
+                 begin
+                   if (ref.index <> NR_NO) and assigned(ref.symbol) then
+                      internalerror(2002081402);
+                   { base + reg }
+                   if ref.index <> NR_NO then
+                      begin
+                         { base + reg + offset }
+                         if (ref.offset < low(shortint)) or (ref.offset > high(shortint)) then
+                           begin
+                              list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,ref.base));
+                              fixref := true;
+                              ref.offset := 0;
+                              exit;
+                           end;
+                      end
+                   else
+                   { base + offset }
+                   if (ref.offset < low(smallint)) or (ref.offset > high(smallint)) then
                      begin
                      begin
-                        list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,ref.base));
-                        fixref := true;
-                        ref.offset := 0;
-                        exit;
+                       list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,ref.base));
+                       fixref := true;
+                       ref.offset := 0;
+                       exit;
                      end;
                      end;
-                end
-             else
-             { base + offset }
-             if (ref.offset < low(smallint)) or (ref.offset > high(smallint)) then
-               begin
-                 list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,ref.base));
-                 fixref := true;
-                 ref.offset := 0;
-                 exit;
-               end;
-           end;
+                 end;
+             end;
+           cpu_Coldfire:
+             begin
+               if (ref.base<>NR_NO) then
+                 begin
+                   if assigned(ref.symbol) and (ref.index=NR_NO) then
+                     begin
+                       hreg:=cg.getaddressregister(list);
+                       reference_reset_symbol(href,ref.symbol,0,ref.alignment);
+                       list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
+                       ref.index:=ref.base;
+                       ref.base:=hreg;
+                       ref.symbol:=nil;
+                     end;
+                   if (ref.index<>NR_NO) and assigned(ref.symbol) then
+                     begin
+                       list.concat(taicpu.op_reg_reg(A_ADD,S_L,ref.base,ref.index));
+                       ref.index:=NR_NO;
+                     end;
+                   {if (ref.index <> NR_NO) and assigned(ref.symbol) then
+                      internalerror(2002081403);}
+                   { first ensure that base is an address register }
+                   if not isaddressregister(ref.base) then
+                     begin
+                       hreg:=getaddressregister(list);
+                       list.concat(taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg));
+                       fixref:=true;
+                       ref.base:=hreg;
+                     end;
+                   { base + reg }
+                   if ref.index <> NR_NO then
+                      begin
+                         { base + reg + offset }
+                         if (ref.offset < low(shortint)) or (ref.offset > high(shortint)) then
+                           begin
+                              list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,ref.base));
+                              fixref := true;
+                              ref.offset := 0;
+                              exit;
+                           end;
+                      end
+                   else
+                   { base + offset }
+                   if (ref.offset < low(smallint)) or (ref.offset > high(smallint)) then
+                     begin
+                       list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,ref.base));
+                       fixref:=true;
+                       ref.offset:=0;
+                       exit;
+                     end;
+                 end
+               else
+                 { Note: symbol -> ref would be supported as long as ref does not
+                         contain a offset or index... (maybe something for the
+                         optimizer) }
+                 if Assigned(ref.symbol) {and (ref.index<>NR_NO)} then
+                   begin
+                     hreg:=cg.getaddressregister(list);
+                     idxreg:=ref.index;
+                     ref.index:=NR_NO;
+                     list.concat(taicpu.op_ref_reg(A_LEA,S_L,ref,hreg));
+                     reference_reset_base(ref,hreg,0,ref.alignment);
+                     ref.index:=idxreg;
+                     fixref:=true;
+                   end;
+             end;
+         end;
        end;
        end;
 
 
 
 
@@ -513,12 +588,32 @@ unit cgcpu;
       end;
       end;
 
 
     procedure tcg68k.a_load_const_ref(list : TAsmList; tosize: tcgsize; a : tcgint;const ref : treference);
     procedure tcg68k.a_load_const_ref(list : TAsmList; tosize: tcgsize; a : tcgint;const ref : treference);
+      var
+        hreg : tregister;
+        href : treference;
       begin
       begin
 {$ifdef DEBUG_CHARLIE}
 {$ifdef DEBUG_CHARLIE}
         list.concat(tai_comment.create(strpnew('a_load_const_ref')));
         list.concat(tai_comment.create(strpnew('a_load_const_ref')));
 {$endif DEBUG_CHARLIE}
 {$endif DEBUG_CHARLIE}
 
 
-        list.concat(taicpu.op_const_ref(A_MOVE,S_L,longint(a),ref));
+        href:=ref;
+        fixref(list,href);
+        { for coldfire we need to go through a temporary register if we have a
+          offset, index or symbol given }
+        if (current_settings.cputype=cpu_coldfire) and
+            (
+              (href.offset<>0) or
+              { TODO : check whether we really need this second condition }
+              (href.index<>NR_NO) or
+              assigned(href.symbol)
+            ) then
+          begin
+            hreg:=getintregister(list,tosize);
+            list.concat(taicpu.op_const_reg(A_MOVE,S_L,longint(a),hreg));
+            list.concat(taicpu.op_reg_ref(A_MOVE,S_L,hreg,href));
+          end
+        else
+          list.concat(taicpu.op_const_ref(A_MOVE,S_L,longint(a),href));
       end;
       end;
 
 
 
 
@@ -540,6 +635,8 @@ unit cgcpu;
       var
       var
         aref: treference;
         aref: treference;
         bref: treference;
         bref: treference;
+        dofix : boolean;
+        hreg: TRegister;
       begin
       begin
         aref := sref;
         aref := sref;
         bref := dref;
         bref := dref;
@@ -548,6 +645,57 @@ unit cgcpu;
 {$ifdef DEBUG_CHARLIE}
 {$ifdef DEBUG_CHARLIE}
 //        writeln('a_load_ref_ref');
 //        writeln('a_load_ref_ref');
 {$endif DEBUG_CHARLIE}
 {$endif DEBUG_CHARLIE}
+        { Coldfire dislikes certain move combinations }
+        if current_settings.cputype=cpu_coldfire then
+          begin
+            { TODO : move.b/w only allowed in newer coldfires... (ISA_B+) }
+
+            dofix:=false;
+            if { (d16,Ax) and (d8,Ax,Xi) }
+                (
+                  (aref.base<>NR_NO) and
+                  (
+                    (aref.index<>NR_NO) or
+                    (aref.offset<>0)
+                  )
+                ) or
+                { (xxx) }
+                assigned(aref.symbol) then
+              begin
+                if aref.index<>NR_NO then
+                  begin
+                    dofix:={ (d16,Ax) and (d8,Ax,Xi) }
+                           (
+                             (bref.base<>NR_NO) and
+                             (
+                               (bref.index<>NR_NO) or
+                               (bref.offset<>0)
+                             )
+                           ) or
+                           { (xxx) }
+                           assigned(bref.symbol);
+                  end
+                else
+                  { offset <> 0, but no index }
+                  begin
+                    dofix:={ (d8,Ax,Xi) }
+                           (
+                             (bref.base<>NR_NO) and
+                             (bref.index<>NR_NO)
+                           ) or
+                           { (xxx) }
+                           assigned(bref.symbol);
+                  end;
+              end;
+
+            if dofix then
+              begin
+                hreg:=getaddressregister(list);
+                list.concat(taicpu.op_ref_reg(A_LEA,S_L,bref,hreg));
+                list.concat(taicpu.op_reg_ref(A_MOVE,S_L{TCGSize2OpSize[fromsize]},hreg,bref));
+                exit;
+              end;
+          end;
         list.concat(taicpu.op_ref_ref(A_MOVE,TCGSize2OpSize[fromsize],aref,bref));
         list.concat(taicpu.op_ref_ref(A_MOVE,TCGSize2OpSize[fromsize],aref,bref));
       end;
       end;
 
 
@@ -565,7 +713,7 @@ unit cgcpu;
       var
       var
        href : treference;
        href : treference;
       begin
       begin
-         href := ref;
+         href:=ref;
          fixref(list,href);
          fixref(list,href);
          list.concat(taicpu.op_ref_reg(A_MOVE,TCGSize2OpSize[fromsize],href,register));
          list.concat(taicpu.op_ref_reg(A_MOVE,TCGSize2OpSize[fromsize],href,register));
          { extend the value in the register }
          { extend the value in the register }
@@ -696,7 +844,16 @@ unit cgcpu;
           OP_AND,
           OP_AND,
           OP_OR:
           OP_OR:
               begin
               begin
-                 list.concat(taicpu.op_const_reg(topcg2tasmop[op],S_L,longint(a), reg));
+                if isaddressregister(reg) then
+                  begin
+                    { use scratch register (there is a anda/ora though...) }
+                    scratch_reg:=getintregister(list,OS_INT);
+                    list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg,scratch_reg));
+                    list.concat(taicpu.op_const_reg(opcode,S_L,longint(a),scratch_reg));
+                    list.concat(taicpu.op_reg_reg(A_MOVE,S_L,scratch_reg,reg));
+                  end
+                else
+                  list.concat(taicpu.op_const_reg(topcg2tasmop[op],S_L,longint(a), reg));
               end;
               end;
           OP_DIV :
           OP_DIV :
               begin
               begin
@@ -708,7 +865,7 @@ unit cgcpu;
               end;
               end;
           OP_IMUL :
           OP_IMUL :
               begin
               begin
-                if current_settings.cputype = cpu_MC68000 then
+                if current_settings.cputype<>cpu_MC68020 then
                    begin
                    begin
                      r:=NR_D0;
                      r:=NR_D0;
                      r2:=NR_D1;
                      r2:=NR_D1;
@@ -737,7 +894,7 @@ unit cgcpu;
               end;
               end;
           OP_MUL :
           OP_MUL :
               begin
               begin
-                 if current_settings.cputype = cpu_MC68000 then
+                 if current_settings.cputype<>cpu_MC68020 then
                    begin
                    begin
                      r:=NR_D0;
                      r:=NR_D0;
                      r2:=NR_D1;
                      r2:=NR_D1;
@@ -745,7 +902,7 @@ unit cgcpu;
                      cg.getcpuregister(list,NR_D1);
                      cg.getcpuregister(list,NR_D1);
                      list.concat(taicpu.op_const_reg(A_MOVE,S_L,a, r));
                      list.concat(taicpu.op_const_reg(A_MOVE,S_L,a, r));
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg, r2));
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg, r2));
-                     cg.a_call_name(list,'FPC_MUL_LONGWORD',false);
+                     cg.a_call_name(list,'FPC_MUL_DWORD',false);
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,r, reg));
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,r, reg));
                      cg.ungetcpuregister(list,r);
                      cg.ungetcpuregister(list,r);
                      cg.ungetcpuregister(list,r2);
                      cg.ungetcpuregister(list,r2);
@@ -769,7 +926,7 @@ unit cgcpu;
               begin
               begin
                 if (a >= 1) and (a <= 8) then
                 if (a >= 1) and (a <= 8) then
                  begin
                  begin
-                   { now allowed to shift an address register }
+                   { not allowed to shift an address register }
                    if (isaddressregister(reg)) then
                    if (isaddressregister(reg)) then
                      begin
                      begin
                        scratch_reg := getintregister(list,OS_INT);
                        scratch_reg := getintregister(list,OS_INT);
@@ -963,7 +1120,7 @@ unit cgcpu;
               begin
               begin
                  sign_extend(list, size,reg1);
                  sign_extend(list, size,reg1);
                  sign_extend(list, size,reg2);
                  sign_extend(list, size,reg2);
-                 if current_settings.cputype = cpu_MC68000 then
+                 if current_settings.cputype <> cpu_MC68020 then
                    begin
                    begin
                      r:=NR_D0;
                      r:=NR_D0;
                      r2:=NR_D1;
                      r2:=NR_D1;
@@ -971,7 +1128,7 @@ unit cgcpu;
                      cg.getcpuregister(list,NR_D1);
                      cg.getcpuregister(list,NR_D1);
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg1, r));
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg1, r));
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg2, r2));
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg2, r2));
-                     cg.a_call_name(list,'FPC_MUL_LONGWORD',false);
+                     cg.a_call_name(list,'FPC_MUL_DWORD',false);
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,r, reg2));
                      list.concat(taicpu.op_reg_reg(A_MOVE,S_L,r, reg2));
                      cg.ungetcpuregister(list,r);
                      cg.ungetcpuregister(list,r);
                      cg.ungetcpuregister(list,r2);
                      cg.ungetcpuregister(list,r2);
@@ -1085,6 +1242,15 @@ unit cgcpu;
          a_jmp_cond(list,cmp_op,l);
          a_jmp_cond(list,cmp_op,l);
       end;
       end;
 
 
+    procedure tcg68k.a_jmp_name(list: TAsmList; const s: string);
+      var
+       ai: taicpu;
+      begin
+         ai := Taicpu.op_sym(A_JMP,S_NO,current_asmdata.RefAsmSymbol(s));
+         ai.is_jmp := true;
+         list.concat(ai);
+      end;
+
     procedure tcg68k.a_jmp_always(list : TAsmList;l: tasmlabel);
     procedure tcg68k.a_jmp_always(list : TAsmList;l: tasmlabel);
       var
       var
        ai: taicpu;
        ai: taicpu;
@@ -1274,7 +1440,14 @@ unit cgcpu;
                    a_label(list,hl);
                    a_label(list,hl);
                    list.concat(taicpu.op_ref_ref(A_MOVE,S_B,hp1,hp2));
                    list.concat(taicpu.op_ref_ref(A_MOVE,S_B,hp1,hp2));
                    a_label(list,hl2);
                    a_label(list,hl2);
-                   list.concat(taicpu.op_reg_sym(A_DBRA,S_L,hregister,hl));
+                   if current_settings.cputype=cpu_coldfire then
+                     begin
+                       { Coldfire does not support DBRA }
+                       list.concat(taicpu.op_const_reg(A_SUB,S_L,1,hregister));
+                       list.concat(taicpu.op_sym(A_BMI,S_L,hl));
+                     end
+                   else
+                     list.concat(taicpu.op_reg_sym(A_DBRA,S_L,hregister,hl));
                 end;
                 end;
 
 
               { restore the registers that we have just used olny if they are used! }
               { restore the registers that we have just used olny if they are used! }
@@ -1353,7 +1526,7 @@ unit cgcpu;
 
 
     procedure tcg68k.g_proc_exit(list : TAsmList; parasize: longint; nostackframe: boolean);
     procedure tcg68k.g_proc_exit(list : TAsmList; parasize: longint; nostackframe: boolean);
       var
       var
-//        r,hregister : TRegister;
+        r,hregister : TRegister;
         localsize: tcgint;
         localsize: tcgint;
         spr : TRegister;
         spr : TRegister;
         fpr : TRegister;
         fpr : TRegister;
@@ -1374,7 +1547,36 @@ unit cgcpu;
                 { only 68020+ supports RTD, so this needs another code path
                 { only 68020+ supports RTD, so this needs another code path
                   for 68000 and Coldfire (KB) }
                   for 68000 and Coldfire (KB) }
 { TODO: 68020+ only code generation, without fallback}
 { TODO: 68020+ only code generation, without fallback}
-                list.concat(taicpu.op_const(A_RTD,S_NO,parasize));
+                if current_settings.cputype=cpu_mc68020 then
+                  list.concat(taicpu.op_const(A_RTD,S_NO,parasize))
+                else
+                  begin
+
+                    { We must pull the PC Counter from the stack, before  }
+                    { restoring the stack pointer, otherwise the PC would }
+                    { point to nowhere!                                   }
+
+                    { save the PC counter (pop it from the stack)         }
+                    //hregister:=cg.getaddressregister(list);
+                    hregister:=NR_A3;
+                    cg.a_reg_alloc(list,hregister);
+                    reference_reset_base(ref,NR_STACK_POINTER_REG,0,4);
+                    ref.direction:=dir_inc;
+                    list.concat(taicpu.op_ref_reg(A_MOVE,S_L,ref,hregister));
+                    { can we do a quick addition ... }
+                    r:=NR_SP;
+                    if (parasize > 0) and (parasize < 9) then
+                       list.concat(taicpu.op_const_reg(A_ADDQ,S_L,parasize,r))
+                    else { nope ... }
+                       list.concat(taicpu.op_const_reg(A_ADD,S_L,parasize,r));
+
+                    { restore the PC counter (push it on the stack)       }
+                    reference_reset_base(ref,NR_STACK_POINTER_REG,0,4);
+                    ref.direction:=dir_dec;
+                    cg.a_reg_alloc(list,hregister);
+                    list.concat(taicpu.op_reg_ref(A_MOVE,S_L,hregister,ref));
+                    list.concat(taicpu.op_none(A_RTS,S_NO));
+                  end;
               end
               end
             else
             else
               list.concat(taicpu.op_none(A_RTS,S_NO));
               list.concat(taicpu.op_none(A_RTS,S_NO));

+ 3 - 3
compiler/m68k/cpubase.pas

@@ -254,9 +254,9 @@ unit cpubase;
       NR_STACK_POINTER_REG = NR_SP;
       NR_STACK_POINTER_REG = NR_SP;
       RS_STACK_POINTER_REG = RS_SP;
       RS_STACK_POINTER_REG = RS_SP;
       {# Frame pointer register }
       {# Frame pointer register }
-{ TODO: FIX ME!!! frame pointer is A5 on Amiga, but A6 on unixes?}
-      NR_FRAME_POINTER_REG = NR_A5;
-      RS_FRAME_POINTER_REG = RS_A5;
+{ Frame pointer register (initialized in tm68kprocinfo.init_framepointer) }
+      RS_FRAME_POINTER_REG: tsuperregister = RS_NO;
+      NR_FRAME_POINTER_REG: tregister = NR_NO;
 
 
       {# Register for addressing absolute data in a position independant way,
       {# Register for addressing absolute data in a position independant way,
          such as in PIC code. The exact meaning is ABI specific. For
          such as in PIC code. The exact meaning is ABI specific. For

+ 8 - 1
compiler/m68k/cpupara.pas

@@ -32,7 +32,7 @@ unit cpupara;
       cpubase,
       cpubase,
       aasmdata,
       aasmdata,
       symconst,symtype,symdef,symsym,
       symconst,symtype,symdef,symsym,
-      parabase,paramgr,cgbase;
+      parabase,paramgr,cgbase,cgutils;
 
 
     type
     type
        { Returns the location for the nr-st 32 Bit int parameter
        { Returns the location for the nr-st 32 Bit int parameter
@@ -49,6 +49,7 @@ unit cpupara;
           function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;override;
           function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;override;
           function parseparaloc(p : tparavarsym;const s : string) : boolean;override;
           function parseparaloc(p : tparavarsym;const s : string) : boolean;override;
           function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;override;
           function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;override;
+          function get_volatile_registers_int(calloption:tproccalloption):tcpuregisterset;override;
          private
          private
           procedure init_values(var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword);
           procedure init_values(var curintreg, curfloatreg: tsuperregister; var cur_stack_offset: aword);
           function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
           function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
@@ -469,6 +470,12 @@ unit cpupara;
         end;
         end;
       end;
       end;
 
 
+    function tm68kparamanager.get_volatile_registers_int(calloption:tproccalloption):tcpuregisterset;
+      begin
+        { for now we set all int registers as volatile }
+        Result:=[RS_D0..RS_D7];
+      end;
+
 
 
     function tm68kparamanager.parseparaloc(p : tparavarsym;const s : string) : boolean;
     function tm68kparamanager.parseparaloc(p : tparavarsym;const s : string) : boolean;
       var
       var

+ 24 - 1
compiler/m68k/cpupi.pas

@@ -28,14 +28,37 @@ unit cpupi;
   interface
   interface
 
 
     uses
     uses
-      procinfo,cgbase,psub;
+      psub;
 
 
     type
     type
       tm68kprocinfo = class(tcgprocinfo)
       tm68kprocinfo = class(tcgprocinfo)
+        procedure init_framepointer;override;
       end;
       end;
 
 
   implementation
   implementation
 
 
+    uses
+      procinfo,
+      cpubase,
+      systems;
+
+  { tm68kprocinfo }
+
+    procedure tm68kprocinfo.init_framepointer;
+      begin
+        { ToDo : what about system_m68k_embedded? }
+        if target_info.system in [system_m68k_linux,system_m68k_netbsd,system_m68k_openbsd] then
+          begin
+            RS_FRAME_POINTER_REG:=RS_A6;
+            NR_FRAME_POINTER_REG:=NR_A6;
+          end
+        else
+          begin
+            NR_FRAME_POINTER_REG:=NR_A5;
+            RS_FRAME_POINTER_REG:=RS_A5;
+          end;
+      end;
+
 begin
 begin
    cprocinfo:=tm68kprocinfo;
    cprocinfo:=tm68kprocinfo;
 end.
 end.

+ 35 - 10
compiler/m68k/n68kcnv.pas

@@ -43,7 +43,7 @@ implementation
       verbose,globals,systems,
       verbose,globals,systems,
       symconst,symdef,aasmbase,aasmtai,aasmdata,
       symconst,symdef,aasmbase,aasmtai,aasmdata,
       defutil,
       defutil,
-      cgbase,pass_1,pass_2,
+      cgbase,pass_1,pass_2,procinfo,
       ncon,ncal,
       ncon,ncal,
       ncgutil,
       ncgutil,
       cpubase,aasmcpu,
       cpubase,aasmcpu,
@@ -130,7 +130,7 @@ implementation
           internalerror(200110011);
           internalerror(200110011);
         { has to be handled by a helper }
         { has to be handled by a helper }
         if not signed then
         if not signed then
-           internalerror(20020814);
+           internalerror(2002081404);
 
 
         location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,opsize);
         location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,opsize);
         if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE]) then
         if not(left.location.loc in [LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE]) then
@@ -160,10 +160,16 @@ implementation
         resflags : tresflags;
         resflags : tresflags;
         opsize   : tcgsize;
         opsize   : tcgsize;
         newsize  : tcgsize;
         newsize  : tcgsize;
+        hlabel,
+        oldTrueLabel,
+        oldFalseLabel : tasmlabel;
       begin
       begin
-         secondpass(left);
+         oldTrueLabel:=current_procinfo.CurrTrueLabel;
+         oldFalseLabel:=current_procinfo.CurrFalseLabel;
+         current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel);
+         current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
 
 
-{ TODO: needs LOC_JUMP support, because called for bool_to_bool from ncgcnv }
+         secondpass(left);
 
 
          { Explicit typecasts from any ordinal type to a boolean type }
          { Explicit typecasts from any ordinal type to a boolean type }
          { must not change the ordinal value                          }
          { must not change the ordinal value                          }
@@ -178,10 +184,8 @@ implementation
                 hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,resultdef,true)
                 hlcg.location_force_reg(current_asmdata.CurrAsmList,location,left.resultdef,resultdef,true)
               else
               else
                 location.size:=newsize;
                 location.size:=newsize;
-{   ACTIVATE when loc_jump support is added
               current_procinfo.CurrTrueLabel:=oldTrueLabel;
               current_procinfo.CurrTrueLabel:=oldTrueLabel;
               current_procinfo.CurrFalseLabel:=oldFalseLabel;
               current_procinfo.CurrFalseLabel:=oldFalseLabel;
-}
               exit;
               exit;
            end;
            end;
 
 
@@ -221,13 +225,34 @@ implementation
                 hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
                 hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
                 resflags:=left.location.resflags;
                 resflags:=left.location.resflags;
               end;
               end;
+            LOC_JUMP :
+              begin
+                { for now blindly copied from nx86cnv }
+                location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
+                location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size);
+                current_asmdata.getjumplabel(hlabel);
+                cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel);
+                if not(is_cbool(resultdef)) then
+                  cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,1,location.register)
+                else
+                  cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,-1,location.register);
+                cg.a_jmp_always(current_asmdata.CurrAsmList,hlabel);
+                cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel);
+                cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,0,location.register);
+                cg.a_label(current_asmdata.CurrAsmList,hlabel);
+              end;
             else
             else
              internalerror(200512182);
              internalerror(200512182);
          end;
          end;
-         cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,hreg1);
-         if (is_cbool(resultdef)) then
-           cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,location.size,hreg1,hreg1);
-         location.register := hreg1;
+         if left.location.loc<>LOC_JUMP then
+           begin
+             cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,hreg1);
+             if (is_cbool(resultdef)) then
+               cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,location.size,hreg1,hreg1);
+             location.register := hreg1;
+           end;
+         current_procinfo.CurrTrueLabel:=oldTrueLabel;
+         current_procinfo.CurrFalseLabel:=oldFalseLabel;
       end;
       end;
 
 
 {
 {

+ 6 - 6
compiler/m68k/n68kmat.pas

@@ -145,7 +145,7 @@ implementation
      paraloc1 : tcgpara;
      paraloc1 : tcgpara;
    begin
    begin
      { no RTL call, so inline a zero denominator verification }
      { no RTL call, so inline a zero denominator verification }
-     if current_settings.cputype <> cpu_MC68000 then
+     if current_settings.cputype=cpu_MC68020 then
        begin
        begin
          { verify if denominator is zero }
          { verify if denominator is zero }
          current_asmdata.getjumplabel(continuelabel);
          current_asmdata.getjumplabel(continuelabel);
@@ -165,7 +165,7 @@ implementation
        end
        end
      else
      else
        begin
        begin
-         { On MC68000/68010 mw must pass through RTL routines }
+         { On MC68000/68010/Coldfire we must pass through RTL routines }
          reg_d0:=NR_D0;
          reg_d0:=NR_D0;
          cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0);
          cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0);
          reg_d1:=NR_D1;
          reg_d1:=NR_D1;
@@ -177,7 +177,7 @@ implementation
          if signed then
          if signed then
              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIV_LONGINT',false)
              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIV_LONGINT',false)
          else
          else
-             cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIV_CARDINAL',false);
+             cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIV_DWORD',false);
         cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,reg_d0,denum);
         cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,reg_d0,denum);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,reg_d0);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,reg_d0);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,reg_d1);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,reg_d1);
@@ -193,7 +193,7 @@ implementation
     begin
     begin
 //     writeln('emit mod reg reg');
 //     writeln('emit mod reg reg');
      { no RTL call, so inline a zero denominator verification }
      { no RTL call, so inline a zero denominator verification }
-     if current_settings.cputype <> cpu_MC68000 then
+     if current_settings.cputype=cpu_MC68020 then
        begin
        begin
          { verify if denominator is zero }
          { verify if denominator is zero }
          current_asmdata.getjumplabel(continuelabel);
          current_asmdata.getjumplabel(continuelabel);
@@ -228,7 +228,7 @@ implementation
        end
        end
      else
      else
        begin
        begin
-         { On MC68000/68010 mw must pass through RTL routines }
+         { On MC68000/68010/coldfire we must pass through RTL routines }
          Reg_d0:=NR_D0;
          Reg_d0:=NR_D0;
          cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0);
          cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0);
          Reg_d1:=NR_D1;
          Reg_d1:=NR_D1;
@@ -240,7 +240,7 @@ implementation
          if signed then
          if signed then
              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_MOD_LONGINT',false)
              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_MOD_LONGINT',false)
          else
          else
-             cg.a_call_name(current_asmdata.CurrAsmList,'FPC_MOD_CARDINAL',false);
+             cg.a_call_name(current_asmdata.CurrAsmList,'FPC_MOD_DWORD',false);
         cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,Reg_D0,denum);
         cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,Reg_D0,denum);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,Reg_D0);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,Reg_D0);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,Reg_D1);
         cg.ungetcpuregister(current_asmdata.CurrAsmList,Reg_D1);

+ 5 - 4
compiler/m68k/ra68kmot.pas

@@ -221,6 +221,7 @@ const
   var
   var
    token: tasmtoken;
    token: tasmtoken;
    forcelabel: boolean;
    forcelabel: boolean;
+   s : string;
   begin
   begin
     forcelabel := FALSE;
     forcelabel := FALSE;
     actasmpattern :='';
     actasmpattern :='';
@@ -504,7 +505,8 @@ const
                            end;
                            end;
             else
             else
              begin
              begin
-               Message(scan_f_illegal_char);
+               s:=c;
+               Message2(scan_f_illegal_char,s,'$'+hexstr(ord(c),2));
              end;
              end;
 
 
       end; { end case }
       end; { end case }
@@ -1585,7 +1587,6 @@ const
      AS_SEPARATOR, AS_COMMA: ;
      AS_SEPARATOR, AS_COMMA: ;
     else
     else
      begin
      begin
-      writeln('looofasz');
       Message(asmr_e_invalid_opcode_and_operand);
       Message(asmr_e_invalid_opcode_and_operand);
       Consume(actasmtoken);
       Consume(actasmtoken);
      end;
      end;
@@ -1697,7 +1698,7 @@ const
         hl: tasmlabel;
         hl: tasmlabel;
         instr : TM68kInstruction;
         instr : TM68kInstruction;
       begin
       begin
-        Message(asmr_d_start_reading);
+        //Message(asmr_d_start_reading);
         firsttoken := TRUE;
         firsttoken := TRUE;
         operandnum := 0;
         operandnum := 0;
         { sets up all opcode and register tables in uppercase }
         { sets up all opcode and register tables in uppercase }
@@ -1806,7 +1807,7 @@ const
         LocalLabelList.Free;
         LocalLabelList.Free;
 
 
         assemble:=curlist;
         assemble:=curlist;
-        Message(asmr_d_finish_reading);
+        //Message(asmr_d_finish_reading);
       end;
       end;
 
 
 
 

+ 9 - 3
compiler/mips/cpupi.pas

@@ -81,7 +81,7 @@ implementation
         { for testing }
         { for testing }
         needs_frame_pointer := true;//false;
         needs_frame_pointer := true;//false;
         computed_local_size:=-1;
         computed_local_size:=-1;
-        { pi_needs_got is not yet set correctly 
+        { pi_needs_got is not yet set correctly
           so include it always if creating PIC code }
           so include it always if creating PIC code }
         if (cs_create_pic in current_settings.moduleswitches) then
         if (cs_create_pic in current_settings.moduleswitches) then
           begin
           begin
@@ -101,8 +101,14 @@ implementation
         if tg.direction = -1 then
         if tg.direction = -1 then
           tg.setfirsttemp(0)
           tg.setfirsttemp(0)
         else
         else
-          tg.setfirsttemp(maxpushedparasize+
-           floatregssave*sizeof(aint)+intregssave*sizeof(aint));
+          begin
+            if not (po_nostackframe in procdef.procoptions) then
+              tg.setfirsttemp(Align(maxpushedparasize+
+                floatregssave*sizeof(aint)+intregssave*sizeof(aint)
+                ,max(current_settings.alignment.localalignmin,8)))
+            else
+              tg.setfirsttemp(align(maxpushedparasize,max(current_settings.alignment.localalignmin,8)));
+          end;
       end;
       end;
 
 
 
 

+ 2 - 2
compiler/ncal.pas

@@ -3293,8 +3293,8 @@ implementation
                               That means the for pushes the para with the
                               That means the for pushes the para with the
                               highest offset (see para3) needs to be pushed first
                               highest offset (see para3) needs to be pushed first
                             }
                             }
-{$if defined(i386)}
-                            { the i386 and jvm code generators expect all reference }
+{$if defined(i386) or defined(m68k)}
+                            { the i386, m68k and jvm code generators expect all reference }
                             { parameters to be in this order so they can use   }
                             { parameters to be in this order so they can use   }
                             { pushes in case of no fixed stack                 }
                             { pushes in case of no fixed stack                 }
                             if (not paramanager.use_fixed_stack and
                             if (not paramanager.use_fixed_stack and

+ 6 - 0
compiler/ncgutil.pas

@@ -639,6 +639,12 @@ implementation
               end
               end
             else
             else
 {$endif cpu64bitalu}
 {$endif cpu64bitalu}
+            { Note: for withs of records (and maybe objects, classes, etc.) an
+                    address register could be set here, but that is later
+                    changed to an intregister neverthless when in the
+                    tcgassignmentnode maybechangeloadnodereg is called for the
+                    temporary node; so the workaround for now is to fix the
+                    symptoms... }
               l.register:=cg.getintregister(list,l.size);
               l.register:=cg.getintregister(list,l.size);
           end;
           end;
       end;
       end;

+ 5 - 2
compiler/rgobj.pas

@@ -2056,9 +2056,11 @@ unit rgobj;
                   if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
                   if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
                     with ref^ do
                     with ref^ do
                       begin
                       begin
-                        if (base <> NR_NO) then
+                        if (base <> NR_NO) and
+                            (getregtype(base)=regtype) then
                           addreginfo(base,instr.spilling_get_operation_type_ref(counter,base));
                           addreginfo(base,instr.spilling_get_operation_type_ref(counter,base));
-                        if (index <> NR_NO) then
+                        if (index <> NR_NO) and
+                            (getregtype(index)=regtype) then
                           addreginfo(index,instr.spilling_get_operation_type_ref(counter,index));
                           addreginfo(index,instr.spilling_get_operation_type_ref(counter,index));
                       end;
                       end;
                 end;
                 end;
@@ -2219,6 +2221,7 @@ unit rgobj;
                 begin
                 begin
                   if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
                   if regtype in [R_INTREGISTER,R_ADDRESSREGISTER] then
                     begin
                     begin
+                      { no need to check for the register type here }
                       tryreplacereg(ref^.base);
                       tryreplacereg(ref^.base);
                       tryreplacereg(ref^.index);
                       tryreplacereg(ref^.index);
                     end;
                     end;

+ 4 - 1
compiler/sparc/cpupi.pas

@@ -67,7 +67,10 @@ implementation
           Alignment must be the max available, as doubles require
           Alignment must be the max available, as doubles require
           8 byte alignment
           8 byte alignment
         }
         }
-        result:=Align(tg.direction*tg.lasttemp+maxpushedparasize+target_info.first_parm_offset,current_settings.alignment.localalignmax);
+        if (po_nostackframe in procdef.procoptions) then
+          result:=Align(tg.direction*tg.lasttemp+maxpushedparasize,current_settings.alignment.localalignmax)
+        else
+          result:=Align(tg.direction*tg.lasttemp+maxpushedparasize+target_info.first_parm_offset,current_settings.alignment.localalignmax);
       end;
       end;
 
 
 
 

+ 18 - 5
packages/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/08/17]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/10/12]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
@@ -209,6 +209,14 @@ endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 linuxHier=1
 linuxHier=1
 endif
 endif
+ifndef CROSSCOMPILE
+BUILDFULLNATIVE=1
+export BUILDFULLNATIVE
+endif
+ifdef BUILDFULLNATIVE
+BUILDNATIVE=1
+export BUILDNATIVE
+endif
 export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
 export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
 ifdef FPCDIR
 ifdef FPCDIR
 override FPCDIR:=$(subst \,/,$(FPCDIR))
 override FPCDIR:=$(subst \,/,$(FPCDIR))
@@ -1642,6 +1650,8 @@ FPMAKE_OPT+=-bu
 .NOTPARALLEL:
 .NOTPARALLEL:
 fpmkunit_bootstrap:
 fpmkunit_bootstrap:
 	$(MAKE) -C fpmkunit bootstrap
 	$(MAKE) -C fpmkunit bootstrap
+fpmkunit_clean_bootstrap:
+	$(MAKE) -C fpmkunit clean_bootstrap
 fpmake: fpmake.pp fpmkunit_bootstrap
 fpmake: fpmake.pp fpmkunit_bootstrap
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
 all:	fpmake
 all:	fpmake
@@ -1653,15 +1663,18 @@ release:	fpmake
 debug:	fpmake
 debug:	fpmake
 	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
 	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-clean:	
+clean:	fpmkunit_clean_bootstrap
 else
 else
-clean:	
+clean:	fpmkunit_clean_bootstrap
 	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
 	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
 endif
 endif
+CLEAN_TARGET_DIRS=$(subst /Makefile, ,$(wildcard */Makefile))
+%_distclean:
+	$(MAKE) -C $* distclean
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
+distclean:	fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS)) fpmkunit_clean_bootstrap
 else
 else
-distclean:	
+distclean:	fpmkunit_clean_bootstrap
 ifdef inUnix
 ifdef inUnix
 	{ $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
 	{ $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
 else
 else

+ 11 - 5
packages/Makefile.fpc

@@ -60,6 +60,8 @@ FPMAKE_OPT+=-bu
 
 
 fpmkunit_bootstrap:
 fpmkunit_bootstrap:
 	$(MAKE) -C fpmkunit bootstrap
 	$(MAKE) -C fpmkunit bootstrap
+fpmkunit_clean_bootstrap:
+	$(MAKE) -C fpmkunit clean_bootstrap
 fpmake: fpmake.pp fpmkunit_bootstrap
 fpmake: fpmake.pp fpmkunit_bootstrap
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
 all:	fpmake
 all:	fpmake
@@ -74,18 +76,22 @@ debug:	fpmake
 # most often fail because the dependencies are cleared.
 # most often fail because the dependencies are cleared.
 # In case of a clean, simply do nothing
 # In case of a clean, simply do nothing
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-clean:	
+clean:	fpmkunit_clean_bootstrap
 else
 else
-clean:	
+clean:	fpmkunit_clean_bootstrap
 	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
 	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
 endif
 endif
+
+CLEAN_TARGET_DIRS=$(subst /Makefile, ,$(wildcard */Makefile))
+%_distclean:
+	$(MAKE) -C $* distclean
+
 # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
 # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
 # when the package is compiled using fpcmake prior to running this clean using fpmake
 # when the package is compiled using fpcmake prior to running this clean using fpmake
-# It does not work well, though, since the sub-directories are not cleaned at all.
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
+distclean:	fpc_cleanall $(addsuffix _distclean,$(CLEAN_TARGET_DIRS)) fpmkunit_clean_bootstrap
 else
 else
-distclean:	
+distclean:	fpmkunit_clean_bootstrap
 ifdef inUnix
 ifdef inUnix
         { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
         { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
 else
 else

+ 6 - 3
packages/fcl-base/src/base64.pp

@@ -87,7 +87,7 @@ type
   end;
   end;
 
 
 function EncodeStringBase64(const s:string):String;
 function EncodeStringBase64(const s:string):String;
-function DecodeStringBase64(const s:string):String;
+function DecodeStringBase64(const s:string;strict:boolean=false):String;
 
 
 implementation
 implementation
 
 
@@ -417,7 +417,7 @@ begin
   raise EStreamError.Create('Invalid stream operation');
   raise EStreamError.Create('Invalid stream operation');
 end;
 end;
 
 
-function DecodeStringBase64(const s:string):String;
+function DecodeStringBase64(const s:string;strict:boolean=false):String;
 
 
 var 
 var 
   Instream, 
   Instream, 
@@ -428,7 +428,10 @@ begin
   try
   try
     Outstream:=TStringStream.Create('');
     Outstream:=TStringStream.Create('');
     try 
     try 
-      Decoder:=TBase64DecodingStream.Create(Instream,bdmMIME);
+      if strict then
+        Decoder:=TBase64DecodingStream.Create(Instream,bdmStrict)
+      else
+        Decoder:=TBase64DecodingStream.Create(Instream,bdmMIME);
       try
       try
          Outstream.CopyFrom(Decoder,Decoder.Size);
          Outstream.CopyFrom(Decoder,Decoder.Size);
          Result:=Outstream.DataString;
          Result:=Outstream.DataString;

+ 1 - 1
packages/fcl-db/Makefile.fpc.fpcmake

@@ -18,7 +18,7 @@ dirs_solaris=src/dbase src/sqlite
 dirs_netbsd=src/dbase src/sqlite src/paradox
 dirs_netbsd=src/dbase src/sqlite src/paradox
 dirs_openbsd=src/dbase src/sqlite src/paradox
 dirs_openbsd=src/dbase src/sqlite src/paradox
 dirs_win32=src/dbase src/paradox src/sqlite src/export src/datadict src/codegen 
 dirs_win32=src/dbase src/paradox src/sqlite src/export src/datadict src/codegen 
-dirs_win64=src/dbase src/export src/datadict src/codegen 
+dirs_win64=src/dbase src/sqlite src/export src/datadict src/codegen
 dirs_wince=src/dbase src/sqlite src/export src/datadict src/codegen
 dirs_wince=src/dbase src/sqlite src/export src/datadict src/codegen
 
 
 [require]
 [require]

+ 17 - 1
packages/fcl-db/fpmake.pp

@@ -11,7 +11,7 @@ const
   ParadoxOSes         = [beos,haiku,linux,freebsd,netbsd,openbsd,win32];
   ParadoxOSes         = [beos,haiku,linux,freebsd,netbsd,openbsd,win32];
   DatadictOSes        = [aix,beos,darwin,haiku,linux,freebsd,win32,win64,wince];
   DatadictOSes        = [aix,beos,darwin,haiku,linux,freebsd,win32,win64,wince];
   SqldbConnectionOSes = [aix,beos,haiku,linux,freebsd,darwin,iphonesim,netbsd,openbsd,solaris,win32,win64,wince];
   SqldbConnectionOSes = [aix,beos,haiku,linux,freebsd,darwin,iphonesim,netbsd,openbsd,solaris,win32,win64,wince];
-  SqliteOSes          = [aix,beos,haiku,linux,freebsd,darwin,iphonesim,netbsd,openbsd,solaris,win32,wince];
+  SqliteOSes          = [aix,beos,haiku,linux,freebsd,darwin,iphonesim,netbsd,openbsd,solaris,win32,win64,wince];
   DBaseOSes           = [aix,beos,haiku,linux,freebsd,darwin,iphonesim,netbsd,openbsd,solaris,win32,win64,wince];
   DBaseOSes           = [aix,beos,haiku,linux,freebsd,darwin,iphonesim,netbsd,openbsd,solaris,win32,win64,wince];
   MSSQLOSes           = [beos,haiku,linux,freebsd,netbsd,openbsd,solaris,win32,win64];
   MSSQLOSes           = [beos,haiku,linux,freebsd,netbsd,openbsd,solaris,win32,win64];
   SqldbWithoutOracleOSes   = [win64];
   SqldbWithoutOracleOSes   = [win64];
@@ -412,6 +412,22 @@ begin
           AddUnit('fpddsqldb');
           AddUnit('fpddsqldb');
           AddUnit('mysql50conn');
           AddUnit('mysql50conn');
         end;
         end;
+    T:=P.Targets.AddUnit('fpddmysql51.pp', DatadictOSes);
+      with T.Dependencies do
+        begin
+          AddUnit('sqldb');
+          AddUnit('fpdatadict');
+          AddUnit('fpddsqldb');
+          AddUnit('mysql51conn');
+        end;
+    T:=P.Targets.AddUnit('fpddmysql55.pp', DatadictOSes);
+      with T.Dependencies do
+        begin
+          AddUnit('sqldb');
+          AddUnit('fpdatadict');
+          AddUnit('fpddsqldb');
+          AddUnit('mysql55conn');
+        end;
     T:=P.Targets.AddUnit('fpddodbc.pp', DatadictOSes);
     T:=P.Targets.AddUnit('fpddodbc.pp', DatadictOSes);
       with T.Dependencies do
       with T.Dependencies do
         begin
         begin

+ 13 - 11
packages/fcl-db/src/base/xmldatapacketreader.pp

@@ -347,38 +347,40 @@ begin
     AFieldNode := FRecordNode.Attributes.GetNamedItem(FieldDefs[FieldNr].Name);
     AFieldNode := FRecordNode.Attributes.GetNamedItem(FieldDefs[FieldNr].Name);
     if assigned(AFieldNode) then
     if assigned(AFieldNode) then
       begin
       begin
-      if FieldDefs[FieldNr].DataType in [ftMemo,ftBlob] then
+       s := AFieldNode.NodeValue;
+       AField := Fields.FieldByNumber(FieldDefs[FieldNr].FieldNo);
+       if (FieldDefs[FieldNr].DataType in [ftBlob, ftBytes, ftVarBytes]) and (s <> '') then
+         s := DecodeStringBase64(s);
+       if FieldDefs[FieldNr].DataType in [ftBlob, ftMemo] then
         begin
         begin
         ABufBlobField.BlobBuffer:=ADataset.GetNewBlobBuffer;
         ABufBlobField.BlobBuffer:=ADataset.GetNewBlobBuffer;
-        afield := Fields.FieldByNumber(FieldDefs[FieldNr].FieldNo);
         AField.SetData(@ABufBlobField);
         AField.SetData(@ABufBlobField);
-        s := AFieldNode.NodeValue;
-        if (FieldDefs[FieldNr].DataType = ftBlob) and (s<>'') then
-          s := DecodeStringBase64(s);
         ABufBlobField.BlobBuffer^.Size:=length(s);
         ABufBlobField.BlobBuffer^.Size:=length(s);
         ReAllocMem(ABufBlobField.BlobBuffer^.Buffer,ABufBlobField.BlobBuffer^.Size);
         ReAllocMem(ABufBlobField.BlobBuffer^.Buffer,ABufBlobField.BlobBuffer^.Size);
         move(s[1],ABufBlobField.BlobBuffer^.Buffer^,ABufBlobField.BlobBuffer^.Size);
         move(s[1],ABufBlobField.BlobBuffer^.Buffer^,ABufBlobField.BlobBuffer^.Size);
         end
         end
       else
       else
-        Fields.FieldByNumber(FieldDefs[FieldNr].FieldNo).AsString := AFieldNode.NodeValue;  // set it to the filterbuffer
+        AField.AsString := s;  // set it to the filterbuffer
       end
       end
     end;
     end;
 end;
 end;
 
 
 procedure TXMLDatapacketReader.StoreRecord(ADataset : TCustomBufDataset; ARowState : TRowState; AUpdOrder : integer = 0);
 procedure TXMLDatapacketReader.StoreRecord(ADataset : TCustomBufDataset; ARowState : TRowState; AUpdOrder : integer = 0);
 var FieldNr : Integer;
 var FieldNr : Integer;
-    AField: TField;
+    AFieldDef: TFieldDef;
+    s: string;
     ARecordNode : TDOMElement;
     ARecordNode : TDOMElement;
 begin
 begin
   inc(FEntryNr);
   inc(FEntryNr);
   ARecordNode := XMLDocument.CreateElement('ROW');
   ARecordNode := XMLDocument.CreateElement('ROW');
   for FieldNr := 0 to ADataset.FieldDefs.Count-1 do
   for FieldNr := 0 to ADataset.FieldDefs.Count-1 do
     begin
     begin
-    AField := ADataset.Fields.FieldByNumber(ADataset.FieldDefs[FieldNr].FieldNo);
-    if AField.DataType=ftBlob then
-      ARecordNode.SetAttribute(AField.FieldName,EncodeStringBase64(AField.AsString))
+    AFieldDef := ADataset.FieldDefs[FieldNr];
+    s := ADataset.Fields.FieldByNumber(AFieldDef.FieldNo).AsString;
+    if AFieldDef.DataType in [ftBlob, ftBytes, ftVarBytes] then
+      ARecordNode.SetAttribute(AFieldDef.Name, EncodeStringBase64(s))
     else
     else
-      ARecordNode.SetAttribute(AField.FieldName,AField.AsString);
+      ARecordNode.SetAttribute(AFieldDef.Name, s);
     end;
     end;
   if ARowState<>[] then
   if ARowState<>[] then
     begin
     begin

+ 83 - 183
packages/fcl-db/src/datadict/Makefile

@@ -1,10 +1,10 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/04/25]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/07/16]
 #
 #
 default: all
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) solaris qnx haiku aix
+UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
 LIMIT83fs = go32v2 os2 emx watcom
 OSNeedsComspecToRunBatch = go32v2 watcom
 OSNeedsComspecToRunBatch = go32v2 watcom
 FORCE:
 FORCE:
@@ -153,6 +153,12 @@ ifdef OS_TARGET_DEFAULT
 OS_TARGET=$(OS_TARGET_DEFAULT)
 OS_TARGET=$(OS_TARGET_DEFAULT)
 endif
 endif
 endif
 endif
+ifneq ($(words $(FPC_COMPILERINFO)),5)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTP)
+FPC_COMPILERINFO+=$(shell $(FPC) -iSO)
+FPC_COMPILERINFO+=$(shell $(FPC) -iTO)
+endif
 ifndef CPU_SOURCE
 ifndef CPU_SOURCE
 CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
 CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
 endif
 endif
@@ -295,19 +301,19 @@ endif
 override PACKAGE_NAME=fcl-db
 override PACKAGE_NAME=fcl-db
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-db/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-db/Makefile.fpc,$(PACKAGESDIR))))))
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -316,7 +322,7 @@ ifeq ($(FULL_TARGET),i386-haiku)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -328,13 +334,13 @@ ifeq ($(FULL_TARGET),i386-netware)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -358,16 +364,16 @@ ifeq ($(FULL_TARGET),i386-nativent)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -376,7 +382,7 @@ ifeq ($(FULL_TARGET),m68k-atari)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -385,10 +391,10 @@ ifeq ($(FULL_TARGET),m68k-embedded)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -397,7 +403,7 @@ ifeq ($(FULL_TARGET),powerpc-macos)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -408,14 +414,11 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc-aix)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
@@ -424,22 +427,16 @@ ifeq ($(FULL_TARGET),sparc-embedded)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
-ifeq ($(FULL_TARGET),x86_64-netbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 ifeq ($(FULL_TARGET),x86_64-solaris)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-openbsd)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddodbc fpddsqlite3
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddodbc fpddsqlite3
@@ -448,13 +445,13 @@ ifeq ($(FULL_TARGET),x86_64-embedded)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddsqlite3
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddsqlite3
@@ -472,46 +469,40 @@ ifeq ($(FULL_TARGET),arm-symbian)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc64-aix)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb
 endif
 endif
-ifeq ($(FULL_TARGET),mips-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_UNITS+=fpdatadict fpdddiff fpdddbf fpddsqldb  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -520,7 +511,7 @@ ifeq ($(FULL_TARGET),i386-haiku)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -532,13 +523,13 @@ ifeq ($(FULL_TARGET),i386-netware)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -562,16 +553,16 @@ ifeq ($(FULL_TARGET),i386-nativent)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -580,7 +571,7 @@ ifeq ($(FULL_TARGET),m68k-atari)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -589,10 +580,10 @@ ifeq ($(FULL_TARGET),m68k-embedded)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -601,7 +592,7 @@ ifeq ($(FULL_TARGET),powerpc-macos)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -612,14 +603,11 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc-aix)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
@@ -628,22 +616,16 @@ ifeq ($(FULL_TARGET),sparc-embedded)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
-ifeq ($(FULL_TARGET),x86_64-netbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 ifeq ($(FULL_TARGET),x86_64-solaris)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-openbsd)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddpq fpddodbc fpddsqlite3
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddpq fpddodbc fpddsqlite3
@@ -652,13 +634,13 @@ ifeq ($(FULL_TARGET),x86_64-embedded)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddpq fpddsqlite3
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddpq fpddsqlite3
@@ -676,31 +658,25 @@ ifeq ($(FULL_TARGET),arm-symbian)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc64-aix)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff
 endif
 endif
-ifeq ($(FULL_TARGET),mips-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+override TARGET_RSTS+=fpdatadict fpddfb fpddsqldb fpdddiff  fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 endif
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
@@ -817,9 +793,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc-aix)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
@@ -838,15 +811,9 @@ endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-netbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 ifeq ($(FULL_TARGET),x86_64-solaris)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-openbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 ifeq ($(FULL_TARGET),x86_64-darwin)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
@@ -889,9 +856,6 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc64-aix)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
@@ -901,9 +865,6 @@ endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
-ifeq ($(FULL_TARGET),mips-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 override COMPILER_OPTIONS+=-S2h
 override COMPILER_OPTIONS+=-S2h
 endif
 endif
@@ -1259,11 +1220,6 @@ EXEEXT=.dol
 SHAREDLIBEXT=.so
 SHAREDLIBEXT=.so
 SHORTSUFFIX=wii
 SHORTSUFFIX=wii
 endif
 endif
-ifeq ($(OS_TARGET),aix)
-BATCHEXT=.sh
-EXEEXT=
-SHORTSUFFIX=aix
-endif
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
@@ -1496,6 +1452,25 @@ DATESTR:=$(shell $(DATE) +%Y%m%d)
 else
 else
 DATESTR=
 DATESTR=
 endif
 endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
 ZIPOPT=-9
 ZIPOPT=-9
 ZIPEXT=.zip
 ZIPEXT=.zip
 ifeq ($(USETAR),bz2)
 ifeq ($(USETAR),bz2)
@@ -1938,21 +1913,6 @@ REQUIRE_PACKAGES_FPMKUNIT=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-XML=1
 REQUIRE_PACKAGES_FCL-XML=1
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc-aix)
-REQUIRE_PACKAGES_RTL=1
-REQUIRE_PACKAGES_PASZLIB=1
-REQUIRE_PACKAGES_FCL-PROCESS=1
-REQUIRE_PACKAGES_HASH=1
-REQUIRE_PACKAGES_FPMKUNIT=1
-REQUIRE_PACKAGES_FCL-BASE=1
-REQUIRE_PACKAGES_FCL-XML=1
-REQUIRE_PACKAGES_IBASE=1
-REQUIRE_PACKAGES_MYSQL=1
-REQUIRE_PACKAGES_ORACLE=1
-REQUIRE_PACKAGES_SQLITE=1
-REQUIRE_PACKAGES_ODBC=1
-REQUIRE_PACKAGES_POSTGRES=1
-endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
@@ -2031,21 +1991,6 @@ REQUIRE_PACKAGES_SQLITE=1
 REQUIRE_PACKAGES_ODBC=1
 REQUIRE_PACKAGES_ODBC=1
 REQUIRE_PACKAGES_POSTGRES=1
 REQUIRE_PACKAGES_POSTGRES=1
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-netbsd)
-REQUIRE_PACKAGES_RTL=1
-REQUIRE_PACKAGES_PASZLIB=1
-REQUIRE_PACKAGES_FCL-PROCESS=1
-REQUIRE_PACKAGES_HASH=1
-REQUIRE_PACKAGES_FPMKUNIT=1
-REQUIRE_PACKAGES_FCL-BASE=1
-REQUIRE_PACKAGES_FCL-XML=1
-REQUIRE_PACKAGES_IBASE=1
-REQUIRE_PACKAGES_MYSQL=1
-REQUIRE_PACKAGES_ORACLE=1
-REQUIRE_PACKAGES_SQLITE=1
-REQUIRE_PACKAGES_ODBC=1
-REQUIRE_PACKAGES_POSTGRES=1
-endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
 ifeq ($(FULL_TARGET),x86_64-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
@@ -2055,21 +2000,6 @@ REQUIRE_PACKAGES_FPMKUNIT=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-XML=1
 REQUIRE_PACKAGES_FCL-XML=1
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-openbsd)
-REQUIRE_PACKAGES_RTL=1
-REQUIRE_PACKAGES_PASZLIB=1
-REQUIRE_PACKAGES_FCL-PROCESS=1
-REQUIRE_PACKAGES_HASH=1
-REQUIRE_PACKAGES_FPMKUNIT=1
-REQUIRE_PACKAGES_FCL-BASE=1
-REQUIRE_PACKAGES_FCL-XML=1
-REQUIRE_PACKAGES_IBASE=1
-REQUIRE_PACKAGES_MYSQL=1
-REQUIRE_PACKAGES_ORACLE=1
-REQUIRE_PACKAGES_SQLITE=1
-REQUIRE_PACKAGES_ODBC=1
-REQUIRE_PACKAGES_POSTGRES=1
-endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
 ifeq ($(FULL_TARGET),x86_64-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
@@ -2234,21 +2164,6 @@ REQUIRE_PACKAGES_FPMKUNIT=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-XML=1
 REQUIRE_PACKAGES_FCL-XML=1
 endif
 endif
-ifeq ($(FULL_TARGET),powerpc64-aix)
-REQUIRE_PACKAGES_RTL=1
-REQUIRE_PACKAGES_PASZLIB=1
-REQUIRE_PACKAGES_FCL-PROCESS=1
-REQUIRE_PACKAGES_HASH=1
-REQUIRE_PACKAGES_FPMKUNIT=1
-REQUIRE_PACKAGES_FCL-BASE=1
-REQUIRE_PACKAGES_FCL-XML=1
-REQUIRE_PACKAGES_IBASE=1
-REQUIRE_PACKAGES_MYSQL=1
-REQUIRE_PACKAGES_ORACLE=1
-REQUIRE_PACKAGES_SQLITE=1
-REQUIRE_PACKAGES_ODBC=1
-REQUIRE_PACKAGES_POSTGRES=1
-endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
@@ -2282,21 +2197,6 @@ REQUIRE_PACKAGES_FPMKUNIT=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-XML=1
 REQUIRE_PACKAGES_FCL-XML=1
 endif
 endif
-ifeq ($(FULL_TARGET),mips-linux)
-REQUIRE_PACKAGES_RTL=1
-REQUIRE_PACKAGES_PASZLIB=1
-REQUIRE_PACKAGES_FCL-PROCESS=1
-REQUIRE_PACKAGES_HASH=1
-REQUIRE_PACKAGES_FPMKUNIT=1
-REQUIRE_PACKAGES_FCL-BASE=1
-REQUIRE_PACKAGES_FCL-XML=1
-REQUIRE_PACKAGES_IBASE=1
-REQUIRE_PACKAGES_MYSQL=1
-REQUIRE_PACKAGES_ORACLE=1
-REQUIRE_PACKAGES_SQLITE=1
-REQUIRE_PACKAGES_ODBC=1
-REQUIRE_PACKAGES_POSTGRES=1
-endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
@@ -2822,16 +2722,12 @@ endif
 ifndef CROSSBOOTSTRAP
 ifndef CROSSBOOTSTRAP
 ifneq ($(BINUTILSPREFIX),)
 ifneq ($(BINUTILSPREFIX),)
 override FPCOPT+=-XP$(BINUTILSPREFIX)
 override FPCOPT+=-XP$(BINUTILSPREFIX)
+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
 endif
 endif
 ifneq ($(BINUTILSPREFIX),)
 ifneq ($(BINUTILSPREFIX),)
 override FPCOPT+=-Xr$(RLINKPATH)
 override FPCOPT+=-Xr$(RLINKPATH)
 endif
 endif
 endif
 endif
-ifndef CROSSCOMPILE
-ifneq ($(BINUTILSPREFIX),)
-override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
-endif
-endif
 ifdef UNITDIR
 ifdef UNITDIR
 override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
 endif
 endif
@@ -3075,6 +2971,9 @@ endif
 fpc_install: all $(INSTALLTARGET)
 fpc_install: all $(INSTALLTARGET)
 ifdef INSTALLEXEFILES
 ifdef INSTALLEXEFILES
 	$(MKDIR) $(INSTALL_BINDIR)
 	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
 	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
 	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
 endif
 endif
 ifdef INSTALL_CREATEPACKAGEFPC
 ifdef INSTALL_CREATEPACKAGEFPC
@@ -3247,6 +3146,7 @@ fpc_baseinfo:
 	@$(ECHO)  Date...... $(DATE)
 	@$(ECHO)  Date...... $(DATE)
 	@$(ECHO)  FPCMake... $(FPCMAKE)
 	@$(ECHO)  FPCMake... $(FPCMAKE)
 	@$(ECHO)  PPUMove... $(PPUMOVE)
 	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Upx....... $(UPXPROG)
 	@$(ECHO)  Zip....... $(ZIPPROG)
 	@$(ECHO)  Zip....... $(ZIPPROG)
 	@$(ECHO)
 	@$(ECHO)
 	@$(ECHO)  == Object info ==
 	@$(ECHO)  == Object info ==

+ 16 - 16
packages/fcl-db/src/datadict/Makefile.fpc

@@ -20,27 +20,27 @@ packages_aix=ibase mysql oracle sqlite odbc postgres
 
 
 [target]
 [target]
 units=fpdatadict fpdddiff fpdddbf fpddsqldb
 units=fpdatadict fpdddiff fpdddbf fpddsqldb
-units_linux=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-units_freebsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-units_darwin=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-units_iphonesim=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-units_netbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-units_openbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-units_win32=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+units_linux=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+units_freebsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55 
+units_darwin=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+units_iphonesim=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+units_netbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+units_openbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+units_win32=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 units_wince=fpddsqlite3
 units_wince=fpddsqlite3
 units_win64=fpddodbc fpddsqlite3
 units_win64=fpddodbc fpddsqlite3
-units_aix=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+units_aix=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 rsts=fpdatadict fpddfb fpddsqldb fpdddiff
 rsts=fpdatadict fpddfb fpddsqldb fpdddiff
-rsts_linux=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-rsts_freebsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-rsts_darwin=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-rsts_iphonesim=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-rsts_netbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-rsts_openbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
-rsts_win32=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+rsts_linux=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+rsts_freebsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+rsts_darwin=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+rsts_iphonesim=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+rsts_netbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+rsts_openbsd=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
+rsts_win32=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 rsts_wince=fpddfb fpddpq fpddsqlite3
 rsts_wince=fpddfb fpddpq fpddsqlite3
 rsts_win64=fpddfb fpddpq fpddodbc fpddsqlite3
 rsts_win64=fpddfb fpddpq fpddodbc fpddsqlite3
-rsts_aix=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd
+rsts_aix=fpddfb fpddmysql40 fpddmysql41 fpddmysql50 fpddodbc fpddpq fpddoracle fpddsqlite3 fpddregstd fpddmysql51 fpddmysql55
 
 
 [compiler]
 [compiler]
 options=-S2h
 options=-S2h

+ 74 - 0
packages/fcl-db/src/datadict/fpddmysql51.pp

@@ -0,0 +1,74 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by Michael Van Canneyt, member of the
+    Free Pascal development team
+
+    MySQL 5.1 Data Dictionary Engine Implementation.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit fpddmysql51;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, sqldb, fpdatadict, fpddsqldb;
+  
+Type
+  { TSQLDBMySql51DDEngine }
+
+  TSQLDBMySql51DDEngine = Class(TSQLDBDDEngine)
+  Protected
+    Function CreateConnection(AConnectString  : String) : TSQLConnection; override;
+  Public
+    Class function Description : string; override;
+    Class function DBType : String; override;
+  end;
+
+Procedure RegisterMySQL51DDEngine;
+Procedure UnRegisterMySQL51DDEngine;
+
+implementation
+
+uses mysql51conn;
+
+Procedure RegisterMySQL51DDEngine;
+
+begin
+  RegisterDictionaryEngine(TSQLDBMySQL51DDEngine);
+end;
+
+Procedure UnRegisterMySQL51DDEngine;
+
+begin
+  UnRegisterDictionaryEngine(TSQLDBMySQL51DDEngine);
+end;
+
+{ TSQLDBMySql51DDEngine }
+
+function TSQLDBMySql51DDEngine.CreateConnection(AConnectString: String
+  ): TSQLConnection;
+begin
+  Result:=mysql51conn.TMySQL51Connection.Create(Self);
+end;
+
+class function TSQLDBMySql51DDEngine.Description: string;
+begin
+  Result:='Mysql 5.1 connection using SQLDB';
+end;
+
+class function TSQLDBMySql51DDEngine.DBType: String;
+begin
+  Result:='MySQL 5.1';
+end;
+
+end.
+

+ 74 - 0
packages/fcl-db/src/datadict/fpddmysql55.pp

@@ -0,0 +1,74 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2007 by Michael Van Canneyt, member of the
+    Free Pascal development team
+
+    MySQL 5.5 Data Dictionary Engine Implementation.
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit fpddmysql55;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, sqldb, fpdatadict, fpddsqldb;
+  
+Type
+  { TSQLDBMySql55DDEngine }
+
+  TSQLDBMySql55DDEngine = Class(TSQLDBDDEngine)
+  Protected
+    Function CreateConnection(AConnectString  : String) : TSQLConnection; override;
+  Public
+    Class function Description : string; override;
+    Class function DBType : String; override;
+  end;
+
+Procedure RegisterMySQL55DDEngine;
+Procedure UnRegisterMySQL55DDEngine;
+
+implementation
+
+uses mysql55conn;
+
+Procedure RegisterMySQL55DDEngine;
+
+begin
+  RegisterDictionaryEngine(TSQLDBMySQL55DDEngine);
+end;
+
+Procedure UnRegisterMySQL55DDEngine;
+
+begin
+  UnRegisterDictionaryEngine(TSQLDBMySQL55DDEngine);
+end;
+
+{ TSQLDBMySql55DDEngine }
+
+function TSQLDBMySql55DDEngine.CreateConnection(AConnectString: String
+  ): TSQLConnection;
+begin
+  Result:=mysql55conn.TMySQL55Connection.Create(Self);
+end;
+
+class function TSQLDBMySql55DDEngine.Description: string;
+begin
+  Result:='Mysql 5.5 connection using SQLDB';
+end;
+
+class function TSQLDBMySql55DDEngine.DBType: String;
+begin
+  Result:='MySQL 5.5';
+end;
+
+end.
+

+ 5 - 5
packages/fcl-db/src/sqldb/interbase/ibconnection.pp

@@ -1049,7 +1049,7 @@ end;
 {$IFDEF SUPPORT_MSECS}
 {$IFDEF SUPPORT_MSECS}
 const
 const
   IBDateOffset = 15018; //an offset from 17 Nov 1858.
   IBDateOffset = 15018; //an offset from 17 Nov 1858.
-  IBSecsCount  = SecsPerDay * 10000; //count of 1/10000 seconds since midnight.
+  IBTimeFractionsPerDay  = SecsPerDay * ISC_TIME_SECONDS_PRECISION; //Number of Firebird time fractions per day
 {$ENDIF}
 {$ENDIF}
 
 
 procedure TIBConnection.GetDateTime(CurrBuff, Buffer : pointer; AType : integer);
 procedure TIBConnection.GetDateTime(CurrBuff, Buffer : pointer; AType : integer);
@@ -1071,7 +1071,7 @@ begin
       {$IFNDEF SUPPORT_MSECS}
       {$IFNDEF SUPPORT_MSECS}
       isc_decode_sql_time(PISC_TIME(CurrBuff), @CTime);
       isc_decode_sql_time(PISC_TIME(CurrBuff), @CTime);
       {$ELSE}
       {$ELSE}
-      PTime :=  PISC_TIME(CurrBuff)^ / IBSecsCount;
+      PTime :=  PISC_TIME(CurrBuff)^ / IBTimeFractionsPerDay;
       {$ENDIF}
       {$ENDIF}
     SQL_TIMESTAMP :
     SQL_TIMESTAMP :
       begin
       begin
@@ -1080,7 +1080,7 @@ begin
       {$ELSE}
       {$ELSE}
       PTime := ComposeDateTime(
       PTime := ComposeDateTime(
                   PISC_TIMESTAMP(CurrBuff)^.timestamp_date - IBDateOffset,
                   PISC_TIMESTAMP(CurrBuff)^.timestamp_date - IBDateOffset,
-                  PISC_TIMESTAMP(CurrBuff)^.timestamp_time / IBSecsCount
+                  PISC_TIMESTAMP(CurrBuff)^.timestamp_time / IBTimeFractionsPerDay
                );
                );
       {$ENDIF}
       {$ENDIF}
       end
       end
@@ -1130,7 +1130,7 @@ begin
       {$IFNDEF SUPPORT_MSECS}
       {$IFNDEF SUPPORT_MSECS}
       isc_encode_sql_time(@CTime, PISC_TIME(CurrBuff));
       isc_encode_sql_time(@CTime, PISC_TIME(CurrBuff));
       {$ELSE}
       {$ELSE}
-      PISC_TIME(CurrBuff)^ := Trunc(abs(Frac(PTime)) * IBSecsCount);
+      PISC_TIME(CurrBuff)^ := Trunc(abs(Frac(PTime)) * IBTimeFractionsPerDay);
       {$ENDIF}
       {$ENDIF}
     SQL_TIMESTAMP :
     SQL_TIMESTAMP :
       begin
       begin
@@ -1138,7 +1138,7 @@ begin
       isc_encode_timestamp(@CTime, PISC_TIMESTAMP(CurrBuff));
       isc_encode_timestamp(@CTime, PISC_TIMESTAMP(CurrBuff));
       {$ELSE}
       {$ELSE}
       PISC_TIMESTAMP(CurrBuff)^.timestamp_date := Trunc(PTime) + IBDateOffset;
       PISC_TIMESTAMP(CurrBuff)^.timestamp_date := Trunc(PTime) + IBDateOffset;
-      PISC_TIMESTAMP(CurrBuff)^.timestamp_time := Trunc(abs(Frac(PTime)) * IBSecsCount);
+      PISC_TIMESTAMP(CurrBuff)^.timestamp_time := Trunc(abs(Frac(PTime)) * IBTimeFractionsPerDay);
       {$ENDIF}
       {$ENDIF}
       end
       end
   else
   else

+ 11 - 0
packages/fcl-db/tests/database.ini.txt

@@ -116,10 +116,21 @@ name=test.db
 connector=sql
 connector=sql
 connectorparams=mssql
 connectorparams=mssql
 name=pubs
 name=pubs
+; If you want to use trusted authentication/SSPI, leave
+; user and password blank
 user=sa
 user=sa
 password=
 password=
 hostname=127.0.0.1
 hostname=127.0.0.1
 
 
+; Sybase ASE database
+[sybase]
+connector=sql
+connectorparams=sybase
+name=testdb
+usser=sa
+password=
+hostname=127.0.0.1
+
 ; TDBf: DBase/FoxPro database:
 ; TDBf: DBase/FoxPro database:
 [dbf]
 [dbf]
 connector=dbf
 connector=dbf

+ 7 - 4
packages/fcl-db/tests/sqldbtoolsunit.pas

@@ -19,11 +19,11 @@ uses
   ,mssqlconn
   ,mssqlconn
   ;
   ;
 
 
-type TSQLDBTypes = (mysql40,mysql41,mysql50,mysql51,mysql55,postgresql,interbase,odbc,oracle,sqlite3,mssql);
+type TSQLDBTypes = (mysql40,mysql41,mysql50,mysql51,mysql55,postgresql,interbase,odbc,oracle,sqlite3,mssql,sybase);
 
 
 const MySQLdbTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
 const MySQLdbTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
       DBTypesNames : Array [TSQLDBTypes] of String[19] =
       DBTypesNames : Array [TSQLDBTypes] of String[19] =
-        ('MYSQL40','MYSQL41','MYSQL50','MYSQL51','MYSQL55','POSTGRESQL','INTERBASE','ODBC','ORACLE','SQLITE3','MSSQL');
+        ('MYSQL40','MYSQL41','MYSQL50','MYSQL51','MYSQL55','POSTGRESQL','INTERBASE','ODBC','ORACLE','SQLITE3','MSSQL','SYBASE');
              
              
       FieldtypeDefinitionsConst : Array [TFieldType] of String[20] =
       FieldtypeDefinitionsConst : Array [TFieldType] of String[20] =
         (
         (
@@ -168,7 +168,8 @@ begin
   {$IFNDEF Win64}
   {$IFNDEF Win64}
   if SQLDbType = ORACLE then Fconnection := TOracleConnection.Create(nil);
   if SQLDbType = ORACLE then Fconnection := TOracleConnection.Create(nil);
   {$ENDIF Win64}
   {$ENDIF Win64}
-  if SQLDbType = MSSQL then
+  if SQLDbType in [MSSQL,Sybase] then
+    // todo: Sybase: copied over MSSQL; verify correctness
     begin
     begin
     Fconnection := TMSSQLConnection.Create(nil);
     Fconnection := TMSSQLConnection.Create(nil);
     FieldtypeDefinitions[ftBoolean] := 'BIT';
     FieldtypeDefinitions[ftBoolean] := 'BIT';
@@ -194,7 +195,7 @@ begin
         testValues[ftDateTime,t] := copy(testValues[ftDateTime,t],1,19)+'.000';
         testValues[ftDateTime,t] := copy(testValues[ftDateTime,t],1,19)+'.000';
       end;
       end;
     end;
     end;
-  if SQLDbType in [postgresql,interbase,mssql] then
+  if SQLDbType in [postgresql,interbase,mssql,sybase] then
     begin
     begin
     // Some db's do not support times > 24:00:00
     // Some db's do not support times > 24:00:00
     testTimeValues[3]:='13:25:15.000';
     testTimeValues[3]:='13:25:15.000';
@@ -216,6 +217,7 @@ begin
   // SQLite does not support fixed length CHAR datatype
   // SQLite does not support fixed length CHAR datatype
   // MySQL by default trimms trailing spaces on retrieval; so set sql-mode="PAD_CHAR_TO_FULL_LENGTH" - supported from MySQL 5.1.20
   // MySQL by default trimms trailing spaces on retrieval; so set sql-mode="PAD_CHAR_TO_FULL_LENGTH" - supported from MySQL 5.1.20
   // MSSQL set SET ANSI_PADDING ON
   // MSSQL set SET ANSI_PADDING ON
+  // todo: verify Sybase behaviour
   if SQLDbType in [sqlite3] then
   if SQLDbType in [sqlite3] then
     for t := 0 to testValuesCount-1 do
     for t := 0 to testValuesCount-1 do
       testValues[ftFixedChar,t] := PadRight(testValues[ftFixedChar,t], 10);
       testValues[ftFixedChar,t] := PadRight(testValues[ftFixedChar,t], 10);
@@ -237,6 +239,7 @@ begin
       if not(fileexists(dbname)) then
       if not(fileexists(dbname)) then
         FConnection.CreateDB; //Create testdb
         FConnection.CreateDB; //Create testdb
     end;
     end;
+
     if length(dbQuoteChars)>1 then
     if length(dbQuoteChars)>1 then
       begin
       begin
         FieldNameQuoteChars:=dbquotechars;
         FieldNameQuoteChars:=dbquotechars;

+ 34 - 11
packages/fcl-db/tests/testfieldtypes.pas

@@ -1293,7 +1293,10 @@ begin
       sqlite3:
       sqlite3:
         statements := TTestStatements.Create('pragma table_info(FPDEV)');
         statements := TTestStatements.Create('pragma table_info(FPDEV)');
       interbase:
       interbase:
-        statements := TTestStatements.Create(CTE_SELECT (*FB 2.1*));
+        statements := TTestStatements.Create(
+          CTE_SELECT (*FB 2.1*),
+          'EXECUTE BLOCK RETURNS (U VARCHAR(255)) AS BEGIN SELECT rdb$get_context(''SYSTEM'',''CURRENT_USER'') FROM rdb$database INTO U; SUSPEND; END' (*FB 2.0*)
+        );
       postgresql:
       postgresql:
         statements := TTestStatements.Create(CTE_SELECT);
         statements := TTestStatements.Create(CTE_SELECT);
       mssql:
       mssql:
@@ -1495,6 +1498,8 @@ begin
 end;
 end;
 
 
 procedure TTestFieldTypes.TestInsertLargeStrFields;
 procedure TTestFieldTypes.TestInsertLargeStrFields;
+const
+  FieldValue='test1';
 begin
 begin
   with TSQLDBConnector(DBConnector) do
   with TSQLDBConnector(DBConnector) do
     begin
     begin
@@ -1507,11 +1512,11 @@ begin
     TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
     TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
     query.sql.Text:='select * from FPDEV2';
     query.sql.Text:='select * from FPDEV2';
     Query.Open;
     Query.Open;
-    Query.InsertRecord([1,'test1']);
+    Query.InsertRecord([1,FieldValue]);
     Query.ApplyUpdates;
     Query.ApplyUpdates;
     Query.Close;
     Query.Close;
     Query.Open;
     Query.Open;
-    AssertEquals(query.FieldByName('NAME').AsString,'test1');
+    AssertEquals(query.FieldByName('NAME').AsString,FieldValue);
     query.Close;
     query.Close;
     end;
     end;
 end;
 end;
@@ -2027,19 +2032,37 @@ end;
 
 
 procedure TTestFieldTypes.TestTemporaryTable;
 procedure TTestFieldTypes.TestTemporaryTable;
 begin
 begin
-  if SQLDbType in [interbase,mssql] then Ignore('This test does not apply to this sqldb-connection type, since it doesn''t support temporary tables');
+  if SQLDbType in [mssql] then Ignore('This test does not apply to this sqldb-connection type, since it doesn''t support temporary tables');
 
 
   with TSQLDBConnector(DBConnector).Query do
   with TSQLDBConnector(DBConnector).Query do
     begin
     begin
     SQL.Clear;
     SQL.Clear;
-    SQL.Add('CREATE TEMPORARY TABLE TEMP1 (id int)');
-    ExecSQL;
-    SQL.Text := 'INSERT INTO TEMP1(id) values (5)';
+    if SQLDbType=interbase then
+      // Global temporary table: introduced in Firebird 2.1
+      // has persistent metadata; data is per transaction (default) or per connection
+      SQL.Add('CREATE GLOBAL TEMPORARY TABLE FPDEV_TEMP (id int)')
+    else
+      SQL.Add('CREATE TEMPORARY TABLE FPDEV_TEMP (id int)');
     ExecSQL;
     ExecSQL;
-    SQL.Text := 'SELECT * FROM TEMP1';
-    Open;
-    AssertEquals(5,fields[0].AsInteger);
-    Close;
+    try
+      // Firebird/Interbase needs a commit after DDL:
+      TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
+
+      SQL.Text := 'INSERT INTO FPDEV_TEMP(id) values (5)';
+      ExecSQL;
+      SQL.Text := 'SELECT * FROM FPDEV_TEMP';
+      Open;
+      AssertEquals(5, Fields[0].AsInteger);
+      Close;
+    finally
+      // For Firebird/Interbase, we need to explicitly delete the table as well (it's active within the transaction)
+      if SQLDbType=interbase then
+        begin
+        SQL.Text := 'DROP TABLE FPDEV_TEMP';
+        ExecSQL;
+        TSQLDBConnector(DBConnector).Transaction.CommitRetaining;
+        end;
+    end;
     end;
     end;
 end;
 end;
 
 

+ 77 - 54
packages/fcl-registry/src/regini.inc

@@ -5,57 +5,50 @@
 
 
 constructor TRegIniFile.Create(const FN: String);
 constructor TRegIniFile.Create(const FN: String);
 begin
 begin
-  inherited Create;
-  fFileName := FN;
-  if fFileName<>'' then
-   fPath := fFileName + '\'
-  else
-   fPath := '';
+  Create(FN, KEY_ALL_ACCESS);
 end;
 end;
 
 
 constructor TRegIniFile.Create(const FN: String;aaccess:longword);
 constructor TRegIniFile.Create(const FN: String;aaccess:longword);
 begin
 begin
   inherited Create(aaccess);
   inherited Create(aaccess);
   fFileName := FN;
   fFileName := FN;
-  if fFileName<>'' then
-   fPath := fFileName + '\'
+  if fFileName<>'' then begin
+    fPath := fFileName + '\';
+    OpenKey(fFileName, aaccess <> KEY_READ);
+  end
   else
   else
-   fPath := '';
+    fPath := '';
+  fPreferStringValues:=True; // Delphi compatibility
 end;
 end;
 
 
 procedure TRegIniFile.DeleteKey(const Section, Ident: String);
 procedure TRegIniFile.DeleteKey(const Section, Ident: String);
 begin
 begin
-	if not OpenKey(fPath+Section,true) then Exit;
-	try
-	 DeleteValue(Ident);
-	finally
-	 CloseKey;
-	end;
+  if OpenSection(Section) then
+  try
+    DeleteValue(Ident);
+  finally
+    CloseSection;
+  end;
 end;
 end;
 
 
 procedure TRegIniFile.EraseSection(const Section: string);
 procedure TRegIniFile.EraseSection(const Section: string);
 begin
 begin
- inherited DeleteKey(fPath+Section);
+  inherited DeleteKey(Section);
 end;
 end;
 
 
 procedure TRegIniFile.ReadSection(const Section: string; Strings: TStrings);
 procedure TRegIniFile.ReadSection(const Section: string; Strings: TStrings);
 begin
 begin
-	if not OpenKey(fPath+Section,false) then Exit;
-	try
-	 GetValueNames(Strings);
-	finally
-	 CloseKey;
-	end;
+  if OpenSection(Section) then
+  try
+    GetValueNames(Strings);
+  finally
+    CloseSection;
+  end;
 end;
 end;
 
 
 procedure TRegIniFile.ReadSections(Strings: TStrings);
 procedure TRegIniFile.ReadSections(Strings: TStrings);
 begin
 begin
-	if not OpenKey(fFileName,false) then Exit;
-	try
-	 GetKeyNames(Strings);
-	finally
-	 CloseKey;
-	end;
+  GetKeyNames(Strings);
 end;
 end;
 
 
 procedure TRegIniFile.ReadSectionValues(const Section: string; Strings: TStrings);
 procedure TRegIniFile.ReadSectionValues(const Section: string; Strings: TStrings);
@@ -64,24 +57,27 @@ var
  V : String;
  V : String;
  i : Integer;
  i : Integer;
 begin
 begin
-	if not OpenKey(fPath+Section,false) then Exit;
-	ValList := TStringList.Create;
-	try
-	 GetValueNames(ValList);
-	 for i:=0 to ValList.Count-1 do
-	 begin
-	   V := inherited ReadString(ValList.Strings[i]);
-	   Strings.Add(ValList.Strings[i] + '=' + V);
-	 end;
-	finally
-	 ValList.Free;
-	 CloseKey;
-	end;
+  if OpenSection(Section) then
+  try
+ 	  ValList := TStringList.Create;
+ 	  try
+      GetValueNames(ValList);
+      for i:=0 to ValList.Count-1 do
+      begin
+        V := inherited ReadString(ValList.Strings[i]);
+        Strings.Add(ValList.Strings[i] + '=' + V);
+      end;
+ 	  finally
+      ValList.Free;
+ 	  end;
+  finally
+    CloseSection;
+  end;
 end;
 end;
 
 
 procedure TRegIniFile.WriteBool(const Section, Ident: string; Value: Boolean);
 procedure TRegIniFile.WriteBool(const Section, Ident: string; Value: Boolean);
 begin
 begin
-	if not OpenKey(fPath+Section,true) then Exit;
+  if OpenSection(Section) then
 	try
 	try
     if not fPreferStringValues then
     if not fPreferStringValues then
   	  inherited WriteBool(Ident,Value)
   	  inherited WriteBool(Ident,Value)
@@ -92,13 +88,13 @@ begin
         inherited WriteString(Ident,BoolToStr(Value));
         inherited WriteString(Ident,BoolToStr(Value));
     end;
     end;
   finally
   finally
-	  CloseKey;
+    CloseSection;
 	end;
 	end;
 end;
 end;
 
 
 procedure TRegIniFile.WriteInteger(const Section, Ident: string; Value: LongInt);
 procedure TRegIniFile.WriteInteger(const Section, Ident: string; Value: LongInt);
 begin
 begin
-  if not OpenKey(fPath+Section,true) then Exit;
+  if OpenSection(Section) then
   try
   try
     if not fPreferStringValues then
     if not fPreferStringValues then
       inherited WriteInteger(Ident,Value)
       inherited WriteInteger(Ident,Value)
@@ -109,24 +105,24 @@ begin
         inherited WriteString(Ident,IntToStr(Value));
         inherited WriteString(Ident,IntToStr(Value));
     end;
     end;
   finally
   finally
-    CloseKey;
+    CloseSection;
   end;
   end;
 end;
 end;
 
 
 procedure TRegIniFile.WriteString(const Section, Ident, Value: String);
 procedure TRegIniFile.WriteString(const Section, Ident, Value: String);
 begin
 begin
-  if not OpenKey(fPath+Section,true) then Exit;
+  if OpenSection(Section) then
   try
   try
-   inherited WriteString(Ident,Value);
+    inherited WriteString(Ident,Value);
   finally
   finally
-   CloseKey;
+    CloseSection;
   end;
   end;
 end;
 end;
 
 
 function TRegIniFile.ReadBool(const Section, Ident: string; Default: Boolean): Boolean;
 function TRegIniFile.ReadBool(const Section, Ident: string; Default: Boolean): Boolean;
 begin
 begin
 	Result := Default;
 	Result := Default;
-	if not OpenKey(fPath+Section,false) then Exit;
+  if OpenSection(Section) then
 	try
 	try
     if ValueExists(Ident) then
     if ValueExists(Ident) then
       if (not fPreferStringValues) or (GetDataType(Ident)=rdInteger) then
       if (not fPreferStringValues) or (GetDataType(Ident)=rdInteger) then
@@ -134,14 +130,14 @@ begin
       else
       else
         Result := StrToBool(inherited ReadString(Ident));
         Result := StrToBool(inherited ReadString(Ident));
 	finally
 	finally
-	  CloseKey;
+    CloseSection;
 	end;
 	end;
 end;
 end;
 
 
 function TRegIniFile.ReadInteger(const Section, Ident: string; Default: LongInt): LongInt;
 function TRegIniFile.ReadInteger(const Section, Ident: string; Default: LongInt): LongInt;
 begin
 begin
   Result := Default;
   Result := Default;
-  if not OpenKey(fPath+Section,false) then Exit;
+  if OpenSection(Section) then
   try
   try
     if ValueExists(Ident) then
     if ValueExists(Ident) then
       if (not fPreferStringValues) or (GetDataType(Ident)=rdInteger) then
       if (not fPreferStringValues) or (GetDataType(Ident)=rdInteger) then
@@ -149,18 +145,45 @@ begin
       else
       else
         Result := StrToInt(inherited ReadString(Ident));
         Result := StrToInt(inherited ReadString(Ident));
   finally
   finally
-    CloseKey;
+    CloseSection;
   end;
   end;
 end;
 end;
 
 
 function TRegIniFile.ReadString(const Section, Ident, Default: String): String;
 function TRegIniFile.ReadString(const Section, Ident, Default: String): String;
 begin
 begin
   Result := Default;
   Result := Default;
-  if not OpenKey(fPath+Section,false) then Exit;
+  if OpenSection(Section) then
   try
   try
     if ValueExists(Ident) then
     if ValueExists(Ident) then
       Result := inherited ReadString(Ident);
       Result := inherited ReadString(Ident);
   finally
   finally
-    CloseKey;
+    CloseSection;
   end;
   end;
 end;
 end;
+
+function TRegIniFile.OpenSection(const Section: string): boolean;
+var
+  k: HKEY;
+begin
+  ASSERT(fOldCurKey = 0);
+  if Section <> '' then begin
+    k:=GetKey(Section);
+    if k = 0 then begin
+      Result:=False;
+      exit;
+    end;
+    fOldCurKey:=CurrentKey;
+    SetCurrentKey(k);
+  end;
+  Result:=True;
+end;
+
+procedure TRegIniFile.CloseSection;
+begin
+  if fOldCurKey <> 0 then begin
+    CloseKey(CurrentKey);
+    SetCurrentKey(fOldCurKey);
+    fOldCurKey:=0;
+  end;
+end;
+

+ 82 - 261
packages/fcl-registry/src/registry.pp

@@ -46,7 +46,9 @@ type
   TRegistry = class(TObject)
   TRegistry = class(TObject)
   private
   private
     FStringSizeIncludesNull : Boolean;
     FStringSizeIncludesNull : Boolean;
+{$ifdef XMLREG}
     FSysData : Pointer;
     FSysData : Pointer;
+{$endif XMLREG}
     fAccess: LongWord;
     fAccess: LongWord;
     fCurrentKey: HKEY;
     fCurrentKey: HKEY;
     fRootKey: HKEY;
     fRootKey: HKEY;
@@ -133,6 +135,10 @@ type
     fFileName          : String;
     fFileName          : String;
     fPath              : String;
     fPath              : String;
     fPreferStringValues: Boolean;
     fPreferStringValues: Boolean;
+    fOldCurKey         : HKEY;
+
+    function OpenSection(const Section: string): boolean;
+    procedure CloseSection;
   public
   public
     constructor Create(const FN: string); overload;
     constructor Create(const FN: string); overload;
     constructor Create(const FN: string;aaccess:longword); overload;
     constructor Create(const FN: string;aaccess:longword); overload;
@@ -186,6 +192,7 @@ type
     procedure EraseSection(const Section: string); override;
     procedure EraseSection(const Section: string); override;
     procedure DeleteKey(const Section, Name: String); override;
     procedure DeleteKey(const Section, Name: String); override;
     procedure UpdateFile; override;
     procedure UpdateFile; override;
+    function ValueExists(const Section, Ident: string): Boolean; override;
     property RegIniFile: TRegIniFile read FRegIniFile;
     property RegIniFile: TRegIniFile read FRegIniFile;
   end;
   end;
 
 
@@ -337,9 +344,6 @@ end;
 
 
 function TRegistry.ReadCurrency(const Name: string): Currency;
 function TRegistry.ReadCurrency(const Name: string): Currency;
 
 
-Var
-  RegDataType: TRegDataType;
-
 begin
 begin
   ReadBinaryData(Name, Result, SizeOf(Currency));
   ReadBinaryData(Name, Result, SizeOf(Currency));
 end;
 end;
@@ -352,8 +356,6 @@ begin
 end;
 end;
 
 
 function TRegistry.ReadDateTime(const Name: string): TDateTime;
 function TRegistry.ReadDateTime(const Name: string): TDateTime;
-Var
-  RegDataType: TRegDataType;
 
 
 begin
 begin
   ReadBinaryData(Name, Result, SizeOf(TDateTime));
   ReadBinaryData(Name, Result, SizeOf(TDateTime));
@@ -493,122 +495,53 @@ end;
 
 
 function TRegistryIniFile.ReadDate(const Section, Name: string;
 function TRegistryIniFile.ReadDate(const Section, Name: string;
   Default: TDateTime): TDateTime;
   Default: TDateTime): TDateTime;
-var sectkey,curkey : HKey;
-begin 
+begin
+  Result:=Default;
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              if ValueExists(Name) THen 
-                result:=FRegIniFile.ReadDate(Name)
-              else
-                result:=default;
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-       else
-         result:=default; 
-    end;          
+    if OpenSection(Section) then
+      try
+        if ValueExists(Name) then
+          Result:=FRegInifile.ReadDate(Name);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 function TRegistryIniFile.ReadDateTime(const Section, Name: string;
 function TRegistryIniFile.ReadDateTime(const Section, Name: string;
   Default: TDateTime): TDateTime;
   Default: TDateTime): TDateTime;
-var sectkey,curkey : HKey;  
 begin
 begin
+  Result:=Default;
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              if ValueExists(Name) THen 
-                result:=FRegIniFile.ReadDateTime(Name)
-              else
-                result:=default;
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-       else
-         result:=default; 
-    end;          
+    if OpenSection(Section) then
+      try
+        if ValueExists(Name) then
+          Result:=FRegInifile.ReadDateTime(Name);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 function TRegistryIniFile.ReadFloat(const Section, Name: string;
 function TRegistryIniFile.ReadFloat(const Section, Name: string;
   Default: Double): Double;
   Default: Double): Double;
-var sectkey,curkey : HKey;  
 begin
 begin
+  Result:=Default;
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              if ValueExists(Name) THen 
-                result:=FRegIniFile.ReadFloat(Name)
-              else
-                result:=default;
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-       else
-         result:=default; 
-    end;          
+    if OpenSection(Section) then
+      try
+        if ValueExists(Name) then
+          Result:=FRegInifile.ReadFloat(Name);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 function TRegistryIniFile.ReadInteger(const Section, Name: string;
 function TRegistryIniFile.ReadInteger(const Section, Name: string;
   Default: Integer): Longint;
   Default: Integer): Longint;
-var sectkey,curkey : HKey;  
 begin
 begin
-  with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              if ValueExists(Name) THen 
-                result:=FRegIniFile.ReadInteger(section,Name,default)
-              else
-                result:=default;
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-       else
-         result:=default; 
-    end;          
-end;
-
-procedure TRegistryIniFile.ReadSection(const Section: string;
-  Strings: TStrings);
+  Result:=FRegInifile.ReadInteger(Section, Name, Default);
+end;
+
+procedure TRegistryIniFile.ReadSection(const Section: string; Strings: TStrings);
 begin
 begin
   FRegIniFile.ReadSection(Section,strings);
   FRegIniFile.ReadSection(Section,strings);
 end;
 end;
@@ -626,60 +559,22 @@ end;
 
 
 function TRegistryIniFile.ReadString(const Section, Name,
 function TRegistryIniFile.ReadString(const Section, Name,
   Default: string): string;
   Default: string): string;
-var sectkey,curkey : HKey;  
 begin
 begin
-  with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              if ValueExists(Name) THen 
-                result:=FRegIniFile.ReadString(section,Name,default)
-              else
-                result:=default;
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-       else
-         result:=default; 
-    end;          
+  Result:=FRegInifile.ReadString(Section, Name, Default);
 end;
 end;
 
 
 function TRegistryIniFile.ReadTime(const Section, Name: string;
 function TRegistryIniFile.ReadTime(const Section, Name: string;
   Default: TDateTime): TDateTime;
   Default: TDateTime): TDateTime;
-var sectkey,curkey : HKey;  
 begin
 begin
+  Result:=Default;
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              if ValueExists(Name) THen 
-                result:=FRegIniFile.ReadTime(Name)
-              else
-                result:=default;
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-       else
-         result:=default; 
-    end;          
+    if OpenSection(Section) then
+      try
+        if ValueExists(Name) then
+          Result:=FRegInifile.ReadTime(Name);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 procedure TRegistryIniFile.UpdateFile;
 procedure TRegistryIniFile.UpdateFile;
@@ -695,146 +590,72 @@ end;
 
 
 procedure TRegistryIniFile.WriteDate(const Section, Name: string;
 procedure TRegistryIniFile.WriteDate(const Section, Name: string;
   Value: TDateTime);
   Value: TDateTime);
-var sectkey,curkey : HKey;  
 begin
 begin
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              FRegIniFile.WriteDate(name,value)
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-    end;          
+    if OpenSection(Section) then
+      try
+        FRegInifile.WriteDate(Name, Value);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 procedure TRegistryIniFile.WriteDateTime(const Section, Name: string;
 procedure TRegistryIniFile.WriteDateTime(const Section, Name: string;
   Value: TDateTime);
   Value: TDateTime);
-var sectkey,curkey : HKey;  
 begin
 begin
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              FRegIniFile.WriteDateTime(Name,value)
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-    end;
+    if OpenSection(Section) then
+      try
+        FRegInifile.WriteDateTime(Name, Value);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 procedure TRegistryIniFile.WriteFloat(const Section, Name: string;
 procedure TRegistryIniFile.WriteFloat(const Section, Name: string;
   Value: Double);
   Value: Double);
-var sectkey,curkey : HKey;  
 begin
 begin
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              FRegIniFile.WriteFloat(Name,value)
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-    end;          
+    if OpenSection(Section) then
+      try
+        FRegInifile.WriteFloat(Name, Value);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 procedure TRegistryIniFile.WriteInteger(const Section, Name: string;
 procedure TRegistryIniFile.WriteInteger(const Section, Name: string;
   Value: Integer);
   Value: Integer);
-var sectkey,curkey : HKey;  
 begin
 begin
-  with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              FRegIniFile.WriteInteger(section,Name,value)
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-    end;          
-
+  FRegInifile.WriteInteger(Section, Name, Value);
 end;
 end;
 
 
 procedure TRegistryIniFile.WriteString(const Section, Name, Value: String);
 procedure TRegistryIniFile.WriteString(const Section, Name, Value: String);
-var sectkey,curkey : HKey;  
 begin
 begin
-  with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin           
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;               
-            SetCurrentKey(sectKey);
-            try             // save current key
-              FRegIniFile.WriteString(section,Name,value)
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-    end;
+  FRegInifile.WriteString(Section, Name, Value);
 end;
 end;
 
 
 procedure TRegistryIniFile.WriteTime(const Section, Name: string;
 procedure TRegistryIniFile.WriteTime(const Section, Name: string;
   Value: TDateTime);
   Value: TDateTime);
-var sectkey,curkey : HKey;
 begin
 begin
   with FRegInifile do
   with FRegInifile do
-    begin
-      sectkey:=getkey(Section);
-      if sectkey<>0 then
-        begin
-          try // allocation ok
-            curkey:=FRegIniFile.CurrentKey;
-            SetCurrentKey(sectKey);
-            try             // save current key
-              FRegIniFile.WriteTime(Name,value)
-            finally
-              SetCurrentKey(CurKey);
-              end;
-          finally
-            closekey(sectkey);
-            end;
-        end
-    end;
+    if OpenSection(Section) then
+      try
+        FRegInifile.WriteTime(Name, Value);
+      finally
+        CloseSection;
+      end;
+end;
+
+function TRegistryIniFile.ValueExists(const Section, Ident: string): Boolean;
+begin
+  with FRegInifile do
+    if OpenSection(Section) then
+      try
+        Result:=FRegInifile.ValueExists(Ident);
+      finally
+        CloseSection;
+      end;
 end;
 end;
 
 
 end.
 end.

+ 19 - 12
packages/fcl-registry/src/winreg.inc

@@ -177,7 +177,7 @@ Var
   Handle: HKEY;
   Handle: HKEY;
   Disposition: Integer;
   Disposition: Integer;
   SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES;
   SecurityAttributes: Pointer; //LPSECURITY_ATTRIBUTES;
-
+  S: string;
 begin
 begin
   SecurityAttributes := Nil;
   SecurityAttributes := Nil;
   P:=PrepKey(Key);
   P:=PrepKey(Key);
@@ -194,21 +194,27 @@ begin
   else
   else
     Result:=RegOpenKeyExA(GetBaseKey(RelativeKey(Key)),
     Result:=RegOpenKeyExA(GetBaseKey(RelativeKey(Key)),
                          P,0,fAccess,Handle)=ERROR_SUCCESS;
                          P,0,fAccess,Handle)=ERROR_SUCCESS;
-  If Result then
-    fCurrentKey:=Handle;
+  If Result then begin
+    if RelativeKey(Key) then
+      S:=CurrentPath + Key
+    else
+      S:=P;
+    ChangeKey(Handle, S);
+  end;
 end;
 end;
 
 
 function TRegistry.OpenKeyReadOnly(const Key: string): Boolean;
 function TRegistry.OpenKeyReadOnly(const Key: string): Boolean;
 
 
 Var
 Var
-  P: PChar;
-  Handle: HKEY;
-
+  OldAccess: LongWord;
 begin
 begin
-  P:=PrepKey(Key);
-  Result := RegOpenKeyExA(GetBaseKey(RelativeKey(Key)),P,0,KEY_READ,Handle) = 0;
-  If Result Then
-    fCurrentKey := Handle;
+  OldAccess:=fAccess;
+  fAccess:=KEY_READ;
+  try
+    Result:=OpenKey(Key, False);
+  finally
+    fAccess:=OldAccess;
+  end;
 end;
 end;
 
 
 function TRegistry.RegistryConnect(const UNCName: string): Boolean;
 function TRegistry.RegistryConnect(const UNCName: string): Boolean;
@@ -254,12 +260,13 @@ begin
     else
     else
       RegFlushKey(CurrentKey);
       RegFlushKey(CurrentKey);
     fCurrentKey:=0;
     fCurrentKey:=0;
-    end
+    end;
+  fCurrentPath:='';
 end;
 end;
 
 
 procedure TRegistry.CloseKey(key:HKEY);
 procedure TRegistry.CloseKey(key:HKEY);
 begin
 begin
-  RegCloseKey(CurrentKey)
+  RegCloseKey(key);
 end;
 end;
 
 
 procedure TRegistry.ChangeKey(Value: HKey; const Path: String);
 procedure TRegistry.ChangeKey(Value: HKey; const Path: String);

+ 24 - 4
packages/fcl-registry/tests/testbasics.pp

@@ -22,12 +22,17 @@ type
     procedure TestSimpleWinRegistry;
     procedure TestSimpleWinRegistry;
     procedure TestDoubleWrite;
     procedure TestDoubleWrite;
     procedure bug16395;
     procedure bug16395;
+    procedure TestAdv;
   end;
   end;
 
 
 implementation
 implementation
 
 
 uses
 uses
-  registry;
+  registry
+{$ifdef windows}
+  , tregistry2
+{$endif windows}
+  ;
 
 
 { TTestBasics }
 { TTestBasics }
 
 
@@ -37,7 +42,14 @@ var
   fn: string;
   fn: string;
 {$endif}
 {$endif}
 begin
 begin
-{$ifndef windows}
+{$ifdef windows}
+  with TRegistry.Create do
+    try
+      DeleteKey('FirstNode');
+    finally
+      Free;
+    end;
+{$else}
   FN:=includetrailingpathdelimiter(GetAppConfigDir(False))+'reg.xml';
   FN:=includetrailingpathdelimiter(GetAppConfigDir(False))+'reg.xml';
   if FileExists(FN) then
   if FileExists(FN) then
     AssertTrue(DeleteFile(FN));
     AssertTrue(DeleteFile(FN));
@@ -65,7 +77,7 @@ begin
   DeleteUserXmlFile;
   DeleteUserXmlFile;
   with TRegistry.Create do
   with TRegistry.Create do
     try
     try
-      OpenKey('test', true);
+      OpenKey('FirstNode', true);
       WriteString('LAYOUT', '');
       WriteString('LAYOUT', '');
       CloseKey;
       CloseKey;
     finally
     finally
@@ -73,7 +85,7 @@ begin
     end;
     end;
   with TRegistry.Create do
   with TRegistry.Create do
     try
     try
-      OpenKey('test', true);
+      OpenKey('FirstNode', true);
       WriteString('LAYOUT', '');
       WriteString('LAYOUT', '');
       CloseKey;
       CloseKey;
     finally
     finally
@@ -140,6 +152,14 @@ begin
   DeleteUserXmlFile;
   DeleteUserXmlFile;
 end;
 end;
 
 
+procedure TTestBasics.TestAdv;
+begin
+{$ifdef windows}
+  DoRegTest2;
+{$endif windows}
+end;
+
 initialization
 initialization
   RegisterTest(TTestBasics);
   RegisterTest(TTestBasics);
 end.
 end.
+

+ 113 - 0
packages/fcl-registry/tests/tregistry2.pp

@@ -0,0 +1,113 @@
+{$ifdef FPC} {$mode delphi}  {$endif}
+unit tregistry2;
+
+interface
+
+procedure DoRegTest2;
+
+implementation
+
+uses Windows, SysUtils, Classes, registry;
+
+const
+  STestRegPath = 'Software\FPC-RegTest';
+  
+procedure TestFailed(ErrCode: integer);
+begin
+  raise Exception.Create('Test FAILED. Error code: ' + IntToStr(ErrCode));
+end;
+
+procedure ClearReg;
+begin
+  with TRegistry.Create do
+    try
+      DeleteKey(STestRegPath + '\1');
+      DeleteKey(STestRegPath);
+    finally
+      Free;
+    end;
+end;
+
+procedure DoRegTest2;
+var
+  reg: TRegistry;
+  ri: TRegIniFile;
+  rini: TRegistryIniFile;
+  sl: TStringList;
+begin
+  ClearReg;
+  reg:=TRegistry.Create;
+  try
+    if not reg.OpenKey(STestRegPath, True) then
+      TestFailed(1);
+    if reg.CurrentPath <> STestRegPath then
+      TestFailed(2);
+    reg.WriteString('Item1', '1');
+    if not reg.OpenKey('\' + STestRegPath + '\1', True) then
+      TestFailed(3);
+    reg.WriteString('Item2', '2');
+    if reg.CurrentPath <> STestRegPath + '\1' then
+      TestFailed(5);
+    reg.CloseKey;
+    if reg.CurrentPath <> '' then
+      TestFailed(6);
+
+    ri:=TRegIniFile.Create(STestRegPath);
+    with ri do
+    try
+      if ReadString('', 'Item1', '') <> '1' then
+        TestFailed(10);
+      if ReadString('1', 'Item2', '') <> '2' then
+        TestFailed(11);
+      if ReadString('', 'Item1', '') <> '1' then
+        TestFailed(12);
+      if not ValueExists('Item1') then
+        TestFailed(13);
+
+      WriteInteger('1', 'Item3', 3);
+
+      sl:=TStringList.Create;
+      try
+        ReadSectionValues('1', sl);
+        if sl.Count <> 2 then
+          TestFailed(14);
+        if sl.Values['Item2'] <> '2' then
+          TestFailed(15);
+        if sl.Values['Item3'] <> '3' then
+          TestFailed(16);
+      finally
+        sl.Free;
+      end;
+
+      WriteInteger('', 'Item4', 4);
+      if  GetDataType('Item4') <> rdString then
+        TestFailed(17);
+    finally
+      Free;
+    end;
+
+    rini:=TRegistryIniFile.Create(STestRegPath);
+    with rini do
+    try
+      if ReadString('', 'Item1', '') <> '1' then
+        TestFailed(20);
+      if ReadString('1', 'Item2', '') <> '2' then
+        TestFailed(21);
+      if ReadString('', 'Item1', '') <> '1' then
+        TestFailed(22);
+      if not ValueExists('', 'Item4') then
+        TestFailed(23);
+      if not ValueExists('1', 'Item2') then
+        TestFailed(24);
+    finally
+      Free;
+    end;
+
+  finally
+    reg.Free;
+    ClearReg;
+  end;
+end;
+
+end.
+

+ 15 - 9
packages/fpmkunit/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/08/17]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/10/12]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android
@@ -209,6 +209,14 @@ endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 linuxHier=1
 linuxHier=1
 endif
 endif
+ifndef CROSSCOMPILE
+BUILDFULLNATIVE=1
+export BUILDFULLNATIVE
+endif
+ifdef BUILDFULLNATIVE
+BUILDNATIVE=1
+export BUILDNATIVE
+endif
 export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
 export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
 ifdef FPCDIR
 ifdef FPCDIR
 override FPCDIR:=$(subst \,/,$(FPCDIR))
 override FPCDIR:=$(subst \,/,$(FPCDIR))
@@ -2127,6 +2135,8 @@ $(TARGET_UNITDIRBS):
 	$(MKDIRTREE) $(TARGET_UNITDIRBS)
 	$(MKDIRTREE) $(TARGET_UNITDIRBS)
 bootstrap:	$(TARGET_UNITDIRBS)
 bootstrap:	$(TARGET_UNITDIRBS)
 	$(FPCFPMAKE) src/fpmkunit.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) -FU$(TARGET_UNITDIRBS) $(UNIT_ZIPPER) $(UNIT_PROCESS) $(OPT)
 	$(FPCFPMAKE) src/fpmkunit.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) -FU$(TARGET_UNITDIRBS) $(UNIT_ZIPPER) $(UNIT_PROCESS) $(OPT)
+clean_bootstrap:
+	-$(DELTREE) units_bs
 fpmake: fpmake.pp
 fpmake: fpmake.pp
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(UNITDIR_FPMAKE_RTL)) $(FPCMAKEOPT) -Fu$(TARGET_UNITDIRBS) $(OPT)
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(UNITDIR_FPMAKE_RTL)) $(FPCMAKEOPT) -Fu$(TARGET_UNITDIRBS) $(OPT)
 all:	fpmake
 all:	fpmake
@@ -2138,25 +2148,21 @@ release:	fpmake
 debug:	fpmake
 debug:	fpmake
 	$(LOCALFPMAKE) compile --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -dDEBUG
 	$(LOCALFPMAKE) compile --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -bu -o -dDEBUG
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-clean:	
-	-$(DELTREE) units_bs
+clean:	clean_bootstrap
 else
 else
-clean:	
+clean:	clean_bootstrap
 	$(FPMAKE_BIN_CLEAN) clean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 	$(FPMAKE_BIN_CLEAN) clean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
-	-$(DELTREE) units_bs
 endif
 endif
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
-	-$(DELTREE) units_bs
+distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall clean_bootstrap
 else
 else
-distclean:	
+distclean:	clean_bootstrap
 ifdef inUnix
 ifdef inUnix
 	{ $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
 	{ $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
 else
 else
 	$(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 	$(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 endif
 endif
 	-$(DEL) $(LOCALFPMAKE)
 	-$(DEL) $(LOCALFPMAKE)
-	-$(DELTREE) units_bs
 endif
 endif
 install:	fpmake
 install:	fpmake
 ifdef UNIXHier
 ifdef UNIXHier

+ 6 - 8
packages/fpmkunit/Makefile.fpc

@@ -68,6 +68,8 @@ $(TARGET_UNITDIRBS):
 	$(MKDIRTREE) $(TARGET_UNITDIRBS)
 	$(MKDIRTREE) $(TARGET_UNITDIRBS)
 bootstrap:	$(TARGET_UNITDIRBS)
 bootstrap:	$(TARGET_UNITDIRBS)
 	$(FPCFPMAKE) src/fpmkunit.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) -FU$(TARGET_UNITDIRBS) $(UNIT_ZIPPER) $(UNIT_PROCESS) $(OPT)
 	$(FPCFPMAKE) src/fpmkunit.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) -FU$(TARGET_UNITDIRBS) $(UNIT_ZIPPER) $(UNIT_PROCESS) $(OPT)
+clean_bootstrap:
+	-$(DELTREE) units_bs
 fpmake: fpmake.pp
 fpmake: fpmake.pp
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(UNITDIR_FPMAKE_RTL)) $(FPCMAKEOPT) -Fu$(TARGET_UNITDIRBS) $(OPT)
 	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(UNITDIR_FPMAKE_RTL)) $(FPCMAKEOPT) -Fu$(TARGET_UNITDIRBS) $(OPT)
 all:	fpmake
 all:	fpmake
@@ -82,27 +84,23 @@ debug:	fpmake
 # most often fail because the dependencies are cleared.
 # most often fail because the dependencies are cleared.
 # In case of a clean, simply do nothing
 # In case of a clean, simply do nothing
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-clean:	
-	-$(DELTREE) units_bs
+clean:	clean_bootstrap
 else
 else
-clean:	
+clean:	clean_bootstrap
 	$(FPMAKE_BIN_CLEAN) clean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 	$(FPMAKE_BIN_CLEAN) clean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
-	-$(DELTREE) units_bs
 endif
 endif
 # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
 # In case of a distclean, perform an 'old'-style distclean. This to avoid problems
 # when the package is compiled using fpcmake prior to running this clean using fpmake
 # when the package is compiled using fpcmake prior to running this clean using fpmake
 ifeq ($(FPMAKE_BIN_CLEAN),)
 ifeq ($(FPMAKE_BIN_CLEAN),)
-distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
-	-$(DELTREE) units_bs
+distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall clean_bootstrap
 else
 else
-distclean:	
+distclean:	clean_bootstrap
 ifdef inUnix
 ifdef inUnix
         { $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
         { $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
 else
 else
         $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
         $(FPMAKE_BIN_CLEAN) distclean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 endif
 endif
 	-$(DEL) $(LOCALFPMAKE)
 	-$(DEL) $(LOCALFPMAKE)
-	-$(DELTREE) units_bs
 endif
 endif
 install:	fpmake
 install:	fpmake
 ifdef UNIXHier
 ifdef UNIXHier

+ 2 - 2
packages/libndsfpc/examples/filesystem/nitrofs/nitrodir/Makefile.fpc

@@ -4,7 +4,7 @@
 
 
 [target]
 [target]
 loaders= 
 loaders= 
-programs=*
+programs=nitrodir
 
 
 [require]
 [require]
 packages=libndsfpc
 packages=libndsfpc
@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../../..
 fpcdir=../../../../../..
 
 
 [compiler]
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 #-d__THUMB__
 
 
 [clean]
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/2Dplus3D/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 fpcdir=../../../../..
 
 
 [compiler]
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 #-d__THUMB__
 
 
 [clean]
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/dual_screen/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 fpcdir=../../../../..
 
 
 [compiler]
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 #-d__THUMB__
 
 
 [clean]
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/fonts/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 fpcdir=../../../../..
 
 
 [compiler]
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 #-d__THUMB__
 
 
 [clean]
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/primitives/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 fpcdir=../../../../..
 
 
 [compiler]
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 #-d__THUMB__
 
 
 [clean]
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/scrolling/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 fpcdir=../../../../..
 
 
 [compiler]
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 #-d__THUMB__
 
 
 [clean]
 [clean]

+ 1 - 1
packages/libndsfpc/examples/gl2d/sprites/Makefile.fpc

@@ -20,7 +20,7 @@ target=nds
 fpcdir=../../../../..
 fpcdir=../../../../..
 
 
 [compiler]
 [compiler]
-options=-gl -Xm -O2 
+options=-Xm -O2 
 #-d__THUMB__
 #-d__THUMB__
 
 
 [clean]
 [clean]

+ 6 - 1
packages/libndsfpc/examples/graphics/Backgrounds/256_color_bmp/256ColorBmp.pp

@@ -33,6 +33,11 @@ begin
 
 
 
 
   while true do
   while true do
-    swiWaitForVBlank();
+  begin
+		swiWaitForVBlank();
+		scanKeys();
+		if (keysDown() and KEY_START) <> 0 then 
+      exit;
+  end;
 
 
 end.
 end.

+ 3 - 1
packages/libndsfpc/examples/graphics/Backgrounds/Double_Buffer/DoubleBuffer.pp

@@ -43,7 +43,9 @@ begin
 				backBuffer[iy * 256 + ix] := random(colorMask) or BIT(15);
 				backBuffer[iy * 256 + ix] := random(colorMask) or BIT(15);
 
 
 		swiWaitForVBlank();
 		swiWaitForVBlank();
-
+		scanKeys();
+		if (keysDown() and KEY_START) <> 0 then 
+      exit;
 		//swap the back buffer to the current buffer
 		//swap the back buffer to the current buffer
 		backBuffer := pcuint16(bgGetGfxPtr(bg));
 		backBuffer := pcuint16(bgGetGfxPtr(bg));
 
 

+ 50 - 0
packages/libndsfpc/examples/graphics/Backgrounds/all_in_one/Advanced.pp

@@ -163,8 +163,58 @@ begin
 end;
 end;
 
 
 procedure advExtendedPalette();
 procedure advExtendedPalette();
+var
+  paletteSlots: array [0..3] of pcuint16; 
+  i: integer;
+  bg: integer;
 begin
 begin
+  (*
+  When extended palettes are enabled all tiled backgrounds which utilize 
+  16 bit map entries will use extended palettes.  Everything else will continue
+  to use standard palette memory.
+
+  Each tile on the screen may chose one of 16 256-color palettes.  Each background 
+  has its own set of 16 palettes meaning you can have 4*16*256 colors on screen 
+
+  Each background uses 8K of palette memory starting at the base of the vram bank
+  you allocate (which bank is up to you within limits, see the vram usage table
+  to determine which banks can be mapped for textures).  These 8K blocks are often
+  refered to as "slots" with each background getting its own slot.  
+
+   By default, Background 0 uses slot 0 ... Background 3 uses slot 3.  It is possible
+   to assign Background 0 to slot 2 and Background 1 to slot 3 (only these two are configurable)
+  
+  For more information: <a href="http://nocash.emubase.de/gbatek.htm#dsvideoextendedpalettes">gbatek</a>
+  *)
+
+  for i := 0 to 3 do
+    paletteSlots[i]^ := VRAM_E[i * 16 * 256];
+
+  videoSetMode(MODE_0_2D);
+  vramSetBankA(VRAM_A_MAIN_BG);
+
+  //enable extended palettes for background. Once on, the standard BG_PALETTE will 
+  //be ignored for tiled backgrounds with 16 bit map entries (everything else still uses
+  //the standard palette)
+  bgExtPaletteEnable();
+  
+  bg := bgInit(0, BgType_Text8bpp, BgSize_T_256x256, 0, 1);
+	
+	dmaCopy(@TextBackgroundsTiles, bgGetGfxPtr(bg), sizeof(TextBackgroundsTiles));
+	dmaCopy(@Layer256x256Map, bgGetMapPtr(bg),  Layer256x256MapLen);
+  
+  //lock vram E as we are going to use it for 
+  //extended palettes (see documentation for which vram 
+  //banks can be utilized).  You cannot write to it once
+  //it is mapped to the GPU.  These means you should
+  //not update your ext palettes outside of a blank period
+  vramSetBankE(VRAM_E_LCD);
+  dmaCopy(@TextBackgroundsPal, paletteSlots[0], sizeof(TextBackgroundsPal));
+  
+  //tell the GPU to use vram E as extended palette memory
+  vramSetBankE(VRAM_E_BG_EXT_PALETTE);
 
 
+	scroll(bg, 256, 256);
 end;
 end;
 
 
 procedure advMultipleLayers();
 procedure advMultipleLayers();

+ 2 - 0
packages/libndsfpc/examples/graphics/Backgrounds/rotation/Rotation.pp

@@ -78,6 +78,8 @@ begin
 
 
 
 
     swiWaitForVBlank();
     swiWaitForVBlank();
+		if (keysDown() and KEY_START) <> 0 then 
+      exit;
 
 
     bgSetCenter(bg3, rcX, rcY);
     bgSetCenter(bg3, rcX, rcY);
     bgSetRotateScale(bg3, angle, scaleX, scaleY);
     bgSetRotateScale(bg3, angle, scaleX, scaleY);

+ 4 - 1
packages/libndsfpc/examples/graphics/Sprites/animate_simple/AnimateSimple.pp

@@ -199,7 +199,10 @@ begin
     scanKeys();
     scanKeys();
 
 
     keys := keysHeld();
     keys := keysHeld();
-
+		
+    if (keys and KEY_START) <> 0 then 
+      exit;
+      
     if keys <> 0 then
     if keys <> 0 then
     begin
     begin
       if (keys and KEY_UP) <> 0 then
       if (keys and KEY_UP) <> 0 then

+ 3 - 1
packages/libndsfpc/examples/input/Touch_Pad/touch_test/touchTest.pp

@@ -89,7 +89,9 @@ begin
   
   
     pressed := keysDown();  // buttons pressed this loop
     pressed := keysDown();  // buttons pressed this loop
     held := keysHeld();     // buttons currently held
     held := keysHeld();     // buttons currently held
-  
+
+		if (pressed and KEY_START) <> 0 then 
+      exit;  
     // Right Shoulder button toggles the mode
     // Right Shoulder button toggles the mode
 		if ( pressed and KEY_R) <> 0 then Inc(TouchType);
 		if ( pressed and KEY_R) <> 0 then Inc(TouchType);
 
 

+ 19 - 0
packages/libndsfpc/src/fat/fat.inc

@@ -43,5 +43,24 @@ function fatInitDefault(): cbool; cdecl; external;
 function fatMountSimple (const name: pcchar; const ainterface: PDISC_INTERFACE): cbool; cdecl; external;
 function fatMountSimple (const name: pcchar; const ainterface: PDISC_INTERFACE): cbool; cdecl; external;
 function fatMount (const name: pcchar; const ainterface: PDISC_INTERFACE; startSector, cacheSize, SectorsPerPage: cuint32): cbool; cdecl; external;
 function fatMount (const name: pcchar; const ainterface: PDISC_INTERFACE; startSector, cacheSize, SectorsPerPage: cuint32): cbool; cdecl; external;
 function fatUnmount(const name: pcchar): cbool; cdecl; external;
 function fatUnmount(const name: pcchar): cbool; cdecl; external;
+
+// Get Volume Label
+procedure fatGetVolumeLabel(const name: pcchar; labl: pcchar); cdecl; external;
+
+// File attributes
+const
+  ATTR_ARCHIVE    = $20;  // Archive
+  ATTR_DIRECTORY  = $10;  // Directory
+  ATTR_VOLUME     = $08;  // Volume
+  ATTR_SYSTEM     = $04;  // System
+  ATTR_HIDDEN     = $02;  // Hidden
+  ATTR_READONLY   = $01;  // Read only
+
+
+// Methods to modify DOS File Attributes
+
+function FAT_getAttr(const _file: pcchar): cint; cdecl; external;
+function FAT_setAttr(const _file: pcchar; attr: cint): cint; cdecl; external;
+
 {$endif NDS_INTERFACE}
 {$endif NDS_INTERFACE}
 
 

+ 13 - 5
packages/libndsfpc/src/nds/card.inc

@@ -17,11 +17,19 @@ const
   CARD_CR1_IRQ    = $40;  // in byte 1, i.e. 0x4000
   CARD_CR1_IRQ    = $40;  // in byte 1, i.e. 0x4000
 
 
   // SPI EEPROM COMMANDS
   // SPI EEPROM COMMANDS
-  EEPROM_WRSR = $01;
-  EEPROM_WRDI = $04;
-  EEPROM_RDSR = $05;
-  EEPROM_WREN = $06;
-  EEPROM_RDID = $9f;
+
+  SPI_EEPROM_WRSR   = $01;
+  SPI_EEPROM_PP     = $02;	// Page Program
+  SPI_EEPROM_READ   = $03;
+  SPI_EEPROM_WRDI   = $04;  // Write disable
+  SPI_EEPROM_RDSR   = $05;  // Read status register
+  SPI_EEPROM_WREN   = $06;  // Write enable
+  SPI_EEPROM_PW     = $0a;	// Page Write
+  SPI_EEPROM_FAST   = $0b;	// Fast Read
+  SPI_EEPROM_RDID   = $9f;
+  SPI_EEPROM_RDP    = $ab;  // Release from deep power down
+  SPI_EEPROM_DPD    = $b9;  // Deep power down
+
 
 
 // REG_ROMCTRL:
 // REG_ROMCTRL:
   CARD_ACTIVATE   = (1 shl 31);  // when writing, get the ball rolling
   CARD_ACTIVATE   = (1 shl 31);  // when writing, get the ball rolling

+ 14 - 0
packages/libndsfpc/src/nds/libversion.inc

@@ -0,0 +1,14 @@
+{$ifdef NDS_INTERFACE}
+const
+  _LIBNDS_MAJOR_ = 1;
+  _LIBNDS_MINOR_ = 5;
+  _LIBNDS_PATCH_ = 7;
+
+  _LIBNDS_STRING = 'libNDS Release 1.5.7';
+{$endif NDS_INTERFACE}
+
+{$ifdef NDS_IMPLEMENTATION}
+
+
+{$endif NDS_IMPLEMENTATION}
+

+ 2 - 1
packages/libndsfpc/src/nds/ndsinclude.inc

@@ -1,5 +1,6 @@
 
 
 
 
+{$include libversion.inc} 
 { $include helper.inc}
 { $include helper.inc}
 {$include ndstypes.inc}
 {$include ndstypes.inc}
 {$include bios.inc}
 {$include bios.inc}
@@ -15,7 +16,7 @@
 {$include system.inc}
 {$include system.inc}
 {$include timers.inc}
 {$include timers.inc}
 {$include fifomessages.inc} 
 {$include fifomessages.inc} 
-{$include input.inc} // testing...
+{$include input.inc} 
  
  
 {$ifdef ARM9}
 {$ifdef ARM9}
   {$include arm9/dynamicArray.inc}
   {$include arm9/dynamicArray.inc}

+ 6 - 2
packages/univint/src/MacTypes.pas

@@ -303,8 +303,12 @@ type
 	********************************************************************************	}
 	********************************************************************************	}
 	ByteParameter = SInt8;
 	ByteParameter = SInt8;
 
 
-// For interfaces that use Cs "bool" type, which is a 32 bit number
-	CBool = SInt32; 
+// For interfaces that use Cs "bool" type
+{$ifc TARGET_CPU_PPC}
+	CBool = SInt32;
+{$elsec}
+	CBool = SInt8;
+{$endc}
 
 
 {*******************************************************************************
 {*******************************************************************************
 
 

+ 1 - 1
packages/winunits-base/src/activex.pp

@@ -3006,7 +3006,7 @@ TYPE
       Function  LocalGetIDsOfNames():HResult;StdCall;
       Function  LocalGetIDsOfNames():HResult;StdCall;
      {$endif}
      {$endif}
      {$ifndef Call_as}
      {$ifndef Call_as}
-     Function  Invoke(pvInstance: Pointer; memid: MEMBERID; wFlags: WORD; VAR pDispParams: DISPPARAMS; OUT pVarResult: VARIANT; OUT pExcepInfo: EXCEPINFO; OUT puArgErr: UINT):HResult;StdCall;
+     Function  Invoke(pvInstance: Pointer; memid: MEMBERID; wFlags: WORD; VAR pDispParams: DISPPARAMS; pVarResult: PVARIANT; pExcepInfo: PEXCEPINFO; puArgErr: PUINT):HResult;StdCall;
      {$else}
      {$else}
      Function  LocalInvoke ():HResult;StdCall;
      Function  LocalInvoke ():HResult;StdCall;
      {$endif}
      {$endif}

+ 31 - 27
packages/winunits-base/src/comobj.pp

@@ -1023,43 +1023,47 @@ HKCR
         if Register then
         if Register then
         begin
         begin
           classidguid := GUIDToString(ClassID);
           classidguid := GUIDToString(ClassID);
-          CreateRegKey('CLSID\' + classidguid, '', Description);
-          if ClassVersion <> '' then
-          begin
-            CreateRegKey('CLSID\' + classidguid + '\ProgID', '', ProgID + '.' + ClassVersion);
-            CreateRegKey('CLSID\' + classidguid + '\VersionIndependentProgID', '', ProgID + '.' + ClassVersion);
-          end
-          else
-            CreateRegKey('CLSID\' + classidguid + '\ProgID', '', ProgID);
-
           CreateRegKey('CLSID\' + classidguid + '\InprocServer32', '', FComServer.ServerFileName);
           CreateRegKey('CLSID\' + classidguid + '\InprocServer32', '', FComServer.ServerFileName);
-
           //tmSingle, tmApartment, tmFree, tmBoth, tmNeutral
           //tmSingle, tmApartment, tmFree, tmBoth, tmNeutral
           CreateRegKey('CLSID\' + classidguid + '\InprocServer32', 'ThreadingModel', ThreadModelToString(ThreadingModel));
           CreateRegKey('CLSID\' + classidguid + '\InprocServer32', 'ThreadingModel', ThreadModelToString(ThreadingModel));
-
-          CreateRegKey(ProgID, '', Description);
-          CreateRegKey(ProgID + '\CLSID', '', GUIDToString(ClassID));
-          if ClassVersion <> '' then
+          CreateRegKey('CLSID\' + classidguid, '', Description);
+          if ClassName <> '' then
           begin
           begin
-            CreateRegKey(ProgID + '\CurVer', '', ProgID + '.' + ClassVersion);
-            CreateRegKey(ProgID + '.' + ClassVersion, '', Description);
-            CreateRegKey(ProgID + '.' + ClassVersion + '\CLSID', '', GUIDToString(ClassID));
+            if ClassVersion <> '' then
+            begin
+              CreateRegKey('CLSID\' + classidguid + '\ProgID', '', ProgID + '.' + ClassVersion);
+              CreateRegKey('CLSID\' + classidguid + '\VersionIndependentProgID', '', ProgID);
+            end
+            else
+              CreateRegKey('CLSID\' + classidguid + '\ProgID', '', ProgID);
+
+            CreateRegKey(ProgID, '', Description);
+            CreateRegKey(ProgID + '\CLSID', '', GUIDToString(ClassID));
+            if ClassVersion <> '' then
+            begin
+              CreateRegKey(ProgID + '\CurVer', '', ProgID + '.' + ClassVersion);
+              CreateRegKey(ProgID + '.' + ClassVersion, '', Description);
+              CreateRegKey(ProgID + '.' + ClassVersion + '\CLSID', '', GUIDToString(ClassID));
+            end;
           end;
           end;
-
         end else
         end else
         begin
         begin
           classidguid := GUIDToString(ClassID);
           classidguid := GUIDToString(ClassID);
           DeleteRegKey('CLSID\' + classidguid + '\InprocServer32');
           DeleteRegKey('CLSID\' + classidguid + '\InprocServer32');
           DeleteRegKey('CLSID\' + classidguid + '\VersionIndependentProgID');
           DeleteRegKey('CLSID\' + classidguid + '\VersionIndependentProgID');
-          DeleteRegKey('CLSID\' + classidguid + '\ProgID');
-          DeleteRegKey('CLSID\' + classidguid);
-          DeleteRegKey(ProgID + '\CLSID');
-          DeleteRegKey(ProgID);
-          if ClassVersion <> '' then
+          if ClassName <> '' then
           begin
           begin
-            DeleteRegKey(ProgID + '.' + ClassVersion + '\CLSID');
-            DeleteRegKey(ProgID + '.' + ClassVersion);
+            DeleteRegKey('CLSID\' + classidguid + '\ProgID');
+            DeleteRegKey(ProgID + '\CLSID');
+            if ClassVersion <> '' then
+            begin
+              DeleteRegKey(ProgID + '\CurVer');
+              DeleteRegKey(ProgID + '.' + ClassVersion + '\CLSID');
+              DeleteRegKey(ProgID + '.' + ClassVersion);
+            end;
+            DeleteRegKey(ProgID);
           end;
           end;
+          DeleteRegKey('CLSID\' + classidguid);
         end;
         end;
 {$ifdef DEBUG_COM}
 {$ifdef DEBUG_COM}
         WriteLn('UpdateRegistry end');
         WriteLn('UpdateRegistry end');
@@ -1599,7 +1603,7 @@ HKCR
         else
         else
       //  Function  Invoke(pvInstance: Pointer; memid: MEMBERID; wFlags: WORD; VAR pDispParams: DISPPARAMS; OUT pVarResult: VARIANT; OUT pExcepInfo: EXCEPINFO; OUT puArgErr: UINT):HResult;StdCall;
       //  Function  Invoke(pvInstance: Pointer; memid: MEMBERID; wFlags: WORD; VAR pDispParams: DISPPARAMS; OUT pVarResult: VARIANT; OUT pExcepInfo: EXCEPINFO; OUT puArgErr: UINT):HResult;StdCall;
       //  Result := fTypeInfo.Invoke(IDispatch(Self), DispID, Flags, TDispParams(params), PVariant(VarResult)^, PExcepInfo(ExcepInfo)^, PUINT(ArgErr)^);
       //  Result := fTypeInfo.Invoke(IDispatch(Self), DispID, Flags, TDispParams(params), PVariant(VarResult)^, PExcepInfo(ExcepInfo)^, PUINT(ArgErr)^);
-          Result := fTypeInfo.Invoke(fInterfacePointer, DispID, Flags, TDispParams(params), PVariant(VarResult)^, PExcepInfo(ExcepInfo)^, PUINT(ArgErr)^);
+          Result := fTypeInfo.Invoke(fInterfacePointer, DispID, Flags, TDispParams(params), VarResult, ExcepInfo, ArgErr);
       end;
       end;
 
 
     function TAutoIntfObject.InterfaceSupportsErrorInfo(const riid: TIID): HResult;
     function TAutoIntfObject.InterfaceSupportsErrorInfo(const riid: TIID): HResult;
@@ -1699,7 +1703,7 @@ HKCR
         begin
         begin
           Result := TAutoObjectFactory(Factory).DispTypeInfo.Invoke(Pointer(
           Result := TAutoObjectFactory(Factory).DispTypeInfo.Invoke(Pointer(
             PtrUint(Self) + TAutoObjectFactory(Factory).DispIntfEntry^.IOffset),
             PtrUint(Self) + TAutoObjectFactory(Factory).DispIntfEntry^.IOffset),
-            DispID, Flags, TDispParams(Params), PVariant(VarResult)^, PExcepInfo(ExcepInfo)^, PUINT(ArgErr)^);
+            DispID, Flags, TDispParams(Params), VarResult, ExcepInfo, ArgErr);
         end;
         end;
       end;
       end;
 
 

+ 1 - 1
packages/winunits-base/src/comserv.pp

@@ -207,7 +207,7 @@ begin
   //http://www.experts-exchange.com/Programming/Misc/Q_20634807.html
   //http://www.experts-exchange.com/Programming/Misc/Q_20634807.html
   OleCheck(TypeLib.GetLibAttr(ptla));
   OleCheck(TypeLib.GetLibAttr(ptla));
   try
   try
-    OleCheck(ActiveX.UnRegisterTypeLib(ptla^.guid, ptla^.wMajorVerNum, ptla^.wMinorVerNum, ptla^.lcid, ptla^.syskind));
+    ActiveX.UnRegisterTypeLib(ptla^.guid, ptla^.wMajorVerNum, ptla^.wMinorVerNum, ptla^.lcid, ptla^.syskind);
   finally
   finally
     TypeLib.ReleaseTLibAttr(ptla);
     TypeLib.ReleaseTLibAttr(ptla);
   end;
   end;

+ 32 - 6
packages/winunits-base/src/typelib.pas

@@ -53,7 +53,7 @@ To load a different type of library resource, append an integer index to 'FileNa
 Example:  C:\WINDOWS\system32\msvbvm60.dll\3
 Example:  C:\WINDOWS\system32\msvbvm60.dll\3
 }
 }
 function ImportTypelib(FileName: WideString;var sUnitName:string;var slDependencies:TStringList;
 function ImportTypelib(FileName: WideString;var sUnitName:string;var slDependencies:TStringList;
-  bActiveX,bPackage:boolean;var sPackageSource,sPackageRegUnitSource:String):string;
+  bActiveX,bPackage,bRemoveStructTag:boolean;var sPackageSource,sPackageRegUnitSource:String):string;
 
 
 
 
 Type
 Type
@@ -66,6 +66,7 @@ Type
     FAppendVersionNumber: Boolean;
     FAppendVersionNumber: Boolean;
     FCreatePackage: Boolean;
     FCreatePackage: Boolean;
     FDependencies: TStringList;
     FDependencies: TStringList;
+    FRemoveStructTag: Boolean;
     FUnitSource: TStringList;
     FUnitSource: TStringList;
     FPackageSource: TStringList;
     FPackageSource: TStringList;
     FPackageRegUnitSource: TStringList;
     FPackageRegUnitSource: TStringList;
@@ -93,6 +94,7 @@ Type
     procedure SetActiveX(AValue: Boolean);
     procedure SetActiveX(AValue: Boolean);
     procedure SetCreatePackage(AValue: Boolean);
     procedure SetCreatePackage(AValue: Boolean);
     procedure SetOutputFileName(AValue: String);
     procedure SetOutputFileName(AValue: String);
+    procedure SetRemoveStructTag(AValue: Boolean);
     procedure SetUnitName(AValue: string);
     procedure SetUnitName(AValue: string);
   Protected
   Protected
     bIsCustomAutomatable,bIsInterface,bIsAutomatable,bIsExternalDecl,bIsUserDefined:boolean;
     bIsCustomAutomatable,bIsInterface,bIsAutomatable,bIsExternalDecl,bIsUserDefined:boolean;
@@ -116,6 +118,7 @@ Type
     function ValidateIDAgainstDeclared(id: string): boolean; virtual;
     function ValidateIDAgainstDeclared(id: string): boolean; virtual;
     function MakeValidId(id:string;var valid:string): boolean; virtual;
     function MakeValidId(id:string;var valid:string): boolean; virtual;
     function MakeValidIdAgainstDeclared(id:string;var valid:string): boolean;
     function MakeValidIdAgainstDeclared(id:string;var valid:string): boolean;
+    function RemoveTag(typename: string): string;
     // The actual routines that do the work.
     // The actual routines that do the work.
     procedure CreateCoClasses(const TL: ITypeLib; TICount: Integer); virtual;
     procedure CreateCoClasses(const TL: ITypeLib; TICount: Integer); virtual;
     procedure CreateForwards(const TL: ITypeLib; TICount: Integer); virtual;
     procedure CreateForwards(const TL: ITypeLib; TICount: Integer); virtual;
@@ -145,11 +148,13 @@ Type
     // Append version number to unit name.
     // Append version number to unit name.
     Property AppendVersionNumber : Boolean Read FAppendVersionNumber Write FAppendVersionNumber Default True;
     Property AppendVersionNumber : Boolean Read FAppendVersionNumber Write FAppendVersionNumber Default True;
     // Create lpk package for ActiveXContainer descendant: default false
     // Create lpk package for ActiveXContainer descendant: default false
-    Property CreatePackage : Boolean Read FCreatePackage write SetCreatePackage Default False;
+    Property CreatePackage : Boolean read FCreatePackage write SetCreatePackage  Default False;
     // File to read typelib from.
     // File to read typelib from.
     Property InputFileName : WideString Read FInputFileName Write FInputFileName;
     Property InputFileName : WideString Read FInputFileName Write FInputFileName;
     // If set, unit source will be written to this file.
     // If set, unit source will be written to this file.
     Property OutputFileName : String Read FOutputFileName Write SetOutputFileName;
     Property OutputFileName : String Read FOutputFileName Write SetOutputFileName;
+    // Remove tag from struct names
+    Property RemoveStructTag : Boolean read FRemoveStructTag write SetRemoveStructTag Default False;
     // Set automatically by OutputFileName or by Execute
     // Set automatically by OutputFileName or by Execute
     Property UnitName : string Read FUnitname Write SetUnitName;
     Property UnitName : string Read FUnitname Write SetUnitName;
   end;
   end;
@@ -161,7 +166,7 @@ Resourcestring
   SErrInvalidUnitName = 'Invalid unit name : %s';
   SErrInvalidUnitName = 'Invalid unit name : %s';
 
 
 function ImportTypelib(FileName: WideString;var sUnitName:string;var slDependencies:TStringList;
 function ImportTypelib(FileName: WideString;var sUnitName:string;var slDependencies:TStringList;
-  bActiveX,bPackage:boolean;var sPackageSource,sPackageRegUnitSource:String):string;
+  bActiveX,bPackage,bRemoveStructTag:boolean;var sPackageSource,sPackageRegUnitSource:String):string;
 var i:integer;
 var i:integer;
 begin
 begin
   With TTypeLibImporter.Create(Nil) do
   With TTypeLibImporter.Create(Nil) do
@@ -169,6 +174,7 @@ begin
       InputFileName:=FileName;
       InputFileName:=FileName;
       ActiveX:=bActiveX;
       ActiveX:=bActiveX;
       CreatePackage:=bPackage;
       CreatePackage:=bPackage;
+      RemoveStructTag:=bRemoveStructTag;
       Execute;
       Execute;
       Result:=UnitSource.Text;
       Result:=UnitSource.Text;
       sUnitname:=UnitName;
       sUnitname:=UnitName;
@@ -301,6 +307,18 @@ begin
     MakeValidIdAgainstDeclared(id+'_',valid);
     MakeValidIdAgainstDeclared(id+'_',valid);
 end;
 end;
 
 
+function TTypeLibImporter.RemoveTag(typename: string): string;
+begin
+  result:=typename;
+  if FRemoveStructTag and (pos('tag',typename)>0) then
+    if (copy(typename,1,3)='tag') then
+      delete(result,1,3)
+    else if (copy(typename,1,4)='_tag') then
+      delete(result,2,3)
+    else if (copy(typename,1,5)='__tag') then
+      delete(result,3,3);
+end;
+
 
 
 function TTypeLibImporter.TypeToString(TI:ITypeInfo; TD:TYPEDESC):string;
 function TTypeLibImporter.TypeToString(TI:ITypeInfo; TD:TYPEDESC):string;
 
 
@@ -331,9 +349,11 @@ begin
       TD:=TD.lptdesc^;
       TD:=TD.lptdesc^;
     OleCheck(TI.GetRefTypeInfo(TD.hreftype,TIref));
     OleCheck(TI.GetRefTypeInfo(TD.hreftype,TIref));
     OleCheck(TIRef.GetDocumentation(DISPID_UNKNOWN, @BstrName, nil, nil, nil));
     OleCheck(TIRef.GetDocumentation(DISPID_UNKNOWN, @BstrName, nil, nil, nil));
-    MakeValidId(BstrName,result);
     OleCheck(TIRef.GetTypeAttr(TARef));
     OleCheck(TIRef.GetTypeAttr(TARef));
     bIsCustomAutomatable:=TARef^.typekind in [TKIND_DISPATCH,TKIND_INTERFACE,TKIND_ENUM,TKIND_COCLASS];
     bIsCustomAutomatable:=TARef^.typekind in [TKIND_DISPATCH,TKIND_INTERFACE,TKIND_ENUM,TKIND_COCLASS];
+    if TARef^.typekind in [TKIND_RECORD,TKIND_UNION,TKIND_ALIAS] then
+      BstrName:=RemoveTag(BstrName);
+    MakeValidId(BstrName,result);
     if TARef^.typekind=TKIND_ALIAS then
     if TARef^.typekind=TKIND_ALIAS then
       begin
       begin
       TypeToString(TIRef,TARef^.tdescAlias); //not interested in result, only bIsCustomAutomatable and bIsInterface
       TypeToString(TIRef,TARef^.tdescAlias); //not interested in result, only bIsCustomAutomatable and bIsInterface
@@ -1210,7 +1230,7 @@ begin
     case TIT of
     case TIT of
       TKIND_RECORD,TKIND_UNION:
       TKIND_RECORD,TKIND_UNION:
         begin
         begin
-        if not MakeValidId(BstrName,sRecordName) then
+        if not MakeValidId(RemoveTag(BstrName),sRecordName) then
           AddToHeader('//  Warning: renamed record ''%s'' to ''%s''',[BstrName,sRecordName],True);
           AddToHeader('//  Warning: renamed record ''%s'' to ''%s''',[BstrName,sRecordName],True);
         AddToInterface(' P%s = ^%s;'#13#10,[sRecordName,sRecordName]);
         AddToInterface(' P%s = ^%s;'#13#10,[sRecordName,sRecordName]);
         FTypes.Add('P'+sRecordName);
         FTypes.Add('P'+sRecordName);
@@ -1260,7 +1280,7 @@ begin
         stype:=TypeToString(TI, TA^.tdescAlias);
         stype:=TypeToString(TI, TA^.tdescAlias);
         if bIsUserDefined and not ValidateID(stype) then
         if bIsUserDefined and not ValidateID(stype) then
           stype:=stype+'_';
           stype:=stype+'_';
-        if not MakeValidId(BstrName,sRecordName) then
+        if not MakeValidId(RemoveTag(BstrName),sRecordName) then
           AddToHeader('//  Warning: renamed alias ''%s'' to ''%s''',[BstrName,sRecordName],True);
           AddToHeader('//  Warning: renamed alias ''%s'' to ''%s''',[BstrName,sRecordName],True);
         sl:=format(' %s = %s;',[sRecordName,stype]);
         sl:=format(' %s = %s;',[sRecordName,stype]);
         if bIsUserDefined and not bIsExternalDecl and (FTypes.IndexOf(stype)=-1) then //not defined yet, defer
         if bIsUserDefined and not bIsExternalDecl and (FTypes.IndexOf(stype)=-1) then //not defined yet, defer
@@ -1810,6 +1830,12 @@ begin
   SetUnitName(UN)
   SetUnitName(UN)
 end;
 end;
 
 
+procedure TTypeLibImporter.SetRemoveStructTag(AValue: Boolean);
+begin
+  if FRemoveStructTag=AValue then Exit;
+  FRemoveStructTag:=AValue;
+end;
+
 procedure TTypeLibImporter.SetUnitName(AValue: string);
 procedure TTypeLibImporter.SetUnitName(AValue: string);
 begin
 begin
   if FUnitname=AValue then Exit;
   if FUnitname=AValue then Exit;

+ 31 - 8
rtl/i386/cpu.pp

@@ -13,6 +13,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
+{$mode objfpc}
 unit cpu;
 unit cpu;
   interface
   interface
 
 
@@ -25,13 +26,16 @@ unit cpu;
     { returns the contents of the cr0 register }
     { returns the contents of the cr0 register }
     function cr0 : longint;
     function cr0 : longint;
 
 
+    function AVXSupport: boolean;inline;
+
     var
     var
       is_sse3_cpu : boolean = false;
       is_sse3_cpu : boolean = false;
 
 
   implementation
   implementation
 
 
 {$ASMMODE INTEL}
 {$ASMMODE INTEL}
-
+    var
+      _AVXSupport : boolean;
 
 
     function cpuid_support : boolean;assembler;
     function cpuid_support : boolean;assembler;
       {
       {
@@ -76,10 +80,19 @@ unit cpu;
 
 
 
 
 {$ASMMODE ATT}
 {$ASMMODE ATT}
-    function sse3_support : boolean;
+    function XGETBV(i : dword) : int64;assembler;
+      asm
+        movl %eax,%ecx
+        // older FPCs don't know the xgetbv opcode
+        .byte 0x0f,0x01,0xd0
+      end;
+
+
+    procedure SetupSupport;
       var
       var
          _ecx : longint;
          _ecx : longint;
       begin
       begin
+        is_sse3_cpu:=false;
          if cpuid_support then
          if cpuid_support then
            begin
            begin
               asm
               asm
@@ -89,13 +102,23 @@ unit cpu;
                  movl %ecx,_ecx
                  movl %ecx,_ecx
                  popl %ebx
                  popl %ebx
               end;
               end;
-              sse3_support:=(_ecx and $1)<>0;
-           end
-         else
-           { a cpu with without cpuid instruction supports never sse3 }
-           sse3_support:=false;
+              is_sse3_cpu:=(_ecx and $1)<>0;
+              _AVXSupport:=
+                { XGETBV suspport? }
+                ((_ecx and $08000000)<>0) and
+                { xmm and ymm state enabled? }
+                ((XGETBV(0) and %110)=%110) and
+                { avx supported? }
+                ((_ecx and $10000000)<>0);
+           end;
+      end;
+
+
+    function AVXSupport: boolean;inline;
+      begin
+        result:=_AVXSupport;
       end;
       end;
 
 
 begin
 begin
-  is_sse3_cpu:=sse3_support;
+  SetupSupport;
 end.
 end.

+ 6 - 0
rtl/inc/systemh.inc

@@ -142,6 +142,12 @@ Type
 {$ifdef CPUM68K}
 {$ifdef CPUM68K}
   {$define DEFAULT_DOUBLE}
   {$define DEFAULT_DOUBLE}
 
 
+  {$ifdef CPUCOLDFIRE}
+    {$define FPC_INCLUDE_SOFTWARE_MOD_DIV}
+    {$define FPC_INCLUDE_SOFTWARE_MUL}
+    {$define FPC_INCLUDE_SOFTWARE_SHIFT_INT64}
+  {$endif}
+
   {$define SUPPORT_SINGLE}
   {$define SUPPORT_SINGLE}
   {$define SUPPORT_DOUBLE}
   {$define SUPPORT_DOUBLE}
 
 

+ 6 - 0
rtl/linux/m68k/prt0.as

@@ -73,6 +73,12 @@ _haltproc:
         bras  _haltproc
         bras  _haltproc
 
 
 .bss
 .bss
+        .type   __stkptr,@object
+        .size   __stkptr,4
+        .global __stkptr
+__stkptr:
+        .skip   4
+
         .type operatingsystem_parameters,@object
         .type operatingsystem_parameters,@object
         .size operatingsystem_parameters,12
         .size operatingsystem_parameters,12
 operatingsystem_parameters:
 operatingsystem_parameters:

+ 2 - 0
rtl/linux/m68k/sighnd.inc

@@ -47,10 +47,12 @@ const
 
 
 Procedure ResetFPU;
 Procedure ResetFPU;
 begin
 begin
+{$ifdef CPU68020}
   asm
   asm
     fmove.l fpucw,fpcr
     fmove.l fpucw,fpcr
     fmove.l fpust,fpsr
     fmove.l fpust,fpsr
   end;
   end;
+{$endif}
 end;
 end;
 
 
 
 

+ 42 - 3
rtl/linux/m68k/syscall.inc

@@ -23,38 +23,77 @@
 
 
 function FpSysCall(sysnr:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL0'];
 function FpSysCall(sysnr:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL0'];
   asm
   asm
+    move.l sysnr, d0
+    trap #0
+    move.l d0, @Result
   end;
   end;
 
 
 
 
 function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL1'];
 function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL1'];
   asm
   asm
+    move.l sysnr, d0
+    move.l param1, d1
+    trap #0
+    move.l d0, @Result
   end;
   end;
 
 
 
 
 function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL2'];
 function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL2'];
   asm
   asm
+    move.l sysnr, d0
+    move.l param1, d1
+    move.l param2, d2
+    trap #0
+    move.l d0, @Result
   end;
   end;
 
 
 
 
 function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL3'];
 function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL3'];
   asm
   asm
+    move.l sysnr, d0
+    move.l param1, d1
+    move.l param2, d2
+    move.l param3, d3
+    trap #0
+    move.l d0, @Result
   end;
   end;
 
 
 
 
 function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL4'];
 function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL4'];
   asm
   asm
+    move.l sysnr, d0
+    move.l param1, d1
+    move.l param2, d2
+    move.l param3, d3
+    move.l param4, d4
+    trap #0
+    move.l d0, @Result
   end;
   end;
 
 
 
 
 function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL5'];
 function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL5'];
   asm
   asm
+    move.l sysnr, d0
+    move.l param1, d1
+    move.l param2, d2
+    move.l param3, d3
+    move.l param4, d4
+    move.l param5, d5
+    trap #0
+    move.l d0, @Result
   end;
   end;
 
 
 
 
-{$ifdef notsupported}
 function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL6'];
 function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL6'];
   asm
   asm
+    move.l sysnr, d0
+    move.l param1, d1
+    move.l param2, d2
+    move.l param3, d3
+    move.l param4, d4
+    move.l param5, d5
+    move.l param6, a0
+    trap #0
+    move.l d0, @Result
   end;
   end;
 
 
-
-{$endif notsupported}

+ 0 - 2
rtl/linux/m68k/syscallh.inc

@@ -31,7 +31,5 @@ function Do_SysCall(sysnr,param1,param2:TSysParam):TSysResult; external name 'FP
 function Do_SysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_SYSCALL3';
 function Do_SysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; external name 'FPC_SYSCALL3';
 function Do_SysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_SYSCALL4';
 function Do_SysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; external name 'FPC_SYSCALL4';
 function Do_SysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; external name 'FPC_SYSCALL5';
 function Do_SysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; external name 'FPC_SYSCALL5';
-{$ifdef notsupported}
 function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; external name 'FPC_SYSCALL6';
 function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; external name 'FPC_SYSCALL6';
-{$endif notsupported}
 
 

+ 4 - 4
rtl/linux/m68k/sysnr.inc

@@ -258,8 +258,8 @@ Const
         syscall_nr_fremovexattr         = 234;
         syscall_nr_fremovexattr         = 234;
         syscall_nr_futex                = 235;
         syscall_nr_futex                = 235;
         syscall_nr_sendfile64           = 236;
         syscall_nr_sendfile64           = 236;
-        syscall_nr_mincore              = 237;
-        syscall_nr_madvise              = 238;
+        //syscall_nr_mincore              = 237;
+        //syscall_nr_madvise              = 238;
         syscall_nr_fcntl64              = 239;
         syscall_nr_fcntl64              = 239;
         syscall_nr_readahead            = 240;
         syscall_nr_readahead            = 240;
         syscall_nr_io_setup             = 241;
         syscall_nr_io_setup             = 241;
@@ -322,8 +322,8 @@ Const
         syscall_nr_readlinkat           = 298;
         syscall_nr_readlinkat           = 298;
         syscall_nr_fchmodat             = 299;
         syscall_nr_fchmodat             = 299;
         syscall_nr_faccessat            = 300;
         syscall_nr_faccessat            = 300;
-        syscall_nr_ni_syscall           = 301;
-        syscall_nr_ni_syscall           = 302;
+        //syscall_nr_ni_syscall           = 301;
+        //syscall_nr_ni_syscall           = 302;
         syscall_nr_unshare              = 303;
         syscall_nr_unshare              = 303;
         syscall_nr_set_robust_list      = 304;
         syscall_nr_set_robust_list      = 304;
         syscall_nr_get_robust_list      = 305;
         syscall_nr_get_robust_list      = 305;

+ 0 - 1
rtl/linux/system.pp

@@ -355,7 +355,6 @@ begin
   StackBottom := initialstkptr - StackLength;
   StackBottom := initialstkptr - StackLength;
   { Set up signals handlers (may be needed by init code to test cpu features) }
   { Set up signals handlers (may be needed by init code to test cpu features) }
   InstallSignals;
   InstallSignals;
-
 {$if defined(cpui386) or defined(cpuarm)}
 {$if defined(cpui386) or defined(cpuarm)}
   fpc_cpucodeinit;
   fpc_cpucodeinit;
 {$endif cpui386}
 {$endif cpui386}

+ 239 - 0
rtl/linux/termios.inc

@@ -1474,6 +1474,245 @@ const
   TCSAFLUSH = TCSETSF;
   TCSAFLUSH = TCSETSF;
 {$endif CPUMIPS}
 {$endif CPUMIPS}
 
 
+{$ifdef CPUM68K}
+
+const
+  TCGETS = $5401;
+  TCSETS = $5402;
+  TCSETSW = $5403;
+  TCSETSF = $5404;
+  TCGETA = $5405;
+  TCSETA = $5406;
+  TCSETAW = $5407;
+  TCSETAF = $5408;
+  TCSBRK = $5409;
+  TCXONC = $540A;
+  TCFLSH = $540B;
+  TIOCEXCL = $540C;
+  TIOCNXCL = $540D;
+  TIOCSCTTY = $540E;
+  TIOCGPGRP = $540F;
+  TIOCSPGRP = $5410;
+  TIOCOUTQ = $5411;
+  TIOCSTI = $5412;
+  TIOCGWINSZ = $5413;
+  TIOCSWINSZ = $5414;
+  TIOCMGET = $5415;
+  TIOCMBIS = $5416;
+  TIOCMBIC = $5417;
+  TIOCMSET = $5418;
+  TIOCGSOFTCAR = $5419;
+  TIOCSSOFTCAR = $541A;
+  FIONREAD = $541B;
+  TIOCINQ = FIONREAD;
+  TIOCLINUX = $541C;
+  TIOCCONS = $541D;
+  TIOCGSERIAL = $541E;
+  TIOCSSERIAL = $541F;
+  TIOCPKT = $5420;
+  FIONBIO = $5421;
+  TIOCNOTTY = $5422;
+  TIOCSETD = $5423;
+  TIOCGETD = $5424;
+  TCSBRKP = $5425;
+  TIOCSBRK = $5427;
+  TIOCCBRK = $5428;
+  TIOCGSID = $5429;
+  TIOCGRS485 = $542E;
+  TIOCSRS485 = $542F;
+  TCGETX = $5432;
+  TCSETX = $5433;
+  TCSETXF = $5434;
+  TCSETXW = $5435;
+  TIOCVHANGUP = $5437;
+  FIONCLEX = $5450;
+  FIOCLEX = $5451;
+  FIOASYNC = $5452;
+  TIOCSERCONFIG = $5453;
+  TIOCSERGWILD = $5454;
+  TIOCSERSWILD = $5455;
+  TIOCGLCKTRMIOS = $5456;
+  TIOCSLCKTRMIOS = $5457;
+  TIOCSERGSTRUCT = $5458;
+  TIOCSERGETLSR = $5459;
+  TIOCSERGETMULTI = $545A;
+  TIOCSERSETMULTI = $545B;
+  TIOCMIWAIT = $545C;
+  TIOCGICOUNT = $545D;
+
+  { c_cc characters  }
+  VINTR = 0;
+  VQUIT = 1;
+  VERASE = 2;
+  VKILL = 3;
+  VEOF = 4;
+  VTIME = 5;
+  VMIN = 6;
+  VSWTC = 7;
+  VSTART = 8;
+  VSTOP = 9;
+  VSUSP = 10;
+  VEOL = 11;
+  VREPRINT = 12;
+  VDISCARD = 13;
+  VWERASE = 14;
+  VLNEXT = 15;
+  VEOL2 = 16;
+
+  { c_iflag bits  }
+  IGNBRK = &000001;
+  BRKINT = &000002;
+  IGNPAR = &000004;
+  PARMRK = &000010;
+  INPCK = &000020;
+  ISTRIP = &000040;
+  INLCR = &000100;
+  IGNCR = &000200;
+  ICRNL = &000400;
+  IUCLC = &001000;
+  IXON = &002000;
+  IXANY = &004000;
+  IXOFF = &010000;
+  IMAXBEL = &020000;
+  IUTF8 = &040000;
+
+  { c_oflag bits  }
+  OPOST = &000001;
+  OLCUC = &000002;
+  ONLCR = &000004;
+  OCRNL = &000010;
+  ONOCR = &000020;
+  ONLRET = &000040;
+  OFILL = &000100;
+  OFDEL = &000200;
+  NLDLY = &000400;
+  NL0 = &000000;
+  NL1 = &000400;
+  CRDLY = &003000;
+  CR0 = &000000;
+  CR1 = &001000;
+  CR2 = &002000;
+  CR3 = &003000;
+  TABDLY = &014000;
+  TAB0 = &000000;
+  TAB1 = &004000;
+  TAB2 = &010000;
+  TAB3 = &014000;
+  XTABS = &014000;
+  BSDLY = &020000;
+  BS0 = &000000;
+  BS1 = &020000;
+  VTDLY = &040000;
+  VT0 = &000000;
+  VT1 = &040000;
+  FFDLY = &100000;
+  FF0 = &000000;
+  FF1 = &100000;
+
+  { c_cflag bit meaning  }
+  CBAUD = &010017;
+
+  { hang up  }
+  B0 = &000000;
+  B50 = &000001;
+  B75 = &000002;
+  B110 = &000003;
+  B134 = &000004;
+  B150 = &000005;
+  B200 = &000006;
+  B300 = &000007;
+  B600 = &000010;
+  B1200 = &000011;
+  B1800 = &000012;
+  B2400 = &000013;
+  B4800 = &000014;
+  B9600 = &000015;
+  B19200 = &000016;
+  B38400 = &000017;
+  EXTA = B19200;
+  EXTB = B38400;
+  CSIZE = &000060;
+  CS5 = &000000;
+  CS6 = &000020;
+  CS7 = &000040;
+  CS8 = &000060;
+  CSTOPB = &000100;
+  CREAD = &000200;
+  PARENB = &000400;
+  PARODD = &001000;
+  HUPCL = &002000;
+  CLOCAL = &004000;
+  CBAUDEX = &010000;
+  BOTHER = &010000;
+  B57600 = &010001;
+  B115200 = &010002;
+  B230400 = &010003;
+  B460800 = &010004;
+  B500000 = &010005;
+  B576000 = &010006;
+  B921600 = &010007;
+  B1000000 = &010010;
+  B1152000 = &010011;
+  B1500000 = &010012;
+  B2000000 = &010013;
+  B2500000 = &010014;
+  B3000000 = &010015;
+  B3500000 = &010016;
+  B4000000 = &010017;
+  CIBAUD = &02003600000;
+  CMSPAR = &10000000000;
+  CRTSCTS = &20000000000;
+  IBSHIFT = 16;
+
+  { c_lflag bits  }
+  ISIG = &000001;
+  ICANON = &000002;
+  XCASE = &000004;
+  ECHO = &000010;
+  ECHOE = &000020;
+  ECHOK = &000040;
+  ECHONL = &000100;
+  NOFLSH = &000200;
+  TOSTOP = &000400;
+  ECHOCTL = &001000;
+  ECHOPRT = &002000;
+  ECHOKE = &004000;
+  FLUSHO = &010000;
+  PENDIN = &040000;
+  IEXTEN = &100000;
+  EXTPROC = &200000;
+
+  TCOOFF = 0;
+  TCOON = 1;
+  TCIOFF = 2;
+  TCION = 3;
+
+  TCIFLUSH = 0;
+  TCOFLUSH = 1;
+  TCIOFLUSH = 2;
+
+  TCSANOW = 0;
+  TCSADRAIN = 1;
+  TCSAFLUSH = 2;
+
+  { modem lines }
+  TIOCM_LE = $001;
+  TIOCM_DTR = $002;
+  TIOCM_RTS = $004;
+  TIOCM_ST = $008;
+  TIOCM_SR = $010;
+  TIOCM_CTS = $020;
+  TIOCM_CAR = $040;
+  TIOCM_RNG = $080;
+  TIOCM_DSR = $100;
+  TIOCM_CD = TIOCM_CAR;
+  TIOCM_RI = TIOCM_RNG;
+  TIOCM_OUT1 = $2000;
+  TIOCM_OUT2 = $4000;
+  TIOCM_LOOP = $8000;
+
+{$endif CPUM68K}
+
 Type
 Type
   winsize = record
   winsize = record
     ws_row,
     ws_row,

+ 25 - 0
rtl/m68k/m68k.inc

@@ -95,7 +95,12 @@ procedure FillChar(var x;count:longint;value:byte); assembler;
    @LMEMSET4:             { fast loop mode section 68010+ }
    @LMEMSET4:             { fast loop mode section 68010+ }
      move.b d0,(a0)+
      move.b d0,(a0)+
    @LMEMSET3:
    @LMEMSET3:
+{$ifdef CPUCOLDFIRE}
+     sub.l #1,d1
+     bmi @LMEMSET4
+{$else}
      dbra d1,@LMEMSET4
      dbra d1,@LMEMSET4
+{$endif}
 
 
    @LMEMSET5:
    @LMEMSET5:
     end ['d0','d1','a0'];
     end ['d0','d1','a0'];
@@ -137,7 +142,12 @@ asm
 @LMSTRCOPY56:         { 68010 Fast loop mode }
 @LMSTRCOPY56:         { 68010 Fast loop mode }
    move.b (a0)+,(a1)+
    move.b (a0)+,(a1)+
 @LMSTRCOPY55:
 @LMSTRCOPY55:
+{$ifdef CPUCOLDFIRE}
+   sub.l #1,d1
+   bmi @LMSTRCOPY56
+{$else}
    dbra  d1,@LMSTRCOPY56
    dbra  d1,@LMSTRCOPY56
+{$endif}
 @Lend:
 @Lend:
 end;
 end;
 
 
@@ -172,7 +182,12 @@ procedure strconcat(s1,s2 : pointer);[public,alias: 'STRCONCAT'];
 @Loop:
 @Loop:
       move.b  (a1)+,(a0)+          { s1[i] := s2[i];             }
       move.b  (a1)+,(a0)+          { s1[i] := s2[i];             }
 @ALoop:
 @ALoop:
+{$ifdef CPUCOLDFIRE}
+      sub.l   #1,d6
+      bmi     @Loop
+{$else}
       dbra    d6,@Loop
       dbra    d6,@Loop
+{$endif}
       move.l  s1,a0
       move.l  s1,a0
       add.b   d0,(a0)              { change to new string length }
       add.b   d0,(a0)              { change to new string length }
 @Lend:
 @Lend:
@@ -270,12 +285,22 @@ begin
   @LMOVE01:
   @LMOVE01:
     move.b   -(a0),-(a1)   {  (s < d) copy loop }
     move.b   -(a0),-(a1)   {  (s < d) copy loop }
   @LMOVE02:
   @LMOVE02:
+{$ifdef CPUCOLDFIRE}
+    sub.l     #1,d0
+    bmi       @LMOVE01
+{$else}
     dbra      d0,@LMOVE01
     dbra      d0,@LMOVE01
+{$endif}
     bra       @LMOVE5
     bra       @LMOVE5
   @LMOVE03:
   @LMOVE03:
     move.b  (a0)+,(a1)+  { (s >= d) copy loop }
     move.b  (a0)+,(a1)+  { (s >= d) copy loop }
   @LMOVE04:
   @LMOVE04:
+{$ifdef CPUCOLDFIRE}
+    sub.l     #1,d0
+    bmi       @LMOVE03
+{$else}
     dbra      d0,@LMOVE03
     dbra      d0,@LMOVE03
+{$endif}
   { end fast loop mode }
   { end fast loop mode }
   @LMOVE5:
   @LMOVE5:
   end ['d0','a0','a1'];
   end ['d0','a0','a1'];

+ 26 - 0
rtl/m68k/mathu.inc

@@ -0,0 +1,26 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2012 by Sven Barth
+    member of the Free Pascal development team
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$warning TODO}
+
+function GetExceptionMask: TFPUExceptionMask;
+begin
+  Result := [];
+end;
+
+function SetExceptionMask(const Mask: TFPUExceptionMask): TFPUExceptionMask;
+begin
+  { TODO }
+end;
+

+ 24 - 0
rtl/m68k/mathuh.inc

@@ -0,0 +1,24 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2012 by Sven Barth
+    member of the Free Pascal development team
+
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+
+{$warning TODO}
+
+type
+  TFPUException = (exInvalidOp, exDenormalized, exZeroDivide,
+                   exOverflow, exUnderflow, exPrecision);
+  TFPUExceptionMask = set of TFPUException;
+
+function GetExceptionMask: TFPUExceptionMask;
+function SetExceptionMask(const Mask: TFPUExceptionMask): TFPUExceptionMask;
+

+ 4 - 1
rtl/m68k/set.inc

@@ -19,7 +19,10 @@
 {  Based on original code bt Florian Kl„mpfl  for the 80x86.              }
 {  Based on original code bt Florian Kl„mpfl  for the 80x86.              }
 {*************************************************************************}
 {*************************************************************************}
 
 
+{ Edit by Sven: No m68k specific set routines for now (doesn't seem to be
+                compatible to the way FPC handles sets today anyway...) }
 
 
+{$ifdef use_m68k_sets}
   { add the element b to the set pointed by p }
   { add the element b to the set pointed by p }
   { On entry                                   }
   { On entry                                   }
   {  a0    = pointer to set                    }
   {  a0    = pointer to set                    }
@@ -418,4 +421,4 @@
        @BIGMCOMPSETEND:
        @BIGMCOMPSETEND:
         end;
         end;
      end;
      end;
-
+{$endif}

+ 1 - 5
rtl/mips/mips.inc

@@ -17,16 +17,12 @@
                            MIPS specific stuff
                            MIPS specific stuff
 ****************************************************************************}
 ****************************************************************************}
 function get_fsr : dword;assembler;nostackframe;[public, alias: 'FPC_GETFSR'];
 function get_fsr : dword;assembler;nostackframe;[public, alias: 'FPC_GETFSR'];
-  var
-    fsr : dword;
   asm
   asm
     cfc1 $2,$31
     cfc1 $2,$31
   end;
   end;
 
 
 
 
-procedure set_fsr(fsr : dword);assembler;[public, alias: 'FPC_SETFSR'];
-  var
-    _fsr : dword;
+procedure set_fsr(fsr : dword);assembler;nostackframe;[public, alias: 'FPC_SETFSR'];
   asm
   asm
     ctc1 $4,$31
     ctc1 $4,$31
   end;
   end;

+ 4 - 2
rtl/objpas/sysutils/dati.inc

@@ -220,8 +220,10 @@ end ;
 
 
 function DayOfWeek(DateTime: TDateTime): integer;
 function DayOfWeek(DateTime: TDateTime): integer;
 begin
 begin
-  Result := 1 + (Abs(Trunc(DateTime) - 1) mod 7);
-end ;
+  Result := 1 + ((Trunc(DateTime) - 1) mod 7);
+  If (Result<=0) then
+    Inc(Result,7);
+end;
 
 
 {   Date returns the current Date   }
 {   Date returns the current Date   }
 
 

+ 28 - 0
rtl/x86_64/cpu.pp

@@ -30,6 +30,7 @@ unit cpu;
 
 
     function InterlockedCompareExchange128Support : boolean;inline;
     function InterlockedCompareExchange128Support : boolean;inline;
     function AESSupport : boolean;inline;
     function AESSupport : boolean;inline;
+    function AVXSupport : boolean;inline;
 
 
     var
     var
       is_sse3_cpu : boolean = false;
       is_sse3_cpu : boolean = false;
@@ -40,6 +41,7 @@ unit cpu;
 
 
     var
     var
       _AESSupport,
       _AESSupport,
+      _AVXSupport,
       _InterlockedCompareExchange128Support : boolean;
       _InterlockedCompareExchange128Support : boolean;
 
 
     function InterlockedCompareExchange128Support : boolean;inline;
     function InterlockedCompareExchange128Support : boolean;inline;
@@ -52,6 +54,10 @@ unit cpu;
         result:=_AESSupport;
         result:=_AESSupport;
       end;
       end;
 
 
+    function AVXSupport: boolean;
+      begin
+        result:=_AVXSupport;
+      end;
 
 
     function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler;
     function InterlockedCompareExchange128(var Target: Int128Rec; NewValue: Int128Rec; Comperand: Int128Rec): Int128Rec; assembler;
      {
      {
@@ -119,6 +125,19 @@ unit cpu;
     {$endif win64}
     {$endif win64}
 
 
 
 
+    function XGETBV(i : dword) : int64;assembler;
+      asm
+    {$ifndef win64}
+        movq %rdi,%rcx
+    {$endif win64}
+        // older FPCs don't know the xgetbv opcode
+        .byte 0x0f,0x01,0xd0
+        andl $0xffffffff,%eax
+        shll $32,%rdx
+        orq %rdx,%rax
+      end;
+
+
     procedure SetupSupport;
     procedure SetupSupport;
       var
       var
         _ecx : longint;
         _ecx : longint;
@@ -132,6 +151,15 @@ unit cpu;
         end;
         end;
         _InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
         _InterlockedCompareExchange128Support:=(_ecx and $2000)<>0;
         _AESSupport:=(_ecx and $2000000)<>0;
         _AESSupport:=(_ecx and $2000000)<>0;
+
+        _AVXSupport:=
+          { XGETBV suspport? }
+          ((_ecx and $08000000)<>0) and
+          { xmm and ymm state enabled? }
+          ((XGETBV(0) and %110)=%110) and
+          { avx supported? }
+          ((_ecx and $10000000)<>0);
+
         is_sse3_cpu:=(_ecx and $1)<>0;
         is_sse3_cpu:=(_ecx and $1)<>0;
       end;
       end;
 
 

+ 1 - 1
tests/tbs/tb0072.pp

@@ -52,7 +52,7 @@ asm
   mov y,%i1
   mov y,%i1
 end;
 end;
 {$endif CPUSPARC}
 {$endif CPUSPARC}
-{$ifdef CPUSMIPS}
+{$ifdef CPUMIPS}
 {$define SUPPORTED}
 {$define SUPPORTED}
 asm
 asm
   lw $t1,x
   lw $t1,x

+ 28 - 0
tests/test/tnostackframe.pp

@@ -0,0 +1,28 @@
+{ %fail }
+{ %opt=-Sew }
+
+{ This is a border case:
+  the result could be considered to reside only in
+  the function result register,
+  in which case no stack space would be required... }
+
+  { This is the reason of the -Sew option,
+    this test must fail because a warning sould be issued
+    about nostackframe without assembler.
+    Please do not remove -Sew option. PM 2012-10-17 }
+
+function test : longint; nostackframe;
+
+begin
+  test:=5;
+end;
+
+begin
+  if test<>5 then
+    begin
+      writeln('Wrong result in  nostackframe non-assembler function');
+      halt(1);
+    end
+  else
+    writeln('Pascal function nostackframe works OK');
+end.

+ 24 - 0
tests/test/tnostackframe2.pp

@@ -0,0 +1,24 @@
+{ %fail }
+{%opt=-O- }
+{ This function defines a local var which needs stack space,
+  so nostackframe should always be invalid.
+  -O- option used because with -O3 both result
+  and x variable can be regvars, so that there is no error! }
+
+function test : longint; nostackframe;
+var
+  x : longint;
+begin
+  x:=4;
+  test:=5*x;
+end;
+
+begin
+  if test<>20 then
+    begin
+      writeln('Wrong result in  nostackframe non-assembler function');
+      halt(1);
+    end
+  else
+    writeln('Pascal function nostackframe works OK');
+end.

+ 19 - 0
tests/test/tnostackframe3.pp

@@ -0,0 +1,19 @@
+
+var
+  x :longint;
+procedure test; nostackframe;
+begin
+  x:=78;
+end;
+
+begin
+  x:=-1;
+  test;
+  if x<>78 then
+    begin
+      writeln('Wrong result in  nostackframe non-assembler procedure');
+      halt(1);
+    end
+  else
+    writeln('Pascal procedure nostackframe works OK');
+end.

+ 5 - 3
utils/importtl/importtl.pas

@@ -11,7 +11,7 @@ var
   F:text;
   F:text;
   slDep:TStringList;
   slDep:TStringList;
   i:integer;
   i:integer;
-  bNoRecurse,bHelp,bActiveX,bPackage:boolean;
+  bNoRecurse,bHelp,bActiveX,bPackage,bRemoveStructTag:boolean;
 begin
 begin
   slDep:=TStringList.Create;
   slDep:=TStringList.Create;
   bNoRecurse:=false;
   bNoRecurse:=false;
@@ -25,6 +25,7 @@ begin
     else if pos('-a',ParamStr(i))>0 then bActiveX:=true
     else if pos('-a',ParamStr(i))>0 then bActiveX:=true
     else if pos('-h',ParamStr(i))>0 then bHelp:=true
     else if pos('-h',ParamStr(i))>0 then bHelp:=true
     else if pos('-p',ParamStr(i))>0 then bPackage:=true
     else if pos('-p',ParamStr(i))>0 then bPackage:=true
+    else if pos('-t',ParamStr(i))>0 then bRemoveStructTag:=true
     else if pos('-d',ParamStr(i))>0 then
     else if pos('-d',ParamStr(i))>0 then
       begin
       begin
       sOutDir:=trim(copy(ParamStr(i), pos('-d',ParamStr(i))+2, 260));  // windows MAX_PATH
       sOutDir:=trim(copy(ParamStr(i), pos('-d',ParamStr(i))+2, 260));  // windows MAX_PATH
@@ -53,16 +54,17 @@ begin
     writeln('  -h    : displays this text.');
     writeln('  -h    : displays this text.');
     writeln('  -a    : create ActiveXContainer descendants');
     writeln('  -a    : create ActiveXContainer descendants');
     writeln('  -d dir: set output directory. Default: current directory.');
     writeln('  -d dir: set output directory. Default: current directory.');
-    writeln('  -n    : do not recurse typelibs. Default: create bindingss for all');
+    writeln('  -n    : do not recurse typelibs. Default: create bindings for all');
     writeln('          dependencies.');
     writeln('          dependencies.');
     writeln('  -p    : create lazarus package for ActiveXContainer descendants');
     writeln('  -p    : create lazarus package for ActiveXContainer descendants');
+    writeln('  -t    : remove "tag" prefix from structs');
     exit;
     exit;
     end;
     end;
   slDep.Add(paramstr(Paramcount));
   slDep.Add(paramstr(Paramcount));
   i:=0;
   i:=0;
   repeat
   repeat
     writeln('Reading typelib from '+slDep[i]+ ' ...');
     writeln('Reading typelib from '+slDep[i]+ ' ...');
-    sTL:=ImportTypelib(slDep[i],unitname,slDep,bActiveX,bPackage,sPackageSource,sPackageRegUnitSource);
+    sTL:=ImportTypelib(slDep[i],unitname,slDep,bActiveX,bPackage,bRemoveStructTag,sPackageSource,sPackageRegUnitSource);
     unitname:=sOutDir+unitname;
     unitname:=sOutDir+unitname;
     if (bPackage) and (sPackageSource<>'') then
     if (bPackage) and (sPackageSource<>'') then
       begin
       begin