Browse Source

Merged revisions 1756,1764-1774,1776-1777,1784-1785,1787,1791,1797,1813,1823,1825-1826,1829-1869,1871-1872,1875-1878,1880-1881,1884,1890-1891 via svnmerge from
http://[email protected]/svn/fpc/trunk

........
r1756 | tom_at_work | 2005-11-15 18:27:42 +0100 (Tue, 15 Nov 2005) | 3 lines

* ppc32/linux: cprt0 update, fixing linking to libc
* ppc32/linux: stat update, making the compiler cycle with -dFPC_USE_LIBC again
* fixed typo in ugetrlimit libc function name
........
r1764 | peter | 2005-11-16 07:38:33 +0100 (Wed, 16 Nov 2005) | 2 lines

* Mac conversions from Mark de Wever

........
r1765 | hajny | 2005-11-16 19:43:48 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1766 | hajny | 2005-11-16 19:44:13 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1767 | hajny | 2005-11-16 19:46:15 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1768 | hajny | 2005-11-16 19:47:29 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1769 | hajny | 2005-11-16 19:47:52 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1770 | hajny | 2005-11-16 19:59:33 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1771 | hajny | 2005-11-16 19:59:57 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1772 | hajny | 2005-11-16 20:00:21 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of buggy output for -? with path containing underscore
........
r1773 | tom_at_work | 2005-11-16 21:50:38 +0100 (Wed, 16 Nov 2005) | 3 lines

* fixed tb0488 on unix platforms (missing cwstring uses)
* 64bit big-endian fix of dynamic array handling
* added qword support for %x format specifier of format() functions
........
r1774 | tom_at_work | 2005-11-16 21:51:45 +0100 (Wed, 16 Nov 2005) | 2 lines

* renamed tb0488.pp to tb0488a.pp
* added tb0488b test program
........
r1776 | tom_at_work | 2005-11-16 22:08:30 +0100 (Wed, 16 Nov 2005) | 1 line

* fix of test tw3697 for unix platforms
........
r1777 | joost | 2005-11-17 17:06:40 +0100 (Thu, 17 Nov 2005) | 1 line

+ avoided mem-leak
........
r1784 | hajny | 2005-11-19 00:40:06 +0100 (Sat, 19 Nov 2005) | 1 line

* FPC version is (at least) 2.0.2 now
........
r1785 | jonas | 2005-11-19 18:31:35 +0100 (Sat, 19 Nov 2005) | 3 lines

* use stmw/lmw when saving/restoring a lot of registers, to reduce generated
code size and thus instruction cache pressure.

........
r1787 | tom_at_work | 2005-11-20 02:21:55 +0100 (Sun, 20 Nov 2005) | 1 line

* ppc32: added FPU configuration code in math unit (fixes tw3161)
........
r1791 | florian | 2005-11-20 10:11:23 +0100 (Sun, 20 Nov 2005) | 1 line

* copying of classes fixed, closes 3930
........
r1797 | florian | 2005-11-20 23:19:37 +0100 (Sun, 20 Nov 2005) | 2 lines

* hopefully fixed setup of long/shortdateformat setup

........
r1813 | karoly | 2005-11-24 05:58:15 +0100 (Thu, 24 Nov 2005) | 2 lines

Merged r1666 changes from fixes branch

........
r1823 | florian | 2005-11-26 00:08:46 +0100 (Sat, 26 Nov 2005) | 2 lines

* fixed m68k compilation while sitting bored in the train

........
r1825 | daniel | 2005-11-26 00:39:54 +0100 (Sat, 26 Nov 2005) | 2 lines

* Interface unit to fftw library

........
r1826 | daniel | 2005-11-26 00:41:49 +0100 (Sat, 26 Nov 2005) | 2 lines

* fast -> fastest

........
r1829 | karoly | 2005-11-26 23:47:39 +0100 (Sat, 26 Nov 2005) | 3 lines

* Few more changes for MorphOS OpenGL support
* TinyGL unit moved to RTL, because it fits there better

........
r1830 | karoly | 2005-11-27 05:10:09 +0100 (Sun, 27 Nov 2005) | 2 lines

+ Support unit for MUI widget kit added

........
r1831 | karoly | 2005-11-27 05:16:40 +0100 (Sun, 27 Nov 2005) | 2 lines

* Makefile adjustments for MUI

........
r1832 | karoly | 2005-11-27 07:01:50 +0100 (Sun, 27 Nov 2005) | 2 lines

+ Implemented (hopefully correct) DoSuperMethodA()

........
r1833 | karoly | 2005-11-27 07:51:01 +0100 (Sun, 27 Nov 2005) | 2 lines

+ some more emulinterface consts added

........
r1834 | daniel | 2005-11-27 23:33:16 +0100 (Sun, 27 Nov 2005) | 2 lines

* Add fftw

........
r1835 | karoly | 2005-11-28 04:29:37 +0100 (Mon, 28 Nov 2005) | 2 lines

* Changes for better MUI support

........
r1836 | karoly | 2005-11-28 04:48:33 +0100 (Mon, 28 Nov 2005) | 2 lines

* fixed double identifier

........
r1837 | karoly | 2005-11-28 04:52:14 +0100 (Mon, 28 Nov 2005) | 2 lines

* Modified makefile to match the changes

........
r1838 | daniel | 2005-11-28 08:47:44 +0100 (Mon, 28 Nov 2005) | 2 lines

* Add {$inline on}

........
r1839 | daniel | 2005-11-29 09:42:30 +0100 (Tue, 29 Nov 2005) | 2 lines

* Version upgrade to final version from 7 april 2000

........
r1840 | daniel | 2005-11-29 09:59:26 +0100 (Tue, 29 Nov 2005) | 2 lines

* Renamed to crc.pas

........
r1841 | daniel | 2005-11-29 10:00:03 +0100 (Tue, 29 Nov 2005) | 2 lines

* Rename gzcrc

........
r1842 | daniel | 2005-11-29 10:32:53 +0100 (Tue, 29 Nov 2005) | 2 lines

* Rename crc unit

........
r1843 | daniel | 2005-11-29 11:34:25 +0100 (Tue, 29 Nov 2005) | 3 lines

* Replace C types with native Pascal types
* Avoid sysutils overhead

........
r1844 | daniel | 2005-11-29 18:01:04 +0100 (Tue, 29 Nov 2005) | 2 lines

* Kill zmemcpy and zmemzero

........
r1845 | daniel | 2005-11-30 00:21:29 +0100 (Wed, 30 Nov 2005) | 2 lines

* Remove defines in zutil

........
r1846 | daniel | 2005-11-30 00:28:32 +0100 (Wed, 30 Nov 2005) | 3 lines

var & const were sometimes lowercased, sometimes uppercased. Put them
in lowercase.

........
r1847 | daniel | 2005-11-30 00:32:51 +0100 (Wed, 30 Nov 2005) | 2 lines

* Remove unused zmemcmp

........
r1848 | daniel | 2005-11-30 00:40:30 +0100 (Wed, 30 Nov 2005) | 2 lines

* Remove FPC define

........
r1849 | daniel | 2005-11-30 00:46:30 +0100 (Wed, 30 Nov 2005) | 2 lines

* Remove FPC define

........
r1850 | daniel | 2005-11-30 00:53:33 +0100 (Wed, 30 Nov 2005) | 2 lines

* Kill zalloc, zfree fields and start conversion to standard getmem & freemem

........
r1851 | jonas | 2005-11-30 22:17:16 +0100 (Wed, 30 Nov 2005) | 2 lines

* added {$goto on} to fix compilation

........
r1852 | michael | 2005-11-30 22:30:28 +0100 (Wed, 30 Nov 2005) | 1 line

+ Fixed Native Format issues of TDateTime fields
........
r1853 | michael | 2005-11-30 22:52:14 +0100 (Wed, 30 Nov 2005) | 1 line

+ date/time stuff is written in native format
........
r1854 | daniel | 2005-12-01 08:50:09 +0100 (Thu, 01 Dec 2005) | 2 lines

* Fix compilation

........
r1855 | daniel | 2005-12-01 17:11:37 +0100 (Thu, 01 Dec 2005) | 2 lines

* Remove "uses base"

........
r1856 | daniel | 2005-12-01 17:45:44 +0100 (Thu, 01 Dec 2005) | 2 lines

* Rename unit crc to fpccrc to avoid name conflict in packages

........
r1857 | daniel | 2005-12-01 19:32:39 +0100 (Thu, 01 Dec 2005) | 3 lines

* Rename md5 directory to hash for hash functions
* Move crc.pas into hash

........
r1858 | daniel | 2005-12-01 19:33:06 +0100 (Thu, 01 Dec 2005) | 2 lines

* Adapt Makefiles

........
r1859 | daniel | 2005-12-01 19:33:40 +0100 (Thu, 01 Dec 2005) | 2 lines

* Paszlib part of changes

........
r1860 | joost | 2005-12-01 22:25:56 +0100 (Thu, 01 Dec 2005) | 1 line

+ moved empty databasename check to TSQLConnection
........
r1861 | hajny | 2005-12-01 23:07:32 +0100 (Thu, 01 Dec 2005) | 1 line

* workaround for OS/2 bug - check for 64kB border crossing in parameters for DosExecPgm
........
r1862 | daniel | 2005-12-01 23:21:40 +0100 (Thu, 01 Dec 2005) | 2 lines

* Remove now obsolete unit zutil

........
r1863 | daniel | 2005-12-01 23:22:52 +0100 (Thu, 01 Dec 2005) | 2 lines

* Bump version number

........
r1864 | daniel | 2005-12-01 23:44:42 +0100 (Thu, 01 Dec 2005) | 2 lines

* zutil removal

........
r1865 | daniel | 2005-12-01 23:45:08 +0100 (Thu, 01 Dec 2005) | 2 lines

* zutil removal

........
r1866 | daniel | 2005-12-01 23:47:17 +0100 (Thu, 01 Dec 2005) | 2 lines

* Remove zutil

........
r1867 | daniel | 2005-12-01 23:52:54 +0100 (Thu, 01 Dec 2005) | 2 lines

* Inline most stuff in paszlib.pas

........
r1868 | daniel | 2005-12-02 06:30:24 +0100 (Fri, 02 Dec 2005) | 2 lines

* Add deflateInit2_

........
r1869 | jonas | 2005-12-02 12:09:13 +0100 (Fri, 02 Dec 2005) | 3 lines

* fixed crash when an optimized sequence extends till the start of an
assembler block

........
r1871 | daniel | 2005-12-02 22:05:28 +0100 (Fri, 02 Dec 2005) | 2 lines

* Isolated IE200311075 bug found today

........
r1872 | daniel | 2005-12-02 23:27:50 +0100 (Fri, 02 Dec 2005) | 4 lines

* Remove inline from problematic procedures. Problem isolated and moved to
testsuite.
* Added hash to requirements of some packages

........
r1875 | jonas | 2005-12-04 18:48:26 +0100 (Sun, 04 Dec 2005) | 3 lines

* fixed compilation on systems where comp = int64 (i.e., everything non-x86)
and thus incompatible with floating point types

........
r1876 | florian | 2005-12-04 19:29:07 +0100 (Sun, 04 Dec 2005) | 2 lines

* fixed compilerwidestring concatenation

........
r1877 | florian | 2005-12-04 19:29:29 +0100 (Sun, 04 Dec 2005) | 2 lines

* initial revision

........
r1878 | florian | 2005-12-04 19:35:19 +0100 (Sun, 04 Dec 2005) | 2 lines

* allow pred/succ on non continous enumerations in delphi mode

........
r1880 | florian | 2005-12-04 20:36:57 +0100 (Sun, 04 Dec 2005) | 2 lines

* resolve postponed local switch changes before switching mode

........
r1881 | joost | 2005-12-04 21:27:51 +0100 (Sun, 04 Dec 2005) | 1 line

+ fixed compilation
........
r1884 | michael | 2005-12-05 20:07:05 +0100 (Mon, 05 Dec 2005) | 1 line

+ Added XRandr from Nikolay Nikolov
........
........
r1891 | michael | 2005-12-06 21:57:57 +0100 (Tue, 06 Dec 2005) | 1 line

+ Added check for IsMultiThread in CheckSynchronize
........

git-svn-id: branches/fixes_2_0@1892 -

peter 20 years ago
parent
commit
7549fa9d59
100 changed files with 5158 additions and 2877 deletions
  1. 27 10
      .gitattributes
  2. 7 7
      .gitignore
  3. 1 1
      compiler/fpccrc.pas
  4. 20 6
      compiler/m68k/cpubase.pas
  5. 1 1
      compiler/msg/errorct.msg
  6. 1 1
      compiler/msg/errord.msg
  7. 1 1
      compiler/msg/errore.msg
  8. 1 1
      compiler/msg/errores.msg
  9. 1 1
      compiler/msg/errorf.msg
  10. 1 1
      compiler/msg/errorhe.msg
  11. 1 1
      compiler/msg/errorn.msg
  12. 1 1
      compiler/msg/errorpl.msg
  13. 1 1
      compiler/msg/errorpli.msg
  14. 1 1
      compiler/msg/errorptd.msg
  15. 1 1
      compiler/msg/errorptw.msg
  16. 1 1
      compiler/msg/errorr.msg
  17. 1 1
      compiler/msg/errorrw.msg
  18. 1 1
      compiler/msg/errorues.msg
  19. 1 1
      compiler/msgidx.inc
  20. 51 51
      compiler/msgtxt.inc
  21. 2 2
      compiler/ncon.pas
  22. 2 1
      compiler/ninl.pas
  23. 1 1
      compiler/pass_1.pas
  24. 28 4
      compiler/powerpc/cgcpu.pas
  25. 1 1
      compiler/ppu.pas
  26. 6 0
      compiler/scanner.pas
  27. 38 20
      compiler/symdef.pas
  28. 2 1
      compiler/widestr.pas
  29. 0 1
      compiler/x86/cpubase.pas
  30. 64 1
      fcl/Makefile
  31. 1 1
      fcl/Makefile.fpc
  32. 102 2
      fcl/db/dataset.inc
  33. 5 0
      fcl/db/db.pp
  34. 1 0
      fcl/db/dbconst.pp
  35. 19 7
      fcl/db/fields.inc
  36. 0 5
      fcl/db/sqldb/interbase/ibconnection.pp
  37. 0 4
      fcl/db/sqldb/postgres/pqconnection.pp
  38. 13 2
      fcl/db/sqldb/sqldb.pp
  39. 64 1
      fcl/image/Makefile
  40. 1 1
      fcl/image/Makefile.fpc
  41. 4 21
      fcl/inc/zstream.pp
  42. 2 2
      installer/install.dat
  43. 119 119
      packages/base/Makefile
  44. 1 1
      packages/base/Makefile.fpc
  45. 39 75
      packages/base/hash/Makefile
  46. 3 3
      packages/base/hash/Makefile.fpc
  47. 31 37
      packages/base/hash/crc.pas
  48. 10 0
      packages/base/hash/fpmake.inc
  49. 17 0
      packages/base/hash/fpmake.pp
  50. 0 0
      packages/base/hash/md5.pp
  51. 0 0
      packages/base/hash/md5.ref
  52. 0 0
      packages/base/hash/md5test.pp
  53. 101 38
      packages/base/paszlib/Makefile
  54. 4 1
      packages/base/paszlib/Makefile.fpc
  55. 10 12
      packages/base/paszlib/adler.pas
  56. 85 124
      packages/base/paszlib/example.pas
  57. 160 161
      packages/base/paszlib/gzio.pas
  58. 147 151
      packages/base/paszlib/infblock.pas
  59. 93 96
      packages/base/paszlib/infcodes.pas
  60. 88 91
      packages/base/paszlib/inffast.pas
  61. 97 97
      packages/base/paszlib/inftrees.pas
  62. 43 43
      packages/base/paszlib/infutil.pas
  63. 7 10
      packages/base/paszlib/minigzip.pas
  64. 112 106
      packages/base/paszlib/paszlib.pas
  65. 27 16
      packages/base/paszlib/readme.txt
  66. 221 232
      packages/base/paszlib/trees.pas
  67. 83 72
      packages/base/paszlib/zbase.pas
  68. 26 30
      packages/base/paszlib/zcompres.pas
  69. 13 1
      packages/base/paszlib/zconf.inc
  70. 223 237
      packages/base/paszlib/zdeflate.pas
  71. 106 117
      packages/base/paszlib/zinflate.pas
  72. 17 20
      packages/base/paszlib/zuncompr.pas
  73. 0 516
      packages/base/paszlib/zutil.pas
  74. 69 12
      packages/extra/Makefile
  75. 4 4
      packages/extra/Makefile.fpc
  76. 1720 0
      packages/extra/fftw/Makefile
  77. 22 0
      packages/extra/fftw/Makefile.fpc
  78. 31 0
      packages/extra/fftw/example.pas
  79. 133 0
      packages/extra/fftw/fftw_s.pas
  80. 63 0
      packages/extra/fftw/readme.txt
  81. 2 15
      packages/extra/opengl/Makefile
  82. 1 1
      packages/extra/opengl/Makefile.fpc
  83. 1 0
      packages/extra/opengl/gl.pp
  84. 1 0
      packages/extra/opengl/glu.pp
  85. 1 0
      packages/extra/opengl/glut.pp
  86. 18 0
      packages/extra/opengl/tinygl.inc
  87. 17 0
      packages/extra/opengl/tinyglh.inc
  88. 38 43
      packages/extra/x11/Makefile
  89. 1 1
      packages/extra/x11/Makefile.fpc
  90. 74 0
      packages/extra/x11/randr.inc
  91. 200 0
      packages/extra/x11/xrandr.pp
  92. 1 1
      rtl/inc/dynarr.inc
  93. 41 41
      rtl/inc/systemh.inc
  94. 111 105
      rtl/linux/powerpc/cprt0.as
  95. 102 41
      rtl/linux/powerpc/stat.inc
  96. 43 37
      rtl/morphos/Makefile
  97. 9 1
      rtl/morphos/Makefile.fpc
  98. 64 0
      rtl/morphos/aboxlib.pas
  99. 1 1
      rtl/morphos/asl.pas
  100. 30 0
      rtl/morphos/emuld.inc

+ 27 - 10
.gitattributes

@@ -83,7 +83,6 @@ compiler/comprsrc.pas svneol=native#text/plain
 compiler/cp437.pas svneol=native#text/plain
 compiler/cp437.pas svneol=native#text/plain
 compiler/cp850.pas svneol=native#text/plain
 compiler/cp850.pas svneol=native#text/plain
 compiler/cp8859_1.pas svneol=native#text/plain
 compiler/cp8859_1.pas svneol=native#text/plain
-compiler/crc.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
 compiler/cutils.pas svneol=native#text/plain
 compiler/cutils.pas svneol=native#text/plain
@@ -93,6 +92,7 @@ compiler/dwarf.pas svneol=native#text/plain
 compiler/export.pas svneol=native#text/plain
 compiler/export.pas svneol=native#text/plain
 compiler/finput.pas svneol=native#text/plain
 compiler/finput.pas svneol=native#text/plain
 compiler/fmodule.pas svneol=native#text/plain
 compiler/fmodule.pas svneol=native#text/plain
+compiler/fpccrc.pas svneol=native#text/plain
 compiler/fpcdefs.inc svneol=native#text/plain
 compiler/fpcdefs.inc svneol=native#text/plain
 compiler/fppu.pas svneol=native#text/plain
 compiler/fppu.pas svneol=native#text/plain
 compiler/gdb.pas svneol=native#text/plain
 compiler/gdb.pas svneol=native#text/plain
@@ -1117,6 +1117,14 @@ packages/base/gdbint/gdbobjs.inc svneol=native#text/plain
 packages/base/gdbint/gdbver.pp svneol=native#text/plain
 packages/base/gdbint/gdbver.pp svneol=native#text/plain
 packages/base/gdbint/symify.pp svneol=native#text/plain
 packages/base/gdbint/symify.pp svneol=native#text/plain
 packages/base/gdbint/testgdb.pp svneol=native#text/plain
 packages/base/gdbint/testgdb.pp svneol=native#text/plain
+packages/base/hash/Makefile svneol=native#text/plain
+packages/base/hash/Makefile.fpc svneol=native#text/plain
+packages/base/hash/crc.pas -text
+packages/base/hash/fpmake.inc svneol=native#text/plain
+packages/base/hash/fpmake.pp svneol=native#text/plain
+packages/base/hash/md5.pp svneol=native#text/plain
+packages/base/hash/md5.ref -text
+packages/base/hash/md5test.pp svneol=native#text/plain
 packages/base/ibase/Makefile svneol=native#text/plain
 packages/base/ibase/Makefile svneol=native#text/plain
 packages/base/ibase/Makefile.fpc svneol=native#text/plain
 packages/base/ibase/Makefile.fpc svneol=native#text/plain
 packages/base/ibase/README -text
 packages/base/ibase/README -text
@@ -1382,11 +1390,6 @@ packages/base/libc/wordexph.inc svneol=native#text/plain
 packages/base/libc/wordsizeh.inc svneol=native#text/plain
 packages/base/libc/wordsizeh.inc svneol=native#text/plain
 packages/base/libc/xlocaleh.inc svneol=native#text/plain
 packages/base/libc/xlocaleh.inc svneol=native#text/plain
 packages/base/libc/xopen_limh.inc svneol=native#text/plain
 packages/base/libc/xopen_limh.inc svneol=native#text/plain
-packages/base/md5/Makefile svneol=native#text/plain
-packages/base/md5/Makefile.fpc svneol=native#text/plain
-packages/base/md5/md5.pp svneol=native#text/plain
-packages/base/md5/md5.ref -text
-packages/base/md5/md5test.pp svneol=native#text/plain
 packages/base/mysql/Makefile svneol=native#text/plain
 packages/base/mysql/Makefile svneol=native#text/plain
 packages/base/mysql/Makefile.fpc svneol=native#text/plain
 packages/base/mysql/Makefile.fpc svneol=native#text/plain
 packages/base/mysql/README -text
 packages/base/mysql/README -text
@@ -1561,7 +1564,6 @@ packages/base/paszlib/Makefile.fpc svneol=native#text/plain
 packages/base/paszlib/adler.pas svneol=native#text/plain
 packages/base/paszlib/adler.pas svneol=native#text/plain
 packages/base/paszlib/changes.txt svneol=native#text/plain
 packages/base/paszlib/changes.txt svneol=native#text/plain
 packages/base/paszlib/example.pas svneol=native#text/plain
 packages/base/paszlib/example.pas svneol=native#text/plain
-packages/base/paszlib/gzcrc.pas svneol=native#text/plain
 packages/base/paszlib/gzio.pas svneol=native#text/plain
 packages/base/paszlib/gzio.pas svneol=native#text/plain
 packages/base/paszlib/infblock.pas svneol=native#text/plain
 packages/base/paszlib/infblock.pas svneol=native#text/plain
 packages/base/paszlib/infcodes.pas svneol=native#text/plain
 packages/base/paszlib/infcodes.pas svneol=native#text/plain
@@ -1578,7 +1580,6 @@ packages/base/paszlib/zconf.inc svneol=native#text/plain
 packages/base/paszlib/zdeflate.pas svneol=native#text/plain
 packages/base/paszlib/zdeflate.pas svneol=native#text/plain
 packages/base/paszlib/zinflate.pas svneol=native#text/plain
 packages/base/paszlib/zinflate.pas svneol=native#text/plain
 packages/base/paszlib/zuncompr.pas svneol=native#text/plain
 packages/base/paszlib/zuncompr.pas svneol=native#text/plain
-packages/base/paszlib/zutil.pas svneol=native#text/plain
 packages/base/postgres/Makefile svneol=native#text/plain
 packages/base/postgres/Makefile svneol=native#text/plain
 packages/base/postgres/Makefile.fpc svneol=native#text/plain
 packages/base/postgres/Makefile.fpc svneol=native#text/plain
 packages/base/postgres/README -text
 packages/base/postgres/README -text
@@ -1787,6 +1788,11 @@ packages/extra/cdrom/scsidefs.pp svneol=native#text/plain
 packages/extra/cdrom/showcds.pp svneol=native#text/plain
 packages/extra/cdrom/showcds.pp svneol=native#text/plain
 packages/extra/cdrom/wincd.pp svneol=native#text/plain
 packages/extra/cdrom/wincd.pp svneol=native#text/plain
 packages/extra/cdrom/wnaspi32.pp svneol=native#text/plain
 packages/extra/cdrom/wnaspi32.pp svneol=native#text/plain
+packages/extra/fftw/Makefile -text
+packages/extra/fftw/Makefile.fpc -text
+packages/extra/fftw/example.pas -text
+packages/extra/fftw/fftw_s.pas -text
+packages/extra/fftw/readme.txt -text
 packages/extra/forms/Makefile svneol=native#text/plain
 packages/extra/forms/Makefile svneol=native#text/plain
 packages/extra/forms/Makefile.fpc svneol=native#text/plain
 packages/extra/forms/Makefile.fpc svneol=native#text/plain
 packages/extra/forms/README -text
 packages/extra/forms/README -text
@@ -2671,7 +2677,6 @@ packages/extra/opengl/glut.pp svneol=native#text/plain
 packages/extra/opengl/glx.pp svneol=native#text/plain
 packages/extra/opengl/glx.pp svneol=native#text/plain
 packages/extra/opengl/readme -text
 packages/extra/opengl/readme -text
 packages/extra/opengl/tinygl.inc -text
 packages/extra/opengl/tinygl.inc -text
-packages/extra/opengl/tinygl.pp -text
 packages/extra/opengl/tinyglh.inc -text
 packages/extra/opengl/tinyglh.inc -text
 packages/extra/os2units/Makefile svneol=native#text/plain
 packages/extra/os2units/Makefile svneol=native#text/plain
 packages/extra/os2units/Makefile.fpc svneol=native#text/plain
 packages/extra/os2units/Makefile.fpc svneol=native#text/plain
@@ -3105,6 +3110,7 @@ packages/extra/x11/Makefile svneol=native#text/plain
 packages/extra/x11/Makefile.fpc svneol=native#text/plain
 packages/extra/x11/Makefile.fpc svneol=native#text/plain
 packages/extra/x11/cursorfont.pp svneol=native#text/plain
 packages/extra/x11/cursorfont.pp svneol=native#text/plain
 packages/extra/x11/keysym.pp svneol=native#text/plain
 packages/extra/x11/keysym.pp svneol=native#text/plain
+packages/extra/x11/randr.inc svneol=native#text/plain
 packages/extra/x11/x.pp svneol=native#text/plain
 packages/extra/x11/x.pp svneol=native#text/plain
 packages/extra/x11/xatom.pp svneol=native#text/plain
 packages/extra/x11/xatom.pp svneol=native#text/plain
 packages/extra/x11/xcms.pp svneol=native#text/plain
 packages/extra/x11/xcms.pp svneol=native#text/plain
@@ -3116,6 +3122,7 @@ packages/extra/x11/xinerama.pp svneol=native#text/plain
 packages/extra/x11/xkb.pp svneol=native#text/plain
 packages/extra/x11/xkb.pp svneol=native#text/plain
 packages/extra/x11/xkblib.pp svneol=native#text/plain
 packages/extra/x11/xkblib.pp svneol=native#text/plain
 packages/extra/x11/xlib.pp svneol=native#text/plain
 packages/extra/x11/xlib.pp svneol=native#text/plain
+packages/extra/x11/xrandr.pp svneol=native#text/plain
 packages/extra/x11/xrender.pp svneol=native#text/plain
 packages/extra/x11/xrender.pp svneol=native#text/plain
 packages/extra/x11/xresource.pp svneol=native#text/plain
 packages/extra/x11/xresource.pp svneol=native#text/plain
 packages/extra/x11/xshm.pp svneol=native#text/plain
 packages/extra/x11/xshm.pp svneol=native#text/plain
@@ -3558,6 +3565,8 @@ rtl/morphos/hardware.pas svneol=native#text/plain
 rtl/morphos/inputevent.pas svneol=native#text/plain
 rtl/morphos/inputevent.pas svneol=native#text/plain
 rtl/morphos/intuition.pas svneol=native#text/plain
 rtl/morphos/intuition.pas svneol=native#text/plain
 rtl/morphos/layers.pas svneol=native#text/plain
 rtl/morphos/layers.pas svneol=native#text/plain
+rtl/morphos/mui.pas -text
+rtl/morphos/muihelper.pas -text
 rtl/morphos/prt0.as -text
 rtl/morphos/prt0.as -text
 rtl/morphos/sysdir.inc svneol=native#text/plain
 rtl/morphos/sysdir.inc svneol=native#text/plain
 rtl/morphos/sysfile.inc svneol=native#text/plain
 rtl/morphos/sysfile.inc svneol=native#text/plain
@@ -3570,6 +3579,7 @@ rtl/morphos/sysutils.pp svneol=native#text/plain
 rtl/morphos/timer.pp svneol=native#text/plain
 rtl/morphos/timer.pp svneol=native#text/plain
 rtl/morphos/timerd.inc svneol=native#text/plain
 rtl/morphos/timerd.inc svneol=native#text/plain
 rtl/morphos/timerf.inc svneol=native#text/plain
 rtl/morphos/timerf.inc svneol=native#text/plain
+rtl/morphos/tinygl.pp -text
 rtl/morphos/tthread.inc svneol=native#text/plain
 rtl/morphos/tthread.inc svneol=native#text/plain
 rtl/morphos/utild1.inc svneol=native#text/plain
 rtl/morphos/utild1.inc svneol=native#text/plain
 rtl/morphos/utild2.inc svneol=native#text/plain
 rtl/morphos/utild2.inc svneol=native#text/plain
@@ -4817,7 +4827,8 @@ tests/tbs/tb0484.pp svneol=native#text/plain
 tests/tbs/tb0485.pp svneol=native#text/plain
 tests/tbs/tb0485.pp svneol=native#text/plain
 tests/tbs/tb0486.pp svneol=native#text/plain
 tests/tbs/tb0486.pp svneol=native#text/plain
 tests/tbs/tb0487.pp svneol=native#text/plain
 tests/tbs/tb0487.pp svneol=native#text/plain
-tests/tbs/tb0488.pp svneol=native#text/plain
+tests/tbs/tb0488a.pp svneol=native#text/plain
+tests/tbs/tb0488b.pp -text
 tests/tbs/tb0489.pp svneol=native#text/plain
 tests/tbs/tb0489.pp svneol=native#text/plain
 tests/tbs/tb0490.pp svneol=native#text/plain
 tests/tbs/tb0490.pp svneol=native#text/plain
 tests/tbs/tb0491.pp svneol=native#text/plain
 tests/tbs/tb0491.pp svneol=native#text/plain
@@ -4826,6 +4837,9 @@ tests/tbs/tb0493.pp svneol=native#text/plain
 tests/tbs/tb0494.pp -text
 tests/tbs/tb0494.pp -text
 tests/tbs/tb0495.pp svneol=native#text/plain
 tests/tbs/tb0495.pp svneol=native#text/plain
 tests/tbs/tb0496.pp svneol=native#text/plain
 tests/tbs/tb0496.pp svneol=native#text/plain
+tests/tbs/tb0497.pp -text
+tests/tbs/tb0497a.pp -text
+tests/tbs/tb0497b.pp -text
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0060.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain
 tests/tbs/ub0069.pp svneol=native#text/plain
 tests/tbs/ub0119.pp svneol=native#text/plain
 tests/tbs/ub0119.pp svneol=native#text/plain
@@ -6027,6 +6041,7 @@ tests/webtbs/tw3898.pp svneol=native#text/plain
 tests/webtbs/tw3899.pp svneol=native#text/plain
 tests/webtbs/tw3899.pp svneol=native#text/plain
 tests/webtbs/tw3900.pp svneol=native#text/plain
 tests/webtbs/tw3900.pp svneol=native#text/plain
 tests/webtbs/tw3913.pp svneol=native#text/plain
 tests/webtbs/tw3913.pp svneol=native#text/plain
+tests/webtbs/tw3930.pp -text
 tests/webtbs/tw3931a.pp svneol=native#text/plain
 tests/webtbs/tw3931a.pp svneol=native#text/plain
 tests/webtbs/tw3939.pp svneol=native#text/plain
 tests/webtbs/tw3939.pp svneol=native#text/plain
 tests/webtbs/tw3953a.pp svneol=native#text/plain
 tests/webtbs/tw3953a.pp svneol=native#text/plain
@@ -6114,6 +6129,8 @@ tests/webtbs/tw4529.pp -text svneol=unset#text/plain
 tests/webtbs/tw4533.pp svneol=native#text/plain
 tests/webtbs/tw4533.pp svneol=native#text/plain
 tests/webtbs/tw4537.pp svneol=native#text/plain
 tests/webtbs/tw4537.pp svneol=native#text/plain
 tests/webtbs/tw4540.pp -text svneol=unset#text/plain
 tests/webtbs/tw4540.pp -text svneol=unset#text/plain
+tests/webtbs/tw4557.pp svneol=native#text/plain
+tests/webtbs/tw4566.pp -text svneol=unset#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1873.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/ub1883.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain
 tests/webtbs/uw0555.pp svneol=native#text/plain

+ 7 - 7
.gitignore

@@ -512,6 +512,13 @@ packages/base/gdbint/*.ppu
 packages/base/gdbint/*.s
 packages/base/gdbint/*.s
 packages/base/gdbint/fpcmade.*
 packages/base/gdbint/fpcmade.*
 packages/base/gdbint/units
 packages/base/gdbint/units
+packages/base/hash/*.bak
+packages/base/hash/*.exe
+packages/base/hash/*.o
+packages/base/hash/*.ppu
+packages/base/hash/*.s
+packages/base/hash/fpcmade.*
+packages/base/hash/units
 packages/base/ibase/*.bak
 packages/base/ibase/*.bak
 packages/base/ibase/*.exe
 packages/base/ibase/*.exe
 packages/base/ibase/*.o
 packages/base/ibase/*.o
@@ -540,13 +547,6 @@ packages/base/libc/*.ppu
 packages/base/libc/*.s
 packages/base/libc/*.s
 packages/base/libc/fpcmade.*
 packages/base/libc/fpcmade.*
 packages/base/libc/units
 packages/base/libc/units
-packages/base/md5/*.bak
-packages/base/md5/*.exe
-packages/base/md5/*.o
-packages/base/md5/*.ppu
-packages/base/md5/*.s
-packages/base/md5/fpcmade.*
-packages/base/md5/units
 packages/base/mysql/*.bak
 packages/base/mysql/*.bak
 packages/base/mysql/*.exe
 packages/base/mysql/*.exe
 packages/base/mysql/*.o
 packages/base/mysql/*.o

+ 1 - 1
compiler/crc.pas → compiler/fpccrc.pas

@@ -19,7 +19,7 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
-Unit crc;
+Unit fpccrc;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
 
 

+ 20 - 6
compiler/m68k/cpubase.pas

@@ -168,12 +168,6 @@ unit cpubase;
         'ge','pl','gt','t','hi','vc','le','vs'
         'ge','pl','gt','t','hi','vc','le','vs'
       );
       );
 
 
-      inverse_cond:array[TAsmCond] of TAsmCond=(C_None,
-{$warning TODO, this is just a copy!}
-         C_CC,C_LS,C_CS,C_LT,C_EQ,C_MI,C_F,C_NE,
-         C_GE,C_PL,C_GT,C_T,C_HI,C_VC,C_LE,C_VS
-      );
-
 {*****************************************************************************
 {*****************************************************************************
                                    Flags
                                    Flags
 *****************************************************************************}
 *****************************************************************************}
@@ -334,6 +328,9 @@ unit cpubase;
 
 
     function isaddressregister(reg : tregister) : boolean;
     function isaddressregister(reg : tregister) : boolean;
 
 
+    function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
+    function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
+
 implementation
 implementation
 
 
     uses
     uses
@@ -459,4 +456,21 @@ implementation
       end;
       end;
 
 
 
 
+    function inverse_cond(const c: TAsmCond): TAsmCond; {$ifdef USEINLINE}inline;{$endif USEINLINE}
+      const
+        inverse:array[TAsmCond] of TAsmCond=(C_None,
+{$warning TODO, this is just a copy!}
+           C_CC,C_LS,C_CS,C_LT,C_EQ,C_MI,C_F,C_NE,
+           C_GE,C_PL,C_GT,C_T,C_HI,C_VC,C_LE,C_VS
+        );
+      begin
+        result := inverse[c];
+      end;
+
+
+    function conditions_equal(const c1, c2: TAsmCond): boolean; {$ifdef USEINLINE}inline;{$endif USEINLINE}
+      begin
+        result := c1 = c2;
+      end;
+
 end.
 end.

+ 1 - 1
compiler/msg/errorct.msg

@@ -2004,7 +2004,7 @@ unit_u_skipping_reresolving_unit=10059_U_No es torna a resoldre l'unitat $1, enc
 #
 #
 # 11039 is the las used one
 # 11039 is the las used one
 #
 #
-option_usage=11000_$1 [opcions] <fitxer-entrada> [opcions]
+option_usage=11000_O_$1 [opcions] <fitxer-entrada> [opcions]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errord.msg

@@ -2035,7 +2035,7 @@ unit_u_skipping_reresolving_unit=10059_U_Erneutes Resolving der Unit $1 wird 
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [Optionen] <Eingabedatei> [Optionen]
+option_usage=11000_O_$1 [Optionen] <Eingabedatei> [Optionen]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errore.msg

@@ -2033,7 +2033,7 @@ unit_u_skipping_reresolving_unit=10059_U_Skipping re-resolving unit $1, still lo
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [options] <inputfile> [options]
+option_usage=11000_O_$1 [options] <inputfile> [options]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errores.msg

@@ -2015,7 +2015,7 @@ unit_u_skipping_reresolving_unit=10059_U_Saltando re-resoluci
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [opciones] <fichero_entrada> [opciones]
+option_usage=11000_O_$1 [opciones] <fichero_entrada> [opciones]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorf.msg

@@ -1636,7 +1636,7 @@ unit_u_check_time=10037_U_PPU Check file $1 time $2
 #
 #
 #  Options
 #  Options
 #
 #
-option_usage=11000_$1 [options] <inputfile> [options]
+option_usage=11000_O_$1 [options] <inputfile> [options]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorhe.msg

@@ -2010,7 +2010,7 @@ unit_u_skipping_reresolving_unit=10059_U_Skipping re-resolving unit $1, still lo
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [options] <inputfile> [options]
+option_usage=11000_O_$1 [options] <inputfile> [options]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorn.msg

@@ -2169,7 +2169,7 @@ unit_u_skipping_reresolving_unit=10059_U_Oplossen van unit $1 wordt overgeslagen
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [opties] <bestand> [opties]
+option_usage=11000_O_$1 [opties] <bestand> [opties]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorpl.msg

@@ -2021,7 +2021,7 @@ unit_u_skipping_reresolving_unit=10059_U_Omini
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [opcje] <nazwapliku> [opcje]
+option_usage=11000_O_$1 [opcje] <nazwapliku> [opcje]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorpli.msg

@@ -2021,7 +2021,7 @@ unit_u_skipping_reresolving_unit=10059_U_Omini
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [opcje] <nazwapliku> [opcje]
+option_usage=11000_O_$1 [opcje] <nazwapliku> [opcje]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorptd.msg

@@ -1951,7 +1951,7 @@ unit_u_skipping_reresolving_unit=10059_U_Pulando o recalculo da area de dados da
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [opcoes] <arquivo entrada> [opcoes]
+option_usage=11000_O_$1 [opcoes] <arquivo entrada> [opcoes]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorptw.msg

@@ -1951,7 +1951,7 @@ unit_u_skipping_reresolving_unit=10059_U_Pulando o recalculo da 
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [opções] <arquivo entrada> [opções]
+option_usage=11000_O_$1 [opções] <arquivo entrada> [opções]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorr.msg

@@ -1753,7 +1753,7 @@ unit_h_source_modified=10041_H_
 #
 #
 #  Options
 #  Options
 #
 #
-option_usage=11000_$1 [®¯æ¨¨] <ä ©«> [®¯æ¨¨]
+option_usage=11000_O_$1 [®¯æ¨¨] <ä ©«> [®¯æ¨¨]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorrw.msg

@@ -1753,7 +1753,7 @@ unit_h_source_modified=10041_H_
 #
 #
 #  Options
 #  Options
 #
 #
-option_usage=11000_$1 [îïöèè] <ôàéë> [îïöèè]
+option_usage=11000_O_$1 [îïöèè] <ôàéë> [îïöèè]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msg/errorues.msg

@@ -2009,7 +2009,7 @@ unit_u_skipping_reresolving_unit=10059_U_Saltando re-resolución de $1, aún se
 #
 #
 # 11039 is the last used one
 # 11039 is the last used one
 #
 #
-option_usage=11000_$1 [opciones] <fichero_entrada> [opciones]
+option_usage=11000_O_$1 [opciones] <fichero_entrada> [opciones]
 # BeginOfTeX
 # BeginOfTeX
 %
 %
 % \section{Command-line handling errors}
 % \section{Command-line handling errors}

+ 1 - 1
compiler/msgidx.inc

@@ -662,7 +662,7 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 39153;
+  MsgTxtSize = 39155;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
     19,74,216,59,59,47,100,20,135,60,
     19,74,216,59,59,47,100,20,135,60,

+ 51 - 51
compiler/msgtxt.inc

@@ -673,19 +673,19 @@ const msgtxt : array[0..000163,1..240] of char=(
   '10057_U_Registering new unit $1'#000+
   '10057_U_Registering new unit $1'#000+
   '10058_U_Re-resolving unit $1'#000+
   '10058_U_Re-resolving unit $1'#000+
   '10059_U_Skipping re-resolving unit $1, still loading used units'#000+
   '10059_U_Skipping re-resolving unit $1, still loading used units'#000+
-  '11000_$1 [options] <inputfi','le> [options]'#000+
+  '11000_O_$1 [options] <input','file> [options]'#000+
   '11001_W_Only one source file supported'#000+
   '11001_W_Only one source file supported'#000+
   '11002_W_DEF file can be created only for OS/2'#000+
   '11002_W_DEF file can be created only for OS/2'#000+
   '11003_E_nested response files are not supported'#000+
   '11003_E_nested response files are not supported'#000+
   '11004_F_No source file name in command line'#000+
   '11004_F_No source file name in command line'#000+
   '11005_N_No option inside $1 config file'#000+
   '11005_N_No option inside $1 config file'#000+
-  '11006_E_I','llegal parameter: $1'#000+
+  '11006_E','_Illegal parameter: $1'#000+
   '11007_H_-? writes help pages'#000+
   '11007_H_-? writes help pages'#000+
   '11008_F_Too many config files nested'#000+
   '11008_F_Too many config files nested'#000+
   '11009_F_Unable to open file $1'#000+
   '11009_F_Unable to open file $1'#000+
   '11010_D_Reading further options from $1'#000+
   '11010_D_Reading further options from $1'#000+
   '11011_W_Target is already set to: $1'#000+
   '11011_W_Target is already set to: $1'#000+
-  '11012_W_Shared libs not supported on DOS plat','form, reverting to stat'+
+  '11012_W_Shared libs not supported on DOS pl','atform, reverting to stat'+
   'ic'#000+
   'ic'#000+
   '11013_F_too many IF(N)DEFs'#000+
   '11013_F_too many IF(N)DEFs'#000+
   '11014_F_too many ENDIFs'#000+
   '11014_F_too many ENDIFs'#000+
@@ -693,24 +693,24 @@ const msgtxt : array[0..000163,1..240] of char=(
   '11016_W_Debug information generation is not supported by this executab'+
   '11016_W_Debug information generation is not supported by this executab'+
   'le'#000+
   'le'#000+
   '11017_H_Try recompiling with -dGDB'#000+
   '11017_H_Try recompiling with -dGDB'#000+
-  '11018_E','_You are using the obsolete switch $1'#000+
+  '11018','_E_You are using the obsolete switch $1'#000+
   '11019_E_You are using the obsolete switch $1, please use $2'#000+
   '11019_E_You are using the obsolete switch $1, please use $2'#000+
   '11020_N_Switching assembler to default source writing assembler'#000+
   '11020_N_Switching assembler to default source writing assembler'#000+
   '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+
   '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+
-  '11022_W_"$1','" assembler use forced'#000+
+  '11022_W_"','$1" assembler use forced'#000+
   '11026_T_Reading options from file $1'#000+
   '11026_T_Reading options from file $1'#000+
   '11027_T_Reading options from environment $1'#000+
   '11027_T_Reading options from environment $1'#000+
   '11028_D_Handling option "$1"'#000+
   '11028_D_Handling option "$1"'#000+
   '11029__*** press enter ***'#000+
   '11029__*** press enter ***'#000+
   '11030_H_Start of reading config file $1'#000+
   '11030_H_Start of reading config file $1'#000+
-  '11031_H_End of reading config file $1'#000+
-  '11','032_D_interpreting option "$1"'#000+
+  '11031_H_End of reading config file $1'#000,
+  '11032_D_interpreting option "$1"'#000+
   '11036_D_interpreting firstpass option "$1"'#000+
   '11036_D_interpreting firstpass option "$1"'#000+
   '11033_D_interpreting file option "$1"'#000+
   '11033_D_interpreting file option "$1"'#000+
   '11034_D_Reading config file "$1"'#000+
   '11034_D_Reading config file "$1"'#000+
   '11035_D_found source file name "$1"'#000+
   '11035_D_found source file name "$1"'#000+
   '11039_E_Unknown code page'#000+
   '11039_E_Unknown code page'#000+
-  '11023_Free Pascal Compiler versio','n $FPCVERSION [$FPCDATE] for $FPCCP'+
+  '11023_Free Pascal Compiler vers','ion $FPCVERSION [$FPCDATE] for $FPCCP'+
   'U'#010+
   'U'#010+
   'Copyright (c) 1993-2005 by Florian Klaempfl'#000+
   'Copyright (c) 1993-2005 by Florian Klaempfl'#000+
   '11024_Free Pascal Compiler version $FPCVERSION'#010+
   '11024_Free Pascal Compiler version $FPCVERSION'#010+
@@ -721,7 +721,7 @@ const msgtxt : array[0..000163,1..240] of char=(
   'Supported targets:'#010+
   'Supported targets:'#010+
   '  $OSTARGETS'#010+
   '  $OSTARGETS'#010+
   #010+
   #010+
-  'Supported CPU inst','ruction sets:'#010+
+  'Supported CPU in','struction sets:'#010+
   '  $INSTRUCTIONSETS'#010+
   '  $INSTRUCTIONSETS'#010+
   #010+
   #010+
   'Supported FPU instruction sets:'#010+
   'Supported FPU instruction sets:'#010+
@@ -731,29 +731,29 @@ const msgtxt : array[0..000163,1..240] of char=(
   'For more information read COPYING.FPC'#010+
   'For more information read COPYING.FPC'#010+
   #010+
   #010+
   'Report bugs,suggestions etc to:'#010+
   'Report bugs,suggestions etc to:'#010+
-  '                 bugrep@','freepascal.org'#000+
+  '                 bugre','p@freepascal.org'#000+
   '11025_**0*_put + after a boolean switch option to enable it, - to disa'+
   '11025_**0*_put + after a boolean switch option to enable it, - to disa'+
   'ble it'#010+
   'ble it'#010+
   '**1a_the compiler doesn'#039't delete the generated assembler file'#010+
   '**1a_the compiler doesn'#039't delete the generated assembler file'#010+
   '**2al_list sourcecode lines in assembler file'#010+
   '**2al_list sourcecode lines in assembler file'#010+
-  '**2an_list node info in assembler file'#010+
-  '*','L2ap_use pipes instead of creating temporary assembler files'#010+
+  '**2an_list node info in assembler file',#010+
+  '*L2ap_use pipes instead of creating temporary assembler files'#010+
   '**2ar_list register allocation/release info in assembler file'#010+
   '**2ar_list register allocation/release info in assembler file'#010+
   '**2at_list temp allocation/release info in assembler file'#010+
   '**2at_list temp allocation/release info in assembler file'#010+
   '**1A<x>_output format:'#010+
   '**1A<x>_output format:'#010+
-  '**2Adefault_use default assembler'#010+
-  '3*','2Aas_assemble using GNU AS'#010+
+  '**2Adefault_use default assembler'#010,
+  '3*2Aas_assemble using GNU AS'#010+
   '3*2Anasmcoff_coff (Go32v2) file using Nasm'#010+
   '3*2Anasmcoff_coff (Go32v2) file using Nasm'#010+
   '3*2Anasmelf_elf32 (Linux) file using Nasm'#010+
   '3*2Anasmelf_elf32 (Linux) file using Nasm'#010+
   '3*2Anasmwin32_Win32 object file using Nasm'#010+
   '3*2Anasmwin32_Win32 object file using Nasm'#010+
   '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+
   '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+
-  '3*2Awasm_obj file using Wasm (Watcom',')'#010+
+  '3*2Awasm_obj file using Wasm (Watc','om)'#010+
   '3*2Anasmobj_obj file using Nasm'#010+
   '3*2Anasmobj_obj file using Nasm'#010+
   '3*2Amasm_obj file using Masm (Microsoft)'#010+
   '3*2Amasm_obj file using Masm (Microsoft)'#010+
   '3*2Atasm_obj file using Tasm (Borland)'#010+
   '3*2Atasm_obj file using Tasm (Borland)'#010+
   '3*2Aelf_elf32 (Linux) using internal writer'#010+
   '3*2Aelf_elf32 (Linux) using internal writer'#010+
   '3*2Acoff_coff (Go32v2) using internal writer'#010+
   '3*2Acoff_coff (Go32v2) using internal writer'#010+
-  '3*2Apecoff_pecoff (Win32) using inter','nal writer'#010+
+  '3*2Apecoff_pecoff (Win32) using int','ernal writer'#010+
   '4*2Aas_assemble using GNU AS'#010+
   '4*2Aas_assemble using GNU AS'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
   '6*2Agas_GNU Motorola assembler'#010+
   '6*2Agas_GNU Motorola assembler'#010+
@@ -761,27 +761,27 @@ const msgtxt : array[0..000163,1..240] of char=(
   '6*2Amot_Standard Motorola assembler'#010+
   '6*2Amot_Standard Motorola assembler'#010+
   'A*2Aas_assemble using GNU AS'#010+
   'A*2Aas_assemble using GNU AS'#010+
   'P*2Aas_assemble using GNU AS'#010+
   'P*2Aas_assemble using GNU AS'#010+
-  'S*2Aas_assembl','e using GNU AS'#010+
+  'S*2Aas_assem','ble using GNU AS'#010+
   '**1b_generate browser info'#010+
   '**1b_generate browser info'#010+
   '**2bl_generate local symbol info'#010+
   '**2bl_generate local symbol info'#010+
   '**1B_build all modules'#010+
   '**1B_build all modules'#010+
   '**1C<x>_code generation options:'#010+
   '**1C<x>_code generation options:'#010+
   '**2Cc<x>_set default calling convention to <x>'#010+
   '**2Cc<x>_set default calling convention to <x>'#010+
   '**2CD_create also dynamic library (not supported)'#010+
   '**2CD_create also dynamic library (not supported)'#010+
-  '**2Ce_Compil','ation with emulated floating point opcodes'#010+
+  '**2Ce_Comp','ilation with emulated floating point opcodes'#010+
   '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+
   '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+
   'lues'#010+
   'lues'#010+
   '**2Cg_Generate PIC code'#010+
   '**2Cg_Generate PIC code'#010+
   '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
   '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
   '**2Ci_IO-checking'#010+
   '**2Ci_IO-checking'#010+
   '**2Cn_omit linking stage'#010+
   '**2Cn_omit linking stage'#010+
-  '**2','Co_check overflow of integer operations'#010+
+  '*','*2Co_check overflow of integer operations'#010+
   '**2Cp<x>_select instruction set, see fpc -i for possible values'#010+
   '**2Cp<x>_select instruction set, see fpc -i for possible values'#010+
   '**2Cr_range checking'#010+
   '**2Cr_range checking'#010+
   '**2CR_verify object method call validity'#010+
   '**2CR_verify object method call validity'#010+
   '**2Cs<n>_set stack size to <n>'#010+
   '**2Cs<n>_set stack size to <n>'#010+
   '**2Ct_stack checking'#010+
   '**2Ct_stack checking'#010+
-  '**2CX_create also smar','tlinked library'#010+
+  '**2CX_create also sm','artlinked library'#010+
   '**1d<x>_defines the symbol <x>'#010+
   '**1d<x>_defines the symbol <x>'#010+
   '**1D_generate a DEF file'#010+
   '**1D_generate a DEF file'#010+
   '**2Dd<x>_set description to <x>'#010+
   '**2Dd<x>_set description to <x>'#010+
@@ -789,26 +789,26 @@ const msgtxt : array[0..000163,1..240] of char=(
   '*O2Dw_PM application'#010+
   '*O2Dw_PM application'#010+
   '**1e<x>_set path to executable'#010+
   '**1e<x>_set path to executable'#010+
   '**1E_same as -Cn'#010+
   '**1E_same as -Cn'#010+
-  '**1F<x>_set file names and paths:'#010+
-  '*','*2Fa<x>[,y]_for a program load first units <x> and [y] before uses '+
-  'is parsed'#010+
+  '**1F<x>_set file names and paths:',#010+
+  '**2Fa<x>[,y]_for a program load first units <x> and [y] before uses is'+
+  ' parsed'#010+
   '**2Fc<x>_sets input codepage to <x>'#010+
   '**2Fc<x>_sets input codepage to <x>'#010+
   '**2FD<x>_sets the directory where to search for compiler utilities'#010+
   '**2FD<x>_sets the directory where to search for compiler utilities'#010+
   '**2Fe<x>_redirect error output to <x>'#010+
   '**2Fe<x>_redirect error output to <x>'#010+
-  '**2FE<x>_set exe/unit ','output path to <x>'#010+
+  '**2FE<x>_set exe/uni','t output path to <x>'#010+
   '**2Fi<x>_adds <x> to include path'#010+
   '**2Fi<x>_adds <x> to include path'#010+
   '**2Fl<x>_adds <x> to library path'#010+
   '**2Fl<x>_adds <x> to library path'#010+
   '**2FL<x>_uses <x> as dynamic linker'#010+
   '**2FL<x>_uses <x> as dynamic linker'#010+
   '**2Fo<x>_adds <x> to object path'#010+
   '**2Fo<x>_adds <x> to object path'#010+
   '**2Fr<x>_load error message file <x>'#010+
   '**2Fr<x>_load error message file <x>'#010+
   '**2Fu<x>_adds <x> to unit path'#010+
   '**2Fu<x>_adds <x> to unit path'#010+
-  '**2FU<x>_set uni','t output path to <x>, overrides -FE'#010+
+  '**2FU<x>_set u','nit output path to <x>, overrides -FE'#010+
   '*g1g_generate debugger information:'#010+
   '*g1g_generate debugger information:'#010+
   '*g2gc_generate checks for pointers'#010+
   '*g2gc_generate checks for pointers'#010+
   '*g2gd_use dbx'#010+
   '*g2gd_use dbx'#010+
   '*g2gg_use gsym'#010+
   '*g2gg_use gsym'#010+
   '*g2gh_use heap trace unit (for memory leak debugging)'#010+
   '*g2gh_use heap trace unit (for memory leak debugging)'#010+
-  '*g2gl_use line info unit to show more info for bac','ktraces'#010+
+  '*g2gl_use line info unit to show more info for b','acktraces'#010+
   '*g2gv_generates programs traceable with valgrind'#010+
   '*g2gv_generates programs traceable with valgrind'#010+
   '*g2gw_generate dwarf debugging info'#010+
   '*g2gw_generate dwarf debugging info'#010+
   '**1i_information'#010+
   '**1i_information'#010+
@@ -816,75 +816,75 @@ const msgtxt : array[0..000163,1..240] of char=(
   '**2iV_return compiler version'#010+
   '**2iV_return compiler version'#010+
   '**2iSO_return compiler OS'#010+
   '**2iSO_return compiler OS'#010+
   '**2iSP_return compiler processor'#010+
   '**2iSP_return compiler processor'#010+
-  '**2iTO_return ','target OS'#010+
+  '**2iTO_retur','n target OS'#010+
   '**2iTP_return target processor'#010+
   '**2iTP_return target processor'#010+
   '**1I<x>_adds <x> to include path'#010+
   '**1I<x>_adds <x> to include path'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1l_write logo'#010+
   '**1l_write logo'#010+
   '**1M<x>_set language mode to <x>'#010+
   '**1M<x>_set language mode to <x>'#010+
   '**2Mfpc_free pascal dialect (default)'#010+
   '**2Mfpc_free pascal dialect (default)'#010+
-  '**2Mobjfpc_switch some Delphi 2 extensions on'#010+
-  '**','2Mdelphi_tries to be Delphi compatible'#010+
+  '**2Mobjfpc_switch some Delphi 2 extensions on'#010,
+  '**2Mdelphi_tries to be Delphi compatible'#010+
   '**2Mtp_tries to be TP/BP 7.0 compatible'#010+
   '**2Mtp_tries to be TP/BP 7.0 compatible'#010+
   '**2Mgpc_tries to be gpc compatible'#010+
   '**2Mgpc_tries to be gpc compatible'#010+
   '**2Mmacpas_tries to be compatible to the macintosh pascal dialects'#010+
   '**2Mmacpas_tries to be compatible to the macintosh pascal dialects'#010+
   '**1n_don'#039't read the default config file'#010+
   '**1n_don'#039't read the default config file'#010+
-  '**1o<x>_change the ','name of the executable produced to <x>'#010+
+  '**1o<x>_change th','e name of the executable produced to <x>'#010+
   '**1O<x>_optimizations:'#010+
   '**1O<x>_optimizations:'#010+
   '3*2Oa_<type>=<values> set alignment'#010+
   '3*2Oa_<type>=<values> set alignment'#010+
   '3*2Og_generate smaller code'#010+
   '3*2Og_generate smaller code'#010+
   '3*2OG_generate faster code (default)'#010+
   '3*2OG_generate faster code (default)'#010+
   '**2Or_keep certain variables in registers'#010+
   '**2Or_keep certain variables in registers'#010+
-  '3*2Ou_enable uncertain optimization','s (see docs)'#010+
+  '3*2Ou_enable uncertain optimizati','ons (see docs)'#010+
   '3*2O1_level 1 optimizations (quick optimizations)'#010+
   '3*2O1_level 1 optimizations (quick optimizations)'#010+
   '3*2O2_level 2 optimizations (-O1 + slower optimizations)'#010+
   '3*2O2_level 2 optimizations (-O1 + slower optimizations)'#010+
   '3*2O3_level 3 optimizations (-O2 repeatedly, max 5 times)'#010+
   '3*2O3_level 3 optimizations (-O2 repeatedly, max 5 times)'#010+
   '3*2Op<x>_target processor:'#010+
   '3*2Op<x>_target processor:'#010+
-  '3*3Op1_set target processor to 386/','486'#010+
+  '3*3Op1_set target processor to 38','6/486'#010+
   '3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#010+
   '3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#010+
   '3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#010+
   '3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#010+
   '6*2Og_generate smaller code'#010+
   '6*2Og_generate smaller code'#010+
   '6*2OG_generate faster code (default)'#010+
   '6*2OG_generate faster code (default)'#010+
   '6*2Ox_optimize maximum (still BUGGY!!!)'#010+
   '6*2Ox_optimize maximum (still BUGGY!!!)'#010+
-  '6*2O0_set target proce','ssor to a MC68000'#010+
+  '6*2O0_set target pro','cessor to a MC68000'#010+
   '6*2O2_set target processor to a MC68020+ (default)'#010+
   '6*2O2_set target processor to a MC68020+ (default)'#010+
   '**1pg_generate profile code for gprof (defines FPC_PROFILE)'#010+
   '**1pg_generate profile code for gprof (defines FPC_PROFILE)'#010+
   '**1R<x>_assembler reading style:'#010+
   '**1R<x>_assembler reading style:'#010+
   '**2Rdefault_use default assembler'#010+
   '**2Rdefault_use default assembler'#010+
   '3*2Ratt_read AT&T style assembler'#010+
   '3*2Ratt_read AT&T style assembler'#010+
-  '3*2Rintel_','read Intel style assembler'#010+
+  '3*2Rinte','l_read Intel style assembler'#010+
   '6*2RMOT_read motorola style assembler'#010+
   '6*2RMOT_read motorola style assembler'#010+
   '**1S<x>_syntax options:'#010+
   '**1S<x>_syntax options:'#010+
   '**2S2_same as -Mobjfpc'#010+
   '**2S2_same as -Mobjfpc'#010+
   '**2Sc_supports operators like C (*=,+=,/= and -=)'#010+
   '**2Sc_supports operators like C (*=,+=,/= and -=)'#010+
   '**2Sa_include assertion code.'#010+
   '**2Sa_include assertion code.'#010+
   '**2Sd_same as -Mdelphi'#010+
   '**2Sd_same as -Mdelphi'#010+
-  '**2Se<x>_error options. <','x> is a combination of the following:'#010+
+  '**2Se<x>_error options.',' <x> is a combination of the following:'#010+
   '**3*_<n> : compiler stops after the <n> errors (default is 1)'#010+
   '**3*_<n> : compiler stops after the <n> errors (default is 1)'#010+
   '**3*_w : compiler stops also after warnings'#010+
   '**3*_w : compiler stops also after warnings'#010+
   '**3*_n : compiler stops also after notes'#010+
   '**3*_n : compiler stops also after notes'#010+
   '**3*_h : compiler stops also after hints'#010+
   '**3*_h : compiler stops also after hints'#010+
-  '**2Sg_allow LA','BEL and GOTO'#010+
+  '**2Sg_allow ','LABEL and GOTO'#010+
   '**2Sh_Use ansistrings'#010+
   '**2Sh_Use ansistrings'#010+
   '**2Si_support C++ styled INLINE'#010+
   '**2Si_support C++ styled INLINE'#010+
   '**2Sk_load fpcylix unit'#010+
   '**2Sk_load fpcylix unit'#010+
   '**2SI<x>_set interface style to <x>'#010+
   '**2SI<x>_set interface style to <x>'#010+
   '**3SIcom_COM compatible interface (default)'#010+
   '**3SIcom_COM compatible interface (default)'#010+
   '**3SIcorba_CORBA compatible interface'#010+
   '**3SIcorba_CORBA compatible interface'#010+
-  '**2Sm_support macros like C (gl','obal)'#010+
+  '**2Sm_support macros like C (','global)'#010+
   '**2So_same as -Mtp'#010+
   '**2So_same as -Mtp'#010+
   '**2Sp_same as -Mgpc'#010+
   '**2Sp_same as -Mgpc'#010+
   '**2Ss_constructor name must be init (destructor must be done)'#010+
   '**2Ss_constructor name must be init (destructor must be done)'#010+
   '**2St_allow static keyword in objects'#010+
   '**2St_allow static keyword in objects'#010+
   '**1s_don'#039't call assembler and linker'#010+
   '**1s_don'#039't call assembler and linker'#010+
   '**2sh_Generate script to link on host'#010+
   '**2sh_Generate script to link on host'#010+
-  '**2st_Generate scrip','t to link on target'#010+
+  '**2st_Generate scr','ipt to link on target'#010+
   '**2sr_Skip register allocation phase (use with -alr)'#010+
   '**2sr_Skip register allocation phase (use with -alr)'#010+
   '**1T<x>_Target operating system:'#010+
   '**1T<x>_Target operating system:'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Tfreebsd_FreeBSD'#010+
   '3*2Tfreebsd_FreeBSD'#010+
   '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
   '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
-  '3*2Tlinux_Linux'#010,
+  '3*2Tlinux_Linu','x'#010+
   '3*2Tnetbsd_NetBSD'#010+
   '3*2Tnetbsd_NetBSD'#010+
   '3*2Tnetware_Novell Netware Module (clib)'#010+
   '3*2Tnetware_Novell Netware Module (clib)'#010+
   '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
   '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
@@ -892,7 +892,7 @@ const msgtxt : array[0..000163,1..240] of char=(
   '3*2Tos2_OS/2 / eComStation'#010+
   '3*2Tos2_OS/2 / eComStation'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Twatcom_Watcom compatible DOS extender'#010+
   '3*2Twatcom_Watcom compatible DOS extender'#010+
-  '3*2Twdosx_WDOSX DOS extend','er'#010+
+  '3*2Twdosx_WDOSX DOS exte','nder'#010+
   '3*2Twin32_Windows 32 Bit'#010+
   '3*2Twin32_Windows 32 Bit'#010+
   '4*2Tlinux_Linux'#010+
   '4*2Tlinux_Linux'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tamiga_Commodore Amiga'#010+
@@ -902,7 +902,7 @@ const msgtxt : array[0..000163,1..240] of char=(
   '6*2Tpalmos_PalmOS'#010+
   '6*2Tpalmos_PalmOS'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Tlinux_Linux'#010+
   'P*2Tdarwin_Darwin and MacOS X on PowerPC'#010+
   'P*2Tdarwin_Darwin and MacOS X on PowerPC'#010+
-  'P*2Tlinu','x_Linux on PowerPC'#010+
+  'P*2Tli','nux_Linux on PowerPC'#010+
   'P*2Tmacos_MacOS (classic) on PowerPC'#010+
   'P*2Tmacos_MacOS (classic) on PowerPC'#010+
   'P*2Tmorphos_MorphOS'#010+
   'P*2Tmorphos_MorphOS'#010+
   'S*2Tlinux_Linux'#010+
   'S*2Tlinux_Linux'#010+
@@ -910,47 +910,47 @@ const msgtxt : array[0..000163,1..240] of char=(
   '**1U_unit options:'#010+
   '**1U_unit options:'#010+
   '**2Un_don'#039't check the unit name'#010+
   '**2Un_don'#039't check the unit name'#010+
   '**2Ur_generate release unit files'#010+
   '**2Ur_generate release unit files'#010+
-  '**2Us_compile a system unit'#010+
-  '**','1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
+  '**2Us_compile a system unit'#010,
+  '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
   '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010+
   '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010+
   '**2*_w : Show warnings               u : Show unit info'#010+
   '**2*_w : Show warnings               u : Show unit info'#010+
-  '**2*_n : Show notes                  t : Show tri','ed/used files'#010+
+  '**2*_n : Show notes                  t : Show t','ried/used files'#010+
   '**2*_h : Show hints                  c : Show conditionals'#010+
   '**2*_h : Show hints                  c : Show conditionals'#010+
   '**2*_i : Show general info           d : Show debug info'#010+
   '**2*_i : Show general info           d : Show debug info'#010+
   '**2*_l : Show linenumbers            r : Rhide/GCC compatibility mode'#010+
   '**2*_l : Show linenumbers            r : Rhide/GCC compatibility mode'#010+
-  '**2*_a : Show everything             x :',' Executable info (Win32 only'+
+  '**2*_a : Show everything             x',' : Executable info (Win32 only'+
   ')'#010+
   ')'#010+
   '**2*_b : Write file names messages with full path'#010+
   '**2*_b : Write file names messages with full path'#010+
   '**2*_v : write fpcdebug.txt with     p : Write tree.log with parse tre'+
   '**2*_v : write fpcdebug.txt with     p : Write tree.log with parse tre'+
   'e'#010+
   'e'#010+
   '**2*_    lots of debugging info'#010+
   '**2*_    lots of debugging info'#010+
   '3*1W<x>_Win32-like target options'#010+
   '3*1W<x>_Win32-like target options'#010+
-  '3*2WB_Create a relocat','able image'#010+
+  '3*2WB_Create a reloc','atable image'#010+
   '3*2WB<x>_Set Image base to Hexadecimal <x> value'#010+
   '3*2WB<x>_Set Image base to Hexadecimal <x> value'#010+
   '3*2WC_Specify console type application'#010+
   '3*2WC_Specify console type application'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE'#010+
   '3*2WF_Specify full-screen type application (OS/2 only)'#010+
   '3*2WF_Specify full-screen type application (OS/2 only)'#010+
-  '3*2WG_Specify graphic type applica','tion'#010+
+  '3*2WG_Specify graphic type appli','cation'#010+
   '3*2WN_Do not generate relocation code (necessary for debugging)'#010+
   '3*2WN_Do not generate relocation code (necessary for debugging)'#010+
   '3*2WR_Generate relocation code'#010+
   '3*2WR_Generate relocation code'#010+
   'P*2WC_Specify console type application (MacOS only)'#010+
   'P*2WC_Specify console type application (MacOS only)'#010+
   'P*2WG_Specify graphic type application (MacOS only)'#010+
   'P*2WG_Specify graphic type application (MacOS only)'#010+
-  'P*2WT_Specify tool type application ','(MPW tool, MacOS only)'#010+
+  'P*2WT_Specify tool type applicatio','n (MPW tool, MacOS only)'#010+
   '**1X_executable options:'#010+
   '**1X_executable options:'#010+
   '**2Xc_pass --shared to the linker (Unix only)'#010+
   '**2Xc_pass --shared to the linker (Unix only)'#010+
   '**2Xd_don'#039't use standard library search path (needed for cross com'+
   '**2Xd_don'#039't use standard library search path (needed for cross com'+
   'pile)'#010+
   'pile)'#010+
   '**2XD_try to link units dynamic          (defines FPC_LINK_DYNAMIC)'#010+
   '**2XD_try to link units dynamic          (defines FPC_LINK_DYNAMIC)'#010+
-  '**2Xm_','generate link map'#010+
+  '**2X','m_generate link map'#010+
   '**2XM<x>_set the name of the '#039'main'#039' program routine (default i'+
   '**2XM<x>_set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
   's '#039'main'#039')'#010+
   '**2XP<x>_prepend the binutils names with the prefix <x>'#010+
   '**2XP<x>_prepend the binutils names with the prefix <x>'#010+
   '**2Xr<x>_set library search path to <x> (needed for cross compile)'#010+
   '**2Xr<x>_set library search path to <x> (needed for cross compile)'#010+
-  '**2Xs_strip all symbols fro','m executable'#010+
+  '**2Xs_strip all symbols f','rom executable'#010+
   '**2XS_try to link units static (default) (defines FPC_LINK_STATIC)'#010+
   '**2XS_try to link units static (default) (defines FPC_LINK_STATIC)'#010+
   '**2Xt_link with static libraries (-static is passed to linker)'#010+
   '**2Xt_link with static libraries (-static is passed to linker)'#010+
   '**2XX_try to link units smart            (defines FPC_LINK_SMART)'#010+
   '**2XX_try to link units smart            (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1*_'#010+
   '**1?_shows this help'#010+
   '**1?_shows this help'#010+
-  '**1h','_shows this help without waiting'#000
+  '**','1h_shows this help without waiting'#000
 );
 );

+ 2 - 2
compiler/ncon.pas

@@ -595,9 +595,9 @@ implementation
     destructor tstringconstnode.destroy;
     destructor tstringconstnode.destroy;
       begin
       begin
         if st_type=st_widestring then
         if st_type=st_widestring then
-         donewidestring(pcompilerwidestring(value_str))
+          donewidestring(pcompilerwidestring(value_str))
         else
         else
-         ansistringdispose(value_str,len);
+          ansistringdispose(value_str,len);
         inherited destroy;
         inherited destroy;
       end;
       end;
 
 

+ 2 - 1
compiler/ninl.pas

@@ -1613,7 +1613,8 @@ implementation
                    else
                    else
                      begin
                      begin
                        if (resulttype.def.deftype=enumdef) and
                        if (resulttype.def.deftype=enumdef) and
-                          (tenumdef(resulttype.def).has_jumps) then
+                          (tenumdef(resulttype.def).has_jumps) and
+                          not(m_delphi in aktmodeswitches) then
                          CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible);
                          CGMessage(type_e_succ_and_pred_enums_with_assign_not_possible);
                      end;
                      end;
 
 

+ 1 - 1
compiler/pass_1.pas

@@ -97,7 +97,7 @@ implementation
          begin
          begin
            { update the codegenerror boolean with the previous result of this node }
            { update the codegenerror boolean with the previous result of this node }
            if (nf_error in p.flags) then
            if (nf_error in p.flags) then
-            codegenerror:=true;
+             codegenerror:=true;
          end;
          end;
       end;
       end;
 
 

+ 28 - 4
compiler/powerpc/cgcpu.pas

@@ -1203,8 +1203,20 @@ const
                 if regcounter2 in rg[R_INTREGISTER].used_in_proc then
                 if regcounter2 in rg[R_INTREGISTER].used_in_proc then
                   begin
                   begin
                      usesgpr:=true;
                      usesgpr:=true;
-                     a_load_reg_ref(list,OS_INT,OS_INT,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href);
-                     dec(href.offset,4);
+                     if (regcounter2 <= RS_R22) or
+                        ((cs_littlesize in aktglobalswitches) and
+                         { with RS_R30 it's also already smaller, but too big a speed trade-off to make }
+                         (regcounter2 <= RS_R29)) then
+                       begin
+                         dec(href.offset,(RS_R31-regcounter2+1)*sizeof(aint));
+                         list.concat(taicpu.op_reg_ref(A_STMW,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href));
+                         break;
+                       end
+                     else
+                       begin
+                         a_load_reg_ref(list,OS_INT,OS_INT,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href);
+                         dec(href.offset,4);
+                       end;
                   end;
                   end;
               end;
               end;
 {
 {
@@ -1344,8 +1356,20 @@ const
                 if regcounter2 in rg[R_INTREGISTER].used_in_proc then
                 if regcounter2 in rg[R_INTREGISTER].used_in_proc then
                   begin
                   begin
                      usesgpr:=true;
                      usesgpr:=true;
-                     a_load_ref_reg(list,OS_INT,OS_INT,href,newreg(R_INTREGISTER,regcounter2,R_SUBNONE));
-                     dec(href.offset,4);
+                     if (regcounter2 <= RS_R22) or
+                        ((cs_littlesize in aktglobalswitches) and
+                         { with RS_R30 it's also already smaller, but too big a speed trade-off to make }
+                         (regcounter2 <= RS_R29)) then
+                       begin
+                         dec(href.offset,(RS_R31-regcounter2+1)*sizeof(aint));
+                         list.concat(taicpu.op_reg_ref(A_LMW,newreg(R_INTREGISTER,regcounter2,R_SUBNONE),href));
+                         break;
+                       end
+                     else
+                       begin
+                         a_load_ref_reg(list,OS_INT,OS_INT,href,newreg(R_INTREGISTER,regcounter2,R_SUBNONE));
+                         dec(href.offset,4);
+                       end;
                   end;
                   end;
               end;
               end;
 
 

+ 1 - 1
compiler/ppu.pas

@@ -270,7 +270,7 @@ implementation
 {$ifdef Test_Double_checksum}
 {$ifdef Test_Double_checksum}
     comphook,
     comphook,
 {$endif def Test_Double_checksum}
 {$endif def Test_Double_checksum}
-    crc,
+    fpccrc,
     cutils;
     cutils;
 
 
 {*****************************************************************************
 {*****************************************************************************

+ 6 - 0
compiler/scanner.pas

@@ -288,6 +288,12 @@ implementation
 
 
         if b then
         if b then
          begin
          begin
+           { resolve all postponed switch changes }
+           if localswitcheschanged then
+             begin
+               aktlocalswitches:=nextaktlocalswitches;
+               localswitcheschanged:=false;
+             end;
            { turn ansistrings on by default ? }
            { turn ansistrings on by default ? }
            if (m_delphi in aktmodeswitches) then
            if (m_delphi in aktmodeswitches) then
             begin
             begin

+ 38 - 20
compiler/symdef.pas

@@ -348,6 +348,7 @@ interface
           procedure deref;
           procedure deref;
           { add interface reference loaded from ppu }
           { add interface reference loaded from ppu }
           procedure addintf_deref(const d:tderef;iofs:longint);
           procedure addintf_deref(const d:tderef;iofs:longint);
+          procedure addintf_ioffset(d:tdef;iofs:longint);
 
 
           procedure clearmappings;
           procedure clearmappings;
           procedure addmappings(intfindex: longint; const origname, newname: string);
           procedure addmappings(intfindex: longint; const origname, newname: string);
@@ -862,7 +863,7 @@ implementation
       fmodule,
       fmodule,
       { other }
       { other }
       gendef,
       gendef,
-      crc
+      fpccrc
       ;
       ;
 
 
 {****************************************************************************
 {****************************************************************************
@@ -5113,27 +5114,35 @@ implementation
 
 
 
 
     function tobjectdef.getcopy : tstoreddef;
     function tobjectdef.getcopy : tstoreddef;
+      var
+        i,
+        implintfcount : longint;
       begin
       begin
-        result:=inherited getcopy;
-      (*
         result:=tobjectdef.create(objecttype,objname^,childof);
         result:=tobjectdef.create(objecttype,objname^,childof);
-          childofderef  : tderef;
-          objname,
-          objrealname   : pstring;
-          objectoptions : tobjectoptions;
-          { to be able to have a variable vmt position }
-          { and no vmt field for objects without virtuals }
-          vmt_offset : longint;
-{$ifdef GDB}
-          writing_class_record_stab : boolean;
-{$endif GDB}
-          objecttype : tobjectdeftype;
-          iidguid: pguid;
-          iidstr: pstring;
-          lastvtableindex: longint;
-          { store implemented interfaces defs and name mappings }
-          implementedinterfaces: timplementedinterfaces;
-      *)
+        tobjectdef(result).symtable:=symtable.getcopy;
+        if assigned(objname) then
+          tobjectdef(result).objname:=stringdup(objname^);
+        if assigned(objrealname) then
+          tobjectdef(result).objrealname:=stringdup(objrealname^);
+        tobjectdef(result).objectoptions:=objectoptions;
+        tobjectdef(result).vmt_offset:=vmt_offset;
+        if assigned(iidguid) then
+          begin
+            new(tobjectdef(result).iidguid);
+            move(iidguid^,tobjectdef(result).iidguid^,sizeof(iidguid^));
+          end;
+        if assigned(iidstr) then
+          tobjectdef(result).iidstr:=stringdup(iidstr^);
+        tobjectdef(result).lastvtableindex:=lastvtableindex;
+        if assigned(implementedinterfaces) then
+          begin
+            implintfcount:=implementedinterfaces.count;
+            for i:=1 to implintfcount do
+              begin
+                tobjectdef(result).implementedinterfaces.addintf_ioffset(implementedinterfaces.interfaces(i),
+                    implementedinterfaces.ioffsets(i));
+              end;
+          end;
       end;
       end;
 
 
 
 
@@ -6307,6 +6316,15 @@ implementation
         finterfaces.insert(hintf);
         finterfaces.insert(hintf);
       end;
       end;
 
 
+    procedure timplementedinterfaces.addintf_ioffset(d:tdef;iofs:longint);
+      var
+        hintf : timplintfentry;
+      begin
+        hintf:=timplintfentry.create(tobjectdef(d));
+        hintf.ioffset:=iofs;
+        finterfaces.insert(hintf);
+      end;
+
     procedure timplementedinterfaces.addintf(def: tdef);
     procedure timplementedinterfaces.addintf(def: tdef);
       begin
       begin
         if not assigned(def) or (searchintf(def)<>-1) or (def.deftype<>objectdef) or
         if not assigned(def) or (searchintf(def)<>-1) or (def.deftype<>objectdef) or

+ 2 - 1
compiler/widestr.pas

@@ -104,6 +104,7 @@ unit widestr;
            reallocmem(r^.data,sizeof(tcompilerwidechar)*l)
            reallocmem(r^.data,sizeof(tcompilerwidechar)*l)
          else
          else
            getmem(r^.data,sizeof(tcompilerwidechar)*l);
            getmem(r^.data,sizeof(tcompilerwidechar)*l);
+         r^.maxlen:=l;
       end;
       end;
 
 
     procedure concatwidestringchar(r : pcompilerwidestring;c : tcompilerwidechar);
     procedure concatwidestringchar(r : pcompilerwidestring;c : tcompilerwidechar);
@@ -118,8 +119,8 @@ unit widestr;
     procedure concatwidestrings(s1,s2 : pcompilerwidestring);
     procedure concatwidestrings(s1,s2 : pcompilerwidestring);
       begin
       begin
          setlengthwidestring(s1,s1^.len+s2^.len);
          setlengthwidestring(s1,s1^.len+s2^.len);
-         inc(s1^.len,s2^.len);
          move(s2^.data^,s1^.data[s1^.len],s2^.len*sizeof(tcompilerwidechar));
          move(s2^.data^,s1^.data[s1^.len],s2^.len*sizeof(tcompilerwidechar));
+         inc(s1^.len,s2^.len);
       end;
       end;
 
 
     procedure copywidestring(s,d : pcompilerwidestring);
     procedure copywidestring(s,d : pcompilerwidestring);

+ 0 - 1
compiler/x86/cpubase.pas

@@ -459,5 +459,4 @@ implementation
       end;
       end;
 
 
 
 
-
 end.
 end.

+ 64 - 1
fcl/Makefile

@@ -1878,9 +1878,10 @@ else
 TAROPT=vz
 TAROPT=vz
 TAREXT=.tar.gz
 TAREXT=.tar.gz
 endif
 endif
-override REQUIRE_PACKAGES=rtl paszlib
+override REQUIRE_PACKAGES=rtl paszlib hash
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -1894,6 +1895,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -1901,6 +1903,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
@@ -1913,6 +1916,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
@@ -1920,6 +1924,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -1933,6 +1938,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -1940,6 +1946,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -1952,6 +1959,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -1959,6 +1967,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -1966,6 +1975,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -1973,6 +1983,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -1985,6 +1996,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -1992,6 +2004,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
@@ -1999,6 +2012,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2006,6 +2020,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2013,6 +2028,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2020,6 +2036,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2033,6 +2050,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2046,6 +2064,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2058,6 +2077,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2065,6 +2085,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2072,6 +2093,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2084,6 +2106,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2091,6 +2114,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2104,6 +2128,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2116,6 +2141,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2123,6 +2149,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2136,6 +2163,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2143,6 +2171,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2156,6 +2185,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2168,6 +2198,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2175,6 +2206,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2188,6 +2220,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2201,6 +2234,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2208,6 +2242,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2221,6 +2256,7 @@ REQUIRE_PACKAGES_SQLITE=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
@@ -2228,6 +2264,7 @@ REQUIRE_PACKAGES_LIBASYNC=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_NETDB=1
 REQUIRE_PACKAGES_LIBASYNC=1
 REQUIRE_PACKAGES_LIBASYNC=1
@@ -2265,6 +2302,32 @@ ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
 endif
 endif
 endif
+ifdef REQUIRE_PACKAGES_HASH
+PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_HASH),)
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),)
+UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)
+else
+UNITDIR_HASH=$(PACKAGEDIR_HASH)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_HASH)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_HASH=
+UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_HASH),)
+UNITDIR_HASH:=$(firstword $(UNITDIR_HASH))
+else
+UNITDIR_HASH=
+endif
+endif
+ifdef UNITDIR_HASH
+override COMPILER_UNITDIR+=$(UNITDIR_HASH)
+endif
+endif
 ifdef REQUIRE_PACKAGES_PASZLIB
 ifdef REQUIRE_PACKAGES_PASZLIB
 PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_PASZLIB),)
 ifneq ($(PACKAGEDIR_PASZLIB),)

+ 1 - 1
fcl/Makefile.fpc

@@ -7,7 +7,7 @@ name=fcl
 version=2.0.3
 version=2.0.3
 
 
 [require]
 [require]
-packages=paszlib
+packages=paszlib hash
 packages_linux=netdb libasync pthreads
 packages_linux=netdb libasync pthreads
 packages_freebsd=netdb libasync pthreads
 packages_freebsd=netdb libasync pthreads
 packages_darwin=netdb libasync pthreads
 packages_darwin=netdb libasync pthreads

+ 102 - 2
fcl/db/dataset.inc

@@ -498,8 +498,89 @@ end;
 function TDataSet.GetFieldData(Field: TField; Buffer: Pointer;
 function TDataSet.GetFieldData(Field: TField; Buffer: Pointer;
   NativeFormat: Boolean): Boolean;
   NativeFormat: Boolean): Boolean;
   
   
+Const
+  TempBufSize = 1024; { Let's not exaggerate.}
+    
+Var
+  Buf : Array[1..TempBufSize] of Char;
+  P : PChar; 
 begin
 begin
-  Result := GetFieldData(Field, Buffer);
+  If NativeFormat then
+    Result:=GetFieldData(Field, Buffer)
+  else
+    begin
+    If (Field.DataSize<=TempBufSize) then
+      P:=@Buf
+    else
+      P:=GetMem(Field.DataSize);
+    Result:=GetFieldData(Field,P);
+    If Result then
+      DataConvert(Field,P,Buffer,False);
+    If (P<>@Buf) then
+      FreeMem(P);
+    end;  
+end;
+
+Function DateTimeRecToDateTime(DT: TFieldType; Data: TDateTimeRec): TDateTime;
+
+var
+  TS: TTimeStamp;
+
+begin
+  TS.Date:=0;
+  TS.Time:=0;
+  case DT of
+    ftDate: TS.Date := Data.Date;
+    ftTime: With TS do
+              begin
+              Time := Data.Time;
+              Date := DateDelta;
+              end;
+  else
+    try
+      TS:=MSecsToTimeStamp(trunc(Data.DateTime));
+    except
+    end;
+  end;  
+  Result:=TimeStampToDateTime(TS);
+end; 
+
+Function DateTimeToDateTimeRec(DT: TFieldType; Data: TDateTime): TDateTimeRec;
+
+var
+  TS : TTimeStamp;
+  
+begin
+  TS:=DateTimeToTimeStamp(Data);
+  With Result do
+    case DT of
+      ftDate: 
+        Date:=TS.Date;
+      ftTime: 
+        Time:=TS.Time;
+    else
+      DateTime:=TimeStampToMSecs(TS);
+    end;
+end;
+
+procedure TDataSet.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean);
+
+Type
+  PDateTime = ^TDateTime;
+  PDateTimeRec = ^TDateTimeRec;
+
+Var
+  DT : TFieldType; 
+ 
+begin
+  DT:=Field.DataType;
+  case DT of
+    ftDate, ftTime, ftDateTime:
+      if ToNative then
+         PDateTimeRec(Dest)^:=DateTimeToDateTimeRec(DT,PDateTime(Source)^) 
+       else
+         PDateTime(Dest)^:=DateTimeRecToDateTime(DT,PDateTimeRec(Source)^);
+  end;
 end;
 end;
 
 
 procedure TDataSet.SetFieldData(Field: TField; Buffer: Pointer);
 procedure TDataSet.SetFieldData(Field: TField; Buffer: Pointer);
@@ -511,8 +592,27 @@ end;
 procedure TDataSet.SetFieldData(Field: TField; Buffer: Pointer;
 procedure TDataSet.SetFieldData(Field: TField; Buffer: Pointer;
   NativeFormat: Boolean);
   NativeFormat: Boolean);
 
 
+Const
+  TempBufSize = 1024; { Let's not exaggerate.}
+    
+Var
+  Buf : Array[1..TempBufSize] of Char;
+  P : PChar; 
+
 begin
 begin
-  SetFieldData(Field, Buffer);
+  if NativeFormat then
+    SetFieldData(Field, Buffer)
+  else 
+    begin
+    if Field.DataSize<=dsMaxStringSize then
+      P:=GetMem(Field.DataSize)
+    else
+      P:=@Buf;  
+    DataConvert(Field,Buffer,P,True);
+    SetFieldData(Field,P);
+    If (P<>@Buf) then
+      FreeMem(P);
+    end;  
 end;
 end;
 
 
 Function TDataset.GetField (Index : Longint) : TField;
 Function TDataset.GetField (Index : Longint) : TField;

+ 5 - 0
fcl/db/db.pp

@@ -318,10 +318,12 @@ type
     procedure Clear; virtual;
     procedure Clear; virtual;
     procedure FocusControl;
     procedure FocusControl;
     function GetData(Buffer: Pointer): Boolean;
     function GetData(Buffer: Pointer): Boolean;
+    function GetData(Buffer: Pointer; NativeFormat : Boolean): Boolean;
     class function IsBlob: Boolean; virtual;
     class function IsBlob: Boolean; virtual;
     function IsValidChar(InputChar: Char): Boolean; virtual;
     function IsValidChar(InputChar: Char): Boolean; virtual;
     procedure RefreshLookupList;
     procedure RefreshLookupList;
     procedure SetData(Buffer: Pointer);
     procedure SetData(Buffer: Pointer);
+    procedure SetData(Buffer: Pointer; NativeFormat : Boolean);
     procedure SetFieldType(AValue: TFieldType); virtual;
     procedure SetFieldType(AValue: TFieldType); virtual;
     procedure Validate(Buffer: Pointer);
     procedure Validate(Buffer: Pointer);
     property AsBoolean: Boolean read GetAsBoolean write SetAsBoolean;
     property AsBoolean: Boolean read GetAsBoolean write SetAsBoolean;
@@ -1066,6 +1068,7 @@ type
     function GetDataSource: TDataSource; virtual;
     function GetDataSource: TDataSource; virtual;
     function GetFieldData(Field: TField; Buffer: Pointer): Boolean; overload; virtual;
     function GetFieldData(Field: TField; Buffer: Pointer): Boolean; overload; virtual;
     function GetFieldData(Field: TField; Buffer: Pointer; NativeFormat: Boolean): Boolean; overload; virtual;
     function GetFieldData(Field: TField; Buffer: Pointer; NativeFormat: Boolean): Boolean; overload; virtual;
+    procedure DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean);virtual;
     function GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult; virtual; abstract;
     function GetRecord(Buffer: PChar; GetMode: TGetMode; DoCheck: Boolean): TGetResult; virtual; abstract;
     function GetRecordSize: Word; virtual; abstract;
     function GetRecordSize: Word; virtual; abstract;
     procedure InternalAddRecord(Buffer: Pointer; Append: Boolean); virtual; abstract;
     procedure InternalAddRecord(Buffer: Pointer; Append: Boolean); virtual; abstract;
@@ -1801,6 +1804,8 @@ Procedure DatabaseErrorFmt (Const Fmt : String; Args : Array Of Const);
 Procedure DatabaseErrorFmt (Const Fmt : String; Args : Array Of const;
 Procedure DatabaseErrorFmt (Const Fmt : String; Args : Array Of const;
                             Comp : TComponent);
                             Comp : TComponent);
 Function ExtractFieldName(Const Fields: String; var Pos: Integer): String;
 Function ExtractFieldName(Const Fields: String; var Pos: Integer): String;
+Function DateTimeRecToDateTime(DT: TFieldType; Data: TDateTimeRec): TDateTime;
+Function DateTimeToDateTimeRec(DT: TFieldType; Data: TDateTime): TDateTimeRec;
 
 
 implementation
 implementation
 
 

+ 1 - 0
fcl/db/dbconst.pp

@@ -30,6 +30,7 @@ Const
   SErrColumnNotFound       = 'Column "%s" not found.';
   SErrColumnNotFound       = 'Column "%s" not found.';
   SErrDatabasenAssigned    = 'Database not assigned!';
   SErrDatabasenAssigned    = 'Database not assigned!';
   SErrNoDatabaseAvailable  = 'Invalid operation: Not attached to database';
   SErrNoDatabaseAvailable  = 'Invalid operation: Not attached to database';
+  SErrNoDatabaseName       = 'Database connect string (DatabaseName) not filled in!';
   SErrNoSelectStatement    = 'Cannot open a non-select statement';
   SErrNoSelectStatement    = 'Cannot open a non-select statement';
   SErrNoStatement          = 'SQL statement not set';
   SErrNoStatement          = 'SQL statement not set';
   SErrTransAlreadyActive   = 'Transaction already active';
   SErrTransAlreadyActive   = 'Transaction already active';

+ 19 - 7
fcl/db/fields.inc

@@ -540,6 +540,12 @@ end;
 
 
 function TField.GetData(Buffer: Pointer): Boolean;
 function TField.GetData(Buffer: Pointer): Boolean;
 
 
+begin
+  Result:=GetData(Buffer,True);
+end;
+
+function TField.GetData(Buffer: Pointer; NativeFormat : Boolean): Boolean;
+
 begin
 begin
   IF FDataset=Nil then
   IF FDataset=Nil then
     DatabaseErrorFmt(SNoDataset,[FieldName]);
     DatabaseErrorFmt(SNoDataset,[FieldName]);
@@ -550,7 +556,7 @@ begin
       Move (FValueBuffer^,Buffer^ ,DataSize);
       Move (FValueBuffer^,Buffer^ ,DataSize);
     end
     end
   else
   else
-    Result:=FDataset.GetFieldData(Self,Buffer);
+    Result:=FDataset.GetFieldData(Self,Buffer,NativeFormat);
 end;
 end;
 
 
 function TField.GetDataSize: Word;
 function TField.GetDataSize: Word;
@@ -767,10 +773,16 @@ end;
 
 
 procedure TField.SetData(Buffer: Pointer);
 procedure TField.SetData(Buffer: Pointer);
 
 
+begin
+ SetData(Buffer,True);
+end;
+
+procedure TField.SetData(Buffer: Pointer; NativeFormat : Boolean);
+
 begin
 begin
   If Not Assigned(FDataset) then
   If Not Assigned(FDataset) then
     EDatabaseError.CreateFmt(SNoDataset,[FieldName]);
     EDatabaseError.CreateFmt(SNoDataset,[FieldName]);
-  FDataSet.SetFieldData(Self,Buffer, False);
+  FDataSet.SetFieldData(Self,Buffer, NativeFormat);
 end;
 end;
 
 
 Procedure TField.SetDataset (Value : TDataset);
 Procedure TField.SetDataset (Value : TDataset);
@@ -1749,7 +1761,7 @@ end;
 function TDateTimeField.GetAsDateTime: TDateTime;
 function TDateTimeField.GetAsDateTime: TDateTime;
 
 
 begin
 begin
-  If Not GetData(@Result) then
+  If Not GetData(@Result,False) then
     Result:=0;
     Result:=0;
 end;
 end;
 
 
@@ -1763,7 +1775,7 @@ function TDateTimeField.GetAsVariant: Variant;
 Var d : tDateTime;
 Var d : tDateTime;
 
 
 begin
 begin
-  If Getdata(@d) then
+  If Getdata(@d,False) then
     Result := d
     Result := d
   else
   else
     Result:=Null;
     Result:=Null;
@@ -1796,7 +1808,7 @@ Var R : TDateTime;
     F : String;
     F : String;
 
 
 begin
 begin
-  If Not Getdata(@R) then
+  If Not Getdata(@R,False) then
     TheText:=''
     TheText:=''
   else
   else
     begin
     begin
@@ -1817,7 +1829,7 @@ end;
 procedure TDateTimeField.SetAsDateTime(AValue: TDateTime);
 procedure TDateTimeField.SetAsDateTime(AValue: TDateTime);
 
 
 begin
 begin
-  SetData(@Avalue);
+  SetData(@Avalue,False);
 end;
 end;
 
 
 
 
@@ -1834,7 +1846,7 @@ Var R : TDateTime;
 
 
 begin
 begin
   R:=StrToDateTime(AVAlue);
   R:=StrToDateTime(AVAlue);
-  SetData(@R);
+  SetData(@R,False);
 end;
 end;
 
 
 
 

+ 0 - 5
fcl/db/sqldb/interbase/ibconnection.pp

@@ -90,9 +90,6 @@ implementation
 
 
 uses strutils;
 uses strutils;
 
 
-resourcestring
-  SErrNoDatabaseName = 'Database connect string (DatabaseName) not filled in!';
-
 type
 type
   TTm = packed record
   TTm = packed record
     tm_sec : longint;
     tm_sec : longint;
@@ -243,8 +240,6 @@ begin
      DPB := DPB + chr(isc_dpb_sql_role_name) + chr(Length(Role)) + Role;
      DPB := DPB + chr(isc_dpb_sql_role_name) + chr(Length(Role)) + Role;
   if Length(CharSet) > 0 then
   if Length(CharSet) > 0 then
     DPB := DPB + Chr(isc_dpb_lc_ctype) + Chr(Length(CharSet)) + CharSet;
     DPB := DPB + Chr(isc_dpb_lc_ctype) + Chr(Length(CharSet)) + CharSet;
-  if (DatabaseName = '') then
-    DatabaseError(SErrNoDatabaseName,self);
 
 
   FSQLDatabaseHandle := nil;
   FSQLDatabaseHandle := nil;
   if isc_attach_database(@FStatus, Length(DatabaseName), @DatabaseName[1], @FSQLDatabaseHandle,
   if isc_attach_database(@FStatus, Length(DatabaseName), @DatabaseName[1], @FSQLDatabaseHandle,

+ 0 - 4
fcl/db/sqldb/postgres/pqconnection.pp

@@ -82,7 +82,6 @@ ResourceString
   SErrExecuteFailed = 'Execution of query failed';
   SErrExecuteFailed = 'Execution of query failed';
   SErrFieldDefsFailed = 'Can not extract field information from query';
   SErrFieldDefsFailed = 'Can not extract field information from query';
   SErrFetchFailed = 'Fetch of data failed';
   SErrFetchFailed = 'Fetch of data failed';
-  SErrNoDatabaseName = 'Database connect string (DatabaseName) not filled in!';
   SErrPrepareFailed = 'Preparation of query failed.';
   SErrPrepareFailed = 'Preparation of query failed.';
 
 
 const Oid_Bool     = 16;
 const Oid_Bool     = 16;
@@ -269,9 +268,6 @@ begin
 
 
   inherited dointernalconnect;
   inherited dointernalconnect;
 
 
-  if (DatabaseName = '') then
-    DatabaseError(SErrNoDatabaseName,self);
-
   FConnectString := '';
   FConnectString := '';
   if (UserName <> '') then FConnectString := FConnectString + ' user=''' + UserName + '''';
   if (UserName <> '') then FConnectString := FConnectString + ' user=''' + UserName + '''';
   if (Password <> '') then FConnectString := FConnectString + ' password=''' + Password + '''';
   if (Password <> '') then FConnectString := FConnectString + ' password=''' + Password + '''';

+ 13 - 2
fcl/db/sqldb/sqldb.pp

@@ -88,7 +88,6 @@ type
     function Fetch(cursor : TSQLCursor) : boolean; virtual; abstract;
     function Fetch(cursor : TSQLCursor) : boolean; virtual; abstract;
     procedure AddFieldDefs(cursor: TSQLCursor; FieldDefs : TfieldDefs); virtual; abstract;
     procedure AddFieldDefs(cursor: TSQLCursor; FieldDefs : TfieldDefs); virtual; abstract;
     procedure UnPrepareStatement(cursor : TSQLCursor); virtual; abstract;
     procedure UnPrepareStatement(cursor : TSQLCursor); virtual; abstract;
-
     procedure FreeFldBuffers(cursor : TSQLCursor); virtual; abstract;
     procedure FreeFldBuffers(cursor : TSQLCursor); virtual; abstract;
     function LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;buffer : pointer) : boolean; virtual; abstract;
     function LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;buffer : pointer) : boolean; virtual; abstract;
     function GetTransactionHandle(trans : TSQLHandle): pointer; virtual; abstract;
     function GetTransactionHandle(trans : TSQLHandle): pointer; virtual; abstract;
@@ -196,6 +195,7 @@ type
     function Fetch : boolean; override;
     function Fetch : boolean; override;
     function LoadField(FieldDef : TFieldDef;buffer : pointer) : boolean; override;
     function LoadField(FieldDef : TFieldDef;buffer : pointer) : boolean; override;
     // abstract & virtual methods of TDataset
     // abstract & virtual methods of TDataset
+    procedure DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean); override;
     procedure UpdateIndexDefs; override;
     procedure UpdateIndexDefs; override;
     procedure SetDatabase(Value : TDatabase); override;
     procedure SetDatabase(Value : TDatabase); override;
     Procedure SetTransaction(Value : TDBTransaction); override;
     Procedure SetTransaction(Value : TDBTransaction); override;
@@ -297,7 +297,8 @@ end;
 
 
 procedure TSQLConnection.DoInternalConnect;
 procedure TSQLConnection.DoInternalConnect;
 begin
 begin
-// Empty abstract
+  if (DatabaseName = '') then
+    DatabaseError(SErrNoDatabaseName,self);
 end;
 end;
 
 
 procedure TSQLConnection.DoInternalDisconnect;
 procedure TSQLConnection.DoInternalDisconnect;
@@ -678,6 +679,16 @@ begin
   result := (Database as tSQLConnection).LoadField(FCursor,FieldDef,buffer)
   result := (Database as tSQLConnection).LoadField(FCursor,FieldDef,buffer)
 end;
 end;
 
 
+procedure TSQLQuery.DataConvert(Field: TField; Source, Dest: Pointer; ToNative: Boolean); 
+
+begin
+  { 
+    all data is in native format for these types, so no conversion is needed.
+  }
+  If not (Field.DataType in [ftDate,ftTime,ftDateTime]) then
+    Inherited DataConvert(Field,Source,Dest,ToNative);
+end;
+
 procedure TSQLQuery.InternalAddRecord(Buffer: Pointer; AAppend: Boolean);
 procedure TSQLQuery.InternalAddRecord(Buffer: Pointer; AAppend: Boolean);
 begin
 begin
   // not implemented - sql dataset
   // not implemented - sql dataset

+ 64 - 1
fcl/image/Makefile

@@ -1294,189 +1294,226 @@ else
 TAROPT=vz
 TAROPT=vz
 TAREXT=.tar.gz
 TAREXT=.tar.gz
 endif
 endif
-override REQUIRE_PACKAGES=rtl paszlib pasjpeg
+override REQUIRE_PACKAGES=rtl paszlib pasjpeg hash
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_PASJPEG=1
 REQUIRE_PACKAGES_PASJPEG=1
 endif
 endif
@@ -1506,6 +1543,32 @@ ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
 endif
 endif
 endif
+ifdef REQUIRE_PACKAGES_HASH
+PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_HASH),)
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),)
+UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)
+else
+UNITDIR_HASH=$(PACKAGEDIR_HASH)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_HASH)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_HASH=
+UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_HASH),)
+UNITDIR_HASH:=$(firstword $(UNITDIR_HASH))
+else
+UNITDIR_HASH=
+endif
+endif
+ifdef UNITDIR_HASH
+override COMPILER_UNITDIR+=$(UNITDIR_HASH)
+endif
+endif
 ifdef REQUIRE_PACKAGES_PASZLIB
 ifdef REQUIRE_PACKAGES_PASZLIB
 PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_PASZLIB),)
 ifneq ($(PACKAGEDIR_PASZLIB),)

+ 1 - 1
fcl/image/Makefile.fpc

@@ -6,7 +6,7 @@
 main=fcl
 main=fcl
 
 
 [require]
 [require]
-packages=paszlib pasjpeg
+packages=paszlib pasjpeg hash
 
 
 [target]
 [target]
 units=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm \
 units=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm \

+ 4 - 21
fcl/inc/zstream.pp

@@ -117,17 +117,6 @@ Const
   SSeekError = 'Compression stream seek error';
   SSeekError = 'Compression stream seek error';
   SInvalidSeek = 'Invalid Compression seek operation';
   SInvalidSeek = 'Invalid Compression seek operation';
 
 
-function zlibAllocMem(opaque:pointer; items:uInt; size:uInt):pointer;{$ifndef usepaszlib}cdecl;{$endif}
-begin
-  Result:=GetMem(Items*Size);
-end;
-
-procedure zlibFreeMem(opaque:pointer; address:pointer);{$ifndef usepaszlib}cdecl;{$endif}
-begin
-  FreeMem(address);
-end;
-
-
 procedure TCompressionStream.CompressBuf(const InBuf: Pointer; InBytes: Integer;
 procedure TCompressionStream.CompressBuf(const InBuf: Pointer; InBytes: Integer;
                       var OutBuf: Pointer; var OutBytes: Integer);
                       var OutBuf: Pointer; var OutBytes: Integer);
 var
 var
@@ -135,8 +124,6 @@ var
   P: Pointer;
   P: Pointer;
 begin
 begin
   FillChar(strm, sizeof(strm), 0);
   FillChar(strm, sizeof(strm), 0);
-  strm.zalloc := @zlibAllocMem;
-  strm.zfree := @zlibFreeMem;
   OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255;
   OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255;
   OutBuf:=GetMem(OutBytes);
   OutBuf:=GetMem(OutBytes);
   try
   try
@@ -144,7 +131,7 @@ begin
     strm.avail_in := InBytes;
     strm.avail_in := InBytes;
     strm.next_out := OutBuf;
     strm.next_out := OutBuf;
     strm.avail_out := OutBytes;
     strm.avail_out := OutBytes;
-    CompressionCheck(deflateInit_(strm, Z_BEST_COMPRESSION, ZLIB_VERSION, sizeof(strm)));
+    CompressionCheck(deflateInit(strm, Z_BEST_COMPRESSION));
     try
     try
       while CompressionCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do
       while CompressionCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do
       begin
       begin
@@ -176,8 +163,6 @@ Type
   PByte = ^Byte;
   PByte = ^Byte;
 begin
 begin
   FillChar(strm, sizeof(strm), 0);
   FillChar(strm, sizeof(strm), 0);
-  strm.zalloc := @zlibAllocMem;
-  strm.zfree := @zlibFreeMem;
   BufInc := (InBytes + 255) and not 255;
   BufInc := (InBytes + 255) and not 255;
   if OutEstimate = 0 then
   if OutEstimate = 0 then
     OutBytes := BufInc
     OutBytes := BufInc
@@ -189,7 +174,7 @@ begin
     strm.avail_in := InBytes;
     strm.avail_in := InBytes;
     strm.next_out := OutBuf;
     strm.next_out := OutBuf;
     strm.avail_out := OutBytes;
     strm.avail_out := OutBytes;
-    DecompressionCheck(inflateInit_(strm, ZLIB_VERSION, sizeof(strm)));
+    DecompressionCheck(inflateInit(strm));
     try
     try
       while DecompressionCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END do
       while DecompressionCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END do
       begin
       begin
@@ -218,8 +203,6 @@ begin
   inherited Create;
   inherited Create;
   FStrm := Strm;
   FStrm := Strm;
   FStrmPos := Strm.Position;
   FStrmPos := Strm.Position;
-  FZRec.zalloc := @zlibAllocMem;
-  FZRec.zfree := @zlibFreeMem;
 end;
 end;
 
 
 procedure TCustomZLibStream.Progress(Sender: TObject);
 procedure TCustomZLibStream.Progress(Sender: TObject);
@@ -239,7 +222,7 @@ begin
   inherited Create(Dest);
   inherited Create(Dest);
   FZRec.next_out := @FBuffer;
   FZRec.next_out := @FBuffer;
   FZRec.avail_out := sizeof(FBuffer);
   FZRec.avail_out := sizeof(FBuffer);
-  CompressionCheck(deflateInit_(FZRec, Levels[CompressionLevel], ZLIB_VERSION, sizeof(FZRec)));
+  CompressionCheck(deflateInit(FZRec, Levels[CompressionLevel]));
 end;
 end;
 
 
 destructor TCompressionStream.Destroy;
 destructor TCompressionStream.Destroy;
@@ -326,7 +309,7 @@ constructor TDecompressionStream.Create(Source: TStream);
 begin
 begin
   inherited Create(Source);
   inherited Create(Source);
   FZRec.next_in := @FBuffer;
   FZRec.next_in := @FBuffer;
-  DecompressionCheck(inflateInit_(FZRec, ZLIB_VERSION, sizeof(FZRec)));
+  DecompressionCheck(inflateInit(FZRec));
 end;
 end;
 
 
 destructor TDecompressionStream.Destroy;
 destructor TDecompressionStream.Destroy;

+ 2 - 2
installer/install.dat

@@ -5,8 +5,8 @@
 #
 #
 # Warning: no package should contain more than 16 files
 # Warning: no package should contain more than 16 files
 
 
-title=Free Pascal Compiler 1.9.6
-version=1.9.6
+title=Free Pascal Compiler 2.0.2
+version=2.0.2
 
 
 #
 #
 # General
 # General

+ 119 - 119
packages/base/Makefile

@@ -231,115 +231,115 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint mysql ibase odbc sqlite postgres
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint mysql ibase odbc sqlite postgres
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc sqlite pthreads
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc sqlite pthreads
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc sqlite pthreads
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc sqlite pthreads
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  libasync mysql ibase postgres oracle odbc sqlite pthreads
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  libasync mysql ibase postgres oracle odbc sqlite pthreads
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc sqlite pthreads
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc sqlite pthreads
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_DIRS+=paszlib pasjpeg regexpr netdb md5  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
+override TARGET_DIRS+=hash paszlib pasjpeg regexpr netdb  gdbint libasync mysql ibase postgres oracle odbc pthreads sqlite libc
 endif
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCSUBDIR=packages/base
 override INSTALL_FPCSUBDIR=packages/base
@@ -1378,11 +1378,11 @@ fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIR
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
 fpc_makefiles: fpc_makefile fpc_makefile_dirs
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1395,19 +1395,19 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_LIBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_IBASE=1
 TARGET_DIRS_IBASE=1
@@ -1416,18 +1416,18 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_POSTGRES=1
 TARGET_DIRS_POSTGRES=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1439,18 +1439,18 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_PTHREADS=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1460,32 +1460,32 @@ TARGET_DIRS_ORACLE=1
 TARGET_DIRS_ODBC=1
 TARGET_DIRS_ODBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1495,46 +1495,46 @@ TARGET_DIRS_ORACLE=1
 TARGET_DIRS_ODBC=1
 TARGET_DIRS_ODBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1547,11 +1547,11 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_LIBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1563,11 +1563,11 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_PTHREADS=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1577,25 +1577,25 @@ TARGET_DIRS_ORACLE=1
 TARGET_DIRS_ODBC=1
 TARGET_DIRS_ODBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1605,18 +1605,18 @@ TARGET_DIRS_ORACLE=1
 TARGET_DIRS_ODBC=1
 TARGET_DIRS_ODBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1629,11 +1629,11 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_LIBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1643,18 +1643,18 @@ TARGET_DIRS_ORACLE=1
 TARGET_DIRS_ODBC=1
 TARGET_DIRS_ODBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_IBASE=1
 TARGET_DIRS_IBASE=1
@@ -1665,18 +1665,18 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_PTHREADS=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1689,11 +1689,11 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_LIBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1703,18 +1703,18 @@ TARGET_DIRS_ORACLE=1
 TARGET_DIRS_ODBC=1
 TARGET_DIRS_ODBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1727,11 +1727,11 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_LIBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1743,18 +1743,18 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_PTHREADS=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1767,18 +1767,18 @@ TARGET_DIRS_SQLITE=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_LIBC=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
+TARGET_DIRS_HASH=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_PASJPEG=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_REGEXPR=1
 TARGET_DIRS_NETDB=1
 TARGET_DIRS_NETDB=1
-TARGET_DIRS_MD5=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_GDBINT=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_LIBASYNC=1
 TARGET_DIRS_MYSQL=1
 TARGET_DIRS_MYSQL=1
@@ -1790,6 +1790,51 @@ TARGET_DIRS_PTHREADS=1
 TARGET_DIRS_SQLITE=1
 TARGET_DIRS_SQLITE=1
 TARGET_DIRS_LIBC=1
 TARGET_DIRS_LIBC=1
 endif
 endif
+ifdef TARGET_DIRS_HASH
+hash_all:
+	$(MAKE) -C hash all
+hash_debug:
+	$(MAKE) -C hash debug
+hash_smart:
+	$(MAKE) -C hash smart
+hash_release:
+	$(MAKE) -C hash release
+hash_units:
+	$(MAKE) -C hash units
+hash_examples:
+	$(MAKE) -C hash examples
+hash_shared:
+	$(MAKE) -C hash shared
+hash_install:
+	$(MAKE) -C hash install
+hash_sourceinstall:
+	$(MAKE) -C hash sourceinstall
+hash_exampleinstall:
+	$(MAKE) -C hash exampleinstall
+hash_distinstall:
+	$(MAKE) -C hash distinstall
+hash_zipinstall:
+	$(MAKE) -C hash zipinstall
+hash_zipsourceinstall:
+	$(MAKE) -C hash zipsourceinstall
+hash_zipexampleinstall:
+	$(MAKE) -C hash zipexampleinstall
+hash_zipdistinstall:
+	$(MAKE) -C hash zipdistinstall
+hash_clean:
+	$(MAKE) -C hash clean
+hash_distclean:
+	$(MAKE) -C hash distclean
+hash_cleanall:
+	$(MAKE) -C hash cleanall
+hash_info:
+	$(MAKE) -C hash info
+hash_makefiles:
+	$(MAKE) -C hash makefiles
+hash:
+	$(MAKE) -C hash all
+.PHONY: hash_all hash_debug hash_smart hash_release hash_units hash_examples hash_shared hash_install hash_sourceinstall hash_exampleinstall hash_distinstall hash_zipinstall hash_zipsourceinstall hash_zipexampleinstall hash_zipdistinstall hash_clean hash_distclean hash_cleanall hash_info hash_makefiles hash
+endif
 ifdef TARGET_DIRS_PASZLIB
 ifdef TARGET_DIRS_PASZLIB
 paszlib_all:
 paszlib_all:
 	$(MAKE) -C paszlib all
 	$(MAKE) -C paszlib all
@@ -1970,51 +2015,6 @@ netdb:
 	$(MAKE) -C netdb all
 	$(MAKE) -C netdb all
 .PHONY: netdb_all netdb_debug netdb_smart netdb_release netdb_units netdb_examples netdb_shared netdb_install netdb_sourceinstall netdb_exampleinstall netdb_distinstall netdb_zipinstall netdb_zipsourceinstall netdb_zipexampleinstall netdb_zipdistinstall netdb_clean netdb_distclean netdb_cleanall netdb_info netdb_makefiles netdb
 .PHONY: netdb_all netdb_debug netdb_smart netdb_release netdb_units netdb_examples netdb_shared netdb_install netdb_sourceinstall netdb_exampleinstall netdb_distinstall netdb_zipinstall netdb_zipsourceinstall netdb_zipexampleinstall netdb_zipdistinstall netdb_clean netdb_distclean netdb_cleanall netdb_info netdb_makefiles netdb
 endif
 endif
-ifdef TARGET_DIRS_MD5
-md5_all:
-	$(MAKE) -C md5 all
-md5_debug:
-	$(MAKE) -C md5 debug
-md5_smart:
-	$(MAKE) -C md5 smart
-md5_release:
-	$(MAKE) -C md5 release
-md5_units:
-	$(MAKE) -C md5 units
-md5_examples:
-	$(MAKE) -C md5 examples
-md5_shared:
-	$(MAKE) -C md5 shared
-md5_install:
-	$(MAKE) -C md5 install
-md5_sourceinstall:
-	$(MAKE) -C md5 sourceinstall
-md5_exampleinstall:
-	$(MAKE) -C md5 exampleinstall
-md5_distinstall:
-	$(MAKE) -C md5 distinstall
-md5_zipinstall:
-	$(MAKE) -C md5 zipinstall
-md5_zipsourceinstall:
-	$(MAKE) -C md5 zipsourceinstall
-md5_zipexampleinstall:
-	$(MAKE) -C md5 zipexampleinstall
-md5_zipdistinstall:
-	$(MAKE) -C md5 zipdistinstall
-md5_clean:
-	$(MAKE) -C md5 clean
-md5_distclean:
-	$(MAKE) -C md5 distclean
-md5_cleanall:
-	$(MAKE) -C md5 cleanall
-md5_info:
-	$(MAKE) -C md5 info
-md5_makefiles:
-	$(MAKE) -C md5 makefiles
-md5:
-	$(MAKE) -C md5 all
-.PHONY: md5_all md5_debug md5_smart md5_release md5_units md5_examples md5_shared md5_install md5_sourceinstall md5_exampleinstall md5_distinstall md5_zipinstall md5_zipsourceinstall md5_zipexampleinstall md5_zipdistinstall md5_clean md5_distclean md5_cleanall md5_info md5_makefiles md5
-endif
 ifdef TARGET_DIRS_GDBINT
 ifdef TARGET_DIRS_GDBINT
 gdbint_all:
 gdbint_all:
 	$(MAKE) -C gdbint all
 	$(MAKE) -C gdbint all

+ 1 - 1
packages/base/Makefile.fpc

@@ -3,7 +3,7 @@
 #
 #
 
 
 [target]
 [target]
-dirs=paszlib pasjpeg regexpr netdb md5
+dirs=hash paszlib pasjpeg regexpr netdb
 dirs_linux=gdbint libasync mysql ibase postgres oracle odbc \
 dirs_linux=gdbint libasync mysql ibase postgres oracle odbc \
             pthreads sqlite libc
             pthreads sqlite libc
 dirs_win32=gdbint mysql ibase odbc sqlite postgres
 dirs_win32=gdbint mysql ibase odbc sqlite postgres

+ 39 - 75
packages/base/md5/Makefile → packages/base/hash/Makefile

@@ -1,8 +1,8 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/11/08]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/05/15]
 #
 #
 default: all
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd arm-linux
 BSDs = freebsd netbsd openbsd darwin
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
 LIMIT83fs = go32v2 os2 emx watcom
@@ -230,118 +230,106 @@ ifeq ($(UNITSDIR),)
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
-override PACKAGE_NAME=md5
-override PACKAGE_VERSION=2.0.3
+override PACKAGE_NAME=hash
+override PACKAGE_VERSION=2.0.0
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=md5
-endif
-ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=md5
-endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=md5
-endif
-ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=md5
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=md5
+override TARGET_UNITS+=md5 crc
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_EXAMPLES+=md5test
 override TARGET_EXAMPLES+=md5test
@@ -388,9 +376,6 @@ endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
 override TARGET_EXAMPLES+=md5test
 override TARGET_EXAMPLES+=md5test
 endif
 endif
-ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_EXAMPLES+=md5test
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_EXAMPLES+=md5test
 override TARGET_EXAMPLES+=md5test
 endif
 endif
@@ -442,18 +427,9 @@ endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 override TARGET_EXAMPLES+=md5test
 override TARGET_EXAMPLES+=md5test
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_EXAMPLES+=md5test
-endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
 override TARGET_EXAMPLES+=md5test
 override TARGET_EXAMPLES+=md5test
 endif
 endif
-ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_EXAMPLES+=md5test
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_EXAMPLES+=md5test
-endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 ifdef REQUIRE_UNITSDIR
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
@@ -1229,9 +1205,6 @@ endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
-ifeq ($(FULL_TARGET),i386-wince)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
@@ -1283,18 +1256,9 @@ endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
-ifeq ($(FULL_TARGET),arm-wince)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifdef REQUIRE_PACKAGES_RTL
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_RTL),)
 ifneq ($(PACKAGEDIR_RTL),)
@@ -1365,12 +1329,12 @@ ifeq ($(CPU_TARGET),i386)
 FPCCPUOPT:=-OG2p3
 FPCCPUOPT:=-OG2p3
 else
 else
 ifeq ($(CPU_TARGET),powerpc)
 ifeq ($(CPU_TARGET),powerpc)
-FPCCPUOPT:=-O1r
+FPCCPUOPT:=-O1
 else
 else
 FPCCPUOPT:=
 FPCCPUOPT:=
 endif
 endif
 endif
 endif
-override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPT+=-Xs $(FPCCPUOPT) -n
 override FPCOPTDEF+=RELEASE
 override FPCOPTDEF+=RELEASE
 endif
 endif
 ifdef STRIP
 ifdef STRIP

+ 3 - 3
packages/base/md5/Makefile.fpc → packages/base/hash/Makefile.fpc

@@ -3,11 +3,11 @@
 #
 #
 
 
 [package]
 [package]
-name=md5
-version=2.0.3
+name=hash
+version=2.0.0
 
 
 [target]
 [target]
-units=md5
+units=md5 crc
 examples=md5test
 examples=md5test
 
 
 [install]
 [install]

+ 31 - 37
packages/base/paszlib/gzcrc.pas → packages/base/hash/crc.pas

@@ -1,4 +1,4 @@
-Unit gzCrc;
+unit crc;
 
 
 {
 {
   crc32.c -- compute the CRC-32 of a data stream
   crc32.c -- compute the CRC-32 of a data stream
@@ -11,13 +11,7 @@ Unit gzCrc;
 
 
 interface
 interface
 
 
-{$I zconf.inc}
-
-uses
-  zutil, zbase;
-
-
-function crc32(crc : uLong; buf : pBytef; len : uInt) : uLong;
+function crc32(crc : cardinal; buf : Pbyte; len : cardinal) : cardinal;
 
 
 {  Update a running crc with the bytes buf[0..len-1] and return the updated
 {  Update a running crc with the bytes buf[0..len-1] and return the updated
    crc. If buf is NULL, this function returns the required initial value
    crc. If buf is NULL, this function returns the required initial value
@@ -26,9 +20,9 @@ function crc32(crc : uLong; buf : pBytef; len : uInt) : uLong;
    Usage example:
    Usage example:
 
 
     var
     var
-      crc : uLong;
+      crc : cardinal;
     begin
     begin
-      crc := crc32(0, Z_NULL, 0);
+      crc := crc32(0, nil, 0);
 
 
       while (read_buffer(buffer, length) <> EOF) do
       while (read_buffer(buffer, length) <> EOF) do
         crc := crc32(crc, buffer, length);
         crc := crc32(crc, buffer, length);
@@ -38,7 +32,7 @@ function crc32(crc : uLong; buf : pBytef; len : uInt) : uLong;
 
 
 }
 }
 
 
-function get_crc_table : pointer;  { can be used by asm versions of crc32() }
+function get_crc_table : Pcardinal;  { can be used by asm versions of crc32() }
 
 
 
 
 implementation
 implementation
@@ -80,9 +74,9 @@ var
 {local}
 {local}
 procedure make_crc_table;
 procedure make_crc_table;
 var
 var
- c    : uLong;
- n,k  : int;
- poly : uLong; { polynomial exclusive-or pattern }
+ c    : cardinal;
+ n,k  : integer;
+ poly : cardinal; { polynomial exclusive-or pattern }
 
 
 const
 const
  { terms of polynomial defining this crc (except x^32): }
  { terms of polynomial defining this crc (except x^32): }
@@ -90,13 +84,13 @@ const
 
 
 begin
 begin
   { make exclusive-or pattern from polynomial ($EDB88320) }
   { make exclusive-or pattern from polynomial ($EDB88320) }
-  poly := Long(0);
+  poly := longint(0);
   for n := 0 to (sizeof(p) div sizeof(Byte))-1 do
   for n := 0 to (sizeof(p) div sizeof(Byte))-1 do
-    poly := poly or (Long(1) shl (31 - p[n]));
+    poly := poly or (longint(1) shl (31 - p[n]));
 
 
   for n := 0 to 255 do
   for n := 0 to 255 do
   begin
   begin
-    c := uLong(n);
+    c := cardinal(n);
     for k := 0 to 7 do
     for k := 0 to 7 do
     begin
     begin
       if (c and 1) <> 0 then
       if (c and 1) <> 0 then
@@ -116,7 +110,7 @@ end;
 
 
 {local}
 {local}
 const
 const
-  crc_table : array[0..256-1] of uLongf = (
+  crc_table : array[0..256-1] of cardinal = (
   $00000000, $77073096, $ee0e612c, $990951ba, $076dc419,
   $00000000, $77073096, $ee0e612c, $990951ba, $076dc419,
   $706af48f, $e963a535, $9e6495a3, $0edb8832, $79dcb8a4,
   $706af48f, $e963a535, $9e6495a3, $0edb8832, $79dcb8a4,
   $e0d5e91e, $97d2d988, $09b64c2b, $7eb17cbd, $e7b82d07,
   $e0d5e91e, $97d2d988, $09b64c2b, $7eb17cbd, $e7b82d07,
@@ -175,21 +169,21 @@ const
 { =========================================================================
 { =========================================================================
   This function can be used by asm versions of crc32() }
   This function can be used by asm versions of crc32() }
 
 
-function get_crc_table : {const} pointer;
+function get_crc_table : {const} Pcardinal;
 begin
 begin
 {$ifdef DYNAMIC_CRC_TABLE}
 {$ifdef DYNAMIC_CRC_TABLE}
   if (crc_table_empty) then
   if (crc_table_empty) then
     make_crc_table;
     make_crc_table;
 {$endif}
 {$endif}
-  get_crc_table :=  {const} pointer(@crc_table);
+  get_crc_table :=  {const} Pcardinal(@crc_table);
 end;
 end;
 
 
 { ========================================================================= }
 { ========================================================================= }
 
 
-function crc32 (crc : uLong; buf : pBytef; len : uInt): uLong;
+function crc32 (crc : cardinal; buf : Pbyte; len : cardinal): cardinal;
 begin
 begin
-  if (buf = Z_NULL) then
-    crc32 := Long(0)
+  if (buf = nil) then
+    crc32 := 0
   else
   else
   begin
   begin
 
 
@@ -198,40 +192,40 @@ begin
       make_crc_table;
       make_crc_table;
 {$ENDIF}
 {$ENDIF}
 
 
-    crc := crc xor ULong($ffffffff);
+    crc := crc xor cardinal($ffffffff);
     while (len >= 8) do
     while (len >= 8) do
     begin
     begin
       {DO8(buf)}
       {DO8(buf)}
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
 
 
-      Dec(len, 8);
+      dec(len, 8);
     end;
     end;
     if (len <> 0) then
     if (len <> 0) then
     repeat
     repeat
       {DO1(buf)}
       {DO1(buf)}
-      crc := crc_table[(int(crc) xor buf^) and $ff] xor (crc shr 8);
+      crc := crc_table[(integer(crc) xor buf^) and $ff] xor (crc shr 8);
       inc(buf);
       inc(buf);
 
 
-      Dec(len);
+      dec(len);
     until (len = 0);
     until (len = 0);
-    crc32 := crc xor ULong($ffffffff);
+    crc32 := crc xor cardinal($ffffffff);
   end;
   end;
 end;
 end;
 
 
 
 
-end.
+end.

+ 10 - 0
packages/base/hash/fpmake.inc

@@ -0,0 +1,10 @@
+    StartPackage('md5');
+    {$IF defined(ALLPACKAGES)}
+    Directory:='base/md5';
+    {$ELSEIF defined(BASEPACKAGES)}
+    Directory:='md5';
+    {$ENDIF}
+    Version:='2.0.0';
+    T:=Targets.AddUnit('md5');
+    T:=Targets.AddExampleunit('md5test');
+    EndPackage;

+ 17 - 0
packages/base/hash/fpmake.pp

@@ -0,0 +1,17 @@
+{$mode objfpc}{$H+}
+program fpmake;
+
+uses fpmkunit;
+
+Var
+  T : TTarget;
+
+begin
+  With Installer do 
+    begin
+    { Base packages }
+    {$i fpmake.inc}
+    Run;
+    end;
+end.
+

+ 0 - 0
packages/base/md5/md5.pp → packages/base/hash/md5.pp


+ 0 - 0
packages/base/md5/md5.ref → packages/base/hash/md5.ref


+ 0 - 0
packages/base/md5/md5test.pp → packages/base/hash/md5test.pp


+ 101 - 38
packages/base/paszlib/Makefile

@@ -233,115 +233,115 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
 override PACKAGE_NAME=paszlib
 override PACKAGE_NAME=paszlib
 override PACKAGE_VERSION=2.0.3
 override PACKAGE_VERSION=2.0.3
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+override TARGET_UNITS+=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_EXAMPLES+=example minigzip
 override TARGET_EXAMPLES+=example minigzip
@@ -1183,117 +1183,154 @@ else
 TAROPT=vz
 TAROPT=vz
 TAREXT=.tar.gz
 TAREXT=.tar.gz
 endif
 endif
-override REQUIRE_PACKAGES=rtl 
+override REQUIRE_PACKAGES=rtl hash
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HASH=1
 endif
 endif
 ifdef REQUIRE_PACKAGES_RTL
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
@@ -1321,6 +1358,32 @@ ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
 endif
 endif
 endif
+ifdef REQUIRE_PACKAGES_HASH
+PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_HASH),)
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)),)
+UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)
+else
+UNITDIR_HASH=$(PACKAGEDIR_HASH)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_HASH)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_HASH)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_HASH=
+UNITDIR_HASH:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /hash/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_HASH),)
+UNITDIR_HASH:=$(firstword $(UNITDIR_HASH))
+else
+UNITDIR_HASH=
+endif
+endif
+ifdef UNITDIR_HASH
+override COMPILER_UNITDIR+=$(UNITDIR_HASH)
+endif
+endif
 ifndef NOCPUDEF
 ifndef NOCPUDEF
 override FPCOPTDEF=$(CPU_TARGET)
 override FPCOPTDEF=$(CPU_TARGET)
 endif
 endif

+ 4 - 1
packages/base/paszlib/Makefile.fpc

@@ -6,8 +6,11 @@
 name=paszlib
 name=paszlib
 version=2.0.3
 version=2.0.3
 
 
+[require]
+packages=hash
+
 [target]
 [target]
-units=paszlib adler gzcrc gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr zutil
+units=paszlib adler gzio infblock infcodes inffast inftrees infutil trees zcompres zdeflate zinflate zbase zuncompr
 examples=example minigzip
 examples=example minigzip
 
 
 [install]
 [install]

+ 10 - 12
packages/base/paszlib/adler.pas

@@ -1,4 +1,4 @@
-Unit Adler;
+unit adler;
 
 
 {
 {
   adler32.c -- compute the Adler-32 checksum of a data stream
   adler32.c -- compute the Adler-32 checksum of a data stream
@@ -13,10 +13,7 @@ interface
 
 
 {$I zconf.inc}
 {$I zconf.inc}
 
 
-uses
-  zutil;
-
-function adler32(adler : uLong; buf : pBytef; len : uInt) : uLong;
+function adler32(adler : cardinal; buf : Pbyte; len : cardinal) : cardinal;
 
 
 {    Update a running Adler-32 checksum with the bytes buf[0..len-1] and
 {    Update a running Adler-32 checksum with the bytes buf[0..len-1] and
    return the updated checksum. If buf is NIL, this function returns
    return the updated checksum. If buf is NIL, this function returns
@@ -25,9 +22,9 @@ function adler32(adler : uLong; buf : pBytef; len : uInt) : uLong;
    much faster. Usage example:
    much faster. Usage example:
 
 
    var
    var
-     adler : uLong;
+     adler : cardinal;
    begin
    begin
-     adler := adler32(0, Z_NULL, 0);
+     adler := adler32(0, nil, 0);
 
 
      while (read_buffer(buffer, length) <> EOF) do
      while (read_buffer(buffer, length) <> EOF) do
        adler := adler32(adler, buffer, length);
        adler := adler32(adler, buffer, length);
@@ -40,7 +37,7 @@ function adler32(adler : uLong; buf : pBytef; len : uInt) : uLong;
 implementation
 implementation
 
 
 const
 const
-  BASE = Long(65521); { largest prime smaller than 65536 }
+  BASE = cardinal(65521); { largest prime smaller than 65536 }
   {NMAX = 5552; original code with unsigned 32 bit integer }
   {NMAX = 5552; original code with unsigned 32 bit integer }
   { NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 }
   { NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 }
   NMAX = 3854;        { code with signed 32 bit integer }
   NMAX = 3854;        { code with signed 32 bit integer }
@@ -50,17 +47,17 @@ const
 
 
 { ========================================================================= }
 { ========================================================================= }
 
 
-function adler32(adler : uLong; buf : pBytef; len : uInt) : uLong;
+function adler32(adler : cardinal; buf : Pbyte; len : cardinal) : cardinal;
 var
 var
-  s1, s2 : uLong;
-  k : int;
+  s1, s2 : cardinal;
+  k : integer;
 begin
 begin
   s1 := adler and $ffff;
   s1 := adler and $ffff;
   s2 := (adler shr 16) and $ffff;
   s2 := (adler shr 16) and $ffff;
 
 
   if not Assigned(buf) then
   if not Assigned(buf) then
   begin
   begin
-    adler32 := uLong(1);
+    adler32 := cardinal(1);
     exit;
     exit;
   end;
   end;
 
 
@@ -111,3 +108,4 @@ end;
 #define DO16(buf)   DO8(buf,0); DO8(buf,8);
 #define DO16(buf)   DO8(buf,0); DO8(buf,8);
 }
 }
 end.
 end.
+

+ 85 - 124
packages/base/paszlib/example.pas

@@ -8,9 +8,7 @@ program example;
   For conditions of distribution and use, see copyright notice in readme.txt
   For conditions of distribution and use, see copyright notice in readme.txt
 }
 }
 {-$define MemCheck}
 {-$define MemCheck}
-{$IFNDEF FPC}
-  {$DEFINE TEST_COMPRESS}
-{$ENDIF}
+{$DEFINE TEST_COMPRESS}
 {$DEFINE TEST_GZIO}
 {$DEFINE TEST_GZIO}
 {$DEFINE TEST_INFLATE}
 {$DEFINE TEST_INFLATE}
 {$DEFINE TEST_DEFLATE}
 {$DEFINE TEST_DEFLATE}
@@ -19,22 +17,16 @@ program example;
 {$DEFINE TEST_FLUSH}
 {$DEFINE TEST_FLUSH}
 
 
 uses
 uses
-{$ifdef ver80}
- WinCrt,
-{$endif}
   strings,
   strings,
-{$ifndef MSDOS}
-  SysUtils,
-{$endif}
   zutil,
   zutil,
   zbase,
   zbase,
-  gzIo,
-  zInflate,
-  zDeflate,
-  zCompres,
-  zUnCompr
-{$ifdef MemCheck}
-  , MemCheck in '..\..\monotekt\pas\memcheck\memcheck.pas'
+  gzio,
+  zinflate,
+  zdeflate,
+  zcompres,
+  zuncompr
+{$ifdef memcheck}
+  , memcheck in '..\..\monotekt\pas\memcheck\memcheck.pas'
 {$endif}
 {$endif}
 ;
 ;
 
 
@@ -45,7 +37,7 @@ begin
   Halt(1);
   Halt(1);
 end;
 end;
 
 
-procedure CHECK_ERR(err : int; msg : string);
+procedure CHECK_ERR(err : integer; msg : string);
 begin
 begin
   if (err <> Z_OK) then
   if (err <> Z_OK) then
   begin
   begin
@@ -63,21 +55,21 @@ const
 const
 const
   dictionary : PChar = 'hello';
   dictionary : PChar = 'hello';
 var
 var
-  dictId : uLong; { Adler32 value of the dictionary }
+  dictId : cardinal; { Adler32 value of the dictionary }
 {$ENDIF}
 {$ENDIF}
 
 
 { ===========================================================================
 { ===========================================================================
   Test compress() and uncompress() }
   Test compress() and uncompress() }
 
 
 {$IFDEF TEST_COMPRESS}
 {$IFDEF TEST_COMPRESS}
-procedure test_compress(compr : pBytef; var comprLen : uLong;
-                        uncompr : pBytef; uncomprLen : uLong);
+procedure test_compress(compr : Pbyte; var comprLen : cardinal;
+                        uncompr : Pbyte; uncomprLen : cardinal);
 var
 var
-  err : int;
-  len : uLong;
+  err : integer;
+  len : cardinal;
 begin
 begin
   len := strlen(hello)+1;
   len := strlen(hello)+1;
-  err := compress(compr, comprLen, pBytef(hello)^, len);
+  err := compress(compr, comprLen, Pbyte(hello)^, len);
   CHECK_ERR(err, 'compress');
   CHECK_ERR(err, 'compress');
 
 
   strcopy(PChar(uncompr), 'garbage');
   strcopy(PChar(uncompr), 'garbage');
@@ -101,11 +93,11 @@ end;
 {$IFDEF TEST_GZIO}
 {$IFDEF TEST_GZIO}
 procedure test_gzio(const outf : string; { output file }
 procedure test_gzio(const outf : string; { output file }
                     const inf : string;  { input file }
                     const inf : string;  { input file }
-                    uncompr : pBytef;
-                    uncomprLen : int);
+                    uncompr : Pbyte;
+                    uncomprLen : integer);
 var
 var
-  err : int;
-  len : int;
+  err : integer;
+  len : integer;
 var
 var
   zfile : gzFile;
   zfile : gzFile;
   pos : z_off_t;
   pos : z_off_t;
@@ -137,7 +129,7 @@ begin
     Stop;
     Stop;
   end;
   end;
   {$ENDIF}
   {$ENDIF}
-  gzseek(zfile, Long(1), SEEK_CUR); { add one zero byte }
+  gzseek(zfile, longint(1), SEEK_CUR); { add one zero byte }
   gzclose(zfile);
   gzclose(zfile);
 
 
   zfile := gzopen(inf, 'r');
   zfile := gzopen(inf, 'r');
@@ -146,7 +138,7 @@ begin
 
 
   strcopy(pchar(uncompr), 'garbage');
   strcopy(pchar(uncompr), 'garbage');
 
 
-  uncomprLen := gzread(zfile, uncompr, uInt(uncomprLen));
+  uncomprLen := gzread(zfile, uncompr, cardinal(uncomprLen));
   if (uncomprLen <> len) then
   if (uncomprLen <> len) then
   begin
   begin
     WriteLn('gzread err: ', gzerror(zfile, err));
     WriteLn('gzread err: ', gzerror(zfile, err));
@@ -160,7 +152,7 @@ begin
   else
   else
     WriteLn('gzread(): ', pchar(uncompr));
     WriteLn('gzread(): ', pchar(uncompr));
 
 
-  pos := gzseek(zfile, Long(-8), SEEK_CUR);
+  pos := gzseek(zfile, longint(-8), SEEK_CUR);
   if (pos <> 6) or (gztell(zfile) <> pos) then
   if (pos <> 6) or (gztell(zfile) <> pos) then
   begin
   begin
     WriteLn('gzseek error, pos=',pos,', gztell=',gztell(zfile));
     WriteLn('gzseek error, pos=',pos,', gztell=',gztell(zfile));
@@ -196,24 +188,21 @@ end;
   Test deflate() with small buffers }
   Test deflate() with small buffers }
 
 
 {$IFDEF TEST_DEFLATE}
 {$IFDEF TEST_DEFLATE}
-procedure test_deflate(compr : pBytef; comprLen : uLong);
+procedure test_deflate(compr : Pbyte; comprLen : cardinal);
 var
 var
   c_stream : z_stream; { compression stream }
   c_stream : z_stream; { compression stream }
-  err : int;
-  len : int;
+  err : integer;
+  len : integer;
 begin
 begin
   len := strlen(hello)+1;
   len := strlen(hello)+1;
-  c_stream.zalloc := NIL; {alloc_func(0);}
-  c_stream.zfree := NIL;  {free_func(0);}
-  c_stream.opaque := NIL; {voidpf(0);}
 
 
   err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION);
   err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION);
   CHECK_ERR(err, 'deflateInit');
   CHECK_ERR(err, 'deflateInit');
 
 
-  c_stream.next_in  := pBytef(hello);
+  c_stream.next_in  := Pbyte(hello);
   c_stream.next_out := compr;
   c_stream.next_out := compr;
 
 
-  while (c_stream.total_in <> uLong(len)) and (c_stream.total_out < comprLen) do
+  while (c_stream.total_in <> cardinal(len)) and (c_stream.total_out < comprLen) do
   begin
   begin
     c_stream.avail_out := 1; { force small buffers }
     c_stream.avail_out := 1; { force small buffers }
     c_stream.avail_in := 1;
     c_stream.avail_in := 1;
@@ -241,18 +230,14 @@ end;
 }
 }
 
 
 {$IFDEF TEST_INFLATE}
 {$IFDEF TEST_INFLATE}
-procedure test_inflate(compr : pBytef; comprLen : uLong;
-                       uncompr : pBytef;  uncomprLen : uLong);
+procedure test_inflate(compr : Pbyte; comprLen : cardinal;
+                       uncompr : Pbyte;  uncomprLen : cardinal);
 var
 var
-  err : int;
+  err : integer;
   d_stream : z_stream; { decompression stream }
   d_stream : z_stream; { decompression stream }
 begin
 begin
   strcopy(PChar(uncompr), 'garbage');
   strcopy(PChar(uncompr), 'garbage');
 
 
-  d_stream.zalloc := NIL; {alloc_func(0);}
-  d_stream.zfree := NIL; {free_func(0);}
-  d_stream.opaque := NIL; {voidpf(0);}
-
   d_stream.next_in  := compr;
   d_stream.next_in  := compr;
   d_stream.avail_in := 0;
   d_stream.avail_in := 0;
   d_stream.next_out := uncompr;
   d_stream.next_out := uncompr;
@@ -291,27 +276,23 @@ end;
  }
  }
 
 
 {$IFDEF TEST_DEFLATE}
 {$IFDEF TEST_DEFLATE}
-procedure test_large_deflate(compr : pBytef; comprLen : uLong;
-                             uncompr : pBytef;  uncomprLen : uLong);
+procedure test_large_deflate(compr : Pbyte; comprLen : cardinal;
+                             uncompr : Pbyte;  uncomprLen : cardinal);
 var
 var
   c_stream : z_stream; { compression stream }
   c_stream : z_stream; { compression stream }
-  err : int;
+  err : integer;
 begin
 begin
-  c_stream.zalloc := NIL; {alloc_func(0);}
-  c_stream.zfree := NIL;  {free_func(0);}
-  c_stream.opaque := NIL; {voidpf(0);}
-
   err := deflateInit(c_stream, Z_BEST_SPEED);
   err := deflateInit(c_stream, Z_BEST_SPEED);
   CHECK_ERR(err, 'deflateInit');
   CHECK_ERR(err, 'deflateInit');
 
 
   c_stream.next_out := compr;
   c_stream.next_out := compr;
-  c_stream.avail_out := uInt(comprLen);
+  c_stream.avail_out := cardinal(comprLen);
 
 
   { At this point, uncompr is still mostly zeroes, so it should compress
   { At this point, uncompr is still mostly zeroes, so it should compress
     very well: }
     very well: }
 
 
   c_stream.next_in := uncompr;
   c_stream.next_in := uncompr;
-  c_stream.avail_in := uInt(uncomprLen);
+  c_stream.avail_in := cardinal(uncomprLen);
   err := deflate(c_stream, Z_NO_FLUSH);
   err := deflate(c_stream, Z_NO_FLUSH);
   CHECK_ERR(err, 'deflate');
   CHECK_ERR(err, 'deflate');
   if (c_stream.avail_in <> 0) then
   if (c_stream.avail_in <> 0) then
@@ -323,14 +304,14 @@ begin
   { Feed in already compressed data and switch to no compression: }
   { Feed in already compressed data and switch to no compression: }
   deflateParams(c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
   deflateParams(c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY);
   c_stream.next_in := compr;
   c_stream.next_in := compr;
-  c_stream.avail_in := uInt(comprLen div 2);
+  c_stream.avail_in := cardinal(comprLen div 2);
   err := deflate(c_stream, Z_NO_FLUSH);
   err := deflate(c_stream, Z_NO_FLUSH);
   CHECK_ERR(err, 'deflate');
   CHECK_ERR(err, 'deflate');
 
 
   { Switch back to compressing mode: }
   { Switch back to compressing mode: }
   deflateParams(c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
   deflateParams(c_stream, Z_BEST_COMPRESSION, Z_FILTERED);
   c_stream.next_in := uncompr;
   c_stream.next_in := uncompr;
-  c_stream.avail_in := uInt(uncomprLen);
+  c_stream.avail_in := cardinal(uncomprLen);
   err := deflate(c_stream, Z_NO_FLUSH);
   err := deflate(c_stream, Z_NO_FLUSH);
   CHECK_ERR(err, 'deflate');
   CHECK_ERR(err, 'deflate');
 
 
@@ -349,20 +330,16 @@ end;
   Test inflate() with large buffers }
   Test inflate() with large buffers }
 
 
 {$IFDEF TEST_INFLATE}
 {$IFDEF TEST_INFLATE}
-procedure test_large_inflate(compr : pBytef; comprLen : uLong;
-                             uncompr : pBytef;  uncomprLen : uLong);
+procedure test_large_inflate(compr : Pbyte; comprLen : cardinal;
+                             uncompr : Pbyte;  uncomprLen : cardinal);
 var
 var
-  err : int;
+  err : integer;
   d_stream : z_stream; { decompression stream }
   d_stream : z_stream; { decompression stream }
 begin
 begin
   strcopy(PChar(uncompr), 'garbage');
   strcopy(PChar(uncompr), 'garbage');
 
 
-  d_stream.zalloc := NIL; {alloc_func(0);}
-  d_stream.zfree := NIL; {free_func(0);}
-  d_stream.opaque := NIL; {voidpf(0);}
-
   d_stream.next_in  := compr;
   d_stream.next_in  := compr;
-  d_stream.avail_in := uInt(comprLen);
+  d_stream.avail_in := cardinal(comprLen);
 
 
   err := inflateInit(d_stream);
   err := inflateInit(d_stream);
   CHECK_ERR(err, 'inflateInit');
   CHECK_ERR(err, 'inflateInit');
@@ -370,7 +347,7 @@ begin
   while TRUE do
   while TRUE do
   begin
   begin
     d_stream.next_out := uncompr;            { discard the output }
     d_stream.next_out := uncompr;            { discard the output }
-    d_stream.avail_out := uInt(uncomprLen);
+    d_stream.avail_out := cardinal(uncomprLen);
     err := inflate(d_stream, Z_NO_FLUSH);
     err := inflate(d_stream, Z_NO_FLUSH);
     if (err = Z_STREAM_END) then
     if (err = Z_STREAM_END) then
       break;
       break;
@@ -394,25 +371,21 @@ end;
   Test deflate() with full flush
   Test deflate() with full flush
  }
  }
 {$IFDEF TEST_FLUSH}
 {$IFDEF TEST_FLUSH}
-procedure test_flush(compr : pBytef; var comprLen : uLong);
+procedure test_flush(compr : Pbyte; var comprLen : cardinal);
 var
 var
   c_stream : z_stream; { compression stream }
   c_stream : z_stream; { compression stream }
-  err : int;
-  len : int;
+  err : integer;
+  len : integer;
 
 
 begin
 begin
   len := strlen(hello)+1;
   len := strlen(hello)+1;
-  c_stream.zalloc := NIL;       {alloc_func(0);}
-  c_stream.zfree := NIL;        {free_func(0);}
-  c_stream.opaque := NIL;       {voidpf(0);}
-
   err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION);
   err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION);
   CHECK_ERR(err, 'deflateInit');
   CHECK_ERR(err, 'deflateInit');
 
 
-  c_stream.next_in := pBytef(hello);
+  c_stream.next_in := Pbyte(hello);
   c_stream.next_out := compr;
   c_stream.next_out := compr;
   c_stream.avail_in := 3;
   c_stream.avail_in := 3;
-  c_stream.avail_out := uInt(comprLen);
+  c_stream.avail_out := cardinal(comprLen);
 
 
   err := deflate(c_stream, Z_FULL_FLUSH);
   err := deflate(c_stream, Z_FULL_FLUSH);
   CHECK_ERR(err, 'deflate');
   CHECK_ERR(err, 'deflate');
@@ -435,18 +408,14 @@ end;
   Test inflateSync()
   Test inflateSync()
  }
  }
 {$IFDEF TEST_SYNC}
 {$IFDEF TEST_SYNC}
-procedure test_sync(compr : pBytef; comprLen : uLong;
-                    uncompr : pBytef; uncomprLen : uLong);
+procedure test_sync(compr : Pbyte; comprLen : cardinal;
+                    uncompr : Pbyte; uncomprLen : cardinal);
 var
 var
-  err : int;
+  err : integer;
   d_stream : z_stream; { decompression stream }
   d_stream : z_stream; { decompression stream }
 begin
 begin
   strcopy(PChar(uncompr), 'garbage');
   strcopy(PChar(uncompr), 'garbage');
 
 
-  d_stream.zalloc := NIL;            {alloc_func(0);}
-  d_stream.zfree := NIL;             {free_func(0);}
-  d_stream.opaque := NIL;            {voidpf(0);}
-
   d_stream.next_in  := compr;
   d_stream.next_in  := compr;
   d_stream.avail_in := 2; { just read the zlib header }
   d_stream.avail_in := 2; { just read the zlib header }
 
 
@@ -454,12 +423,12 @@ begin
   CHECK_ERR(err, 'inflateInit');
   CHECK_ERR(err, 'inflateInit');
 
 
   d_stream.next_out := uncompr;
   d_stream.next_out := uncompr;
-  d_stream.avail_out := uInt(uncomprLen);
+  d_stream.avail_out := cardinal(uncomprLen);
 
 
   inflate(d_stream, Z_NO_FLUSH);
   inflate(d_stream, Z_NO_FLUSH);
   CHECK_ERR(err, 'inflate');
   CHECK_ERR(err, 'inflate');
 
 
-  d_stream.avail_in := uInt(comprLen-2);   { read all compressed data }
+  d_stream.avail_in := cardinal(comprLen-2);   { read all compressed data }
   err := inflateSync(d_stream);           { but skip the damaged part }
   err := inflateSync(d_stream);           { but skip the damaged part }
   CHECK_ERR(err, 'inflateSync');
   CHECK_ERR(err, 'inflateSync');
 
 
@@ -481,28 +450,24 @@ end;
   Test deflate() with preset dictionary
   Test deflate() with preset dictionary
  }
  }
 {$IFDEF TEST_DICT}
 {$IFDEF TEST_DICT}
-procedure test_dict_deflate(compr : pBytef; comprLen : uLong);
+procedure test_dict_deflate(compr : Pbyte; comprLen : cardinal);
 var
 var
   c_stream : z_stream; { compression stream }
   c_stream : z_stream; { compression stream }
-  err : int;
+  err : integer;
 begin
 begin
-  c_stream.zalloc := NIL; {(alloc_func)0;}
-  c_stream.zfree := NIL; {(free_func)0;}
-  c_stream.opaque := NIL; {(voidpf)0;}
-
   err := deflateInit(c_stream, Z_BEST_COMPRESSION);
   err := deflateInit(c_stream, Z_BEST_COMPRESSION);
   CHECK_ERR(err, 'deflateInit');
   CHECK_ERR(err, 'deflateInit');
 
 
   err := deflateSetDictionary(c_stream,
   err := deflateSetDictionary(c_stream,
-                              pBytef(dictionary), StrLen(dictionary));
+                              Pbyte(dictionary), StrLen(dictionary));
   CHECK_ERR(err, 'deflateSetDictionary');
   CHECK_ERR(err, 'deflateSetDictionary');
 
 
   dictId := c_stream.adler;
   dictId := c_stream.adler;
   c_stream.next_out := compr;
   c_stream.next_out := compr;
-  c_stream.avail_out := uInt(comprLen);
+  c_stream.avail_out := cardinal(comprLen);
 
 
-  c_stream.next_in := pBytef(hello);
-  c_stream.avail_in := uInt(strlen(hello)+1);
+  c_stream.next_in := Pbyte(hello);
+  c_stream.avail_in := cardinal(strlen(hello)+1);
 
 
   err := deflate(c_stream, Z_FINISH);
   err := deflate(c_stream, Z_FINISH);
   if (err <> Z_STREAM_END) then
   if (err <> Z_STREAM_END) then
@@ -517,26 +482,22 @@ end;
 { ===========================================================================
 { ===========================================================================
   Test inflate() with a preset dictionary }
   Test inflate() with a preset dictionary }
 
 
-procedure test_dict_inflate(compr : pBytef; comprLen : uLong;
-                            uncompr : pBytef; uncomprLen : uLong);
+procedure test_dict_inflate(compr : Pbyte; comprLen : cardinal;
+                            uncompr : Pbyte; uncomprLen : cardinal);
 var
 var
-  err : int;
+  err : integer;
   d_stream : z_stream; { decompression stream }
   d_stream : z_stream; { decompression stream }
 begin
 begin
   strcopy(PChar(uncompr), 'garbage');
   strcopy(PChar(uncompr), 'garbage');
 
 
-  d_stream.zalloc := NIL;              { alloc_func(0); }
-  d_stream.zfree := NIL;               { free_func(0); }
-  d_stream.opaque := NIL;              { voidpf(0); }
-
   d_stream.next_in  := compr;
   d_stream.next_in  := compr;
-  d_stream.avail_in := uInt(comprLen);
+  d_stream.avail_in := cardinal(comprLen);
 
 
   err := inflateInit(d_stream);
   err := inflateInit(d_stream);
   CHECK_ERR(err, 'inflateInit');
   CHECK_ERR(err, 'inflateInit');
 
 
   d_stream.next_out := uncompr;
   d_stream.next_out := uncompr;
-  d_stream.avail_out := uInt(uncomprLen);
+  d_stream.avail_out := cardinal(uncomprLen);
 
 
   while TRUE do
   while TRUE do
   begin
   begin
@@ -548,10 +509,10 @@ begin
       if (d_stream.adler <> dictId) then
       if (d_stream.adler <> dictId) then
       begin
       begin
         WriteLn('unexpected dictionary');
         WriteLn('unexpected dictionary');
-        Stop;
+	Stop;
       end;
       end;
-      err := inflateSetDictionary(d_stream, pBytef(dictionary),
-                                     StrLen(dictionary));
+      err := inflateSetDictionary(d_stream, Pbyte(dictionary),
+				     StrLen(dictionary));
     end;
     end;
     CHECK_ERR(err, 'inflate with dict');
     CHECK_ERR(err, 'inflate with dict');
   end;
   end;
@@ -571,13 +532,13 @@ begin
 end;
 end;
 {$ENDIF}
 {$ENDIF}
 
 
-function GetFromFile(buf : pBytef; FName : string;
-                     var MaxLen : uInt) : boolean;
+function GetFromFile(buf : Pbyte; FName : string;
+                     var MaxLen : cardinal) : boolean;
 const
 const
   zOfs = 0;
   zOfs = 0;
 var
 var
   f : file;
   f : file;
-  Len : uLong;
+  Len : cardinal;
 begin
 begin
   assign(f, FName);
   assign(f, FName);
   GetFromFile := false;
   GetFromFile := false;
@@ -604,17 +565,17 @@ end;
 }
 }
 
 
 var
 var
-  compr, uncompr : pBytef;
+  compr, uncompr : Pbyte;
 const
 const
   msdoslen = 25000;
   msdoslen = 25000;
-  comprLenL : uLong = msdoslen div sizeof(uInt); { don't overflow on MSDOS }
-  uncomprLenL : uLong = msdoslen div sizeof(uInt);
+  comprLenL : cardinal = msdoslen div sizeof(cardinal); { don't overflow on MSDOS }
+  uncomprLenL : cardinal = msdoslen div sizeof(cardinal);
 var
 var
   zVersion,
   zVersion,
   myVersion : string;
   myVersion : string;
 var
 var
-  comprLen : uInt;
-  uncomprLen : uInt;
+  comprLen : cardinal;
+  uncomprLen : cardinal;
 begin
 begin
   {$ifdef MemCheck}
   {$ifdef MemCheck}
   MemChk;
   MemChk;
@@ -635,20 +596,20 @@ begin
       WriteLn('warning: different zlib version');
       WriteLn('warning: different zlib version');
     end;
     end;
 
 
-  GetMem(compr, comprLen*sizeof(uInt));
-  GetMem(uncompr, uncomprLen*sizeof(uInt));
+  GetMem(compr, comprLen*sizeof(cardinal));
+  GetMem(uncompr, uncomprLen*sizeof(cardinal));
   { compr and uncompr are cleared to avoid reading uninitialized
   { compr and uncompr are cleared to avoid reading uninitialized
     data and to ensure that uncompr compresses well. }
     data and to ensure that uncompr compresses well. }
 
 
-  if (compr = Z_NULL) or (uncompr = Z_NULL) then
+  if (compr = nil) or (uncompr = nil) then
   begin
   begin
     WriteLn('out of memory');
     WriteLn('out of memory');
     Stop;
     Stop;
   end;
   end;
-  FillChar(compr^, comprLen*sizeof(uInt), 0);
-  FillChar(uncompr^, uncomprLen*sizeof(uInt), 0);
+  FillChar(compr^, comprLen*sizeof(cardinal), 0);
+  FillChar(uncompr^, uncomprLen*sizeof(cardinal), 0);
 
 
-  if (compr = Z_NULL) or (uncompr = Z_NULL) then
+  if (compr = nil) or (uncompr = nil) then
   begin
   begin
     WriteLn('out of memory');
     WriteLn('out of memory');
     Stop;
     Stop;
@@ -659,10 +620,10 @@ begin
 
 
   {$IFDEF TEST_GZIO}
   {$IFDEF TEST_GZIO}
   Case ParamCount of
   Case ParamCount of
-    0:  test_gzio('foo.gz', 'foo.gz', uncompr, int(uncomprLen));
-    1:  test_gzio(ParamStr(1), 'foo.gz', uncompr, int(uncomprLen));
+    0:  test_gzio('foo.gz', 'foo.gz', uncompr, integer(uncomprLen));
+    1:  test_gzio(ParamStr(1), 'foo.gz', uncompr, integer(uncomprLen));
   else
   else
-    test_gzio(ParamStr(1), ParamStr(2), uncompr, int(uncomprLen));
+    test_gzio(ParamStr(1), ParamStr(2), uncompr, integer(uncomprLen));
   end;
   end;
   {$ENDIF}
   {$ENDIF}
 
 
@@ -699,6 +660,6 @@ begin
   test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
   test_dict_inflate(compr, comprLen, uncompr, uncomprLen);
   {$ENDIF}
   {$ENDIF}
   readln;
   readln;
-  FreeMem(compr, comprLen*sizeof(uInt));
-  FreeMem(uncompr, uncomprLen*sizeof(uInt));
+  FreeMem(compr, comprLen*sizeof(cardinal));
+  FreeMem(uncompr, uncomprLen*sizeof(cardinal));
 end.
 end.

+ 160 - 161
packages/base/paszlib/gzio.pas

@@ -1,4 +1,4 @@
-Unit gzIO;
+unit gzio;
 
 
 {
 {
   Pascal unit based on gzio.c -- IO on .gz files
   Pascal unit based on gzio.c -- IO on .gz files
@@ -16,40 +16,40 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  {$ifdef MSDOS}
-  dos, strings,
+  {$ifdef UNIX}
+  baseunix,
   {$else}
   {$else}
-  SysUtils,
+  dos,
   {$endif}
   {$endif}
-  zutil, zbase, gzcrc, zdeflate, zinflate;
+  zbase, crc, zdeflate, zinflate;
 
 
-type gzFile = voidp;
-type z_off_t = long;
+type gzFile = pointer;
+type z_off_t = longint;
 
 
-function gzopen  (path:ansistring; mode:string) : gzFile;
-function gzsetparams (f:gzfile; level:int; strategy:int) : int;
-function gzread  (f:gzFile; buf:voidp; len:uInt) : int;
-function gzgetc  (f:gzfile) : int;
-function gzgets  (f:gzfile; buf:PChar; len:int) : PChar;
+function gzopen  (path:string; mode:string) : gzFile;
+function gzread  (f:gzFile; buf:pointer; len:cardinal) : integer;
+function gzgetc  (f:gzfile) : integer;
+function gzgets  (f:gzfile; buf:Pchar; len:integer) : Pchar;
 
 
 {$ifndef NO_DEFLATE}
 {$ifndef NO_DEFLATE}
-function gzwrite (f:gzFile; buf:voidp; len:uInt) : int;
-function gzputc  (f:gzfile; c:char) : int;
-function gzputs  (f:gzfile; s:PChar) : int;
-function gzflush (f:gzFile; flush:int)           : int;
+function gzwrite (f:gzFile; buf:pointer; len:cardinal) : integer;
+function gzputc  (f:gzfile; c:char) : integer;
+function gzputs  (f:gzfile; s:Pchar) : integer;
+function gzflush (f:gzFile; flush:integer)           : integer;
   {$ifdef GZ_FORMAT_STRING}
   {$ifdef GZ_FORMAT_STRING}
   function gzprintf (zfile : gzFile;
   function gzprintf (zfile : gzFile;
                      const format : string;
                      const format : string;
-                     a : array of int);    { doesn't compile }
+                     a : array of integer);    { doesn't compile }
   {$endif}
   {$endif}
 {$endif}
 {$endif}
 
 
-function gzseek   (f:gzfile; offset:z_off_t; whence:int) : z_off_t;
-function gzrewind (f:gzFile) : int;
-function gztell   (f:gzfile) : z_off_t;
-function gzeof    (f:gzfile) : boolean;
-function gzclose  (f:gzFile)                      : int;
-function gzerror  (f:gzFile; var errnum:Int)      : string;
+function gzseek  (f:gzfile; offset:z_off_t; whence:integer) : z_off_t;
+function gztell  (f:gzfile) : z_off_t;
+function gzclose (f:gzFile)                      : integer;
+function gzerror (f:gzFile; var errnum:integer)      : string;
+function gzsetparams (f:gzfile; level:integer; strategy:integer) : integer;
+function gzrewind (f:gzFile) : integer;
+function gzeof (f:gzfile) : boolean;
 
 
 const
 const
   SEEK_SET {: z_off_t} = 0; { seek from beginning of file }
   SEEK_SET {: z_off_t} = 0; { seek from beginning of file }
@@ -77,22 +77,22 @@ const
 
 
 type gz_stream = record
 type gz_stream = record
   stream      : z_stream;
   stream      : z_stream;
-  z_err       : int;      { error code for last stream operation }
+  z_err       : integer;      { error code for last stream operation }
   z_eof       : boolean;  { set if end of input file }
   z_eof       : boolean;  { set if end of input file }
   gzfile      : file;     { .gz file }
   gzfile      : file;     { .gz file }
-  inbuf       : pBytef;   { input buffer }
-  outbuf      : pBytef;   { output buffer }
-  crc         : uLong;    { crc32 of uncompressed data }
+  inbuf       : Pbyte;   { input buffer }
+  outbuf      : Pbyte;   { output buffer }
+  crc         : cardinal;    { crc32 of uncompressed data }
   msg,                    { error message - limit 79 chars }
   msg,                    { error message - limit 79 chars }
-  path        : ansistring;   { path name for debugging only - limit 79 chars }
+  path        : string[79];   { path name for debugging only - limit 79 chars }
   transparent : boolean;  { true if input file is not a .gz file }
   transparent : boolean;  { true if input file is not a .gz file }
   mode        : char;     { 'w' or 'r' }
   mode        : char;     { 'w' or 'r' }
-  startpos    : long;     { start of compressed data in file (header skipped) }
+  startpos    : longint;     { start of compressed data in file (header skipped) }
 end;
 end;
 
 
 type gz_streamp = ^gz_stream;
 type gz_streamp = ^gz_stream;
 
 
-function destroy (var s:gz_streamp) : int; forward;
+function destroy (var s:gz_streamp) : integer; forward;
 procedure check_header(s:gz_streamp); forward;
 procedure check_header(s:gz_streamp); forward;
 
 
 
 
@@ -109,24 +109,26 @@ procedure check_header(s:gz_streamp); forward;
   gzopen can be used to open a file which is not in gzip format; in this
   gzopen can be used to open a file which is not in gzip format; in this
   case, gzread will directly read from the file without decompression.
   case, gzread will directly read from the file without decompression.
 
 
-  gzopen returns NIL if the file could not be opened (non-zero IOResult)
+  gzopen returns nil if the file could not be opened (non-zero IOResult)
   or if there was insufficient memory to allocate the (de)compression state
   or if there was insufficient memory to allocate the (de)compression state
   (zlib error is Z_MEM_ERROR).
   (zlib error is Z_MEM_ERROR).
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzopen (path:ansistring; mode:string) : gzFile;
+function gzopen (path:string; mode:string) : gzFile;
 
 
 var
 var
 
 
-  i        : uInt;
-  err      : int;
-  level    : int;        { compression level }
-  strategy : int;        { compression strategy }
+  i        : cardinal;
+  err      : integer;
+  level    : integer;        { compression level }
+  strategy : integer;        { compression strategy }
   s        : gz_streamp;
   s        : gz_streamp;
-{$IFDEF MSDOS}
-  attr     : word;       { file attributes }
-{$ENDIF}
+{$ifdef UNIX}
+  info:      stat;
+{$else}
+  attr:      word;
+{$endif}
 
 
 {$IFNDEF NO_DEFLATE}
 {$IFNDEF NO_DEFLATE}
   gzheader : array [0..9] of byte;
   gzheader : array [0..9] of byte;
@@ -135,31 +137,28 @@ var
 begin
 begin
 
 
   if (path='') or (mode='') then begin
   if (path='') or (mode='') then begin
-    gzopen := Z_NULL;
+    gzopen := nil;
     exit;
     exit;
   end;
   end;
 
 
   GetMem (s,sizeof(gz_stream));
   GetMem (s,sizeof(gz_stream));
   if not Assigned (s) then begin
   if not Assigned (s) then begin
-    gzopen := Z_NULL;
+    gzopen := nil;
     exit;
     exit;
   end;
   end;
 
 
   level := Z_DEFAULT_COMPRESSION;
   level := Z_DEFAULT_COMPRESSION;
   strategy := Z_DEFAULT_STRATEGY;
   strategy := Z_DEFAULT_STRATEGY;
 
 
-  s^.stream.zalloc := NIL;     { (alloc_func)0 }
-  s^.stream.zfree := NIL;      { (free_func)0 }
-  s^.stream.opaque := NIL;     { (voidpf)0 }
-  s^.stream.next_in := Z_NULL;
-  s^.stream.next_out := Z_NULL;
+  s^.stream.next_in := nil;
+  s^.stream.next_out := nil;
   s^.stream.avail_in := 0;
   s^.stream.avail_in := 0;
   s^.stream.avail_out := 0;
   s^.stream.avail_out := 0;
   s^.z_err := Z_OK;
   s^.z_err := Z_OK;
   s^.z_eof := false;
   s^.z_eof := false;
-  s^.inbuf := Z_NULL;
-  s^.outbuf := Z_NULL;
-  s^.crc := crc32(0, Z_NULL, 0);
+  s^.inbuf := nil;
+  s^.outbuf := nil;
+  s^.crc := crc32(0, nil, 0);
   s^.msg := '';
   s^.msg := '';
   s^.transparent := false;
   s^.transparent := false;
 
 
@@ -177,7 +176,7 @@ begin
   end;
   end;
   if (s^.mode=chr(0)) then begin
   if (s^.mode=chr(0)) then begin
     destroy(s);
     destroy(s);
-    gzopen := gzFile(Z_NULL);
+    gzopen := gzFile(nil);
     exit;
     exit;
   end;
   end;
 
 
@@ -192,9 +191,9 @@ begin
     GetMem (s^.outbuf, Z_BUFSIZE);
     GetMem (s^.outbuf, Z_BUFSIZE);
     s^.stream.next_out := s^.outbuf;
     s^.stream.next_out := s^.outbuf;
 {$ENDIF}
 {$ENDIF}
-    if (err <> Z_OK) or (s^.outbuf = Z_NULL) then begin
+    if (err <> Z_OK) or (s^.outbuf = nil) then begin
       destroy(s);
       destroy(s);
-      gzopen := gzFile(Z_NULL);
+      gzopen := gzFile(nil);
       exit;
       exit;
     end;
     end;
   end
   end
@@ -206,9 +205,9 @@ begin
     err := inflateInit2_ (s^.stream, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream));
     err := inflateInit2_ (s^.stream, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream));
         { windowBits is passed < 0 to tell that there is no zlib header }
         { windowBits is passed < 0 to tell that there is no zlib header }
 
 
-    if (err <> Z_OK) or (s^.inbuf = Z_NULL) then begin
+    if (err <> Z_OK) or (s^.inbuf = nil) then begin
       destroy(s);
       destroy(s);
-      gzopen := gzFile(Z_NULL);
+      gzopen := gzFile(nil);
       exit;
       exit;
     end;
     end;
   end;
   end;
@@ -217,14 +216,14 @@ begin
 
 
   {$IFOPT I+} {$I-} {$define IOcheck} {$ENDIF}
   {$IFOPT I+} {$I-} {$define IOcheck} {$ENDIF}
   Assign (s^.gzfile, s^.path);
   Assign (s^.gzfile, s^.path);
-  {$ifdef MSDOS}
-  GetFAttr(s^.gzfile, Attr);
-  if (DosError <> 0) and (s^.mode='w') then
-    ReWrite (s^.gzfile,1)
+  {$ifdef unix}
+  if (fpstat(s^.path,info)<0) and (s^.mode='w') then
+    ReWrite (s^.gzfile,1)  
   else
   else
     Reset (s^.gzfile,1);
     Reset (s^.gzfile,1);
   {$else}
   {$else}
-  if (not FileExists(s^.path)) and (s^.mode='w') then
+  GetFAttr(s^.gzfile, Attr);
+  if (DosError <> 0) and (s^.mode='w') then
     ReWrite (s^.gzfile,1)
     ReWrite (s^.gzfile,1)
   else
   else
     Reset (s^.gzfile,1);
     Reset (s^.gzfile,1);
@@ -232,7 +231,7 @@ begin
   {$IFDEF IOCheck} {$I+} {$ENDIF}
   {$IFDEF IOCheck} {$I+} {$ENDIF}
   if (IOResult <> 0) then begin
   if (IOResult <> 0) then begin
     destroy(s);
     destroy(s);
-    gzopen := gzFile(Z_NULL);
+    gzopen := gzFile(nil);
     exit;
     exit;
   end;
   end;
 
 
@@ -249,7 +248,7 @@ begin
     gzheader [8] := 0;            { xflags }
     gzheader [8] := 0;            { xflags }
     gzheader [9] := 0;            { OS code = MS-DOS }
     gzheader [9] := 0;            { OS code = MS-DOS }
     blockwrite (s^.gzfile, gzheader, 10);
     blockwrite (s^.gzfile, gzheader, 10);
-    s^.startpos := LONG(10);
+    s^.startpos := longint(10);
 {$ENDIF}
 {$ENDIF}
   end
   end
   else begin
   else begin
@@ -267,7 +266,7 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzsetparams (f:gzfile; level:int; strategy:int) : int;
+function gzsetparams (f:gzfile; level:integer; strategy:integer) : integer;
 
 
 var
 var
 
 
@@ -278,7 +277,7 @@ begin
 
 
   s := gz_streamp(f);
   s := gz_streamp(f);
 
 
-  if (s = NIL) or (s^.mode <> 'w') then begin
+  if (s = nil) or (s^.mode <> 'w') then begin
     gzsetparams := Z_STREAM_ERROR;
     gzsetparams := Z_STREAM_ERROR;
     exit;
     exit;
   end;
   end;
@@ -303,7 +302,7 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function get_byte (s:gz_streamp) : int;
+function get_byte (s:gz_streamp) : integer;
 
 
 begin
 begin
 
 
@@ -314,7 +313,7 @@ begin
 
 
   if (s^.stream.avail_in = 0) then begin
   if (s^.stream.avail_in = 0) then begin
     {$I-}
     {$I-}
-    blockread (s^.gzfile, s^.inbuf^, Z_BUFSIZE, Int(s^.stream.avail_in));
+    blockread (s^.gzfile, s^.inbuf^, Z_BUFSIZE, s^.stream.avail_in);
     {$I+}
     {$I+}
     if (s^.stream.avail_in = 0) then begin
     if (s^.stream.avail_in = 0) then begin
       s^.z_eof := true;
       s^.z_eof := true;
@@ -338,11 +337,11 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 {
 {
-function getLong (s:gz_streamp) : uLong;
+function getLong (s:gz_streamp) : cardinal;
 var
 var
   x  : array [0..3] of byte;
   x  : array [0..3] of byte;
   i  : byte;
   i  : byte;
-  c  : int;
+  c  : integer;
   n1 : longint;
   n1 : longint;
   n2 : longint;
   n2 : longint;
 begin
 begin
@@ -357,12 +356,12 @@ begin
   getlong := (n1 shl 16) or n2;
   getlong := (n1 shl 16) or n2;
 end;
 end;
 }
 }
-function getLong(s : gz_streamp) : uLong;
+function getLong(s : gz_streamp) : cardinal;
 var
 var
   x : packed array [0..3] of byte;
   x : packed array [0..3] of byte;
-  c : int;
+  c : integer;
 begin
 begin
-  { x := uLong(get_byte(s));  - you can't do this with TP, no unsigned long }
+  { x := cardinal(get_byte(s));  - you can't do this with TP, no unsigned longint }
   { the following assumes a little endian machine and TP }
   { the following assumes a little endian machine and TP }
   x[0] := Byte(get_byte(s));
   x[0] := Byte(get_byte(s));
   x[1] := Byte(get_byte(s));
   x[1] := Byte(get_byte(s));
@@ -371,7 +370,7 @@ begin
   x[3] := Byte(c);
   x[3] := Byte(c);
   if (c = Z_EOF) then
   if (c = Z_EOF) then
     s^.z_err := Z_DATA_ERROR;
     s^.z_err := Z_DATA_ERROR;
-  GetLong := uLong(longint(x));
+  GetLong := cardinal(longint(x));
 end;
 end;
 
 
 
 
@@ -392,10 +391,10 @@ procedure check_header (s:gz_streamp);
 
 
 var
 var
 
 
-  method : int;  { method byte }
-  flags  : int;  { flags byte }
-  len    : uInt;
-  c      : int;
+  method : integer;  { method byte }
+  flags  : integer;  { flags byte }
+  len    : cardinal;
+  c      : integer;
 
 
 begin
 begin
 
 
@@ -410,7 +409,7 @@ begin
       if (c <> Z_EOF) then begin
       if (c <> Z_EOF) then begin
         Inc(s^.stream.avail_in);
         Inc(s^.stream.avail_in);
         Dec(s^.stream.next_in);
         Dec(s^.stream.next_in);
-        s^.transparent := TRUE;
+	s^.transparent := TRUE;
       end;
       end;
       if (s^.stream.avail_in <> 0) then s^.z_err := Z_OK
       if (s^.stream.avail_in <> 0) then s^.z_err := Z_OK
       else s^.z_err := Z_STREAM_END;
       else s^.z_err := Z_STREAM_END;
@@ -428,8 +427,8 @@ begin
   for len := 0 to 5 do get_byte(s); { Discard time, xflags and OS code }
   for len := 0 to 5 do get_byte(s); { Discard time, xflags and OS code }
 
 
   if ((flags and EXTRA_FIELD) <> 0) then begin { skip the extra field }
   if ((flags and EXTRA_FIELD) <> 0) then begin { skip the extra field }
-    len := uInt(get_byte(s));
-    len := len + (uInt(get_byte(s)) shr 8);
+    len := cardinal(get_byte(s));
+    len := len + (cardinal(get_byte(s)) shr 8);
     { len is garbage if EOF but the loop below will quit anyway }
     { len is garbage if EOF but the loop below will quit anyway }
     while (len <> 0) and (get_byte(s) <> Z_EOF) do Dec(len);
     while (len <> 0) and (get_byte(s) <> Z_EOF) do Dec(len);
   end;
   end;
@@ -466,7 +465,7 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function destroy (var s:gz_streamp) : int;
+function destroy (var s:gz_streamp) : integer;
 
 
 begin
 begin
 
 
@@ -477,7 +476,7 @@ begin
     exit;
     exit;
   end;
   end;
 
 
-  if (s^.stream.state <> NIL) then begin
+  if (s^.stream.state <> nil) then begin
     if (s^.mode = 'w') then begin
     if (s^.mode = 'w') then begin
 {$IFDEF NO_DEFLATE}
 {$IFDEF NO_DEFLATE}
       destroy := Z_STREAM_ERROR;
       destroy := Z_STREAM_ERROR;
@@ -519,27 +518,27 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzread (f:gzFile; buf:voidp; len:uInt) : int;
+function gzread (f:gzFile; buf:pointer; len:cardinal) : integer;
 
 
 var
 var
 
 
   s         : gz_streamp;
   s         : gz_streamp;
-  start     : pBytef;
-  next_out  : pBytef;
-  n         : uInt;
-  crclen    : uInt;  { Buffer length to update CRC32 }
-  filecrc   : uLong; { CRC32 stored in GZIP'ed file }
-  filelen   : uLong; { Total lenght of uncompressed file }
+  start     : Pbyte;
+  next_out  : Pbyte;
+  n         : cardinal;
+  crclen    : cardinal;  { Buffer length to update CRC32 }
+  filecrc   : cardinal; { CRC32 stored in GZIP'ed file }
+  filelen   : cardinal; { Total lenght of uncompressed file }
   bytes     : integer;  { bytes actually read in I/O blockread }
   bytes     : integer;  { bytes actually read in I/O blockread }
-  total_in  : uLong;
-  total_out : uLong;
+  total_in  : cardinal;
+  total_out : cardinal;
 
 
 begin
 begin
 
 
   s := gz_streamp(f);
   s := gz_streamp(f);
-  start := pBytef(buf); { starting point for crc computation }
+  start := Pbyte(buf); { starting point for crc computation }
 
 
-  if (s = NIL) or (s^.mode <> 'r') then begin
+  if (s = nil) or (s^.mode <> 'r') then begin
     gzread := Z_STREAM_ERROR;
     gzread := Z_STREAM_ERROR;
     exit;
     exit;
   end;
   end;
@@ -554,7 +553,7 @@ begin
     exit;
     exit;
   end;
   end;
 
 
-  s^.stream.next_out := pBytef(buf);
+  s^.stream.next_out := Pbyte(buf);
   s^.stream.avail_out := len;
   s^.stream.avail_out := len;
 
 
   while (s^.stream.avail_out <> 0) do begin
   while (s^.stream.avail_out <> 0) do begin
@@ -564,7 +563,7 @@ begin
       n := s^.stream.avail_in;
       n := s^.stream.avail_in;
       if (n > s^.stream.avail_out) then n := s^.stream.avail_out;
       if (n > s^.stream.avail_out) then n := s^.stream.avail_out;
       if (n > 0) then begin
       if (n > 0) then begin
-        zmemcpy(s^.stream.next_out, s^.stream.next_in, n);
+        move(s^.stream.next_in^,s^.stream.next_out^,n);
         inc (s^.stream.next_out, n);
         inc (s^.stream.next_out, n);
         inc (s^.stream.next_in, n);
         inc (s^.stream.next_in, n);
         dec (s^.stream.avail_out, n);
         dec (s^.stream.avail_out, n);
@@ -572,24 +571,24 @@ begin
       end;
       end;
       if (s^.stream.avail_out > 0) then begin
       if (s^.stream.avail_out > 0) then begin
         blockread (s^.gzfile, s^.stream.next_out^, s^.stream.avail_out, bytes);
         blockread (s^.gzfile, s^.stream.next_out^, s^.stream.avail_out, bytes);
-        dec (s^.stream.avail_out, uInt(bytes));
+        dec (s^.stream.avail_out, cardinal(bytes));
       end;
       end;
       dec (len, s^.stream.avail_out);
       dec (len, s^.stream.avail_out);
-      inc (s^.stream.total_in, uLong(len));
-      inc (s^.stream.total_out, uLong(len));
-      gzread := int(len);
+      inc (s^.stream.total_in, cardinal(len));
+      inc (s^.stream.total_out, cardinal(len));
+      gzread := integer(len);
       exit;
       exit;
     end; { IF transparent }
     end; { IF transparent }
 
 
     if (s^.stream.avail_in = 0) and (s^.z_eof = false) then begin
     if (s^.stream.avail_in = 0) and (s^.z_eof = false) then begin
       {$I-}
       {$I-}
-      blockread (s^.gzfile, s^.inbuf^, Z_BUFSIZE, Int(s^.stream.avail_in));
+      blockread (s^.gzfile, s^.inbuf^, Z_BUFSIZE, s^.stream.avail_in);
       {$I+}
       {$I+}
       if (s^.stream.avail_in = 0) then begin
       if (s^.stream.avail_in = 0) then begin
         s^.z_eof := true;
         s^.z_eof := true;
-        if (IOResult <> 0) then begin
-          s^.z_err := Z_ERRNO;
-          break;
+	if (IOResult <> 0) then begin
+	  s^.z_err := Z_ERRNO;
+	  break;
         end;
         end;
       end;
       end;
       s^.stream.next_in := s^.inbuf;
       s^.stream.next_in := s^.inbuf;
@@ -613,18 +612,18 @@ begin
 
 
       if (s^.crc <> filecrc) or (s^.stream.total_out <> filelen)
       if (s^.crc <> filecrc) or (s^.stream.total_out <> filelen)
         then s^.z_err := Z_DATA_ERROR
         then s^.z_err := Z_DATA_ERROR
-        else begin
-          { Check for concatenated .gz files: }
-          check_header(s);
-          if (s^.z_err = Z_OK) then begin
+	else begin
+	  { Check for concatenated .gz files: }
+	  check_header(s);
+	  if (s^.z_err = Z_OK) then begin
             total_in := s^.stream.total_in;
             total_in := s^.stream.total_in;
             total_out := s^.stream.total_out;
             total_out := s^.stream.total_out;
 
 
-            inflateReset (s^.stream);
-            s^.stream.total_in := total_in;
-            s^.stream.total_out := total_out;
-            s^.crc := crc32 (0, Z_NULL, 0);
-          end;
+	    inflateReset (s^.stream);
+	    s^.stream.total_in := total_in;
+	    s^.stream.total_out := total_out;
+	    s^.crc := crc32 (0, nil, 0);
+	  end;
       end; {IF-THEN-ELSE}
       end; {IF-THEN-ELSE}
     end;
     end;
 
 
@@ -640,7 +639,7 @@ begin
   end;
   end;
   s^.crc := crc32 (s^.crc, start, crclen);
   s^.crc := crc32 (s^.crc, start, crclen);
 
 
-  gzread := int(len - s^.stream.avail_out);
+  gzread := integer(len - s^.stream.avail_out);
 
 
 end;
 end;
 
 
@@ -652,7 +651,7 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzgetc (f:gzfile) : int;
+function gzgetc (f:gzfile) : integer;
 
 
 var c:byte;
 var c:byte;
 
 
@@ -669,23 +668,23 @@ end;
   or a newline character is read and transferred to buf, or an end-of-file
   or a newline character is read and transferred to buf, or an end-of-file
   condition is encountered. The string is then Null-terminated.
   condition is encountered. The string is then Null-terminated.
 
 
-  gzgets returns buf, or Z_NULL in case of error.
+  gzgets returns buf, or nil in case of error.
   The current implementation is not optimized at all.
   The current implementation is not optimized at all.
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzgets (f:gzfile; buf:PChar; len:int) : PChar;
+function gzgets (f:gzfile; buf:Pchar; len:integer) : Pchar;
 
 
 var
 var
 
 
-  b      : PChar; { start of buffer }
-  bytes  : Int;   { number of bytes read by gzread }
+  b      : Pchar; { start of buffer }
+  bytes  : integer;   { number of bytes read by gzread }
   gzchar : char;  { char read by gzread }
   gzchar : char;  { char read by gzread }
 
 
 begin
 begin
 
 
-    if (buf = Z_NULL) or (len <= 0) then begin
-      gzgets := Z_NULL;
+    if (buf = nil) or (len <= 0) then begin
+      gzgets := nil;
       exit;
       exit;
     end;
     end;
 
 
@@ -698,7 +697,7 @@ begin
     until (len = 0) or (bytes <> 1) or (gzchar = Chr(13));
     until (len = 0) or (bytes <> 1) or (gzchar = Chr(13));
 
 
     buf^ := Chr(0);
     buf^ := Chr(0);
-    if (b = buf) and (len > 0) then gzgets := Z_NULL else gzgets := b;
+    if (b = buf) and (len > 0) then gzgets := nil else gzgets := b;
 
 
 end;
 end;
 
 
@@ -713,7 +712,7 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzwrite (f:gzfile; buf:voidp; len:uInt) : int;
+function gzwrite (f:gzfile; buf:pointer; len:cardinal) : integer;
 
 
 var
 var
 
 
@@ -724,12 +723,12 @@ begin
 
 
     s := gz_streamp(f);
     s := gz_streamp(f);
 
 
-    if (s = NIL) or (s^.mode <> 'w') then begin
+    if (s = nil) or (s^.mode <> 'w') then begin
       gzwrite := Z_STREAM_ERROR;
       gzwrite := Z_STREAM_ERROR;
       exit;
       exit;
     end;
     end;
 
 
-    s^.stream.next_in := pBytef(buf);
+    s^.stream.next_in := Pbyte(buf);
     s^.stream.avail_in := len;
     s^.stream.avail_in := len;
 
 
     while (s^.stream.avail_in <> 0) do begin
     while (s^.stream.avail_in <> 0) do begin
@@ -750,7 +749,7 @@ begin
     end; {WHILE}
     end; {WHILE}
 
 
     s^.crc := crc32(s^.crc, buf, len);
     s^.crc := crc32(s^.crc, buf, len);
-    gzwrite := int(len - s^.stream.avail_in);
+    gzwrite := integer(len - s^.stream.avail_in);
 
 
 end;
 end;
 
 
@@ -764,17 +763,17 @@ end;
 {$IFDEF GZ_FORMAT_STRING}
 {$IFDEF GZ_FORMAT_STRING}
 function gzprintf (zfile : gzFile;
 function gzprintf (zfile : gzFile;
                    const format : string;
                    const format : string;
-                   a : array of int) : int;
+                   a : array of integer) : integer;
 var
 var
   buf : array[0..Z_PRINTF_BUFSIZE-1] of char;
   buf : array[0..Z_PRINTF_BUFSIZE-1] of char;
-  len : int;
+  len : integer;
 begin
 begin
 {$ifdef HAS_snprintf}
 {$ifdef HAS_snprintf}
     snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
     snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
-             a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+	     a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 {$else}
 {$else}
     sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
     sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
-            a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
+	    a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
 {$endif}
 {$endif}
     len := strlen(buf); { old sprintf doesn't return the nb of bytes written }
     len := strlen(buf); { old sprintf doesn't return the nb of bytes written }
     if (len <= 0) return 0;
     if (len <= 0) return 0;
@@ -791,13 +790,13 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzputc (f:gzfile; c:char) : int;
+function gzputc (f:gzfile; c:char) : integer;
 begin
 begin
   if (gzwrite (f,@c,1) = 1) then
   if (gzwrite (f,@c,1) = 1) then
   {$IFDEF FPC}
   {$IFDEF FPC}
-    gzputc := int(ord(c))
+    gzputc := integer(ord(c))
   {$ELSE}
   {$ELSE}
-    gzputc := int(c)
+    gzputc := integer(c)
   {$ENDIF}
   {$ENDIF}
   else
   else
     gzputc := -1;
     gzputc := -1;
@@ -812,9 +811,9 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzputs (f:gzfile; s:PChar) : int;
+function gzputs (f:gzfile; s:Pchar) : integer;
 begin
 begin
-  gzputs := gzwrite (f, voidp(s), strlen(s));
+  gzputs := gzwrite (f, pointer(s), strlen(s));
 end;
 end;
 
 
 
 
@@ -825,9 +824,9 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function do_flush (f:gzfile; flush:int) : int;
+function do_flush (f:gzfile; flush:integer) : integer;
 var
 var
-  len     : uInt;
+  len     : cardinal;
   done    : boolean;
   done    : boolean;
   s       : gz_streamp;
   s       : gz_streamp;
   written : integer;
   written : integer;
@@ -835,7 +834,7 @@ begin
   done := false;
   done := false;
   s := gz_streamp(f);
   s := gz_streamp(f);
 
 
-  if (s = NIL) or (s^.mode <> 'w') then begin
+  if (s = nil) or (s^.mode <> 'w') then begin
     do_flush := Z_STREAM_ERROR;
     do_flush := Z_STREAM_ERROR;
     exit;
     exit;
   end;
   end;
@@ -890,9 +889,9 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzflush (f:gzfile; flush:int) : int;
+function gzflush (f:gzfile; flush:integer) : integer;
 var
 var
-  err : int;
+  err : integer;
   s   : gz_streamp;
   s   : gz_streamp;
 begin
 begin
   s := gz_streamp(f);
   s := gz_streamp(f);
@@ -915,13 +914,13 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzrewind (f:gzFile) : int;
+function gzrewind (f:gzFile) : integer;
 var
 var
   s:gz_streamp;
   s:gz_streamp;
 begin
 begin
   s := gz_streamp(f);
   s := gz_streamp(f);
 
 
-  if (s = NIL) or (s^.mode <> 'r') then begin
+  if (s = nil) or (s^.mode <> 'r') then begin
     gzrewind := -1;
     gzrewind := -1;
     exit;
     exit;
   end;
   end;
@@ -943,7 +942,7 @@ begin
   {$I-}
   {$I-}
   seek (s^.gzfile, s^.startpos);
   seek (s^.gzfile, s^.startpos);
   {$I+}
   {$I+}
-  gzrewind := int(IOResult);
+  gzrewind := integer(IOResult);
   exit;
   exit;
 end;
 end;
 
 
@@ -960,14 +959,14 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzseek (f:gzfile; offset:z_off_t; whence:int) : z_off_t;
+function gzseek (f:gzfile; offset:z_off_t; whence:integer) : z_off_t;
 var
 var
   s : gz_streamp;
   s : gz_streamp;
-  size : uInt;
+  size : cardinal;
 begin
 begin
   s := gz_streamp(f);
   s := gz_streamp(f);
 
 
-  if (s = NIL) or (whence = SEEK_END) or (s^.z_err = Z_ERRNO)
+  if (s = nil) or (whence = SEEK_END) or (s^.z_err = Z_ERRNO)
   or (s^.z_err = Z_DATA_ERROR) then begin
   or (s^.z_err = Z_DATA_ERROR) then begin
     gzseek := z_off_t(-1);
     gzseek := z_off_t(-1);
     exit;
     exit;
@@ -985,14 +984,14 @@ begin
     end;
     end;
 
 
     { At this point, offset is the number of zero bytes to write. }
     { At this point, offset is the number of zero bytes to write. }
-    if (s^.inbuf = Z_NULL) then begin
-      GetMem (s^.inbuf, Z_BUFSIZE);
-      zmemzero(s^.inbuf, Z_BUFSIZE);
+    if s^.inbuf=nil then begin
+      getmem(s^.inbuf,Z_BUFSIZE);
+      fillchar(s^.inbuf^,Z_BUFSIZE,0);
     end;
     end;
 
 
     while (offset > 0) do begin
     while (offset > 0) do begin
       size := Z_BUFSIZE;
       size := Z_BUFSIZE;
-      if (offset < Z_BUFSIZE) then size := uInt(offset);
+      if (offset < Z_BUFSIZE) then size := cardinal(offset);
 
 
       size := gzwrite(f, s^.inbuf, size);
       size := gzwrite(f, s^.inbuf, size);
       if (size = 0) then begin
       if (size = 0) then begin
@@ -1027,14 +1026,14 @@ begin
       exit;
       exit;
     end;
     end;
 
 
-    s^.stream.total_in := uLong(offset);
-    s^.stream.total_out := uLong(offset);
+    s^.stream.total_in := cardinal(offset);
+    s^.stream.total_out := cardinal(offset);
     gzseek := z_off_t(offset);
     gzseek := z_off_t(offset);
     exit;
     exit;
   end;
   end;
 
 
   { For a negative seek, rewind and use positive seek }
   { For a negative seek, rewind and use positive seek }
-  if (uLong(offset) >= s^.stream.total_out)
+  if (cardinal(offset) >= s^.stream.total_out)
     then dec (offset, s^.stream.total_out)
     then dec (offset, s^.stream.total_out)
     else if (gzrewind(f) <> 0) then begin
     else if (gzrewind(f) <> 0) then begin
       gzseek := z_off_t(-1);
       gzseek := z_off_t(-1);
@@ -1042,12 +1041,12 @@ begin
   end;
   end;
   { offset is now the number of bytes to skip. }
   { offset is now the number of bytes to skip. }
 
 
-  if (offset <> 0) and (s^.outbuf = Z_NULL)
+  if (offset <> 0) and (s^.outbuf = nil)
   then GetMem (s^.outbuf, Z_BUFSIZE);
   then GetMem (s^.outbuf, Z_BUFSIZE);
 
 
   while (offset > 0) do begin
   while (offset > 0) do begin
     size := Z_BUFSIZE;
     size := Z_BUFSIZE;
-    if (offset < Z_BUFSIZE) then size := int(offset);
+    if (offset < Z_BUFSIZE) then size := integer(offset);
 
 
     size := gzread (f, s^.outbuf, size);
     size := gzread (f, s^.outbuf, size);
     if (size <= 0) then begin
     if (size <= 0) then begin
@@ -1088,7 +1087,7 @@ var
 begin
 begin
   s := gz_streamp(f);
   s := gz_streamp(f);
 
 
-  if (s=NIL) or (s^.mode<>'r') then
+  if (s=nil) or (s^.mode<>'r') then
     gzeof := false
     gzeof := false
   else
   else
     gzeof := s^.z_eof;
     gzeof := s^.z_eof;
@@ -1101,9 +1100,9 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-procedure putLong (var f:file; x:uLong);
+procedure putLong (var f:file; x:cardinal);
 var
 var
-  n : int;
+  n : integer;
   c : byte;
   c : byte;
 begin
 begin
   for n:=0 to 3 do begin
   for n:=0 to 3 do begin
@@ -1123,13 +1122,13 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzclose (f:gzFile) : int;
+function gzclose (f:gzFile) : integer;
 var
 var
-  err : int;
+  err : integer;
   s   : gz_streamp;
   s   : gz_streamp;
 begin
 begin
   s := gz_streamp(f);
   s := gz_streamp(f);
-  if (s = NIL) then begin
+  if (s = nil) then begin
     gzclose := Z_STREAM_ERROR;
     gzclose := Z_STREAM_ERROR;
     exit;
     exit;
   end;
   end;
@@ -1164,13 +1163,13 @@ end;
 
 
 ============================================================================}
 ============================================================================}
 
 
-function gzerror (f:gzfile; var errnum:int) : string;
+function gzerror (f:gzfile; var errnum:integer) : string;
 var
 var
  m : string;
  m : string;
  s : gz_streamp;
  s : gz_streamp;
 begin
 begin
   s := gz_streamp(f);
   s := gz_streamp(f);
-  if (s = NIL) then begin
+  if (s = nil) then begin
     errnum := Z_STREAM_ERROR;
     errnum := Z_STREAM_ERROR;
     gzerror := zError(Z_STREAM_ERROR);
     gzerror := zError(Z_STREAM_ERROR);
     end;
     end;
@@ -1189,4 +1188,4 @@ begin
   gzerror := s^.msg;
   gzerror := s^.msg;
 end;
 end;
 
 
-end.
+end.

+ 147 - 151
packages/base/paszlib/infblock.pas

@@ -1,4 +1,6 @@
-Unit InfBlock;
+unit infblock;
+
+{$goto on}
 
 
 { infblock.h and
 { infblock.h and
   infblock.c -- interpret and process block types to last block
   infblock.c -- interpret and process block types to last block
@@ -10,41 +12,35 @@ Unit InfBlock;
 }
 }
 
 
 interface
 interface
-{$ifdef fpc}
-{$goto on}
-{$endif}
 
 
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  {$IFDEF STRUTILS_DEBUG}
-  strutils,
-  {$ENDIF}
-  zutil, zbase;
+  zbase;
 
 
 function inflate_blocks_new(var z : z_stream;
 function inflate_blocks_new(var z : z_stream;
                             c : check_func;  { check function }
                             c : check_func;  { check function }
-                            w : uInt     { window size }
+                            w : cardinal     { window size }
                             ) : pInflate_blocks_state;
                             ) : pInflate_blocks_state;
 
 
 function inflate_blocks (var s : inflate_blocks_state;
 function inflate_blocks (var s : inflate_blocks_state;
                          var z : z_stream;
                          var z : z_stream;
-                         r : int             { initial return code }
-                         ) : int;
+                         r : integer             { initial return code }
+                         ) : integer;
 
 
 procedure inflate_blocks_reset (var s : inflate_blocks_state;
 procedure inflate_blocks_reset (var s : inflate_blocks_state;
                                 var z : z_stream;
                                 var z : z_stream;
-                                c : puLong); { check value on output }
+                                c : Pcardinal); { check value on output }
 
 
 
 
 function inflate_blocks_free(s : pInflate_blocks_state;
 function inflate_blocks_free(s : pInflate_blocks_state;
-                             var z : z_stream) : int;
+                             var z : z_stream) : integer;
 
 
 procedure inflate_set_dictionary(var s : inflate_blocks_state;
 procedure inflate_set_dictionary(var s : inflate_blocks_state;
                                  const d : array of byte;  { dictionary }
                                  const d : array of byte;  { dictionary }
-                                 n : uInt);         { dictionary length }
+                                 n : cardinal);         { dictionary length }
 
 
-function inflate_blocks_sync_point(var s : inflate_blocks_state) : int;
+function inflate_blocks_sync_point(var s : inflate_blocks_state) : integer;
 
 
 implementation
 implementation
 
 
@@ -53,7 +49,7 @@ uses
 
 
 { Tables for deflate from PKZIP's appnote.txt. }
 { Tables for deflate from PKZIP's appnote.txt. }
 Const
 Const
-  border : Array [0..18] Of Word  { Order of the bit length code lengths }
+  border : array [0..18] of word  { Order of the bit length code lengths }
     = (16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15);
     = (16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15);
 
 
 { Notes beyond the 1.93a appnote.txt:
 { Notes beyond the 1.93a appnote.txt:
@@ -102,9 +98,9 @@ Const
 
 
 procedure inflate_blocks_reset (var s : inflate_blocks_state;
 procedure inflate_blocks_reset (var s : inflate_blocks_state;
                                 var z : z_stream;
                                 var z : z_stream;
-                                c : puLong); { check value on output }
+                                c : Pcardinal); { check value on output }
 begin
 begin
-  if (c <> Z_NULL) then
+  if (c <> nil) then
     c^ := s.check;
     c^ := s.check;
   if (s.mode = BTREE) or (s.mode = DTREE) then
   if (s.mode = BTREE) or (s.mode = DTREE) then
     ZFREE(z, s.sub.trees.blens);
     ZFREE(z, s.sub.trees.blens);
@@ -119,10 +115,10 @@ begin
   s.read := s.window;
   s.read := s.window;
   if Assigned(s.checkfn) then
   if Assigned(s.checkfn) then
   begin
   begin
-    s.check := s.checkfn(uLong(0), pBytef(NIL), 0);
+    s.check := s.checkfn(cardinal(0), Pbyte(NIL), 0);
     z.adler := s.check;
     z.adler := s.check;
   end;
   end;
-  {$IFDEF STRUTILS_DEBUG}
+  {$IFDEF DEBUG}
   Tracev('inflate:   blocks reset');
   Tracev('inflate:   blocks reset');
   {$ENDIF}
   {$ENDIF}
 end;
 end;
@@ -130,69 +126,69 @@ end;
 
 
 function inflate_blocks_new(var z : z_stream;
 function inflate_blocks_new(var z : z_stream;
                             c : check_func;  { check function }
                             c : check_func;  { check function }
-                            w : uInt         { window size }
+                            w : cardinal         { window size }
                             ) : pInflate_blocks_state;
                             ) : pInflate_blocks_state;
 var
 var
   s : pInflate_blocks_state;
   s : pInflate_blocks_state;
 begin
 begin
   s := pInflate_blocks_state( ZALLOC(z,1, sizeof(inflate_blocks_state)) );
   s := pInflate_blocks_state( ZALLOC(z,1, sizeof(inflate_blocks_state)) );
-  if (s = Z_NULL) then
+  if (s = nil) then
   begin
   begin
     inflate_blocks_new := s;
     inflate_blocks_new := s;
     exit;
     exit;
   end;
   end;
   s^.hufts := huft_ptr( ZALLOC(z, sizeof(inflate_huft), MANY) );
   s^.hufts := huft_ptr( ZALLOC(z, sizeof(inflate_huft), MANY) );
 
 
-  if (s^.hufts = Z_NULL) then
+  if (s^.hufts = nil) then
   begin
   begin
     ZFREE(z, s);
     ZFREE(z, s);
-    inflate_blocks_new := Z_NULL;
+    inflate_blocks_new := nil;
     exit;
     exit;
   end;
   end;
 
 
-  s^.window := pBytef( ZALLOC(z, 1, w) );
-  if (s^.window = Z_NULL) then
+  s^.window := Pbyte( ZALLOC(z, 1, w) );
+  if (s^.window = nil) then
   begin
   begin
     ZFREE(z, s^.hufts);
     ZFREE(z, s^.hufts);
     ZFREE(z, s);
     ZFREE(z, s);
-    inflate_blocks_new := Z_NULL;
+    inflate_blocks_new := nil;
     exit;
     exit;
   end;
   end;
   s^.zend := s^.window;
   s^.zend := s^.window;
   Inc(s^.zend, w);
   Inc(s^.zend, w);
   s^.checkfn := c;
   s^.checkfn := c;
   s^.mode := ZTYPE;
   s^.mode := ZTYPE;
-  {$IFDEF STRUTILS_DEBUG}
+  {$IFDEF DEBUG}  
   Tracev('inflate:   blocks allocated');
   Tracev('inflate:   blocks allocated');
   {$ENDIF}
   {$ENDIF}
-  inflate_blocks_reset(s^, z, Z_NULL);
+  inflate_blocks_reset(s^, z, nil);
   inflate_blocks_new := s;
   inflate_blocks_new := s;
 end;
 end;
 
 
 
 
 function inflate_blocks (var s : inflate_blocks_state;
 function inflate_blocks (var s : inflate_blocks_state;
                          var z : z_stream;
                          var z : z_stream;
-                         r : int) : int;           { initial return code }
+                         r : integer) : integer;           { initial return code }
 label
 label
   start_btree, start_dtree,
   start_btree, start_dtree,
   start_blkdone, start_dry,
   start_blkdone, start_dry,
   start_codes;
   start_codes;
 
 
 var
 var
-  t : uInt;               { temporary storage }
-  b : uLong;              { bit buffer }
-  k : uInt;               { bits in bit buffer }
-  p : pBytef;             { input data pointer }
-  n : uInt;               { bytes available there }
-  q : pBytef;             { output window write pointer }
-  m : uInt;               { bytes to end of window or read pointer }
+  t : cardinal;               { temporary storage }
+  b : cardinal;              { bit buffer }
+  k : cardinal;               { bits in bit buffer }
+  p : Pbyte;             { input data pointer }
+  n : cardinal;               { bytes available there }
+  q : Pbyte;             { output window write pointer }
+  m : cardinal;               { bytes to end of window or read pointer }
 { fixed code blocks }
 { fixed code blocks }
 var
 var
-  bl, bd : uInt;
+  bl, bd : cardinal;
   tl, td : pInflate_huft;
   tl, td : pInflate_huft;
 var
 var
   h : pInflate_huft;
   h : pInflate_huft;
-  i, j, c : uInt;
+  i, j, c : cardinal;
 var
 var
   cs : pInflate_codes_state;
   cs : pInflate_codes_state;
 begin
 begin
@@ -202,10 +198,10 @@ begin
   b := s.bitb;
   b := s.bitb;
   k := s.bitk;
   k := s.bitk;
   q := s.write;
   q := s.write;
-  if ptr2int(q) < ptr2int(s.read) then
-    m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+  if ptrint(q) < ptrint(s.read) then
+    m := cardinal(ptrint(s.read)-ptrint(q)-1)
   else
   else
-    m := uInt(ptr2int(s.zend)-ptr2int(q));
+    m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
 { decompress an inflated block }
 { decompress an inflated block }
 
 
@@ -227,24 +223,24 @@ begin
             s.bitb := b;
             s.bitb := b;
             s.bitk := k;
             s.bitk := k;
             z.avail_in := n;
             z.avail_in := n;
-            Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+            Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
             z.next_in := p;
             z.next_in := p;
             s.write := q;
             s.write := q;
             inflate_blocks := inflate_flush(s,z,r);
             inflate_blocks := inflate_flush(s,z,r);
             exit;
             exit;
           end;
           end;
-          Dec(n);
-          b := b or (uLong(p^) shl k);
+          dec(n);
+          b := b or (cardinal(p^) shl k);
           Inc(p);
           Inc(p);
           Inc(k, 8);
           Inc(k, 8);
         end;
         end;
 
 
-        t := uInt(b) and 7;
+        t := cardinal(b) and 7;
         s.last := boolean(t and 1);
         s.last := boolean(t and 1);
         case (t shr 1) of
         case (t shr 1) of
           0:                         { stored }
           0:                         { stored }
             begin
             begin
-              {$IFDEF STRUTILS_DEBUG}
+              {$IFDEF DEBUG}
               if s.last then
               if s.last then
                 Tracev('inflate:     stored block (last)')
                 Tracev('inflate:     stored block (last)')
               else
               else
@@ -252,19 +248,19 @@ begin
               {$ENDIF}
               {$ENDIF}
               {DUMPBITS(3);}
               {DUMPBITS(3);}
               b := b shr 3;
               b := b shr 3;
-              Dec(k, 3);
+              dec(k, 3);
 
 
               t := k and 7;                  { go to byte boundary }
               t := k and 7;                  { go to byte boundary }
               {DUMPBITS(t);}
               {DUMPBITS(t);}
               b := b shr t;
               b := b shr t;
-              Dec(k, t);
+              dec(k, t);
 
 
               s.mode := LENS;                { get length of stored block }
               s.mode := LENS;                { get length of stored block }
             end;
             end;
           1:                         { fixed }
           1:                         { fixed }
             begin
             begin
               begin
               begin
-                {$IFDEF STRUTILS_DEBUG}
+                {$IFDEF DEBUG}
                 if s.last then
                 if s.last then
                   Tracev('inflate:     fixed codes blocks (last)')
                   Tracev('inflate:     fixed codes blocks (last)')
                 else
                 else
@@ -272,14 +268,14 @@ begin
                 {$ENDIF}
                 {$ENDIF}
                 inflate_trees_fixed(bl, bd, tl, td, z);
                 inflate_trees_fixed(bl, bd, tl, td, z);
                 s.sub.decode.codes := inflate_codes_new(bl, bd, tl, td, z);
                 s.sub.decode.codes := inflate_codes_new(bl, bd, tl, td, z);
-                if (s.sub.decode.codes = Z_NULL) then
+                if (s.sub.decode.codes = nil) then
                 begin
                 begin
                   r := Z_MEM_ERROR;
                   r := Z_MEM_ERROR;
                   { update pointers and return }
                   { update pointers and return }
                   s.bitb := b;
                   s.bitb := b;
                   s.bitk := k;
                   s.bitk := k;
                   z.avail_in := n;
                   z.avail_in := n;
-                  Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+                  Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
                   z.next_in := p;
                   z.next_in := p;
                   s.write := q;
                   s.write := q;
                   inflate_blocks := inflate_flush(s,z,r);
                   inflate_blocks := inflate_flush(s,z,r);
@@ -288,21 +284,21 @@ begin
               end;
               end;
               {DUMPBITS(3);}
               {DUMPBITS(3);}
               b := b shr 3;
               b := b shr 3;
-              Dec(k, 3);
+              dec(k, 3);
 
 
               s.mode := CODES;
               s.mode := CODES;
             end;
             end;
           2:                         { dynamic }
           2:                         { dynamic }
             begin
             begin
-              {$IFDEF STRUTILS_DEBUG}
+              {$IFDEF DEBUG}
               if s.last then
               if s.last then
                 Tracev('inflate:     dynamic codes block (last)')
                 Tracev('inflate:     dynamic codes block (last)')
               else
               else
                 Tracev('inflate:     dynamic codes block');
                 Tracev('inflate:     dynamic codes block');
-              {$ENDIF}
+              {$ENDIF}                
               {DUMPBITS(3);}
               {DUMPBITS(3);}
               b := b shr 3;
               b := b shr 3;
-              Dec(k, 3);
+              dec(k, 3);
 
 
               s.mode := TABLE;
               s.mode := TABLE;
             end;
             end;
@@ -310,7 +306,7 @@ begin
             begin                   { illegal }
             begin                   { illegal }
               {DUMPBITS(3);}
               {DUMPBITS(3);}
               b := b shr 3;
               b := b shr 3;
-              Dec(k, 3);
+              dec(k, 3);
 
 
               s.mode := BLKBAD;
               s.mode := BLKBAD;
               z.msg := 'invalid block type';
               z.msg := 'invalid block type';
@@ -319,7 +315,7 @@ begin
               s.bitb := b;
               s.bitb := b;
               s.bitk := k;
               s.bitk := k;
               z.avail_in := n;
               z.avail_in := n;
-              Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+              Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
               z.next_in := p;
               z.next_in := p;
               s.write := q;
               s.write := q;
               inflate_blocks := inflate_flush(s,z,r);
               inflate_blocks := inflate_flush(s,z,r);
@@ -341,14 +337,14 @@ begin
             s.bitb := b;
             s.bitb := b;
             s.bitk := k;
             s.bitk := k;
             z.avail_in := n;
             z.avail_in := n;
-            Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+            Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
             z.next_in := p;
             z.next_in := p;
             s.write := q;
             s.write := q;
             inflate_blocks := inflate_flush(s,z,r);
             inflate_blocks := inflate_flush(s,z,r);
             exit;
             exit;
           end;
           end;
-          Dec(n);
-          b := b or (uLong(p^) shl k);
+          dec(n);
+          b := b or (cardinal(p^) shl k);
           Inc(p);
           Inc(p);
           Inc(k, 8);
           Inc(k, 8);
         end;
         end;
@@ -362,16 +358,16 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_blocks := inflate_flush(s,z,r);
           inflate_blocks := inflate_flush(s,z,r);
           exit;
           exit;
         end;
         end;
-        s.sub.left := uInt(b) and $ffff;
+        s.sub.left := cardinal(b) and $ffff;
         k := 0;
         k := 0;
         b := 0;                      { dump bits }
         b := 0;                      { dump bits }
-        {$IFDEF STRUTILS_DEBUG}
+        {$IFDEF DEBUG}
         Tracev('inflate:       stored length '+IntToStr(s.sub.left));
         Tracev('inflate:       stored length '+IntToStr(s.sub.left));
         {$ENDIF}
         {$ENDIF}
         if s.sub.left <> 0 then
         if s.sub.left <> 0 then
@@ -390,7 +386,7 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_blocks := inflate_flush(s,z,r);
           inflate_blocks := inflate_flush(s,z,r);
@@ -403,10 +399,10 @@ begin
           if (q = s.zend) and (s.read <> s.window) then
           if (q = s.zend) and (s.read <> s.window) then
           begin
           begin
             q := s.window;
             q := s.window;
-            if ptr2int(q) < ptr2int(s.read) then
-              m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+            if ptrint(q) < ptrint(s.read) then
+              m := cardinal(ptrint(s.read)-ptrint(q)-1)
             else
             else
-              m := uInt(ptr2int(s.zend)-ptr2int(q));
+              m := cardinal(ptrint(s.zend)-ptrint(q));
           end;
           end;
 
 
           if (m = 0) then
           if (m = 0) then
@@ -415,19 +411,19 @@ begin
             s.write := q;
             s.write := q;
             r := inflate_flush(s,z,r);
             r := inflate_flush(s,z,r);
             q := s.write;
             q := s.write;
-            if ptr2int(q) < ptr2int(s.read) then
-              m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+            if ptrint(q) < ptrint(s.read) then
+              m := cardinal(ptrint(s.read)-ptrint(q)-1)
             else
             else
-              m := uInt(ptr2int(s.zend)-ptr2int(q));
+              m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
             {WRAP}
             {WRAP}
             if (q = s.zend) and (s.read <> s.window) then
             if (q = s.zend) and (s.read <> s.window) then
             begin
             begin
               q := s.window;
               q := s.window;
-              if ptr2int(q) < ptr2int(s.read) then
-                m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+              if ptrint(q) < ptrint(s.read) then
+                m := cardinal(ptrint(s.read)-ptrint(q)-1)
               else
               else
-                m := uInt(ptr2int(s.zend)-ptr2int(q));
+                m := cardinal(ptrint(s.zend)-ptrint(q));
             end;
             end;
 
 
             if (m = 0) then
             if (m = 0) then
@@ -436,7 +432,7 @@ begin
               s.bitb := b;
               s.bitb := b;
               s.bitk := k;
               s.bitk := k;
               z.avail_in := n;
               z.avail_in := n;
-              Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+              Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
               z.next_in := p;
               z.next_in := p;
               s.write := q;
               s.write := q;
               inflate_blocks := inflate_flush(s,z,r);
               inflate_blocks := inflate_flush(s,z,r);
@@ -451,20 +447,20 @@ begin
           t := n;
           t := n;
         if (t > m) then
         if (t > m) then
           t := m;
           t := m;
-        zmemcpy(q, p, t);
-        Inc(p, t);  Dec(n, t);
-        Inc(q, t);  Dec(m, t);
-        Dec(s.sub.left, t);
+        move(p^,q^,t);
+        inc(p, t);  dec(n, t);
+        inc(q, t);  dec(m, t);
+        dec(s.sub.left, t);
         if (s.sub.left = 0) then
         if (s.sub.left = 0) then
         begin
         begin
-          {$IFDEF STRUTILS_DEBUG}
-          if (ptr2int(q) >= ptr2int(s.read)) then
+          {$IFDEF DEBUG}
+          if (ptrint(q) >= ptrint(s.read)) then
             Tracev('inflate:       stored end '+
             Tracev('inflate:       stored end '+
-                IntToStr(z.total_out + ptr2int(q) - ptr2int(s.read)) + ' total out')
+                IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
           else
           else
             Tracev('inflate:       stored end '+
             Tracev('inflate:       stored end '+
-                    IntToStr(z.total_out + ptr2int(s.zend) - ptr2int(s.read) +
-                    ptr2int(q) - ptr2int(s.window)) +  ' total out');
+                    IntToStr(z.total_out + ptrint(s.zend) - ptrint(s.read) +
+                    ptrint(q) - ptrint(s.window)) +  ' total out');
           {$ENDIF}
           {$ENDIF}
           if s.last then
           if s.last then
             s.mode := DRY
             s.mode := DRY
@@ -486,19 +482,19 @@ begin
             s.bitb := b;
             s.bitb := b;
             s.bitk := k;
             s.bitk := k;
             z.avail_in := n;
             z.avail_in := n;
-            Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+            Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
             z.next_in := p;
             z.next_in := p;
             s.write := q;
             s.write := q;
             inflate_blocks := inflate_flush(s,z,r);
             inflate_blocks := inflate_flush(s,z,r);
             exit;
             exit;
           end;
           end;
-          Dec(n);
-          b := b or (uLong(p^) shl k);
+          dec(n);
+          b := b or (cardinal(p^) shl k);
           Inc(p);
           Inc(p);
           Inc(k, 8);
           Inc(k, 8);
         end;
         end;
 
 
-        t := uInt(b) and $3fff;
+        t := cardinal(b) and $3fff;
         s.sub.trees.table := t;
         s.sub.trees.table := t;
   {$ifndef PKZIP_BUG_WORKAROUND}
   {$ifndef PKZIP_BUG_WORKAROUND}
         if ((t and $1f) > 29) or (((t shr 5) and $1f) > 29) then
         if ((t and $1f) > 29) or (((t shr 5) and $1f) > 29) then
@@ -510,7 +506,7 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_blocks := inflate_flush(s,z,r);
           inflate_blocks := inflate_flush(s,z,r);
@@ -518,15 +514,15 @@ begin
         end;
         end;
   {$endif}
   {$endif}
         t := 258 + (t and $1f) + ((t shr 5) and $1f);
         t := 258 + (t and $1f) + ((t shr 5) and $1f);
-        s.sub.trees.blens := puIntArray( ZALLOC(z, t, sizeof(uInt)) );
-        if (s.sub.trees.blens = Z_NULL) then
+        s.sub.trees.blens := Pcardinalarray( ZALLOC(z, t, sizeof(cardinal)) );
+        if (s.sub.trees.blens = nil) then
         begin
         begin
           r := Z_MEM_ERROR;
           r := Z_MEM_ERROR;
           { update pointers and return }
           { update pointers and return }
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_blocks := inflate_flush(s,z,r);
           inflate_blocks := inflate_flush(s,z,r);
@@ -534,10 +530,10 @@ begin
         end;
         end;
         {DUMPBITS(14);}
         {DUMPBITS(14);}
         b := b shr 14;
         b := b shr 14;
-        Dec(k, 14);
+        dec(k, 14);
 
 
         s.sub.trees.index := 0;
         s.sub.trees.index := 0;
-        {$IFDEF STRUTILS_DEBUG}
+        {$IFDEF DEBUG}
         Tracev('inflate:       table sizes ok');
         Tracev('inflate:       table sizes ok');
         {$ENDIF}
         {$ENDIF}
         s.mode := BTREE;
         s.mode := BTREE;
@@ -562,23 +558,23 @@ begin
               s.bitb := b;
               s.bitb := b;
               s.bitk := k;
               s.bitk := k;
               z.avail_in := n;
               z.avail_in := n;
-              Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+              Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
               z.next_in := p;
               z.next_in := p;
               s.write := q;
               s.write := q;
               inflate_blocks := inflate_flush(s,z,r);
               inflate_blocks := inflate_flush(s,z,r);
               exit;
               exit;
             end;
             end;
-            Dec(n);
-            b := b or (uLong(p^) shl k);
+            dec(n);
+            b := b or (cardinal(p^) shl k);
             Inc(p);
             Inc(p);
             Inc(k, 8);
             Inc(k, 8);
           end;
           end;
 
 
-          s.sub.trees.blens^[border[s.sub.trees.index]] := uInt(b) and 7;
+          s.sub.trees.blens^[border[s.sub.trees.index]] := cardinal(b) and 7;
           Inc(s.sub.trees.index);
           Inc(s.sub.trees.index);
           {DUMPBITS(3);}
           {DUMPBITS(3);}
           b := b shr 3;
           b := b shr 3;
-          Dec(k, 3);
+          dec(k, 3);
         end;
         end;
         while (s.sub.trees.index < 19) do
         while (s.sub.trees.index < 19) do
         begin
         begin
@@ -598,14 +594,14 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_blocks := inflate_flush(s,z,r);
           inflate_blocks := inflate_flush(s,z,r);
           exit;
           exit;
         end;
         end;
         s.sub.trees.index := 0;
         s.sub.trees.index := 0;
-        {$IFDEF STRUTILS_DEBUG}
+        {$IFDEF DEBUG}
         Tracev('inflate:       bits tree ok');
         Tracev('inflate:       bits tree ok');
         {$ENDIF}
         {$ENDIF}
         s.mode := DTREE;
         s.mode := DTREE;
@@ -634,20 +630,20 @@ begin
               s.bitb := b;
               s.bitb := b;
               s.bitk := k;
               s.bitk := k;
               z.avail_in := n;
               z.avail_in := n;
-              Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+              Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
               z.next_in := p;
               z.next_in := p;
               s.write := q;
               s.write := q;
               inflate_blocks := inflate_flush(s,z,r);
               inflate_blocks := inflate_flush(s,z,r);
               exit;
               exit;
             end;
             end;
-            Dec(n);
-            b := b or (uLong(p^) shl k);
+            dec(n);
+            b := b or (cardinal(p^) shl k);
             Inc(p);
             Inc(p);
             Inc(k, 8);
             Inc(k, 8);
           end;
           end;
 
 
           h := s.sub.trees.tb;
           h := s.sub.trees.tb;
-          Inc(h, uInt(b) and inflate_mask[t]);
+          Inc(h, cardinal(b) and inflate_mask[t]);
           t := h^.Bits;
           t := h^.Bits;
           c := h^.Base;
           c := h^.Base;
 
 
@@ -655,7 +651,7 @@ begin
           begin
           begin
             {DUMPBITS(t);}
             {DUMPBITS(t);}
             b := b shr t;
             b := b shr t;
-            Dec(k, t);
+            dec(k, t);
 
 
             s.sub.trees.blens^[s.sub.trees.index] := c;
             s.sub.trees.blens^[s.sub.trees.index] := c;
             Inc(s.sub.trees.index);
             Inc(s.sub.trees.index);
@@ -684,26 +680,26 @@ begin
                 s.bitb := b;
                 s.bitb := b;
                 s.bitk := k;
                 s.bitk := k;
                 z.avail_in := n;
                 z.avail_in := n;
-                Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+                Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
                 z.next_in := p;
                 z.next_in := p;
                 s.write := q;
                 s.write := q;
                 inflate_blocks := inflate_flush(s,z,r);
                 inflate_blocks := inflate_flush(s,z,r);
                 exit;
                 exit;
               end;
               end;
-              Dec(n);
-              b := b or (uLong(p^) shl k);
+              dec(n);
+              b := b or (cardinal(p^) shl k);
               Inc(p);
               Inc(p);
               Inc(k, 8);
               Inc(k, 8);
             end;
             end;
 
 
             {DUMPBITS(t);}
             {DUMPBITS(t);}
             b := b shr t;
             b := b shr t;
-            Dec(k, t);
+            dec(k, t);
 
 
-            Inc(j, uInt(b) and inflate_mask[i]);
+            Inc(j, cardinal(b) and inflate_mask[i]);
             {DUMPBITS(i);}
             {DUMPBITS(i);}
             b := b shr i;
             b := b shr i;
-            Dec(k, i);
+            dec(k, i);
 
 
             i := s.sub.trees.index;
             i := s.sub.trees.index;
             t := s.sub.trees.table;
             t := s.sub.trees.table;
@@ -718,7 +714,7 @@ begin
               s.bitb := b;
               s.bitb := b;
               s.bitk := k;
               s.bitk := k;
               z.avail_in := n;
               z.avail_in := n;
-              Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+              Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
               z.next_in := p;
               z.next_in := p;
               s.write := q;
               s.write := q;
               inflate_blocks := inflate_flush(s,z,r);
               inflate_blocks := inflate_flush(s,z,r);
@@ -731,12 +727,12 @@ begin
             repeat
             repeat
               s.sub.trees.blens^[i] := c;
               s.sub.trees.blens^[i] := c;
               Inc(i);
               Inc(i);
-              Dec(j);
+              dec(j);
             until (j=0);
             until (j=0);
             s.sub.trees.index := i;
             s.sub.trees.index := i;
           end;
           end;
         end; { while }
         end; { while }
-        s.sub.trees.tb := Z_NULL;
+        s.sub.trees.tb := nil;
         begin
         begin
           bl := 9;         { must be <= 9 for lookahead assumptions }
           bl := 9;         { must be <= 9 for lookahead assumptions }
           bd := 6;         { must be <= 9 for lookahead assumptions }
           bd := 6;         { must be <= 9 for lookahead assumptions }
@@ -747,32 +743,32 @@ begin
           ZFREE(z, s.sub.trees.blens);
           ZFREE(z, s.sub.trees.blens);
           if (t <> Z_OK) then
           if (t <> Z_OK) then
           begin
           begin
-            if (t = uInt(Z_DATA_ERROR)) then
+            if (t = cardinal(Z_DATA_ERROR)) then
               s.mode := BLKBAD;
               s.mode := BLKBAD;
             r := t;
             r := t;
             { update pointers and return }
             { update pointers and return }
             s.bitb := b;
             s.bitb := b;
             s.bitk := k;
             s.bitk := k;
             z.avail_in := n;
             z.avail_in := n;
-            Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+            Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
             z.next_in := p;
             z.next_in := p;
             s.write := q;
             s.write := q;
             inflate_blocks := inflate_flush(s,z,r);
             inflate_blocks := inflate_flush(s,z,r);
             exit;
             exit;
           end;
           end;
-          {$IFDEF STRUTILS_DEBUG}
+          {$IFDEF DEBUG}
           Tracev('inflate:       trees ok');
           Tracev('inflate:       trees ok');
-          {$ENDIF}
+          {$ENDIF}          
           { c renamed to cs }
           { c renamed to cs }
           cs := inflate_codes_new(bl, bd, tl, td, z);
           cs := inflate_codes_new(bl, bd, tl, td, z);
-          if (cs = Z_NULL) then
+          if (cs = nil) then
           begin
           begin
             r := Z_MEM_ERROR;
             r := Z_MEM_ERROR;
             { update pointers and return }
             { update pointers and return }
             s.bitb := b;
             s.bitb := b;
             s.bitk := k;
             s.bitk := k;
             z.avail_in := n;
             z.avail_in := n;
-            Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+            Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
             z.next_in := p;
             z.next_in := p;
             s.write := q;
             s.write := q;
             inflate_blocks := inflate_flush(s,z,r);
             inflate_blocks := inflate_flush(s,z,r);
@@ -791,7 +787,7 @@ begin
         s.bitb := b;
         s.bitb := b;
         s.bitk := k;
         s.bitk := k;
         z.avail_in := n;
         z.avail_in := n;
-        Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+        Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
         z.next_in := p;
         z.next_in := p;
         s.write := q;
         s.write := q;
 
 
@@ -809,18 +805,18 @@ begin
         b := s.bitb;
         b := s.bitb;
         k := s.bitk;
         k := s.bitk;
         q := s.write;
         q := s.write;
-        if ptr2int(q) < ptr2int(s.read) then
-          m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+        if ptrint(q) < ptrint(s.read) then
+          m := cardinal(ptrint(s.read)-ptrint(q)-1)
         else
         else
-          m := uInt(ptr2int(s.zend)-ptr2int(q));
-        {$IFDEF STRUTILS_DEBUG}
-        if (ptr2int(q) >= ptr2int(s.read)) then
+          m := cardinal(ptrint(s.zend)-ptrint(q));
+        {$IFDEF DEBUG}
+        if (ptrint(q) >= ptrint(s.read)) then
           Tracev('inflate:       codes end '+
           Tracev('inflate:       codes end '+
-              IntToStr(z.total_out + ptr2int(q) - ptr2int(s.read)) + ' total out')
+              IntToStr(z.total_out + ptrint(q) - ptrint(s.read)) + ' total out')
         else
         else
           Tracev('inflate:       codes end '+
           Tracev('inflate:       codes end '+
-                  IntToStr(z.total_out + ptr2int(s.zend) - ptr2int(s.read) +
-                  ptr2int(q) - ptr2int(s.window)) +  ' total out');
+                  IntToStr(z.total_out + ptrint(s.zend) - ptrint(s.read) +
+                  ptrint(q) - ptrint(s.window)) +  ' total out');
         {$ENDIF}
         {$ENDIF}
         if (not s.last) then
         if (not s.last) then
         begin
         begin
@@ -830,12 +826,12 @@ begin
         {$ifndef patch112}
         {$ifndef patch112}
         if (k > 7) then           { return unused byte, if any }
         if (k > 7) then           { return unused byte, if any }
         begin
         begin
-          {$IFDEF STRUTILS_DEBUG}
+          {$IFDEF DEBUG}
           Assert(k < 16, 'inflate_codes grabbed too many bytes');
           Assert(k < 16, 'inflate_codes grabbed too many bytes');
           {$ENDIF}
           {$ENDIF}
-          Dec(k, 8);
-          Inc(n);
-          Dec(p);                    { can always return one }
+          dec(k, 8);
+          inc(n);
+          dec(p);                    { can always return one }
         end;
         end;
         {$endif}
         {$endif}
         s.mode := DRY;
         s.mode := DRY;
@@ -851,10 +847,10 @@ begin
         q := s.write;
         q := s.write;
 
 
         { not needed anymore, we are done:
         { not needed anymore, we are done:
-        if ptr2int(q) < ptr2int(s.read) then
-          m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+        if ptrint(q) < ptrint(s.read) then
+          m := cardinal(ptrint(s.read)-ptrint(q)-1)
         else
         else
-          m := uInt(ptr2int(s.zend)-ptr2int(q));
+          m := cardinal(ptrint(s.zend)-ptrint(q));
         }
         }
 
 
         if (s.read <> s.write) then
         if (s.read <> s.write) then
@@ -863,7 +859,7 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_blocks := inflate_flush(s,z,r);
           inflate_blocks := inflate_flush(s,z,r);
@@ -880,7 +876,7 @@ begin
         s.bitb := b;
         s.bitb := b;
         s.bitk := k;
         s.bitk := k;
         z.avail_in := n;
         z.avail_in := n;
-        Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+        Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
         z.next_in := p;
         z.next_in := p;
         s.write := q;
         s.write := q;
         inflate_blocks := inflate_flush(s,z,r);
         inflate_blocks := inflate_flush(s,z,r);
@@ -893,7 +889,7 @@ begin
         s.bitb := b;
         s.bitb := b;
         s.bitk := k;
         s.bitk := k;
         z.avail_in := n;
         z.avail_in := n;
-        Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+        Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
         z.next_in := p;
         z.next_in := p;
         s.write := q;
         s.write := q;
         inflate_blocks := inflate_flush(s,z,r);
         inflate_blocks := inflate_flush(s,z,r);
@@ -906,7 +902,7 @@ begin
       s.bitb := b;
       s.bitb := b;
       s.bitk := k;
       s.bitk := k;
       z.avail_in := n;
       z.avail_in := n;
-      Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+      Inc(z.total_in, ptrint(p) - ptrint(z.next_in));
       z.next_in := p;
       z.next_in := p;
       s.write := q;
       s.write := q;
       inflate_blocks := inflate_flush(s,z,r);
       inflate_blocks := inflate_flush(s,z,r);
@@ -918,37 +914,37 @@ end;
 
 
 
 
 function inflate_blocks_free(s : pInflate_blocks_state;
 function inflate_blocks_free(s : pInflate_blocks_state;
-                             var z : z_stream) : int;
+                             var z : z_stream) : integer;
 begin
 begin
-  inflate_blocks_reset(s^, z, Z_NULL);
+  inflate_blocks_reset(s^, z, nil);
   ZFREE(z, s^.window);
   ZFREE(z, s^.window);
   ZFREE(z, s^.hufts);
   ZFREE(z, s^.hufts);
   ZFREE(z, s);
   ZFREE(z, s);
-  {$IFDEF STRUTILS_DEBUG}
+  {$IFDEF DEBUG}
   Trace('inflate:   blocks freed');
   Trace('inflate:   blocks freed');
-  {$ENDIF}
+  {$ENDIF}  
   inflate_blocks_free := Z_OK;
   inflate_blocks_free := Z_OK;
 end;
 end;
 
 
 
 
 procedure inflate_set_dictionary(var s : inflate_blocks_state;
 procedure inflate_set_dictionary(var s : inflate_blocks_state;
                                  const d : array of byte; { dictionary }
                                  const d : array of byte; { dictionary }
-                                 n : uInt);         { dictionary length }
+                                 n : cardinal);         { dictionary length }
 begin
 begin
-  zmemcpy(s.window, pBytef(@d), n);
+  move(d,s.window^,n);
   s.write := s.window;
   s.write := s.window;
-  Inc(s.write, n);
+  inc(s.write, n);
   s.read := s.write;
   s.read := s.write;
 end;
 end;
 
 
 
 
 { Returns true if inflate is currently at the end of a block generated
 { Returns true if inflate is currently at the end of a block generated
   by Z_SYNC_FLUSH or Z_FULL_FLUSH.
   by Z_SYNC_FLUSH or Z_FULL_FLUSH.
-  IN assertion: s <> Z_NULL }
+  IN assertion: s <> nil }
 
 
-function inflate_blocks_sync_point(var s : inflate_blocks_state) : int;
+function inflate_blocks_sync_point(var s : inflate_blocks_state) : integer;
 begin
 begin
-  inflate_blocks_sync_point := int(s.mode = LENS);
+  inflate_blocks_sync_point := integer(s.mode = LENS);
 end;
 end;
 
 
 end.
 end.

+ 93 - 96
packages/base/paszlib/infcodes.pas

@@ -1,4 +1,4 @@
-Unit InfCodes;
+unit infcodes;
 
 
 { infcodes.c -- process literals and length/distance pairs
 { infcodes.c -- process literals and length/distance pairs
   Copyright (C) 1995-1998 Mark Adler
   Copyright (C) 1995-1998 Mark Adler
@@ -13,20 +13,17 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  {$IFDEF STRUTILS_DEBUG}
-  strutils,
-  {$ENDIF}
-  zutil, zbase;
+  zbase;
 
 
-function inflate_codes_new (bl : uInt;
-                            bd : uInt;
+function inflate_codes_new (bl : cardinal;
+                            bd : cardinal;
                             tl : pInflate_huft;
                             tl : pInflate_huft;
                             td : pInflate_huft;
                             td : pInflate_huft;
                             var z : z_stream): pInflate_codes_state;
                             var z : z_stream): pInflate_codes_state;
 
 
 function inflate_codes(var s : inflate_blocks_state;
 function inflate_codes(var s : inflate_blocks_state;
                        var z : z_stream;
                        var z : z_stream;
-                       r : int) : int;
+                       r : integer) : integer;
 
 
 procedure inflate_codes_free(c : pInflate_codes_state;
 procedure inflate_codes_free(c : pInflate_codes_state;
                              var z : z_stream);
                              var z : z_stream);
@@ -37,8 +34,8 @@ uses
   infutil, inffast;
   infutil, inffast;
 
 
 
 
-function inflate_codes_new (bl : uInt;
-                            bd : uInt;
+function inflate_codes_new (bl : cardinal;
+                            bd : cardinal;
                             tl : pInflate_huft;
                             tl : pInflate_huft;
                             td : pInflate_huft;
                             td : pInflate_huft;
                             var z : z_stream): pInflate_codes_state;
                             var z : z_stream): pInflate_codes_state;
@@ -53,7 +50,7 @@ begin
     c^.dbits := Byte(bd);
     c^.dbits := Byte(bd);
     c^.ltree := tl;
     c^.ltree := tl;
     c^.dtree := td;
     c^.dtree := td;
-    {$IFDEF STRUTILS_DEBUG}
+    {$IFDEF DEBUG}
     Tracev('inflate:       codes new');
     Tracev('inflate:       codes new');
     {$ENDIF}
     {$ENDIF}
   end;
   end;
@@ -63,18 +60,18 @@ end;
 
 
 function inflate_codes(var s : inflate_blocks_state;
 function inflate_codes(var s : inflate_blocks_state;
                        var z : z_stream;
                        var z : z_stream;
-                       r : int) : int;
+                       r : integer) : integer;
 var
 var
-  j : uInt;               { temporary storage }
+  j : cardinal;               { temporary storage }
   t : pInflate_huft;      { temporary pointer }
   t : pInflate_huft;      { temporary pointer }
-  e : uInt;               { extra bits or operation }
-  b : uLong;              { bit buffer }
-  k : uInt;               { bits in bit buffer }
-  p : pBytef;             { input data pointer }
-  n : uInt;               { bytes available there }
-  q : pBytef;             { output window write pointer }
-  m : uInt;               { bytes to end of window or read pointer }
-  f : pBytef;             { pointer to copy strings from }
+  e : cardinal;               { extra bits or operation }
+  b : cardinal;              { bit buffer }
+  k : cardinal;               { bits in bit buffer }
+  p : Pbyte;             { input data pointer }
+  n : cardinal;               { bytes available there }
+  q : Pbyte;             { output window write pointer }
+  m : cardinal;               { bytes to end of window or read pointer }
+  f : Pbyte;             { pointer to copy strings from }
 var
 var
   c : pInflate_codes_state;
   c : pInflate_codes_state;
 begin
 begin
@@ -86,10 +83,10 @@ begin
   b := s.bitb;
   b := s.bitb;
   k := s.bitk;
   k := s.bitk;
   q := s.write;
   q := s.write;
-  if ptr2int(q) < ptr2int(s.read) then
-    m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+  if ptrint(q) < ptrint(s.read) then
+    m := cardinal(ptrint(s.read)-ptrint(q)-1)
   else
   else
-    m := uInt(ptr2int(s.zend)-ptr2int(q));
+    m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
   { process input and output based on current state }
   { process input and output based on current state }
   while True do
   while True do
@@ -104,7 +101,7 @@ begin
         s.bitb := b;
         s.bitb := b;
         s.bitk := k;
         s.bitk := k;
         z.avail_in := n;
         z.avail_in := n;
-        Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+        Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
         z.next_in := p;
         z.next_in := p;
         s.write := q;
         s.write := q;
 
 
@@ -115,10 +112,10 @@ begin
         b := s.bitb;
         b := s.bitb;
         k := s.bitk;
         k := s.bitk;
         q := s.write;
         q := s.write;
-        if ptr2int(q) < ptr2int(s.read) then
-          m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+        if ptrint(q) < ptrint(s.read) then
+          m := cardinal(ptrint(s.read)-ptrint(q)-1)
         else
         else
-          m := uInt(ptr2int(s.zend)-ptr2int(q));
+          m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
         if (r <> Z_OK) then
         if (r <> Z_OK) then
         begin
         begin
@@ -149,33 +146,33 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_codes := inflate_flush(s,z,r);
           inflate_codes := inflate_flush(s,z,r);
           exit;
           exit;
         end;
         end;
-        Dec(n);
-        b := b or (uLong(p^) shl k);
+        dec(n);
+        b := b or (cardinal(p^) shl k);
         Inc(p);
         Inc(p);
         Inc(k, 8);
         Inc(k, 8);
       end;
       end;
       t := c^.sub.code.tree;
       t := c^.sub.code.tree;
-      Inc(t, uInt(b) and inflate_mask[j]);
+      Inc(t, cardinal(b) and inflate_mask[j]);
       {DUMPBITS(t^.bits);}
       {DUMPBITS(t^.bits);}
       b := b shr t^.bits;
       b := b shr t^.bits;
-      Dec(k, t^.bits);
+      dec(k, t^.bits);
 
 
-      e := uInt(t^.exop);
+      e := cardinal(t^.exop);
       if (e = 0) then            { literal }
       if (e = 0) then            { literal }
       begin
       begin
         c^.sub.lit := t^.base;
         c^.sub.lit := t^.base;
-       {$IFDEF STRUTILS_DEBUG}
+       {$IFDEF DEBUG}
         if (t^.base >= $20) and (t^.base < $7f) then
         if (t^.base >= $20) and (t^.base < $7f) then
           Tracevv('inflate:         literal '+char(t^.base))
           Tracevv('inflate:         literal '+char(t^.base))
         else
         else
           Tracevv('inflate:         literal '+IntToStr(t^.base));
           Tracevv('inflate:         literal '+IntToStr(t^.base));
-        {$ENDIF}
+        {$ENDIF}          
         c^.mode := LIT;
         c^.mode := LIT;
         continue;  { break switch statement }
         continue;  { break switch statement }
       end;
       end;
@@ -194,9 +191,9 @@ begin
       end;
       end;
       if (e and 32 <> 0) then            { end of block }
       if (e and 32 <> 0) then            { end of block }
       begin
       begin
-        {$IFDEF STRUTILS_DEBUG}
+        {$IFDEF DEBUG}
         Tracevv('inflate:         end of block');
         Tracevv('inflate:         end of block');
-        {$ENDIF}
+        {$ENDIF}        
         c^.mode := WASH;
         c^.mode := WASH;
         continue;         { break C-switch statement }
         continue;         { break C-switch statement }
       end;
       end;
@@ -207,7 +204,7 @@ begin
       s.bitb := b;
       s.bitb := b;
       s.bitk := k;
       s.bitk := k;
       z.avail_in := n;
       z.avail_in := n;
-      Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+      Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
       z.next_in := p;
       z.next_in := p;
       s.write := q;
       s.write := q;
       inflate_codes := inflate_flush(s,z,r);
       inflate_codes := inflate_flush(s,z,r);
@@ -228,25 +225,25 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_codes := inflate_flush(s,z,r);
           inflate_codes := inflate_flush(s,z,r);
           exit;
           exit;
         end;
         end;
-        Dec(n);
-        b := b or (uLong(p^) shl k);
+        dec(n);
+        b := b or (cardinal(p^) shl k);
         Inc(p);
         Inc(p);
         Inc(k, 8);
         Inc(k, 8);
       end;
       end;
-      Inc(c^.len, uInt(b and inflate_mask[j]));
+      Inc(c^.len, cardinal(b and inflate_mask[j]));
       {DUMPBITS(j);}
       {DUMPBITS(j);}
       b := b shr j;
       b := b shr j;
-      Dec(k, j);
+      dec(k, j);
 
 
       c^.sub.code.need := c^.dbits;
       c^.sub.code.need := c^.dbits;
       c^.sub.code.tree := c^.dtree;
       c^.sub.code.tree := c^.dtree;
-      {$IFDEF STRUTILS_DEBUG}
+      {$IFDEF DEBUG}
       Tracevv('inflate:         length '+IntToStr(c^.len));
       Tracevv('inflate:         length '+IntToStr(c^.len));
       {$ENDIF}
       {$ENDIF}
       c^.mode := DIST;
       c^.mode := DIST;
@@ -267,23 +264,23 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_codes := inflate_flush(s,z,r);
           inflate_codes := inflate_flush(s,z,r);
           exit;
           exit;
         end;
         end;
-        Dec(n);
-        b := b or (uLong(p^) shl k);
+        dec(n);
+        b := b or (cardinal(p^) shl k);
         Inc(p);
         Inc(p);
         Inc(k, 8);
         Inc(k, 8);
       end;
       end;
-      t := @huft_ptr(c^.sub.code.tree)^[uInt(b) and inflate_mask[j]];
+      t := @huft_ptr(c^.sub.code.tree)^[cardinal(b) and inflate_mask[j]];
       {DUMPBITS(t^.bits);}
       {DUMPBITS(t^.bits);}
       b := b shr t^.bits;
       b := b shr t^.bits;
-      Dec(k, t^.bits);
+      dec(k, t^.bits);
 
 
-      e := uInt(t^.exop);
+      e := cardinal(t^.exop);
       if (e and 16 <> 0) then            { distance }
       if (e and 16 <> 0) then            { distance }
       begin
       begin
         c^.sub.copy.get := e and 15;
         c^.sub.copy.get := e and 15;
@@ -304,7 +301,7 @@ begin
       s.bitb := b;
       s.bitb := b;
       s.bitk := k;
       s.bitk := k;
       z.avail_in := n;
       z.avail_in := n;
-      Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+      Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
       z.next_in := p;
       z.next_in := p;
       s.write := q;
       s.write := q;
       inflate_codes := inflate_flush(s,z,r);
       inflate_codes := inflate_flush(s,z,r);
@@ -325,22 +322,22 @@ begin
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+          Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_codes := inflate_flush(s,z,r);
           inflate_codes := inflate_flush(s,z,r);
           exit;
           exit;
         end;
         end;
-        Dec(n);
-        b := b or (uLong(p^) shl k);
+        dec(n);
+        b := b or (cardinal(p^) shl k);
         Inc(p);
         Inc(p);
         Inc(k, 8);
         Inc(k, 8);
       end;
       end;
-      Inc(c^.sub.copy.dist, uInt(b) and inflate_mask[j]);
+      Inc(c^.sub.copy.dist, cardinal(b) and inflate_mask[j]);
       {DUMPBITS(j);}
       {DUMPBITS(j);}
       b := b shr j;
       b := b shr j;
-      Dec(k, j);
-      {$IFDEF STRUTILS_DEBUG}
+      dec(k, j);
+      {$IFDEF DEBUG}
       Tracevv('inflate:         distance '+ IntToStr(c^.sub.copy.dist));
       Tracevv('inflate:         distance '+ IntToStr(c^.sub.copy.dist));
       {$ENDIF}
       {$ENDIF}
       c^.mode := COPY;
       c^.mode := COPY;
@@ -349,11 +346,11 @@ begin
   COPY:          { o: copying bytes in window, waiting for space }
   COPY:          { o: copying bytes in window, waiting for space }
     begin
     begin
       f := q;
       f := q;
-      Dec(f, c^.sub.copy.dist);
-      if (uInt(ptr2int(q) - ptr2int(s.window)) < c^.sub.copy.dist) then
+      dec(f, c^.sub.copy.dist);
+      if (cardinal(ptrint(q) - ptrint(s.window)) < c^.sub.copy.dist) then
       begin
       begin
         f := s.zend;
         f := s.zend;
-        Dec(f, c^.sub.copy.dist - uInt(ptr2int(q) - ptr2int(s.window)));
+        dec(f, c^.sub.copy.dist - cardinal(ptrint(q) - ptrint(s.window)));
       end;
       end;
 
 
       while (c^.len <> 0) do
       while (c^.len <> 0) do
@@ -365,10 +362,10 @@ begin
           if (q = s.zend) and (s.read <> s.window) then
           if (q = s.zend) and (s.read <> s.window) then
           begin
           begin
             q := s.window;
             q := s.window;
-            if ptr2int(q) < ptr2int(s.read) then
-              m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+            if ptrint(q) < ptrint(s.read) then
+              m := cardinal(ptrint(s.read)-ptrint(q)-1)
             else
             else
-              m := uInt(ptr2int(s.zend)-ptr2int(q));
+              m := cardinal(ptrint(s.zend)-ptrint(q));
           end;
           end;
 
 
           if (m = 0) then
           if (m = 0) then
@@ -377,19 +374,19 @@ begin
             s.write := q;
             s.write := q;
             r := inflate_flush(s,z,r);
             r := inflate_flush(s,z,r);
             q := s.write;
             q := s.write;
-            if ptr2int(q) < ptr2int(s.read) then
-              m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+            if ptrint(q) < ptrint(s.read) then
+              m := cardinal(ptrint(s.read)-ptrint(q)-1)
             else
             else
-              m := uInt(ptr2int(s.zend)-ptr2int(q));
+              m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
             {WRAP}
             {WRAP}
             if (q = s.zend) and (s.read <> s.window) then
             if (q = s.zend) and (s.read <> s.window) then
             begin
             begin
               q := s.window;
               q := s.window;
-              if ptr2int(q) < ptr2int(s.read) then
-                m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+              if ptrint(q) < ptrint(s.read) then
+                m := cardinal(ptrint(s.read)-ptrint(q)-1)
               else
               else
-                m := uInt(ptr2int(s.zend)-ptr2int(q));
+                m := cardinal(ptrint(s.zend)-ptrint(q));
             end;
             end;
 
 
             if (m = 0) then
             if (m = 0) then
@@ -398,7 +395,7 @@ begin
               s.bitb := b;
               s.bitb := b;
               s.bitk := k;
               s.bitk := k;
               z.avail_in := n;
               z.avail_in := n;
-              Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+              Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
               z.next_in := p;
               z.next_in := p;
               s.write := q;
               s.write := q;
               inflate_codes := inflate_flush(s,z,r);
               inflate_codes := inflate_flush(s,z,r);
@@ -412,11 +409,11 @@ begin
         q^ := f^;
         q^ := f^;
         Inc(q);
         Inc(q);
         Inc(f);
         Inc(f);
-        Dec(m);
+        dec(m);
 
 
         if (f = s.zend) then
         if (f = s.zend) then
           f := s.window;
           f := s.window;
-        Dec(c^.len);
+        dec(c^.len);
       end;
       end;
       c^.mode := START;
       c^.mode := START;
       { C-switch break; not needed }
       { C-switch break; not needed }
@@ -430,10 +427,10 @@ begin
         if (q = s.zend) and (s.read <> s.window) then
         if (q = s.zend) and (s.read <> s.window) then
         begin
         begin
           q := s.window;
           q := s.window;
-          if ptr2int(q) < ptr2int(s.read) then
-            m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+          if ptrint(q) < ptrint(s.read) then
+            m := cardinal(ptrint(s.read)-ptrint(q)-1)
           else
           else
-            m := uInt(ptr2int(s.zend)-ptr2int(q));
+            m := cardinal(ptrint(s.zend)-ptrint(q));
         end;
         end;
 
 
         if (m = 0) then
         if (m = 0) then
@@ -442,19 +439,19 @@ begin
           s.write := q;
           s.write := q;
           r := inflate_flush(s,z,r);
           r := inflate_flush(s,z,r);
           q := s.write;
           q := s.write;
-          if ptr2int(q) < ptr2int(s.read) then
-            m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+          if ptrint(q) < ptrint(s.read) then
+            m := cardinal(ptrint(s.read)-ptrint(q)-1)
           else
           else
-            m := uInt(ptr2int(s.zend)-ptr2int(q));
+            m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
           {WRAP}
           {WRAP}
           if (q = s.zend) and (s.read <> s.window) then
           if (q = s.zend) and (s.read <> s.window) then
           begin
           begin
             q := s.window;
             q := s.window;
-            if ptr2int(q) < ptr2int(s.read) then
-              m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+            if ptrint(q) < ptrint(s.read) then
+              m := cardinal(ptrint(s.read)-ptrint(q)-1)
             else
             else
-              m := uInt(ptr2int(s.zend)-ptr2int(q));
+              m := cardinal(ptrint(s.zend)-ptrint(q));
           end;
           end;
 
 
           if (m = 0) then
           if (m = 0) then
@@ -463,7 +460,7 @@ begin
             s.bitb := b;
             s.bitb := b;
             s.bitk := k;
             s.bitk := k;
             z.avail_in := n;
             z.avail_in := n;
-            Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+            Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
             z.next_in := p;
             z.next_in := p;
             s.write := q;
             s.write := q;
             inflate_codes := inflate_flush(s,z,r);
             inflate_codes := inflate_flush(s,z,r);
@@ -476,7 +473,7 @@ begin
       {OUTBYTE(c^.sub.lit);}
       {OUTBYTE(c^.sub.lit);}
       q^ := c^.sub.lit;
       q^ := c^.sub.lit;
       Inc(q);
       Inc(q);
-      Dec(m);
+      dec(m);
 
 
       c^.mode := START;
       c^.mode := START;
       {break;}
       {break;}
@@ -486,22 +483,22 @@ begin
       {$ifdef patch112}
       {$ifdef patch112}
       if (k > 7) then           { return unused byte, if any }
       if (k > 7) then           { return unused byte, if any }
       begin
       begin
-        {$IFDEF STRUTILS_DEBUG}
+        {$IFDEF DEBUG}
         Assert(k < 16, 'inflate_codes grabbed too many bytes');
         Assert(k < 16, 'inflate_codes grabbed too many bytes');
         {$ENDIF}
         {$ENDIF}
-        Dec(k, 8);
+        dec(k, 8);
         Inc(n);
         Inc(n);
-        Dec(p);                    { can always return one }
+        dec(p);                    { can always return one }
       end;
       end;
       {$endif}
       {$endif}
       {FLUSH}
       {FLUSH}
       s.write := q;
       s.write := q;
       r := inflate_flush(s,z,r);
       r := inflate_flush(s,z,r);
       q := s.write;
       q := s.write;
-      if ptr2int(q) < ptr2int(s.read) then
-        m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+      if ptrint(q) < ptrint(s.read) then
+        m := cardinal(ptrint(s.read)-ptrint(q)-1)
       else
       else
-        m := uInt(ptr2int(s.zend)-ptr2int(q));
+        m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
       if (s.read <> s.write) then
       if (s.read <> s.write) then
       begin
       begin
@@ -509,7 +506,7 @@ begin
         s.bitb := b;
         s.bitb := b;
         s.bitk := k;
         s.bitk := k;
         z.avail_in := n;
         z.avail_in := n;
-        Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+        Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
         z.next_in := p;
         z.next_in := p;
         s.write := q;
         s.write := q;
         inflate_codes := inflate_flush(s,z,r);
         inflate_codes := inflate_flush(s,z,r);
@@ -526,7 +523,7 @@ begin
       s.bitb := b;
       s.bitb := b;
       s.bitk := k;
       s.bitk := k;
       z.avail_in := n;
       z.avail_in := n;
-      Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+      Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
       z.next_in := p;
       z.next_in := p;
       s.write := q;
       s.write := q;
       inflate_codes := inflate_flush(s,z,r);
       inflate_codes := inflate_flush(s,z,r);
@@ -539,7 +536,7 @@ begin
       s.bitb := b;
       s.bitb := b;
       s.bitk := k;
       s.bitk := k;
       z.avail_in := n;
       z.avail_in := n;
-      Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+      Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
       z.next_in := p;
       z.next_in := p;
       s.write := q;
       s.write := q;
       inflate_codes := inflate_flush(s,z,r);
       inflate_codes := inflate_flush(s,z,r);
@@ -552,7 +549,7 @@ begin
       s.bitb := b;
       s.bitb := b;
       s.bitk := k;
       s.bitk := k;
       z.avail_in := n;
       z.avail_in := n;
-      Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+      Inc(z.total_in, ptrint(p)-ptrint(z.next_in));
       z.next_in := p;
       z.next_in := p;
       s.write := q;
       s.write := q;
       inflate_codes := inflate_flush(s,z,r);
       inflate_codes := inflate_flush(s,z,r);
@@ -568,9 +565,9 @@ procedure inflate_codes_free(c : pInflate_codes_state;
                              var z : z_stream);
                              var z : z_stream);
 begin
 begin
   ZFREE(z, c);
   ZFREE(z, c);
-  {$IFDEF STRUTILS_DEBUG}
+  {$IFDEF DEBUG}  
   Tracev('inflate:       codes free');
   Tracev('inflate:       codes free');
   {$ENDIF}
   {$ENDIF}
 end;
 end;
 
 
-end.
+end.

+ 88 - 91
packages/base/paszlib/inffast.pas

@@ -16,17 +16,14 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  {$ifdef STRUTILS_DEBUG}
-  strutils,
-  {$ENDIF}
-  zutil, zbase;
+  zbase;
 
 
-function inflate_fast( bl : uInt;
-                       bd : uInt;
+function inflate_fast( bl : cardinal;
+                       bd : cardinal;
                        tl : pInflate_huft;
                        tl : pInflate_huft;
                        td : pInflate_huft;
                        td : pInflate_huft;
                       var s : inflate_blocks_state;
                       var s : inflate_blocks_state;
-                      var z : z_stream) : int;
+                      var z : z_stream) : integer;
 
 
 
 
 implementation
 implementation
@@ -40,27 +37,27 @@ uses
   at least ten.  The ten bytes are six bytes for the longest length/
   at least ten.  The ten bytes are six bytes for the longest length/
   distance pair plus four bytes for overloading the bit buffer. }
   distance pair plus four bytes for overloading the bit buffer. }
 
 
-function inflate_fast( bl : uInt;
-                       bd : uInt;
+function inflate_fast( bl : cardinal;
+                       bd : cardinal;
                        tl : pInflate_huft;
                        tl : pInflate_huft;
                        td : pInflate_huft;
                        td : pInflate_huft;
                       var s : inflate_blocks_state;
                       var s : inflate_blocks_state;
-                      var z : z_stream) : int;
+                      var z : z_stream) : integer;
 
 
 var
 var
   t : pInflate_huft;      { temporary pointer }
   t : pInflate_huft;      { temporary pointer }
-  e : uInt;               { extra bits or operation }
-  b : uLong;              { bit buffer }
-  k : uInt;               { bits in bit buffer }
-  p : pBytef;             { input data pointer }
-  n : uInt;               { bytes available there }
-  q : pBytef;             { output window write pointer }
-  m : uInt;               { bytes to end of window or read pointer }
-  ml : uInt;              { mask for literal/length tree }
-  md : uInt;              { mask for distance tree }
-  c : uInt;               { bytes to copy }
-  d : uInt;               { distance back to copy from }
-  r : pBytef;             { copy source pointer }
+  e : cardinal;               { extra bits or operation }
+  b : longint;              { bit buffer }
+  k : cardinal;               { bits in bit buffer }
+  p : Pbyte;             { input data pointer }
+  n : cardinal;               { bytes available there }
+  q : Pbyte;             { output window write pointer }
+  m : cardinal;               { bytes to end of window or read pointer }
+  ml : cardinal;              { mask for literal/length tree }
+  md : cardinal;              { mask for distance tree }
+  c : cardinal;               { bytes to copy }
+  d : cardinal;               { distance back to copy from }
+  r : Pbyte;             { copy source pointer }
 begin
 begin
   { load input, output, bit values (macro LOAD) }
   { load input, output, bit values (macro LOAD) }
   p := z.next_in;
   p := z.next_in;
@@ -68,10 +65,10 @@ begin
   b := s.bitb;
   b := s.bitb;
   k := s.bitk;
   k := s.bitk;
   q := s.write;
   q := s.write;
-  if ptr2int(q) < ptr2int(s.read) then
-    m := uInt(ptr2int(s.read)-ptr2int(q)-1)
+  if ptrint(q) < ptrint(s.read) then
+    m := cardinal(ptrint(s.read)-ptrint(q)-1)
   else
   else
-    m := uInt(ptr2int(s.zend)-ptr2int(q));
+    m := cardinal(ptrint(s.zend)-ptrint(q));
 
 
   { initialize masks }
   { initialize masks }
   ml := inflate_mask[bl];
   ml := inflate_mask[bl];
@@ -83,63 +80,63 @@ begin
     {GRABBITS(20);}             { max bits for literal/length code }
     {GRABBITS(20);}             { max bits for literal/length code }
     while (k < 20) do
     while (k < 20) do
     begin
     begin
-      Dec(n);
-      b := b or (uLong(p^) shl k);
-      Inc(p);
-      Inc(k, 8);
+      dec(n);
+      b := b or (longint(p^) shl k);
+      inc(p);
+      inc(k, 8);
     end;
     end;
 
 
-    t := @(huft_ptr(tl)^[uInt(b) and ml]);
+    t := @(huft_ptr(tl)^[cardinal(b) and ml]);
 
 
     e := t^.exop;
     e := t^.exop;
     if (e = 0) then
     if (e = 0) then
     begin
     begin
       {DUMPBITS(t^.bits);}
       {DUMPBITS(t^.bits);}
       b := b shr t^.bits;
       b := b shr t^.bits;
-      Dec(k, t^.bits);
-     {$IFDEF STRUTILS_DEBUG}
+      dec(k, t^.bits);
+     {$IFDEF DEBUG}
       if (t^.base >= $20) and (t^.base < $7f) then
       if (t^.base >= $20) and (t^.base < $7f) then
         Tracevv('inflate:         * literal '+char(t^.base))
         Tracevv('inflate:         * literal '+char(t^.base))
       else
       else
         Tracevv('inflate:         * literal '+ IntToStr(t^.base));
         Tracevv('inflate:         * literal '+ IntToStr(t^.base));
       {$ENDIF}
       {$ENDIF}
       q^ := Byte(t^.base);
       q^ := Byte(t^.base);
-      Inc(q);
-      Dec(m);
+      inc(q);
+      dec(m);
       continue;
       continue;
     end;
     end;
     repeat
     repeat
       {DUMPBITS(t^.bits);}
       {DUMPBITS(t^.bits);}
       b := b shr t^.bits;
       b := b shr t^.bits;
-      Dec(k, t^.bits);
+      dec(k, t^.bits);
 
 
       if (e and 16 <> 0) then
       if (e and 16 <> 0) then
       begin
       begin
         { get extra bits for length }
         { get extra bits for length }
         e := e and 15;
         e := e and 15;
-        c := t^.base + (uInt(b) and inflate_mask[e]);
+        c := t^.base + (cardinal(b) and inflate_mask[e]);
         {DUMPBITS(e);}
         {DUMPBITS(e);}
         b := b shr e;
         b := b shr e;
-        Dec(k, e);
-        {$IFDEF STRUTILS_DEBUG}
+        dec(k, e);
+        {$IFDEF DEBUG}
         Tracevv('inflate:         * length ' + IntToStr(c));
         Tracevv('inflate:         * length ' + IntToStr(c));
         {$ENDIF}
         {$ENDIF}
         { decode distance base of block to copy }
         { decode distance base of block to copy }
         {GRABBITS(15);}           { max bits for distance code }
         {GRABBITS(15);}           { max bits for distance code }
         while (k < 15) do
         while (k < 15) do
         begin
         begin
-          Dec(n);
-          b := b or (uLong(p^) shl k);
-          Inc(p);
-          Inc(k, 8);
+          dec(n);
+          b := b or (longint(p^) shl k);
+          inc(p);
+          inc(k, 8);
         end;
         end;
 
 
-        t := @huft_ptr(td)^[uInt(b) and md];
+        t := @huft_ptr(td)^[cardinal(b) and md];
         e := t^.exop;
         e := t^.exop;
         repeat
         repeat
           {DUMPBITS(t^.bits);}
           {DUMPBITS(t^.bits);}
           b := b shr t^.bits;
           b := b shr t^.bits;
-          Dec(k, t^.bits);
+          dec(k, t^.bits);
 
 
           if (e and 16 <> 0) then
           if (e and 16 <> 0) then
           begin
           begin
@@ -148,58 +145,58 @@ begin
             {GRABBITS(e);}         { get extra bits (up to 13) }
             {GRABBITS(e);}         { get extra bits (up to 13) }
             while (k < e) do
             while (k < e) do
             begin
             begin
-              Dec(n);
-              b := b or (uLong(p^) shl k);
-              Inc(p);
-              Inc(k, 8);
+              dec(n);
+              b := b or (longint(p^) shl k);
+              inc(p);
+              inc(k, 8);
             end;
             end;
 
 
-            d := t^.base + (uInt(b) and inflate_mask[e]);
+            d := t^.base + (cardinal(b) and inflate_mask[e]);
             {DUMPBITS(e);}
             {DUMPBITS(e);}
             b := b shr e;
             b := b shr e;
-            Dec(k, e);
+            dec(k, e);
 
 
-            {$IFDEF STRUTILS_DEBUG}
+            {$IFDEF DEBUG}
             Tracevv('inflate:         * distance '+IntToStr(d));
             Tracevv('inflate:         * distance '+IntToStr(d));
             {$ENDIF}
             {$ENDIF}
             { do the copy }
             { do the copy }
-            Dec(m, c);
-            if (uInt(ptr2int(q) - ptr2int(s.window)) >= d) then     { offset before dest }
+            dec(m, c);
+            if (cardinal(ptrint(q) - ptrint(s.window)) >= d) then     { offset before dest }
             begin                                  {  just copy }
             begin                                  {  just copy }
               r := q;
               r := q;
-              Dec(r, d);
-              q^ := r^;  Inc(q); Inc(r); Dec(c); { minimum count is three, }
-              q^ := r^;  Inc(q); Inc(r); Dec(c); { so unroll loop a little }
+              dec(r, d);
+              q^ := r^;  inc(q); inc(r); dec(c); { minimum count is three, }
+              q^ := r^;  inc(q); inc(r); dec(c); { so unroll loop a little }
             end
             end
             else                        { else offset after destination }
             else                        { else offset after destination }
             begin
             begin
-              e := d - uInt(ptr2int(q) - ptr2int(s.window)); { bytes from offset to end }
+              e := d - cardinal(ptrint(q) - ptrint(s.window)); { bytes from offset to end }
               r := s.zend;
               r := s.zend;
-              Dec(r, e);                  { pointer to offset }
+              dec(r, e);                  { pointer to offset }
               if (c > e) then             { if source crosses, }
               if (c > e) then             { if source crosses, }
               begin
               begin
-                Dec(c, e);                { copy to end of window }
+                dec(c, e);                { copy to end of window }
                 repeat
                 repeat
                   q^ := r^;
                   q^ := r^;
-                  Inc(q);
-                  Inc(r);
-                  Dec(e);
+                  inc(q);
+                  inc(r);
+                  dec(e);
                 until (e=0);
                 until (e=0);
                 r := s.window;           { copy rest from start of window }
                 r := s.window;           { copy rest from start of window }
               end;
               end;
             end;
             end;
             repeat                       { copy all or what's left }
             repeat                       { copy all or what's left }
               q^ := r^;
               q^ := r^;
-              Inc(q);
-              Inc(r);
-              Dec(c);
+              inc(q);
+              inc(r);
+              dec(c);
             until (c = 0);
             until (c = 0);
             break;
             break;
           end
           end
           else
           else
             if (e and 64 = 0) then
             if (e and 64 = 0) then
             begin
             begin
-              Inc(t, t^.base + (uInt(b) and inflate_mask[e]));
+              inc(t, t^.base + (cardinal(b) and inflate_mask[e]));
               e := t^.exop;
               e := t^.exop;
             end
             end
           else
           else
@@ -209,14 +206,14 @@ begin
             c := z.avail_in-n;
             c := z.avail_in-n;
             if (k shr 3) < c then
             if (k shr 3) < c then
               c := k shr 3;
               c := k shr 3;
-            Inc(n, c);
-            Dec(p, c);
-            Dec(k, c shl 3);
+            inc(n, c);
+            dec(p, c);
+            dec(k, c shl 3);
             {UPDATE}
             {UPDATE}
             s.bitb := b;
             s.bitb := b;
             s.bitk := k;
             s.bitk := k;
             z.avail_in := n;
             z.avail_in := n;
-            Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+            inc(z.total_in, ptrint(p)-ptrint(z.next_in));
             z.next_in := p;
             z.next_in := p;
             s.write := q;
             s.write := q;
 
 
@@ -229,46 +226,46 @@ begin
       if (e and 64 = 0) then
       if (e and 64 = 0) then
       begin
       begin
          {t += t->base;
          {t += t->base;
-          e = (t += ((uInt)b & inflate_mask[e]))->exop;}
+          e = (t += ((cardinal)b & inflate_mask[e]))->exop;}
 
 
-        Inc(t, t^.base + (uInt(b) and inflate_mask[e]));
+        inc(t, t^.base + (cardinal(b) and inflate_mask[e]));
         e := t^.exop;
         e := t^.exop;
         if (e = 0) then
         if (e = 0) then
         begin
         begin
           {DUMPBITS(t^.bits);}
           {DUMPBITS(t^.bits);}
           b := b shr t^.bits;
           b := b shr t^.bits;
-          Dec(k, t^.bits);
+          dec(k, t^.bits);
 
 
-         {$IFDEF STRUTILS_DEBUG}
+         {$IFDEF DEBUG}
           if (t^.base >= $20) and (t^.base < $7f) then
           if (t^.base >= $20) and (t^.base < $7f) then
             Tracevv('inflate:         * literal '+char(t^.base))
             Tracevv('inflate:         * literal '+char(t^.base))
           else
           else
             Tracevv('inflate:         * literal '+IntToStr(t^.base));
             Tracevv('inflate:         * literal '+IntToStr(t^.base));
-          {$ENDIF}
+          {$ENDIF}            
           q^ := Byte(t^.base);
           q^ := Byte(t^.base);
-          Inc(q);
-          Dec(m);
+          inc(q);
+          dec(m);
           break;
           break;
         end;
         end;
       end
       end
       else
       else
         if (e and 32 <> 0) then
         if (e and 32 <> 0) then
         begin
         begin
-          {$IFDEF STRUTILS_DEBUG}
+          {$IFDEF DEBUG}
           Tracevv('inflate:         * end of block');
           Tracevv('inflate:         * end of block');
           {$ENDIF}
           {$ENDIF}
           {UNGRAB}
           {UNGRAB}
           c := z.avail_in-n;
           c := z.avail_in-n;
           if (k shr 3) < c then
           if (k shr 3) < c then
             c := k shr 3;
             c := k shr 3;
-          Inc(n, c);
-          Dec(p, c);
-          Dec(k, c shl 3);
+          inc(n, c);
+          dec(p, c);
+          dec(k, c shl 3);
           {UPDATE}
           {UPDATE}
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+          inc(z.total_in, ptrint(p)-ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_fast := Z_STREAM_END;
           inflate_fast := Z_STREAM_END;
@@ -281,14 +278,14 @@ begin
           c := z.avail_in-n;
           c := z.avail_in-n;
           if (k shr 3) < c then
           if (k shr 3) < c then
             c := k shr 3;
             c := k shr 3;
-          Inc(n, c);
-          Dec(p, c);
-          Dec(k, c shl 3);
+          inc(n, c);
+          dec(p, c);
+          dec(k, c shl 3);
           {UPDATE}
           {UPDATE}
           s.bitb := b;
           s.bitb := b;
           s.bitk := k;
           s.bitk := k;
           z.avail_in := n;
           z.avail_in := n;
-          Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+          inc(z.total_in, ptrint(p)-ptrint(z.next_in));
           z.next_in := p;
           z.next_in := p;
           s.write := q;
           s.write := q;
           inflate_fast := Z_DATA_ERROR;
           inflate_fast := Z_DATA_ERROR;
@@ -302,17 +299,17 @@ begin
   c := z.avail_in-n;
   c := z.avail_in-n;
   if (k shr 3) < c then
   if (k shr 3) < c then
     c := k shr 3;
     c := k shr 3;
-  Inc(n, c);
-  Dec(p, c);
-  Dec(k, c shl 3);
+  inc(n, c);
+  dec(p, c);
+  dec(k, c shl 3);
   {UPDATE}
   {UPDATE}
   s.bitb := b;
   s.bitb := b;
   s.bitk := k;
   s.bitk := k;
   z.avail_in := n;
   z.avail_in := n;
-  Inc(z.total_in, ptr2int(p)-ptr2int(z.next_in));
+  inc(z.total_in, ptrint(p)-ptrint(z.next_in));
   z.next_in := p;
   z.next_in := p;
   s.write := q;
   s.write := q;
   inflate_fast := Z_OK;
   inflate_fast := Z_OK;
 end;
 end;
 
 
-end.
+end.

+ 97 - 97
packages/base/paszlib/inftrees.pas

@@ -1,4 +1,4 @@
-Unit InfTrees;
+unit inftrees;
 
 
 { inftrees.h -- header to use inftrees.c
 { inftrees.h -- header to use inftrees.c
   inftrees.c -- generate Huffman trees for efficient decoding
   inftrees.c -- generate Huffman trees for efficient decoding
@@ -18,7 +18,7 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  zutil, zbase;
+  zbase;
 
 
 
 
 { Maximum size of dynamic tree.  The maximum found in a long but non-
 { Maximum size of dynamic tree.  The maximum found in a long but non-
@@ -32,36 +32,36 @@ const
 
 
 {$ifdef DEBUG}
 {$ifdef DEBUG}
 var
 var
-  inflate_hufts : uInt;
+  inflate_hufts : cardinal;
 {$endif}
 {$endif}
 
 
 function inflate_trees_bits(
 function inflate_trees_bits(
-  var c : array of uIntf;  { 19 code lengths }
-  var bb : uIntf;          { bits tree desired/actual depth }
+  var c : array of cardinal;  { 19 code lengths }
+  var bb : cardinal;          { bits tree desired/actual depth }
   var tb : pinflate_huft;  { bits tree result }
   var tb : pinflate_huft;  { bits tree result }
   var hp : array of Inflate_huft;      { space for trees }
   var hp : array of Inflate_huft;      { space for trees }
   var z : z_stream         { for messages }
   var z : z_stream         { for messages }
-    ) : int;
+    ) : integer;
 
 
 function inflate_trees_dynamic(
 function inflate_trees_dynamic(
-    nl : uInt;                    { number of literal/length codes }
-    nd : uInt;                    { number of distance codes }
-    var c : Array of uIntf;           { that many (total) code lengths }
-    var bl : uIntf;               { literal desired/actual bit depth }
-    var bd : uIntf;               { distance desired/actual bit depth }
+    nl : cardinal;                    { number of literal/length codes }
+    nd : cardinal;                    { number of distance codes }
+    var c : Array of cardinal;           { that many (total) code lengths }
+    var bl : cardinal;               { literal desired/actual bit depth }
+    var bd : cardinal;               { distance desired/actual bit depth }
 var tl : pInflate_huft;           { literal/length tree result }
 var tl : pInflate_huft;           { literal/length tree result }
 var td : pInflate_huft;           { distance tree result }
 var td : pInflate_huft;           { distance tree result }
 var hp : array of Inflate_huft;   { space for trees }
 var hp : array of Inflate_huft;   { space for trees }
 var z : z_stream                  { for messages }
 var z : z_stream                  { for messages }
-     ) : int;
+     ) : integer;
 
 
 function inflate_trees_fixed (
 function inflate_trees_fixed (
-    var bl : uIntf;               { literal desired/actual bit depth }
-    var bd : uIntf;               { distance desired/actual bit depth }
+    var bl : cardinal;                { literal desired/actual bit depth }
+    var bd : cardinal;                { distance desired/actual bit depth }
     var tl : pInflate_huft;       { literal/length tree result }
     var tl : pInflate_huft;       { literal/length tree result }
     var td : pInflate_huft;       { distance tree result }
     var td : pInflate_huft;       { distance tree result }
     var z : z_stream              { for memory allocation }
     var z : z_stream              { for memory allocation }
-     ) : int;
+     ) : integer;
 
 
 
 
 implementation
 implementation
@@ -79,23 +79,23 @@ const
 
 
 const
 const
 { Tables for deflate from PKZIP's appnote.txt. }
 { Tables for deflate from PKZIP's appnote.txt. }
-  cplens : Array [0..30] Of uInt  { Copy lengths for literal codes 257..285 }
+  cplens : Array [0..30] Of cardinal  { Copy lengths for literal codes 257..285 }
      = (3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
      = (3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0);
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0);
         { actually lengths - 2; also see note #13 above about 258 }
         { actually lengths - 2; also see note #13 above about 258 }
 
 
   invalid_code = 112;
   invalid_code = 112;
 
 
-  cplext : Array [0..30] Of uInt  { Extra bits for literal codes 257..285 }
+  cplext : Array [0..30] Of cardinal  { Extra bits for literal codes 257..285 }
      = (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
      = (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
         3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, invalid_code, invalid_code);
         3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, invalid_code, invalid_code);
 
 
-  cpdist : Array [0..29] Of uInt { Copy offsets for distance codes 0..29 }
+  cpdist : Array [0..29] Of cardinal { Copy offsets for distance codes 0..29 }
      = (1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
      = (1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
         8193, 12289, 16385, 24577);
         8193, 12289, 16385, 24577);
 
 
-  cpdext : Array [0..29] Of uInt { Extra bits for distance codes }
+  cpdext : Array [0..29] Of cardinal { Extra bits for distance codes }
      = (0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
      = (0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
         7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
         7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
         12, 12, 13, 13);
         12, 12, 13, 13);
@@ -138,48 +138,48 @@ const
 {$DEFINE USE_PTR}
 {$DEFINE USE_PTR}
 
 
 function huft_build(
 function huft_build(
-var b : array of uIntf;    { code lengths in bits (all assumed <= BMAX) }
-    n : uInt;              { number of codes (assumed <= N_MAX) }
-    s : uInt;              { number of simple-valued codes (0..s-1) }
-const d : array of uIntf;  { list of base values for non-simple codes }
+var b : array of cardinal;    { code lengths in bits (all assumed <= BMAX) }
+    n : cardinal;              { number of codes (assumed <= N_MAX) }
+    s : cardinal;              { number of simple-valued codes (0..s-1) }
+const d : array of cardinal;  { list of base values for non-simple codes }
 { array of word }
 { array of word }
-const e : array of uIntf;  { list of extra bits for non-simple codes }
+const e : array of cardinal;  { list of extra bits for non-simple codes }
 { array of byte }
 { array of byte }
   t : ppInflate_huft;     { result: starting table }
   t : ppInflate_huft;     { result: starting table }
-var m : uIntf;             { maximum lookup bits, returns actual }
+var m : cardinal;             { maximum lookup bits, returns actual }
 var hp : array of inflate_huft;  { space for trees }
 var hp : array of inflate_huft;  { space for trees }
-var hn : uInt;             { hufts used in space }
-var v : array of uIntf     { working area: values in order of bit length }
-   ) : int;
+var hn : cardinal;             { hufts used in space }
+var v : array of cardinal     { working area: values in order of bit length }
+   ) : integer;
 { Given a list of code lengths and a maximum table size, make a set of
 { Given a list of code lengths and a maximum table size, make a set of
   tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
   tables to decode that set of codes.  Return Z_OK on success, Z_BUF_ERROR
   if the given code set is incomplete (the tables are still built in this
   if the given code set is incomplete (the tables are still built in this
   case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
   case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
   lengths), or Z_MEM_ERROR if not enough memory. }
   lengths), or Z_MEM_ERROR if not enough memory. }
 Var
 Var
-  a : uInt;                     { counter for codes of length k }
-  c : Array [0..BMAX] Of uInt;  { bit length count table }
-  f : uInt;                     { i repeats in table every f entries }
-  g : int;                      { maximum code length }
-  h : int;                      { table level }
-  i : uInt;  {register}         { counter, current code }
-  j : uInt;  {register}         { counter }
-  k : Int;   {register}         { number of bits in current code }
-  l : int;                      { bits per table (returned in m) }
-  mask : uInt;                  { (1 shl w) - 1, to avoid cc -O bug on HP }
-  p : ^uIntf; {register}        { pointer into c[], b[], or v[] }
+  a : cardinal;                     { counter for codes of length k }
+  c : Array [0..BMAX] Of cardinal;  { bit length count table }
+  f : cardinal;                     { i repeats in table every f entries }
+  g : integer;                      { maximum code length }
+  h : integer;                      { table level }
+  i : cardinal;  {register}         { counter, current code }
+  j : cardinal;  {register}         { counter }
+  k : integer;   {register}         { number of bits in current code }
+  l : integer;			{ bits per table (returned in m) }
+  mask : cardinal;                  { (1 shl w) - 1, to avoid cc -O bug on HP }
+  p : ^cardinal; {register}        { pointer into c[], b[], or v[] }
   q : pInflate_huft;            { points to current table }
   q : pInflate_huft;            { points to current table }
   r : inflate_huft;             { table entry for structure assignment }
   r : inflate_huft;             { table entry for structure assignment }
   u : Array [0..BMAX-1] Of pInflate_huft; { table stack }
   u : Array [0..BMAX-1] Of pInflate_huft; { table stack }
-  w : int;   {register}         { bits before this table = (l*h) }
-  x : Array [0..BMAX] Of uInt;  { bit offsets, then code stack }
+  w : integer;   {register}         { bits before this table = (l*h) }
+  x : Array [0..BMAX] Of cardinal;  { bit offsets, then code stack }
   {$IFDEF USE_PTR}
   {$IFDEF USE_PTR}
-  xp : puIntf;                  { pointer into x }
+  xp : Pcardinal;                  { pointer into x }
   {$ELSE}
   {$ELSE}
-  xp : uInt;
+  xp : cardinal;
   {$ENDIF}
   {$ENDIF}
-  y : int;                      { number of dummy codes added }
-  z : uInt;                     { number of entries in current table }
+  y : integer;                      { number of dummy codes added }
+  z : cardinal;                     { number of entries in current table }
 Begin
 Begin
   { Generate counts for each bit length }
   { Generate counts for each bit length }
   FillChar(c,SizeOf(c),0) ;     { clear c[] }
   FillChar(c,SizeOf(c),0) ;     { clear c[] }
@@ -201,13 +201,13 @@ Begin
     if (c[j] <> 0) then
     if (c[j] <> 0) then
       break;
       break;
   k := j ;                      { minimum code length }
   k := j ;                      { minimum code length }
-  if (uInt(l) < j) then
+  if (cardinal(l) < j) then
     l := j;
     l := j;
   for i := BMAX downto 1 do
   for i := BMAX downto 1 do
     if (c[i] <> 0) then
     if (c[i] <> 0) then
       break ;
       break ;
   g := i ;                      { maximum code length }
   g := i ;                      { maximum code length }
-  if (uInt(l) > i) then
+  if (cardinal(l) > i) then
      l := i;
      l := i;
   m := l;
   m := l;
 
 
@@ -301,7 +301,7 @@ Begin
 
 
         { table size upper limit }
         { table size upper limit }
         z := g - w;
         z := g - w;
-        If (z > uInt(l)) Then
+        If (z > cardinal(l)) Then
           z := l;
           z := l;
 
 
         { try a k-w bit table }
         { try a k-w bit table }
@@ -362,11 +362,11 @@ Begin
         if (h <> 0) then
         if (h <> 0) then
         begin
         begin
           x[h] := i;             { save pattern for backing up }
           x[h] := i;             { save pattern for backing up }
-          r.bits := Byte(l);     { bits to dump before this table }
-          r.exop := Byte(j);     { bits in this table }
+          r.bits := byte(l);     { bits to dump before this table }
+          r.exop := byte(j);     { bits in this table }
           j := i shr (w - l);
           j := i shr (w - l);
-          {r.base := uInt( q - u[h-1] -j);}   { offset to this table }
-          r.base := (ptr2int(q) - ptr2int(u[h-1]) ) div sizeof(q^) - j;
+          {r.base := cardinal( q - u[h-1] -j);}   { offset to this table }
+          r.base := (ptrint(q) - ptrint(u[h-1]) ) div sizeof(q^) - j;
           huft_Ptr(u[h-1])^[j] := r;  { connect to last table }
           huft_Ptr(u[h-1])^[j] := r;  { connect to last table }
         end
         end
         else
         else
@@ -374,11 +374,11 @@ Begin
       end;
       end;
 
 
       { set up table entry in r }
       { set up table entry in r }
-      r.bits := Byte(k - w);
+      r.bits := byte(k - w);
 
 
       { C-code: if (p >= v + n) - see ZUTIL.PAS for comments }
       { C-code: if (p >= v + n) - see ZUTIL.PAS for comments }
 
 
-      if ptr2int(p)>=ptr2int(@(v[n])) then  { also works under DPMI ?? }
+      if ptrint(p)>=ptrint(@(v[n])) then  { also works under DPMI ?? }
         r.exop := 128 + 64                  { out of values--invalid code }
         r.exop := 128 + 64                  { out of values--invalid code }
       else
       else
         if (p^ < s) then
         if (p^ < s) then
@@ -392,7 +392,7 @@ Begin
         end
         end
         Else
         Else
         begin
         begin
-          r.exop := Byte(e[p^-s] + 16 + 64);  { non-simple--look up in lists }
+          r.exop := byte(e[p^-s] + 16 + 64);  { non-simple--look up in lists }
           r.base := d[p^-s];
           r.base := d[p^-s];
           Inc (p);
           Inc (p);
         end ;
         end ;
@@ -438,27 +438,27 @@ end; { huft_build}
 
 
 
 
 function inflate_trees_bits(
 function inflate_trees_bits(
-  var c : array of uIntf;  { 19 code lengths }
-  var bb : uIntf;          { bits tree desired/actual depth }
+  var c : array of cardinal;  { 19 code lengths }
+  var bb : cardinal;          { bits tree desired/actual depth }
   var tb : pinflate_huft;  { bits tree result }
   var tb : pinflate_huft;  { bits tree result }
   var hp : array of Inflate_huft;      { space for trees }
   var hp : array of Inflate_huft;      { space for trees }
   var z : z_stream         { for messages }
   var z : z_stream         { for messages }
-    ) : int;
+    ) : integer;
 var
 var
-  r : int;
-  hn : uInt;          { hufts used in space }
-  v : PuIntArray;     { work area for huft_build }
+  r : integer;
+  hn : cardinal;          { hufts used in space }
+  v : Pcardinalarray;     { work area for huft_build }
 begin
 begin
   hn := 0;
   hn := 0;
-  v := PuIntArray( ZALLOC(z, 19, sizeof(uInt)) );
-  if (v = Z_NULL) then
+  v := Pcardinalarray( ZALLOC(z, 19, sizeof(cardinal)) );
+  if (v = nil) then
   begin
   begin
     inflate_trees_bits := Z_MEM_ERROR;
     inflate_trees_bits := Z_MEM_ERROR;
     exit;
     exit;
   end;
   end;
 
 
   r := huft_build(c, 19, 19, cplens, cplext,
   r := huft_build(c, 19, 19, cplens, cplext,
-                             {puIntf(Z_NULL), puIntf(Z_NULL),}
+                             {Pcardinal(nil), Pcardinal(nil),}
                   @tb, bb, hp, hn, v^);
                   @tb, bb, hp, hn, v^);
   if (r = Z_DATA_ERROR) then
   if (r = Z_DATA_ERROR) then
     z.msg := 'oversubscribed dynamic bit lengths tree'
     z.msg := 'oversubscribed dynamic bit lengths tree'
@@ -474,25 +474,25 @@ end;
 
 
 
 
 function inflate_trees_dynamic(
 function inflate_trees_dynamic(
-    nl : uInt;                    { number of literal/length codes }
-    nd : uInt;                    { number of distance codes }
-    var c : Array of uIntf;           { that many (total) code lengths }
-    var bl : uIntf;          { literal desired/actual bit depth }
-    var bd : uIntf;          { distance desired/actual bit depth }
+    nl : cardinal;                    { number of literal/length codes }
+    nd : cardinal;                    { number of distance codes }
+    var c : Array of cardinal;           { that many (total) code lengths }
+    var bl : cardinal;          { literal desired/actual bit depth }
+    var bd : cardinal;          { distance desired/actual bit depth }
 var tl : pInflate_huft;           { literal/length tree result }
 var tl : pInflate_huft;           { literal/length tree result }
 var td : pInflate_huft;           { distance tree result }
 var td : pInflate_huft;           { distance tree result }
 var hp : array of Inflate_huft;   { space for trees }
 var hp : array of Inflate_huft;   { space for trees }
 var z : z_stream                  { for messages }
 var z : z_stream                  { for messages }
-     ) : int;
+     ) : integer;
 var
 var
-  r : int;
-  hn : uInt;          { hufts used in space }
-  v : PuIntArray;     { work area for huft_build }
+  r : integer;
+  hn : cardinal;          { hufts used in space }
+  v : Pcardinalarray;     { work area for huft_build }
 begin
 begin
   hn := 0;
   hn := 0;
   { allocate work area }
   { allocate work area }
-  v := PuIntArray( ZALLOC(z, 288, sizeof(uInt)) );
-  if (v = Z_NULL) then
+  v := Pcardinalarray( ZALLOC(z, 288, sizeof(cardinal)) );
+  if (v = nil) then
   begin
   begin
     inflate_trees_dynamic := Z_MEM_ERROR;
     inflate_trees_dynamic := Z_MEM_ERROR;
     exit;
     exit;
@@ -517,7 +517,7 @@ begin
   end;
   end;
 
 
   { build distance tree }
   { build distance tree }
-  r := huft_build(puIntArray(@c[nl])^, nd, 0,
+  r := huft_build(Pcardinalarray(@c[nl])^, nd, 0,
                   cpdist, cpdext, @td, bd, hp, hn, v^);
                   cpdist, cpdext, @td, bd, hp, hn, v^);
   if (r <> Z_OK) or ((bd = 0) and (nl > 257)) then
   if (r <> Z_OK) or ((bd = 0) and (nl > 257)) then
   begin
   begin
@@ -560,8 +560,8 @@ const
   FIXEDH = 544;      { number of hufts used by fixed tables }
   FIXEDH = 544;      { number of hufts used by fixed tables }
 var
 var
   fixed_mem : array[0..FIXEDH-1] of inflate_huft;
   fixed_mem : array[0..FIXEDH-1] of inflate_huft;
-  fixed_bl : uInt;
-  fixed_bd : uInt;
+  fixed_bl : cardinal;
+  fixed_bd : cardinal;
   fixed_tl : pInflate_huft;
   fixed_tl : pInflate_huft;
   fixed_td : pInflate_huft;
   fixed_td : pInflate_huft;
 
 
@@ -571,18 +571,18 @@ var
 
 
 {local}
 {local}
 const
 const
-  fixed_bl = uInt(9);
+  fixed_bl = 9;
 {local}
 {local}
 const
 const
-  fixed_bd = uInt(5);
+  fixed_bd = 5;
 {local}
 {local}
 const
 const
   fixed_tl : array [0..288-1] of inflate_huft = (
   fixed_tl : array [0..288-1] of inflate_huft = (
     Exop,             { number of extra bits or operation }
     Exop,             { number of extra bits or operation }
-    bits : Byte;      { number of bits in this code or subcode }
-    {pad : uInt;}       { pad structure to a power of 2 (4 bytes for }
-                      {  16-bit, 8 bytes for 32-bit int's) }
-    base : uInt;      { literal, length base, or distance base }
+    bits : byte;      { number of bits in this code or subcode }
+    {pad : cardinal;}       { pad structure to a power of 2 (4 bytes for }
+                      {  16-bit, 8 bytes for 32-bit integer's) }
+    base : cardinal;      { literal, length base, or distance base }
                       { or table offset }
                       { or table offset }
 
 
     ((96,7),256), ((0,8),80), ((0,8),16), ((84,8),115), ((82,7),31),
     ((96,7),256), ((0,8),80), ((0,8),16), ((84,8),115), ((82,7),31),
@@ -708,21 +708,21 @@ const
 {$ENDIF}
 {$ENDIF}
 
 
 function inflate_trees_fixed(
 function inflate_trees_fixed(
-var bl : uIntf;              { literal desired/actual bit depth }
-var bd : uIntf;              { distance desired/actual bit depth }
+var bl : cardinal;               { literal desired/actual bit depth }
+var bd : cardinal;               { distance desired/actual bit depth }
 var tl : pInflate_huft;      { literal/length tree result }
 var tl : pInflate_huft;      { literal/length tree result }
 var td : pInflate_huft;      { distance tree result }
 var td : pInflate_huft;      { distance tree result }
 var  z : z_stream            { for memory allocation }
 var  z : z_stream            { for memory allocation }
-      ) : int;
+      ) : integer;
 type
 type
   pFixed_table = ^fixed_table;
   pFixed_table = ^fixed_table;
-  fixed_table = array[0..288-1] of uIntf;
+  fixed_table = array[0..288-1] of cardinal;
 var
 var
-  k : int;                   { temporary variable }
-  c : pFixed_table;          { length list for huft_build }
-  v : PuIntArray;            { work area for huft_build }
+  k : integer;                   { temporary variable }
+  c : pFixed_table;              { length list for huft_build }
+  v : Pcardinalarray;            { work area for huft_build }
 var
 var
-  f : uInt;                  { number of hufts used in fixed_mem }
+  f : cardinal;                  { number of hufts used in fixed_mem }
 begin
 begin
   { build fixed tables if not already (multiple overlapped executions ok) }
   { build fixed tables if not already (multiple overlapped executions ok) }
   if not fixed_built then
   if not fixed_built then
@@ -730,14 +730,14 @@ begin
     f := 0;
     f := 0;
 
 
     { allocate memory }
     { allocate memory }
-    c := pFixed_table( ZALLOC(z, 288, sizeof(uInt)) );
-    if (c = Z_NULL) then
+    c := pFixed_table( ZALLOC(z, 288, sizeof(cardinal)) );
+    if (c = nil) then
     begin
     begin
       inflate_trees_fixed := Z_MEM_ERROR;
       inflate_trees_fixed := Z_MEM_ERROR;
       exit;
       exit;
     end;
     end;
-    v := PuIntArray( ZALLOC(z, 288, sizeof(uInt)) );
-    if (v = Z_NULL) then
+    v := Pcardinalarray( ZALLOC(z, 288, sizeof(cardinal)) );
+    if (v = nil) then
     begin
     begin
       ZFREE(z, c);
       ZFREE(z, c);
       inflate_trees_fixed := Z_MEM_ERROR;
       inflate_trees_fixed := Z_MEM_ERROR;
@@ -777,4 +777,4 @@ begin
 end; { inflate_trees_fixed }
 end; { inflate_trees_fixed }
 
 
 
 
-end.
+end.

+ 43 - 43
packages/base/paszlib/infutil.pas

@@ -17,46 +17,46 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  zutil, zbase;
+  zbase;
 
 
 { copy as much as possible from the sliding window to the output area }
 { copy as much as possible from the sliding window to the output area }
 function inflate_flush(var s : inflate_blocks_state;
 function inflate_flush(var s : inflate_blocks_state;
                        var z : z_stream;
                        var z : z_stream;
-                       r : int) : int;
+                       r : integer) : integer;
 
 
 { And'ing with mask[n] masks the lower n bits }
 { And'ing with mask[n] masks the lower n bits }
 const
 const
-  inflate_mask : array[0..17-1] of uInt = (
+  inflate_mask : array[0..17-1] of cardinal = (
     $0000,
     $0000,
     $0001, $0003, $0007, $000f, $001f, $003f, $007f, $00ff,
     $0001, $0003, $0007, $000f, $001f, $003f, $007f, $00ff,
     $01ff, $03ff, $07ff, $0fff, $1fff, $3fff, $7fff, $ffff);
     $01ff, $03ff, $07ff, $0fff, $1fff, $3fff, $7fff, $ffff);
 
 
-{procedure GRABBITS(j : int);}
-{procedure DUMPBITS(j : int);}
-{procedure NEEDBITS(j : int);}
+{procedure GRABBITS(j : integer);}
+{procedure DUMPBITS(j : integer);}
+{procedure NEEDBITS(j : integer);}
 
 
 implementation
 implementation
 
 
 { macros for bit input with no checking and for returning unused bytes }
 { macros for bit input with no checking and for returning unused bytes }
-procedure GRABBITS(j : int);
+procedure GRABBITS(j : integer);
 begin
 begin
   {while (k < j) do
   {while (k < j) do
   begin
   begin
-    Dec(z^.avail_in);
-    Inc(z^.total_in);
+    dec(z^.avail_in);
+    inc(z^.total_in);
     b := b or (uLong(z^.next_in^) shl k);
     b := b or (uLong(z^.next_in^) shl k);
-    Inc(z^.next_in);
-    Inc(k, 8);
+    inc(z^.next_in);
+    inc(k, 8);
   end;}
   end;}
 end;
 end;
 
 
-procedure DUMPBITS(j : int);
+procedure DUMPBITS(j : integer);
 begin
 begin
   {b := b shr j;
   {b := b shr j;
-  Dec(k, j);}
+  dec(k, j);}
 end;
 end;
 
 
-procedure NEEDBITS(j : int);
+procedure NEEDBITS(j : integer);
 begin
 begin
  (*
  (*
           while (k < j) do
           while (k < j) do
@@ -70,16 +70,16 @@ begin
               s.bitb := b;
               s.bitb := b;
               s.bitk := k;
               s.bitk := k;
               z.avail_in := n;
               z.avail_in := n;
-              Inc(z.total_in, LongInt(p)-LongInt(z.next_in));
+              inc(z.total_in, LongInt(p)-LongInt(z.next_in));
               z.next_in := p;
               z.next_in := p;
               s.write := q;
               s.write := q;
               result := inflate_flush(s,z,r);
               result := inflate_flush(s,z,r);
               exit;
               exit;
             end;
             end;
-            Dec(n);
+            dec(n);
             b := b or (uLong(p^) shl k);
             b := b or (uLong(p^) shl k);
-            Inc(p);
-            Inc(k, 8);
+            inc(p);
+            inc(k, 8);
           end;
           end;
  *)
  *)
 end;
 end;
@@ -94,9 +94,9 @@ begin
     begin
     begin
       q := s.window;
       q := s.window;
       if LongInt(q) < LongInt(s.read) then
       if LongInt(q) < LongInt(s.read) then
-        m := uInt(LongInt(s.read)-LongInt(q)-1)
+        m := cardinal(LongInt(s.read)-LongInt(q)-1)
       else
       else
-        m := uInt(LongInt(s.zend)-LongInt(q));
+        m := cardinal(LongInt(s.zend)-LongInt(q));
     end;
     end;
 
 
     if (m = 0) then
     if (m = 0) then
@@ -106,18 +106,18 @@ begin
       r := inflate_flush(s,z,r);
       r := inflate_flush(s,z,r);
       q := s.write;
       q := s.write;
       if LongInt(q) < LongInt(s.read) then
       if LongInt(q) < LongInt(s.read) then
-        m := uInt(LongInt(s.read)-LongInt(q)-1)
+        m := cardinal(LongInt(s.read)-LongInt(q)-1)
       else
       else
-        m := uInt(LongInt(s.zend)-LongInt(q));
+        m := cardinal(LongInt(s.zend)-LongInt(q));
 
 
       {WRAP}
       {WRAP}
       if (q = s.zend) and (s.read <> s.window) then
       if (q = s.zend) and (s.read <> s.window) then
       begin
       begin
         q := s.window;
         q := s.window;
         if LongInt(q) < LongInt(s.read) then
         if LongInt(q) < LongInt(s.read) then
-          m := uInt(LongInt(s.read)-LongInt(q)-1)
+          m := cardinal(LongInt(s.read)-LongInt(q)-1)
         else
         else
-          m := uInt(LongInt(s.zend)-LongInt(q));
+          m := cardinal(LongInt(s.zend)-LongInt(q));
       end;
       end;
 
 
       if (m = 0) then
       if (m = 0) then
@@ -126,7 +126,7 @@ begin
         s.bitb := b;
         s.bitb := b;
         s.bitk := k;
         s.bitk := k;
         z.avail_in := n;
         z.avail_in := n;
-        Inc(z.total_in, LongInt(p)-LongInt(z.next_in));
+        inc(z.total_in, LongInt(p)-LongInt(z.next_in));
         z.next_in := p;
         z.next_in := p;
         s.write := q;
         s.write := q;
         result := inflate_flush(s,z,r);
         result := inflate_flush(s,z,r);
@@ -141,29 +141,29 @@ end;
 { copy as much as possible from the sliding window to the output area }
 { copy as much as possible from the sliding window to the output area }
 function inflate_flush(var s : inflate_blocks_state;
 function inflate_flush(var s : inflate_blocks_state;
                        var z : z_stream;
                        var z : z_stream;
-                       r : int) : int;
+                       r : integer) : integer;
 var
 var
-  n : uInt;
-  p : pBytef;
-  q : pBytef;
+  n : cardinal;
+  p : Pbyte;
+  q : Pbyte;
 begin
 begin
   { local copies of source and destination pointers }
   { local copies of source and destination pointers }
   p := z.next_out;
   p := z.next_out;
   q := s.read;
   q := s.read;
 
 
   { compute number of bytes to copy as far as end of window }
   { compute number of bytes to copy as far as end of window }
-  if ptr2int(q) <= ptr2int(s.write) then
-    n := uInt(ptr2int(s.write) - ptr2int(q))
+  if ptrint(q) <= ptrint(s.write) then
+    n := cardinal(ptrint(s.write) - ptrint(q))
   else
   else
-    n := uInt(ptr2int(s.zend) - ptr2int(q));
+    n := cardinal(ptrint(s.zend) - ptrint(q));
   if (n > z.avail_out) then
   if (n > z.avail_out) then
     n := z.avail_out;
     n := z.avail_out;
   if (n <> 0) and (r = Z_BUF_ERROR) then
   if (n <> 0) and (r = Z_BUF_ERROR) then
     r := Z_OK;
     r := Z_OK;
 
 
   { update counters }
   { update counters }
-  Dec(z.avail_out, n);
-  Inc(z.total_out, n);
+  dec(z.avail_out, n);
+  inc(z.total_out, n);
 
 
 
 
   { update check information }
   { update check information }
@@ -174,9 +174,9 @@ begin
   end;
   end;
 
 
   { copy as far as end of window }
   { copy as far as end of window }
-  zmemcpy(p, q, n);
-  Inc(p, n);
-  Inc(q, n);
+  move(q^,p^,n);
+  inc(p, n);
+  inc(q, n);
 
 
   { see if more to copy at beginning of window }
   { see if more to copy at beginning of window }
   if (q = s.zend) then
   if (q = s.zend) then
@@ -187,15 +187,15 @@ begin
       s.write := s.window;
       s.write := s.window;
 
 
     { compute bytes to copy }
     { compute bytes to copy }
-    n := uInt(ptr2int(s.write) - ptr2int(q));
+    n := cardinal(ptrint(s.write) - ptrint(q));
     if (n > z.avail_out) then
     if (n > z.avail_out) then
       n := z.avail_out;
       n := z.avail_out;
     if (n <> 0) and (r = Z_BUF_ERROR) then
     if (n <> 0) and (r = Z_BUF_ERROR) then
       r := Z_OK;
       r := Z_OK;
 
 
     { update counters }
     { update counters }
-    Dec( z.avail_out, n);
-    Inc( z.total_out, n);
+    dec( z.avail_out, n);
+    inc( z.total_out, n);
 
 
     { update check information }
     { update check information }
     if Assigned(s.checkfn) then
     if Assigned(s.checkfn) then
@@ -205,9 +205,9 @@ begin
     end;
     end;
 
 
     { copy }
     { copy }
-    zmemcpy(p, q, n);
-    Inc(p, n);
-    Inc(q, n);
+    move(q^,p^,n);
+    inc(p, n);
+    inc(q, n);
   end;
   end;
 
 
 
 

+ 7 - 10
packages/base/paszlib/minigzip.pas

@@ -18,10 +18,7 @@ program minigzip;
 }
 }
 
 
 uses
 uses
-  {$IFDEF VER80}
-  WinCrt,
-  {$ENDIF}
-  gzio, zutil;
+  gzio;
 
 
 const
 const
   BUFLEN       = 16384 ;
   BUFLEN       = 16384 ;
@@ -54,9 +51,9 @@ end;
 
 
 procedure gz_compress (var infile:file; outfile:gzFile);
 procedure gz_compress (var infile:file; outfile:gzFile);
 var
 var
-  len   : uInt;
+  len   : cardinal;
   ioerr : integer;
   ioerr : integer;
-  err   : int;
+  err   : integer;
 begin
 begin
 
 
   while true do begin
   while true do begin
@@ -91,10 +88,10 @@ end;
 
 
 procedure gz_uncompress (infile:gzFile; var outfile:file);
 procedure gz_uncompress (infile:gzFile; var outfile:file);
 var
 var
-  len     : int;
-  written : uInt;
+  len     : integer;
+  written : cardinal;
   ioerr   : integer;
   ioerr   : integer;
-  err     : int;
+  err     : integer;
 begin
 begin
   while true do begin
   while true do begin
 
 
@@ -248,4 +245,4 @@ begin
   if (uncompr = true)
   if (uncompr = true)
     then file_uncompress (ParamStr(ParamCount))
     then file_uncompress (ParamStr(ParamCount))
     else file_compress (ParamStr(ParamCount), outmode);
     else file_compress (ParamStr(ParamCount), outmode);
-end.
+end.

+ 112 - 106
packages/base/paszlib/paszlib.pas

@@ -1,25 +1,19 @@
 unit paszlib;
 unit paszlib;
 
 
+{$inline on}
+
 interface
 interface
 
 
 uses
 uses
   zbase;
   zbase;
 
 
 const
 const
-  ZLIB_VERSION = '1.1.2';
+  ZLIB_VERSION = '1.2';
 
 
 type
 type
   { Compatibility types }
   { Compatibility types }
-  PByte   = ^Byte;
-  Uint    = Cardinal;
-  Ulong   = Cardinal;
-  Ulongf  = ULong;
-  Pulongf = ^Ulongf;
   z_off_t = longint;
   z_off_t = longint;
 
 
-  TAllocfunc = function (opaque:pointer; items:uInt; size:uInt):pointer;
-  TFreeFunc = procedure (opaque:pointer; address:pointer);
-
   TInternalState = record
   TInternalState = record
     end;
     end;
   PInternalState = ^TInternalstate;
   PInternalState = ^TInternalstate;
@@ -63,270 +57,282 @@ const
 
 
   Z_DEFLATED = 8;
   Z_DEFLATED = 8;
 
 
-  Z_NULL = 0;
-
-function zlibVersion:string;
-function deflate(var strm:TZstream; flush:longint):longint;
-function deflateEnd(var strm:TZstream):longint;
-function inflate(var strm:TZstream; flush:longint):longint;
-function inflateEnd(var strm:TZstream):longint;
-function deflateSetDictionary(var strm:TZstream;dictionary : pchar; dictLength:uInt):longint;
-function deflateCopy(var dest,source:TZstream):longint;
-function deflateReset(var strm:TZstream):longint;
-function deflateParams(var strm:TZstream; level:longint; strategy:longint):longint;
-function inflateSetDictionary(var strm:TZStream;dictionary : pchar; dictLength:uInt):longint;
-function inflateSync(var strm:TZStream):longint;
-function inflateReset(var strm:TZStream):longint;
-function compress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
-function compress2(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong; level:longint):longint;
-function uncompress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
-function gzopen(path:pchar; mode:pchar):gzFile;
-function gzsetparams(Thefile:gzFile; level:longint; strategy:longint):longint;
-function gzread(thefile:gzFile; buf : pointer; len:cardinal):longint;
-function gzwrite(thefile:gzFile; buf: pointer; len:cardinal):longint;
-function gzputs(thefile:gzFile; s:pchar):longint;
-function gzgets(thefile:gzFile; buf:pchar; len:longint):pchar;
-function gzputc(thefile:gzFile; c:char):longint;
-function gzgetc(thefile:gzFile):char;
-function gzflush(thefile:gzFile; flush:longint):longint;
-function gzseek(thefile:gzFile; offset:z_off_t; whence:longint):z_off_t;
-function gzrewind(thefile:gzFile):longint;
-function gztell(thefile:gzFile):z_off_t;
-function gzeof(thefile:gzFile):longbool;
-function gzclose(thefile:gzFile):longint;
-function gzerror(thefile:gzFile; var errnum:longint):string;
-function adler32(theadler:uLong;buf : pchar; len:uInt):uLong;
-function crc32(thecrc:uLong;buf : pchar; len:uInt):uLong;
-function deflateInit_(var strm:TZStream; level:longint; version:pchar; stream_size:longint):longint;
-function inflateInit_(var strm:TZStream; version:pchar; stream_size:longint):longint;
-function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:pchar; stream_size:longint):longint;
-function inflateInit2_(var strm:TZStream; windowBits:longint; version:pchar; stream_size:longint):longint;
-function deflateInit(var strm:TZStream;level : longint) : longint;
-function inflateInit(var strm:TZStream) : longint;
-function deflateInit2(var strm:TZStream;level,method,windowBits,memLevel,strategy : longint) : longint;
-function inflateInit2(var strm:TZStream; windowBits : longint) : longint;
-function zError(err:longint):string;
-function inflateSyncPoint(z:PZstream):longint;
-function get_crc_table:pointer;
+  Z_NULL = nil;
+
+function zlibVersion:string;inline;
+function deflate(var strm:TZstream; flush:longint):longint;inline;
+function deflateEnd(var strm:TZstream):longint;inline;
+function inflate(var strm:TZstream; flush:longint):longint;inline;
+function inflateEnd(var strm:TZstream):longint;inline;
+function deflateSetDictionary(var strm:TZstream;dictionary : Pchar; dictLength:cardinal):longint;inline;
+function deflateCopy(var dest,source:TZstream):longint;inline;
+function deflateReset(var strm:TZstream):longint;inline;
+function deflateParams(var strm:TZstream; level:longint; strategy:longint):longint;inline;
+function inflateSetDictionary(var strm:TZStream;dictionary : Pchar; dictLength:cardinal):longint;inline;
+function inflateSync(var strm:TZStream):longint;inline;
+function inflateReset(var strm:TZStream):longint;inline;
+function compress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
+function compress2(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal; level:longint):longint;
+function uncompress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
+function gzopen(path:Pchar; mode:Pchar):gzFile;inline;
+function gzsetparams(Thefile:gzFile; level:longint; strategy:longint):longint;inline;
+function gzread(thefile:gzFile; buf : pointer; len:cardinal):longint;inline;
+function gzwrite(thefile:gzFile; buf: pointer; len:cardinal):longint;inline;
+function gzputs(thefile:gzFile; s:Pchar):longint;inline;
+function gzgets(thefile:gzFile; buf:Pchar; len:longint):Pchar;inline;
+function gzputc(thefile:gzFile; c:char):longint;inline;
+function gzgetc(thefile:gzFile):char;inline;
+function gzflush(thefile:gzFile; flush:longint):longint;inline;
+function gzseek(thefile:gzFile; offset:z_off_t; whence:longint):z_off_t;inline;
+function gzrewind(thefile:gzFile):longint;inline;
+function gztell(thefile:gzFile):z_off_t;inline;
+function gzeof(thefile:gzFile):longbool;inline;
+function gzclose(thefile:gzFile):longint;inline;
+function gzerror(thefile:gzFile; var errnum:smallint):string;inline;
+function adler32(theadler:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
+function crc32(thecrc:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
+function deflateInit_(var strm:TZStream; level:longint; version:Pchar; stream_size:longint):longint;inline;
+function inflateInit_(var strm:TZStream; version:Pchar; stream_size:longint):longint;inline;
+function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:Pchar; stream_size:longint):longint;inline;
+function inflateInit2_(var strm:TZStream; windowBits:longint; version:Pchar; stream_size:longint):longint;inline;
+function deflateInit(var strm:TZStream;level : longint) : longint;inline;
+function inflateInit(var strm:TZStream) : longint;inline;
+function deflateInit2(var strm:TZStream;level,method,windowBits,memLevel,strategy : longint) : longint;inline;
+function inflateInit2(var strm:TZStream; windowBits : longint) : longint;inline;
+function zError(err:longint):string;inline;
+function inflateSyncPoint(z:PZstream):longint;inline;
+function get_crc_table:pointer;inline;
 
 
 implementation
 implementation
 
 
 uses
 uses
-  zutil,zdeflate,zinflate,zcompres,zuncompr,gzio,adler,gzcrc;
+  zdeflate,zinflate,zcompres,zuncompr,gzio,adler,crc;
 
 
-function zlibVersion:string;
+function zlibVersion:string;inline;
 begin
 begin
   zlibversion:=zbase.zlibversion;
   zlibversion:=zbase.zlibversion;
 end;
 end;
 
 
-function deflate(var strm:TZstream; flush:longint):longint;
+function deflate(var strm:TZstream; flush:longint):longint;inline;
 begin
 begin
   deflate:=zdeflate.deflate(strm,flush);
   deflate:=zdeflate.deflate(strm,flush);
 end;
 end;
 
 
-function deflateEnd(var strm:TZstream):longint;
+function deflateEnd(var strm:TZstream):longint;inline;
 begin
 begin
   deflateEnd:=zdeflate.deflateEnd(strm);
   deflateEnd:=zdeflate.deflateEnd(strm);
 end;
 end;
 
 
-function inflate(var strm:TZstream; flush:longint):longint;
+function inflate(var strm:TZstream; flush:longint):longint;inline;
 begin
 begin
   inflate:=zinflate.inflate(strm,flush);
   inflate:=zinflate.inflate(strm,flush);
 end;
 end;
 
 
-function inflateEnd(var strm:TZstream):longint;
+function inflateEnd(var strm:TZstream):longint;inline;
 begin
 begin
   inflateEnd:=zinflate.inflateEnd(strm);
   inflateEnd:=zinflate.inflateEnd(strm);
 end;
 end;
 
 
-function deflateSetDictionary(var strm:TZstream;dictionary : pchar; dictLength:uInt):longint;
+function deflateSetDictionary(var strm:TZstream;dictionary : Pchar; dictLength:cardinal):longint;inline;
 begin
 begin
-  deflateSetDictionary:=zdeflate.deflateSetDictionary(strm,pbytef(dictionary),dictlength);
+  deflateSetDictionary:=zdeflate.deflateSetDictionary(strm,Pbyte(dictionary),dictlength);
 end;
 end;
 
 
-function deflateCopy(var dest,source:TZstream):longint;
+function deflateCopy(var dest,source:TZstream):longint;inline;
 begin
 begin
   deflateCopy:=zdeflate.deflateCopy(@dest,@source);
   deflateCopy:=zdeflate.deflateCopy(@dest,@source);
 end;
 end;
 
 
-function deflateReset(var strm:TZstream):longint;
+function deflateReset(var strm:TZstream):longint;inline;
 begin
 begin
   deflateReset:=zdeflate.deflateReset(strm);
   deflateReset:=zdeflate.deflateReset(strm);
 end;
 end;
 
 
-function deflateParams(var strm:TZstream; level:longint; strategy:longint):longint;
+function deflateParams(var strm:TZstream; level:longint; strategy:longint):longint;inline;
 begin
 begin
   deflateParams:=zdeflate.deflateParams(strm,level,strategy);
   deflateParams:=zdeflate.deflateParams(strm,level,strategy);
 end;
 end;
 
 
-function inflateSetDictionary(var strm:TZStream;dictionary : pchar; dictLength:uInt):longint;
+function inflateSetDictionary(var strm:TZStream;dictionary : Pchar; dictLength:cardinal):longint;inline;
 begin
 begin
-  inflateSetDictionary:=zinflate.inflateSetDictionary(strm,pbytef(dictionary),dictlength);
+  inflateSetDictionary:=zinflate.inflateSetDictionary(strm,Pbyte(dictionary),dictlength);
 end;
 end;
 
 
-function inflateSync(var strm:TZStream):longint;
+function inflateSync(var strm:TZStream):longint;inline;
 begin
 begin
   inflateSync:=zinflate.inflateSync(strm);
   inflateSync:=zinflate.inflateSync(strm);
 end;
 end;
 
 
-function inflateReset(var strm:TZStream):longint;
+function inflateReset(var strm:TZStream):longint;inline;
 begin
 begin
   inflateReset:=zinflate.inflateReset(strm);
   inflateReset:=zinflate.inflateReset(strm);
 end;
 end;
 
 
-function compress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
+function compress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
+
+type Pbytearray=^Tbytearray;
+     Tbytearray=array[0..0] of byte;
+
 begin
 begin
-  compress:=zcompres.compress(pbytef(dest),destlen,pbytef(source),sourcelen);
+  compress:=zcompres.compress(Pbyte(dest),destlen,Pbytearray(source)^,sourcelen);
 end;
 end;
 
 
-function compress2(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong; level:longint):longint;
+function compress2(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal; level:longint):longint;
+
+type Pbytearray=^Tbytearray;
+     Tbytearray=array[0..0] of byte;
+
 begin
 begin
-  compress2:=zcompres.compress2(pbytef(dest),destlen,pbytef(source),sourcelen,level);
+  compress2:=zcompres.compress2(Pbyte(dest),destlen,Pbytearray(source)^,sourcelen,level);
 end;
 end;
 
 
-function uncompress(dest:pchar;var destLen:uLongf; source : pchar; sourceLen:uLong):longint;
+function uncompress(dest:Pchar;var destLen:cardinal; source : Pchar; sourceLen:cardinal):longint;
+
+type Pbytearray=^Tbytearray;
+     Tbytearray=array[0..0] of byte;
+
 begin
 begin
-  uncompress:=zuncompr.uncompress(pbytef(dest),destlen,pbytef(source),sourcelen);
+  uncompress:=zuncompr.uncompress(Pbyte(dest),destlen,Pbytearray(source)^,sourcelen);
 end;
 end;
 
 
-function gzopen(path:pchar; mode:pchar):gzFile;
+function gzopen(path:Pchar; mode:Pchar):gzFile;inline;
 begin
 begin
   gzopen:=gzio.gzopen(path,mode);
   gzopen:=gzio.gzopen(path,mode);
 end;
 end;
 
 
-function gzsetparams(Thefile:gzFile; level:longint; strategy:longint):longint;
+function gzsetparams(Thefile:gzFile; level:longint; strategy:longint):longint;inline;
 begin
 begin
   gzsetparams:=gzio.gzsetparams(thefile,level,strategy);
   gzsetparams:=gzio.gzsetparams(thefile,level,strategy);
 end;
 end;
 
 
-function gzread(thefile:gzFile; buf : pointer; len:cardinal):longint;
+function gzread(thefile:gzFile; buf : pointer; len:cardinal):longint;inline;
 begin
 begin
   gzread:=gzio.gzread(thefile,buf,len);
   gzread:=gzio.gzread(thefile,buf,len);
 end;
 end;
 
 
-function gzwrite(thefile:gzFile; buf: pointer; len:cardinal):longint;
+function gzwrite(thefile:gzFile; buf: pointer; len:cardinal):longint;inline;
 begin
 begin
   gzwrite:=gzio.gzwrite(thefile,buf,len);
   gzwrite:=gzio.gzwrite(thefile,buf,len);
 end;
 end;
 
 
-function gzputs(thefile:gzFile; s:pchar):longint;
+function gzputs(thefile:gzFile; s:Pchar):longint;inline;
 begin
 begin
   gzputs:=gzio.gzputs(thefile,s);
   gzputs:=gzio.gzputs(thefile,s);
 end;
 end;
 
 
-function gzgets(thefile:gzFile; buf:pchar; len:longint):pchar;
+function gzgets(thefile:gzFile; buf:Pchar; len:longint):Pchar;inline;
 begin
 begin
   gzgets:=gzio.gzgets(thefile,buf,len);
   gzgets:=gzio.gzgets(thefile,buf,len);
 end;
 end;
 
 
-function gzputc(thefile:gzFile; c:char):longint;
+function gzputc(thefile:gzFile; c:char):longint;inline;
 begin
 begin
   gzputc:=gzio.gzputc(thefile,c);
   gzputc:=gzio.gzputc(thefile,c);
 end;
 end;
 
 
-function gzgetc(thefile:gzFile):char;
+function gzgetc(thefile:gzFile):char;inline;
 begin
 begin
   gzgetc:=chr(gzio.gzgetc(thefile));
   gzgetc:=chr(gzio.gzgetc(thefile));
 end;
 end;
 
 
-function gzflush(thefile:gzFile; flush:longint):longint;
+function gzflush(thefile:gzFile; flush:longint):longint;inline;
 begin
 begin
   gzflush:=gzio.gzflush(thefile,flush);
   gzflush:=gzio.gzflush(thefile,flush);
 end;
 end;
 
 
-function gzseek(thefile:gzFile; offset:z_off_t; whence:longint):z_off_t;
+function gzseek(thefile:gzFile; offset:z_off_t; whence:longint):z_off_t;inline;
 begin
 begin
   gzseek:=gzio.gzseek(thefile,offset,whence);
   gzseek:=gzio.gzseek(thefile,offset,whence);
 end;
 end;
 
 
-function gzrewind(thefile:gzFile):longint;
+function gzrewind(thefile:gzFile):longint;inline;
 begin
 begin
   gzrewind:=gzio.gzrewind(thefile);
   gzrewind:=gzio.gzrewind(thefile);
 end;
 end;
 
 
-function gztell(thefile:gzFile):z_off_t;
+function gztell(thefile:gzFile):z_off_t;inline;
 begin
 begin
   gztell:=gzio.gztell(thefile);
   gztell:=gzio.gztell(thefile);
 end;
 end;
 
 
-function gzeof(thefile:gzFile):longbool;
+function gzeof(thefile:gzFile):longbool;inline;
 begin
 begin
   gzeof:=gzio.gzeof(thefile);
   gzeof:=gzio.gzeof(thefile);
 end;
 end;
 
 
-function gzclose(thefile:gzFile):longint;
+function gzclose(thefile:gzFile):longint;inline;
 begin
 begin
   gzclose:=gzio.gzclose(thefile);
   gzclose:=gzio.gzclose(thefile);
 end;
 end;
 
 
-function gzerror(thefile:gzFile; var errnum:longint):string;
+function gzerror(thefile:gzFile; var errnum:smallint):string;inline;
 begin
 begin
   gzerror:=gzio.gzerror(thefile,errnum);
   gzerror:=gzio.gzerror(thefile,errnum);
 end;
 end;
 
 
-function adler32(theadler:uLong;buf : pchar; len:uInt):uLong;
+function adler32(theadler:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
 begin
 begin
-  adler32:=adler.adler32(theadler,pbytef(buf),len);
+  adler32:=adler.adler32(theadler,Pbyte(buf),len);
 end;
 end;
 
 
-function crc32(thecrc:uLong;buf : pchar; len:uInt):uLong;
+function crc32(thecrc:cardinal;buf : Pchar; len:cardinal):cardinal;inline;
 begin
 begin
-  crc32:=gzcrc.crc32(thecrc,pbytef(buf),len);
+  crc32:=crc.crc32(thecrc,Pbyte(buf),len);
 end;
 end;
 
 
-function deflateInit_(var strm:TZStream; level:longint; version:pchar; stream_size:longint):longint;
+function deflateInit_(var strm:TZStream; level:longint; version:Pchar; stream_size:longint):longint;inline;
 begin
 begin
   deflateInit_:=zdeflate.deflateInit_(@strm,level,version,stream_size);
   deflateInit_:=zdeflate.deflateInit_(@strm,level,version,stream_size);
 end;
 end;
 
 
-function inflateInit_(var strm:TZStream; version:pchar; stream_size:longint):longint;
+function inflateInit_(var strm:TZStream; version:Pchar; stream_size:longint):longint;inline;
 begin
 begin
   inflateInit_:=zinflate.inflateInit_(@strm,version,stream_size);
   inflateInit_:=zinflate.inflateInit_(@strm,version,stream_size);
 end;
 end;
 
 
-function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:pchar; stream_size:longint):longint;
+function deflateInit2_(var strm:TZStream; level:longint; method:longint; windowBits:longint; memLevel:longint;strategy:longint; version:Pchar; stream_size:longint):longint;inline;
 begin
 begin
   deflateInit2_:=zdeflate.deflateInit2_(strm,level,method,windowBits,memlevel,strategy,version,stream_size);
   deflateInit2_:=zdeflate.deflateInit2_(strm,level,method,windowBits,memlevel,strategy,version,stream_size);
 end;
 end;
 
 
-function inflateInit2_(var strm:TZStream; windowBits:longint; version:pchar; stream_size:longint):longint;
+function inflateInit2_(var strm:TZStream; windowBits:longint; version:Pchar; stream_size:longint):longint;inline;
 begin
 begin
   inflateInit2_:=zinflate.inflateInit2_(strm,windowBits,version,stream_size);
   inflateInit2_:=zinflate.inflateInit2_(strm,windowBits,version,stream_size);
 end;
 end;
 
 
-function deflateInit(var strm:TZStream;level : longint) : longint;
+function deflateInit(var strm:TZStream;level : longint) : longint;inline;
 begin
 begin
   deflateInit:=zdeflate.deflateInit(strm,level);
   deflateInit:=zdeflate.deflateInit(strm,level);
 end;
 end;
 
 
-function inflateInit(var strm:TZStream) : longint;
+function inflateInit(var strm:TZStream) : longint;inline;
 begin
 begin
   inflateInit:=zinflate.inflateInit(strm);
   inflateInit:=zinflate.inflateInit(strm);
 end;
 end;
 
 
-function deflateInit2(var strm:TZStream;level,method,windowBits,memLevel,strategy : longint) : longint;
+function deflateInit2(var strm:TZStream;level,method,windowBits,memLevel,strategy : longint) : longint;inline;
 begin
 begin
   deflateInit2:=zdeflate.deflateInit2(strm,level,method,windowbits,memlevel,strategy);
   deflateInit2:=zdeflate.deflateInit2(strm,level,method,windowbits,memlevel,strategy);
 end;
 end;
 
 
-function inflateInit2(var strm:TZStream; windowBits : longint) : longint;
+function inflateInit2(var strm:TZStream; windowBits : longint) : longint;inline;
 begin
 begin
   inflateInit2:=zinflate.inflateInit2_(strm,windowBits,ZLIB_VERSION,sizeof(TZStream));
   inflateInit2:=zinflate.inflateInit2_(strm,windowBits,ZLIB_VERSION,sizeof(TZStream));
 end;
 end;
 
 
-function zError(err:longint):string;
+function zError(err:longint):string;inline;
 begin
 begin
   zerror:=zbase.zerror(err);
   zerror:=zbase.zerror(err);
 end;
 end;
 
 
-function inflateSyncPoint(z:PZstream):longint;
+function inflateSyncPoint(z:PZstream):longint;inline;
 begin
 begin
   inflateSyncPoint:=zinflate.inflateSyncPoint(z^);
   inflateSyncPoint:=zinflate.inflateSyncPoint(z^);
 end;
 end;
 
 
-function get_crc_table:pointer;
+function get_crc_table:pointer;inline;
 begin
 begin
-  get_crc_table:=gzcrc.get_crc_table;
+  get_crc_table:=crc.get_crc_table;
 end;
 end;
 
 
 end.
 end.

+ 27 - 16
packages/base/paszlib/readme.txt

@@ -4,7 +4,7 @@ PASZLIB 1.0                                                   May 11th, 1998
 
 
 Based on the zlib 1.1.2, a general purpose data compression library.
 Based on the zlib 1.1.2, a general purpose data compression library.
 
 
-Copyright (C) 1998 by NOMSSI NZALI Jacques H. C. 
+Copyright (C) 1998,1999,2000 by NOMSSI NZALI Jacques H. C. 
 [kn&n DES]         See "Legal issues" for conditions of distribution and use.
 [kn&n DES]         See "Legal issues" for conditions of distribution and use.
 _____________________________________________________________________________
 _____________________________________________________________________________
 
 
@@ -31,17 +31,23 @@ plus a few kilobytes for small objects.
 Change Log
 Change Log
 ==========
 ==========
 
 
-May 7th 1999   - Some changes for FPC
-                 deflateCopy() has new parameters
-                 trees.pas - record constant definition
-June 17th 1998 - Applied official 1.1.2 patch. 
-		 Memcheck turned off by default.
-                 zutil.pas patch for Delphi 1 memory allocation corrected.
-                 dzlib.txt file added.
-                 compress2() is now exported
-
-June 25th 1998 - fixed a conversion bug: in inftrees.pas, ZFREE(z, v) was
-                 missing in line 574;
+March 24th 2000 - minizip code by Gilles Vollant ported to Pascal. 
+                  z_stream.msg defined as string[255] to avoid problems
+                  with Delphi 2+ dynamic string handling.
+                  changes to silence Delphi 5 compiler warning. If you
+                  have Delphi 5, defines Delphi5 in zconf.inc
+                              
+May 7th 1999    - Some changes for FPC
+                  deflateCopy() has new parameters
+                  trees.pas - record constant definition
+June 17th 1998  - Applied official 1.1.2 patch. 
+	          Memcheck turned off by default.
+                  zutil.pas patch for Delphi 1 memory allocation corrected.
+                  dzlib.txt file added.
+                  compress2() is now exported
+
+June 25th 1998 -  fixed a conversion bug: in inftrees.pas, ZFREE(z, v) was
+                  missing in line 574;
 
 
 File list
 File list
 =========
 =========
@@ -65,7 +71,6 @@ infcodes.pas   process literals and length/distance pairs
 inffast.pas    process literals and length/distance pairs fast
 inffast.pas    process literals and length/distance pairs fast
 inftrees.pas   generate Huffman trees for efficient decoding
 inftrees.pas   generate Huffman trees for efficient decoding
 infutil.pas    types and macros common to blocks and codes
 infutil.pas    types and macros common to blocks and codes
-minigzip.pas   simulate gzip using the zlib compression library
 strutils.pas   string utilities
 strutils.pas   string utilities
 trees.pas      output deflated data using Huffman coding
 trees.pas      output deflated data using Huffman coding
 zcompres.pas   compress a memory buffer
 zcompres.pas   compress a memory buffer
@@ -75,15 +80,21 @@ zlib.pas       zlib data structures. read the comments there!
 zuncompr.pas   decompress a memory buffer
 zuncompr.pas   decompress a memory buffer
 zutil.pas
 zutil.pas
 
 
+minizip/ziputils.pas data structure and IO on .zip file 
+minizip/unzip.pas  
+minizip/zip.pas
+      
 Test applications
 Test applications
 
 
 example.pas    usage example of the zlib compression library
 example.pas    usage example of the zlib compression library
 minigzip.pas   simulate gzip using the zlib compression library
 minigzip.pas   simulate gzip using the zlib compression library
+minizip/miniunz.pas  simulates unzip using the zlib compression library
+minizip/minizip.pas  simulates zip using the zlib compression library
 
 
 Legal issues
 Legal issues
 ============
 ============
 
 
-Copyright (C) 1998 by Jacques Nomssi Nzali
+Copyright (C) 1998,1999,2000 by Jacques Nomssi Nzali
 
 
   This software is provided 'as-is', without any express or implied
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the author be held liable for any damages
   warranty.  In no event will the author be held liable for any damages
@@ -114,5 +125,5 @@ Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
 (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
 These documents are also available in other formats from
 These documents are also available in other formats from
 ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html.
 ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html.
-_____________________________________________________________________________
-Jacques Nomssi Nzali <mailto:[email protected]> May 7th, 1999
+____________________________________________________________________________
+Jacques Nomssi Nzali <mailto:[email protected]> March 24th, 2000

File diff suppressed because it is too large
+ 221 - 232
packages/base/paszlib/trees.pas


+ 83 - 72
packages/base/paszlib/zbase.pas

@@ -1,4 +1,4 @@
-Unit Zbase;
+unit zbase;
 
 
 
 
 { Original:
 { Original:
@@ -41,9 +41,6 @@ interface
 
 
 {$I zconf.inc}
 {$I zconf.inc}
 
 
-uses
-  zutil;
-
 { zconf.h -- configuration of the zlib compression library }
 { zconf.h -- configuration of the zlib compression library }
 { zutil.c -- target dependent utility functions for the compression library }
 { zutil.c -- target dependent utility functions for the compression library }
 
 
@@ -69,13 +66,19 @@ uses
 
 
 
 
 { Compile with -DMAXSEG_64K if the alloc function cannot allocate more
 { Compile with -DMAXSEG_64K if the alloc function cannot allocate more
-  than 64k bytes at a time (needed on systems with 16-bit int). }
+  than 64k bytes at a time (needed on systems with 16-bit integer). }
 
 
 { Maximum value for memLevel in deflateInit2 }
 { Maximum value for memLevel in deflateInit2 }
 {$ifdef MAXSEG_64K}
 {$ifdef MAXSEG_64K}
-const
-  MAX_MEM_LEVEL = 8;
-  DEF_MEM_LEVEL = MAX_MEM_LEVEL;  { default memLevel }
+  {$IFDEF VER70}
+  const
+    MAX_MEM_LEVEL = 7;
+    DEF_MEM_LEVEL = MAX_MEM_LEVEL;  { default memLevel }
+  {$ELSE}
+  const
+    MAX_MEM_LEVEL = 8;
+    DEF_MEM_LEVEL = MAX_MEM_LEVEL;  { default memLevel }
+  {$ENDIF}
 {$else}
 {$else}
 const
 const
   MAX_MEM_LEVEL = 9;
   MAX_MEM_LEVEL = 9;
@@ -84,11 +87,27 @@ const
 
 
 { Maximum value for windowBits in deflateInit2 and inflateInit2 }
 { Maximum value for windowBits in deflateInit2 and inflateInit2 }
 const
 const
+{$IFDEF VER70}
+  MAX_WBITS = 14; { 32K LZ77 window }
+{$ELSE}
   MAX_WBITS = 15; { 32K LZ77 window }
   MAX_WBITS = 15; { 32K LZ77 window }
+{$ENDIF}
+
 { default windowBits for decompression. MAX_WBITS is for compression only }
 { default windowBits for decompression. MAX_WBITS is for compression only }
 const
 const
   DEF_WBITS = MAX_WBITS;
   DEF_WBITS = MAX_WBITS;
 
 
+
+type  Pbytearray=^Tbytearray;
+      Pwordarray=^Twordarray;
+      Pcardinalarray=^Tcardinalarray;
+
+      Tbytearray = array [0..maxint div sizeof(byte)-1] of byte;
+      Twordarray = array [0..maxint div sizeof(word)-1] of word;
+      Tintegerarray = array [0..maxint div sizeof(integer)-1] of integer;
+      Tcardinalarray = array [0..maxint div sizeof(cardinal)-1] of cardinal;
+
+
 { The memory requirements for deflate are (in bytes):
 { The memory requirements for deflate are (in bytes):
             1 shl (windowBits+2)   +  1 shl (memLevel+9)
             1 shl (windowBits+2)   +  1 shl (memLevel+9)
  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
@@ -110,14 +129,14 @@ type
   inflate_huft = Record
   inflate_huft = Record
     Exop,             { number of extra bits or operation }
     Exop,             { number of extra bits or operation }
     bits : Byte;      { number of bits in this code or subcode }
     bits : Byte;      { number of bits in this code or subcode }
-    {pad : uInt;}       { pad structure to a power of 2 (4 bytes for }
-                      {  16-bit, 8 bytes for 32-bit int's) }
-    base : uInt;      { literal, length base, or distance base }
+    {pad : cardinal;}       { pad structure to a power of 2 (4 bytes for }
+                      {  16-bit, 8 bytes for 32-bit integer's) }
+    base : cardinal;      { literal, length base, or distance base }
                       { or table offset }
                       { or table offset }
   End;
   End;
 
 
 type
 type
-  huft_field = Array[0..(MaxInt div SizeOf(inflate_huft))-1] of inflate_huft;
+  huft_field = Array[0..(maxint div SizeOf(inflate_huft))-1] of inflate_huft;
   huft_ptr = ^huft_field;
   huft_ptr = ^huft_field;
 type
 type
   ppInflate_huft = ^pInflate_huft;
   ppInflate_huft = ^pInflate_huft;
@@ -143,17 +162,17 @@ type
     mode : inflate_codes_mode;        { current inflate_codes mode }
     mode : inflate_codes_mode;        { current inflate_codes mode }
 
 
     { mode dependent information }
     { mode dependent information }
-    len : uInt;
+    len : cardinal;
     sub : record                      { submode }
     sub : record                      { submode }
       Case Byte of
       Case Byte of
       0:(code : record                { if LEN or DIST, where in tree }
       0:(code : record                { if LEN or DIST, where in tree }
           tree : pInflate_huft;       { pointer into tree }
           tree : pInflate_huft;       { pointer into tree }
-          need : uInt;                { bits needed }
+          need : cardinal;                { bits needed }
          end);
          end);
-      1:(lit : uInt);                 { if LIT, literal }
+      1:(lit : cardinal);                 { if LIT, literal }
       2:(copy: record                 { if EXT or COPY, where and how much }
       2:(copy: record                 { if EXT or COPY, where and how much }
-           get : uInt;                { bits to get for extra }
-           dist : uInt;               { distance back to copy from }
+           get : cardinal;                { bits to get for extra }
+           dist : cardinal;               { distance back to copy from }
          end);
          end);
     end;
     end;
 
 
@@ -165,10 +184,10 @@ type
   end;
   end;
 
 
 type
 type
-  check_func = function(check : uLong;
-                        buf : pBytef;
+  check_func = function(check : cardinal;
+                        buf : Pbyte;
                         {const buf : array of byte;}
                         {const buf : array of byte;}
-                        len : uInt) : uLong;
+	                len : cardinal) : cardinal;
 type
 type
   inflate_block_mode =
   inflate_block_mode =
      (ZTYPE,    { get type bits (3, including end bit) }
      (ZTYPE,    { get type bits (3, including end bit) }
@@ -193,12 +212,12 @@ type
     { mode dependent information }
     { mode dependent information }
     sub : record                  { submode }
     sub : record                  { submode }
     case Byte of
     case Byte of
-    0:(left : uInt);              { if STORED, bytes left to copy }
+    0:(left : cardinal);              { if STORED, bytes left to copy }
     1:(trees : record             { if DTREE, decoding info for trees }
     1:(trees : record             { if DTREE, decoding info for trees }
-        table : uInt;               { table lengths (14 bits) }
-        index : uInt;               { index into blens (or border) }
-        blens : PuIntArray;         { bit lengths of codes }
-        bb : uInt;                  { bit length tree depth }
+        table : cardinal;               { table lengths (14 bits) }
+        index : cardinal;               { index into blens (or border) }
+        blens : Pcardinalarray;         { bit lengths of codes }
+        bb : cardinal;                  { bit length tree depth }
         tb : pInflate_huft;         { bit length decoding tree }
         tb : pInflate_huft;         { bit length decoding tree }
       end);
       end);
     2:(decode : record            { if CODES, current state }
     2:(decode : record            { if CODES, current state }
@@ -210,15 +229,15 @@ type
     last : boolean;               { true if this block is the last block }
     last : boolean;               { true if this block is the last block }
 
 
     { mode independent information }
     { mode independent information }
-    bitk : uInt;            { bits in bit buffer }
-    bitb : uLong;           { bit buffer }
+    bitk : cardinal;            { bits in bit buffer }
+    bitb : cardinal;           { bit buffer }
     hufts : huft_ptr; {pInflate_huft;}  { single malloc for tree space }
     hufts : huft_ptr; {pInflate_huft;}  { single malloc for tree space }
-    window : pBytef;        { sliding window }
-    zend : pBytef;          { one byte after sliding window }
-    read : pBytef;          { window read pointer }
-    write : pBytef;         { window write pointer }
+    window : Pbyte;        { sliding window }
+    zend : Pbyte;          { one byte after sliding window }
+    read : Pbyte;          { window read pointer }
+    write : Pbyte;         { window write pointer }
     checkfn : check_func;   { check function }
     checkfn : check_func;   { check function }
-    check : uLong;          { check on output }
+    check : cardinal;          { check on output }
   end;
   end;
 
 
 type
 type
@@ -248,50 +267,43 @@ type
      { mode dependent information }
      { mode dependent information }
      sub : record          { submode }
      sub : record          { submode }
        case byte of
        case byte of
-       0:(method : uInt);  { if FLAGS, method byte }
+       0:(method : cardinal);  { if FLAGS, method byte }
        1:(check : record   { if CHECK, check values to compare }
        1:(check : record   { if CHECK, check values to compare }
-           was : uLong;        { computed check value }
-           need : uLong;       { stream check value }
+           was : cardinal;        { computed check value }
+           need : cardinal;       { stream check value }
           end);
           end);
-       2:(marker : uInt);  { if BAD, inflateSync's marker bytes count }
+       2:(marker : cardinal);  { if BAD, inflateSync's marker bytes count }
      end;
      end;
 
 
      { mode independent information }
      { mode independent information }
      nowrap : boolean;      { flag for no wrapper }
      nowrap : boolean;      { flag for no wrapper }
-     wbits : uInt;          { log2(window size)  (8..15, defaults to 15) }
+     wbits : cardinal;          { log2(window size)  (8..15, defaults to 15) }
      blocks : pInflate_blocks_state;    { current inflate_blocks state }
      blocks : pInflate_blocks_state;    { current inflate_blocks state }
    end;
    end;
 
 
 type
 type
-  alloc_func = function(opaque : voidpf; items : uInt; size : uInt) : voidpf;
-  free_func = procedure(opaque : voidpf; address : voidpf);
+  alloc_func = function(opaque : pointer; items : cardinal; size : cardinal) : pointer;
+  free_func = procedure(opaque : pointer; address : pointer);
 
 
 type
 type
   z_streamp = ^z_stream;
   z_streamp = ^z_stream;
   z_stream = record
   z_stream = record
-    next_in : pBytef;     { next input byte }
-    avail_in : uInt;      { number of bytes available at next_in }
-    total_in : uLong;     { total nb of input bytes read so far }
+    next_in : Pbyte;     { next input byte }
+    avail_in : cardinal;      { number of bytes available at next_in }
+    total_in : cardinal;     { total nb of input bytes read so far }
 
 
-    next_out : pBytef;    { next output byte should be put there }
-    avail_out : uInt;     { remaining free space at next_out }
-    total_out : uLong;    { total nb of bytes output so far }
+    next_out : Pbyte;    { next output byte should be put there }
+    avail_out : cardinal;     { remaining free space at next_out }
+    total_out : cardinal;    { total nb of bytes output so far }
 
 
-    msg : string;         { last error message, '' if no error }
+    msg : string[255];         { last error message, '' if no error }
     state : pInternal_state; { not visible by applications }
     state : pInternal_state; { not visible by applications }
 
 
-    zalloc : alloc_func;  { used to allocate the internal state }
-    zfree : free_func;    { used to free the internal state }
-    opaque : voidpf;      { private data object passed to zalloc and zfree }
-
-    data_type : int;      { best guess about the data type: ascii or binary }
-    adler : uLong;        { adler32 value of the uncompressed data }
-    reserved : uLong;     { reserved for future use }
+    data_type : integer;      { best guess about the data type: ascii or binary }
+    adler : cardinal;        { adler32 value of the uncompressed data }
+    reserved : cardinal;     { reserved for future use }
   end;
   end;
-{$ifdef fpc}
-  TZStream = z_stream;
-  PZStream = ^TZStream;
-{$endif}
+
 
 
 {  The application must update next_in and avail_in when avail_in has
 {  The application must update next_in and avail_in when avail_in has
    dropped to zero. It must update next_out and avail_out when avail_out
    dropped to zero. It must update next_out and avail_out when avail_out
@@ -363,7 +375,7 @@ const  { constants }
 
 
   {$IFDEF GZIO}
   {$IFDEF GZIO}
 var
 var
-  errno : int;
+  errno : integer;
   {$ENDIF}
   {$ENDIF}
 
 
         { common constants }
         { common constants }
@@ -404,13 +416,13 @@ function zlibVersion : string;
   not compatible with the zlib.h header file used by the application.
   not compatible with the zlib.h header file used by the application.
   This check is automatically made by deflateInit and inflateInit. }
   This check is automatically made by deflateInit and inflateInit. }
 
 
-function zError(err : int) : string;
+function zError(err : integer) : string;
 
 
-function ZALLOC (var strm : z_stream; items : uInt; size : uInt) : voidpf;
+function ZALLOC (var strm : z_stream; items : cardinal; size : cardinal) : pointer;
 
 
-procedure ZFREE (var strm : z_stream; ptr : voidpf);
+procedure ZFREE (var strm : z_stream; ptr : pointer);
 
 
-procedure TRY_FREE (var strm : z_stream; ptr : voidpf);
+procedure TRY_FREE (var strm : z_stream; ptr : pointer);
 
 
 const
 const
   ZLIB_VERSION : string[10] = '1.1.2';
   ZLIB_VERSION : string[10] = '1.1.2';
@@ -429,7 +441,7 @@ const
             'incompatible version',{ Z_VERSION_ERROR (-6) }
             'incompatible version',{ Z_VERSION_ERROR (-6) }
             '');
             '');
 const
 const
-  z_verbose : int = 1;
+  z_verbose : integer = 1;
 
 
 {$IFDEF DEBUG}
 {$IFDEF DEBUG}
 procedure z_error (m : string);
 procedure z_error (m : string);
@@ -437,7 +449,7 @@ procedure z_error (m : string);
 
 
 implementation
 implementation
 
 
-function zError(err : int) : string;
+function zError(err : integer) : string;
 begin
 begin
   zError := z_errmsg[Z_NEED_DICT-err];
   zError := z_errmsg[Z_NEED_DICT-err];
 end;
 end;
@@ -496,20 +508,19 @@ begin
     WriteLn(x);
     WriteLn(x);
 end;
 end;
 
 
-function ZALLOC (var strm : z_stream; items : uInt; size : uInt) : voidpf;
+function ZALLOC (var strm : z_stream; items : cardinal; size : cardinal) : pointer;
 begin
 begin
-  ZALLOC := strm.zalloc(strm.opaque, items, size);
+  getmem(ZALLOC,items*size);
 end;
 end;
 
 
-procedure ZFREE (var strm : z_stream; ptr : voidpf);
+procedure ZFREE (var strm : z_stream; ptr : pointer);
 begin
 begin
-  strm.zfree(strm.opaque, ptr);
+  freemem(ptr);
 end;
 end;
 
 
-procedure TRY_FREE (var strm : z_stream; ptr : voidpf);
+procedure TRY_FREE (var strm : z_stream; ptr : pointer);
 begin
 begin
-  {if @strm <> Z_NULL then}
-    strm.zfree(strm.opaque, ptr);
+  freemem(ptr);
 end;
 end;
 
 
-end.
+end.

+ 26 - 30
packages/base/paszlib/zcompres.pas

@@ -13,15 +13,15 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  zutil, zbase, zDeflate;
+  zbase, zdeflate;
 
 
                         { utility functions }
                         { utility functions }
 
 
 {EXPORT}
 {EXPORT}
-function compress (dest : pBytef;
-                   var destLen : uLong;
-                   source : pBytef;
-                   sourceLen : uLong) : int;
+function compress (dest : Pbyte;
+                   var destLen : cardinal;
+                   const source : array of Byte;
+                   sourceLen : cardinal) : integer;
 
 
  { Compresses the source buffer into the destination buffer.  sourceLen is
  { Compresses the source buffer into the destination buffer.  sourceLen is
    the byte length of the source buffer. Upon entry, destLen is the total
    the byte length of the source buffer. Upon entry, destLen is the total
@@ -35,11 +35,11 @@ function compress (dest : pBytef;
    buffer. }
    buffer. }
 
 
 {EXPORT}
 {EXPORT}
-function compress2 (dest : pBytef;
-                    var destLen : uLong;
-                    source : pBytef;
-                    sourceLen : uLong;
-                    level : int) : int;
+function compress2 (dest : Pbyte;
+                    var destLen : cardinal;
+                    const source : array of byte;
+                    sourceLen : cardinal;
+                    level : integer) : integer;
 {  Compresses the source buffer into the destination buffer. The level
 {  Compresses the source buffer into the destination buffer. The level
    parameter has the same meaning as in deflateInit.  sourceLen is the byte
    parameter has the same meaning as in deflateInit.  sourceLen is the byte
    length of the source buffer. Upon entry, destLen is the total size of the
    length of the source buffer. Upon entry, destLen is the total size of the
@@ -54,37 +54,33 @@ implementation
 
 
 { ===========================================================================
 { ===========================================================================
 }
 }
-function compress2 (dest : pBytef;
-                    var destLen : uLong;
-                    source : pbytef;
-                    sourceLen : uLong;
-                    level : int) : int;
+function compress2 (dest : Pbyte;
+                    var destLen : cardinal;
+                    const source : array of byte;
+                    sourceLen : cardinal;
+                    level : integer) : integer;
 var
 var
   stream : z_stream;
   stream : z_stream;
-  err : int;
+  err : integer;
 begin
 begin
-  stream.next_in := source;
-  stream.avail_in := uInt(sourceLen);
+  stream.next_in := Pbyte(@source);
+  stream.avail_in := cardinal(sourceLen);
 {$ifdef MAXSEG_64K}
 {$ifdef MAXSEG_64K}
   { Check for source > 64K on 16-bit machine: }
   { Check for source > 64K on 16-bit machine: }
-  if (uLong(stream.avail_in) <> sourceLen) then
+  if (cardinal(stream.avail_in) <> sourceLen) then
   begin
   begin
     compress2 := Z_BUF_ERROR;
     compress2 := Z_BUF_ERROR;
     exit;
     exit;
   end;
   end;
 {$endif}
 {$endif}
   stream.next_out := dest;
   stream.next_out := dest;
-  stream.avail_out := uInt(destLen);
-  if (uLong(stream.avail_out) <> destLen) then
+  stream.avail_out := cardinal(destLen);
+  if (cardinal(stream.avail_out) <> destLen) then
   begin
   begin
     compress2 := Z_BUF_ERROR;
     compress2 := Z_BUF_ERROR;
     exit;
     exit;
   end;
   end;
 
 
-  stream.zalloc := NIL;       { alloc_func(0); }
-  stream.zfree := NIL;        { free_func(0); }
-  stream.opaque := NIL;       { voidpf(0); }
-
   err := deflateInit(stream, level);
   err := deflateInit(stream, level);
   if (err <> Z_OK) then
   if (err <> Z_OK) then
   begin
   begin
@@ -110,13 +106,13 @@ end;
 
 
 { ===========================================================================
 { ===========================================================================
  }
  }
-function compress (dest : pBytef;
-                   var destLen : uLong;
-                   source : pBytef;
-                   sourceLen : uLong) : int;
+function compress (dest : Pbyte;
+                   var destLen : cardinal;
+                   const source : array of Byte;
+                   sourceLen : cardinal) : integer;
 begin
 begin
   compress := compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
   compress := compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
 end;
 end;
 
 
 
 
-end.
+end.

+ 13 - 1
packages/base/paszlib/zconf.inc

@@ -6,6 +6,9 @@
   than 64k bytes at a time (needed on systems with 16-bit int). }
   than 64k bytes at a time (needed on systems with 16-bit int). }
 
 
 {- $DEFINE MAXSEG_64K}
 {- $DEFINE MAXSEG_64K}
+{$IFDEF VER70}
+  {$DEFINE MAXSEG_64K}
+{$ENDIF}
 {$IFNDEF WIN32}
 {$IFNDEF WIN32}
   {$DEFINE UNALIGNED_OK}  { requires SizeOf(ush) = 2 ! }
   {$DEFINE UNALIGNED_OK}  { requires SizeOf(ush) = 2 ! }
 {$ENDIF}
 {$ENDIF}
@@ -14,11 +17,20 @@
 {$UNDEF FASTEST}
 {$UNDEF FASTEST}
 {$define patch112}        { apply patch from the zlib home page }
 {$define patch112}        { apply patch from the zlib home page }
 { -------------------------------------------------------------------- }
 { -------------------------------------------------------------------- }
+{$IFDEF WIN32}
+  {$DEFINE Delphi32}
+  {- $DEFINE Delphi5}  { keep compiler quiet }
+{$ENDIF}
+
+{$IFDEF DPMI}
+  {$DEFINE MSDOS}
+{$ENDIF}
+
 {$IFDEF FPC}
 {$IFDEF FPC}
  {$DEFINE Use32}
  {$DEFINE Use32}
  {$UNDEF DPMI}
  {$UNDEF DPMI}
  {$UNDEF MSDOS}
  {$UNDEF MSDOS}
  {$UNDEF UNALIGNED_OK}  { requires SizeOf(ush) = 2 ! }
  {$UNDEF UNALIGNED_OK}  { requires SizeOf(ush) = 2 ! }
  {$UNDEF MAXSEG_64K}
  {$UNDEF MAXSEG_64K}
+ {$UNDEF Delphi32}
 {$ENDIF}
 {$ENDIF}
-

File diff suppressed because it is too large
+ 223 - 237
packages/base/paszlib/zdeflate.pas


+ 106 - 117
packages/base/paszlib/zinflate.pas

@@ -1,4 +1,4 @@
-Unit  zInflate;
+unit  zinflate;
 
 
 {  inflate.c -- zlib interface to inflate modules
 {  inflate.c -- zlib interface to inflate modules
    Copyright (C) 1995-1998 Mark Adler
    Copyright (C) 1995-1998 Mark Adler
@@ -13,9 +13,9 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  zutil, zbase, infblock, infutil;
+  zbase, infblock, infutil;
 
 
-function inflateInit(var z : z_stream) : int;
+function inflateInit(var z : z_stream) : integer;
 
 
 {    Initializes the internal stream state for decompression. The fields
 {    Initializes the internal stream state for decompression. The fields
    zalloc, zfree and opaque must be initialized before by the caller.  If
    zalloc, zfree and opaque must be initialized before by the caller.  If
@@ -32,13 +32,17 @@ function inflateInit(var z : z_stream) : int;
 
 
 function inflateInit_(z : z_streamp;
 function inflateInit_(z : z_streamp;
                       const version : string;
                       const version : string;
-                      stream_size : int) : int;
+                      stream_size : integer) : integer;
 
 
 
 
 function inflateInit2_(var z: z_stream;
 function inflateInit2_(var z: z_stream;
-                       w : int;
+                       w : integer;
                        const version : string;
                        const version : string;
-                       stream_size : int) : int;
+                       stream_size : integer) : integer;
+
+function inflateInit2(var z: z_stream;
+                       windowBits : integer) : integer;
+
 {
 {
      This is another version of inflateInit with an extra parameter. The
      This is another version of inflateInit with an extra parameter. The
    fields next_in, avail_in, zalloc, zfree and opaque must be initialized
    fields next_in, avail_in, zalloc, zfree and opaque must be initialized
@@ -61,7 +65,7 @@ function inflateInit2_(var z: z_stream;
 
 
 
 
 
 
-function inflateEnd(var z : z_stream) : int;
+function inflateEnd(var z : z_stream) : integer;
 
 
 {
 {
    All dynamically allocated data structures for this stream are freed.
    All dynamically allocated data structures for this stream are freed.
@@ -73,7 +77,7 @@ function inflateEnd(var z : z_stream) : int;
    static string (which must not be deallocated).
    static string (which must not be deallocated).
 }
 }
 
 
-function inflateReset(var z : z_stream) : int;
+function inflateReset(var z : z_stream) : integer;
 
 
 {
 {
    This function is equivalent to inflateEnd followed by inflateInit,
    This function is equivalent to inflateEnd followed by inflateInit,
@@ -86,7 +90,7 @@ function inflateReset(var z : z_stream) : int;
 
 
 
 
 function inflate(var z : z_stream;
 function inflate(var z : z_stream;
-                 f : int) : int;
+                 f : integer) : integer;
 {
 {
   inflate decompresses as much data as possible, and stops when the input
   inflate decompresses as much data as possible, and stops when the input
   buffer becomes empty or the output buffer becomes full. It may introduce
   buffer becomes empty or the output buffer becomes full. It may introduce
@@ -134,7 +138,7 @@ function inflate(var z : z_stream;
 
 
      If a preset dictionary is needed at this point (see inflateSetDictionary
      If a preset dictionary is needed at this point (see inflateSetDictionary
   below), inflate sets strm-adler to the adler32 checksum of the
   below), inflate sets strm-adler to the adler32 checksum of the
-  dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise
+  dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise 
   it sets strm->adler to the adler32 checksum of all output produced
   it sets strm->adler to the adler32 checksum of all output produced
   so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
   so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or
   an error code as described below. At the end of the stream, inflate()
   an error code as described below. At the end of the stream, inflate()
@@ -156,8 +160,8 @@ function inflate(var z : z_stream;
 
 
 
 
 function inflateSetDictionary(var z : z_stream;
 function inflateSetDictionary(var z : z_stream;
-                              dictionary : pBytef; {const array of byte}
-                              dictLength : uInt) : int;
+                              dictionary : Pbyte; {const array of byte}
+                              dictLength : cardinal) : integer;
 
 
 {
 {
      Initializes the decompression dictionary from the given uncompressed byte
      Initializes the decompression dictionary from the given uncompressed byte
@@ -175,7 +179,7 @@ function inflateSetDictionary(var z : z_stream;
    inflate().
    inflate().
 }
 }
 
 
-function inflateSync(var z : z_stream) : int;
+function inflateSync(var z : z_stream) : integer;
 
 
 {
 {
   Skips invalid compressed data until a full flush point (see above the
   Skips invalid compressed data until a full flush point (see above the
@@ -192,7 +196,7 @@ function inflateSync(var z : z_stream) : int;
 }
 }
 
 
 
 
-function inflateSyncPoint(var z : z_stream) : int;
+function inflateSyncPoint(var z : z_stream) : integer;
 
 
 
 
 implementation
 implementation
@@ -200,7 +204,7 @@ implementation
 uses
 uses
   adler;
   adler;
 
 
-function inflateReset(var z : z_stream) : int;
+function inflateReset(var z : z_stream) : integer;
 begin
 begin
   if (z.state = Z_NULL) then
   if (z.state = Z_NULL) then
   begin
   begin
@@ -222,9 +226,9 @@ begin
 end;
 end;
 
 
 
 
-function inflateEnd(var z : z_stream) : int;
+function inflateEnd(var z : z_stream) : integer;
 begin
 begin
-  if (z.state = Z_NULL) or not Assigned(z.zfree) then
+  if z.state=nil then
   begin
   begin
     inflateEnd :=  Z_STREAM_ERROR;
     inflateEnd :=  Z_STREAM_ERROR;
     exit;
     exit;
@@ -241,9 +245,9 @@ end;
 
 
 
 
 function inflateInit2_(var z: z_stream;
 function inflateInit2_(var z: z_stream;
-                       w : int;
+                       w : integer;
                        const version : string;
                        const version : string;
-                       stream_size : int) : int;
+                       stream_size : integer) : integer;
 begin
 begin
   if (version = '') or (version[1] <> ZLIB_VERSION[1]) or
   if (version = '') or (version[1] <> ZLIB_VERSION[1]) or
       (stream_size <> sizeof(z_stream)) then
       (stream_size <> sizeof(z_stream)) then
@@ -254,31 +258,15 @@ begin
   { initialize state }
   { initialize state }
   { SetLength(strm.msg, 255); }
   { SetLength(strm.msg, 255); }
   z.msg := '';
   z.msg := '';
-{$ifdef fpc}
-  if not Assigned(z.zalloc) then
-  begin
-    z.zalloc := @zcalloc;
-    z.opaque := voidpf(0);
-  end;
-  if not Assigned(z.zfree) then
-    z.zfree := @zcfree;
-{$else}
-  if not Assigned(z.zalloc) then
-  begin
-    z.zalloc := zcalloc;
-    z.opaque := voidpf(0);
-  end;
-  if not Assigned(z.zfree) then
-    z.zfree := zcfree;
-{$endif}
+
   z.state := pInternal_state( ZALLOC(z,1,sizeof(internal_state)) );
   z.state := pInternal_state( ZALLOC(z,1,sizeof(internal_state)) );
-  if (z.state = Z_NULL) then
+  if z.state=nil then
   begin
   begin
     inflateInit2_ := Z_MEM_ERROR;
     inflateInit2_ := Z_MEM_ERROR;
     exit;
     exit;
   end;
   end;
 
 
-  z.state^.blocks := Z_NULL;
+  z.state^.blocks := nil;
 
 
   { handle undocumented nowrap option (no zlib header or check) }
   { handle undocumented nowrap option (no zlib header or check) }
   z.state^.nowrap := FALSE;
   z.state^.nowrap := FALSE;
@@ -295,17 +283,13 @@ begin
     inflateInit2_ := Z_STREAM_ERROR;
     inflateInit2_ := Z_STREAM_ERROR;
     exit;
     exit;
   end;
   end;
-  z.state^.wbits := uInt(w);
+  z.state^.wbits := cardinal(w);
 
 
   { create inflate_blocks state }
   { create inflate_blocks state }
   if z.state^.nowrap then
   if z.state^.nowrap then
-    z.state^.blocks := inflate_blocks_new(z, NIL, uInt(1) shl w)
+    z.state^.blocks := inflate_blocks_new(z, nil, cardinal(1) shl w)
   else
   else
-{$ifdef fpc}
-    z.state^.blocks := inflate_blocks_new(z, @adler32, uInt(1) shl w);
-{$else}
-    z.state^.blocks := inflate_blocks_new(z, adler32, uInt(1) shl w);
-{$endif}
+    z.state^.blocks := inflate_blocks_new(z, @adler32, cardinal(1) shl w);
   if (z.state^.blocks = Z_NULL) then
   if (z.state^.blocks = Z_NULL) then
   begin
   begin
     inflateEnd(z);
     inflateEnd(z);
@@ -320,17 +304,22 @@ begin
   inflateInit2_ :=  Z_OK;
   inflateInit2_ :=  Z_OK;
 end;
 end;
 
 
-function inflateInit(var z : z_stream) : int;
+function inflateInit2(var z: z_stream; windowBits : integer) : integer;
+begin
+  inflateInit2 := inflateInit2_(z, windowBits, ZLIB_VERSION, sizeof(z_stream));
+end;
+
+
+function inflateInit(var z : z_stream) : integer;
 { inflateInit is a macro to allow checking the zlib version
 { inflateInit is a macro to allow checking the zlib version
-  and the compiler's view of z_stream:
-  }
+  and the compiler's view of z_stream:  }
 begin
 begin
   inflateInit := inflateInit2_(z, DEF_WBITS, ZLIB_VERSION, sizeof(z_stream));
   inflateInit := inflateInit2_(z, DEF_WBITS, ZLIB_VERSION, sizeof(z_stream));
 end;
 end;
 
 
 function inflateInit_(z : z_streamp;
 function inflateInit_(z : z_streamp;
                       const version : string;
                       const version : string;
-                      stream_size : int) : int;
+                      stream_size : integer) : integer;
 begin
 begin
   { initialize state }
   { initialize state }
   if (z = Z_NULL) then
   if (z = Z_NULL) then
@@ -340,10 +329,10 @@ begin
 end;
 end;
 
 
 function inflate(var z : z_stream;
 function inflate(var z : z_stream;
-                 f : int) : int;
+                 f : integer) : integer;
 var
 var
-  r : int;
-  b : uInt;
+  r : integer;
+  b : cardinal;
 begin
 begin
   if (z.state = Z_NULL) or (z.next_in = Z_NULL) then
   if (z.state = Z_NULL) or (z.next_in = Z_NULL) then
   begin
   begin
@@ -392,11 +381,11 @@ begin
         end;
         end;
         r := f;
         r := f;
 
 
-        {z.state^.sub.check.need := uLong(NEXTBYTE(z)) shl 24;}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        z.state^.sub.check.need := uLong(z.next_in^) shl 24;
-        Inc(z.next_in);
+        {z.state^.sub.check.need := cardinal(NEXTBYTE(z)) shl 24;}
+        dec(z.avail_in);
+        inc(z.total_in);
+        z.state^.sub.check.need := cardinal(z.next_in^) shl 24;
+        inc(z.next_in);
 
 
         z.state^.mode := CHECK3;   { falltrough }
         z.state^.mode := CHECK3;   { falltrough }
       end;
       end;
@@ -409,11 +398,11 @@ begin
           exit;
           exit;
         end;
         end;
         r := f;
         r := f;
-        {Inc( z.state^.sub.check.need, uLong(NEXTBYTE(z)) shl 16);}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        Inc(z.state^.sub.check.need, uLong(z.next_in^) shl 16);
-        Inc(z.next_in);
+        {inc( z.state^.sub.check.need, cardinal(NEXTBYTE(z)) shl 16);}
+        dec(z.avail_in);
+        inc(z.total_in);
+        inc(z.state^.sub.check.need, cardinal(z.next_in^) shl 16);
+        inc(z.next_in);
 
 
         z.state^.mode := CHECK2;   { falltrough }
         z.state^.mode := CHECK2;   { falltrough }
       end;
       end;
@@ -427,11 +416,11 @@ begin
         end;
         end;
         r := f;
         r := f;
 
 
-        {Inc( z.state^.sub.check.need, uLong(NEXTBYTE(z)) shl 8);}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        Inc(z.state^.sub.check.need, uLong(z.next_in^) shl 8);
-        Inc(z.next_in);
+        {inc( z.state^.sub.check.need, cardinal(NEXTBYTE(z)) shl 8);}
+        dec(z.avail_in);
+        inc(z.total_in);
+        inc(z.state^.sub.check.need, cardinal(z.next_in^) shl 8);
+        inc(z.next_in);
 
 
         z.state^.mode := CHECK1;   { falltrough }
         z.state^.mode := CHECK1;   { falltrough }
       end;
       end;
@@ -444,11 +433,11 @@ begin
           exit;
           exit;
         end;
         end;
         r := f;
         r := f;
-        {Inc( z.state^.sub.check.need, uLong(NEXTBYTE(z)) );}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        Inc(z.state^.sub.check.need, uLong(z.next_in^) );
-        Inc(z.next_in);
+        {inc( z.state^.sub.check.need, cardinal(NEXTBYTE(z)) );}
+        dec(z.avail_in);
+        inc(z.total_in);
+        inc(z.state^.sub.check.need, cardinal(z.next_in^) );
+        inc(z.next_in);
 
 
 
 
         if (z.state^.sub.check.was <> z.state^.sub.check.need) then
         if (z.state^.sub.check.was <> z.state^.sub.check.need) then
@@ -479,10 +468,10 @@ begin
         r := f; {}
         r := f; {}
 
 
         {z.state^.sub.method := NEXTBYTE(z);}
         {z.state^.sub.method := NEXTBYTE(z);}
-        Dec(z.avail_in);
-        Inc(z.total_in);
+        dec(z.avail_in);
+        inc(z.total_in);
         z.state^.sub.method := z.next_in^;
         z.state^.sub.method := z.next_in^;
-        Inc(z.next_in);
+        inc(z.next_in);
 
 
         if ((z.state^.sub.method and $0f) <> Z_DEFLATED) then
         if ((z.state^.sub.method and $0f) <> Z_DEFLATED) then
         begin
         begin
@@ -511,10 +500,10 @@ begin
         end;
         end;
         r := f; {}
         r := f; {}
         {b := NEXTBYTE(z);}
         {b := NEXTBYTE(z);}
-        Dec(z.avail_in);
-        Inc(z.total_in);
+        dec(z.avail_in);
+        inc(z.total_in);
         b := z.next_in^;
         b := z.next_in^;
-        Inc(z.next_in);
+        inc(z.next_in);
 
 
         if (((z.state^.sub.method shl 8) + b) mod 31) <> 0 then {% mod ?}
         if (((z.state^.sub.method shl 8) + b) mod 31) <> 0 then {% mod ?}
         begin
         begin
@@ -529,7 +518,7 @@ begin
         if ((b and PRESET_DICT) = 0) then
         if ((b and PRESET_DICT) = 0) then
         begin
         begin
           z.state^.mode := BLOCKS;
           z.state^.mode := BLOCKS;
-          continue;      { break C-switch }
+	  continue;      { break C-switch }
         end;
         end;
         z.state^.mode := DICT4;
         z.state^.mode := DICT4;
         { falltrough }
         { falltrough }
@@ -543,11 +532,11 @@ begin
         end;
         end;
         r := f;
         r := f;
 
 
-        {z.state^.sub.check.need := uLong(NEXTBYTE(z)) shl 24;}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        z.state^.sub.check.need :=  uLong(z.next_in^) shl 24;
-        Inc(z.next_in);
+        {z.state^.sub.check.need := cardinal(NEXTBYTE(z)) shl 24;}
+        dec(z.avail_in);
+        inc(z.total_in);
+        z.state^.sub.check.need :=  cardinal(z.next_in^) shl 24;
+        inc(z.next_in);
 
 
         z.state^.mode := DICT3;        { falltrough }
         z.state^.mode := DICT3;        { falltrough }
       end;
       end;
@@ -559,11 +548,11 @@ begin
           exit;
           exit;
         end;
         end;
         r := f;
         r := f;
-        {Inc(z.state^.sub.check.need, uLong(NEXTBYTE(z)) shl 16);}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        Inc(z.state^.sub.check.need, uLong(z.next_in^) shl 16);
-        Inc(z.next_in);
+        {inc(z.state^.sub.check.need, cardinal(NEXTBYTE(z)) shl 16);}
+        dec(z.avail_in);
+        inc(z.total_in);
+        inc(z.state^.sub.check.need, cardinal(z.next_in^) shl 16);
+        inc(z.next_in);
 
 
         z.state^.mode := DICT2;        { falltrough }
         z.state^.mode := DICT2;        { falltrough }
       end;
       end;
@@ -576,11 +565,11 @@ begin
         end;
         end;
         r := f;
         r := f;
 
 
-        {Inc(z.state^.sub.check.need, uLong(NEXTBYTE(z)) shl 8);}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        Inc(z.state^.sub.check.need, uLong(z.next_in^) shl 8);
-        Inc(z.next_in);
+        {inc(z.state^.sub.check.need, cardinal(NEXTBYTE(z)) shl 8);}
+        dec(z.avail_in);
+        inc(z.total_in);
+        inc(z.state^.sub.check.need, cardinal(z.next_in^) shl 8);
+        inc(z.next_in);
 
 
         z.state^.mode := DICT1;        { falltrough }
         z.state^.mode := DICT1;        { falltrough }
       end;
       end;
@@ -592,11 +581,11 @@ begin
           exit;
           exit;
         end;
         end;
         { r := f;    ---  wird niemals benutzt }
         { r := f;    ---  wird niemals benutzt }
-        {Inc(z.state^.sub.check.need, uLong(NEXTBYTE(z)) );}
-        Dec(z.avail_in);
-        Inc(z.total_in);
-        Inc(z.state^.sub.check.need, uLong(z.next_in^) );
-        Inc(z.next_in);
+        {inc(z.state^.sub.check.need, cardinal(NEXTBYTE(z)) );}
+        dec(z.avail_in);
+        inc(z.total_in);
+        inc(z.state^.sub.check.need, cardinal(z.next_in^) );
+        inc(z.next_in);
 
 
         z.adler := z.state^.sub.check.need;
         z.adler := z.state^.sub.check.need;
         z.state^.mode := DICT0;
         z.state^.mode := DICT0;
@@ -628,10 +617,10 @@ begin
 end;
 end;
 
 
 function inflateSetDictionary(var z : z_stream;
 function inflateSetDictionary(var z : z_stream;
-                              dictionary : pBytef; {const array of byte}
-                              dictLength : uInt) : int;
+                              dictionary : Pbyte; {const array of byte}
+                              dictLength : cardinal) : integer;
 var
 var
-  length : uInt;
+  length : cardinal;
 begin
 begin
   length := dictLength;
   length := dictLength;
 
 
@@ -640,17 +629,17 @@ begin
     inflateSetDictionary := Z_STREAM_ERROR;
     inflateSetDictionary := Z_STREAM_ERROR;
     exit;
     exit;
   end;
   end;
-  if (adler32(Long(1), dictionary, dictLength) <> z.adler) then
+  if (adler32(1, dictionary, dictLength) <> z.adler) then
   begin
   begin
     inflateSetDictionary := Z_DATA_ERROR;
     inflateSetDictionary := Z_DATA_ERROR;
     exit;
     exit;
   end;
   end;
-  z.adler := Long(1);
+  z.adler := 1;
 
 
-  if (length >= (uInt(1) shl z.state^.wbits)) then
+  if (length >= (1 shl z.state^.wbits)) then
   begin
   begin
     length := (1 shl z.state^.wbits)-1;
     length := (1 shl z.state^.wbits)-1;
-    Inc( dictionary, dictLength - length);
+    inc( dictionary, dictLength - length);
   end;
   end;
   inflate_set_dictionary(z.state^.blocks^, dictionary^, length);
   inflate_set_dictionary(z.state^.blocks^, dictionary^, length);
   z.state^.mode := BLOCKS;
   z.state^.mode := BLOCKS;
@@ -658,14 +647,14 @@ begin
 end;
 end;
 
 
 
 
-function inflateSync(var z : z_stream) : int;
+function inflateSync(var z : z_stream) : integer;
 const
 const
   mark : packed array[0..3] of byte = (0, 0, $ff, $ff);
   mark : packed array[0..3] of byte = (0, 0, $ff, $ff);
 var
 var
-  n : uInt;       { number of bytes to look at }
-  p : pBytef;     { pointer to bytes }
-  m : uInt;       { number of marker bytes found in a row }
-  r, w : uLong;   { temporaries to save total_in and total_out }
+  n : cardinal;       { number of bytes to look at }
+  p : Pbyte;     { pointer to bytes }
+  m : cardinal;       { number of marker bytes found in a row }
+  r, w : cardinal;   { temporaries to save total_in and total_out }
 begin
 begin
   { set up }
   { set up }
   if (z.state = Z_NULL) then
   if (z.state = Z_NULL) then
@@ -691,18 +680,18 @@ begin
   while (n <> 0) and (m < 4) do
   while (n <> 0) and (m < 4) do
   begin
   begin
     if (p^ = mark[m]) then
     if (p^ = mark[m]) then
-      Inc(m)
+      inc(m)
     else
     else
       if (p^ <> 0) then
       if (p^ <> 0) then
         m := 0
         m := 0
       else
       else
         m := 4 - m;
         m := 4 - m;
-    Inc(p);
-    Dec(n);
+    inc(p);
+    dec(n);
   end;
   end;
 
 
   { restore }
   { restore }
-  Inc(z.total_in, ptr2int(p) - ptr2int(z.next_in));
+  inc(z.total_in, ptrint(p) - ptrint(z.next_in));
   z.next_in := p;
   z.next_in := p;
   z.avail_in := n;
   z.avail_in := n;
   z.state^.sub.marker := m;
   z.state^.sub.marker := m;
@@ -733,9 +722,9 @@ end;
   waiting for these length bytes.
   waiting for these length bytes.
 }
 }
 
 
-function inflateSyncPoint(var z : z_stream) : int;
+function inflateSyncPoint(var z : z_stream) : integer;
 begin
 begin
-  if (z.state = Z_NULL) or (z.state^.blocks = Z_NULL) then
+  if (z.state = nil) or (z.state^.blocks = nil) then
   begin
   begin
     inflateSyncPoint := Z_STREAM_ERROR;
     inflateSyncPoint := Z_STREAM_ERROR;
     exit;
     exit;

+ 17 - 20
packages/base/paszlib/zuncompr.pas

@@ -1,4 +1,4 @@
-Unit zUnCompr;
+unit zuncompr;
 
 
 { uncompr.c -- decompress a memory buffer
 { uncompr.c -- decompress a memory buffer
   Copyright (C) 1995-1998 Jean-loup Gailly.
   Copyright (C) 1995-1998 Jean-loup Gailly.
@@ -13,7 +13,7 @@ interface
 {$I zconf.inc}
 {$I zconf.inc}
 
 
 uses
 uses
-  zutil, zbase, zInflate;
+  zbase, zinflate;
 
 
 { ===========================================================================
 { ===========================================================================
      Decompresses the source buffer into the destination buffer.  sourceLen is
      Decompresses the source buffer into the destination buffer.  sourceLen is
@@ -31,41 +31,38 @@ uses
    buffer, or Z_DATA_ERROR if the input data was corrupted.
    buffer, or Z_DATA_ERROR if the input data was corrupted.
 }
 }
 
 
-function uncompress (dest : pBytef;
-                     var destLen : uLong;
-                     source : pBytef;
-                     sourceLen : uLong) : int;
+function uncompress (dest : Pbyte;
+                     var destLen : cardinal;
+                     const source : array of byte;
+                     sourceLen : cardinal) : integer;
 
 
 implementation
 implementation
 
 
-function uncompress (dest : pBytef;
-                     var destLen : uLong;
-                     source : pBytef;
-                     sourceLen : uLong) : int;
+function uncompress (dest : Pbyte;
+                     var destLen : cardinal;
+                     const source : array of byte;
+                     sourceLen : cardinal) : integer;
 var
 var
   stream : z_stream;
   stream : z_stream;
-  err : int;
+  err : integer;
 begin
 begin
-  stream.next_in := source;
-  stream.avail_in := uInt(sourceLen);
+  stream.next_in := Pbyte(@source);
+  stream.avail_in := cardinal(sourceLen);
   { Check for source > 64K on 16-bit machine: }
   { Check for source > 64K on 16-bit machine: }
-  if (uLong(stream.avail_in) <> sourceLen) then
+  if (cardinal(stream.avail_in) <> sourceLen) then
   begin
   begin
     uncompress := Z_BUF_ERROR;
     uncompress := Z_BUF_ERROR;
     exit;
     exit;
   end;
   end;
 
 
   stream.next_out := dest;
   stream.next_out := dest;
-  stream.avail_out := uInt(destLen);
-  if (uLong(stream.avail_out) <> destLen) then
+  stream.avail_out := cardinal(destLen);
+  if (cardinal(stream.avail_out) <> destLen) then
   begin
   begin
     uncompress := Z_BUF_ERROR;
     uncompress := Z_BUF_ERROR;
     exit;
     exit;
   end;
   end;
 
 
-  stream.zalloc := NIL;       { alloc_func(0); }
-  stream.zfree := NIL;        { free_func(0); }
-
   err := inflateInit(stream);
   err := inflateInit(stream);
   if (err <> Z_OK) then
   if (err <> Z_OK) then
   begin
   begin
@@ -89,4 +86,4 @@ begin
   uncompress := err;
   uncompress := err;
 end;
 end;
 
 
-end.
+end.

+ 0 - 516
packages/base/paszlib/zutil.pas

@@ -1,516 +0,0 @@
-Unit ZUtil;
-
-{
-  Copyright (C) 1998 by Jacques Nomssi Nzali
-  For conditions of distribution and use, see copyright notice in readme.txt
-}
-
-interface
-
-{$I zconf.inc}
-
-{ Type declarations }
-
-type
-  {Byte   = usigned char;  8 bits}
-  Bytef  = byte;
-  charf  = byte;
-
-{$IFDEF FPC}
-  int    = longint;
-{$ELSE}
-  int    = integer;
-{$ENDIF}
-
-  intf   = int;
-{$IFDEF FPC}
-  uInt = Cardinal;     { 16 bits or more }
-{$ELSE}
-  {$IFDEF MSDOS}
-    uInt   = Word;
-  {$ENDIF}
-{$ENDIF}
-  uIntf  = uInt;
-
-  Long   = longint;
-{$ifdef FPC}
-  uLong  = Cardinal;
-{$else}
-  uLong  = LongInt;      { 32 bits or more }
-{$endif}
-  uLongf = uLong;
-
-  voidp  = pointer;
-  voidpf = voidp;
-  pBytef = ^Bytef;
-  pIntf  = ^intf;
-  puIntf = ^uIntf;
-  puLong = ^uLongf;
-
-  ptr2int = uInt;
-{ a pointer to integer casting is used to do pointer arithmetic.
-  ptr2int must be an integer type and sizeof(ptr2int) must be less
-  than sizeof(pointer) - Nomssi }
-
-type
-  zByteArray = array[0..(MaxInt div SizeOf(Bytef))-1] of Bytef;
-  pzByteArray = ^zByteArray;
-type
-  zIntfArray = array[0..(MaxInt div SizeOf(Intf))-1] of Intf;
-  pzIntfArray = ^zIntfArray;
-type
-  zuIntArray = array[0..(MaxInt div SizeOf(uInt))-1] of uInt;
-  PuIntArray = ^zuIntArray;
-
-{ Type declarations - only for deflate }
-
-type
-  uch  = Byte;
-  uchf = uch; { FAR }
-  ush  = Word;
-  ushf = ush;
-  ulg  = LongInt;
-
-  unsigned = uInt;
-
-  pcharf = ^charf;
-  puchf = ^uchf;
-  pushf = ^ushf;
-
-type
-  zuchfArray = zByteArray;
-  puchfArray = ^zuchfArray;
-type
-  zushfArray = array[0..(MaxInt div SizeOf(ushf))-1] of ushf;
-  pushfArray = ^zushfArray;
-
-procedure zmemcpy(destp : pBytef; sourcep : pBytef; len : uInt);
-function zmemcmp(s1p, s2p : pBytef; len : uInt) : int;
-procedure zmemzero(destp : pBytef; len : uInt);
-procedure zcfree(opaque : voidpf; ptr : voidpf);
-function zcalloc (opaque : voidpf; items : uInt; size : uInt) : voidpf;
-
-implementation
-
-{$ifdef ver80}
-  {$define Delphi16}
-{$endif}
-{$ifdef ver70}
-  {$define HugeMem}
-{$endif}
-{$ifdef ver60}
-  {$define HugeMem}
-{$endif}
-
-{$IFDEF CALLDOS}
-uses
-  WinDos;
-{$ENDIF}
-{$IFDEF Delphi16}
-uses
-  WinTypes,
-  WinProcs;
-{$ENDIF}
-{$IFNDEF FPC}
-  {$IFDEF DPMI}
-  uses
-    WinAPI;
-  {$ENDIF}
-{$ENDIF}
-
-{$IFDEF CALLDOS}
-{ reduce your application memory footprint with $M before using this }
-function dosAlloc (Size : Longint) : Pointer;
-var
-  regs: TRegisters;
-begin
-  regs.bx := (Size + 15) div 16; { number of 16-bytes-paragraphs }
-  regs.ah := $48;                { Allocate memory block }
-  msdos(regs);
-  if regs.Flags and FCarry <> 0 then
-    DosAlloc := NIL
-  else
-    DosAlloc := Ptr(regs.ax, 0);
-end;
-
-
-function dosFree(P : pointer) : boolean;
-var
-  regs: TRegisters;
-begin
-  dosFree := FALSE;
-  regs.bx := Seg(P^);             { segment }
-  if Ofs(P) <> 0 then
-    exit;
-  regs.ah := $49;                { Free memory block }
-  msdos(regs);
-  dosFree := (regs.Flags and FCarry = 0);
-end;
-{$ENDIF}
-
-type
-  LH = record
-    L, H : word;
-  end;
-
-{$IFDEF HugeMem}
-  {$define HEAP_LIST}
-{$endif}
-
-{$IFDEF HEAP_LIST} {--- to avoid Mark and Release --- }
-const
-  MaxAllocEntries = 50;
-type
-  TMemRec = record
-    orgvalue,
-    value : pointer;
-    size: longint;
-  end;
-const
-  allocatedCount : 0..MaxAllocEntries = 0;
-var
-  allocatedList : array[0..MaxAllocEntries-1] of TMemRec;
-
- function NewAllocation(ptr0, ptr : pointer; memsize : longint) : boolean;
- begin
-   if (allocatedCount < MaxAllocEntries) and (ptr0 <> NIL) then
-   begin
-     with allocatedList[allocatedCount] do
-     begin
-       orgvalue := ptr0;
-       value := ptr;
-       size := memsize;
-     end;
-     Inc(allocatedCount);  { we don't check for duplicate }
-     NewAllocation := TRUE;
-   end
-   else
-     NewAllocation := FALSE;
- end;
-{$ENDIF}
-
-{$IFDEF HugeMem}
-
-{ The code below is extremely version specific to the TP 6/7 heap manager!!}
-type
-  PFreeRec = ^TFreeRec;
-  TFreeRec = record
-    next: PFreeRec;
-    size: Pointer;
-  end;
-type
-  HugePtr = voidpf;
-
-
- procedure IncPtr(var p:pointer;count:word);
- { Increments pointer }
- begin
-   inc(LH(p).L,count);
-   if LH(p).L < count then
-     inc(LH(p).H,SelectorInc);  { $1000 }
- end;
-
- procedure DecPtr(var p:pointer;count:word);
- { decrements pointer }
- begin
-   if count > LH(p).L then
-     dec(LH(p).H,SelectorInc);
-   dec(LH(p).L,Count);
- end;
-
- procedure IncPtrLong(var p:pointer;count:longint);
- { Increments pointer; assumes count > 0 }
- begin
-   inc(LH(p).H,SelectorInc*LH(count).H);
-   inc(LH(p).L,LH(Count).L);
-   if LH(p).L < LH(count).L then
-     inc(LH(p).H,SelectorInc);
- end;
-
- procedure DecPtrLong(var p:pointer;count:longint);
- { Decrements pointer; assumes count > 0 }
- begin
-   if LH(count).L > LH(p).L then
-     dec(LH(p).H,SelectorInc);
-   dec(LH(p).L,LH(Count).L);
-   dec(LH(p).H,SelectorInc*LH(Count).H);
- end;
- { The next section is for real mode only }
-
-function Normalized(p : pointer)  : pointer;
-var
-  count : word;
-begin
-  count := LH(p).L and $FFF0;
-  Normalized := Ptr(LH(p).H + (count shr 4), LH(p).L and $F);
-end;
-
-procedure FreeHuge(var p:HugePtr; size : longint);
-const
-  blocksize = $FFF0;
-var
-  block : word;
-begin
-  while size > 0 do
-  begin
-    { block := minimum(size, blocksize); }
-    if size > blocksize then
-      block := blocksize
-    else
-      block := size;
-
-    dec(size,block);
-    freemem(p,block);
-    IncPtr(p,block);    { we may get ptr($xxxx, $fff8) and 31 bytes left }
-    p := Normalized(p); { to free, so we must normalize }
-  end;
-end;
-
-function FreeMemHuge(ptr : pointer) : boolean;
-var
-  i : integer; { -1..MaxAllocEntries }
-begin
-  FreeMemHuge := FALSE;
-  i := allocatedCount - 1;
-  while (i >= 0) do
-  begin
-    if (ptr = allocatedList[i].value) then
-    begin
-      with allocatedList[i] do
-        FreeHuge(orgvalue, size);
-
-      Move(allocatedList[i+1], allocatedList[i],
-           SizeOf(TMemRec)*(allocatedCount - 1 - i));
-      Dec(allocatedCount);
-      FreeMemHuge := TRUE;
-      break;
-    end;
-    Dec(i);
-  end;
-end;
-
-procedure GetMemHuge(var p:HugePtr;memsize:Longint);
-const
-  blocksize = $FFF0;
-var
-  size : longint;
-  prev,free : PFreeRec;
-  save,temp : pointer;
-  block : word;
-begin
-  p := NIL;
-  { Handle the easy cases first }
-  if memsize > maxavail then
-    exit
-  else
-    if memsize <= blocksize then
-    begin
-      getmem(p, memsize);
-      if not NewAllocation(p, p, memsize) then
-      begin
-        FreeMem(p, memsize);
-        p := NIL;
-      end;
-    end
-    else
-    begin
-      size := memsize + 15;
-
-      { Find the block that has enough space }
-      prev := PFreeRec(@freeList);
-      free := prev^.next;
-      while (free <> heapptr) and (ptr2int(free^.size) < size) do
-      begin
-        prev := free;
-        free := prev^.next;
-      end;
-
-      { Now free points to a region with enough space; make it the first one and
-        multiple allocations will be contiguous. }
-
-      save := freelist;
-      freelist := free;
-      { In TP 6, this works; check against other heap managers }
-      while size > 0 do
-      begin
-        { block := minimum(size, blocksize); }
-        if size > blocksize then
-          block := blocksize
-        else
-          block := size;
-        dec(size,block);
-        getmem(temp,block);
-      end;
-
-      { We've got what we want now; just sort things out and restore the
-        free list to normal }
-
-      p := free;
-      if prev^.next <> freelist then
-      begin
-        prev^.next := freelist;
-        freelist := save;
-      end;
-
-      if (p <> NIL) then
-      begin
-        { return pointer with 0 offset }
-        temp := p;
-        if Ofs(p^)<>0 Then
-          p := Ptr(Seg(p^)+1,0);  { hack }
-        if not NewAllocation(temp, p, memsize + 15) then
-        begin
-          FreeHuge(temp, size);
-          p := NIL;
-        end;
-      end;
-
-    end;
-end;
-
-{$ENDIF}
-
-procedure zmemcpy(destp : pBytef; sourcep : pBytef; len : uInt);
-begin
-  Move(sourcep^, destp^, len);
-end;
-
-function zmemcmp(s1p, s2p : pBytef; len : uInt) : int;
-var
-  j : uInt;
-  source,
-  dest : pBytef;
-begin
-  source := s1p;
-  dest := s2p;
-  for j := 0 to pred(len) do
-  begin
-    if (source^ <> dest^) then
-    begin
-      zmemcmp := 2*Ord(source^ > dest^)-1;
-      exit;
-    end;
-    Inc(source);
-    Inc(dest);
-  end;
-  zmemcmp := 0;
-end;
-
-procedure zmemzero(destp : pBytef; len : uInt);
-begin
-  FillChar(destp^, len, 0);
-end;
-
-procedure zcfree(opaque : voidpf; ptr : voidpf);
-{$ifdef Delphi16}
-var
-  Handle : THandle;
-{$endif}
-begin
-  {$IFDEF DPMI}
-  {h :=} GlobalFreePtr(ptr);
-  {$ELSE}
-    {$IFDEF CALL_DOS}
-    dosFree(ptr);
-    {$ELSE}
-      {$ifdef HugeMem}
-      FreeMemHuge(ptr);
-      {$else}
-        {$ifdef Delphi16}
-        Handle := GlobalHandle(LH(ptr).H); { HiWord(LongInt(ptr)) }
-        GlobalUnLock(Handle);
-        GlobalFree(Handle);
-        {$else}
-          FreeMem(ptr);  { Delphi 2,3,4 }
-        {$endif}
-      {$endif}
-    {$ENDIF}
-  {$ENDIF}
-end;
-
-function zcalloc (opaque : voidpf; items : uInt; size : uInt) : voidpf;
-var
-  p : voidpf;
-  memsize : LongInt;
-{$ifdef Delphi16}
-  handle : THandle;
-{$endif}
-begin
-  memsize := Long(items) * size;
-  {$IFDEF DPMI}
-  p := GlobalAllocPtr(gmem_moveable, memsize);
-  {$ELSE}
-    {$IFDEF CALLDOS}
-    p := dosAlloc(memsize);
-    {$ELSE}
-      {$ifdef HugeMem}
-      GetMemHuge(p, memsize);
-      {$else}
-        {$ifdef Delphi16}
-        Handle := GlobalAlloc(HeapAllocFlags, memsize);
-        p := GlobalLock(Handle);
-        {$else}
-          GetMem(p, memsize);  { Delphi: p := AllocMem(memsize); }
-        {$endif}
-      {$endif}
-    {$ENDIF}
-  {$ENDIF}
-  zcalloc := p;
-end;
-
-
-end.
-{ edited from a SWAG posting:
-In Turbo Pascal 6, the heap is the memory allocated when using the Procedures 'New' and
-'GetMem'. The heap starts at the address location pointed to by 'Heaporg' and
-grows to higher addresses as more memory is allocated. The top of the heap,
-the first address of allocatable memory space above the allocated memory
-space, is pointed to by 'HeapPtr'.
-
-Memory is deallocated by the Procedures 'Dispose' and 'FreeMem'. As memory
-blocks are deallocated more memory becomes available, but..... When a block
-of memory, which is not the top-most block in the heap is deallocated, a gap
-in the heap will appear. to keep track of these gaps Turbo Pascal maintains
-a so called free list.
-
-The Function 'MaxAvail' holds the size of the largest contiguous free block
-_in_ the heap. The Function 'MemAvail' holds the sum of all free blocks in
-the heap.
-
-TP6.0 keeps track of the free blocks by writing a 'free list Record' to the
-first eight Bytes of the freed memory block! A (TP6.0) free-list Record
-contains two four Byte Pointers of which the first one points to the next
-free memory block, the second Pointer is not a Real Pointer but contains the
-size of the memory block.
-
-Summary
-
-TP6.0 maintains a linked list with block sizes and Pointers to the _next_
-free block. An extra heap Variable 'Heapend' designate the end of the heap.
-When 'HeapPtr' and 'FreeList' have the same value, the free list is empty.
-
-
-                     TP6.0     Heapend
-                ÚÄÄÄÄÄÄÄÄÄ¿ <ÄÄÄÄ
-                ³         ³
-                ³         ³
-                ³         ³
-                ³         ³
-                ³         ³
-                ³         ³
-                ³         ³
-                ³         ³  HeapPtr
-             ÚÄ>ÃÄÄÄÄÄÄÄÄÄ´ <ÄÄÄÄ
-             ³  ³         ³
-             ³  ÃÄÄÄÄÄÄÄÄÄ´
-             ÀÄij  Free   ³
-             ÚÄ>ÃÄÄÄÄÄÄÄÄÄ´
-             ³  ³         ³
-             ³  ÃÄÄÄÄÄÄÄÄÄ´
-             ÀÄij  Free   ³  FreeList
-                ÃÄÄÄÄÄÄÄÄÄ´ <ÄÄÄÄ
-                ³         ³  Heaporg
-                ÃÄÄÄÄÄÄÄÄÄ´ <ÄÄÄÄ
-
-
-}

+ 69 - 12
packages/extra/Makefile

@@ -231,19 +231,19 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
 override TARGET_DIRS+=unzip
 override TARGET_DIRS+=unzip
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_DIRS+=unzip opengl gtk gtk2 zlib tcl cdrom fpgtk winunits
+override TARGET_DIRS+=unzip opengl gtk gtk2 zlib tcl cdrom fpgtk winunits fftw
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 override TARGET_DIRS+=os2units rexx unzip zlib x11 gtk libpng tcl imlib fpgtk
 override TARGET_DIRS+=os2units rexx unzip zlib x11 gtk libpng tcl imlib fpgtk
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
@@ -261,10 +261,10 @@ ifeq ($(FULL_TARGET),i386-netwlibc)
 override TARGET_DIRS+=unzip zlib
 override TARGET_DIRS+=unzip zlib
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
@@ -279,31 +279,31 @@ ifeq ($(FULL_TARGET),m68k-palmos)
 override TARGET_DIRS+=palmunits
 override TARGET_DIRS+=palmunits
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 override TARGET_DIRS+=unzip zlib x11 opengl gtk syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_DIRS+=unzip zlib x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
+override TARGET_DIRS+=unzip zlib fftw x11 opengl gtk gtk2 syslog forms svgalib ggi libpng libgd utmp bfd gdbm ncurses tcl cdrom imlib gnome1 fpgtk unixutil newt uuid
 endif
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCSUBDIR=packages/extra
 override INSTALL_FPCSUBDIR=packages/extra
@@ -1344,6 +1344,7 @@ fpc_makefiles: fpc_makefile fpc_makefile_dirs
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1380,6 +1381,7 @@ TARGET_DIRS_TCL=1
 TARGET_DIRS_CDROM=1
 TARGET_DIRS_CDROM=1
 TARGET_DIRS_FPGTK=1
 TARGET_DIRS_FPGTK=1
 TARGET_DIRS_WINUNITS=1
 TARGET_DIRS_WINUNITS=1
+TARGET_DIRS_FFTW=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 TARGET_DIRS_OS2UNITS=1
 TARGET_DIRS_OS2UNITS=1
@@ -1396,6 +1398,7 @@ endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1480,6 +1483,7 @@ endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1506,6 +1510,7 @@ endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1576,6 +1581,7 @@ endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1623,6 +1629,7 @@ endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1644,6 +1651,7 @@ endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1691,6 +1699,7 @@ endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1717,6 +1726,7 @@ endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1739,6 +1749,7 @@ endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1765,6 +1776,7 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_UNZIP=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_ZLIB=1
+TARGET_DIRS_FFTW=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_X11=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_GTK=1
 TARGET_DIRS_GTK=1
@@ -1878,6 +1890,51 @@ zlib:
 	$(MAKE) -C zlib all
 	$(MAKE) -C zlib all
 .PHONY: zlib_all zlib_debug zlib_smart zlib_release zlib_units zlib_examples zlib_shared zlib_install zlib_sourceinstall zlib_exampleinstall zlib_distinstall zlib_zipinstall zlib_zipsourceinstall zlib_zipexampleinstall zlib_zipdistinstall zlib_clean zlib_distclean zlib_cleanall zlib_info zlib_makefiles zlib
 .PHONY: zlib_all zlib_debug zlib_smart zlib_release zlib_units zlib_examples zlib_shared zlib_install zlib_sourceinstall zlib_exampleinstall zlib_distinstall zlib_zipinstall zlib_zipsourceinstall zlib_zipexampleinstall zlib_zipdistinstall zlib_clean zlib_distclean zlib_cleanall zlib_info zlib_makefiles zlib
 endif
 endif
+ifdef TARGET_DIRS_FFTW
+fftw_all:
+	$(MAKE) -C fftw all
+fftw_debug:
+	$(MAKE) -C fftw debug
+fftw_smart:
+	$(MAKE) -C fftw smart
+fftw_release:
+	$(MAKE) -C fftw release
+fftw_units:
+	$(MAKE) -C fftw units
+fftw_examples:
+	$(MAKE) -C fftw examples
+fftw_shared:
+	$(MAKE) -C fftw shared
+fftw_install:
+	$(MAKE) -C fftw install
+fftw_sourceinstall:
+	$(MAKE) -C fftw sourceinstall
+fftw_exampleinstall:
+	$(MAKE) -C fftw exampleinstall
+fftw_distinstall:
+	$(MAKE) -C fftw distinstall
+fftw_zipinstall:
+	$(MAKE) -C fftw zipinstall
+fftw_zipsourceinstall:
+	$(MAKE) -C fftw zipsourceinstall
+fftw_zipexampleinstall:
+	$(MAKE) -C fftw zipexampleinstall
+fftw_zipdistinstall:
+	$(MAKE) -C fftw zipdistinstall
+fftw_clean:
+	$(MAKE) -C fftw clean
+fftw_distclean:
+	$(MAKE) -C fftw distclean
+fftw_cleanall:
+	$(MAKE) -C fftw cleanall
+fftw_info:
+	$(MAKE) -C fftw info
+fftw_makefiles:
+	$(MAKE) -C fftw makefiles
+fftw:
+	$(MAKE) -C fftw all
+.PHONY: fftw_all fftw_debug fftw_smart fftw_release fftw_units fftw_examples fftw_shared fftw_install fftw_sourceinstall fftw_exampleinstall fftw_distinstall fftw_zipinstall fftw_zipsourceinstall fftw_zipexampleinstall fftw_zipdistinstall fftw_clean fftw_distclean fftw_cleanall fftw_info fftw_makefiles fftw
+endif
 ifdef TARGET_DIRS_X11
 ifdef TARGET_DIRS_X11
 x11_all:
 x11_all:
 	$(MAKE) -C x11 all
 	$(MAKE) -C x11 all

+ 4 - 4
packages/extra/Makefile.fpc

@@ -2,7 +2,7 @@
 #   Makefile.fpc for Free Pascal Packages
 #   Makefile.fpc for Free Pascal Packages
 #
 #
 [target]
 [target]
-dirs_linux=unzip zlib \
+dirs_linux=unzip zlib fftw \
            x11 opengl gtk gtk2 syslog \
            x11 opengl gtk gtk2 syslog \
            forms svgalib ggi libpng libgd \
            forms svgalib ggi libpng libgd \
            utmp bfd gdbm ncurses tcl cdrom \
            utmp bfd gdbm ncurses tcl cdrom \
@@ -11,7 +11,7 @@ dirs_netbsd=unzip zlib \
             x11 opengl gtk syslog \
             x11 opengl gtk syslog \
             forms svgalib ggi libpng libgd \
             forms svgalib ggi libpng libgd \
             utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
             utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
-dirs_freebsd=unzip zlib \
+dirs_freebsd=unzip zlib fftw \
              x11 opengl gtk gtk2 syslog \
              x11 opengl gtk gtk2 syslog \
              forms svgalib ggi libpng libgd \
              forms svgalib ggi libpng libgd \
              utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
              utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
@@ -19,7 +19,7 @@ dirs_openbsd=unzip zlib \
              x11 opengl gtk syslog \
              x11 opengl gtk syslog \
              forms svgalib ggi libpng libgd \
              forms svgalib ggi libpng libgd \
              utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
              utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
-dirs_win32=unzip opengl gtk gtk2 zlib tcl cdrom fpgtk winunits
+dirs_win32=unzip opengl gtk gtk2 zlib tcl cdrom fpgtk winunits fftw
 dirs_os2=os2units \
 dirs_os2=os2units \
          rexx \
          rexx \
          unzip zlib \
          unzip zlib \
@@ -39,7 +39,7 @@ dirs_amiga=amunits
 dirs_palmos=palmunits
 dirs_palmos=palmunits
 dirs_netware=unzip zlib
 dirs_netware=unzip zlib
 dirs_netwlibc=unzip zlib
 dirs_netwlibc=unzip zlib
-dirs_darwin= unzip zlib \
+dirs_darwin= unzip zlib fftw \
              x11 opengl gtk syslog \
              x11 opengl gtk syslog \
              forms svgalib ggi libpng libgd \
              forms svgalib ggi libpng libgd \
              utmp bfd gdbm ncurses fpgtk tcl imlib gnome1
              utmp bfd gdbm ncurses fpgtk tcl imlib gnome1

+ 1720 - 0
packages/extra/fftw/Makefile

@@ -0,0 +1,1720 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/05/15]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd arm-linux
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx
+LIMIT83fs = go32v2 os2 emx watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPC:=$(shell $(FPCPROG) -PB)
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+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
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+export OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+override PACKAGE_NAME=fftw
+override PACKAGE_VERSION=2.0.0
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_UNITS+=fftw_s
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=fftw_s
+endif
+override INSTALL_FPCPACKAGE=y
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+STATICLIBPREFIX=libp
+RSTEXT=.rst
+ifeq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+endif
+ifeq ($(OS_TARGET),darwin)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+endif
+else
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+SHORTSUFFIX=wat
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.sl2
+STATICLIBPREFIX=
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+PPUEXT=.ppu
+ASMEXT=.asm
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),atari)
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nw
+endif
+ifeq ($(OS_TARGET),netwlibc)
+STATICLIBPREFIX=
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.nlm
+EXEEXT=.nlm
+SHORTSUFFIX=nwl
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+PPUEXT=.ppu
+ASMEXT=.s
+OEXT=.o
+SMARTEXT=.sl
+STATICLIBEXT=.a
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifneq ($(findstring 1.0.,$(FPC_VERSION)),)
+ifeq ($(OS_TARGET),win32)
+ifeq ($(CROSSBINDIR),)
+ASNAME=asw
+LDNAME=ldw
+ARNAME=arw
+endif
+endif
+endif
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+PPAS=ppas$(SRCBATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+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
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl 
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(CPU_TARGET)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX) -Xc
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+else
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1
+else
+FPCCPUOPT:=
+endif
+endif
+override FPCOPT+=-Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+ifeq ($(CPU_TARGET),i386)
+override FPCOPT+=-OG2p3
+endif
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifeq ($(OS_TARGET),linux)
+ifeq ($(FPC_VERSION),1.0.6)
+override FPCOPTDEF+=HASUNIX
+endif
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+EXECPPAS:=@$(PPAS)
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_distinstall
+fpc_distinstall: install exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../fpc-pack
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(PACKAGE_NAME)
+endif
+endif
+ifndef FULLZIPNAME
+FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX)
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifndef inUnix
+USEZIPWRAPPER=1
+endif
+ifdef USEZIPWRAPPER
+ZIPPATHSEP=$(PATHSEP)
+ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT))
+else
+ZIPPATHSEP=/
+endif
+ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(MKDIR) $(DIST_DESTDIR)
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHOREDIR),echo)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER)
+else
+	echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX)
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX)
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples:
+shared:
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall: fpc_distinstall
+zipinstall: fpc_zipinstall
+zipsourceinstall: fpc_zipsourceinstall
+zipexampleinstall: fpc_zipexampleinstall
+zipdistinstall: fpc_zipdistinstall
+clean: fpc_clean
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif

+ 22 - 0
packages/extra/fftw/Makefile.fpc

@@ -0,0 +1,22 @@
+#
+#   Makefile.fpc for Forms Bindings
+#
+
+[package]
+name=fftw
+version=2.0.0
+
+[target]
+units=fftw_s
+programs=
+exampledirs=
+
+[require]
+packages=
+libc=
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../../..

+ 31 - 0
packages/extra/fftw/example.pas

@@ -0,0 +1,31 @@
+program example;
+
+uses fftw;
+
+const s=128;
+
+var i,o:Pcomplex_single;
+    p:fftw_plan_single;
+    a:cardinal;
+
+begin
+  fftw_getmem(i,s*sizeof(complex_single));
+     
+  fftw_getmem(o,s*sizeof(complex_single));
+  p:=fftw_plan_dft_1d(128,i,o,fftw_forward,[fftw_estimate]);
+  for a:=0 to 127 do
+     begin
+         i[a].re:=(single(a)-64);
+         i[a].im:=0;
+     end;
+  writeln('input:');
+  for a:=0 to 127 do
+    writeln('(',i[a].re:8:4,',',i[a].im:8:4,')');
+  fftw_execute(p);
+  writeln('output:');
+  for a:=0 to 127 do
+    writeln('(',o[a].re:8:4,',',o[a].im:8:4,')');
+  fftw_destroy_plan(p);
+  fftw_freemem(i);
+  fftw_freemem(o);
+end.

+ 133 - 0
packages/extra/fftw/fftw_s.pas

@@ -0,0 +1,133 @@
+unit fftw_s;
+{
+   FFTW - Fastest Fourier Transform in the West library
+
+   This interface unit is (C) 2005 by Daniel Mantione
+     member of the Free Pascal development team.
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   This file carries, as a independend work calling a well
+   documented binary interface, the Free Pascal LGPL license
+   with static linking exception.
+
+   Note that the FFTW library itself carries the GPL license
+   and can therefore not be used in non-GPL software.
+}
+
+{*****************************************************************************}
+                                    interface
+{*****************************************************************************}
+
+{$CALLING cdecl} {Saves some typing.}
+
+{$MACRO on}
+{$INLINE on}
+
+type    complex_single=record
+          re,im:single;
+        end;
+        Pcomplex_single=^complex_single;
+
+        fftw_plan_single=type pointer;
+
+        fftw_sign=(fftw_backward=1,fftw_forward=$ffffffff);
+
+        fftw_flag=(fftw_measure,            {generated optimized algorithm}
+                   fftw_destroy_input,      {default}
+                   fftw_unaligned,          {data is unaligned}
+                   fftw_conserve_memory,    {needs no explanation}
+                   fftw_exhaustive,         {search optimal algorithm}
+                   fftw_preserve_input,     {don't overwrite input}
+                   fftw_patient,            {generate highly optimized alg.}
+                   fftw_estimate);          {don't optimize, just use an alg.}
+        fftw_flagset=set of fftw_flag;
+                   
+
+{Complex to complex transformations.}
+function fftw_plan_dft_1d(n:cardinal;i,o:Pcomplex_single;
+                          sign:fftw_sign;flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_1d';
+function fftw_plan_dft_2d(nx,ny:cardinal;i,o:Pcomplex_single;
+                          sign:fftw_sign;flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_2d';
+function fftw_plan_dft_3d(nx,ny,nz:cardinal;i,o:Pcomplex_single;
+                          sign:fftw_sign;flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_3d';
+
+function fftw_plan_dft(rank:cardinal;n:Pcardinal;i,o:Pcomplex_single;
+                       sign:fftw_sign;flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft';
+
+{Real to complex transformations.}
+function fftw_plan_dft_1d(n:cardinal;i:Psingle;o:Pcomplex_single;
+                          flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_r2c_1d';
+function fftw_plan_dft_2d(nx,ny:cardinal;i:Psingle;o:Pcomplex_single;
+                          flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_r2c_2d';
+function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Psingle;o:Pcomplex_single;
+                          flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_r2c_3d';
+function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Psingle;o:Pcomplex_single;
+                       flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_r2c';
+
+{Complex to real transformations.}
+function fftw_plan_dft_1d(n:cardinal;i:Pcomplex_single;o:Psingle;
+                          flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_c2r_1d';
+function fftw_plan_dft_2d(nx,ny:cardinal;i:Pcomplex_single;o:Psingle;
+                          flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_c2r_2d';
+function fftw_plan_dft_3d(nx,ny,nz:cardinal;i:Pcomplex_single;o:Psingle;
+                          flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_c2r_3d';
+function fftw_plan_dft(rank:cardinal;n:Pcardinal;i:Pcomplex_single;o:Psingle;
+                       flags:fftw_flagset):fftw_plan_single;
+         external 'fftw3f' name 'fftwf_plan_dft_c2r';
+
+
+procedure fftw_destroy_plan(plan:fftw_plan_single);
+          external 'fftw3f' name 'fftwf_destroy_plan';
+procedure fftw_execute(plan:fftw_plan_single);
+          external 'fftw3f' name 'fftwf_execute';
+
+{*****************************************************************************}
+                                  implementation
+{*****************************************************************************}
+
+{$LINKLIB fftw3f}
+
+{Required libraries by libfftw3}
+{$LINKLIB gcc}
+{$LINKLIB c}
+{$LINKLIB m}
+
+{$calling register} {Back to normal!}
+
+{Better don't use fftw_malloc and fftw_free, but provide Pascal replacements.}
+
+{$IF defined(cpui386) or defined(cpupowerpc)}
+  {$DEFINE align:=16}
+{$ENDIF}
+
+procedure fftw_getmem(var p:pointer;size:sizeint);
+
+begin
+{$IFDEF align}
+  getmem(p,size+16-1);
+  ptruint(p):=(ptruint(p)+align-1) and not (align-1);
+{$ELSE}
+  getmem(p,size);
+{$ENDIF}
+end;
+
+procedure fftw_freemem(p:pointer);inline;
+
+begin
+  freemem(p);
+end;
+
+end.

+ 63 - 0
packages/extra/fftw/readme.txt

@@ -0,0 +1,63 @@
+Interface unit for Fastest Fourier in the West library
+------------------------------------------------------
+
+This unit is a Pascal interface to the FFTW library version 3. FFTW is
+a library to compute fast fourier transforms extremely fast, it uses
+a runtime code generator to generate the best algorithm for a specific
+transformation.
+
+The unit is experimental and community involvement is welcome.
+
+At this time we provide a single precision interface only. 
+Interfaces for the double and extended precision is a simpleprogramming
+exercise, you can simply replace single by double everywhere. 
+
+See http://www.fftw.org for extensive documentation.
+
+Usage:
+* Compile FFTW. Use the "--enable-single" option to configure to select single
+  precision.
+* We need libgcc. Its location should be present in your fpc.cfg. If not,
+  please use the tool "samplecfg" that is shipped with the compiler to
+  generate a new fpc.cfg.
+* The compiler should be able to find libfftw3f.a. Put something like
+  -Fl/path/to/libfftw3f.a in your fpc.cfg
+
+Short example how to perform a Fourier transformation in Pascal:
+
+begin
+  {You can use getmem, but only fftw_getmem ensures 3DNOW/SSE
+   algorithms.}
+  fftw_getmem(i,count*sizeof(complex_single));
+  fftw_getmem(o,count*sizeof(complex_single));
+
+  {FFTW will now generate an algoritm to compute the FFT:}
+  plan:=fftw_plan_dft_1d(count,i,o,fftw_forward,[fftw_estimate]);
+
+  {Put code to fill i^ with input data here.}
+  fftw_execute(p); {Execute FFT}
+  {Output in o^}
+
+  {We can repeat, and refill i with input data.}
+  {Put code to fill i^ with input data here.}
+  fftw_execute(p); {Execute FFT}
+  {Output in o^}
+
+  fftw_destroy_plan(p);
+  fftw_freemem(i);
+  fftw_freemem(o);
+end;
+
+Differences with C version:
+  * To introduce strong typing:
+  ** The sign (fftw_forward,fftw_backward) is an enumeration instead of an int
+     with constants.
+  ** The flags ([fftw_estimate]) is a flag set instead of an int with constants.
+  ** The fftw_plan_single type is an opaque pointer incompatible with anything
+     else;
+  * To ease programming:
+  ** Functions for complex to complex, real to complex, and complex to real are
+     all called equally, the compiler will determine which one needs to be
+     called. So we have just fftw_plan_dft_1d instead of fftw_plan_dft_1d,
+     fftw_plan_dft_r2c_1d, fftw_plan_dft_c2r_1d, etc. 
+  * fftw_getmem/fftw_freemem instead of fftw_malloc/fftw_free

+ 2 - 15
packages/extra/opengl/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/06]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/11/08]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
@@ -231,7 +231,7 @@ UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 override PACKAGE_NAME=opengl
 override PACKAGE_NAME=opengl
-override PACKAGE_VERSION=2.0.3
+override PACKAGE_VERSION=2.0.0
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_UNITS+=gl glu glut  glx glext
 override TARGET_UNITS+=gl glu glut  glx glext
 endif
 endif
@@ -657,11 +657,6 @@ GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`)
 endif
 endif
 endif
 endif
 endif
 endif
-ifeq ($(CPU_TARGET),powerpc64)
-ifeq ($(BINUTILSPREFIX),)
-GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`)
-endif
-endif
 endif
 endif
 ifndef GCCLIBDIR
 ifndef GCCLIBDIR
 CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH))))
 CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH))))
@@ -1522,14 +1517,6 @@ override FPCEXTCMD:=$(FPCOPT)
 override FPCOPT:=!FPCEXTCMD
 override FPCOPT:=!FPCEXTCMD
 export FPCEXTCMD
 export FPCEXTCMD
 endif
 endif
-override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
-override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
-ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
-override ACROSSCOMPILE=1
-endif
-ifdef ACROSSCOMPILE
-override FPCOPT+=$(CROSSOPT)
-endif
 override COMPILER:=$(FPC) $(FPCOPT)
 override COMPILER:=$(FPC) $(FPCOPT)
 ifeq (,$(findstring -s ,$(COMPILER)))
 ifeq (,$(findstring -s ,$(COMPILER)))
 EXECPPAS=
 EXECPPAS=

+ 1 - 1
packages/extra/opengl/Makefile.fpc

@@ -4,7 +4,7 @@
 
 
 [package]
 [package]
 name=opengl
 name=opengl
-version=2.0.3
+version=2.0.0
 
 
 [require]
 [require]
 packages_linux=x11
 packages_linux=x11

+ 1 - 0
packages/extra/opengl/gl.pp

@@ -49,6 +49,7 @@ Abstract:
 {$ELSE}
 {$ELSE}
   {$DEFINE extdecl := cdecl}
   {$DEFINE extdecl := cdecl}
   {$IFDEF MorphOS}
   {$IFDEF MorphOS}
+    {$INLINE ON}
     {$DEFINE GL_UNIT}
     {$DEFINE GL_UNIT}
   {$ELSE}
   {$ELSE}
     {$LINKLIB c}
     {$LINKLIB c}

+ 1 - 0
packages/extra/opengl/glu.pp

@@ -61,6 +61,7 @@ Abstract:
 {$ENDIF}
 {$ENDIF}
 
 
 {$IFDEF MORPHOS}
 {$IFDEF MORPHOS}
+{$INLINE ON}
 {$DEFINE GLU_UNIT}
 {$DEFINE GLU_UNIT}
 {$ENDIF}
 {$ENDIF}
 
 

+ 1 - 0
packages/extra/opengl/glut.pp

@@ -14,6 +14,7 @@
 {$ENDIF}
 {$ENDIF}
 
 
 {$IFDEF MORPHOS}
 {$IFDEF MORPHOS}
+{$INLINE ON}
 {$DEFINE GLUT_UNIT}
 {$DEFINE GLUT_UNIT}
 {$ENDIF}
 {$ENDIF}
 
 

+ 18 - 0
packages/extra/opengl/tinygl.inc

@@ -1,3 +1,21 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Karoly Balogh
+
+     TinyGL/OpenGL wrapper include for MorphOS/PowerPC
+
+    Thanks to Michal 'kiero' Wozniak and Mark 'bigfoot' Olsen
+    for their help.
+
+    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.
+
+ **********************************************************************}
+
 { ****************************************************************************************************** }
 { ****************************************************************************************************** }
 { ** TinyGL syscalls                                                                                  ** }
 { ** TinyGL syscalls                                                                                  ** }
 { ****************************************************************************************************** }
 { ****************************************************************************************************** }

+ 17 - 0
packages/extra/opengl/tinyglh.inc

@@ -1,3 +1,20 @@
+{
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 2005 by Karoly Balogh
+
+     TinyGL/OpenGL wrapper include header for MorphOS/PowerPC
+
+    Thanks to Michal 'kiero' Wozniak and Mark 'bigfoot' Olsen
+    for their help.
+
+    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.
+
+ **********************************************************************}
 
 
 { ****************************************************************************************************** }
 { ****************************************************************************************************** }
 { ** GL functions                                                                                     ** }
 { ** GL functions                                                                                     ** }

+ 38 - 43
packages/extra/x11/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/11/14]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/11/08]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
@@ -233,115 +233,115 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
 override PACKAGE_NAME=x11
 override PACKAGE_NAME=x11
 override PACKAGE_VERSION=2.0.3
 override PACKAGE_VERSION=2.0.3
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+override TARGET_UNITS+=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 endif
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 ifdef REQUIRE_UNITSDIR
 ifdef REQUIRE_UNITSDIR
@@ -546,11 +546,6 @@ GCCLIBDIR:=$(shell dirname `gcc -m32 -print-libgcc-file-name`)
 endif
 endif
 endif
 endif
 endif
 endif
-ifeq ($(CPU_TARGET),powerpc64)
-ifeq ($(BINUTILSPREFIX),)
-GCCLIBDIR:=$(shell dirname `gcc -m64 -print-libgcc-file-name`)
-endif
-endif
 endif
 endif
 ifndef GCCLIBDIR
 ifndef GCCLIBDIR
 CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH))))
 CROSSGCC=$(strip $(wildcard $(addsuffix /$(BINUTILSPREFIX)gcc$(SRCEXEEXT),$(SEARCHPATH))))

+ 1 - 1
packages/extra/x11/Makefile.fpc

@@ -7,7 +7,7 @@ name=x11
 version=2.0.3
 version=2.0.3
 
 
 [target]
 [target]
-units=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont
+units=x xlib xutil xresource xcms xshm xrender keysym xi xkb xkblib xatom xinerama xv xvlib cursorfont xrandr
 
 
 [require]
 [require]
 libc=y
 libc=y

+ 74 - 0
packages/extra/x11/randr.inc

@@ -0,0 +1,74 @@
+{*
+ * $XFree86: xc/include/extensions/randr.h,v 1.4 2001/11/24 07:24:58 keithp Exp $
+ *
+ * Copyright (C) 2000, Compaq Computer Corporation, 
+ * Copyright (C) 2002, Hewlett Packard, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Compaq or HP not be used in advertising
+ * or publicity pertaining to distribution of the software without specific,
+ * written prior permission.  HP makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
+ *}
+
+type
+  PRotation      = ^TRotation;
+  TRotation      = cushort;
+  PSizeID        = ^TSizeID;
+  TSizeID        = cushort;
+  PSubpixelOrder = ^TSubpixelOrder;
+  TSubpixelOrder = cushort;
+
+const
+  RANDR_NAME                     = 'RANDR';
+  RANDR_MAJOR                    = 1;
+  RANDR_MINOR                    = 1;
+
+  RRNumberErrors                 = 0;
+  RRNumberEvents                 = 1;
+
+  X_RRQueryVersion               = 0;
+{ we skip 1 to make old clients fail pretty immediately }
+  X_RROldGetScreenInfo           = 1;
+  X_RR1_0SetScreenConfig         = 2;
+{ V1.0 apps share the same set screen config request id }
+  X_RRSetScreenConfig            = 2;
+  X_RROldScreenChangeSelectInput = 3;
+{ 3 used to be ScreenChangeSelectInput; deprecated }
+  X_RRSelectInput                = 4;
+  X_RRGetScreenInfo              = 5;
+
+{ used in XRRSelectInput }
+
+  RRScreenChangeNotifyMask       = 1 shl 0;
+
+  RRScreenChangeNotify           = 0;
+
+{ used in the rotation field; rotation and reflection in 0.1 proto. }
+  RR_Rotate_0                    = 1;
+  RR_Rotate_90                   = 2;
+  RR_Rotate_180                  = 4;
+  RR_Rotate_270                  = 8;
+
+{ new in 1.0 protocol, to allow reflection of screen }
+
+  RR_Reflect_X                   = 16;
+  RR_Reflect_Y                   = 32;
+
+  RRSetConfigSuccess             = 0;
+  RRSetConfigInvalidConfigTime   = 1;
+  RRSetConfigInvalidTime         = 2;
+  RRSetConfigFailed              = 3;

+ 200 - 0
packages/extra/x11/xrandr.pp

@@ -0,0 +1,200 @@
+{
+  $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $
+ 
+  Copyright (C) 2000 Compaq Computer Corporation, Inc.
+  Copyright (C) 2002 Hewlett-Packard Company, Inc.
+ 
+  Permission to use, copy, modify, distribute, and sell this software and its
+  documentation for any purpose is hereby granted without fee, provided that
+  the above copyright notice appear in all copies and that both that
+  copyright notice and this permission notice appear in supporting
+  documentation, and that the name of Compaq not be used in advertising or
+  publicity pertaining to distribution of the software without specific,
+  written prior permission.  HP makes no representations about the
+  suitability of this software for any purpose.  It is provided "as is"
+  without express or implied warranty.
+ 
+  HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ
+  BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+  OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
+  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ 
+  Author:  Jim Gettys, HP Labs, HP.
+}
+
+unit xrandr;
+
+interface
+
+{$PACKRECORDS c}
+
+uses
+  ctypes, x, xlib;
+
+const
+  libXrandr = 'Xrandr';
+
+{$I randr.inc}
+
+type
+  PXRRScreenSize = ^TXRRScreenSize;
+  TXRRScreenSize = record
+    width, height : cint;
+    mwidth, mheight : cint;
+  end;
+
+{
+   Events.
+}
+
+  TXRRScreenChangeNotifyEvent = record
+    _type : cint;                 { event base }
+    serial : culong;              { # of last request processed by server }
+    send_event : TBool;           { true if this came from a SendEvent request }
+    display : PDisplay;           { Display the event was read from }
+    window : TWindow;             { window which selected for this event }
+    root : TWindow;               { Root window for changed screen }
+    timestamp : TTime;            { when the screen change occurred }
+    config_timestamp : TTime;     { when the last configuration change }
+    size_index : TSizeID;
+    subpixel_order : TSubpixelOrder;
+    rotation : TRotation;
+    width : cint;
+    height : cint;
+    mwidth : cint;
+    mheight : cint;
+  end;
+
+
+{ internal representation is private to the library }
+  PXRRScreenConfiguration = ^TXRRScreenConfiguration;
+  TXRRScreenConfiguration = record end;
+
+function XRRQueryExtension(
+  dpy : PDisplay;
+  event_basep,
+  error_basep : Pcint) : TBool; cdecl; external libXrandr;
+
+function XRRQueryVersion(
+  dpy : PDisplay;
+  major_versionp : Pcint;
+  minor_versionp : Pcint) : TStatus; cdecl; external libXrandr;
+
+function XRRGetScreenInfo(
+  dpy : PDisplay;
+  draw : TDrawable) : PXRRScreenConfiguration; cdecl; external libXrandr;
+
+procedure XRRFreeScreenConfigInfo(
+  config : PXRRScreenConfiguration); cdecl; external libXrandr;
+
+{
+  Note that screen configuration changes are only permitted if the client can
+  prove it has up to date configuration information.  We are trying to
+  insist that it become possible for screens to change dynamically, so
+  we want to ensure the client knows what it is talking about when requesting
+  changes.
+}
+function XRRSetScreenConfig(
+  dpy : PDisplay;
+  config : PXRRScreenConfiguration;
+  draw : TDrawable;
+  size_index : cint;
+  rotation : TRotation;
+  timestamp : TTime) : TStatus; cdecl; external libXrandr;
+
+{ added in v1.1, sorry for the lame name }
+function XRRSetScreenConfigAndRate(
+  dpy : PDisplay;
+  config : PXRRScreenConfiguration;
+  draw : TDrawable;
+  size_index : cint;
+  rotation : TRotation;
+  rate : cshort;
+  timestamp : TTime) : TStatus; cdecl; external libXrandr;
+
+
+function XRRConfigRotations(
+  config : PXRRScreenConfiguration;
+  current_rotation : PRotation) : TRotation; cdecl; external libXrandr;
+
+function XRRConfigTimes(
+  config : PXRRScreenConfiguration;
+  config_timestamp : PTime) : TTime; cdecl; external libXrandr;
+
+function XRRConfigSizes(
+  config : PXRRScreenConfiguration;
+  nsizes : Pcint) : PXRRScreenSize; cdecl; external libXrandr;
+
+function XRRConfigRates(
+  config : PXRRScreenConfiguration;
+  sizeID : cint;
+  nrates : Pcint) : Pcshort; cdecl; external libXrandr;
+
+function XRRConfigCurrentConfiguration(
+  config : PXRRScreenConfiguration;
+  rotation : PRotation) : TSizeID; cdecl; external libXrandr;
+
+function XRRConfigCurrentRate(
+  config : PXRRScreenConfiguration) : cshort; cdecl; external libXrandr;
+
+function XRRRootToScreen(
+  dpy : PDisplay;
+  root : TWindow) : cint; cdecl; external libXrandr;
+
+{
+  returns the screen configuration for the specified screen; does a lazy
+  evalution to delay getting the information, and caches the result.
+  These routines should be used in preference to XRRGetScreenInfo
+  to avoid unneeded round trips to the X server.  These are new
+  in protocol version 0.1.
+}
+
+
+function XRRScreenConfig(
+  dpy : PDisplay;
+  screen : cint) : PXRRScreenConfiguration; cdecl; external libXrandr;
+function XRRConfig(
+  screen : PScreen) : PXRRScreenConfiguration; cdecl; external libXrandr;
+procedure XRRSelectInput(
+  dpy : PDisplay;
+  window : TWindow;
+  mask : cint); cdecl; external libXrandr;
+
+{
+  the following are always safe to call, even if RandR is not implemented 
+  on a screen 
+}
+
+
+function XRRRotations(
+  dpy : PDisplay;
+  screen : cint;
+  current_rotation : PRotation) : TRotation; cdecl; external libXrandr;
+function XRRSizes(
+  dpy : PDisplay;
+  screen : cint;
+  nsizes : Pcint) : PXRRScreenSize; cdecl; external libXrandr;
+function XRRRates(
+  dpy : PDisplay;
+  screen : cint;
+  sizeID : cint;
+  nrates : Pcint) : Pcshort; cdecl; external libXrandr;
+function XRRTimes(
+  dpy : PDisplay;
+  screen : cint;
+  config_timestamp : PTime) : TTime; cdecl; external libXrandr;
+
+
+{
+  intended to take RRScreenChangeNotify,  or 
+  ConfigureNotify (on the root window)
+  returns 1 if it is an event type it understands, 0 if not
+}
+function XRRUpdateConfiguration(
+  event : PXEvent) : cint; cdecl; external libXrandr;
+
+implementation
+
+end.

+ 1 - 1
rtl/inc/dynarr.inc

@@ -20,7 +20,7 @@ type
    { to calculate memory requirements       }
    { to calculate memory requirements       }
    pdynarray = ^tdynarray;
    pdynarray = ^tdynarray;
    tdynarray = packed record
    tdynarray = packed record
-      refcount : longint;
+      refcount : ptrint;
       high : tdynarrayindex;
       high : tdynarrayindex;
    end;
    end;
 
 

+ 41 - 41
rtl/inc/systemh.inc

@@ -368,11 +368,11 @@ ThreadVar
 {$endif}
 {$endif}
 
 
 Procedure Move(const source;var dest;count:SizeInt);{$ifdef INLINEGENERICS}inline;{$endif}
 Procedure Move(const source;var dest;count:SizeInt);{$ifdef INLINEGENERICS}inline;{$endif}
-Procedure FillChar(Var x;count:SizeInt;Value:Boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
-Procedure FillChar(Var x;count:SizeInt;Value:Char);{$ifdef SYSTEMINLINE}inline;{$endif}
-Procedure FillChar(Var x;count:SizeInt;Value:Byte);{$ifdef INLINEGENERICS}inline;{$endif}
+Procedure FillChar(var x;count:SizeInt;Value:Boolean);{$ifdef SYSTEMINLINE}inline;{$endif}
+Procedure FillChar(var x;count:SizeInt;Value:Char);{$ifdef SYSTEMINLINE}inline;{$endif}
+Procedure FillChar(var x;count:SizeInt;Value:Byte);{$ifdef INLINEGENERICS}inline;{$endif}
 procedure FillByte(var x;count:SizeInt;value:byte);{$ifdef INLINEGENERICS}inline;{$endif}
 procedure FillByte(var x;count:SizeInt;value:byte);{$ifdef INLINEGENERICS}inline;{$endif}
-Procedure FillWord(Var x;count:SizeInt;Value:Word);
+Procedure FillWord(var x;count:SizeInt;Value:Word);
 procedure FillDWord(var x;count:SizeInt;value:DWord);
 procedure FillDWord(var x;count:SizeInt;value:DWord);
 function  IndexChar(const buf;len:SizeInt;b:char):SizeInt;
 function  IndexChar(const buf;len:SizeInt;b:char):SizeInt;
 function  IndexByte(const buf;len:SizeInt;b:byte):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
 function  IndexByte(const buf;len:SizeInt;b:byte):SizeInt;{$ifdef INLINEGENERICS}inline;{$endif}
@@ -452,14 +452,14 @@ function strpas(p:pchar):shortstring;external name 'FPC_PCHAR_TO_SHORTSTR';
 function strlen(p:pchar):longint;external name 'FPC_PCHAR_LENGTH';
 function strlen(p:pchar):longint;external name 'FPC_PCHAR_LENGTH';
 
 
 { Shortstring functions }
 { Shortstring functions }
-Procedure Delete(Var s:shortstring;index:SizeInt;count:SizeInt);
-Procedure Insert(const source:shortstring;Var s:shortstring;index:SizeInt);
-Procedure Insert(source:Char;Var s:shortstring;index:SizeInt);
+Procedure Delete(var s:shortstring;index:SizeInt;count:SizeInt);
+Procedure Insert(const source:shortstring;var s:shortstring;index:SizeInt);
+Procedure Insert(source:Char;var s:shortstring;index:SizeInt);
 Function  Pos(const substr:shortstring;const s:shortstring):SizeInt;
 Function  Pos(const substr:shortstring;const s:shortstring):SizeInt;
 Function  Pos(C:Char;const s:shortstring):SizeInt;
 Function  Pos(C:Char;const s:shortstring):SizeInt;
-Function  Pos (Const Substr : ShortString; Const Source : AnsiString) : SizeInt;
-Procedure SetString (Var S : Shortstring; Buf : PChar; Len : SizeInt);
-Procedure SetString (Var S : AnsiString; Buf : PChar; Len : SizeInt);
+Function  Pos (const Substr : ShortString; const Source : AnsiString) : SizeInt;
+Procedure SetString (var S : Shortstring; Buf : PChar; Len : SizeInt);
+Procedure SetString (var S : AnsiString; Buf : PChar; Len : SizeInt);
 Function  upCase(const s:shortstring):shortstring;
 Function  upCase(const s:shortstring):shortstring;
 Function  lowerCase(const s:shortstring):shortstring; overload;
 Function  lowerCase(const s:shortstring):shortstring; overload;
 Function  Space(b:byte):shortstring;
 Function  Space(b:byte):shortstring;
@@ -482,11 +482,11 @@ function  pos(const substr : shortstring;c:char): SizeInt;
                              AnsiString Handling
                              AnsiString Handling
 ****************************************************************************}
 ****************************************************************************}
 
 
-Procedure UniqueString(Var S : AnsiString);external name 'FPC_ANSISTR_UNIQUE';
-Function  Pos (Const Substr : AnsiString; Const Source : AnsiString) : SizeInt;
-Function  Pos (c : Char; Const s : AnsiString) : SizeInt;
-Procedure Insert (Const Source : AnsiString; Var S : AnsiString; Index : SizeInt);
-Procedure Delete (Var S : AnsiString; Index,Size: SizeInt);
+Procedure UniqueString(var S : AnsiString);external name 'FPC_ANSISTR_UNIQUE';
+Function  Pos (const Substr : AnsiString; const Source : AnsiString) : SizeInt;
+Function  Pos (c : Char; const s : AnsiString) : SizeInt;
+Procedure Insert (const Source : AnsiString; var S : AnsiString; Index : SizeInt);
+Procedure Delete (var S : AnsiString; Index,Size: SizeInt);
 Function  StringOfChar(c : char;l : SizeInt) : AnsiString;
 Function  StringOfChar(c : char;l : SizeInt) : AnsiString;
 function  upcase(const s : ansistring) : ansistring;
 function  upcase(const s : ansistring) : ansistring;
 function  lowercase(const s : ansistring) : ansistring;
 function  lowercase(const s : ansistring) : ansistring;
@@ -536,9 +536,9 @@ Procedure Truncate (Var F:File);
                            Typed File Management
                            Typed File Management
 ****************************************************************************}
 ****************************************************************************}
 
 
-Procedure Assign(Var f:TypedFile;const Name:string);
-Procedure Assign(Var f:TypedFile;p:pchar);
-Procedure Assign(Var f:TypedFile;c:char);
+Procedure Assign(var f:TypedFile;const Name:string);
+Procedure Assign(var f:TypedFile;p:pchar);
+Procedure Assign(var f:TypedFile;c:char);
 Procedure Reset(var f : TypedFile);   [INTERNPROC: fpc_in_Reset_TypedFile];
 Procedure Reset(var f : TypedFile);   [INTERNPROC: fpc_in_Reset_TypedFile];
 Procedure Rewrite(var f : TypedFile); [INTERNPROC: fpc_in_Rewrite_TypedFile];
 Procedure Rewrite(var f : TypedFile); [INTERNPROC: fpc_in_Rewrite_TypedFile];
 
 
@@ -546,29 +546,29 @@ Procedure Rewrite(var f : TypedFile); [INTERNPROC: fpc_in_Rewrite_TypedFile];
                             Text File Management
                             Text File Management
 ****************************************************************************}
 ****************************************************************************}
 
 
-Procedure Assign(Var t:Text;const s:string);
-Procedure Assign(Var t:Text;p:pchar);
-Procedure Assign(Var t:Text;c:char);
-Procedure Close(Var t:Text);
-Procedure Rewrite(Var t:Text);
-Procedure Reset(Var t:Text);
-Procedure Append(Var t:Text);
-Procedure Flush(Var t:Text);
-Procedure Erase(Var t:Text);
-Procedure Rename(Var t:Text;const s:string);
-Procedure Rename(Var t:Text;p:pchar);
-Procedure Rename(Var t:Text;c:char);
-Function  EOF(Var t:Text):Boolean;
+Procedure Assign(var t:Text;const s:string);
+Procedure Assign(var t:Text;p:pchar);
+Procedure Assign(var t:Text;c:char);
+Procedure Close(var t:Text);
+Procedure Rewrite(var t:Text);
+Procedure Reset(var t:Text);
+Procedure Append(var t:Text);
+Procedure Flush(var t:Text);
+Procedure Erase(var t:Text);
+Procedure Rename(var t:Text;const s:string);
+Procedure Rename(var t:Text;p:pchar);
+Procedure Rename(var t:Text;c:char);
+Function  EOF(var t:Text):Boolean;
 Function  EOF:Boolean;
 Function  EOF:Boolean;
-Function  EOLn(Var t:Text):Boolean;
+Function  EOLn(var t:Text):Boolean;
 Function  EOLn:Boolean;
 Function  EOLn:Boolean;
-Function  SeekEOLn (Var t:Text):Boolean;
-Function  SeekEOF (Var t:Text):Boolean;
+Function  SeekEOLn (var t:Text):Boolean;
+Function  SeekEOF (var t:Text):Boolean;
 Function  SeekEOLn:Boolean;
 Function  SeekEOLn:Boolean;
 Function  SeekEOF:Boolean;
 Function  SeekEOF:Boolean;
-Procedure SetTextBuf(Var f:Text; Var Buf);[INTERNPROC:fpc_in_settextbuf_file_x];
-Procedure SetTextBuf(Var f:Text; Var Buf; Size:Longint);
-Procedure SetTextLineEnding(Var f:Text; Ending:string);
+Procedure SetTextBuf(var f:Text; var Buf);[INTERNPROC:fpc_in_settextbuf_file_x];
+Procedure SetTextBuf(var f:Text; var Buf; Size:SizeInt);
+Procedure SetTextLineEnding(var f:Text; Ending:string);
 
 
 {****************************************************************************
 {****************************************************************************
                             Directory Management
                             Directory Management
@@ -577,8 +577,8 @@ Procedure SetTextLineEnding(Var f:Text; Ending:string);
 Procedure chdir(const s:string);
 Procedure chdir(const s:string);
 Procedure mkdir(const s:string);
 Procedure mkdir(const s:string);
 Procedure rmdir(const s:string);
 Procedure rmdir(const s:string);
-Procedure getdir(drivenr:byte;Var dir:shortstring);
-Procedure getdir(drivenr:byte;Var dir:ansistring);
+Procedure getdir(drivenr:byte;var dir:shortstring);
+Procedure getdir(drivenr:byte;var dir:ansistring);
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -619,13 +619,13 @@ Procedure SysResetFPU;{$ifdef SYSTEMINLINE}inline;{$endif}
 *****************************************************************************}
 *****************************************************************************}
 
 
 function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):ppchar; // const ?
 function ArrayStringToPPchar(const S:Array of AnsiString;reserveentries:Longint):ppchar; // const ?
-Function StringToPPChar(Var S:AnsiString;ReserveEntries:integer):ppchar;
+Function StringToPPChar(var S:AnsiString;ReserveEntries:integer):ppchar;
 Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
 Function StringToPPChar(S: PChar;ReserveEntries:integer):ppchar;
 
 
 
 
 procedure AbstractError;external name 'FPC_ABSTRACTERROR';
 procedure AbstractError;external name 'FPC_ABSTRACTERROR';
 Function  SysBackTraceStr(Addr:Pointer): ShortString;
 Function  SysBackTraceStr(Addr:Pointer): ShortString;
-Procedure SysAssert(Const Msg,FName:ShortString;LineNo:Longint;ErrorAddr:Pointer);
+Procedure SysAssert(const Msg,FName:ShortString;LineNo:Longint;ErrorAddr:Pointer);
 
 
 { Error handlers }
 { Error handlers }
 Type
 Type

+ 111 - 105
rtl/linux/powerpc/cprt0.as

@@ -1,105 +1,111 @@
-/*
-  $Id: cprt0.as,v 1.9 2004/09/02 18:57:37 marco Exp $
-*/
-/* Startup code for programs linked with GNU libc.
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library 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.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-        .section ".text"
-        .globl  _start
-_start:
-	mr 	26,1
-	/* Set up an initial stack frame, and clear the LR.  */
-	clrrwi	1,1,4
-	li	0,0
-	stwu	1,-16(1)
-	mtlr	0
-	stw	0,0(1)
-
-        lis 	11,operatingsystem_parameter_argc@ha
-	stw 	3,operatingsystem_parameter_argc@l(11);
-
-        lis 	11,operatingsystem_parameter_argv@ha
-	stw 	4,operatingsystem_parameter_argv@l(11);
-
-	lis 	11,operatingsystem_parameter_envp@ha
-	stw 	5,operatingsystem_parameter_envp@l(11);
-
-	/* init libc, parameters are already setup at this point */
-	bl	__libc_init_first
-
-	/* install finalization code handler */
-	lis	3,_fini@ha
-	addi	3,3,_fini@l
-	bl	PASCALMAIN
-
-        .globl  _haltproc
-        .type   _haltproc,@function
-_haltproc:
-        li      0,1	         /* exit call */
-	lis	3,operatingsystem_result@h
-	stw	3,operatingsystem_result@l(3)
-        sc
-        b	_haltproc
-
-	/* Define a symbol for the first piece of initialized data.  */
-	.section ".data"
-	.globl	__data_start
-__data_start:
-data_start:
-        .globl  ___fpc_brk_addr         /* heap management */
-        .type   ___fpc_brk_addr,@object
-        .size   ___fpc_brk_addr,4
-___fpc_brk_addr:
-        .long   0
-
-.text
-        .comm operatingsystem_parameter_envp,4
-        .comm operatingsystem_parameter_argc,4
-        .comm operatingsystem_parameter_argv,4
-
-/*
-
-  Revision 1.9  2004/09/02 18:57:37  marco
-   * fixed argc<->argv
-
-  Revision 1.8  2004/08/18 14:26:50  karoly
-    * quick fix to make it compile
-
-  Revision 1.7  2004/07/03 21:50:31  daniel
-    * Modified bootstrap code so separate prt0.as/prt0_10.as files are no
-      longer necessary
-
-  Revision 1.6  2004/01/04 17:28:03  florian
-    * clean up
-
-  Revision 1.5  2004/01/04 17:12:28  florian
-    * arg* and envp handling fixed
-
-  Revision 1.4  2003/12/28 20:08:53  florian
-    * initial code
-
-  Revision 1.3  2002/09/07 16:01:20  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.2  2002/07/26 17:09:44  florian
-    * log fixed
-
-  Revision 1.1  2002/07/26 17:07:11  florian
-    + dummy implementation to test the makefile
-*/
+/*
+ * Startup code for programs linked with GNU libc, PowerPC
+ * version.
+ *
+ * Adapted from the glibc-sources (2.3.5) in the file
+ * 
+ *     sysdeps/powerpc/powerpc32/elf/start.S
+ *
+ * Original header follows.
+ */
+
+/* Startup code for programs linked with GNU libc.
+   Copyright (C) 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library 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.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  
+*/
+
+/* These are the various addresses we require.  */
+    .section ".rodata"
+    .align    2
+start_addresses:
+    .long     _SDA_BASE_
+    .long     main_stub
+    .long     __libc_csu_init
+    .long     __libc_csu_fini
+    .size   start_adresses, .-start_addresses
+
+    .section ".text"
+    .globl  _start
+_start:
+    /* save stack pointer for later use */
+    mr     9, 1
+ /* Set up an initial stack frame, and clear the LR.  */
+    clrrwi 1, 1, 4
+    li     0, 0
+    stwu   1, -16(1)
+    mtlr   0
+    stw    0, 0(1)
+ /* Set r13 to point at the 'small data area', and put the address of
+    start_addresses in r8...  */
+    lis    8,  start_addresses@ha
+    lwzu   13, start_addresses@l(8)
+ /* and continue in libc-start, in glibc.  */
+    b      __libc_start_main
+
+    .globl  main_stub
+    .type   main_stub, @function
+main_stub:
+ /* save link register and setup stack frame */ 
+    mflr    0
+    stw     0, 0(1)
+    stwu    1, -16(1)
+
+    lis     11, operatingsystem_parameter_argc@ha
+    stw      3, operatingsystem_parameter_argc@l(11);
+
+    lis     11, operatingsystem_parameter_argv@ha
+    stw      4, operatingsystem_parameter_argv@l(11);
+
+    lis     11, operatingsystem_parameter_envp@ha
+    stw      5, operatingsystem_parameter_envp@l(11);
+
+    lis     11, ___fpc_ret@ha
+    stw     1, ___fpc_ret@l(11)
+
+    bl      PASCALMAIN
+
+    .globl  _haltproc
+    .type   _haltproc, @function
+_haltproc:
+    lis     11, ___fpc_ret@ha
+    lwz     1, ___fpc_ret@l(11)
+    addi    1, 1, 16
+    lwz     0, 0(1)
+    mtlr    0
+    blr
+
+#    li      0, 1       /* exit call */
+#    lis     3, operatingsystem_result@h
+#    stw     3, operatingsystem_result@l(3)
+#    sc
+#    b       _haltproc
+
+ /* Define a symbol for the first piece of initialized data.  */
+    .section ".data"
+    .globl   __data_start
+__data_start:
+data_start:
+
+___fpc_ret:                            /* return address to libc */
+    .long   0
+
+.text
+    .comm operatingsystem_parameter_envp, 4
+    .comm operatingsystem_parameter_argc, 4
+    .comm operatingsystem_parameter_argv, 4
+

+ 102 - 41
rtl/linux/powerpc/stat.inc

@@ -1,7 +1,9 @@
 {
 {
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
-    Copyright (c) 1999-2000 by Jonas Maebe,
-    member of the Free Pascal development team.
+    Copyright (c) 1999-2000 by Jonas Maebe, (c) 2005 Thomas Schatzl,
+    members of the Free Pascal development team.
+
+    Contains the definition of the stat type for the PowerPC platform.
 
 
     See the file COPYING.FPC, included in this distribution,
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
     for details about the copyright.
@@ -12,45 +14,104 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
-  Stat = packed Record  // No unix typing because of differences
+{ This structure was ported from 
+
+    /usr/include/asm-ppc/stat.h
+
+  on a 2.6.11 kernel.
+}
+
+{$PACKRECORDS C}
+
+{$IFNDEF FPC_USE_LIBC}
+  stat = record
     case byte of
     case byte of
-      0: (st_dev    : cardinal;
-          st_ino,
-          st_mode   : cardinal;
-          nlink     : word;
-          __pad1    : word;
-          uid,
-          gid,
-          rdev      : cardinal;
-          st_size   : longint;
-          st_blksize,
-          st_blocks,
-          st_atime,
-          __unused1,
-          st_mtime,
-          __unused2,
-          st_ctime,
-          __unused3,
-          __unused4,
-          __unused5  : cardinal;);
-      1: (dev    : cardinal;
-          ino,
-          mode   : cardinal;
-          nlink_dummy     : word;
-          __pad2    : word;
-          uid_dummy,
-          gid_dummy,
-          rdev_dummy      : cardinal;
-          size   : longint;
-          blksize,
-          blocks,
-          atime,
-          __unused1_dummy,
-          mtime,
-          __unused2_dummy,
-          ctime,
-          __unused3_dummy,
-          __unused4_dummy,
-          __unused5_dummy  : cardinal;);
+      0: (
+        st_dev     : cULong;   { actually dev_t, but this one is defined wrongly }
+        st_ino     : ino_t;
+        st_mode    : mode_t;
+        st_nlink   : nlink_t;
+        st_uid     : uid_t;
+        st_gid     : gid_t;
+        st_rdev    : cULong;   { actually dev_t, but this one is defined wrongly }
+        st_size    : off_t;
+        st_blksize : cULong;
+        st_blocks  : cULong;
+        st_atime,
+        __unused1,
+        st_mtime,
+        __unused2,
+        st_ctime,
+        __unused3,
+        __unused4,
+        __unused5  : cULong);
+      1: (
+        dev    : cULong;
+        ino    : ino_t;
+        mode   : mode_t;
+        nlink  : nlink_t;
+        uid    : uid_t;
+        gid    : gid_t;
+        rdev   : cULong;
+        size   : off_t;
+        blksize,
+        blocks,
+        atime,
+        __unused1_dummy,
+        mtime,
+        __unused2_dummy,
+        ctime,
+        __unused3_dummy,
+        __unused4_dummy,
+        __unused5_dummy  : cULong);
   end;
   end;
 
 
+{$ELSE FPC_USE_LIBC}
+
+{ when linking to libc, we need to use some other, 64 bit enhanced stat type.
+ Found out by having too much time on hand and some sophisticated guessing. }
+
+  stat = record
+    case byte of
+      0: (
+        st_dev     : cULongLong;
+        st_ino     : cULongLong;
+        st_mode    : mode_t;
+        st_nlink   : nlink_t;
+        st_uid     : uid_t;
+        st_gid     : gid_t;
+        st_rdev    : cULongLong;
+        st_size    : cLongLong;
+        st_blksize : cULong;
+        st_blocks  : cULong;
+        st_atime,
+        __unused1,
+        st_mtime,
+        __unused2,
+        st_ctime,
+        __unused3,
+        __unused4,
+        __unused5  : cULong);
+      1: (
+        dev    : cULongLong;
+        ino    : cULongLong;
+        mode   : mode_t;
+        nlink  : nlink_t;
+        uid    : uid_t;
+        gid    : gid_t;
+        rdev   : cULongLong;
+        size   : cLongLong;
+        blksize,
+        blocks,
+        atime,
+        __unused1_dummy,
+        mtime,
+        __unused2_dummy,
+        ctime,
+        __unused3_dummy,
+        __unused4_dummy,
+        __unused5_dummy  : cULong);
+  end;
+
+{$ENDIF FPC_USE_LIBC}
+

+ 43 - 37
rtl/morphos/Makefile

@@ -246,115 +246,115 @@ endif
 OBJPASDIR=$(RTL)/objpas
 OBJPASDIR=$(RTL)/objpas
 GRAPHDIR=$(INC)/graph
 GRAPHDIR=$(INC)/graph
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition clipboard asl ahi get9 fpmkunit
+override TARGET_UNITS+=$(SYSTEMUNIT) objpas macpas strings dos sysutils classes math typinfo varutils charset ucomplex getopts matrix variants types rtlconsts sysconst dateutil exec timer doslib utility hardware inputevent graphics layers intuition aboxlib mui clipboard datatypes asl ahi tinygl get9 muihelper fpmkunit
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_LOADERS+=prt0
 override TARGET_LOADERS+=prt0
@@ -2062,7 +2062,13 @@ graphics$(PPUEXT): graphics.pas exec$(PPUEXT) utility$(PPUEXT) hardware$(PPUEXT)
 layers$(PPUEXT)  : layers.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
 layers$(PPUEXT)  : layers.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
 intuition$(PPUEXT): intuition.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT) \
 intuition$(PPUEXT): intuition.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT) \
 		    inputevent$(PPUEXT) timer$(PPUEXT) layers$(PPUEXT)
 		    inputevent$(PPUEXT) timer$(PPUEXT) layers$(PPUEXT)
+aboxlib$(PPUEXT): aboxlib.pas
 clipboard$(PPUEXT): clipboard.pas exec$(PPUEXT)
 clipboard$(PPUEXT): clipboard.pas exec$(PPUEXT)
+datatype$(PPUEXT): datatypes.pas exec$(PPUEXT) doslib$(PPUEXT) intuition$(PPUEXT) \
+		   utility$(PPUEXT) graphics$(PPUEXT)
 asl$(PPUEXT): asl.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
 asl$(PPUEXT): asl.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
 ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
 ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
+mui$(PPUEXT): mui.pas exec$(PPUEXT) utility$(PPUEXT) intuition$(PPUEXT) graphics$(PPUEXT)
+tinygl$(PPUEXT): tinygl.pp exec$(PPUEXT)
 get9$(PPUEXT): get9.pas exec$(PPUEXT)
 get9$(PPUEXT): get9.pas exec$(PPUEXT)
+muihelper$(PPUEXT): muihelper.pas intuition$(PPUEXT) mui$(PPUEXT) doslib$(PPUEXT) utility$(PPUEXT)

+ 9 - 1
rtl/morphos/Makefile.fpc

@@ -13,7 +13,9 @@ units=$(SYSTEMUNIT) objpas macpas strings \
       charset ucomplex getopts matrix \
       charset ucomplex getopts matrix \
       variants types rtlconsts sysconst dateutil \
       variants types rtlconsts sysconst dateutil \
       exec timer doslib utility hardware inputevent graphics layers \
       exec timer doslib utility hardware inputevent graphics layers \
-      intuition aboxlib clipboard datatypes asl ahi get9 \
+      intuition aboxlib mui \
+# these can be moved to packages later
+      clipboard datatypes asl ahi tinygl get9 muihelper \
       fpmkunit
       fpmkunit
 rsts=math rtlconsts varutils typinfo variants classes sysconst dateutil fpmkunit
 rsts=math rtlconsts varutils typinfo variants classes sysconst dateutil fpmkunit
 
 
@@ -205,4 +207,10 @@ asl$(PPUEXT): asl.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
 
 
 ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
 ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
 
 
+mui$(PPUEXT): mui.pas exec$(PPUEXT) utility$(PPUEXT) intuition$(PPUEXT) graphics$(PPUEXT)
+
+tinygl$(PPUEXT): tinygl.pp exec$(PPUEXT)
+
 get9$(PPUEXT): get9.pas exec$(PPUEXT)
 get9$(PPUEXT): get9.pas exec$(PPUEXT)
+
+muihelper$(PPUEXT): muihelper.pas intuition$(PPUEXT) mui$(PPUEXT) doslib$(PPUEXT) utility$(PPUEXT)

+ 64 - 0
rtl/morphos/aboxlib.pas

@@ -21,10 +21,22 @@ unit aboxlib;
 interface
 interface
 
 
 function DoMethod(obj : longword; msg : array of LongWord): longword;
 function DoMethod(obj : longword; msg : array of LongWord): longword;
+function DoMethod(obj : pointer; msg : array of LongWord): longword; inline;
 function DoMethodA(obj : longword; msg1 : Pointer): longword; assembler;
 function DoMethodA(obj : longword; msg1 : Pointer): longword; assembler;
 
 
+function DoSuperMethod(class_: longword; obj : longword; msg : array of LongWord): longword;
+function DoSuperMethodA(class_: longword; obj : longword; msg1 : Pointer): longword; assembler;
+function DoSuperMethodA(class_: pointer; obj : pointer; msg1 : Pointer): longword; inline;
+
+function DoSuperNew(class_: pointer; obj: pointer; tags: array of LongWord): longword;
+
+// This procedure is used to pop dispatcher args from emulstruc
+procedure DISPATCHERARG(var cl; var obj; var msg); assembler;
+
 implementation
 implementation
 
 
+uses intuition;
+
 function DoMethodA(obj : longword; msg1 : Pointer): longword; assembler;
 function DoMethodA(obj : longword; msg1 : Pointer): longword; assembler;
 asm
 asm
   mflr r31
   mflr r31
@@ -47,4 +59,56 @@ begin
   DoMethod:=DoMethodA(obj, @msg);
   DoMethod:=DoMethodA(obj, @msg);
 end;
 end;
 
 
+function DoMethod(obj : pointer; msg : array of LongWord): longword; inline;
+begin
+  DoMethod:=DoMethodA(DWord(obj), @msg);
+end;
+
+function DoSuperMethodA(class_: longword; obj : longword; msg1 : Pointer): longword; assembler;
+asm
+  mflr r31
+
+  lwz r9,24(r3)
+  stw r9,32(r2)
+  stw r5,36(r2)
+  stw r4,40(r2)
+
+  lwz r11,104(r2)
+  lwz r3,8(r9)
+  mtlr r11
+  blrl
+
+  mtlr r31
+end ['R31'];
+
+function DoSuperMethodA(class_: pointer; obj : pointer; msg1 : Pointer): longword; inline;
+begin
+  DoSuperMethodA:=DoSuperMethodA(DWord(class_),DWord(obj),msg1);
+end;
+
+function DoSuperMethod(class_: longword; obj : longword; msg : array of LongWord): longword;
+begin
+  DoSuperMethod:=DoSuperMethodA(class_, obj, @msg);
+end;
+
+function DoSuperNew(class_: pointer; obj: pointer; tags: array of LongWord): longword;
+var opSet: topSet;
+begin
+  opSet.MethodID := OM_NEW;
+  opSet.ops_AttrList := @tags;
+  opSet.ops_GInfo := nil;
+  DoSuperNew:=DoSuperMethodA(class_,obj,@opset);
+end;
+
+// This procedure is used to pop dispatcher args from emulstruc
+procedure DISPATCHERARG(var cl; var obj; var msg); assembler;
+asm
+  lwz r6,32(r2) // REG_a0
+  stw r6,(r3)   // cl
+  lwz r6,40(r2) // REG_a2
+  stw r6,(r4)   // obj
+  lwz r6,36(r2) // REG_a1
+  stw r6,(r5)   // msg
+end;
+
 end.
 end.

+ 1 - 1
rtl/morphos/asl.pas

@@ -2,7 +2,7 @@
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
     Copyright (c) 2005 Karoly Balogh for Genesi S.a.r.l.
     Copyright (c) 2005 Karoly Balogh for Genesi S.a.r.l.
 
 
-    intuition.library interface unit for MorphOS/PowerPC
+    asl.library interface unit for MorphOS/PowerPC
 
 
     Based on work of Nils Sjoholm member of the Amiga RTL
     Based on work of Nils Sjoholm member of the Amiga RTL
     development team.
     development team.

+ 30 - 0
rtl/morphos/emuld.inc

@@ -16,6 +16,36 @@
 
 
  **********************************************************************}
  **********************************************************************}
 
 
+{ * emulinterface consts from MorphOS SDK * }
+
+const
+  TRAP_MASK            = $00ff;
+  TRAP_AREA_START      = $ff00;      { * $ff00 .. $ffff area * }
+  TRAP_LIB             = $ff00;
+  TRAP_LIB_QUICK       = $ff01;
+  TRAP_LIBNR           = $ff05;
+  TRAP_LIBNR_QUICK     = $ff06;
+  TRAP_ISYNC           = $ff0f;
+  TRAP_SYNC            = $ff10;
+  TRAP_EIEIO           = $ff11;
+  TRAP_LIBSR           = $ff12;
+  TRAP_LIBSRNR         = $ff13;
+  TRAP_LIBD0_D1        = $ff14;
+  TRAP_LIBRESTORE      = $ff15;
+  TRAP_LIBD0D1SR       = $ff17;
+  TRAP_LIBD0D1A0A1SR   = $ff18;
+
+const
+  EMULTAG_NAME             = $0;    { * Gives back a Name Ptr * }
+  EMULTAG_VERSION          = $1;    { * Gives back a Version  * }
+  EMULTAG_REVISION         = $2;    { * Gives back a Revision * }
+  EMULTAG_OPCODETABLE      = $3;    { * Gives back the 16 Bit Opcodetable Ptr or NULL * }
+  EMULTAG_TYPE             = $4;    { * Gives back the emulation type   * }
+  EMULTAG_EMULHANDLE       = $5;    { * Gives back the EmulHandle Ptr   * }
+  EMULTAG_EMULHANDLESIZE   = $6;    { * Gives back the EmulHandle Size  * }
+  EMULTAG_SUPERHANDLE      = $7;    { * Gives back the SuperHandle Ptr  * }
+  EMULTAG_SUPERHANDLESIZE  = $8;    { * Gives back the SuperHandle Size * }
+
 { * emulinterface structures from MorphOS SDK * }
 { * emulinterface structures from MorphOS SDK * }
 
 
 type
 type

Some files were not shown because too many files changed in this diff