From e27a49450afb99dda698457b4784f5c90bc289ca Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Tue, 7 Aug 2018 21:36:49 +0300 Subject: [PATCH 01/36] fpc/linux compatibility --- jcl/source/common/JclAbstractContainers.pas | 24 +- jcl/source/common/JclAnsiStrings.pas | 18 +- jcl/source/common/JclArrayLists.pas | 2 +- jcl/source/common/JclArraySets.pas | 5 +- jcl/source/common/JclBase.pas | 33 +- jcl/source/common/JclBinaryTrees.pas | 2 +- jcl/source/common/JclCompression.pas | 24 +- jcl/source/common/JclCounter.pas | 4 + jcl/source/common/JclDateTime.pas | 32 +- jcl/source/common/JclFileUtils.pas | 67 +- jcl/source/common/JclHashMaps.pas | 5 +- jcl/source/common/JclHashSets.pas | 2 +- jcl/source/common/JclLinkedLists.pas | 2 +- jcl/source/common/JclMath.pas | 34 +- jcl/source/common/JclPCRE.pas | 4 + jcl/source/common/JclQueues.pas | 5 +- jcl/source/common/JclRTTI.pas | 4 +- jcl/source/common/JclSimpleXml.pas | 11 +- jcl/source/common/JclSortedMaps.pas | 2 +- jcl/source/common/JclStacks.pas | 5 +- jcl/source/common/JclStreams.pas | 41 +- jcl/source/common/JclStringConversions.pas | 3 + jcl/source/common/JclStringLists.pas | 16 +- jcl/source/common/JclStrings.pas | 38 +- jcl/source/common/JclSysInfo.pas | 66 +- jcl/source/common/JclSysUtils.pas | 47 +- jcl/source/common/JclTrees.pas | 2 +- jcl/source/common/JclUnicode.pas | 49 +- jcl/source/common/JclUnitVersioning.pas | 2 +- jcl/source/common/JclVectors.pas | 2 +- jcl/source/common/JclWideStrings.pas | 2 +- jcl/source/common/bzip2.pas | 4 + jcl/source/common/pcre.pas | 4 + jcl/source/common/zlibh.pas | 6 + jcl/source/fpc/FpLibcCompatibility.pas | 110 ++ jcl/source/fpc/FpStringHash.pas | 80 + jcl/source/fpc/FpWinAPICompatibility.pas | 81 + jcl/source/fpc/libclite/aineth.inc | 24 + jcl/source/fpc/libclite/aioh.inc | 117 ++ jcl/source/fpc/libclite/aliasesh.inc | 28 + jcl/source/fpc/libclite/allocah.inc | 8 + jcl/source/fpc/libclite/argph.inc | 155 ++ jcl/source/fpc/libclite/argzh.inc | 33 + jcl/source/fpc/libclite/asocketh.inc | 39 + jcl/source/fpc/libclite/asockiosh.inc | 14 + jcl/source/fpc/libclite/bconfnameh.inc | 261 +++ jcl/source/fpc/libclite/bdirenth.inc | 37 + jcl/source/fpc/libclite/bdlfcnh.inc | 17 + jcl/source/fpc/libclite/bfcntlh.inc | 119 ++ jcl/source/fpc/libclite/bfenvh.inc | 55 + jcl/source/fpc/libclite/binh.inc | 99 + jcl/source/fpc/libclite/bipch.inc | 40 + jcl/source/fpc/libclite/bmmanh.inc | 50 + jcl/source/fpc/libclite/bmsqh.inc | 54 + jcl/source/fpc/libclite/bnetdbh.inc | 18 + jcl/source/fpc/libclite/bpollh.inc | 23 + jcl/source/fpc/libclite/bresourceh.inc | 97 + jcl/source/fpc/libclite/bschedh.inc | 42 + jcl/source/fpc/libclite/bselecth.inc | 88 + jcl/source/fpc/libclite/bsemh.inc | 55 + jcl/source/fpc/libclite/bshmh.inc | 75 + jcl/source/fpc/libclite/bsockaddrh.inc | 13 + jcl/source/fpc/libclite/bsocket.inc | 51 + jcl/source/fpc/libclite/bsocketh.inc | 256 +++ jcl/source/fpc/libclite/bstatfsh.inc | 41 + jcl/source/fpc/libclite/bstath.inc | 93 + jcl/source/fpc/libclite/bstatvfsh.inc | 61 + jcl/source/fpc/libclite/bstroptsh.inc | 140 ++ jcl/source/fpc/libclite/btermiosh.inc | 193 ++ jcl/source/fpc/libclite/btimeh.inc | 33 + jcl/source/fpc/libclite/buioh.inc | 20 + jcl/source/fpc/libclite/bustath.inc | 19 + jcl/source/fpc/libclite/butmph.inc | 61 + jcl/source/fpc/libclite/butmpxh.inc | 41 + jcl/source/fpc/libclite/butsnameh.inc | 11 + jcl/source/fpc/libclite/bwaitflags.inc | 44 + jcl/source/fpc/libclite/bwaitflagsh.inc | 13 + jcl/source/fpc/libclite/bwaitstatus.inc | 53 + jcl/source/fpc/libclite/bwaitstatush.inc | 19 + jcl/source/fpc/libclite/cerrno.inc | 16 + jcl/source/fpc/libclite/crypth.inc | 35 + jcl/source/fpc/libclite/ctypeh.inc | 26 + jcl/source/fpc/libclite/dirent.inc | 14 + jcl/source/fpc/libclite/direnth.inc | 74 + jcl/source/fpc/libclite/dlfcnh.inc | 33 + jcl/source/fpc/libclite/endianh.inc | 20 + jcl/source/fpc/libclite/envzh.inc | 17 + jcl/source/fpc/libclite/errh.inc | 15 + jcl/source/fpc/libclite/errnoh.inc | 157 ++ jcl/source/fpc/libclite/errorh.inc | 9 + jcl/source/fpc/libclite/fcntlh.inc | 47 + jcl/source/fpc/libclite/fenvh.inc | 27 + jcl/source/fpc/libclite/fileh.inc | 15 + jcl/source/fpc/libclite/fmtmsgh.inc | 41 + jcl/source/fpc/libclite/fnmatchh.inc | 24 + jcl/source/fpc/libclite/fpmake.inc | 11 + jcl/source/fpc/libclite/fpmake.pp | 17 + jcl/source/fpc/libclite/fstabh.inc | 37 + jcl/source/fpc/libclite/gconfigh.inc | 66 + jcl/source/fpc/libclite/gconvh.inc | 109 ++ jcl/source/fpc/libclite/getopth.inc | 34 + jcl/source/fpc/libclite/glibc_versionh.inc | 9 + jcl/source/fpc/libclite/globh.inc | 87 + jcl/source/fpc/libclite/glue.inc | 51 + jcl/source/fpc/libclite/grph.inc | 45 + jcl/source/fpc/libclite/iconvh.inc | 16 + jcl/source/fpc/libclite/igmph.inc | 6 + jcl/source/fpc/libclite/inttypesh.inc | 15 + jcl/source/fpc/libclite/ioctl_typesh.inc | 62 + jcl/source/fpc/libclite/ioctlsh.inc | 62 + jcl/source/fpc/libclite/kioctlsh.inc | 109 ++ jcl/source/fpc/libclite/langinfoh.inc | 375 ++++ jcl/source/fpc/libclite/lib_namesh.inc | 29 + jcl/source/fpc/libclite/libclite.pp | 255 +++ jcl/source/fpc/libclite/libgenh.inc | 11 + jcl/source/fpc/libclite/libintlh.inc | 19 + jcl/source/fpc/libclite/libio.inc | 83 + jcl/source/fpc/libclite/libioh.inc | 312 ++++ jcl/source/fpc/libclite/limitsh.inc | 23 + jcl/source/fpc/libclite/local_limh.inc | 12 + jcl/source/fpc/libclite/localeh.inc | 79 + jcl/source/fpc/libclite/malloch.inc | 76 + jcl/source/fpc/libclite/mcheckh.inc | 27 + jcl/source/fpc/libclite/mntenth.inc | 48 + jcl/source/fpc/libclite/monetaryh.inc | 13 + jcl/source/fpc/libclite/nashh.inc | 22 + jcl/source/fpc/libclite/nath.inc | 10 + jcl/source/fpc/libclite/nax25h.inc | 144 ++ jcl/source/fpc/libclite/nech.inc | 34 + jcl/source/fpc/libclite/netdbh.inc | 199 ++ jcl/source/fpc/libclite/netherh.inc | 18 + jcl/source/fpc/libclite/nethernet.inc | 4 + jcl/source/fpc/libclite/netherneth.inc | 46 + jcl/source/fpc/libclite/nicmp6.inc | 31 + jcl/source/fpc/libclite/nicmp6h.inc | 190 ++ jcl/source/fpc/libclite/nif_arph.inc | 119 ++ jcl/source/fpc/libclite/nif_ether.inc | 12 + jcl/source/fpc/libclite/nif_etherh.inc | 21 + jcl/source/fpc/libclite/nif_fddih.inc | 15 + jcl/source/fpc/libclite/nif_packeth.inc | 14 + jcl/source/fpc/libclite/nif_ppp.inc | 133 ++ jcl/source/fpc/libclite/nif_ppph.inc | 94 + jcl/source/fpc/libclite/nif_shaperh.inc | 30 + jcl/source/fpc/libclite/nif_trh.inc | 18 + jcl/source/fpc/libclite/nifh.inc | 107 ++ jcl/source/fpc/libclite/nigmph.inc | 22 + jcl/source/fpc/libclite/nin.inc | 123 ++ jcl/source/fpc/libclite/nin_systmh.inc | 17 + jcl/source/fpc/libclite/ninh.inc | 181 ++ jcl/source/fpc/libclite/nip.inc | 25 + jcl/source/fpc/libclite/nip6h.inc | 68 + jcl/source/fpc/libclite/nip_icmp.inc | 25 + jcl/source/fpc/libclite/nip_icmph.inc | 162 ++ jcl/source/fpc/libclite/niph.inc | 140 ++ jcl/source/fpc/libclite/nipxh.inc | 84 + jcl/source/fpc/libclite/nl_typesh.inc | 22 + jcl/source/fpc/libclite/nnetromh.inc | 63 + jcl/source/fpc/libclite/npacketh.inc | 47 + jcl/source/fpc/libclite/nroseh.inc | 91 + jcl/source/fpc/libclite/nroute.inc | 19 + jcl/source/fpc/libclite/nrouteh.inc | 107 ++ jcl/source/fpc/libclite/nssh.inc | 19 + jcl/source/fpc/libclite/ntcph.inc | 119 ++ jcl/source/fpc/libclite/nudph.inc | 19 + jcl/source/fpc/libclite/nupdh.inc | 6 + jcl/source/fpc/libclite/pathsh.inc | 35 + jcl/source/fpc/libclite/posix1_limh.inc | 36 + jcl/source/fpc/libclite/posix2_limh.inc | 24 + jcl/source/fpc/libclite/posixopth.inc | 46 + jcl/source/fpc/libclite/printfh.inc | 45 + jcl/source/fpc/libclite/proutedh.inc | 48 + jcl/source/fpc/libclite/prwhodh.inc | 37 + jcl/source/fpc/libclite/ptalkdh.inc | 56 + jcl/source/fpc/libclite/pthread.inc | 23 + jcl/source/fpc/libclite/pthreadh.inc | 266 +++ jcl/source/fpc/libclite/pthreadtypesh.inc | 140 ++ jcl/source/fpc/libclite/ptimedh.inc | 60 + jcl/source/fpc/libclite/ptyh.inc | 10 + jcl/source/fpc/libclite/pwdh.inc | 44 + jcl/source/fpc/libclite/regexh.inc | 184 ++ jcl/source/fpc/libclite/regexph.inc | 128 ++ jcl/source/fpc/libclite/saccth.inc | 50 + jcl/source/fpc/libclite/schedh.inc | 19 + jcl/source/fpc/libclite/searchh.inc | 94 + jcl/source/fpc/libclite/semaphoreh.inc | 52 + jcl/source/fpc/libclite/sfsuidh.inc | 9 + jcl/source/fpc/libclite/sgttyh.inc | 17 + jcl/source/fpc/libclite/shadowh.inc | 46 + jcl/source/fpc/libclite/sigactionh.inc | 47 + jcl/source/fpc/libclite/sigcontexth.inc | 89 + jcl/source/fpc/libclite/siginfoh.inc | 167 ++ jcl/source/fpc/libclite/signalh.inc | 90 + jcl/source/fpc/libclite/signumh.inc | 52 + jcl/source/fpc/libclite/sigseth.inc | 31 + jcl/source/fpc/libclite/sigstackh.inc | 38 + jcl/source/fpc/libclite/sigthreadh.inc | 10 + jcl/source/fpc/libclite/sioctlh.inc | 10 + jcl/source/fpc/libclite/sipch.inc | 10 + jcl/source/fpc/libclite/skdaemonh.inc | 8 + jcl/source/fpc/libclite/sklogh.inc | 9 + jcl/source/fpc/libclite/smmaph.inc | 32 + jcl/source/fpc/libclite/smounth.inc | 30 + jcl/source/fpc/libclite/smsgh.inc | 23 + jcl/source/fpc/libclite/spawnh.inc | 87 + jcl/source/fpc/libclite/spermh.inc | 10 + jcl/source/fpc/libclite/spollh.inc | 23 + jcl/source/fpc/libclite/sptraceh.inc | 57 + jcl/source/fpc/libclite/squota.inc | 34 + jcl/source/fpc/libclite/squotah.inc | 75 + jcl/source/fpc/libclite/sraw.inc | 15 + jcl/source/fpc/libclite/srawh.inc | 23 + jcl/source/fpc/libclite/srebooth.inc | 17 + jcl/source/fpc/libclite/sresourceh.inc | 23 + jcl/source/fpc/libclite/sscsi_ioctlh.inc | 16 + jcl/source/fpc/libclite/sscsih.inc | 159 ++ jcl/source/fpc/libclite/sselect.inc | 33 + jcl/source/fpc/libclite/sselecth.inc | 33 + jcl/source/fpc/libclite/ssemh.inc | 25 + jcl/source/fpc/libclite/ssendfileh.inc | 10 + jcl/source/fpc/libclite/ssgh.inc | 142 ++ jcl/source/fpc/libclite/sshmh.inc | 14 + jcl/source/fpc/libclite/ssocketh.inc | 51 + jcl/source/fpc/libclite/sstat.inc | 116 ++ jcl/source/fpc/libclite/sstatfsh.inc | 16 + jcl/source/fpc/libclite/sstath.inc | 101 ++ jcl/source/fpc/libclite/sstatvfsh.inc | 17 + jcl/source/fpc/libclite/sswaph.inc | 14 + jcl/source/fpc/libclite/ssysctlh.inc | 11 + jcl/source/fpc/libclite/ssysinfoh.inc | 34 + jcl/source/fpc/libclite/ssyslog.inc | 31 + jcl/source/fpc/libclite/ssyslogh.inc | 127 ++ jcl/source/fpc/libclite/stdinth.inc | 97 + jcl/source/fpc/libclite/stdio_exth.inc | 22 + jcl/source/fpc/libclite/stdio_limh.inc | 22 + jcl/source/fpc/libclite/stdioh.inc | 161 ++ jcl/source/fpc/libclite/stdlib.inc | 6 + jcl/source/fpc/libclite/stdlibh.inc | 210 +++ jcl/source/fpc/libclite/stime.inc | 79 + jcl/source/fpc/libclite/stimebh.inc | 19 + jcl/source/fpc/libclite/stimeh.inc | 80 + jcl/source/fpc/libclite/stringh.inc | 68 + jcl/source/fpc/libclite/stroptsh.inc | 14 + jcl/source/fpc/libclite/sttydefaults.inc | 5 + jcl/source/fpc/libclite/sttydefaultsh.inc | 46 + jcl/source/fpc/libclite/sucontexth.inc | 87 + jcl/source/fpc/libclite/suioh.inc | 12 + jcl/source/fpc/libclite/sun.inc | 6 + jcl/source/fpc/libclite/sunh.inc | 17 + jcl/source/fpc/libclite/suserh.inc | 87 + jcl/source/fpc/libclite/sustath.inc | 9 + jcl/source/fpc/libclite/sutsnameh.inc | 31 + jcl/source/fpc/libclite/svlimith.inc | 22 + jcl/source/fpc/libclite/svtimesh.inc | 32 + jcl/source/fpc/libclite/swaith.inc | 34 + jcl/source/fpc/libclite/sysexitsh.inc | 27 + jcl/source/fpc/libclite/syslogh.inc | 6 + jcl/source/fpc/libclite/systypeshh.inc | 54 + jcl/source/fpc/libclite/termios.inc | 5 + jcl/source/fpc/libclite/termiosh.inc | 29 + jcl/source/fpc/libclite/time.inc | 4 + jcl/source/fpc/libclite/timeh.inc | 112 ++ jcl/source/fpc/libclite/timesh.inc | 22 + jcl/source/fpc/libclite/timexh.inc | 96 + jcl/source/fpc/libclite/ttyenth.inc | 36 + jcl/source/fpc/libclite/types.inc | 11 + jcl/source/fpc/libclite/typesh.inc | 229 +++ jcl/source/fpc/libclite/ucontexth.inc | 21 + jcl/source/fpc/libclite/ulimith.inc | 16 + jcl/source/fpc/libclite/unistdh.inc | 202 +++ jcl/source/fpc/libclite/utimeh.inc | 20 + jcl/source/fpc/libclite/utmph.inc | 37 + jcl/source/fpc/libclite/utmpxh.inc | 29 + jcl/source/fpc/libclite/wcharh.inc | 122 ++ jcl/source/fpc/libclite/wctypeh.inc | 54 + jcl/source/fpc/libclite/wordexph.inc | 41 + jcl/source/fpc/libclite/wordsizeh.inc | 4 + jcl/source/fpc/libclite/xlocaleh.inc | 21 + jcl/source/fpc/libclite/xopen_limh.inc | 13 + jcl/source/include/jcl.inc | 5 + jcl/source/include/jedi.inc | 1813 +++++++++++++++++++ jcl/source/include/kylix.inc | 30 + jcl/source/include/windowsonly.inc | 2 +- jcl/source/prototypes/JclArrayLists.pas | 5 +- jcl/source/prototypes/JclArraySets.pas | 2 +- jcl/source/prototypes/JclBinaryTrees.pas | 5 +- jcl/source/prototypes/JclGraphics.pas | 65 + jcl/source/prototypes/JclHashMaps.pas | 5 +- jcl/source/prototypes/JclHashSets.pas | 5 +- jcl/source/prototypes/JclLinkedLists.pas | 2 +- jcl/source/prototypes/JclQueues.pas | 2 +- jcl/source/prototypes/JclSortedMaps.pas | 5 +- jcl/source/prototypes/JclStacks.pas | 2 +- jcl/source/prototypes/JclTrees.pas | 5 +- jcl/source/prototypes/JclVectors.pas | 5 +- jcl/source/vcl/JclGraphUtils.pas | 48 +- jcl/source/vcl/JclGraphics.pas | 65 + jcl/source/vcl/JclVclResources.pas | 3 +- jcl/source/vcl/JclVersionCtrlSVNImpl.pas | 3 + jcl/source/windows/JclMiscel.pas | 3 + jcl/source/windows/JclRegistry.pas | 2 +- jcl/source/windows/JclShell.pas | 4 +- 301 files changed, 16587 insertions(+), 141 deletions(-) create mode 100644 jcl/source/fpc/FpLibcCompatibility.pas create mode 100644 jcl/source/fpc/FpStringHash.pas create mode 100644 jcl/source/fpc/FpWinAPICompatibility.pas create mode 100644 jcl/source/fpc/libclite/aineth.inc create mode 100644 jcl/source/fpc/libclite/aioh.inc create mode 100644 jcl/source/fpc/libclite/aliasesh.inc create mode 100644 jcl/source/fpc/libclite/allocah.inc create mode 100644 jcl/source/fpc/libclite/argph.inc create mode 100644 jcl/source/fpc/libclite/argzh.inc create mode 100644 jcl/source/fpc/libclite/asocketh.inc create mode 100644 jcl/source/fpc/libclite/asockiosh.inc create mode 100644 jcl/source/fpc/libclite/bconfnameh.inc create mode 100644 jcl/source/fpc/libclite/bdirenth.inc create mode 100644 jcl/source/fpc/libclite/bdlfcnh.inc create mode 100644 jcl/source/fpc/libclite/bfcntlh.inc create mode 100644 jcl/source/fpc/libclite/bfenvh.inc create mode 100644 jcl/source/fpc/libclite/binh.inc create mode 100644 jcl/source/fpc/libclite/bipch.inc create mode 100644 jcl/source/fpc/libclite/bmmanh.inc create mode 100644 jcl/source/fpc/libclite/bmsqh.inc create mode 100644 jcl/source/fpc/libclite/bnetdbh.inc create mode 100644 jcl/source/fpc/libclite/bpollh.inc create mode 100644 jcl/source/fpc/libclite/bresourceh.inc create mode 100644 jcl/source/fpc/libclite/bschedh.inc create mode 100644 jcl/source/fpc/libclite/bselecth.inc create mode 100644 jcl/source/fpc/libclite/bsemh.inc create mode 100644 jcl/source/fpc/libclite/bshmh.inc create mode 100644 jcl/source/fpc/libclite/bsockaddrh.inc create mode 100644 jcl/source/fpc/libclite/bsocket.inc create mode 100644 jcl/source/fpc/libclite/bsocketh.inc create mode 100644 jcl/source/fpc/libclite/bstatfsh.inc create mode 100644 jcl/source/fpc/libclite/bstath.inc create mode 100644 jcl/source/fpc/libclite/bstatvfsh.inc create mode 100644 jcl/source/fpc/libclite/bstroptsh.inc create mode 100644 jcl/source/fpc/libclite/btermiosh.inc create mode 100644 jcl/source/fpc/libclite/btimeh.inc create mode 100644 jcl/source/fpc/libclite/buioh.inc create mode 100644 jcl/source/fpc/libclite/bustath.inc create mode 100644 jcl/source/fpc/libclite/butmph.inc create mode 100644 jcl/source/fpc/libclite/butmpxh.inc create mode 100644 jcl/source/fpc/libclite/butsnameh.inc create mode 100644 jcl/source/fpc/libclite/bwaitflags.inc create mode 100644 jcl/source/fpc/libclite/bwaitflagsh.inc create mode 100644 jcl/source/fpc/libclite/bwaitstatus.inc create mode 100644 jcl/source/fpc/libclite/bwaitstatush.inc create mode 100644 jcl/source/fpc/libclite/cerrno.inc create mode 100644 jcl/source/fpc/libclite/crypth.inc create mode 100644 jcl/source/fpc/libclite/ctypeh.inc create mode 100644 jcl/source/fpc/libclite/dirent.inc create mode 100644 jcl/source/fpc/libclite/direnth.inc create mode 100644 jcl/source/fpc/libclite/dlfcnh.inc create mode 100644 jcl/source/fpc/libclite/endianh.inc create mode 100644 jcl/source/fpc/libclite/envzh.inc create mode 100644 jcl/source/fpc/libclite/errh.inc create mode 100644 jcl/source/fpc/libclite/errnoh.inc create mode 100644 jcl/source/fpc/libclite/errorh.inc create mode 100644 jcl/source/fpc/libclite/fcntlh.inc create mode 100644 jcl/source/fpc/libclite/fenvh.inc create mode 100644 jcl/source/fpc/libclite/fileh.inc create mode 100644 jcl/source/fpc/libclite/fmtmsgh.inc create mode 100644 jcl/source/fpc/libclite/fnmatchh.inc create mode 100644 jcl/source/fpc/libclite/fpmake.inc create mode 100644 jcl/source/fpc/libclite/fpmake.pp create mode 100644 jcl/source/fpc/libclite/fstabh.inc create mode 100644 jcl/source/fpc/libclite/gconfigh.inc create mode 100644 jcl/source/fpc/libclite/gconvh.inc create mode 100644 jcl/source/fpc/libclite/getopth.inc create mode 100644 jcl/source/fpc/libclite/glibc_versionh.inc create mode 100644 jcl/source/fpc/libclite/globh.inc create mode 100644 jcl/source/fpc/libclite/glue.inc create mode 100644 jcl/source/fpc/libclite/grph.inc create mode 100644 jcl/source/fpc/libclite/iconvh.inc create mode 100644 jcl/source/fpc/libclite/igmph.inc create mode 100644 jcl/source/fpc/libclite/inttypesh.inc create mode 100644 jcl/source/fpc/libclite/ioctl_typesh.inc create mode 100644 jcl/source/fpc/libclite/ioctlsh.inc create mode 100644 jcl/source/fpc/libclite/kioctlsh.inc create mode 100644 jcl/source/fpc/libclite/langinfoh.inc create mode 100644 jcl/source/fpc/libclite/lib_namesh.inc create mode 100644 jcl/source/fpc/libclite/libclite.pp create mode 100644 jcl/source/fpc/libclite/libgenh.inc create mode 100644 jcl/source/fpc/libclite/libintlh.inc create mode 100644 jcl/source/fpc/libclite/libio.inc create mode 100644 jcl/source/fpc/libclite/libioh.inc create mode 100644 jcl/source/fpc/libclite/limitsh.inc create mode 100644 jcl/source/fpc/libclite/local_limh.inc create mode 100644 jcl/source/fpc/libclite/localeh.inc create mode 100644 jcl/source/fpc/libclite/malloch.inc create mode 100644 jcl/source/fpc/libclite/mcheckh.inc create mode 100644 jcl/source/fpc/libclite/mntenth.inc create mode 100644 jcl/source/fpc/libclite/monetaryh.inc create mode 100644 jcl/source/fpc/libclite/nashh.inc create mode 100644 jcl/source/fpc/libclite/nath.inc create mode 100644 jcl/source/fpc/libclite/nax25h.inc create mode 100644 jcl/source/fpc/libclite/nech.inc create mode 100644 jcl/source/fpc/libclite/netdbh.inc create mode 100644 jcl/source/fpc/libclite/netherh.inc create mode 100644 jcl/source/fpc/libclite/nethernet.inc create mode 100644 jcl/source/fpc/libclite/netherneth.inc create mode 100644 jcl/source/fpc/libclite/nicmp6.inc create mode 100644 jcl/source/fpc/libclite/nicmp6h.inc create mode 100644 jcl/source/fpc/libclite/nif_arph.inc create mode 100644 jcl/source/fpc/libclite/nif_ether.inc create mode 100644 jcl/source/fpc/libclite/nif_etherh.inc create mode 100644 jcl/source/fpc/libclite/nif_fddih.inc create mode 100644 jcl/source/fpc/libclite/nif_packeth.inc create mode 100644 jcl/source/fpc/libclite/nif_ppp.inc create mode 100644 jcl/source/fpc/libclite/nif_ppph.inc create mode 100644 jcl/source/fpc/libclite/nif_shaperh.inc create mode 100644 jcl/source/fpc/libclite/nif_trh.inc create mode 100644 jcl/source/fpc/libclite/nifh.inc create mode 100644 jcl/source/fpc/libclite/nigmph.inc create mode 100644 jcl/source/fpc/libclite/nin.inc create mode 100644 jcl/source/fpc/libclite/nin_systmh.inc create mode 100644 jcl/source/fpc/libclite/ninh.inc create mode 100644 jcl/source/fpc/libclite/nip.inc create mode 100644 jcl/source/fpc/libclite/nip6h.inc create mode 100644 jcl/source/fpc/libclite/nip_icmp.inc create mode 100644 jcl/source/fpc/libclite/nip_icmph.inc create mode 100644 jcl/source/fpc/libclite/niph.inc create mode 100644 jcl/source/fpc/libclite/nipxh.inc create mode 100644 jcl/source/fpc/libclite/nl_typesh.inc create mode 100644 jcl/source/fpc/libclite/nnetromh.inc create mode 100644 jcl/source/fpc/libclite/npacketh.inc create mode 100644 jcl/source/fpc/libclite/nroseh.inc create mode 100644 jcl/source/fpc/libclite/nroute.inc create mode 100644 jcl/source/fpc/libclite/nrouteh.inc create mode 100644 jcl/source/fpc/libclite/nssh.inc create mode 100644 jcl/source/fpc/libclite/ntcph.inc create mode 100644 jcl/source/fpc/libclite/nudph.inc create mode 100644 jcl/source/fpc/libclite/nupdh.inc create mode 100644 jcl/source/fpc/libclite/pathsh.inc create mode 100644 jcl/source/fpc/libclite/posix1_limh.inc create mode 100644 jcl/source/fpc/libclite/posix2_limh.inc create mode 100644 jcl/source/fpc/libclite/posixopth.inc create mode 100644 jcl/source/fpc/libclite/printfh.inc create mode 100644 jcl/source/fpc/libclite/proutedh.inc create mode 100644 jcl/source/fpc/libclite/prwhodh.inc create mode 100644 jcl/source/fpc/libclite/ptalkdh.inc create mode 100644 jcl/source/fpc/libclite/pthread.inc create mode 100644 jcl/source/fpc/libclite/pthreadh.inc create mode 100644 jcl/source/fpc/libclite/pthreadtypesh.inc create mode 100644 jcl/source/fpc/libclite/ptimedh.inc create mode 100644 jcl/source/fpc/libclite/ptyh.inc create mode 100644 jcl/source/fpc/libclite/pwdh.inc create mode 100644 jcl/source/fpc/libclite/regexh.inc create mode 100644 jcl/source/fpc/libclite/regexph.inc create mode 100644 jcl/source/fpc/libclite/saccth.inc create mode 100644 jcl/source/fpc/libclite/schedh.inc create mode 100644 jcl/source/fpc/libclite/searchh.inc create mode 100644 jcl/source/fpc/libclite/semaphoreh.inc create mode 100644 jcl/source/fpc/libclite/sfsuidh.inc create mode 100644 jcl/source/fpc/libclite/sgttyh.inc create mode 100644 jcl/source/fpc/libclite/shadowh.inc create mode 100644 jcl/source/fpc/libclite/sigactionh.inc create mode 100644 jcl/source/fpc/libclite/sigcontexth.inc create mode 100644 jcl/source/fpc/libclite/siginfoh.inc create mode 100644 jcl/source/fpc/libclite/signalh.inc create mode 100644 jcl/source/fpc/libclite/signumh.inc create mode 100644 jcl/source/fpc/libclite/sigseth.inc create mode 100644 jcl/source/fpc/libclite/sigstackh.inc create mode 100644 jcl/source/fpc/libclite/sigthreadh.inc create mode 100644 jcl/source/fpc/libclite/sioctlh.inc create mode 100644 jcl/source/fpc/libclite/sipch.inc create mode 100644 jcl/source/fpc/libclite/skdaemonh.inc create mode 100644 jcl/source/fpc/libclite/sklogh.inc create mode 100644 jcl/source/fpc/libclite/smmaph.inc create mode 100644 jcl/source/fpc/libclite/smounth.inc create mode 100644 jcl/source/fpc/libclite/smsgh.inc create mode 100644 jcl/source/fpc/libclite/spawnh.inc create mode 100644 jcl/source/fpc/libclite/spermh.inc create mode 100644 jcl/source/fpc/libclite/spollh.inc create mode 100644 jcl/source/fpc/libclite/sptraceh.inc create mode 100644 jcl/source/fpc/libclite/squota.inc create mode 100644 jcl/source/fpc/libclite/squotah.inc create mode 100644 jcl/source/fpc/libclite/sraw.inc create mode 100644 jcl/source/fpc/libclite/srawh.inc create mode 100644 jcl/source/fpc/libclite/srebooth.inc create mode 100644 jcl/source/fpc/libclite/sresourceh.inc create mode 100644 jcl/source/fpc/libclite/sscsi_ioctlh.inc create mode 100644 jcl/source/fpc/libclite/sscsih.inc create mode 100644 jcl/source/fpc/libclite/sselect.inc create mode 100644 jcl/source/fpc/libclite/sselecth.inc create mode 100644 jcl/source/fpc/libclite/ssemh.inc create mode 100644 jcl/source/fpc/libclite/ssendfileh.inc create mode 100644 jcl/source/fpc/libclite/ssgh.inc create mode 100644 jcl/source/fpc/libclite/sshmh.inc create mode 100644 jcl/source/fpc/libclite/ssocketh.inc create mode 100644 jcl/source/fpc/libclite/sstat.inc create mode 100644 jcl/source/fpc/libclite/sstatfsh.inc create mode 100644 jcl/source/fpc/libclite/sstath.inc create mode 100644 jcl/source/fpc/libclite/sstatvfsh.inc create mode 100644 jcl/source/fpc/libclite/sswaph.inc create mode 100644 jcl/source/fpc/libclite/ssysctlh.inc create mode 100644 jcl/source/fpc/libclite/ssysinfoh.inc create mode 100644 jcl/source/fpc/libclite/ssyslog.inc create mode 100644 jcl/source/fpc/libclite/ssyslogh.inc create mode 100644 jcl/source/fpc/libclite/stdinth.inc create mode 100644 jcl/source/fpc/libclite/stdio_exth.inc create mode 100644 jcl/source/fpc/libclite/stdio_limh.inc create mode 100644 jcl/source/fpc/libclite/stdioh.inc create mode 100644 jcl/source/fpc/libclite/stdlib.inc create mode 100644 jcl/source/fpc/libclite/stdlibh.inc create mode 100644 jcl/source/fpc/libclite/stime.inc create mode 100644 jcl/source/fpc/libclite/stimebh.inc create mode 100644 jcl/source/fpc/libclite/stimeh.inc create mode 100644 jcl/source/fpc/libclite/stringh.inc create mode 100644 jcl/source/fpc/libclite/stroptsh.inc create mode 100644 jcl/source/fpc/libclite/sttydefaults.inc create mode 100644 jcl/source/fpc/libclite/sttydefaultsh.inc create mode 100644 jcl/source/fpc/libclite/sucontexth.inc create mode 100644 jcl/source/fpc/libclite/suioh.inc create mode 100644 jcl/source/fpc/libclite/sun.inc create mode 100644 jcl/source/fpc/libclite/sunh.inc create mode 100644 jcl/source/fpc/libclite/suserh.inc create mode 100644 jcl/source/fpc/libclite/sustath.inc create mode 100644 jcl/source/fpc/libclite/sutsnameh.inc create mode 100644 jcl/source/fpc/libclite/svlimith.inc create mode 100644 jcl/source/fpc/libclite/svtimesh.inc create mode 100644 jcl/source/fpc/libclite/swaith.inc create mode 100644 jcl/source/fpc/libclite/sysexitsh.inc create mode 100644 jcl/source/fpc/libclite/syslogh.inc create mode 100644 jcl/source/fpc/libclite/systypeshh.inc create mode 100644 jcl/source/fpc/libclite/termios.inc create mode 100644 jcl/source/fpc/libclite/termiosh.inc create mode 100644 jcl/source/fpc/libclite/time.inc create mode 100644 jcl/source/fpc/libclite/timeh.inc create mode 100644 jcl/source/fpc/libclite/timesh.inc create mode 100644 jcl/source/fpc/libclite/timexh.inc create mode 100644 jcl/source/fpc/libclite/ttyenth.inc create mode 100644 jcl/source/fpc/libclite/types.inc create mode 100644 jcl/source/fpc/libclite/typesh.inc create mode 100644 jcl/source/fpc/libclite/ucontexth.inc create mode 100644 jcl/source/fpc/libclite/ulimith.inc create mode 100644 jcl/source/fpc/libclite/unistdh.inc create mode 100644 jcl/source/fpc/libclite/utimeh.inc create mode 100644 jcl/source/fpc/libclite/utmph.inc create mode 100644 jcl/source/fpc/libclite/utmpxh.inc create mode 100644 jcl/source/fpc/libclite/wcharh.inc create mode 100644 jcl/source/fpc/libclite/wctypeh.inc create mode 100644 jcl/source/fpc/libclite/wordexph.inc create mode 100644 jcl/source/fpc/libclite/wordsizeh.inc create mode 100644 jcl/source/fpc/libclite/xlocaleh.inc create mode 100644 jcl/source/fpc/libclite/xopen_limh.inc create mode 100644 jcl/source/include/jedi.inc create mode 100644 jcl/source/include/kylix.inc diff --git a/jcl/source/common/JclAbstractContainers.pas b/jcl/source/common/JclAbstractContainers.pas index 817bc0a470..344bf19879 100644 --- a/jcl/source/common/JclAbstractContainers.pas +++ b/jcl/source/common/JclAbstractContainers.pas @@ -44,14 +44,22 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE FPC} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF HAS_UNITSCOPE} System.Classes, {$ELSE ~HAS_UNITSCOPE} Classes, {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclContainerIntf, JclSynch, JclSysUtils, + JclBase, JclContainerIntf, + {$IFDEF THREADSAFE} + JclSynch, + {$ENDIF THREADSAFE} + JclSysUtils, JclWideStrings, JclAnsiStrings; @@ -703,9 +711,9 @@ TJclWideStrAbstractCollection = class(TJclWideStrAbstractContainer, procedure AppendToStrings(Strings: TJclWideStrings); procedure AppendFromStrings(Strings: TJclWideStrings); function GetAsStrings: TJclWideStrings; - function GetAsDelimited(const Separator: WideString = WideLineBreak): WideString; - procedure AppendDelimited(const AString: WideString; const Separator: WideString = WideLineBreak); - procedure LoadDelimited(const AString: WideString; const Separator: WideString = WideLineBreak); + function GetAsDelimited(const Separator: WideString {$IFNDEF FPC} = WideLineBreak{$ENDIF}): WideString; + procedure AppendDelimited(const AString: WideString; const Separator: WideString {$IFNDEF FPC} = WideLineBreak{$ENDIF}); + procedure LoadDelimited(const AString: WideString; const Separator: WideString {$IFNDEF FPC} = WideLineBreak{$ENDIF}); end; {$IFDEF SUPPORTS_UNICODE_STRING} @@ -1374,12 +1382,12 @@ function TJclAnsiStrAbstractContainer.Hash(const AString: AnsiString): Integer; else begin case FEncoding of - seISO: + TJclAnsiStrEncoding.seISO: if FCaseSensitive then Result := AnsiStrSimpleHashConvert(AString) else Result := AnsiStrSimpleHashConvertI(AString); - seUTF8: + TJclAnsiStrEncoding.seUTF8: if FCaseSensitive then Result := AnsiStrSimpleHashConvertU(AString) else @@ -1397,7 +1405,7 @@ function TJclAnsiStrAbstractContainer.ItemsCompare(const A, B: AnsiString): Inte else begin case FEncoding of - seISO, seUTF8: + TJclAnsiStrEncoding.seISO, TJclAnsiStrEncoding.seUTF8: if FCaseSensitive then Result := AnsiStrSimpleCompare(A, B) else @@ -1418,7 +1426,7 @@ function TJclAnsiStrAbstractContainer.ItemsEqual(const A, B: AnsiString): Boolea else begin case FEncoding of - seISO, seUTF8: + TJclAnsiStrEncoding.seISO, TJclAnsiStrEncoding.seUTF8: if FCaseSensitive then Result := AnsiStrSimpleEqualityCompare(A, B) else diff --git a/jcl/source/common/JclAnsiStrings.pas b/jcl/source/common/JclAnsiStrings.pas index 426d68f1eb..55e1d50d3b 100644 --- a/jcl/source/common/JclAnsiStrings.pas +++ b/jcl/source/common/JclAnsiStrings.pas @@ -380,8 +380,10 @@ function StrAnsiToOem(const S: AnsiString): AnsiString; {$ENDIF MSWINDOWS} // String Management +{$IFNDEF FPC} procedure StrAddRef(var S: AnsiString); procedure StrDecRef(var S: AnsiString); +{$ENDIF ~FPC} function StrLength(const S: AnsiString): Longint; function StrRefCount(const S: AnsiString): Longint; procedure StrResetLength(var S: AnsiString); @@ -518,8 +520,8 @@ procedure StrNormIndex(const StrLen: SizeInt; var Index: SizeInt; var Count: Siz function ArrayOf(List: TJclAnsiStrings): TDynStringArray; overload; -function AnsiCompareNaturalStr(const S1, S2: AnsiString): SizeInt; -function AnsiCompareNaturalText(const S1, S2: AnsiString): SizeInt; +function AnsiCompareNaturalStr(const S1, S2: AnsiString): SizeInt; overload; +function AnsiCompareNaturalText(const S1, S2: AnsiString): SizeInt; overload; // Explicit ANSI version of former/deprecated SysUtils PAnsiChar functions {$IFNDEF DEPRECATED_SYSUTILS_ANSISTRINGS} @@ -582,12 +584,20 @@ implementation uses {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF SUPPORTS_UNICODE} RtlConsts, {$ENDIF SUPPORTS_UNICODE} - JclLogic, JclResources, JclStreams, JclSynch, JclSysUtils; + JclLogic, JclResources, JclStreams, + {$IFNDEF FPC} + JclSynch, + {$ENDIF ~ENDIF} + JclSysUtils; //=== Internal =============================================================== @@ -2369,6 +2379,7 @@ function StrAnsiToOem(const S: AnsiString): AnsiString; //=== String Management ====================================================== +{$IFNDEF FPC} procedure StrAddRef(var S: AnsiString); var P: PAnsiStrRec; @@ -2405,6 +2416,7 @@ procedure StrDecRef(var S: AnsiString); end; end; end; +{$ENDIF ~FPC} function StrLength(const S: AnsiString): Longint; var diff --git a/jcl/source/common/JclArrayLists.pas b/jcl/source/common/JclArrayLists.pas index c3105f9e7d..940f37d989 100644 --- a/jcl/source/common/JclArrayLists.pas +++ b/jcl/source/common/JclArrayLists.pas @@ -51,7 +51,7 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} JclAlgorithms, - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; type diff --git a/jcl/source/common/JclArraySets.pas b/jcl/source/common/JclArraySets.pas index fb9584ccb4..63ab04bbf0 100644 --- a/jcl/source/common/JclArraySets.pas +++ b/jcl/source/common/JclArraySets.pas @@ -53,7 +53,10 @@ interface {$IFDEF SUPPORTS_GENERICS} JclAlgorithms, {$ENDIF SUPPORTS_GENERICS} - JclBase, JclAbstractContainers, JclContainerIntf, JclArrayLists, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf, JclArrayLists + {$IFDEF THREADSAFE} + , JclSynch + {$ENDIF THREADSAFE}; type TJclIntfArraySet = class(TJclIntfArrayList, {$IFDEF THREADSAFE} IJclLockable, {$ENDIF THREADSAFE} diff --git a/jcl/source/common/JclBase.pas b/jcl/source/common/JclBase.pas index 95a8594ccd..06b88ab71f 100644 --- a/jcl/source/common/JclBase.pas +++ b/jcl/source/common/JclBase.pas @@ -145,8 +145,8 @@ procedure CardinalsToI64(out I: Int64; const LowPart, HighPart: Cardinal); // Redefinition of ULARGE_INTEGER to relieve dependency on Windows.pas type - {$IFNDEF FPC} PULARGE_INTEGER = ^ULARGE_INTEGER; + {$IFDEF FPC} {$EXTERNALSYM PULARGE_INTEGER} ULARGE_INTEGER = record case Integer of @@ -223,6 +223,10 @@ ULARGE_INTEGER = record HexFmt = HexPrefix + HexDigitFmt; + {$ifdef FPC} + ERROR_SUCCESS = 0; + {$endif} + const BOM_UTF16_LSB: array [0..1] of Byte = ($FF,$FE); BOM_UTF16_MSB: array [0..1] of Byte = ($FE,$FF); @@ -331,21 +335,22 @@ function StringOf(const Bytes: Pointer; Size: Cardinal): AnsiString; overload; {$IFDEF FPC} TJclAddr64 = QWord; {$IFDEF CPU64} - TJclAddr = QWord; + //TJclAddr = QWord; {$ENDIF CPU64} {$IFDEF CPU32} - TJclAddr = Cardinal; + //TJclAddr = Cardinal; {$ENDIF CPU32} {$ENDIF FPC} {$IFDEF BORLAND} TJclAddr64 = Int64; {$IFDEF CPU64} - TJclAddr = TJclAddr64; + //TJclAddr = TJclAddr64; {$ENDIF CPU64} {$IFDEF CPU32} - TJclAddr = TJclAddr32; + //TJclAddr = TJclAddr32; {$ENDIF CPU32} {$ENDIF BORLAND} + TJclAddr = NativeUInt; PJclAddr = ^TJclAddr; EJclAddr64Exception = class(EJclError); @@ -355,7 +360,7 @@ function Addr32ToAddr64(const Value: TJclAddr32): TJclAddr64; {$IFDEF FPC} type - HWND = type Windows.HWND; + HWND = type System.THandle; {$ENDIF FPC} {$IFDEF SUPPORTS_GENERICS} @@ -393,12 +398,6 @@ TEquatable = class(TInterfacedObject, IEquatable, IEqualityCompar AWSuffix = 'A'; {$ENDIF ~SUPPORTS_UNICODE} -{$IFDEF FPC} -// FPC emits a lot of warning because the first parameter of its internal -// GetMem is a var parameter, which is not initialized before the call to GetMem -procedure GetMem(out P; Size: Longint); -{$ENDIF FPC} - {$IFDEF UNITVERSIONING} const UnitVersioning: TUnitVersionInfo = ( @@ -613,16 +612,6 @@ procedure LoadAnsiReplacementCharacter; end; {$ENDIF ~MSWINDOWS} -{$IFDEF FPC} -// FPC emits a lot of warning because the first parameter of its internal -// GetMem is a var parameter, which is not initialized before the call to GetMem -procedure GetMem(out P; Size: Longint); -begin - Pointer(P) := nil; - GetMem(Pointer(P), Size); -end; -{$ENDIF FPC} - initialization LoadAnsiReplacementCharacter; diff --git a/jcl/source/common/JclBinaryTrees.pas b/jcl/source/common/JclBinaryTrees.pas index d064955dde..d9cb229a1e 100644 --- a/jcl/source/common/JclBinaryTrees.pas +++ b/jcl/source/common/JclBinaryTrees.pas @@ -50,7 +50,7 @@ interface {$ELSE ~HAS_UNITSCOPE} Classes, {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclAbstractContainers, JclAlgorithms, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclAlgorithms, JclContainerIntf {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; type TItrStart = (isFirst, isLast, isRoot); diff --git a/jcl/source/common/JclCompression.pas b/jcl/source/common/JclCompression.pas index 58cb985a69..4c6703ccbe 100644 --- a/jcl/source/common/JclCompression.pas +++ b/jcl/source/common/JclCompression.pas @@ -54,7 +54,11 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE FPC} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF HAS_UNITSCOPE} {$IFDEF MSWINDOWS} @@ -75,7 +79,10 @@ interface ZLib, {$ENDIF ZLIB_RTL} {$ENDIF ~HAS_UNITSCOPE} - zlibh, bzip2, JclWideStrings, JclBase, JclStreams; + {$IFNDEF FPC} + zlibh, bzip2, + {$ENDIF FPC} + JclWideStrings, JclBase, JclStreams; {$IFDEF RTL230_UP} {$HPPEMIT '// To avoid ambiguity with System::Zlib::z_stream_s we force using ours'} @@ -232,6 +239,7 @@ TJclDecompressStream = class(TJclCompressionStream) TJclDecompressStreamClass = class of TJclDecompressStream; + {$IFNDEF FPC} TJclCompressionStreamFormats = class private FCompressFormats: TList; @@ -299,6 +307,7 @@ TJclZLibCompressStream = class(TJclCompressStream) property Strategy: Integer read FStrategy write SetStrategy; property CompressionLevel: Integer read FCompressionLevel write SetCompressionLevel; end; + {$ENDIF FPC} {$IFDEF ZLIB_RTL} const @@ -312,6 +321,7 @@ TJclZLibCompressStream = class(TJclCompressStream) {$EXTERNALSYM PBytef} {$ENDIF ZLIB_RTL} +{$IFNDEF FPC} type TJclZLibDecompressStream = class(TJclDecompressStream) private @@ -334,6 +344,7 @@ TJclZLibDecompressStream = class(TJclDecompressStream) property WindowBits: Integer read FWindowBits write SetWindowBits; end; + {$ENDIF FPC} // GZIP Support @@ -423,6 +434,7 @@ TJclZLibDecompressStream = class(TJclDecompressStream) gfsMac, gfsZ, gfsCPM, gfsTOPS, gfsNTFS, gfsQDOS, gfsAcorn, gfsOther, gfsUnknown); // Format is described in RFC 1952, http://www.faqs.org/rfcs/rfc1952.html + {$IFNDEF FPC} TJclGZIPCompressionStream = class(TJclCompressStream) private FFlags: TJclGZIPFlags; @@ -569,6 +581,7 @@ TJclBZIP2DecompressionStream = class(TJclDecompressStream) function Read(var Buffer; Count: Longint): Longint; override; function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; override; end; + {$ENDIF FPC} EJclCompressionError = class(EJclError); EJclCompressionCancelled = class(EJclCompressionError); @@ -577,6 +590,7 @@ EJclCompressionFalse = class(EJclCompressionError); // callback type used in helper functions below: TJclCompressStreamProgressCallback = procedure(FileSize, Position: Int64; UserData: Pointer) of object; +{$IFNDEF FPC} {helper functions - one liners by wpostma} function GZipFile(SourceFile, DestinationFile: TFileName; CompressionLevel: Integer = Z_DEFAULT_COMPRESSION; ProgressCallback: TJclCompressStreamProgressCallback = nil; UserData: Pointer = nil): Boolean; @@ -595,6 +609,7 @@ procedure BZip2Stream(SourceStream, DestinationStream: TStream; CompressionLevel ProgressCallback: TJclCompressStreamProgressCallback = nil; UserData: Pointer = nil); procedure UnBZip2Stream(SourceStream, DestinationStream: TStream; ProgressCallback: TJclCompressStreamProgressCallback = nil; UserData: Pointer = nil); +{$ENDIF FPC} // archive ancestor classes {$IFDEF MSWINDOWS} @@ -2401,6 +2416,7 @@ destructor TJclDecompressStream.Destroy; inherited Destroy; end; +{$IFNDEF FPC} //=== { TJclCompressionStreamFormats } ======================================= constructor TJclCompressionStreamFormats.Create; @@ -3591,6 +3607,8 @@ procedure InternalCompress(SourceStream: TStream; CompressStream: TJclCompressSt ProgressCallback(SourceStreamSize, SourceStreamPosition, UserData); end; +{$ENDIF FPC} + procedure InternalDecompress(SourceStream, DestStream: TStream; DecompressStream: TJclDecompressStream; ProgressCallback: TJclCompressStreamProgressCallback; UserData: Pointer); @@ -3629,6 +3647,8 @@ procedure InternalDecompress(SourceStream, DestStream: TStream; { Compress to a .gz file - one liner - NEW MARCH 2007 } +{$IFNDEF FPC} + function GZipFile(SourceFile, DestinationFile: TFileName; CompressionLevel: Integer; ProgressCallback: TJclCompressStreamProgressCallback; UserData: Pointer): Boolean; var @@ -3832,6 +3852,8 @@ procedure UnBZip2Stream(SourceStream, DestinationStream: TStream; end; end; +{$ENDIF FPC} + {$IFDEF MSWINDOWS} function OpenFileStream(const FileName: TFileName; StreamAccess: TJclStreamAccess): TStream; diff --git a/jcl/source/common/JclCounter.pas b/jcl/source/common/JclCounter.pas index 6d29ee8f47..5243c6d62b 100644 --- a/jcl/source/common/JclCounter.pas +++ b/jcl/source/common/JclCounter.pas @@ -55,7 +55,11 @@ interface {$ENDIF MSWINDOWS} {$ENDIF ~HAS_UNITSCOPE} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE FPC} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} JclBase; diff --git a/jcl/source/common/JclDateTime.pas b/jcl/source/common/JclDateTime.pas index d65951b4b0..4557434eba 100644 --- a/jcl/source/common/JclDateTime.pas +++ b/jcl/source/common/JclDateTime.pas @@ -70,15 +70,23 @@ interface SysUtils, {$ENDIF ~HAS_UNITSCOPE} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, - {$ENDIF HAS_UNIT_LIBC} - {$IFDEF FPC} + {$ELSE FPC} + libclite, + {$ENDIF ~FPC} + {$ELSE ~HAS_UNIT_LIBC} {$IFDEF UNIX} + BaseUnix, + dateutils, {$IFNDEF LINUX} Unix, {$ENDIF ~LINUX} - {$ENDIF FPC} - {$ENDIF} + {$ENDIF ~UNIX} + {$ENDIF HAS_UNIT_LIBC} + {$IFDEF FPC} + types, + {$ENDIF ~FPC} JclBase, JclResources; const @@ -87,7 +95,7 @@ interface { Encode / Decode functions } -function EncodeDate(const Year: Integer; Month, Day: Word): TDateTime; +function EncodeDate(const Year: Integer; Month, Day: Word): TDateTime; overload; procedure DecodeDate(Date: TDateTime; out Year, Month, Day: Word); overload; procedure DecodeDate(Date: TDateTime; out Year: Integer; out Month, Day: Word); overload; procedure DecodeDate(Date: TDateTime; out Year, Month, Day: Integer); overload; @@ -678,6 +686,7 @@ function DateTimeToLocalDateTime(DateTime: TDateTime): TDateTime; {$ENDIF MSWINDOWS} {$IFDEF UNIX} +{$IFDEF HAS_UNIT_LIBC} function DateTimeToLocalDateTime(DateTime: TDateTime): TDateTime; var {$IFDEF LINUX} @@ -696,6 +705,12 @@ function DateTimeToLocalDateTime(DateTime: TDateTime): TDateTime; {$ENDIF ~LINUX} Result := ((DateTime * SecsPerDay) - Offset) / SecsPerDay; end; +{$ELSE HAS_UNIT_LIBC} +function DateTimeToLocalDateTime(DateTime: TDateTime): TDateTime; +begin + Result := UniversalTimeToLocal(DateTime); +end; +{$ENDIF HAS_UNIT_LIBC} {$ENDIF UNIX} {$IFDEF MSWINDOWS} @@ -716,6 +731,7 @@ function LocalDateTimeToDateTime(DateTime: TDateTime): TDateTime; {$ENDIF MSWINDOWS} {$IFDEF UNIX} +{$IFDEF HAS_UNIT_LIBC} function LocalDateTimeToDateTime(DateTime: TDateTime): TDateTime; var {$IFDEF LINUX} @@ -734,6 +750,12 @@ function LocalDateTimeToDateTime(DateTime: TDateTime): TDateTime; {$ENDIF ~LINUX} Result := ((DateTime * SecsPerDay) + Offset) / SecsPerDay; end; +{$ELSE HAS_UNIT_LIBC} +function LocalDateTimeToDateTime(DateTime: TDateTime): TDateTime; +begin + Result := LocalTimeToUniversal(DateTime); +end; +{$ENDIF HAS_UNIT_LIBC} {$ENDIF UNIX} function HoursToMSecs(Hours: Integer): Integer; diff --git a/jcl/source/common/JclFileUtils.pas b/jcl/source/common/JclFileUtils.pas index 156053d6d3..ba87679390 100644 --- a/jcl/source/common/JclFileUtils.pas +++ b/jcl/source/common/JclFileUtils.pas @@ -69,7 +69,11 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF HAS_UNITSCOPE} {$IFDEF MSWINDOWS} @@ -95,6 +99,7 @@ interface // PathSeparator = '/'; DirDelimiter = '/'; DirSeparator = ':'; + PathUncPrefix = ''; {$ENDIF UNIX} {$IFDEF MSWINDOWS} PathDevicePrefix = '\\.\'; @@ -203,11 +208,9 @@ procedure EnumDirectories(const Root: string; const HandleDirectory: TFileHandle {$IFDEF MSWINDOWS} procedure CreateEmptyFile(const FileName: string); function CloseVolume(var Volume: THandle): Boolean; -{$IFNDEF FPC} function DeleteDirectory(const DirectoryName: string; MoveToRecycleBin: Boolean): Boolean; function CopyDirectory(ExistingDirectoryName, NewDirectoryName: string): Boolean; function MoveDirectory(ExistingDirectoryName, NewDirectoryName: string): Boolean; -{$ENDIF ~FPC} function DelTree(const Path: string): Boolean; function DelTreeEx(const Path: string; AbortOnFailure: Boolean; Progress: TDelTreeProgress): Boolean; function DiskInDrive(Drive: Char): Boolean; @@ -218,7 +221,7 @@ function FileBackup(const FileName: string; Move: Boolean = False): Boolean; function FileCopy(const ExistingFileName, NewFileName: string; ReplaceExisting: Boolean = False): Boolean; function FileDateTime(const FileName: string): TDateTime; function FileDelete(const FileName: string; MoveToRecycleBin: Boolean = False): Boolean; -function FileExists(const FileName: string): Boolean; +//function FileExists(const FileName: string): Boolean; /// procedure FileHistory Creates a list of history files of a specified /// source file. Each version of the file get's an extention .~~ The file with /// the lowest number is the youngest file. @@ -241,10 +244,11 @@ function FileRestore(const FileName: string): Boolean; function GetBackupFileName(const FileName: string): string; function IsBackupFileName(const FileName: string): Boolean; function FileGetDisplayName(const FileName: string): string; -function FileGetGroupName(const FileName: string {$IFDEF UNIX}; ResolveSymLinks: Boolean = True {$ENDIF}): string; -function FileGetOwnerName(const FileName: string {$IFDEF UNIX}; ResolveSymLinks: Boolean = True {$ENDIF}): string; +function FileGetGroupName(const FileName: string {$IFDEF UNIX}; ResolveSymLinks: Boolean = True {$ENDIF}): string; overload; +function FileGetOwnerName(const FileName: string {$IFDEF UNIX}; ResolveSymLinks: Boolean = True {$ENDIF}): string; overload; function FileGetSize(const FileName: string): Int64; -function FileGetTempName(const Prefix: string): string; +function FileGetTempName(const Prefix: string): string; overload; +function FileGetTempName(const Folder, Prefix: string): string; overload; {$IFDEF MSWINDOWS} function FileGetTypeName(const FileName: string): string; {$ENDIF MSWINDOWS} @@ -2706,7 +2710,7 @@ function PathGetTempPath: string; {$ENDIF MSWINDOWS} {$IFDEF UNIX} begin - Result := GetEnvironmentVariable('TMPDIR'); + Result := {GetEnvironmentVariable('TMPDIR')}GetTempDir; end; {$ENDIF UNIX} @@ -2787,7 +2791,7 @@ function PathIsDiskDevice(const Path: string): Boolean; var FullPath: string; F: PIOFile; - Buffer: array [0..255] of AnsiChar; + Buffer: array [0..255] of Char; MountEntry: TMountEntry; FsTypes: TStringList; @@ -3263,7 +3267,7 @@ function CloseVolume(var Volume: THandle): Boolean; end; end; -{$IFNDEF FPC} // needs JclShell +{$IFDEF MSWINDOWS} // needs JclShell function DeleteDirectory(const DirectoryName: string; MoveToRecycleBin: Boolean): Boolean; begin @@ -3299,7 +3303,7 @@ function MoveDirectory(ExistingDirectoryName, NewDirectoryName: string): Boolean Result := SHFileOperation(SH) = 0; end; -{$ENDIF ~FPC} +{$ENDIF MSWINDOWS} function DelTree(const Path: string): Boolean; begin @@ -3542,7 +3546,7 @@ function FileDelete(const FileName: string; MoveToRecycleBin: Boolean = False): end; {$ENDIF UNIX} -function FileExists(const FileName: string): Boolean; +(*function FileExists(const FileName: string): Boolean; {$IFDEF MSWINDOWS} var Attr: Cardinal; @@ -3561,7 +3565,7 @@ function FileExists(const FileName: string): Boolean; end else Result := False; -end; +end;*) procedure FileHistory(const FileName: string; HistoryPath: string = ''; MaxHistoryCount: Integer = 100; MinFileDate: TDateTime = 0; ReplaceExtention: Boolean = true); @@ -3833,12 +3837,38 @@ function FileGetTempName(const Prefix: string): string; // leading to a possible security hole. The implementation generates names which // can hardly be predicted, but when opening the file you should use the O_EXCL // flag. Using tmpfile or mkstemp is a safe way to avoid this problem. +begin + Result := GetTempFileName(PathGetTempPath, Prefix); +end; +{$ENDIF UNIX} + +function FileGetTempName(const Folder, Prefix: string): string; +{$IFDEF MSWINDOWS} var - P: PChar; + TempFile: string; + R: Cardinal; begin - P := tempnam(PChar(PathGetTempPath), PChar(Prefix)); - Result := P; - Libc.free(P); + Result := ''; + if Folder <> '' then + begin + SetLength(TempFile, MAX_PATH); + R := GetTempFileName(PChar(Folder), PChar(Prefix), 0, PChar(TempFile)); + if R <> 0 then + begin + StrResetLength(TempFile); + Result := TempFile; + end; + end; +end; +{$ENDIF MSWINDOWS} +{$IFDEF UNIX} +// Warning: Between the time the pathname is constructed and the file is created +// another process might have created a file with the same name using tmpnam, +// leading to a possible security hole. The implementation generates names which +// can hardly be predicted, but when opening the file you should use the O_EXCL +// flag. Using tmpfile or mkstemp is a safe way to avoid this problem. +begin + Result := GetTempFileName(Folder, Prefix); end; {$ENDIF UNIX} @@ -4324,7 +4354,7 @@ function GetSizeOfFile(const FileInfo: TSearchRec): Int64; // rr: Note that SysUtils.FindFirst/Next ignore files >= 2 GB under Linux, // thus the following code is rather pointless at the moment of this writing. // We apparently need to write our own set of Findxxx functions to overcome this limitation. - if GetFileStatus(FileInfo.PathOnly + FileInfo.Name, Buf, True) <> 0 then + if GetFileStatus({$IFNDEF UNIX}FileInfo.PathOnly + {$ENDIF UNIX}FileInfo.Name, Buf, True) <> 0 then Result := -1 else Result := Buf.st_size @@ -5032,7 +5062,6 @@ constructor TJclFileVersionInfo.Create(const FileName: string); ExtractData; end; -{$IFDEF MSWINDOWS} {$IFDEF FPC} constructor TJclFileVersionInfo.Create(const Window: HWND; Dummy: Pointer = nil); {$ELSE} @@ -5049,7 +5078,7 @@ constructor TJclFileVersionInfo.Create(const Module: HMODULE); else raise EJclError.CreateResFmt(@RsEModuleNotValid, [Module]); end; -{$ENDIF MSWINDOWS} + destructor TJclFileVersionInfo.Destroy; begin diff --git a/jcl/source/common/JclHashMaps.pas b/jcl/source/common/JclHashMaps.pas index ca4a77eb61..1d1af14956 100644 --- a/jcl/source/common/JclHashMaps.pas +++ b/jcl/source/common/JclHashMaps.pas @@ -51,7 +51,10 @@ interface Classes, {$ENDIF ~HAS_UNITSCOPE} JclAlgorithms, - JclBase, JclSynch, + JclBase, + {$IFDEF THREADSAFE} + JclSynch, + {$ENDIF THREADSAFE} JclContainerIntf, JclAbstractContainers, JclArrayLists, JclArraySets; diff --git a/jcl/source/common/JclHashSets.pas b/jcl/source/common/JclHashSets.pas index e28542daa5..db8b3cec9a 100644 --- a/jcl/source/common/JclHashSets.pas +++ b/jcl/source/common/JclHashSets.pas @@ -51,7 +51,7 @@ interface SysUtils, Classes, {$ENDIF ~HAS_UNITSCOPE} JclAlgorithms, - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; type diff --git a/jcl/source/common/JclLinkedLists.pas b/jcl/source/common/JclLinkedLists.pas index 072e776d22..beb05f85f9 100644 --- a/jcl/source/common/JclLinkedLists.pas +++ b/jcl/source/common/JclLinkedLists.pas @@ -53,7 +53,7 @@ interface {$ELSE ~HAS_UNITSCOPE} Classes, {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; type diff --git a/jcl/source/common/JclMath.pas b/jcl/source/common/JclMath.pas index cc7459543d..4a26647927 100644 --- a/jcl/source/common/JclMath.pas +++ b/jcl/source/common/JclMath.pas @@ -61,6 +61,12 @@ interface { Mathematical constants } +{$IFDEF FPC} + {$IFDEF CPUX64} + {$UNDEF SUPPORTS_EXTENDED} + {$ENDIF CPUX64} +{$ENDIF FPC} + const Bernstein: Float = 0.2801694990238691330364364912307; // Bernstein constant Cbrt2: Float = 1.2599210498948731647672106072782; // CubeRoot(2) @@ -869,8 +875,12 @@ implementation System.Math, {$ENDIF USE_MATH_UNIT} Jcl8087, - JclResources, - JclSynch; + JclResources + {$IFDEF THREADSAFE} + {$IFNDEF FPC} + ,JclSynch + {$ENDIF ~FPC} + {$ENDIF THREADSAFE}; // Note (rrossmair): Usage of the "assembler" directive seems to be an Free Pascal requirement // (it's obsolete in Delphi since v. 2 I believe). @@ -962,6 +972,7 @@ function DegToRad(const Value: Single): Single; // ST(0) := ST(0) * PI / 180 procedure FastDegToRad; assembler; asm + {$IFDEF MSWINDOWS} {$IFDEF PIC} CALL GetGOT {$IFDEF CPU32} @@ -975,6 +986,7 @@ procedure FastDegToRad; assembler; {$ENDIF ~PIC} FMULP FWAIT + {$ENDIF MSWINDOWS} end; // Converts radians to degrees. @@ -1000,6 +1012,7 @@ function RadToDeg(const Value: Single): Single; // ST(0) := ST(0) * (180 / PI); procedure FastRadToDeg; assembler; asm + {$IFDEF MSWINDOWS} {$IFDEF PIC} CALL GetGOT {$IFDEF CPU32} @@ -1013,6 +1026,7 @@ procedure FastRadToDeg; assembler; {$ENDIF ~PIC} FMULP FWAIT + {$ENDIF MSWINDOWS} end; // Converts grads to radians. @@ -1038,6 +1052,7 @@ function GradToRad(const Value: Single): Single; // ST(0) := ST(0) * PI / 200 procedure FastGradToRad; assembler; asm + {$IFDEF MSWINDOWS} {$IFDEF PIC} CALL GetGOT {$IFDEF CPU32} @@ -1051,6 +1066,7 @@ procedure FastGradToRad; assembler; {$ENDIF ~PIC} FMULP FWAIT + {$ENDIF MSWINDOWS} end; // Converts radians to grads. @@ -1076,6 +1092,7 @@ function RadToGrad(const Value: Single): Single; // ST(0) := ST(0) * (200 / PI); procedure FastRadToGrad; assembler; asm + {$IFDEF MSWINDOWS} {$IFDEF PIC} CALL GetGOT {$IFDEF CPU32} @@ -1089,6 +1106,7 @@ procedure FastRadToGrad; assembler; {$ENDIF ~PIC} FMULP FWAIT + {$ENDIF MSWINDOWS} end; // Converts degrees to grads. @@ -1114,6 +1132,7 @@ function DegToGrad(const Value: Single): Single; // ST(0) := ST(0) * (200 / 180); procedure FastDegToGrad; assembler; asm + {$IFDEF MSWINDOWS} {$IFDEF PIC} CALL GetGOT {$IFDEF CPU32} @@ -1127,6 +1146,7 @@ procedure FastDegToGrad; assembler; {$ENDIF ~PIC} FMULP FWAIT + {$ENDIF MSWINDOWS} end; // Converts grads to degrees. @@ -1152,6 +1172,7 @@ function GradToDeg(const Value: Single): Single; // ST(0) := ST(0) * PI / 200 procedure FastGradToDeg; assembler; asm + {$IFDEF MSWINDOWS} {$IFDEF PIC} CALL GetGOT {$IFDEF CPU32} @@ -1165,6 +1186,7 @@ procedure FastGradToDeg; assembler; {$ENDIF ~PIC} FMULP FWAIT + {$ENDIF MSWINDOWS} end; procedure DomainCheck(Err: Boolean); @@ -3301,11 +3323,11 @@ procedure InitExceptObjProc; begin if LockedExchange(ExceptObjProcInitialized, 1) = 0 then if Win32Platform = VER_PLATFORM_WIN32_NT then - {$IFDEF RTL200_UP} // Delphi 2009+ - PrevExceptObjProc := InterlockedExchangePointer(ExceptObjProc, @GetExceptionObject); - {$ELSE} + {$IFDEF FPC} + PrevExceptObjProc := Pointer(InterlockedExchange(TJclAddr(ExceptObjProc), TJclAddr(@GetExceptionObject))); + {$ELSE ~FPC} PrevExceptObjProc := Pointer(InterlockedExchange(Integer(ExceptObjProc), Integer(@GetExceptionObject))); - {$ENDIF RTL200_UP} + {$ENDIF ~FPC} end; {$ENDIF ~FPC} {$ENDIF MSWINDOWS} diff --git a/jcl/source/common/JclPCRE.pas b/jcl/source/common/JclPCRE.pas index 697fef4a46..692ab36775 100644 --- a/jcl/source/common/JclPCRE.pas +++ b/jcl/source/common/JclPCRE.pas @@ -46,7 +46,11 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE FPC} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF HAS_UNITSCOPE} System.Classes, System.SysUtils, diff --git a/jcl/source/common/JclQueues.pas b/jcl/source/common/JclQueues.pas index 0f277ea5e7..e938c4eca2 100644 --- a/jcl/source/common/JclQueues.pas +++ b/jcl/source/common/JclQueues.pas @@ -46,7 +46,10 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} JclAlgorithms, - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf + {$IFDEF THREADSAFE} + , JclSynch + {$ENDIF THREADSAFE}; type diff --git a/jcl/source/common/JclRTTI.pas b/jcl/source/common/JclRTTI.pas index 9fa98f8beb..c86ec3bef2 100644 --- a/jcl/source/common/JclRTTI.pas +++ b/jcl/source/common/JclRTTI.pas @@ -2223,12 +2223,12 @@ function TJclDynArrayTypeInfo.GetElementType: IJclTypeInfo; if TypeData.elType = nil then begin if TypeData.elType2 <> nil then - Result := JclTypeInfo(TypeData.elType2^) + Result := JclTypeInfo(TypeData.elType2{$IFNDEF FPC}^{$ENDIF FPC}) else Result := nil; end else - Result := JclTypeInfo(TypeData.elType^); + Result := JclTypeInfo(TypeData.elType{$IFNDEF FPC}^{$ENDIF FPC}); end; function TJclDynArrayTypeInfo.GetElementsNeedCleanup: Boolean; diff --git a/jcl/source/common/JclSimpleXml.pas b/jcl/source/common/JclSimpleXml.pas index a3f47ef1d6..1fed43976a 100644 --- a/jcl/source/common/JclSimpleXml.pas +++ b/jcl/source/common/JclSimpleXml.pas @@ -65,7 +65,14 @@ interface {$ENDIF MSWINDOWS} SysUtils, Classes, Variants, + {$IFNDEF FPC} IniFiles, + {$ELSE} + FpStringHash, + {$ENDIF FPC} + {$IFDEF FPCNONWINDOWS} + FpWinAPICompatibility, + {$ENDIF FPCNONWINDOWS} Contnrs, {$ENDIF ~HAS_UNITSCOPE} JclBase, JclStreams; @@ -629,7 +636,7 @@ TXMLVariant = class(TInvokeableVariantType) const Name: string; const Arguments: TVarDataArray): Boolean; override; function GetProperty(var Dest: TVarData; const V: TVarData; const Name: string): Boolean; override; - function SetProperty(const V: TVarData; const Name: string; + function SetProperty({$IFDEF FPC}var{$ELSE}const{$ENDIF FPC} V: TVarData; const Name: string; const Value: TVarData): Boolean; override; end; @@ -4244,7 +4251,7 @@ function TXMLVariant.IsClear(const V: TVarData): Boolean; Result := (VXML = nil) or (not VXML.HasItems); end; -function TXMLVariant.SetProperty(const V: TVarData; const Name: string; +function TXMLVariant.SetProperty({$IFDEF FPC}var{$ELSE}const{$ENDIF FPC} V: TVarData; const Name: string; const Value: TVarData): Boolean; function GetStrValue: string; diff --git a/jcl/source/common/JclSortedMaps.pas b/jcl/source/common/JclSortedMaps.pas index 647c73c45d..7e42de32ac 100644 --- a/jcl/source/common/JclSortedMaps.pas +++ b/jcl/source/common/JclSortedMaps.pas @@ -50,7 +50,7 @@ interface Classes, {$ENDIF ~HAS_UNITSCOPE} JclAlgorithms, - JclBase, JclSynch, + JclBase{$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}, JclAbstractContainers, JclContainerIntf, JclArrayLists, JclArraySets; type diff --git a/jcl/source/common/JclStacks.pas b/jcl/source/common/JclStacks.pas index 2b9c818522..117381ad0b 100644 --- a/jcl/source/common/JclStacks.pas +++ b/jcl/source/common/JclStacks.pas @@ -56,7 +56,10 @@ interface JclAlgorithms, {$ENDIF SUPPORTS_GENERICS} {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf + {$IFDEF THREADSAFE} + , JclSynch + {$ENDIF THREADSAFE}; type TJclIntfStack = class(TJclIntfAbstractContainer, {$IFDEF THREADSAFE} IJclLockable, {$ENDIF THREADSAFE} diff --git a/jcl/source/common/JclStreams.pas b/jcl/source/common/JclStreams.pas index 268f9f4e91..93b6e05aff 100644 --- a/jcl/source/common/JclStreams.pas +++ b/jcl/source/common/JclStreams.pas @@ -57,7 +57,11 @@ interface Contnrs, {$ENDIF ~HAS_UNITSCOPE} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} JclBase, JclStringConversions; @@ -604,7 +608,11 @@ implementation JclResources, JclCharsets, JclMath, - JclSysUtils; + JclSysUtils + {$IFDEF FPCNONWINDOWS} + ,FpWinAPICompatibility + {$ENDIF}; + function StreamCopy(Source: TStream; Dest: TStream; BufferSize: Longint): Int64; var @@ -791,7 +799,13 @@ function TJclHandleStream.Read(var Buffer; Count: Longint): Longint; Result := 0; {$ENDIF MSWINDOWS} {$IFDEF LINUX} + {$IFDEF FPC} + Result := FileRead(FHandle, Buffer, Count); + if Result = -1 then + Result := 0; + {$ELSE ~FPC} Result := __read(Handle, Buffer, Count); + {$ENDIF ~FPC} {$ENDIF LINUX} end; @@ -803,7 +817,13 @@ function TJclHandleStream.Write(const Buffer; Count: Longint): Longint; Result := 0; {$ENDIF MSWINDOWS} {$IFDEF LINUX} + {$IFDEF FPC} + Result := FileWrite(FHandle, Buffer, Count); + if Result = -1 then + Result := 0; + {$ELSE ~FPC} Result := __write(Handle, Buffer, Count); + {$ENDIF ~FPC} {$ENDIF LINUX} end; @@ -832,12 +852,19 @@ TLarge = record end; {$ENDIF MSWINDOWS} {$IFDEF LINUX} +{$IFDEF FPC} +function TJclHandleStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; +begin + Result := FileSeek(FHandle, Offset, ord(Origin)); +end; +{$ELSE ~FPC} function TJclHandleStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; const SeekOrigins: array [TSeekOrigin] of Cardinal = ( SEEK_SET {soBeginning}, SEEK_CUR {soCurrent}, SEEK_END {soEnd} ); begin Result := lseek(Handle, Offset, SeekOrigins[Origin]); end; +{$ENDIF ~FPC} {$ENDIF LINUX} procedure TJclHandleStream.SetSize(const NewSize: Int64); @@ -848,8 +875,12 @@ procedure TJclHandleStream.SetSize(const NewSize: Int64); RaiseLastOSError; {$ENDIF MSWINDOWS} {$IFDEF LINUX} + {$IFDEF FPC} + FileTruncate(FHandle, NewSize); + {$ELSE ~FPC} if ftruncate(Handle, Position) = -1 then raise EJclStreamError.CreateRes(@RsStreamsSetSizeError); + {$ENDIF ~FPC} {$ENDIF LINUX} end; @@ -866,7 +897,11 @@ constructor TJclFileStream.Create(const FileName: TFileName; Mode: Word; Rights: if Mode = fmCreate then begin {$IFDEF LINUX} + {$IFDEF FPC} + H := FileCreate(FileName, Mode, Rights); + {$ELSE ~FPC} H := open(PChar(FileName), O_CREAT or O_RDWR, Rights); + {$ENDIF ~FPC} {$ENDIF LINUX} {$IFDEF MSWINDOWS} H := CreateFile(PChar(FileName), GENERIC_READ or GENERIC_WRITE, @@ -892,7 +927,11 @@ destructor TJclFileStream.Destroy; CloseHandle(Handle); {$ENDIF MSWINDOWS} {$IFDEF LINUX} + {$IFDEF FPC} + FileClose(FHandle); + {$ELSE ~FPC} __close(Handle); + {$ENDIF ~FPC} {$ENDIF LINUX} inherited Destroy; end; diff --git a/jcl/source/common/JclStringConversions.pas b/jcl/source/common/JclStringConversions.pas index f7143e1d41..bc0b624503 100644 --- a/jcl/source/common/JclStringConversions.pas +++ b/jcl/source/common/JclStringConversions.pas @@ -304,6 +304,9 @@ implementation Windows, {$ENDIF MSWINDOWS} {$ENDIF ~HAS_UNITSCOPE} + {$IFDEF FPCNONWINDOWS} + FpWinAPICompatibility, + {$ENDIF ~FPCNONWINDOWS} JclResources; const MB_ERR_INVALID_CHARS = 8; diff --git a/jcl/source/common/JclStringLists.pas b/jcl/source/common/JclStringLists.pas index 4e7a66dbe1..9308717a56 100644 --- a/jcl/source/common/JclStringLists.pas +++ b/jcl/source/common/JclStringLists.pas @@ -222,9 +222,9 @@ TJclInterfacedStringList = class(TStringList, IInterface) FOwnerInterface: IInterface; public { IInterface } - function _AddRef: Integer; stdcall; - function _Release: Integer; stdcall; - function QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; stdcall; + function _AddRef: Integer; {$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; + function _Release: Integer; {$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; + function QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; {$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; procedure AfterConstruction; override; end; @@ -253,8 +253,8 @@ TJclStringList = class(TJclInterfacedStringList, IInterface, IJclStringList) destructor Destroy; override; { IInterface } // function QueryInterface(const IID: TGUID; out Obj): HRESULT; stdcall; - function _AddRef: Integer; stdcall; - function _Release: Integer; stdcall; + function _AddRef: Integer; {$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; + function _Release: Integer; {$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; { IJclStringList } // function Add(const S: string): Integer; overload; // function AddObject(const S: string; AObject: TObject): Integer; @@ -471,7 +471,7 @@ procedure TJclInterfacedStringList.AfterConstruction; end; -function TJclInterfacedStringList._AddRef: Integer;stdcall; +function TJclInterfacedStringList._AddRef: Integer;{$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; begin if assigned(FOwnerInterface) then Result := FOwnerInterface._AddRef @@ -480,7 +480,7 @@ function TJclInterfacedStringList._AddRef: Integer;stdcall; end; -function TJclInterfacedStringList._Release: Integer;stdcall; +function TJclInterfacedStringList._Release: Integer;{$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; begin if assigned(FOwnerInterface) then Result := FOwnerInterface._Release @@ -489,7 +489,7 @@ function TJclInterfacedStringList._Release: Integer;stdcall; end; -function TJclInterfacedStringList.QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult;stdcall; +function TJclInterfacedStringList.QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult;{$IFDEF FPCNONWINDOWS}cdecl{$ELSE}stdcall{$ENDIF}; begin if GetInterface(IID, Obj) then Result := 0 diff --git a/jcl/source/common/JclStrings.pas b/jcl/source/common/JclStrings.pas index 44fcb25491..8255de60d5 100644 --- a/jcl/source/common/JclStrings.pas +++ b/jcl/source/common/JclStrings.pas @@ -242,8 +242,10 @@ procedure StrUpperInPlace(var S: string); procedure StrUpperBuff(S: PChar); // String Management +{$IFNDEF FPC} procedure StrAddRef(var S: string); procedure StrDecRef(var S: string); +{$ENDIF ~FPC} function StrLength(const S: string): SizeInt; function StrRefCount(const S: string): SizeInt; @@ -483,7 +485,7 @@ TJclStringBuilder = class(TInterfacedObject, IToString) procedure Clear; { IToString } - function ToString: string; {$IFDEF RTL200_UP} override; {$ENDIF RTL200_UP} + function ToString: string; {$IFDEF HAS_TOSTRING} override; {$ENDIF HAS_TOSTRING} property __Chars__[Index: SizeInt]: Char read GetChars write SetChars; default; property Chars: TCharDynArray read FChars; @@ -550,7 +552,7 @@ TJclTabSet = class (TInterfacedObject, IToString) function UpdatePosition(const S: string; var Column, Line: SizeInt): SizeInt; overload; { IToString } - function ToString: string; overload; {$IFDEF RTL200_UP} override; {$ENDIF RTL200_UP} + function ToString: string; overload; {$IFDEF HAS_TOSTRING} override; {$ENDIF HAS_TOSTRING} // Conversions function ToString(FormattingOptions: SizeInt): string; {$IFDEF RTL200_UP} reintroduce; {$ENDIF RTL200_UP} overload; class function FromString(const S: string): TJclTabSet; {$IFDEF SUPPORTS_STATIC} static; {$ENDIF SUPPORTS_STATIC} @@ -604,8 +606,8 @@ procedure StrResetLength(var S: UnicodeString); overload; {$ENDIF SUPPORTS_UNICODE_STRING} // natural comparison functions -function CompareNaturalStr(const S1, S2: string): SizeInt; -function CompareNaturalText(const S1, S2: string): SizeInt; +function CompareNaturalStr(const S1, S2: string): SizeInt; overload; +function CompareNaturalText(const S1, S2: string): SizeInt; overload; {$IFNDEF UNICODE_RTL_DATABASE} // internal structures published to make function inlining working @@ -638,7 +640,11 @@ implementation uses {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF SUPPORTS_UNICODE} {$IFDEF HAS_UNITSCOPE} @@ -647,7 +653,11 @@ implementation StrUtils, {$ENDIF ~HAS_UNITSCOPE} {$ENDIF SUPPORTS_UNICODE} - JclLogic, JclResources, JclStreams, JclSynch, JclSysUtils; + JclLogic, JclResources, JclStreams, + {$IFNDEF FPC} + JclSynch, + {$ENDIF ~FPC} + JclSysUtils; //=== Internal =============================================================== @@ -1999,6 +2009,7 @@ procedure StrUpperBuff(S: PChar); //=== String Management ====================================================== +{$IFNDEF FPC} procedure StrAddRef(var S: string); var P: PStrRec; @@ -2034,6 +2045,7 @@ procedure StrDecRef(var S: string); end; end; end; +{$ENDIF} function StrLength(const S: string): SizeInt; var @@ -4588,7 +4600,15 @@ function TTabSetData.Add(Column: SizeInt): SizeInt; function TTabSetData.AddRef: SizeInt; begin + {$IFNDEF FPC} Result := LockedInc(FRefCount); + {$ELSE ~FPC} + {$ifdef CPU64} + Result := InterLockedIncrement64(FRefCount); + {$ELSE ~CPU64} + Result := InterLockedIncrement(FRefCount); + {$ENDIF} + {$ENDIF FPC} end; procedure TTabSetData.CalcRealWidth; @@ -4618,7 +4638,15 @@ function TTabSetData.FindStop(Column: SizeInt): SizeInt; function TTabSetData.ReleaseRef: SizeInt; begin + {$IFNDEF FPC} Result := LockedDec(FRefCount); + {$ELSE ~FPC} + {$ifdef CPU64} + Result := InterLockedDecrement64(FRefCount); + {$ELSE ~CPU64} + Result := InterLockedDecrement(FRefCount); + {$ENDIF} + {$ENDIF FPC} if Result <= 0 then Destroy; end; diff --git a/jcl/source/common/JclSysInfo.pas b/jcl/source/common/JclSysInfo.pas index b80c1d8ce9..98ff288bdc 100644 --- a/jcl/source/common/JclSysInfo.pas +++ b/jcl/source/common/JclSysInfo.pas @@ -71,7 +71,11 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF HAS_UNITSCOPE} {$IFDEF MSWINDOWS} @@ -84,6 +88,7 @@ interface {$ENDIF MSWINDOWS} Classes, {$ENDIF ~HAS_UNITSCOPE} + Jcl8087, JclIniFiles, JclBase, JclResources; // Environment Variables @@ -188,8 +193,8 @@ function GetVolumeSerialNumber(const Drive: string): string; function GetVolumeFileSystem(const Drive: string): string; function GetVolumeFileSystemFlags(const Volume: string): TFileSystemFlags; {$ENDIF MSWINDOWS} -function GetIPAddress(const HostName: string): string; {$IFDEF MSWINDOWS} +function GetIPAddress(const HostName: string): string; procedure GetIpAddresses(Results: TStrings; const HostName: AnsiString); overload; {$ENDIF MSWINDOWS} procedure GetIpAddresses(Results: TStrings); overload; @@ -1434,19 +1439,19 @@ implementation {$ENDIF MSWINDOWS} {$ELSE ~HAS_UNITSCOPE} SysUtils, - Math, {$IFDEF MSWINDOWS} + Math, Messages, Winsock, Snmp, {$IFDEF FPC} JwaTlHelp32, JwaPsApi, {$ELSE ~FPC} + Jcl8087, JclIniFiles, TLHelp32, PsApi, JclShell, {$ENDIF ~FPC} JclRegistry, JclWin32, {$ENDIF MSWINDOWS} {$ENDIF ~HAS_UNITSCOPE} - Jcl8087, JclIniFiles, JclSysUtils, JclFileUtils, JclAnsiStrings, JclStrings; {$IFDEF FPC} @@ -1490,8 +1495,12 @@ function GetSpecialFolderLocation(const Folder: Integer): string; function DelEnvironmentVar(const Name: string): Boolean; begin {$IFDEF UNIX} + {$IFDEF HAS_UNIT_LIBC} UnSetEnv(PChar(Name)); Result := True; + {$ELSE ~HAS_UNIT_LIBC} + Result := False; + {$ENDIF ~HAS_UNIT_LIBC} {$ENDIF UNIX} {$IFDEF MSWINDOWS} Result := SetEnvironmentVariable(PChar(Name), nil); @@ -1619,13 +1628,13 @@ function ExpandEnvironmentVarCustom(var Value: string; Vars: TStrings): Boolean; {$IFDEF UNIX} -function GetEnvironmentVar(const Name: string; var Value: string): Boolean; +function GetEnvironmentVar(const Name: string; out Value: string): Boolean; begin Value := getenv(PChar(Name)); Result := Value <> ''; end; -function GetEnvironmentVar(const Name: string; var Value: string; Expand: Boolean): Boolean; +function GetEnvironmentVar(const Name: string; out Value: string; Expand: Boolean): Boolean; begin Result := GetEnvironmentVar(Name, Value); // Expand is there just for x-platform compatibility end; @@ -1726,8 +1735,12 @@ function GetEnvironmentVars(const Vars: TStrings; Expand: Boolean): Boolean; function SetEnvironmentVar(const Name, Value: string): Boolean; begin {$IFDEF UNIX} + {$IFDEF HAS_UNIT_LIBC} SetEnv(PChar(Name), PChar(Value), 1); Result := True; + {$ELSE ~HAS_UNIT_LIBC} + Result := False; + {$ENDIF ~HAS_UNIT_LIBC} {$ENDIF UNIX} {$IFDEF MSWINDOWS} Result := SetEnvironmentVariable(PChar(Name), PChar(Value)); @@ -1856,6 +1869,7 @@ function GetCommonFilesFolder: string; function GetCurrentFolder: string; {$IFDEF UNIX} +{$IFNDEF FPC} const InitialSize = 64; var @@ -1870,15 +1884,17 @@ function GetCurrentFolder: string; StrResetLength(Result); Exit; end; - {$IFDEF FPC} - if GetLastOSError <> ERANGE then - {$ELSE ~FPC} if GetLastError <> ERANGE then - {$ENDIF ~FPC} + RaiseLastOSError; Size := Size * 2; end; end; +{$ELSE FPC} +begin + Result := GetCurrentDir; +end; +{$ENDIF ~FPC} {$ENDIF UNIX} {$IFDEF MSWINDOWS} var @@ -2183,25 +2199,22 @@ function GetVolumeFileSystemFlags(const Volume: string): TFileSystemFlags; {$ENDIF MSWINDOWS} +{$IFDEF MSWINDOWS} { TODO -cDoc: Contributor: twm } function GetIPAddress(const HostName: string): string; var - {$IFDEF MSWINDOWS} R: Integer; WSAData: TWSAData; - {$ENDIF MSWINDOWS} HostEnt: PHostEnt; Host: AnsiString; SockAddr: TSockAddrIn; begin Result := ''; - {$IFDEF MSWINDOWS} WSAData.wVersion := 0; R := WSAStartup(MakeWord(1, 1), WSAData); if R = 0 then try - {$ENDIF MSWINDOWS} Host := AnsiString(HostName); if Host = '' then begin @@ -2214,15 +2227,13 @@ function GetIPAddress(const HostName: string): string; SockAddr.sin_addr.S_addr := Longint(PLongint(HostEnt^.h_addr_list^)^); Result := string(AnsiString(inet_ntoa(SockAddr.sin_addr))); end; - {$IFDEF MSWINDOWS} finally WSACleanup; end; - {$ENDIF MSWINDOWS} end; +{$ENDIF MSWINDOWS} { TODO -cDoc: Donator: twm } - {$IFDEF MSWINDOWS} procedure GetIpAddresses(Results: TStrings); begin @@ -2288,6 +2299,7 @@ procedure GetIpAddresses(Results: TStrings; const HostName: AnsiString); // note that this will append to Results! // +{$IFDEF HAS_UNIT_LIBC} procedure GetIpAddresses(Results: TStrings); var Sock: Integer; @@ -2333,9 +2345,19 @@ procedure GetIpAddresses(Results: TStrings); if_freenameindex(ListSave); end; finally + {$IFNDEF FPC} Libc.__close(Sock) + {$ELSE} + libclite.__close(Sock) + {$ENDIF ~FPC} end; end; +{$ELSE ~HAS_UNIT_LIBC} +procedure GetIpAddresses(Results: TStrings); +begin + {$NOTE GetIpAddresses not implemented} +end; +{$ENDIF ~HAS_UNIT_LIBC} {$ENDIF UNIX} @@ -2367,7 +2389,7 @@ function GetLocalComputerName: string; function GetLocalUserName: string; {$IFDEF UNIX} begin - Result := GetEnv('USER'); + GetEnvironmentVar('USER', Result); end; {$ENDIF UNIX} {$IFDEF MSWINDOWS} @@ -2609,7 +2631,7 @@ function GetBIOSDate: TDateTime; CommLen = 16; // synchronize with size of comm in struct task_struct in // /usr/include/linux/sched.h SProcDirectory = '/proc'; - +{$IFDEF HAS_UNIT_LIBC} function RunningProcessesList(const List: TStrings; FullPath: Boolean): Boolean; var ProcDir: PDirectoryStream; @@ -2676,7 +2698,13 @@ function RunningProcessesList(const List: TStrings; FullPath: Boolean): Boolean; end; end; end; - +{$ELSE HAS_UNIT_LIBC} +function RunningProcessesList(const List: TStrings; FullPath: Boolean): Boolean; +begin + Result := False; + {$NOTE RunningProcessesList not implemented} +end; +{$ENDIF HAS_UNIT_LIBC} {$ENDIF UNIX} {$IFDEF MSWINDOWS} diff --git a/jcl/source/common/JclSysUtils.pas b/jcl/source/common/JclSysUtils.pas index 5c84b14d6a..cf1ac77e48 100644 --- a/jcl/source/common/JclSysUtils.pas +++ b/jcl/source/common/JclSysUtils.pas @@ -66,9 +66,17 @@ interface {$IFDEF MSWINDOWS} Windows, {$ENDIF MSWINDOWS} + {$IFDEF FPCNONWINDOWS} + FpWinAPICompatibility, + {$ENDIF -FPCNONWINDOWS} SysUtils, Classes, TypInfo, SyncObjs, {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclSynch; + JclBase + {$IFDEF THREADSAFE} + {$IFNDEF FPC} + ,JclSynch + {$ENDIF ~FPC} + {$ENDIF THREADSAFE}; // memory initialization // first parameter is "out" to make FPC happy with uninitialized values @@ -489,6 +497,7 @@ TJclNumericFormat = class(TObject) function IntToStrZeroPad(Value, Count: Integer): string; +{$IFNDEF FPC} // Child processes type // e.g. TStrings.Append @@ -633,6 +642,7 @@ TJclCommandLineTool = class(TInterfacedObject, IJclCommandLineTool) property OutputCallback: TTextHandler read GetOutputCallback write SetOutputCallback; property Output: string read GetOutput; end; +{$ENDIF FPC} // Console Utilities function ReadKey: Char; @@ -700,8 +710,10 @@ procedure ListSetItem(var List: string; const Separator: string; function ListItemIndex(const List, Separator, Item: string): Integer; // RTL package information +{$IFDEF MSWINDOWS} function SystemTObjectInstance: TJclAddr; function IsCompiledWithPackages: Boolean; +{$ENDIF} // GUID function JclGUIDToString(const GUID: TGUID): string; @@ -868,7 +880,11 @@ implementation uses {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF MSWINDOWS} JclConsole, @@ -885,7 +901,11 @@ implementation {$ENDIF HAS_UNIT_ANSISTRINGS} {$ENDIF ~HAS_UNITSCOPE} JclFileUtils, JclMath, JclResources, JclStrings, - JclStringConversions, JclSysInfo, JclWin32; + JclStringConversions + {$IFDEF MSWINDOWS} + ,JclSysInfo, JclWin32 + {$ENDIF ~MSWINDOWS} + ; // memory initialization procedure ResetMemory(out P; Size: Longint); @@ -1257,7 +1277,9 @@ function GetAccessToHandleList: IInterface; {$IFDEF RTL160_UP} // Delphi 7-2007 OldValue := Pointer(InterlockedCompareExchange(Longint(GlobalMMFHandleListCS), Longint(CS), 0)); {$ELSE} // Delphi 5, 6 + {$IFNDEF FPC} OldValue := InterlockedCompareExchange(Pointer(GlobalMMFHandleListCS), Pointer(CS), nil); + {$ENDIF FPC} {$ENDIF RTL180_UP} {$ENDIF RTL185_UP} if OldValue <> nil then @@ -1508,6 +1530,12 @@ procedure SortDynArray(const ArrayPtr: Pointer; ElementSize: Cardinal; SortFunc: var TempBuf: TDynByteArray; + function ArrayItemPointer(Item: SizeInt): Pointer; + begin + Assert(Item >= 0); + Result := Pointer(TJclAddr(ArrayPtr) + TJclAddr(Item * SizeInt(ElementSize))); + end; + procedure QuickSort(L, R: SizeInt); var I, J, T: SizeInt; @@ -1518,10 +1546,10 @@ procedure SortDynArray(const ArrayPtr: Pointer; ElementSize: Cardinal; SortFunc: repeat I := L; J := R; - P := Pointer(TJclAddr(ArrayPtr) + TJclAddr(((L + R) shr 1) * SizeInt(ElementSize))); + P := ArrayItemPointer((L + R) shr 1); repeat - IPtr := Pointer(TJclAddr(ArrayPtr) + TJclAddr(I * SizeInt(ElementSize))); - JPtr := Pointer(TJclAddr(ArrayPtr) + TJclAddr(J * SizeInt(ElementSize))); + IPtr := ArrayItemPointer(I); + JPtr := ArrayItemPointer(J); while SortFunc(IPtr, P) < 0 do begin Inc(I); @@ -2366,7 +2394,7 @@ constructor TJclNumericFormat.Create; FSignChars[False] := '-'; FSignChars[True] := '+'; FPaddingChar := ' '; - FMultiplier := '×'; + FMultiplier := 'x'; FFractionalPartSeparator := JclFormatSettings.DecimalSeparator; FDigitBlockSeparator := JclFormatSettings.ThousandSeparator; end; @@ -2734,6 +2762,7 @@ procedure TJclNumericFormat.SetPositiveSign(const Value: Char); FSignChars[True] := Value; end; +{$IFNDEF FPC} //=== Child processes ======================================================== const @@ -3451,6 +3480,8 @@ procedure TJclCommandLineTool.SetOutputCallback(const CallbackMethod: TTextHandl FOutputCallback := CallbackMethod; end; +{$ENDIF FPC} + //=== Console Utilities ====================================================== function ReadKey: Char; @@ -3685,7 +3716,7 @@ function StrToUInt(const Value: string): Cardinal; end; //=== RTL package information ================================================ - +{$IFDEF MSWINDOWS} function SystemTObjectInstance: TJclAddr; begin Result := ModuleFromAddr(Pointer(System.TObject)); @@ -3695,7 +3726,7 @@ function IsCompiledWithPackages: Boolean; begin Result := SystemTObjectInstance <> HInstance; end; - +{$ENDIF MSWINDOWS} //=== GUID =================================================================== function JclGUIDToString(const GUID: TGUID): string; diff --git a/jcl/source/common/JclTrees.pas b/jcl/source/common/JclTrees.pas index a2a92a6ca1..a6a73a201a 100644 --- a/jcl/source/common/JclTrees.pas +++ b/jcl/source/common/JclTrees.pas @@ -52,7 +52,7 @@ interface {$IFDEF SUPPORTS_GENERICS} JclAlgorithms, {$ENDIF SUPPORTS_GENERICS} - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; type diff --git a/jcl/source/common/JclUnicode.pas b/jcl/source/common/JclUnicode.pas index b285afaf6c..345dad0c82 100644 --- a/jcl/source/common/JclUnicode.pas +++ b/jcl/source/common/JclUnicode.pas @@ -189,6 +189,9 @@ interface Character, {$ENDIF HAS_UNIT_CHARACTER} {$ENDIF ~HAS_UNITSCOPE} + {$IFDEF FPCNONWINDOWS} + FpWinAPICompatibility, + {$ENDIF ~FPCNONWINDOWS} JclBase; {$IFNDEF FPC} @@ -1546,14 +1549,18 @@ function UnicodeIsVariationSelector(C: UCS4): Boolean; {$ENDIF ~UNICODE_RTL_DATABASE} // Utility functions +{$IFDEF MSWINDOWS} function CharSetFromLocale(Language: LCID): Byte; function GetCharSetFromLocale(Language: LCID; out FontCharSet: Byte): Boolean; +{$ENDIF MSWINDOWS} function CodePageFromLocale(Language: LCID): Word; function CodeBlockName(const CB: TUnicodeBlock): string; function CodeBlockRange(const CB: TUnicodeBlock): TUnicodeBlockRange; function CodeBlockFromChar(const C: UCS4): TUnicodeBlock; +{$IFDEF MSWINDOWS} function KeyboardCodePage: Word; function KeyUnicode(C: Char): WideChar; +{$ENDIF MSWINDOWS} function StringToWideStringEx(const S: AnsiString; CodePage: Word): WideString; function TranslateString(const S: AnsiString; CP1, CP2: Word): AnsiString; function WideStringToStringEx(const WS: WideString; CodePage: Word): AnsiString; @@ -1638,7 +1645,16 @@ implementation JclCompression, {$ENDIF ~UNICODE_RAW_DATA} {$ENDIF ~UNICODE_RTL_DATABASE} - JclResources, JclSynch, JclSysUtils, JclSysInfo, JclStringConversions, JclWideStrings; + JclResources, + {$IFNDEF FPCNONWINDOWS} + JclSynch, + {$ELSE FPCNONWINDOWS} + syncobjs, + {$ENDIF FPCNONWINDOWS} + JclSysUtils, + JclSysInfo, + JclStringConversions, + JclWideStrings; const {$IFDEF FPC} // declarations from unit [Rtl]Consts @@ -1714,7 +1730,11 @@ procedure LoadCompositionData; var // As the global data can be accessed by several threads it should be guarded // while the data is loaded. + {$IFNDEF FPCNONWINDOWS} LoadInProgress: TJclCriticalSection; + {$ELSE ~FPCNONWINDOWS} + LoadInProgress: TCriticalSection; + {$ENDIF ~FPCNONWINDOWS} function OpenResourceStream(const ResName: string): TJclEasyStream; var @@ -5135,7 +5155,9 @@ procedure TURESearch.FindPrepare(const Pattern: WideString; Options: TSearchFlag constructor TWideStrings.Create; begin inherited Create; + {$IFNDEF FPCNONWINDOWS} FLanguage := GetUserDefaultLCID; + {$ENDIF ~FPCNONWINDOWS} FNormalizationForm := nfC; FSaveFormat := sfUnicodeLSB; end; @@ -7724,6 +7746,7 @@ function UnicodeIsVariationSelector(C: UCS4): Boolean; end; {$ENDIF ~UNICODE_RTL_DATABASE} +{$IFDEF MSWINDOWS} // I need to fix a problem (introduced by MS) here. The first parameter can be a pointer // (and is so defined) or can be a normal DWORD, depending on the dwFlags parameter. // As usual, lpSrc has been translated to a var parameter. But this does not work in @@ -7759,16 +7782,22 @@ function CharSetFromLocale(Language: LCID): Byte; if not GetCharSetFromLocale(Language, Result) then RaiseLastOSError; end; +{$ENDIF MSWINDOWS} function CodePageFromLocale(Language: LCID): Word; // determines the code page for a given locale var Buf: array [0..6] of Char; begin + {$IFNDEF FPCNONWINDOWS} GetLocaleInfo(Language, LOCALE_IDefaultAnsiCodePage, Buf, 6); Result := StrToIntDef(Buf, GetACP); + {$ELSE ~FPCNONWINDOWS} + Result := 0; + {$ENDIF ~FPCNONWINDOWS} end; +{$IFDEF MSWINDOWS} function KeyboardCodePage: Word; begin Result := CodePageFromLocale(GetKeyboardLayout(0) and $FFFF); @@ -7780,6 +7809,7 @@ function KeyUnicode(C: Char): WideChar; begin MultiByteToWideChar(KeyboardCodePage, MB_USEGLYPHCHARS, @C, 1, @Result, 1); end; +{$ENDIF MSWINDOWS} function CodeBlockRange(const CB: TUnicodeBlock): TUnicodeBlockRange; // http://www.unicode.org/Public/5.0.0/ucd/Blocks.txt @@ -7827,7 +7857,7 @@ function CodeBlockFromChar(const C: UCS4): TUnicodeBlock; end; end; - +{$IFDEF MSWINDOWS} function CompareTextWin95(const W1, W2: WideString; Locale: LCID): SizeInt; // special comparation function for Win9x since there's no system defined // comparation function, returns -1 if W1 < W2, 0 if W1 = W2 or 1 if W1 > W2 @@ -7855,6 +7885,13 @@ function CompareTextWinNT(const W1, W2: WideString; Locale: LCID): SizeInt; Result := CompareStringW(Locale, NORM_IGNORECASE, PWideChar(W1), Length(W1), PWideChar(W2), Length(W2)) - 2; end; +{$ELSE MSWINDOWS} +function CompareTextW(const W1, W2: WideString; Locale: LCID): SizeInt; +begin + {$NOTE Locale ignored. Adapt when a fpc release has a codepage strings} + Result := widestringmanager.CompareWideStringProc(W1, W2, [coIgnoreCase]); +end; +{$ENDIF MSWINDOWS} function StringToWideStringEx(const S: AnsiString; CodePage: Word): WideString; var @@ -7957,13 +7994,21 @@ procedure PrepareUnicodeData; // Prepares structures which are globally needed. begin {$IFNDEF UNICODE_RTL_DATABASE} + {$IFNDEF FPCNONWINDOWS} LoadInProgress := TJclCriticalSection.Create; + {$ELSE FPCNONWINDOWS} + LoadInProgress := TCriticalSection.Create; + {$ENDIF FPCNONWINDOWS} {$ENDIF ~UNICODE_RTL_DATABASE} + {$IFDEF MSWINDOWS} if (Win32Platform and VER_PLATFORM_WIN32_NT) <> 0 then @WideCompareText := @CompareTextWinNT else @WideCompareText := @CompareTextWin95; + {$ELSE MSWINDOWS} + @WideCompareText := @CompareTextW; + {$ENDIF MSWINDOWS} end; procedure FreeUnicodeData; diff --git a/jcl/source/common/JclUnitVersioning.pas b/jcl/source/common/JclUnitVersioning.pas index f0f9d49b8f..a5385e8bcf 100644 --- a/jcl/source/common/JclUnitVersioning.pas +++ b/jcl/source/common/JclUnitVersioning.pas @@ -709,7 +709,7 @@ procedure UnregisterUnitVersion(Instance: THandle); UnitVersioning: TUnitVersioning; begin UnitVersioning := GetUnitVersioning; - if Assigned(UnitVersioning) then + if Assigned(UnitVersioning) and not IsLibrary then UnitVersioning.UnregisterModule(Instance); end; diff --git a/jcl/source/common/JclVectors.pas b/jcl/source/common/JclVectors.pas index 0a42c72026..7d2d967d40 100644 --- a/jcl/source/common/JclVectors.pas +++ b/jcl/source/common/JclVectors.pas @@ -53,7 +53,7 @@ interface {$ELSE ~HAS_UNITSCOPE} Classes, {$ENDIF ~HAS_UNITSCOPE} - JclAlgorithms, JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclAlgorithms, JclBase, JclAbstractContainers, JclContainerIntf {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; type diff --git a/jcl/source/common/JclWideStrings.pas b/jcl/source/common/JclWideStrings.pas index 462fc266e5..5f6cc4f836 100644 --- a/jcl/source/common/JclWideStrings.pas +++ b/jcl/source/common/JclWideStrings.pas @@ -2104,7 +2104,7 @@ function TJclWideStringList.GetObject(Index: Integer): TObject; function TJclWideStringList.GetP(Index: Integer): PWideString; begin - Result := Addr(GetItem(Index).FString); + Result := PWideString(GetItem(Index).FString); end; function TJclWideStringList.IndexOf(const S: WideString): Integer; diff --git a/jcl/source/common/bzip2.pas b/jcl/source/common/bzip2.pas index cc2870e965..ee8568d1c0 100644 --- a/jcl/source/common/bzip2.pas +++ b/jcl/source/common/bzip2.pas @@ -378,7 +378,11 @@ implementation {$ENDIF BZIP2_LINKONREQUEST} Types, {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} SysUtils; {$ENDIF ~HAS_UNITSCOPE} diff --git a/jcl/source/common/pcre.pas b/jcl/source/common/pcre.pas index de8835546a..7998a90ad1 100644 --- a/jcl/source/common/pcre.pas +++ b/jcl/source/common/pcre.pas @@ -1693,7 +1693,11 @@ implementation uses {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE FPC} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF HAS_UNITSCOPE} {$IFDEF MSWINDOWS} diff --git a/jcl/source/common/zlibh.pas b/jcl/source/common/zlibh.pas index 2032b98d2d..0575105db9 100644 --- a/jcl/source/common/zlibh.pas +++ b/jcl/source/common/zlibh.pas @@ -69,7 +69,11 @@ interface Windows, {$ENDIF MSWINDOWS} {$IFDEF HAS_UNIT_LIBC} + {$IFNDEF FPC} Libc, + {$ELSE} + libclite, + {$ENDIF ~FPC} {$ENDIF HAS_UNIT_LIBC} {$IFDEF UNITVERSIONING} JclUnitVersioning, @@ -2376,12 +2380,14 @@ procedure free(pBlock: Pointer); {$ENDIF ~LINK_TO_MSVCRT} +{$IFNDEF FPC} {$IFDEF CPU32} procedure __llmod; cdecl; asm jmp System.@_llmod; end; {$ENDIF CPU32} +{$ENDIF FPC} {$ENDIF ZLIB_STATICLINK} {$ENDIF ~ZLIB_RTL} diff --git a/jcl/source/fpc/FpLibcCompatibility.pas b/jcl/source/fpc/FpLibcCompatibility.pas new file mode 100644 index 0000000000..f825b6b476 --- /dev/null +++ b/jcl/source/fpc/FpLibcCompatibility.pas @@ -0,0 +1,110 @@ +unit FpLibcCompatibility; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils; + +Function isgraph(c : Byte) : Integer; +Function isupper(c : Byte) : Integer; +Function islower(c : Byte) : Integer; +Function isalpha(c : Byte) : Integer; +Function isdigit(c : Byte) : Integer; +Function isalnum(c : Byte) : Integer; +Function ispunct(c : Byte) : Integer; +Function isspace(c : Byte) : Integer; +Function iscntrl(c : Byte) : Integer; +Function isblank(c : Byte) : Integer; +Function isxdigit(c : Byte) : Integer; +Function tolower(c : Byte) : Integer; +Function toupper(c : Byte) : Integer; + +implementation + +Function isgraph(c : Byte) : Integer; +begin + if (c - $21) < $5e + then isgraph := 1 + else isgraph := 0; +end; + +Function isupper(c : Byte) : Integer; +begin + if ((c >= 192) and (c <= 223)) or ((AnsiChar(c) >= 'A') and (AnsiChar(c) <= 'Z')) + then isupper := 1 + else isupper := 0; +end; + +Function islower(c : Byte) : Integer; +begin + if ((c >= 224) and (c <= 254)) or ((AnsiChar(c) >= 'a') and (AnsiChar(c) <= 'z')) + then islower := 1 + else islower := 0; +end; + +Function isalpha(c : Byte) : Integer; +begin + if ((c >= 192) and (c <= 223)) or ((AnsiChar(c) >= 'A') and (AnsiChar(c) <= 'Z')) + or ((c >= 224) and (c <= 254)) or ((AnsiChar(c) >= 'a') and (AnsiChar(c) <= 'z')) + then isalpha := 1 + else isalpha := 0; +end; + +Function isdigit(c : Byte) : Integer; +begin + if AnsiChar(c) in ['0'..'9'] then isdigit := 1 + else isdigit := 0; +end; + +Function isalnum(c : Byte) : Integer; +begin + if (isalpha(c) <> 0) or (isdigit(c) <> 0) then isalnum := 1 + else isalnum := 0; +end; + +Function ispunct(c : Byte) : Integer; +begin + if (isgraph(c) = 1) and (isalnum(c) = 0) + then ispunct := 1 + else ispunct := 0; +end; + + +Function isspace(c : Byte) : Integer; +begin + if AnsiChar(c) in [#9..#13,#32] then isspace := 1 + else isspace := 0; +end; + +Function iscntrl(c : Byte) : Integer; +begin + if (c < $20) or (c = $7f) then iscntrl := 1 + else iscntrl := 0; +end; + +Function isblank(c : Byte) : Integer; +begin + if c in [9, 32] then isblank := 1 + else isblank := 0; +end; + +Function isxdigit(c : Byte) : Integer; +begin + if (isdigit(c) = 1) or ((c in [ord('a')..ord('f')]) or (c in [ord('A')..ord('F')])) then isxdigit := 1 + else isxdigit := 0; +end; + +Function tolower(c : Byte) : Integer; +begin + Result := Integer(lowerCase(Char(c))); +end; + +Function toupper(c : Byte) : Integer; +begin + Result := Integer(upCase(Char(c))); +end; + +end. + diff --git a/jcl/source/fpc/FpStringHash.pas b/jcl/source/fpc/FpStringHash.pas new file mode 100644 index 0000000000..83021c53f5 --- /dev/null +++ b/jcl/source/fpc/FpStringHash.pas @@ -0,0 +1,80 @@ +unit FpStringHash; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, contnrs; + +type + + { TStringHash } + + TStringHash = class + private + FHash: TFPHashList; + public + constructor Create({%H-}Size: Cardinal); + destructor Destroy; override; + procedure Add(const Key: string; Value: Integer); + procedure Clear; + function Modify(const Key: string; Value: Integer): Boolean; + procedure Remove(const Key: string); + function ValueOf(const Key: string): Integer; + end; + +implementation + +{ TStringHash } + +constructor TStringHash.Create(Size: Cardinal); +begin + //Ignore Size. TFpHashList adapt hash size according to Capacity + FHash := TFPHashList.Create; +end; + +destructor TStringHash.Destroy; +begin + FHash.Destroy; + inherited Destroy; +end; + +procedure TStringHash.Add(const Key: string; Value: Integer); +begin + FHash.Add(Key, Pointer(Value)); +end; + +procedure TStringHash.Clear; +begin + FHash.Clear; +end; + +function TStringHash.Modify(const Key: string; Value: Integer): Boolean; +var + Index: Integer; +begin + Index := FHash.FindIndexOf(Key); + Result := Index <> -1; + if Result then + FHash.Items[Index] := Pointer(Value); +end; + +procedure TStringHash.Remove(const Key: string); +var + Index: Integer; +begin + Index := FHash.FindIndexOf(Key); + if Index <> -1 then + FHash.Delete(Index); +end; + +function TStringHash.ValueOf(const Key: string): Integer; +begin + Result := FHash.FindIndexOf(Key); + if Result <> -1 then + Result := Integer(FHash.Items[Result]); +end; + +end. + diff --git a/jcl/source/fpc/FpWinAPICompatibility.pas b/jcl/source/fpc/FpWinAPICompatibility.pas new file mode 100644 index 0000000000..874d9c077c --- /dev/null +++ b/jcl/source/fpc/FpWinAPICompatibility.pas @@ -0,0 +1,81 @@ +unit FpWinAPICompatibility; + +{$mode objfpc}{$H+} + +interface + +uses + SysUtils; + +const + CP_ACP = 0; + CP_UTF8 = 65001; + MB_PRECOMPOSED = 1; + MB_COMPOSITE = 2; + MB_USEGLYPHCHARS = 4; + +type + LCID = DWORD; + DWORD_PTR = PtrUInt; + +function MultiByteToWideChar(CodePage: DWord; dwFlags: DWord; lpMultiByteStr: PAnsiChar; cchMultiByte: longint; lpWideCharStr:PWideChar; cchWideChar:longint): longint; +function WideCharToMultiByte(CodePage: DWord; dwFlags:DWORD; lpWideCharStr: PWideChar; cchWideChar:longint; lpMultiByteStr: PAnsiChar;cchMultiByte:longint; lpDefaultChar: PAnsiChar; lpUsedDefaultChar: PBoolean):longint; + +implementation + +uses + Math; + +function MultiByteToWideChar(CodePage: DWord; dwFlags: DWord; lpMultiByteStr: PAnsiChar; cchMultiByte: longint; lpWideCharStr:PWideChar; cchWideChar:longint): longint; +var + UTF16Str: UnicodeString; +begin + if CodePage = CP_UTF8 then + begin + Result := Utf8ToUnicode(lpWideCharStr, cchWideChar, lpMultiByteStr, cchMultiByte); + end + else + begin + //fpc 2.6.x does not support arbitrary code pages. Uses ansi for now + if cchMultiByte = -1 then + cchMultiByte := strlen(lpMultiByteStr); + widestringmanager.Ansi2UnicodeMoveProc(lpMultiByteStr, CodePage, UTF16Str, cchWideChar); + Result := Min(cchWideChar, Length(UTF16Str)); + if Result > 0 then + Move(UTF16Str[1], lpWideCharStr^, Result * SizeOf(PWideChar)); + end; +end; + +//copied from fpc trunk +function fpc_pwidechar_length(p:pwidechar):sizeint; +var i : sizeint; +begin + i:=0; + if assigned(p) then + while p[i]<>#0 do + inc(i); + exit(i); +end; + +function WideCharToMultiByte(CodePage: DWord; dwFlags:DWORD; lpWideCharStr: PWideChar; cchWideChar:longint; lpMultiByteStr: PAnsiChar;cchMultiByte:longint; lpDefaultChar: PAnsiChar; lpUsedDefaultChar: PBoolean):longint; +var + AnsiStr: AnsiString; +begin + if CodePage = CP_UTF8 then + begin + Result := UnicodeToUtf8(lpMultiByteStr, cchMultiByte, lpWideCharStr, cchWideChar); + end + else + begin + //fpc 2.6.x does not support arbitrary code pages. Uses ansi for now + if cchWideChar = -1 then + cchWideChar := fpc_pwidechar_length(lpWideCharStr); + widestringmanager.Unicode2AnsiMoveProc(lpWideCharStr, AnsiStr, CodePage, cchWideChar); + Result := Min(cchMultiByte, Length(AnsiStr)); + if Result > 0 then + Move(AnsiStr[1], lpMultiByteStr^, Result); + end; +end; + +end. + diff --git a/jcl/source/fpc/libclite/aineth.inc b/jcl/source/fpc/libclite/aineth.inc new file mode 100644 index 0000000000..c8d14884cb --- /dev/null +++ b/jcl/source/fpc/libclite/aineth.inc @@ -0,0 +1,24 @@ + + +function inet_addr(__cp:Pchar):in_addr_t;cdecl;external clib name 'inet_addr'; +function inet_lnaof(__in:in_addr):in_addr_t;cdecl;external clib name 'inet_lnaof'; +function inet_makeaddr(__net:in_addr_t; __host:in_addr_t): in_addr_t;cdecl;external clib name 'inet_makeaddr'; +function inet_netof(__in:in_addr):in_addr_t;cdecl;external clib name 'inet_netof'; +function inet_network(__cp:Pchar):in_addr_t;cdecl;external clib name 'inet_network'; +function inet_ntoa(__in:in_addr):Pchar;cdecl;external clib name 'inet_ntoa'; +function inet_pton(__af:longint; __cp:Pchar; __buf:pointer):longint;cdecl;external clib name 'inet_pton'; +function inet_ntop(__af:longint; __cp:pointer; __buf:Pchar; __len:socklen_t):Pchar;cdecl;external clib name 'inet_ntop'; +function inet_aton(__cp:Pchar; __inp:Pin_addr):in_addr_t;cdecl;external clib name 'inet_aton'; +function inet_neta(__net:in_addr_t; __buf:Pchar; __len:size_t):Pchar;cdecl;external clib name 'inet_neta'; +function inet_net_ntop(__af:longint; __cp:pointer; __bits:longint; __buf:Pchar; __len:size_t):Pchar;cdecl;external clib name 'inet_net_ntop'; +function inet_net_pton(__af:longint; __cp:Pchar; __buf:pointer; __len:size_t):longint;cdecl;external clib name 'inet_net_pton'; +function inet_nsap_addr(__cp:Pchar; __buf:Pbyte; __len:longint):dword;cdecl;external clib name 'inet_nsap_addr'; +function inet_nsap_ntoa(__len:longint; __cp:Pbyte; __buf:Pchar):Pchar;cdecl;external clib name 'inet_nsap_ntoa'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function inet_aton(__cp:Pchar; var __inp:in_addr):in_addr_t;cdecl;external clib name 'inet_aton'; diff --git a/jcl/source/fpc/libclite/aioh.inc b/jcl/source/fpc/libclite/aioh.inc new file mode 100644 index 0000000000..4af4661287 --- /dev/null +++ b/jcl/source/fpc/libclite/aioh.inc @@ -0,0 +1,117 @@ + + +type + Paiocb = ^aiocb; + aiocb = record + aio_fildes : longint; + aio_lio_opcode : longint; + aio_reqprio : longint; + aio_buf : pointer; + aio_nbytes : size_t; + aio_sigevent : sigevent; + __next_prio : Paiocb; + __abs_prio : longint; + __policy : longint; + __error_code : longint; + __return_value : __ssize_t; + aio_offset : __off_t; + __pad : array[0..((sizeof(__off64_t)) - (sizeof(__off_t)))-1] of char; + __unused : array[0..31] of char; + end; + PPaiocb = ^Paiocb; + + Paiocb64 = ^aiocb64; + aiocb64 = record + aio_fildes : longint; + aio_lio_opcode : longint; + aio_reqprio : longint; + aio_buf : pointer; + aio_nbytes : size_t; + aio_sigevent : sigevent; + __next_prio : Paiocb; + __abs_prio : longint; + __policy : longint; + __error_code : longint; + __return_value : __ssize_t; + aio_offset : __off64_t; + __unused : array[0..31] of char; + end; + PPaiocb64 = ^Paiocb64; + + Paioinit = ^aioinit; + aioinit = record + aio_threads : longint; + aio_num : longint; + aio_locks : longint; + aio_usedba : longint; + aio_debug : longint; + aio_numusers : longint; + aio_idle_time : longint; + aio_reserved : longint; + end; + +Const + AIO_CANCELED = 0; + AIO_NOTCANCELED = 1; + AIO_ALLDONE = 2; + +Const + LIO_READ = 0; + LIO_WRITE = 1; + LIO_NOP = 2; + +Const + LIO_WAIT = 0; + LIO_NOWAIT = 1; + + +procedure aio_init(__init:Paioinit);cdecl;external clib name 'aio_init'; +function aio_read(__aiocbp:Paiocb):longint;cdecl;external clib name 'aio_read'; +function aio_write(__aiocbp:Paiocb):longint;cdecl;external clib name 'aio_write'; +function lio_listio(__mode:longint; __list:PPaiocb; __nent:longint; __sig:Psigevent):longint;cdecl;external clib name 'lio_listio'; +function aio_error(__aiocbp:Paiocb):longint;cdecl;external clib name 'aio_error'; +function aio_return(__aiocbp:Paiocb):__ssize_t;cdecl;external clib name 'aio_return'; +function aio_cancel(__fildes:longint; __aiocbp:Paiocb):longint;cdecl;external clib name 'aio_cancel'; +function aio_suspend(__list:array of Paiocb; __nent:longint; __timeout:Ptimespec):longint;cdecl;external clib name 'aio_suspend'; +function aio_fsync(__operation:longint; __aiocbp:Paiocb):longint;cdecl;external clib name 'aio_fsync'; + +function aio_read64(__aiocbp:Paiocb64):longint;cdecl;external clib name 'aio_read64'; +function aio_write64(__aiocbp:Paiocb64):longint;cdecl;external clib name 'aio_write64'; +function lio_listio64(__mode:longint; __list:PPaiocb64; __nent:longint; __sig:Psigevent):longint;cdecl;external clib name 'lio_listio64'; +function aio_error64(__aiocbp:Paiocb64):longint;cdecl;external clib name 'aio_error64'; +function aio_return64(__aiocbp:Paiocb64):__ssize_t;cdecl;external clib name 'aio_return64'; +function aio_cancel64(__fildes:longint; __aiocbp:Paiocb64):longint;cdecl;external clib name 'aio_cancel64'; +function aio_suspend64(__list:array of Paiocb64; __nent:longint; __timeout:Ptimespec):longint;cdecl;external clib name 'aio_suspend64'; +function aio_fsync64(__operation:longint; __aiocbp:Paiocb64):longint;cdecl;external clib name 'aio_fsync64'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPAsyncIoCB = aiocb; + PAsyncIoCB = ^TPAsyncIoCB; + PPAsyncIoCB = ^PAsyncIoCB; + + PAsyncIoCB64 = ^TAsyncIoCB64; + TAsyncIoCB64 = aiocb64; + PPAsyncIoCB64 = ^PAsyncIoCB64; + +procedure aio_init(const __init:aioinit);cdecl;external clib name 'aio_init'; +function aio_read(var __aiocbp:aiocb):longint;cdecl;external clib name 'aio_read'; +function aio_write(var __aiocbp:aiocb):longint;cdecl;external clib name 'aio_write'; +function lio_listio(__mode:longint; __list:PPaiocb; __nent:longint; var __sig:sigevent):longint;cdecl;external clib name 'lio_listio'; +function aio_error(const __aiocbp:aiocb):longint;cdecl;external clib name 'aio_error'; +function aio_return(var __aiocbp:aiocb):__ssize_t;cdecl;external clib name 'aio_return'; +function aio_cancel(__fildes:longint; var __aiocbp:aiocb):longint;cdecl;external clib name 'aio_cancel'; +function aio_suspend(__list: PPaiocb; __nent:longint; const __timeout:timespec):longint;cdecl;external clib name 'aio_suspend'; +function aio_fsync(__operation:longint;var __aiocbp:aiocb):longint;cdecl;external clib name 'aio_fsync'; + +function aio_read64(const __aiocbp:aiocb64):longint;cdecl;external clib name 'aio_read64'; +function aio_write64(var __aiocbp: aiocb64):longint;cdecl;external clib name 'aio_write64'; +function lio_listio64(__mode:longint; __list:PPaiocb64; __nent:longint;var __sig:sigevent):longint;cdecl;external clib name 'lio_listio64'; +function aio_error64(const __aiocbp:aiocb64):longint;cdecl;external clib name 'aio_error64'; +function aio_return64(var __aiocbp:aiocb64):__ssize_t;cdecl;external clib name 'aio_return64'; +function aio_cancel64(__fildes:longint; var __aiocbp:aiocb64):longint;cdecl;external clib name 'aio_cancel64'; +function aio_suspend64(__list:PPaiocb64; __nent:longint; const __timeout:timespec):longint;cdecl;external clib name 'aio_suspend64'; +function aio_fsync64(__operation:longint; var __aiocbp: aiocb64):longint;cdecl;external clib name 'aio_fsync64'; diff --git a/jcl/source/fpc/libclite/aliasesh.inc b/jcl/source/fpc/libclite/aliasesh.inc new file mode 100644 index 0000000000..40de7e2bd1 --- /dev/null +++ b/jcl/source/fpc/libclite/aliasesh.inc @@ -0,0 +1,28 @@ + +type + Paliasent = ^aliasent; + aliasent = record + alias_name : Pchar; + alias_members_len : size_t; + alias_members : ^Pchar; + alias_local : longint; + end; + PPaliasent = ^Paliasent; + +procedure setaliasent;cdecl;external clib name 'setaliasent'; +procedure endaliasent;cdecl;external clib name 'endaliasent'; +function getaliasent:Paliasent;cdecl;external clib name 'getaliasent'; +function getaliasent_r(__result_buf:Paliasent; __buffer:Pchar; __buflen:size_t; __result:PPaliasent):longint;cdecl;external clib name 'getaliasent_r'; +function getaliasbyname(__name:Pchar):Paliasent;cdecl;external clib name 'getaliasbyname'; +function getaliasbyname_r(__name:Pchar; __result_buf:Paliasent; __buffer:Pchar; __buflen:size_t; __result:PPaliasent):longint;cdecl;external clib name 'getaliasbyname_r'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TAliasEntry = aliasent; + PAliasEntry = ^TAliasEntry; + +function getaliasent_r(var __result_buf:aliasent; __buffer:Pchar; __buflen:size_t; var __result:Paliasent):longint;cdecl;external clib name 'getaliasent_r'; +function getaliasbyname_r(__name:Pchar; var __result_buf:aliasent; __buffer:Pchar; __buflen:size_t; var __result:Paliasent):longint;cdecl;external clib name 'getaliasbyname_r'; diff --git a/jcl/source/fpc/libclite/allocah.inc b/jcl/source/fpc/libclite/allocah.inc new file mode 100644 index 0000000000..0a1022cc5c --- /dev/null +++ b/jcl/source/fpc/libclite/allocah.inc @@ -0,0 +1,8 @@ + +function alloca(__size:size_t):pointer;cdecl;external clib name '__builtin_alloca'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/argph.inc b/jcl/source/fpc/libclite/argph.inc new file mode 100644 index 0000000000..875daa00a4 --- /dev/null +++ b/jcl/source/fpc/libclite/argph.inc @@ -0,0 +1,155 @@ + +type + Pargp_option = ^argp_option; + argp_option = record + name : Pchar; + key : longint; + arg : Pchar; + flags : longint; + doc : Pchar; + group : longint; + end; + + +const + OPTION_ARG_OPTIONAL = $1; + OPTION_HIDDEN = $2; + OPTION_ALIAS = $4; + OPTION_DOC = $8; + OPTION_NO_USAGE = $10; + + ARGP_ERR_UNKNOWN = E2BIG; + ARGP_KEY_ARG = 0; + ARGP_KEY_ARGS = $1000006; + ARGP_KEY_END = $1000001; + ARGP_KEY_NO_ARGS = $1000002; + ARGP_KEY_INIT = $1000003; + ARGP_KEY_FINI = $1000007; + ARGP_KEY_SUCCESS = $1000004; + ARGP_KEY_ERROR = $1000005; + + ARGP_KEY_HELP_PRE_DOC = $2000001; + ARGP_KEY_HELP_POST_DOC = $2000002; + ARGP_KEY_HELP_HEADER = $2000003; + ARGP_KEY_HELP_EXTRA = $2000004; + ARGP_KEY_HELP_DUP_ARGS_NOTE = $2000005; + ARGP_KEY_HELP_ARGS_DOC = $2000006; + + ARGP_PARSE_ARGV0 = $01; + ARGP_NO_ERRS = $02; + ARGP_NO_ARGS = $04; + ARGP_IN_ORDER = $08; + ARGP_NO_HELP = $10; + ARGP_NO_EXIT = $20; + ARGP_LONG_ONLY = $40; + ARGP_SILENT = (ARGP_NO_EXIT or ARGP_NO_ERRS) or ARGP_NO_HELP; + +type + Pargp_state = ^argp_state; + Pargp_child = ^argp_child; + + argp_parser_t = function (key:longint; arg:Pchar; state:Pargp_state):error_t;cdecl; + + Pargp = ^argp; + argp = record + options : Pargp_option; + parser : argp_parser_t; + args_doc : Pchar; + doc : Pchar; + children : Pargp_child; + help_filter : function (__key:longint; __text:Pchar; __input:pointer):Pchar; + argp_domain : Pchar; + end; + + + argp_child = record + argp : Pargp; + flags : longint; + header : Pchar; + group : longint; + end; + + argp_state = record + root_argp : Pargp; + argc : longint; + argv : ^Pchar; + next : longint; + flags : dword; + arg_num : dword; + quoted : longint; + input : pointer; + child_inputs : ^pointer; + hook : pointer; + name : Pchar; + err_stream : PFILE; + out_stream : PFILE; + pstate : pointer; + end; + +type + TArgPProgramVersionHook = procedure(__stream: PFILE; __state: pargp_state); cdecl; + + + +function argp_parse(__argp:Pargp; __argc:longint; __argv:PPchar; __flags:dword; __arg_index:Plongint; + __input:pointer):error_t;cdecl;external clib name 'argp_parse'; +function __argp_parse(__argp:Pargp; __argc:longint; __argv:PPchar; __flags:dword; __arg_index:Plongint; + __input:pointer):error_t;cdecl;external clib name '__argp_parse'; +var + argp_program_version : Pchar;cvar;external; + argp_program_version_hook : TArgPProgramVersionHook;cvar;external; + argp_program_bug_address : Pchar;cvar;external; + argp_err_exit_status : error_t;cvar;external; + +const + ARGP_HELP_USAGE = $01; + ARGP_HELP_SHORT_USAGE = $02; + ARGP_HELP_SEE = $04; + ARGP_HELP_LONG = $08; + ARGP_HELP_PRE_DOC = $10; + ARGP_HELP_POST_DOC = $20; + ARGP_HELP_DOC = ARGP_HELP_PRE_DOC or ARGP_HELP_POST_DOC; + ARGP_HELP_BUG_ADDR = $40; + ARGP_HELP_LONG_ONLY = $80; + ARGP_HELP_EXIT_ERR = $100; + ARGP_HELP_EXIT_OK = $200; + ARGP_HELP_STD_ERR = ARGP_HELP_SEE or ARGP_HELP_EXIT_ERR; + ARGP_HELP_STD_USAGE = (ARGP_HELP_SHORT_USAGE or ARGP_HELP_SEE) or ARGP_HELP_EXIT_ERR; + ARGP_HELP_STD_HELP = (((ARGP_HELP_SHORT_USAGE or ARGP_HELP_LONG) or ARGP_HELP_EXIT_OK) or ARGP_HELP_DOC) or ARGP_HELP_BUG_ADDR; + +procedure argp_help(__argp:Pargp; __stream:PFILE; __flags:dword; __name:Pchar);cdecl;external clib name 'argp_help'; +procedure __argp_help(__argp:Pargp; __stream:PFILE; __flags:dword; __name:Pchar);cdecl;external clib name '__argp_help'; +procedure argp_state_help(__state:Pargp_state; __stream:PFILE; __flags:dword);cdecl;external clib name 'argp_state_help'; +procedure __argp_state_help(__state:Pargp_state; __stream:PFILE; __flags:dword);cdecl;external clib name '__argp_state_help'; +procedure argp_usage(__state:Pargp_state);cdecl;external clib name 'argp_usage'; +procedure __argp_usage(__state:Pargp_state);cdecl;external clib name '__argp_usage'; +procedure argp_error(__state:Pargp_state; __fmt:Pchar; args:array of const);cdecl;external clib name 'argp_error'; +procedure argp_error(__state:Pargp_state; __fmt:Pchar);cdecl;varargs;external clib name 'argp_error'; +procedure __argp_error(__state:Pargp_state; __fmt:Pchar; args:array of const);cdecl;external clib name '__argp_error'; +procedure __argp_error(__state:Pargp_state; __fmt:Pchar);cdecl;varargs;external clib name '__argp_error'; +procedure argp_failure(__state:Pargp_state; __status:longint; __errnum:longint; __fmt:Pchar; args:array of const);cdecl;external clib name 'argp_failure'; +procedure argp_failure(__state:Pargp_state; __status:longint; __errnum:longint; __fmt:Pchar);cdecl;varargs;external clib name 'argp_failure'; +procedure __argp_failure(__state:Pargp_state; __status:longint; __errnum:longint; __fmt:Pchar; args:array of const);cdecl;external clib name '__argp_failure'; +procedure __argp_failure(__state:Pargp_state; __status:longint; __errnum:longint; __fmt:Pchar);cdecl;varargs;external clib name '__argp_failure'; +function _option_is_short(__opt:Pargp_option):longint;cdecl;external clib name '_option_is_short'; +function __option_is_short(__opt:Pargp_option):longint;cdecl;external clib name '__option_is_short'; +function _option_is_end(__opt:Pargp_option):longint;cdecl;external clib name '_option_is_end'; +function __option_is_end(__opt:Pargp_option):longint;cdecl;external clib name '__option_is_end'; +function _argp_input(__argp:Pargp; __state:Pargp_state):pointer;cdecl;external clib name '_argp_input'; +function __argp_input(__argp:Pargp; __state:Pargp_state):pointer;cdecl;external clib name '__argp_input'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TArgP = argp; + + TArgPOption = argp_option; + PArgPOption = ^TArgPOption; + + TArgPState = argp_state; + PArgPState = ^TArgPState; + TArgPChild = argp_child; + PArgPChild = ^TArgPChild; + diff --git a/jcl/source/fpc/libclite/argzh.inc b/jcl/source/fpc/libclite/argzh.inc new file mode 100644 index 0000000000..d465cbccff --- /dev/null +++ b/jcl/source/fpc/libclite/argzh.inc @@ -0,0 +1,33 @@ + + +type + + Perror_t = ^error_t; + +function argz_create(__argv:PPchar; __argz:PPchar; __len:Psize_t):error_t;cdecl;external clib name 'argz_create'; +function argz_create_sep(__string:Pchar; __sep:longint; __argz:PPchar; __len:Psize_t):error_t;cdecl;external clib name 'argz_create_sep'; +function argz_count(__argz:Pchar; __len:size_t):size_t;cdecl;external clib name 'argz_count'; +procedure argz_extract(__argz:Pchar; __len:size_t; __argv:PPchar);cdecl;external clib name 'argz_extract'; +procedure argz_stringify(__argz:Pchar; __len:size_t; __sep:longint);cdecl;external clib name 'argz_stringify'; +function argz_append(__argz:PPchar; __argz_len:Psize_t; __buf:Pchar; __buf_len:size_t):error_t;cdecl;external clib name 'argz_append'; +function argz_add(__argz:PPchar; __argz_len:Psize_t; __str:Pchar):error_t;cdecl;external clib name 'argz_add'; +function argz_add_sep(__argz:PPchar; __argz_len:Psize_t; __string:Pchar; __delim:longint):error_t;cdecl;external clib name 'argz_add_sep'; +procedure argz_delete(__argz:PPchar; __argz_len:Psize_t; __entry:Pchar);cdecl;external clib name 'argz_delete'; +function argz_insert(__argz:PPchar; __argz_len:Psize_t; __before:Pchar; __entry:Pchar):error_t;cdecl;external clib name 'argz_insert'; +function argz_replace(__argz:PPchar; __argz_len:Psize_t; __str:Pchar; __with:Pchar; __replace_count:Pdword):error_t;cdecl;external clib name 'argz_replace'; +function argz_next(__argz:Pchar; __argz_len:size_t; __entry:Pchar):Pchar;cdecl;external clib name 'argz_next'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function argz_create(__argv:PPchar; var __argz: Pchar; var __len: size_t):error_t;cdecl;external clib name 'argz_create'; +function argz_create_sep(__string:Pchar; __sep:longint; var __argz: Pchar; var __len: size_t):error_t;cdecl;external clib name 'argz_create_sep'; +function argz_append(var __argz: Pchar; var __argz_len: size_t; __buf:Pchar; __buf_len:size_t):error_t;cdecl;external clib name 'argz_append'; +function argz_add(var __argz: Pchar; var __argz_len: size_t; __str:Pchar):error_t;cdecl;external clib name 'argz_add'; +function argz_add_sep(var __argz: Pchar; var __argz_len: size_t; __string:Pchar; __delim:longint):error_t;cdecl;external clib name 'argz_add_sep'; +procedure argz_delete(var __argz: Pchar; var __argz_len: size_t; __entry:Pchar);cdecl;external clib name 'argz_delete'; +function argz_insert(var __argz: Pchar; var __argz_len: size_t; __before:Pchar; __entry:Pchar):error_t;cdecl;external clib name 'argz_insert'; +function argz_replace(var __argz: Pchar; var __argz_len: size_t; __str:Pchar; __with:Pchar; __replace_count:Pdword):error_t;cdecl;external clib name 'argz_replace'; diff --git a/jcl/source/fpc/libclite/asocketh.inc b/jcl/source/fpc/libclite/asocketh.inc new file mode 100644 index 0000000000..d2ea28e9d4 --- /dev/null +++ b/jcl/source/fpc/libclite/asocketh.inc @@ -0,0 +1,39 @@ + +const + SOL_SOCKET = 1; + SO_DEBUG = 1; + SO_REUSEADDR = 2; + SO_TYPE = 3; + SO_ERROR = 4; + SO_DONTROUTE = 5; + SO_BROADCAST = 6; + SO_SNDBUF = 7; + SO_RCVBUF = 8; + SO_KEEPALIVE = 9; + SO_OOBINLINE = 10; + SO_NO_CHECK = 11; + SO_PRIORITY = 12; + SO_LINGER = 13; + SO_BSDCOMPAT = 14; + SO_PASSCRED = 16; + SO_PEERCRED = 17; + SO_RCVLOWAT = 18; + SO_SNDLOWAT = 19; + SO_RCVTIMEO = 20; + SO_SNDTIMEO = 21; + SO_SECURITY_AUTHENTICATION = 22; + SO_SECURITY_ENCRYPTION_TRANSPORT = 23; + SO_SECURITY_ENCRYPTION_NETWORK = 24; + SO_BINDTODEVICE = 25; + SO_ATTACH_FILTER = 26; + SO_DETACH_FILTER = 27; + SO_PEERNAME = 28; + SO_TIMESTAMP = 29; + SCM_TIMESTAMP = SO_TIMESTAMP; + SO_ACCEPTCONN = 30; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/asockiosh.inc b/jcl/source/fpc/libclite/asockiosh.inc new file mode 100644 index 0000000000..ed932ea1c5 --- /dev/null +++ b/jcl/source/fpc/libclite/asockiosh.inc @@ -0,0 +1,14 @@ + +const + FIOSETOWN = $8901; + SIOCSPGRP = $8902; + FIOGETOWN = $8903; + SIOCGPGRP = $8904; + SIOCATMARK = $8905; + SIOCGSTAMP = $8906; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bconfnameh.inc b/jcl/source/fpc/libclite/bconfnameh.inc new file mode 100644 index 0000000000..63a5815e67 --- /dev/null +++ b/jcl/source/fpc/libclite/bconfnameh.inc @@ -0,0 +1,261 @@ + +Const + _PC_LINK_MAX = 0; + _PC_MAX_CANON = 1; + _PC_MAX_INPUT = 2; + _PC_NAME_MAX = 3; + _PC_PATH_MAX = 4; + _PC_PIPE_BUF = 5; + _PC_CHOWN_RESTRICTED = 6; + _PC_NO_TRUNC = 7; + _PC_VDISABLE = 8; + _PC_SYNC_IO = 9; + _PC_ASYNC_IO = 10; + _PC_PRIO_IO = 11; + _PC_SOCK_MAXBUF = 12; + _PC_FILESIZEBITS = 13; + _PC_REC_INCR_XFER_SIZE = 14; + _PC_REC_MAX_XFER_SIZE = 15; + _PC_REC_MIN_XFER_SIZE = 16; + _PC_REC_XFER_ALIGN = 17; + _PC_ALLOC_SIZE_MIN = 18; + _PC_SYMLINK_MAX = 19; + + Const + _SC_ARG_MAX = 0; + _SC_CHILD_MAX = 1; + _SC_CLK_TCK = 2; + _SC_NGROUPS_MAX = 3; + _SC_OPEN_MAX = 4; + _SC_STREAM_MAX = 5; + _SC_TZNAME_MAX = 6; + _SC_JOB_CONTROL = 7; + _SC_SAVED_IDS = 8; + _SC_REALTIME_SIGNALS = 9; + _SC_PRIORITY_SCHEDULING = 10; + _SC_TIMERS = 11; + _SC_ASYNCHRONOUS_IO = 12; + _SC_PRIORITIZED_IO = 13; + _SC_SYNCHRONIZED_IO = 14; + _SC_FSYNC = 15; + _SC_MAPPED_FILES = 16; + _SC_MEMLOCK = 17; + _SC_MEMLOCK_RANGE = 18; + _SC_MEMORY_PROTECTION = 19; + _SC_MESSAGE_PASSING = 20; + _SC_SEMAPHORES = 21; + _SC_SHARED_MEMORY_OBJECTS = 22; + _SC_AIO_LISTIO_MAX = 23; + _SC_AIO_MAX = 24; + _SC_AIO_PRIO_DELTA_MAX = 25; + _SC_DELAYTIMER_MAX = 26; + _SC_MQ_OPEN_MAX = 27; + _SC_MQ_PRIO_MAX = 28; + _SC_VERSION = 29; + _SC_PAGESIZE = 30; + _SC_RTSIG_MAX = 31; + _SC_SEM_NSEMS_MAX = 32; + _SC_SEM_VALUE_MAX = 33; + _SC_SIGQUEUE_MAX = 34; + _SC_TIMER_MAX = 35; + _SC_BC_BASE_MAX = 36; + _SC_BC_DIM_MAX = 37; + _SC_BC_SCALE_MAX = 38; + _SC_BC_STRING_MAX = 39; + _SC_COLL_WEIGHTS_MAX = 40; + _SC_EQUIV_CLASS_MAX = 41; + _SC_EXPR_NEST_MAX = 42; + _SC_LINE_MAX = 43; + _SC_RE_DUP_MAX = 44; + _SC_CHARCLASS_NAME_MAX = 45; + _SC_2_VERSION = 46; + _SC_2_C_BIND = 47; + _SC_2_C_DEV = 48; + _SC_2_FORT_DEV = 49; + _SC_2_FORT_RUN = 50; + _SC_2_SW_DEV = 51; + _SC_2_LOCALEDEF = 52; + _SC_PII = 53; + _SC_PII_XTI = 54; + _SC_PII_SOCKET = 55; + _SC_PII_INTERNET = 56; + _SC_PII_OSI = 57; + _SC_POLL = 58; + _SC_SELECT = 59; + _SC_UIO_MAXIOV = 60; + _SC_IOV_MAX = _SC_UIO_MAXIOV; + _SC_PII_INTERNET_STREAM = (_SC_UIO_MAXIOV)+1; + _SC_PII_INTERNET_DGRAM = (_SC_UIO_MAXIOV)+2; + _SC_PII_OSI_COTS = (_SC_UIO_MAXIOV)+3; + _SC_PII_OSI_CLTS = (_SC_UIO_MAXIOV)+4; + _SC_PII_OSI_M = (_SC_UIO_MAXIOV)+5; + _SC_T_IOV_MAX = (_SC_UIO_MAXIOV)+6; + _SC_THREADS = (_SC_UIO_MAXIOV)+7; + _SC_THREAD_SAFE_FUNCTIONS = (_SC_UIO_MAXIOV)+8; + _SC_GETGR_R_SIZE_MAX = (_SC_UIO_MAXIOV)+9; + _SC_GETPW_R_SIZE_MAX = (_SC_UIO_MAXIOV)+10; + _SC_LOGIN_NAME_MAX = (_SC_UIO_MAXIOV)+11; + _SC_TTY_NAME_MAX = (_SC_UIO_MAXIOV)+12; + _SC_THREAD_DESTRUCTOR_ITERATIONS = (_SC_UIO_MAXIOV)+13; + _SC_THREAD_KEYS_MAX = (_SC_UIO_MAXIOV)+14; + _SC_THREAD_STACK_MIN = (_SC_UIO_MAXIOV)+15; + _SC_THREAD_THREADS_MAX = (_SC_UIO_MAXIOV)+16; + _SC_THREAD_ATTR_STACKADDR = (_SC_UIO_MAXIOV)+17; + _SC_THREAD_ATTR_STACKSIZE = (_SC_UIO_MAXIOV)+18; + _SC_THREAD_PRIORITY_SCHEDULING = (_SC_UIO_MAXIOV)+19; + _SC_THREAD_PRIO_INHERIT = (_SC_UIO_MAXIOV)+20; + _SC_THREAD_PRIO_PROTECT = (_SC_UIO_MAXIOV)+21; + _SC_THREAD_PROCESS_SHARED = (_SC_UIO_MAXIOV)+22; + _SC_NPROCESSORS_CONF = (_SC_UIO_MAXIOV)+23; + _SC_NPROCESSORS_ONLN = (_SC_UIO_MAXIOV)+24; + _SC_PHYS_PAGES = (_SC_UIO_MAXIOV)+25; + _SC_AVPHYS_PAGES = (_SC_UIO_MAXIOV)+26; + _SC_ATEXIT_MAX = (_SC_UIO_MAXIOV)+27; + _SC_PASS_MAX = (_SC_UIO_MAXIOV)+28; + _SC_XOPEN_VERSION = (_SC_UIO_MAXIOV)+29; + _SC_XOPEN_XCU_VERSION = (_SC_UIO_MAXIOV)+30; + _SC_XOPEN_UNIX = (_SC_UIO_MAXIOV)+31; + _SC_XOPEN_CRYPT = (_SC_UIO_MAXIOV)+32; + _SC_XOPEN_ENH_I18N = (_SC_UIO_MAXIOV)+33; + _SC_XOPEN_SHM = (_SC_UIO_MAXIOV)+34; + _SC_2_CHAR_TERM = (_SC_UIO_MAXIOV)+35; + _SC_2_C_VERSION = (_SC_UIO_MAXIOV)+36; + _SC_2_UPE = (_SC_UIO_MAXIOV)+37; + _SC_XOPEN_XPG2 = (_SC_UIO_MAXIOV)+38; + _SC_XOPEN_XPG3 = (_SC_UIO_MAXIOV)+39; + _SC_XOPEN_XPG4 = (_SC_UIO_MAXIOV)+40; + _SC_CHAR_BIT = (_SC_UIO_MAXIOV)+41; + _SC_CHAR_MAX = (_SC_UIO_MAXIOV)+42; + _SC_CHAR_MIN = (_SC_UIO_MAXIOV)+43; + _SC_INT_MAX = (_SC_UIO_MAXIOV)+44; + _SC_INT_MIN = (_SC_UIO_MAXIOV)+45; + _SC_LONG_BIT = (_SC_UIO_MAXIOV)+46; + _SC_WORD_BIT = (_SC_UIO_MAXIOV)+47; + _SC_MB_LEN_MAX = (_SC_UIO_MAXIOV)+48; + _SC_NZERO = (_SC_UIO_MAXIOV)+49; + _SC_SSIZE_MAX = (_SC_UIO_MAXIOV)+50; + _SC_SCHAR_MAX = (_SC_UIO_MAXIOV)+51; + _SC_SCHAR_MIN = (_SC_UIO_MAXIOV)+52; + _SC_SHRT_MAX = (_SC_UIO_MAXIOV)+53; + _SC_SHRT_MIN = (_SC_UIO_MAXIOV)+54; + _SC_UCHAR_MAX = (_SC_UIO_MAXIOV)+55; + _SC_UINT_MAX = (_SC_UIO_MAXIOV)+56; + _SC_ULONG_MAX = (_SC_UIO_MAXIOV)+57; + _SC_USHRT_MAX = (_SC_UIO_MAXIOV)+58; + _SC_NL_ARGMAX = (_SC_UIO_MAXIOV)+59; + _SC_NL_LANGMAX = (_SC_UIO_MAXIOV)+60; + _SC_NL_MSGMAX = (_SC_UIO_MAXIOV)+61; + _SC_NL_NMAX = (_SC_UIO_MAXIOV)+62; + _SC_NL_SETMAX = (_SC_UIO_MAXIOV)+63; + _SC_NL_TEXTMAX = (_SC_UIO_MAXIOV)+64; + _SC_XBS5_ILP32_OFF32 = (_SC_UIO_MAXIOV)+65; + _SC_XBS5_ILP32_OFFBIG = (_SC_UIO_MAXIOV)+66; + _SC_XBS5_LP64_OFF64 = (_SC_UIO_MAXIOV)+67; + _SC_XBS5_LPBIG_OFFBIG = (_SC_UIO_MAXIOV)+68; + _SC_XOPEN_LEGACY = (_SC_UIO_MAXIOV)+69; + _SC_XOPEN_REALTIME = (_SC_UIO_MAXIOV)+70; + _SC_XOPEN_REALTIME_THREADS = (_SC_UIO_MAXIOV)+71; + _SC_ADVISORY_INFO = (_SC_UIO_MAXIOV)+72; + _SC_BARRIERS = (_SC_UIO_MAXIOV)+73; + _SC_BASE = (_SC_UIO_MAXIOV)+74; + _SC_C_LANG_SUPPORT = (_SC_UIO_MAXIOV)+75; + _SC_C_LANG_SUPPORT_R = (_SC_UIO_MAXIOV)+76; + _SC_CLOCK_SELECTION = (_SC_UIO_MAXIOV)+77; + _SC_CPUTIME = (_SC_UIO_MAXIOV)+78; + _SC_THREAD_CPUTIME = (_SC_UIO_MAXIOV)+79; + _SC_DEVICE_IO = (_SC_UIO_MAXIOV)+80; + _SC_DEVICE_SPECIFIC = (_SC_UIO_MAXIOV)+81; + _SC_DEVICE_SPECIFIC_R = (_SC_UIO_MAXIOV)+82; + _SC_FD_MGMT = (_SC_UIO_MAXIOV)+83; + _SC_FIFO = (_SC_UIO_MAXIOV)+84; + _SC_PIPE = (_SC_UIO_MAXIOV)+85; + _SC_FILE_ATTRIBUTES = (_SC_UIO_MAXIOV)+86; + _SC_FILE_LOCKING = (_SC_UIO_MAXIOV)+87; + _SC_FILE_SYSTEM = (_SC_UIO_MAXIOV)+88; + _SC_MONOTONIC_CLOCK = (_SC_UIO_MAXIOV)+89; + _SC_MULTI_PROCESS = (_SC_UIO_MAXIOV)+90; + _SC_SINGLE_PROCESS = (_SC_UIO_MAXIOV)+91; + _SC_NETWORKING = (_SC_UIO_MAXIOV)+92; + _SC_READER_WRITER_LOCKS = (_SC_UIO_MAXIOV)+93; + _SC_SPIN_LOCKS = (_SC_UIO_MAXIOV)+94; + _SC_REGEXP = (_SC_UIO_MAXIOV)+95; + _SC_REGEX_VERSION = (_SC_UIO_MAXIOV)+96; + _SC_SHELL = (_SC_UIO_MAXIOV)+97; + _SC_SIGNALS = (_SC_UIO_MAXIOV)+98; + _SC_SPAWN = (_SC_UIO_MAXIOV)+99; + _SC_SPORADIC_SERVER = (_SC_UIO_MAXIOV)+100; + _SC_THREAD_SPORADIC_SERVER = (_SC_UIO_MAXIOV)+101; + _SC_SYSTEM_DATABASE = (_SC_UIO_MAXIOV)+102; + _SC_SYSTEM_DATABASE_R = (_SC_UIO_MAXIOV)+103; + _SC_TIMEOUTS = (_SC_UIO_MAXIOV)+104; + _SC_TYPED_MEMORY_OBJECTS = (_SC_UIO_MAXIOV)+105; + _SC_USER_GROUPS = (_SC_UIO_MAXIOV)+106; + _SC_USER_GROUPS_R = (_SC_UIO_MAXIOV)+107; + _SC_2_PBS = (_SC_UIO_MAXIOV)+108; + _SC_2_PBS_ACCOUNTING = (_SC_UIO_MAXIOV)+109; + _SC_2_PBS_LOCATE = (_SC_UIO_MAXIOV)+110; + _SC_2_PBS_MESSAGE = (_SC_UIO_MAXIOV)+111; + _SC_2_PBS_TRACK = (_SC_UIO_MAXIOV)+112; + _SC_SYMLOOP_MAX = (_SC_UIO_MAXIOV)+113; + _SC_STREAMS = (_SC_UIO_MAXIOV)+114; + _SC_2_PBS_CHECKPOINT = (_SC_UIO_MAXIOV)+115; + _SC_V6_ILP32_OFF32 = (_SC_UIO_MAXIOV)+116; + _SC_V6_ILP32_OFFBIG = (_SC_UIO_MAXIOV)+117; + _SC_V6_LP64_OFF64 = (_SC_UIO_MAXIOV)+118; + _SC_V6_LPBIG_OFFBIG = (_SC_UIO_MAXIOV)+119; + _SC_HOST_NAME_MAX = (_SC_UIO_MAXIOV)+120; + _SC_TRACE = (_SC_UIO_MAXIOV)+121; + _SC_TRACE_EVENT_FILTER = (_SC_UIO_MAXIOV)+122; + _SC_TRACE_INHERIT = (_SC_UIO_MAXIOV)+123; + _SC_TRACE_LOG = (_SC_UIO_MAXIOV)+124; + + Const + _CS_PATH = 0; + _CS_LFS_CFLAGS = 1000; + _CS_LFS_LDFLAGS = 1001; + _CS_LFS_LIBS = 1002; + _CS_LFS_LINTFLAGS = 1003; + _CS_LFS64_CFLAGS = 1004; + _CS_LFS64_LDFLAGS = 1005; + _CS_LFS64_LIBS = 1006; + _CS_LFS64_LINTFLAGS = 1007; + _CS_XBS5_ILP32_OFF32_CFLAGS = 1100; + _CS_XBS5_ILP32_OFF32_LDFLAGS = 1101; + _CS_XBS5_ILP32_OFF32_LIBS = 1102; + _CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103; + _CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104; + _CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105; + _CS_XBS5_ILP32_OFFBIG_LIBS = 1106; + _CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107; + _CS_XBS5_LP64_OFF64_CFLAGS = 1108; + _CS_XBS5_LP64_OFF64_LDFLAGS = 1109; + _CS_XBS5_LP64_OFF64_LIBS = 1110; + _CS_XBS5_LP64_OFF64_LINTFLAGS = 1111; + _CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112; + _CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113; + _CS_XBS5_LPBIG_OFFBIG_LIBS = 1114; + _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115; + _CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116; + _CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117; + _CS_POSIX_V6_ILP32_OFF32_LIBS = 1118; + _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119; + _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120; + _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121; + _CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122; + _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123; + _CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124; + _CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125; + _CS_POSIX_V6_LP64_OFF64_LIBS = 1126; + _CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127; + _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128; + _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129; + _CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130; + _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131; + _CS_V6_WIDTH_RESTRICTED_ENVS = 1132; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bdirenth.inc b/jcl/source/fpc/libclite/bdirenth.inc new file mode 100644 index 0000000000..ac2f4fa447 --- /dev/null +++ b/jcl/source/fpc/libclite/bdirenth.inc @@ -0,0 +1,37 @@ + +type + Pdirent = ^dirent; + dirent = record + d_ino : __ino_t; + d_off : __off_t; + d_reclen : word; + d_type : byte; + d_name : array[0..255] of char; + end; + +type + Pdirent64 = ^dirent64; + dirent64 = record + d_ino : __ino64_t; + d_off : __off64_t; + d_reclen : word; + d_type : byte; + d_name : array[0..255] of char; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TDirEnt = dirent; + PPDirEnt = ^PDirEnt; + PPPDirEnt = ^PPDirEnt; + + TDirEnt64 = dirent64; + PPDirEnt64 = ^PDirEnt64; + PPPDirEnt64 = ^PPDirEnt64; + + + diff --git a/jcl/source/fpc/libclite/bdlfcnh.inc b/jcl/source/fpc/libclite/bdlfcnh.inc new file mode 100644 index 0000000000..7312e9d8e3 --- /dev/null +++ b/jcl/source/fpc/libclite/bdlfcnh.inc @@ -0,0 +1,17 @@ + +const + RTLD_LAZY = $00001; + RTLD_NOW = $00002; + RTLD_BINDING_MASK = $3; + RTLD_NOLOAD = $00004; + RTLD_GLOBAL = $00100; + RTLD_LOCAL = 0; + RTLD_NODELETE = $01000; + +procedure _dl_mcount_wrapper_check(__selfpc:pointer);cdecl;external clib name '_dl_mcount_wrapper_check'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bfcntlh.inc b/jcl/source/fpc/libclite/bfcntlh.inc new file mode 100644 index 0000000000..35dfe5f146 --- /dev/null +++ b/jcl/source/fpc/libclite/bfcntlh.inc @@ -0,0 +1,119 @@ + +const + O_ACCMODE = &00003; + O_RDONLY = &00000; + O_WRONLY = &00001; + O_RDWR = &00002; + O_CREAT = &00100; + O_EXCL = &00200; + O_NOCTTY = &00400; + O_TRUNC = &01000; + O_APPEND = &02000; + O_NONBLOCK = &04000; + O_NDELAY = O_NONBLOCK; + O_SYNC = &010000; + O_FSYNC = O_SYNC; + O_ASYNC = &020000; + + O_DIRECT = &0040000; + O_DIRECTORY = &0200000; + O_NOFOLLOW = &0400000; + + O_DSYNC = O_SYNC; + O_RSYNC = O_SYNC; + + O_LARGEFILE = &0100000; + + F_DUPFD = 0; + F_GETFD = 1; + F_SETFD = 2; + F_GETFL = 3; + F_SETFL = 4; + + F_GETLK = 5; + F_SETLK = 6; + F_SETLKW = 7; + + F_GETLK64 = 12; + F_SETLK64 = 13; + F_SETLKW64 = 14; + + F_SETOWN = 8; + F_GETOWN = 9; + + F_SETSIG = 10; + F_GETSIG = 11; + + F_SETLEASE = 1024; + F_GETLEASE = 1025; + F_NOTIFY = 1026; + + FD_CLOEXEC = 1; + F_RDLCK = 0; + F_WRLCK = 1; + F_UNLCK = 2; + F_EXLCK = 4; + F_SHLCK = 8; + + LOCK_SH = 1; + LOCK_EX = 2; + LOCK_NB = 4; + LOCK_UN = 8; + + LOCK_MAND = 32; + LOCK_READ = 64; + LOCK_WRITE = 128; + LOCK_RW = 192; + + DN_ACCESS = $00000001; + DN_MODIFY = $00000002; + DN_CREATE = $00000004; + DN_DELETE = $00000008; + DN_RENAME = $00000010; + DN_ATTRIB = $00000020; + DN_MULTISHOT = $80000000; + +type + Pflock = ^flock; + flock = record + l_type : smallint; + l_whence : smallint; + l_start : __off_t; + l_len : __off_t; + l_pid : __pid_t; + end; + + Pflock64 = ^flock64; + flock64 = record + l_type : smallint; + l_whence : smallint; + l_start : __off64_t; + l_len : __off64_t; + l_pid : __pid_t; + end; + +const + FAPPEND = O_APPEND; + FFSYNC = O_FSYNC; + FASYNC = O_ASYNC; + FNONBLOCK = O_NONBLOCK; + FNDELAY = O_NDELAY; + + POSIX_FADV_NORMAL = 0; + POSIX_FADV_RANDOM = 1; + POSIX_FADV_SEQUENTIAL = 2; + POSIX_FADV_WILLNEED = 3; + POSIX_FADV_DONTNEED = 4; + POSIX_FADV_NOREUSE = 5; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TFlock = flock; + + TFlock64 = Flock64; + + diff --git a/jcl/source/fpc/libclite/bfenvh.inc b/jcl/source/fpc/libclite/bfenvh.inc new file mode 100644 index 0000000000..b6e37d620e --- /dev/null +++ b/jcl/source/fpc/libclite/bfenvh.inc @@ -0,0 +1,55 @@ + +Const + FE_INVALID = $01; + __FE_DENORM = $02; + FE_DIVBYZERO = $04; + FE_OVERFLOW = $08; + FE_UNDERFLOW = $10; + FE_INEXACT = $20; + + FE_ALL_EXCEPT = (((FE_INEXACT or FE_DIVBYZERO) or FE_UNDERFLOW) or FE_OVERFLOW) or FE_INVALID; + + FE_TONEAREST = 0; + FE_DOWNWARD = $400; + FE_UPWARD = $800; + FE_TOWARDZERO = $c00; + +type + Pfexcept_t = ^fexcept_t; + fexcept_t = word; + + Pfenv_t = ^fenv_t; + fenv_t = record + __control_word : word; + __unused1 : word; + __status_word : word; + __unused2 : word; + __tags : word; + __unused3 : word; + __eip : dword; + __cs_selector : word; + flag0 : word; + __data_offset : dword; + __data_selector : word; + __unused5 : word; + end; +const + bm_fenv_t___opcode = $7FF; + bp_fenv_t___opcode = 0; + bm_fenv_t___unused4 = $F800; + bp_fenv_t___unused4 = 11; + +const + FE_DFL_ENV = Pfenv_t(-1); + FE_NOMASK_ENV = Pfenv_t(-2); + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TExceptionFlags = fexcept_t; + PExceptionFlags = ^TExceptionFlags; + + TFloatingPointEnv = fenv_t; + PFloatingPointEnv = ^TFloatingPointEnv; diff --git a/jcl/source/fpc/libclite/binh.inc b/jcl/source/fpc/libclite/binh.inc new file mode 100644 index 0000000000..97dcae4378 --- /dev/null +++ b/jcl/source/fpc/libclite/binh.inc @@ -0,0 +1,99 @@ + +const + IP_TOS = 1; + IP_TTL = 2; + IP_HDRINCL = 3; + IP_OPTIONS = 4; + IP_ROUTER_ALERT = 5; + IP_RECVOPTS = 6; + IP_RETOPTS = 7; + IP_PKTINFO = 8; + IP_PKTOPTIONS = 9; + IP_PMTUDISC = 10; + IP_MTU_DISCOVER = 10; + IP_RECVERR = 11; + IP_RECVTTL = 12; + IP_RECVTOS = 13; + IP_MULTICAST_IF = 32; + IP_MULTICAST_TTL = 33; + IP_MULTICAST_LOOP = 34; + IP_ADD_MEMBERSHIP = 35; + IP_DROP_MEMBERSHIP = 36; + IP_RECVRETOPTS = IP_RETOPTS; + IP_PMTUDISC_DONT = 0; + IP_PMTUDISC_WANT = 1; + IP_PMTUDISC_DO = 2; + SOL_IP = 0; + IP_DEFAULT_MULTICAST_TTL = 1; + IP_DEFAULT_MULTICAST_LOOP = 1; + IP_MAX_MEMBERSHIPS = 20; + +type + Pip_opts = ^ip_opts; + ip_opts = record + ip_dst : in_addr; + ip_opts : array[0..39] of char; + end; + + Pip_mreq = ^ip_mreq; + ip_mreq = record + imr_multiaddr : in_addr; + imr_interface : in_addr; + end; + + Pip_mreqn = ^ip_mreqn; + ip_mreqn = record + imr_multiaddr : in_addr; + imr_address : in_addr; + imr_ifindex : longint; + end; + + Pin_pktinfo = ^in_pktinfo; + in_pktinfo = record + ipi_ifindex : longint; + ipi_spec_dst : in_addr; + ipi_addr : in_addr; + end; + + +const + IPV6_ADDRFORM = 1; + IPV6_PKTINFO = 2; + IPV6_HOPOPTS = 3; + IPV6_DSTOPTS = 4; + IPV6_RTHDR = 5; + IPV6_PKTOPTIONS = 6; + IPV6_CHECKSUM = 7; + IPV6_HOPLIMIT = 8; + IPV6_NEXTHOP = 9; + IPV6_AUTHHDR = 10; + IPV6_UNICAST_HOPS = 16; + IPV6_MULTICAST_IF = 17; + IPV6_MULTICAST_HOPS = 18; + IPV6_MULTICAST_LOOP = 19; + IPV6_JOIN_GROUP = 20; + IPV6_LEAVE_GROUP = 21; + IPV6_ROUTER_ALERT = 22; + IPV6_MTU_DISCOVER = 23; + IPV6_MTU = 24; + IPV6_RECVERR = 25; +// SCM_SRCRT = IPV6_RXSRCRT; + IPV6_RXHOPOPTS = IPV6_HOPOPTS; + IPV6_RXDSTOPTS = IPV6_DSTOPTS; + IPV6_ADD_MEMBERSHIP = IPV6_JOIN_GROUP; + IPV6_DROP_MEMBERSHIP = IPV6_LEAVE_GROUP; + IPV6_PMTUDISC_DONT = 0; + IPV6_PMTUDISC_WANT = 1; + IPV6_PMTUDISC_DO = 2; + SOL_IPV6 = 41; + SOL_ICMPV6 = 58; + IPV6_RTHDR_LOOSE = 0; + IPV6_RTHDR_STRICT = 1; + IPV6_RTHDR_TYPE_0 = 0; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bipch.inc b/jcl/source/fpc/libclite/bipch.inc new file mode 100644 index 0000000000..60fd8aae57 --- /dev/null +++ b/jcl/source/fpc/libclite/bipch.inc @@ -0,0 +1,40 @@ + +const + IPC_CREAT = 01000; + IPC_EXCL = 02000; + IPC_NOWAIT = 04000; + IPC_RMID = 0; + IPC_SET = 1; + IPC_STAT = 2; + + IPC_INFO = 3; + + IPC_PRIVATE = __key_t(0); + +type + Pipc_perm = ^ipc_perm; + ipc_perm = record + __key : __key_t; + uid : __uid_t; + gid : __gid_t; + cuid : __uid_t; + cgid : __gid_t; + mode : word; + __pad1 : word; + __seq : word; + __pad2 : word; + __unused1 : dword; + __unused2 : dword; + end; + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TIpcPermission = ipc_perm; + PIpcPermission = ^TIpcPermission; + + diff --git a/jcl/source/fpc/libclite/bmmanh.inc b/jcl/source/fpc/libclite/bmmanh.inc new file mode 100644 index 0000000000..848d57d442 --- /dev/null +++ b/jcl/source/fpc/libclite/bmmanh.inc @@ -0,0 +1,50 @@ + +const + PROT_READ = $1; + PROT_WRITE = $2; + PROT_EXEC = $4; + PROT_NONE = $0; + MAP_SHARED = $01; + MAP_PRIVATE = $02; + + MAP_TYPE = $0f; + + MAP_FIXED = $10; + + MAP_FILE = 0; + MAP_ANONYMOUS = $20; + MAP_ANON = MAP_ANONYMOUS; + + MAP_GROWSDOWN = $0100; + MAP_DENYWRITE = $0800; + MAP_EXECUTABLE = $1000; + MAP_LOCKED = $2000; + MAP_NORESERVE = $4000; + + MS_ASYNC = 1; + MS_SYNC = 4; + MS_INVALIDATE = 2; + MCL_CURRENT = 1; + MCL_FUTURE = 2; + + MREMAP_MAYMOVE = 1; + + MADV_NORMAL = 0; + MADV_RANDOM = 1; + MADV_SEQUENTIAL = 2; + MADV_WILLNEED = 3; + MADV_DONTNEED = 4; + +const + POSIX_MADV_NORMAL = 0; + POSIX_MADV_RANDOM = 1; + POSIX_MADV_SEQUENTIAL = 2; + POSIX_MADV_WILLNEED = 3; + POSIX_MADV_DONTNEED = 4; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bmsqh.inc b/jcl/source/fpc/libclite/bmsqh.inc new file mode 100644 index 0000000000..cf76dd0d7a --- /dev/null +++ b/jcl/source/fpc/libclite/bmsqh.inc @@ -0,0 +1,54 @@ + +const + MSG_NOERROR = $1000; + MSG_EXCEPT = $2000; + +type + Pmsgqnum_t = ^msgqnum_t; + msgqnum_t = dword; + + Pmsglen_t = ^msglen_t; + msglen_t = dword; + Pmsqid_ds = ^msqid_ds; + msqid_ds = record + msg_perm : ipc_perm; + msg_stime : __time_t; + __unused1 : dword; + msg_rtime : __time_t; + __unused2 : dword; + msg_ctime : __time_t; + __unused3 : dword; + __msg_cbytes : dword; + msg_qnum : msgqnum_t; + msg_qbytes : msglen_t; + msg_lspid : __pid_t; + msg_lrpid : __pid_t; + __unused4 : dword; + __unused5 : dword; + end; + + +const + MSG_STAT = 11; + MSG_INFO = 12; + +type + Pmsginfo = ^msginfo; + msginfo = record + msgpool : longint; + msgmap : longint; + msgmax : longint; + msgmnb : longint; + msgmni : longint; + msgssz : longint; + msgtql : longint; + msgseg : word; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TMsgQueueIdDesc = msqid_ds; + PMsgQueueIdDesc = ^TMsgQueueIdDesc; diff --git a/jcl/source/fpc/libclite/bnetdbh.inc b/jcl/source/fpc/libclite/bnetdbh.inc new file mode 100644 index 0000000000..b445a89e81 --- /dev/null +++ b/jcl/source/fpc/libclite/bnetdbh.inc @@ -0,0 +1,18 @@ + +type + Pnetent = ^netent; + netent = record + n_name : Pchar; + n_aliases : ^Pchar; + n_addrtype : longint; + n_net : uint32_t; + end; + PPNetEnt = ^Pnetent; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TNetEnt = netent; diff --git a/jcl/source/fpc/libclite/bpollh.inc b/jcl/source/fpc/libclite/bpollh.inc new file mode 100644 index 0000000000..d673045456 --- /dev/null +++ b/jcl/source/fpc/libclite/bpollh.inc @@ -0,0 +1,23 @@ + +const + POLLIN = $001; + POLLPRI = $002; + POLLOUT = $004; + + POLLRDNORM = $040; + POLLRDBAND = $080; + POLLWRNORM = $100; + POLLWRBAND = $200; + + POLLMSG = $400; + + POLLERR = $008; + POLLHUP = $010; + POLLNVAL = $020; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bresourceh.inc b/jcl/source/fpc/libclite/bresourceh.inc new file mode 100644 index 0000000000..87dea4c530 --- /dev/null +++ b/jcl/source/fpc/libclite/bresourceh.inc @@ -0,0 +1,97 @@ + +type + __rlimit_resource = Longint; + +Const + RLIMIT_CPU = 0; + RLIMIT_FSIZE = 1; + RLIMIT_DATA = 2; + RLIMIT_STACK = 3; + RLIMIT_CORE = 4; + RLIMIT_RSS = 5; + RLIMIT_NOFILE = 7; + RLIMIT_OFILE = RLIMIT_NOFILE; + RLIMIT_AS = 9; + RLIMIT_NPROC = 6; + RLIMIT_MEMLOCK = 8; + RLIMIT_LOCKS = 10; + RLIMIT_NLIMITS = 11; + RLIM_NLIMITS = RLIMIT_NLIMITS; + + RLIM_INFINITY = LongInt(-1); + RLIM64_INFINITY = Int64(-1); + + RLIM_SAVED_MAX = RLIM_INFINITY; + RLIM_SAVED_CUR = RLIM_INFINITY; + +type + Prlim_t = ^rlim_t; + rlim_t = __rlim_t; + + Prlim64_t = ^rlim64_t; + rlim64_t = __rlim64_t; + + Prlimit = ^rlimit; + rlimit = record + rlim_cur : rlim_t; + rlim_max : rlim_t; + end; + + Prlimit64 = ^rlimit64; + rlimit64 = record + rlim_cur : rlim64_t; + rlim_max : rlim64_t; + end; + +type + __rusage_who = Longint; + +Const + RUSAGE_SELF = 0; + RUSAGE_CHILDREN = -(1); + RUSAGE_BOTH = -(2); + +type + Prusage = ^rusage; + rusage = record + ru_utime : timeval; + ru_stime : timeval; + ru_maxrss : longint; + ru_ixrss : longint; + ru_idrss : longint; + ru_isrss : longint; + ru_minflt : longint; + ru_majflt : longint; + ru_nswap : longint; + ru_inblock : longint; + ru_oublock : longint; + ru_msgsnd : longint; + ru_msgrcv : longint; + ru_nsignals : longint; + ru_nvcsw : longint; + ru_nivcsw : longint; + end; + + +const + PRIO_MIN = -(20); + PRIO_MAX = 20; + +type + __priority_which = Longint; + +Const + PRIO_PROCESS = 0; + PRIO_PGRP = 1; + PRIO_USER = 2; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TRLimit = rlimit; + TRLimit64 = rlimit64; + TRUsage = rusage; + diff --git a/jcl/source/fpc/libclite/bschedh.inc b/jcl/source/fpc/libclite/bschedh.inc new file mode 100644 index 0000000000..db21b43fb4 --- /dev/null +++ b/jcl/source/fpc/libclite/bschedh.inc @@ -0,0 +1,42 @@ + +const + SCHED_OTHER = 0; + SCHED_FIFO = 1; + SCHED_RR = 2; + +const + CSIGNAL = $000000ff; + CLONE_VM = $00000100; + CLONE_FS = $00000200; + CLONE_FILES = $00000400; + CLONE_SIGHAND = $00000800; + CLONE_PID = $00001000; + CLONE_PTRACE = $00002000; + CLONE_VFORK = $00004000; + +type + Psched_param = ^sched_param; + sched_param = record + __sched_priority : longint; + end; + + TCloneFunc = function(Arg: Pointer): Integer; cdecl; // For translation + + +function clone(__fn:tclonefunc; __child_stack:pointer; __flags:longint; __arg:pointer):longint;cdecl;external clib name 'clone'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + __sched_param = sched_param; + P__sched_param = ^__sched_param; + TSchedParam = __sched_param; + PSchedParam = ^TSchedParam; + + TCloneProc = TCloneFunc; + + + diff --git a/jcl/source/fpc/libclite/bselecth.inc b/jcl/source/fpc/libclite/bselecth.inc new file mode 100644 index 0000000000..467c4ee841 --- /dev/null +++ b/jcl/source/fpc/libclite/bselecth.inc @@ -0,0 +1,88 @@ + +{$ifndef _SYS_SELECT_H} +{$error "Never use directly; include instead."} +{$endif} +{$if defined __GNUC__ && __GNUC__ >= 2} +(* error +# define __FD_ZERO(fdsp) \ +in define line 26 *) +(* error + do { \ +in declaration at line 28 *) +(* error + int __d0, __d1; \ +(* error + __asm__ ____ ("cld; rep; stosl" \ +in declaration at line 34 *) +(* error + : "memory"); \ +(* error + } while (0) +in define line 37 *) +(* error + __asm__ ____ ("btsl %1,%0" \ +(* error + : "cc","memory") +(* error +# define __FD_CLR(fd, fdsp) \ +(* error + : "cc","memory") +(* error +# define __FD_ISSET(fd, fdsp) \ + in declarator_list *) + in declarator_list *) + in declarator_list *) + in declarator_list *) + in declarator_list *) +(* error + ({register char __result; \ +(* error + __asm__ ____ ("btl %1,%2 ; setcb %b0" \ +in declaration at line 54 *) +(* error + : "cc"); \ +(* error + __result; })) +in declaration at line 55 *) +(* error + __result; })) +{$else} +in define line 61 *) +(* error + do { \ +in declaration at line 63 *) +(* error + unsigned int __i; \ +(* error + fd_set *__arr = (set); \ +in declaration at line 64 *) +(* error + fd_set *__arr = (set); \ +(* error + for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ +in declaration at line 65 *) +(* error + for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ +in declaration at line 65 *) +(* error + for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \ +in declaration at line 66 *) +(* error + __FDS_BITS (__arr)[__i] = 0; \ +(* error + } while (0) +in define line 68 *) +(* error +# define __FD_CLR(d, set) (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d)) +in define line 69 *) +(* error +# define __FD_ISSET(d, set) (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d)) +in define line 70 *) +{$endif} + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bsemh.inc b/jcl/source/fpc/libclite/bsemh.inc new file mode 100644 index 0000000000..4cf935a470 --- /dev/null +++ b/jcl/source/fpc/libclite/bsemh.inc @@ -0,0 +1,55 @@ + +const + SEM_UNDO = $1000; + _GETPID = 11; // renamed, conflict with getpid call. + GETVAL = 12; + GETALL = 13; + GETNCNT = 14; + GETZCNT = 15; + SETVAL = 16; + SETALL = 17; + +type + Psemid_ds = ^semid_ds; + semid_ds = record + sem_perm : ipc_perm; + sem_otime : __time_t; + __unused1 : dword; + sem_ctime : __time_t; + __unused2 : dword; + sem_nsems : dword; + __unused3 : dword; + __unused4 : dword; + end; + + +const + SEM_STAT = 18; + SEM_INFO = 19; + +type + Pseminfo = ^seminfo; + seminfo = record + semmap : longint; + semmni : longint; + semmns : longint; + semmnu : longint; + semmsl : longint; + semopm : longint; + semume : longint; + semusz : longint; + semvmx : longint; + semaem : longint; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSemaphoreIdDescriptor = semid_ds; + PSemaphoreIdDescriptor = ^TSemaphoreIdDescriptor; + + TSemaphoreInfo = seminfo; + PSemaphoreInfo = ^TSemaphoreInfo; diff --git a/jcl/source/fpc/libclite/bshmh.inc b/jcl/source/fpc/libclite/bshmh.inc new file mode 100644 index 0000000000..c6dd934026 --- /dev/null +++ b/jcl/source/fpc/libclite/bshmh.inc @@ -0,0 +1,75 @@ + +const + SHM_R = 0400; + SHM_W = 0200; + SHM_RDONLY = 010000; + SHM_RND = 020000; + SHM_REMAP = 040000; + SHM_LOCK = 11; + SHM_UNLOCK = 12; + +type + Pshmatt_t = ^shmatt_t; + shmatt_t = dword; + + Pshmid_ds = ^shmid_ds; + shmid_ds = record + shm_perm : ipc_perm; + shm_segsz : size_t; + shm_atime : __time_t; + __unused1 : dword; + shm_dtime : __time_t; + __unused2 : dword; + shm_ctime : __time_t; + __unused3 : dword; + shm_cpid : __pid_t; + shm_lpid : __pid_t; + shm_nattch : shmatt_t; + __unused4 : dword; + __unused5 : dword; + end; + +const + SHM_STAT = 13; + SHM_INFO = 14; + SHM_DEST = 01000; + SHM_LOCKED = 02000; + +type + Pshminfo = ^shminfo; + shminfo = record + shmmax : dword; + shmmin : dword; + shmmni : dword; + shmseg : dword; + shmall : dword; + __unused1 : dword; + __unused2 : dword; + __unused3 : dword; + __unused4 : dword; + end; + + Pshm_info = ^_shm_info; + _shm_info = record + used_ids : longint; + shm_tot : dword; + shm_rss : dword; + shm_swp : dword; + swap_attempts : dword; + swap_successes : dword; + end; + P_shm_info = ^_shm_info; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSharedMemIdDescriptor = shmid_ds; + PSharedMemIdDescriptor = ^TSharedMemIdDescriptor; + + TSharedMemInfo = shminfo; + PSharedMemInfo = ^TSharedMemInfo; + + TTotalSharedMemInfo = _shm_info; + PTotalSharedMemInfo = ^TTotalSharedMemInfo; diff --git a/jcl/source/fpc/libclite/bsockaddrh.inc b/jcl/source/fpc/libclite/bsockaddrh.inc new file mode 100644 index 0000000000..a729e3c9a9 --- /dev/null +++ b/jcl/source/fpc/libclite/bsockaddrh.inc @@ -0,0 +1,13 @@ + +type + Psa_family_t = ^sa_family_t; + sa_family_t = word; + +Const + __SOCKADDR_COMMON_SIZE = sizeof(sa_family_t); + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bsocket.inc b/jcl/source/fpc/libclite/bsocket.inc new file mode 100644 index 0000000000..80a8d375f6 --- /dev/null +++ b/jcl/source/fpc/libclite/bsocket.inc @@ -0,0 +1,51 @@ + +function SA_LEN(const Buf): Cardinal; // Untyped buffer; this is *unsafe*. + +begin + Result:=__libc_sa_len(PSockAddr(@Buf)^.sa_family); +end; + + +function CMSG_DATA(cmsg: Pointer): PByte; + +begin + Result:=PByte(Cardinal(cmsg) + SizeOf(Pcmsghdr)); +end; + + +function CMSG_NXTHDR(mhdr: Pmsghdr; cmsg: Pcmsghdr): Pcmsghdr; + +begin + Result:=__cmsg_nxthdr(mhdr, cmsg); +end; + + +function CMSG_FIRSTHDR(mhdr: Pmsghdr): Pcmsghdr; + +begin + if mhdr^.msg_controllen >= SizeOf(cmsghdr) then + Result:=mhdr^.msg_control + else + Result:=nil; +end; + + +function CMSG_ALIGN(len: size_t): size_t; + +begin + Result:=(len+SizeOf(size_t)-1) and (not(SizeOf(size_t)-1)); +end; + + +function CMSG_SPACE(len: size_t): size_t; + +begin + Result:=CMSG_ALIGN(len)+CMSG_ALIGN(SizeOf(cmsghdr)); +end; + + +function CMSG_LEN(len: size_t): size_t; + +begin + Result:=CMSG_ALIGN(SizeOf(cmsghdr))+len; +end; diff --git a/jcl/source/fpc/libclite/bsocketh.inc b/jcl/source/fpc/libclite/bsocketh.inc new file mode 100644 index 0000000000..70fd3e071d --- /dev/null +++ b/jcl/source/fpc/libclite/bsocketh.inc @@ -0,0 +1,256 @@ + +type + SOCKLEN_T = __socklen_t; + PSOCKLEN_T = ^SOCKLEN_T; + +const + + INVALID_SOCKET = -1; + SOCKET_ERROR = -1; + INADDR_ANY = 0; + INADDR_BROADCAST = -1; + INADDR_NONE = $FFFFFFFF; + +Type + __socket_type = ( + SOCK_STREAM := 1, + SOCK_DGRAM := 2, + SOCK_RAW := 3, + SOCK_RDM := 4, + SOCK_SEQPACKET := 5, + SOCK_PACKET := 10 + ); + +Const + PF_UNSPEC = 0; + PF_LOCAL = 1; + PF_UNIX = PF_LOCAL; + PF_FILE = PF_LOCAL; + PF_INET = 2; + PF_AX25 = 3; + PF_IPX = 4; + PF_APPLETALK = 5; + PF_NETROM = 6; + PF_BRIDGE = 7; + PF_ATMPVC = 8; + PF_X25 = 9; + PF_INET6 = 10; + PF_ROSE = 11; + PF_DECnet = 12; + PF_NETBEUI = 13; + PF_SECURITY = 14; + PF_KEY = 15; + PF_NETLINK = 16; + PF_ROUTE = PF_NETLINK; + PF_PACKET = 17; + PF_ASH = 18; + PF_ECONET = 19; + PF_ATMSVC = 20; + PF_SNA = 22; + PF_IRDA = 23; + PF_PPPOX = 24; + PF_WANPIPE = 25; + PF_BLUETOOTH = 31; + PF_MAX = 32; + AF_UNSPEC = PF_UNSPEC; + AF_LOCAL = PF_LOCAL; + AF_UNIX = PF_UNIX; + AF_FILE = PF_FILE; + AF_INET = PF_INET; + AF_AX25 = PF_AX25; + AF_IPX = PF_IPX; + AF_APPLETALK = PF_APPLETALK; + AF_NETROM = PF_NETROM; + AF_BRIDGE = PF_BRIDGE; + AF_ATMPVC = PF_ATMPVC; + AF_X25 = PF_X25; + AF_INET6 = PF_INET6; + AF_ROSE = PF_ROSE; + AF_DECnet = PF_DECnet; + AF_NETBEUI = PF_NETBEUI; + AF_SECURITY = PF_SECURITY; + AF_KEY = PF_KEY; + AF_NETLINK = PF_NETLINK; + AF_ROUTE = PF_ROUTE; + AF_PACKET = PF_PACKET; + AF_ASH = PF_ASH; + AF_ECONET = PF_ECONET; + AF_ATMSVC = PF_ATMSVC; + AF_SNA = PF_SNA; + AF_IRDA = PF_IRDA; + AF_PPPOX = PF_PPPOX; + AF_WANPIPE = PF_WANPIPE; + AF_BLUETOOTH = PF_BLUETOOTH; + AF_MAX = PF_MAX; + SOL_RAW = 255; + SOL_DECNET = 261; + SOL_X25 = 262; + SOL_PACKET = 263; + SOL_ATM = 264; + SOL_AAL = 265; + SOL_IRDA = 266; + SOMAXCONN = 128; + + +Type + __ss_aligntype = __uint32_t; + +const + _SS_SIZE = 128; + _SS_PADSIZE = _SS_SIZE - (2 * SizeOf(__ss_aligntype)); + +type + { // replaced by structure down below. + // Why borland decided to change it is a mystery to me :/ + sockaddr = record + sa_family : sa_family_t ; + sa_data : array [0..13] of char; + end; + } + // redefined as osockaddr. + osockaddr = record + sa_family : sa_family_t ; + sa_data : array [0..13] of char; + end; + + Psockaddr_storage = ^sockaddr_storage; + sockaddr_storage = record + __ss__family : sa_family_t; + __ss_align : __ss_aligntype; + __ss_padding : array[0..(_SS_PADSIZE)-1] of char; + end; + + +Const + MSG_OOB = $01; + MSG_PEEK = $02; + MSG_DONTROUTE = $04; + MSG_TRYHARD = MSG_DONTROUTE; + MSG_CTRUNC = $08; + MSG_PROXY = $10; + MSG_TRUNC = $20; + MSG_DONTWAIT = $40; + MSG_EOR = $80; + MSG_WAITALL = $100; + MSG_FIN = $200; + MSG_SYN = $400; + MSG_CONFIRM = $800; + MSG_RST = $1000; + MSG_ERRQUEUE = $2000; + MSG_NOSIGNAL = $4000; + MSG_MORE = $8000; + +type + Pmsghdr = ^msghdr; + msghdr = record + msg_name : pointer; + msg_namelen : socklen_t; + msg_iov : Piovec; + msg_iovlen : longint; + msg_control : pointer; + msg_controllen : socklen_t; + msg_flags : longint; + end; + + Pcmsghdr = ^cmsghdr; + cmsghdr = record + cmsg_len : size_t; + cmsg_level : longint; + cmsg_type : longint; + end; + +function CMSG_DATA(cmsg : pointer) : Pbyte; +function CMSG_NXTHDR(mhdr: Pmsghdr; cmsg: Pcmsghdr): Pcmsghdr; +function CMSG_FIRSTHDR(mhdr: Pmsghdr): Pcmsghdr; +function CMSG_ALIGN(len: size_t): size_t; +function CMSG_SPACE(len: size_t): size_t; +function CMSG_LEN(len: size_t): size_t; + + +function __cmsg_nxthdr(__mhdr:Pmsghdr; __cmsg:Pcmsghdr):Pcmsghdr;cdecl;external clib name '__cmsg_nxthdr'; + +const + SCM_RIGHTS = $01; + SCM_CREDENTIALS = $02; + SCM_CONNECT = $03; + + + +type + Pucred = ^ucred; + ucred = record + pid : pid_t; + uid : uid_t; + gid : gid_t; + end; + + Plinger = ^linger; + linger = record + l_onoff : longint; + l_linger : longint; + end; + + + + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +type + SunB = record + s_b1, + s_b2, + s_b3, + s_b4: u_char; + end; + + SunW = record + s_w1, + s_w2: u_short; + end; + + in_addr = record + case Integer of + 0: (S_un_b: SunB); + 1: (S_un_w: SunW); + 2: (S_addr: u_long); + end; + TInAddr = in_addr; + PInAddr = ^TInAddr; + + sockaddr = {packed} record + case Integer of + 0: (sa_family: sa_family_t; + sa_data: packed array[0..13] of Byte); + 1: (sin_family: sa_family_t; + sin_port: u_short; + sin_addr: TInAddr; + sin_zero: packed array[0..7] of Byte); + end; + TSockAddr = sockaddr; + PSockAddr = ^TSockAddr; + + TMessageHeader = msghdr; + PMessageHeader = ^TMessageHeader; + + TCMessageHeader = cmsghdr; + PCMessageHeader = ^TCMessageHeader; + + sockaddr_in = sockaddr; + Psockaddr_in = ^sockaddr; + TSockAddrIn = sockaddr_in; + PSockAddrIn = ^TSockAddrIn; + + TSocket = longint; + +function SA_LEN(const buf): Cardinal; // Untyped buffer; this is *unsafe*. +function __libc_sa_len(__af: sa_family_t): Integer; cdecl;external clib name '__libc_sa_len'; + +{ Borland compatibility } + +Type + PSocketLength = ^socklen_t; + \ No newline at end of file diff --git a/jcl/source/fpc/libclite/bstatfsh.inc b/jcl/source/fpc/libclite/bstatfsh.inc new file mode 100644 index 0000000000..fde6ef302c --- /dev/null +++ b/jcl/source/fpc/libclite/bstatfsh.inc @@ -0,0 +1,41 @@ + +type + Pstatfs = ^_statfs; + _statfs = record + f_type : longint; + f_bsize : longint; + f_blocks : __fsblkcnt_t; + f_bfree : __fsblkcnt_t; + f_bavail : __fsblkcnt_t; + f_files : __fsfilcnt_t; + f_ffree : __fsfilcnt_t; + f_fsid : __fsid_t; + f_namelen : longint; + f_spare : array[0..5] of longint; + end; + P_statfs = ^_statfs; + + Pstatfs64 = ^_statfs64; + _statfs64 = record + f_type : longint; + f_bsize : longint; + f_blocks : __fsblkcnt64_t; + f_bfree : __fsblkcnt64_t; + f_bavail : __fsblkcnt64_t; + f_files : __fsfilcnt64_t; + f_ffree : __fsfilcnt64_t; + f_fsid : __fsid_t; + f_namelen : longint; + f_spare : array[0..5] of longint; + end; + P_statfs64 = ^_statfs64; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TStatFs = _statfs; + TStatFs64 = _statfs64; + + diff --git a/jcl/source/fpc/libclite/bstath.inc b/jcl/source/fpc/libclite/bstath.inc new file mode 100644 index 0000000000..c650df3b74 --- /dev/null +++ b/jcl/source/fpc/libclite/bstath.inc @@ -0,0 +1,93 @@ + +const + _STAT_VER_LINUX_OLD = 1; + _STAT_VER_KERNEL = 1; + _STAT_VER_SVR4 = 2; + _STAT_VER_LINUX = 3; + _STAT_VER = _STAT_VER_LINUX; + + _MKNOD_VER_LINUX = 1; + _MKNOD_VER_SVR4 = 2; + _MKNOD_VER = _MKNOD_VER_LINUX; + +type + P_stat = ^_stat; + PStat = ^_stat; + _stat = packed record + st_dev : __dev_t; + __pad1 : word; + __align_pad1 : word; + st_ino : __ino_t; + st_mode : __mode_t; + st_nlink : __nlink_t; + st_uid : __uid_t; + st_gid : __gid_t; + st_rdev : __dev_t; + __pad2 : word; + __align_pad2 : word; + st_size : __off_t; + st_blksize : __blksize_t; + st_blocks : __blkcnt_t; + st_atime : __time_t; + __unused1 : dword; + st_mtime : __time_t; + __unused2 : dword; + st_ctime : __time_t; + __unused3 : dword; + __unused4 : dword; + __unused5 : dword; + end; + + P_stat64 = ^_stat64; + Pstat64 = ^_stat64; + _stat64 = record + st_dev : __dev_t; + __pad1 : dword; + __st_ino : __ino_t; + st_mode : __mode_t; + st_nlink : __nlink_t; + st_uid : __uid_t; + st_gid : __gid_t; + st_rdev : __dev_t; + __pad2 : dword; + st_size : __off64_t; + st_blksize : __blksize_t; + st_blocks : __blkcnt64_t; + st_atime : __time_t; + __unused1 : dword; + st_mtime : __time_t; + __unused2 : dword; + st_ctime : __time_t; + __unused3 : dword; + st_ino : __ino64_t; + end; + +const + __S_IFMT = $F000; + __S_IFDIR = $4000; + __S_IFCHR = $2000; + __S_IFBLK = $6000; + __S_IFREG = $8000; + __S_IFIFO = $1000; + __S_IFLNK = $A000; + __S_IFSOCK = $C000; + + __S_ISUID = $800; + __S_ISGID = $400; + __S_ISVTX = $200; + __S_IREAD = $100; + __S_IWRITE = $80; + __S_IEXEC = $40; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TStatBuf = _stat; + PStatBuf = ^TStatBuf; + + TStatBuf64 = _stat64; + PStatBuf64 = ^TStatBuf64; + + diff --git a/jcl/source/fpc/libclite/bstatvfsh.inc b/jcl/source/fpc/libclite/bstatvfsh.inc new file mode 100644 index 0000000000..d7d02639ad --- /dev/null +++ b/jcl/source/fpc/libclite/bstatvfsh.inc @@ -0,0 +1,61 @@ + +type + Pstatvfs = ^_statvfs; + _statvfs = record + f_bsize : dword; + f_frsize : dword; + f_blocks : __fsblkcnt_t; + f_bfree : __fsblkcnt_t; + f_bavail : __fsblkcnt_t; + f_files : __fsfilcnt_t; + f_ffree : __fsfilcnt_t; + f_favail : __fsfilcnt_t; + f_fsid : dword; + __f_unused : longint; + f_flag : dword; + f_namemax : dword; + __f_spare : array[0..5] of longint; + end; + P_statvfs = ^_statvfs; + + Pstatvfs64 = ^_statvfs64; + _statvfs64 = record + f_bsize : dword; + f_frsize : dword; + f_blocks : __fsblkcnt64_t; + f_bfree : __fsblkcnt64_t; + f_bavail : __fsblkcnt64_t; + f_files : __fsfilcnt64_t; + f_ffree : __fsfilcnt64_t; + f_favail : __fsfilcnt64_t; + f_fsid : dword; + __f_unused : longint; + f_flag : dword; + f_namemax : dword; + __f_spare : array[0..5] of longint; + end; + P_statvfs64 = ^_statvfs64; + +Const + ST_RDONLY = 1; + ST_NOSUID = 2; + ST_NODEV = 4; + ST_NOEXEC = 8; + ST_SYNCHRONOUS = 16; + ST_MANDLOCK = 64; + ST_WRITE = 128; + ST_APPEND = 256; + ST_IMMUTABLE = 512; + ST_NOATIME = 1024; + ST_NODIRATIME = 1025; + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TStatVFs = _statvfs; + TStatVFs64 = _statvfs64; + diff --git a/jcl/source/fpc/libclite/bstroptsh.inc b/jcl/source/fpc/libclite/bstroptsh.inc new file mode 100644 index 0000000000..47a8147066 --- /dev/null +++ b/jcl/source/fpc/libclite/bstroptsh.inc @@ -0,0 +1,140 @@ + +const + __SID = ord('S') shl 8; + I_NREAD = __SID or 1; + I_PUSH = __SID or 2; + I_POP = __SID or 3; + I_LOOK = __SID or 4; + I_FLUSH = __SID or 5; + I_SRDOPT = __SID or 6; + I_GRDOPT = __SID or 7; + I_STR = __SID or 8; + I_SETSIG = __SID or 9; + I_GETSIG = __SID or 10; + I_FIND = __SID or 11; + I_LINK = __SID or 12; + I_UNLINK = __SID or 13; + I_PEEK = __SID or 15; + I_FDINSERT = __SID or 16; + I_SENDFD = __SID or 17; + I_RECVFD = __SID or 14; + I_SWROPT = __SID or 19; + I_GWROPT = __SID or 20; + I_LIST = __SID or 21; + I_PLINK = __SID or 22; + I_PUNLINK = __SID or 23; + I_FLUSHBAND = __SID or 28; + I_CKBAND = __SID or 29; + I_GETBAND = __SID or 30; + I_ATMARK = __SID or 31; + I_SETCLTIME = __SID or 32; + I_GETCLTIME = __SID or 33; + I_CANPUT = __SID or 34; + FMNAMESZ = 8; + FLUSHR = $01; + FLUSHW = $02; + FLUSHRW = $03; + + FLUSHBAND = $04; + + S_INPUT = $0001; + S_HIPRI = $0002; + S_OUTPUT = $0004; + S_MSG = $0008; + S_ERROR = $0010; + S_HANGUP = $0020; + S_RDNORM = $0040; + S_WRNORM = S_OUTPUT; + S_RDBAND = $0080; + S_WRBAND = $0100; + S_BANDURG = $0200; + RS_HIPRI = $01; + RNORM = $0000; + RMSGD = $0001; + RMSGN = $0002; + RPROTDAT = $0004; + RPROTDIS = $0008; + RPROTNORM = $0010; + + RPROTMASK = $001C; + SNDZERO = $001; + SNDPIPE = $002; + + ANYMARK = $01; + LASTMARK = $02; + + MUXID_ALL = -(1); + + MSG_HIPRI = $01; + MSG_ANY = $02; + MSG_BAND = $04; + MORECTL = 1; + MOREDATA = 2; + +type + Pbandinfo = ^bandinfo; + bandinfo = record + bi_pri : byte; + bi_flag : longint; + end; + + Pstrbuf = ^strbuf; + strbuf = record + maxlen : longint; + len : longint; + buf : Pchar; + end; + + t_uscalar_t = __t_uscalar_t; // moved here from stropts.h + + Pstrpeek = ^strpeek; + strpeek = record + ctlbuf : strbuf; + databuf : strbuf; + flags : t_uscalar_t; + end; + + Pstrfdinsert = ^strfdinsert; + strfdinsert = record + ctlbuf : strbuf; + databuf : strbuf; + flags : t_uscalar_t; + fildes : longint; + offset : longint; + end; + + Pstrioctl = ^strioctl; + strioctl = record + ic_cmd : longint; + ic_timout : longint; + ic_len : longint; + ic_dp : Pchar; + end; + + Pstrrecvfd = ^strrecvfd; + strrecvfd = record + fd : longint; + uid : uid_t; + gid : gid_t; + __fill : array[0..7] of char; + end; + + Pstr_mlist = ^str_mlist; + str_mlist = record + l_name : array[0..(FMNAMESZ + 1)-1] of char; + end; + + Pstr_list = ^str_list; + str_list = record + sl_nmods : longint; + sl_modlist : Pstr_mlist; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + Tstrbuf = strbuf; + + diff --git a/jcl/source/fpc/libclite/btermiosh.inc b/jcl/source/fpc/libclite/btermiosh.inc new file mode 100644 index 0000000000..4a048efadf --- /dev/null +++ b/jcl/source/fpc/libclite/btermiosh.inc @@ -0,0 +1,193 @@ + +type + + Pcc_t = ^cc_t; + cc_t = char; + + Pspeed_t = ^speed_t; + speed_t = dword; + + Ptcflag_t = ^tcflag_t; + tcflag_t = dword; + +const + NCCS = 32; + +type + Ptermios = ^termios; + termios = record + c_iflag : tcflag_t; + c_oflag : tcflag_t; + c_cflag : tcflag_t; + c_lflag : tcflag_t; + c_line : cc_t; + c_cc : array[0..(NCCS)-1] of cc_t; + c_ispeed : speed_t; + c_ospeed : speed_t; + end; + + +const + VINTR = 0; + VQUIT = 1; + VERASE = 2; + VKILL = 3; + VEOF = 4; + VTIME = 5; + VMIN = 6; + VSWTC = 7; + VSTART = 8; + VSTOP = 9; + VSUSP = 10; + VEOL = 11; + VREPRINT = 12; + VDISCARD = 13; + VWERASE = 14; + VLNEXT = 15; + VEOL2 = 16; + + IGNBRK = $0000001; + BRKINT = $0000002; + IGNPAR = $0000004; + PARMRK = $0000008; + INPCK = $0000010; + ISTRIP = $0000020; + INLCR = $0000040; + IGNCR = $0000080; + ICRNL = $0000100; + IUCLC = $0000200; + IXON = $0000400; + IXANY = $0000800; + IXOFF = $0001000; + IMAXBEL = $0002000; + + OPOST = $0000001; + OLCUC = $0000002; + ONLCR = $0000004; + OCRNL = $0000008; + ONOCR = $0000010; + ONLRET = $0000020; + OFILL = $0000040; + OFDEL = $0000080; + + NLDLY = $0000040; + NL0 = $0000000; + NL1 = $0000100; + CRDLY = $0000600; + CR0 = $0000000; + CR1 = $0000200; + CR2 = $0000400; + CR3 = $0000600; + TABDLY = $0001800; + TAB0 = $0000000; + TAB1 = $0000800; + TAB2 = $0001000; + TAB3 = $0001800; + BSDLY = $0002000; + BS0 = $0000000; + BS1 = $0002000; + FFDLY = $0080000; + FF0 = $0000000; + FF1 = $0010000; + + VTDLY = $0004000; + VT0 = $0000000; + VT1 = $0004000; + + XTABS = $0001800; + + CBAUD = $000100F; + B0 = $0000000; + B50 = $0000001; + B75 = $0000002; + B110 = $0000003; + B134 = $0000004; + B150 = $0000005; + B200 = $0000006; + B300 = $0000007; + B600 = $0000008; + B1200 = $0000009; + B1800 = $000000A; + B2400 = $000000B; + B4800 = $000000C; + B9600 = $000000D; + B19200 = $000000E; + B38400 = $000000F; + + EXTA = B19200; + EXTB = B38400; + + CSIZE = $0000030; + CS5 = $0000000; + CS6 = $0000010; + CS7 = $0000010; + CS8 = $0000030; + CSTOPB = $0000040; + CREAD = $0000080; + PARENB = $0000100; + PARODD = $0000200; + HUPCL = $0000400; + CLOCAL = $0000800; + + CBAUDEX = $0001000; + + B57600 = $0001001; + B115200 = $0001002; + B230400 = $0001003; + B460800 = $0001004; + B500000 = $0001005; + B576000 = $0001006; + B921600 = $0001007; + B1000000 = $0001008; + B1152000 = $0001009; + B1500000 = $000100A; + B2000000 = $000100B; + B2500000 = $000100C; + B3000000 = $000100D; + B3500000 = $000100E; + B4000000 = $000100F; + + CIBAUD = $100F0000; + CRTSCTS = $80000000; + + ISIG = $0000001; + ICANON = $0000002; + + XCASE = $0000004; + + ECHO = $0000008; + ECHOE = $0000010; + ECHOK = $0000020; + ECHONL = $0000040; + NOFLSH = $0000080; + TOSTOP = $0000100; + + ECHOCTL = $0000200; + ECHOPRT = $0000400; + ECHOKE = $0000800; + FLUSHO = $0001000; + PENDIN = $0004000; + + IEXTEN = $0010000; + + + + TCOOFF = 0; + TCOON = 1; + TCIOFF = 2; + TCION = 3; + TCIFLUSH = 0; + TCOFLUSH = 1; + TCIOFLUSH = 2; + TCSANOW = 0; + TCSADRAIN = 1; + TCSAFLUSH = 2; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TTermIos = termios; + diff --git a/jcl/source/fpc/libclite/btimeh.inc b/jcl/source/fpc/libclite/btimeh.inc new file mode 100644 index 0000000000..fe030ad80f --- /dev/null +++ b/jcl/source/fpc/libclite/btimeh.inc @@ -0,0 +1,33 @@ + +const + CLOCKS_PER_SEC = 1000000; + +function __sysconf(_para1:longint):longint;cdecl;external clib name '__sysconf'; +function CLK_TCK : __clock_t; + +const + CLOCK_REALTIME = 0; + CLOCK_PROCESS_CPUTIME_ID = 2; + CLOCK_THREAD_CPUTIME_ID = 3; + TIMER_ABSTIME = 1; + +const + _STRUCT_TIMEVAL = 1; + +type + Ptimeval = ^timeval; + timeval = record + tv_sec : __time_t; + tv_usec : __suseconds_t; + end; + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TTimeVal = timeval; + + diff --git a/jcl/source/fpc/libclite/buioh.inc b/jcl/source/fpc/libclite/buioh.inc new file mode 100644 index 0000000000..cd5662433c --- /dev/null +++ b/jcl/source/fpc/libclite/buioh.inc @@ -0,0 +1,20 @@ + +const + UIO_MAXIOV = 1024; + +type + Piovec = ^iovec; + iovec = record + iov_base : pointer; + iov_len : size_t; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TIoVector = iovec; + PIoVector = ^TIoVector; + + diff --git a/jcl/source/fpc/libclite/bustath.inc b/jcl/source/fpc/libclite/bustath.inc new file mode 100644 index 0000000000..02787f6713 --- /dev/null +++ b/jcl/source/fpc/libclite/bustath.inc @@ -0,0 +1,19 @@ + +type + P_ustat = ^_ustat; + _ustat = record + f_tfree : __daddr_t; + f_tinode : __ino_t; + f_fname : array[0..5] of char; + f_fpack : array[0..5] of char; + end; + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TUStat = _ustat; + PUStat = ^TUStat; diff --git a/jcl/source/fpc/libclite/butmph.inc b/jcl/source/fpc/libclite/butmph.inc new file mode 100644 index 0000000000..07023ab606 --- /dev/null +++ b/jcl/source/fpc/libclite/butmph.inc @@ -0,0 +1,61 @@ + +const + UT_LINESIZE = 32; + UT_NAMESIZE = 32; + UT_HOSTSIZE = 256; + +type + Plastlog = ^lastlog; + lastlog = record + ll_time : __time_t; + ll_line : array[0..(UT_LINESIZE)-1] of char; + ll_host : array[0..(UT_HOSTSIZE)-1] of char; + end; + + Pexit_status = ^exit_status; + exit_status = record + e_termination : smallint; + e_exit : smallint; + end; + + Putmp = ^utmp; + utmp = record + ut_type : smallint; + ut_pid : pid_t; + ut_line : array[0..(UT_LINESIZE)-1] of char; + ut_id : array[0..3] of char; + ut_user : array[0..(UT_NAMESIZE)-1] of char; + ut_host : array[0..(UT_HOSTSIZE)-1] of char; + ut_exit : exit_status; + ut_session : longint; + ut_tv : timeval; + ut_addr_v6 : array[0..3] of int32_t; + __unused : array[0..19] of char; + end; + PPutmp = ^Putmp; + +const + EMPTY = 0; + RUN_LVL = 1; + BOOT_TIME = 2; + NEW_TIME = 3; + OLD_TIME = 4; + INIT_PROCESS = 5; + LOGIN_PROCESS = 6; + USER_PROCESS = 7; + DEAD_PROCESS = 8; + ACCOUNTING = 9; + UT_UNKNOWN = EMPTY; + _HAVE_UT_TYPE = 1; + _HAVE_UT_PID = 1; + _HAVE_UT_ID = 1; + _HAVE_UT_TV = 1; + _HAVE_UT_HOST = 1; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TUserTmp = utmp; + PUserTmp = ^TUserTmp; diff --git a/jcl/source/fpc/libclite/butmpxh.inc b/jcl/source/fpc/libclite/butmpxh.inc new file mode 100644 index 0000000000..21be2b226f --- /dev/null +++ b/jcl/source/fpc/libclite/butmpxh.inc @@ -0,0 +1,41 @@ + +const + _PATH_UTMPX = _PATH_UTMP; + _PATH_WTMPX = _PATH_WTMP; + +const + __UT_LINESIZE = 32; + __UT_NAMESIZE = 32; + __UT_HOSTSIZE = 256; + +type + P__exit_status = ^__exit_status; + __exit_status = record + e_termination : smallint; + e_exit : smallint; + end; + + Putmpx = ^utmpx; + utmpx = record + ut_type : smallint; + ut_pid : __pid_t; + ut_line : array[0..(__UT_LINESIZE)-1] of char; + ut_id : array[0..3] of char; + ut_user : array[0..(__UT_NAMESIZE)-1] of char; + ut_host : array[0..(__UT_HOSTSIZE)-1] of char; + ut_exit : __exit_status; + ut_session : longint; + ut_tv : timeval; + ut_addr_v6 : array[0..3] of __int32_t; + __unused : array[0..19] of char; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TUserTmpX = utmpx; + PUserTmpX = ^TUserTmpX; + + diff --git a/jcl/source/fpc/libclite/butsnameh.inc b/jcl/source/fpc/libclite/butsnameh.inc new file mode 100644 index 0000000000..b2a5b4fe64 --- /dev/null +++ b/jcl/source/fpc/libclite/butsnameh.inc @@ -0,0 +1,11 @@ + +const + _UTSNAME_LENGTH = 65; + _UTSNAME_DOMAIN_LENGTH = _UTSNAME_LENGTH; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bwaitflags.inc b/jcl/source/fpc/libclite/bwaitflags.inc new file mode 100644 index 0000000000..0e8d38e19a --- /dev/null +++ b/jcl/source/fpc/libclite/bwaitflags.inc @@ -0,0 +1,44 @@ +function WEXITSTATUS(Status: Integer): Integer; +begin + Result := (Status and $FF00) shr 8; +end; + +function WTERMSIG(Status: Integer): Integer; +begin + Result := (Status and $7F); +end; + +function WSTOPSIG(Status: Integer): Integer; +begin + Result := WEXITSTATUS(Status); +end; + +function WIFEXITED(Status: Integer): Boolean; +begin + Result := (WTERMSIG(Status) = 0); +end; + +function WIFSIGNALED(Status: Integer): Boolean; +begin + Result := (not WIFSTOPPED(Status)) and (not WIFEXITED(Status)); +end; + +function WIFSTOPPED(Status: Integer): Boolean; +begin + Result := ((Status and $FF) = $7F); +end; + +function WCOREDUMP(Status: Integer): Boolean; +begin + Result := ((Status and WCOREFLAG) <> 0); +end; + +function W_EXITCODE(ReturnCode, Signal: Integer): Integer; +begin + Result := (ReturnCode shl 8) or Signal; +end; + +function W_STOPCODE(Signal: Integer): Integer; +begin + Result := (Signal shl 8) or $7F; +end; diff --git a/jcl/source/fpc/libclite/bwaitflagsh.inc b/jcl/source/fpc/libclite/bwaitflagsh.inc new file mode 100644 index 0000000000..108f351847 --- /dev/null +++ b/jcl/source/fpc/libclite/bwaitflagsh.inc @@ -0,0 +1,13 @@ + +const + WNOHANG = 1; + WUNTRACED = 2; + __WALL = $40000000; + __WCLONE = $80000000; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/bwaitstatus.inc b/jcl/source/fpc/libclite/bwaitstatus.inc new file mode 100644 index 0000000000..6f0093369b --- /dev/null +++ b/jcl/source/fpc/libclite/bwaitstatus.inc @@ -0,0 +1,53 @@ + +Function WEXITSTATUS(Status: longint): longint; +begin + Result:=(Status and $FF00) shr 8; +end; + + +Function WTERMSIG(Status: longint): longint; +begin + Result:=(Status and $7F); +end; + + +Function WSTOPSIG(Status: longint): longint; +begin + Result:=WEXITSTATUS(Status); +end; + + +Function WIFEXITED(Status: longint): Boolean; +begin + Result:=(WTERMSIG(Status)=0); +end; + + +Function WIFSIGNALED(Status: longint): Boolean; +begin + Result:=(not WIFSTOPPED(Status)) and (not WIFEXITED(Status)); +end; + + +Function WIFSTOPPED(Status: longint): Boolean; +begin + Result:=((Status and $FF)=$7F); +end; + + +Function WCOREDUMP(Status: longint): Boolean; +begin + Result:=((Status and WCOREFLAG)<>0); +end; + + +Function W_EXITCODE(ReturnCode, Signal: longint): longint; +begin + Result:=(ReturnCode shl 8) or Signal; +end; + + +Function W_STOPCODE(Signal: longint): longint; +begin + Result:=(Signal shl 8) or $7F; +end; diff --git a/jcl/source/fpc/libclite/bwaitstatush.inc b/jcl/source/fpc/libclite/bwaitstatush.inc new file mode 100644 index 0000000000..b649470db0 --- /dev/null +++ b/jcl/source/fpc/libclite/bwaitstatush.inc @@ -0,0 +1,19 @@ + +function WEXITSTATUS(Status: longint): longint; +function WTERMSIG(Status: longint): longint; +function WSTOPSIG(Status: longint): longint; +function WIFEXITED(Status: longint): Boolean; +function WIFSIGNALED(Status: longint): Boolean; +function WIFSTOPPED(Status: longint): Boolean; +function WCOREDUMP(Status: longint): Boolean; +function W_EXITCODE(ReturnCode, Signal: longint): longint; +function W_STOPCODE(Signal: longint): longint; + +const + WCOREFLAG = $80; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/cerrno.inc b/jcl/source/fpc/libclite/cerrno.inc new file mode 100644 index 0000000000..1a99ddf474 --- /dev/null +++ b/jcl/source/fpc/libclite/cerrno.inc @@ -0,0 +1,16 @@ + +{ Translation of macro } + +{$ifndef LIBC_OLDERRNO} +function errno : error_t; + +begin + Result:=__errno_location()^; +end; + +procedure seterrno (value : error_t); + +begin + __errno_location()^:=Value; +end; +{$endif} diff --git a/jcl/source/fpc/libclite/crypth.inc b/jcl/source/fpc/libclite/crypth.inc new file mode 100644 index 0000000000..940bc03f9d --- /dev/null +++ b/jcl/source/fpc/libclite/crypth.inc @@ -0,0 +1,35 @@ + + +{ defined earlier in unistdh.inc... +function crypt(__key:Pchar; __salt:Pchar):Pchar;cdecl;external cryptlib name 'crypt'; +procedure setkey(__key:Pchar);cdecl;external cryptlib name 'setkey'; +procedure encrypt(__block:Pchar; __edflag:longint);cdecl;external cryptlib name 'encrypt'; +} +type + Pcrypt_data = ^crypt_data; + crypt_data = record + keysched : array[0..(16 * 8)-1] of char; + sb0 : array[0..32767] of char; + sb1 : array[0..32767] of char; + sb2 : array[0..32767] of char; + sb3 : array[0..32767] of char; + crypt_3_buf : array[0..13] of char; + current_salt : array[0..1] of char; + current_saltbits : longint; + direction : longint; + initialized : longint; + end; + +function crypt_r(__key:Pchar; __salt:Pchar; __data:Pcrypt_data):Pchar;cdecl;external cryptlib name 'crypt_r'; +procedure setkey_r(__key:Pchar; __data:Pcrypt_data);cdecl;external cryptlib name 'setkey_r'; +procedure encrypt_r(__block:Pchar; __edflag:longint; __data:Pcrypt_data);cdecl;external cryptlib name 'encrypt_r'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TCryptData = crypt_data; + PCryptData = ^TCryptData; + + diff --git a/jcl/source/fpc/libclite/ctypeh.inc b/jcl/source/fpc/libclite/ctypeh.inc new file mode 100644 index 0000000000..78142e046c --- /dev/null +++ b/jcl/source/fpc/libclite/ctypeh.inc @@ -0,0 +1,26 @@ + +function isalnum(_para1:longint):longint;cdecl;external clib name 'isalnum'; +function isalpha(_para1:longint):longint;cdecl;external clib name 'isalpha'; +function iscntrl(_para1:longint):longint;cdecl;external clib name 'iscntrl'; +function isdigit(_para1:longint):longint;cdecl;external clib name 'isdigit'; +function islower(_para1:longint):longint;cdecl;external clib name 'islower'; +function isgraph(_para1:longint):longint;cdecl;external clib name 'isgraph'; +function isprint(_para1:longint):longint;cdecl;external clib name 'isprint'; +function ispunct(_para1:longint):longint;cdecl;external clib name 'ispunct'; +function isspace(_para1:longint):longint;cdecl;external clib name 'isspace'; +function isupper(_para1:longint):longint;cdecl;external clib name 'isupper'; +function isxdigit(_para1:longint):longint;cdecl;external clib name 'isxdigit'; +function isblank(_para1: longint):longint; cdecl;external clib name 'isblank'; +function tolower(__c:longint):longint;cdecl;external clib name 'tolower'; +function toupper(__c:longint):longint;cdecl;external clib name 'toupper'; +function isascii(__c:longint):longint;cdecl;external clib name 'isascii'; +function toascii(__c:longint):longint;cdecl;external clib name 'toascii'; +function _toupper(_para1:longint):longint;cdecl;external clib name '_toupper'; +function _tolower(_para1:longint):longint;cdecl;external clib name '_tolower'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/dirent.inc b/jcl/source/fpc/libclite/dirent.inc new file mode 100644 index 0000000000..0c43249965 --- /dev/null +++ b/jcl/source/fpc/libclite/dirent.inc @@ -0,0 +1,14 @@ +{ --------------------------------------------------------------------- + Macros from dirent.h + ---------------------------------------------------------------------} + +function IFTODT(mode : __mode_t) : longint; +begin + IFTODT:=(mode and $F000) shr 12; +end; + +function DTTOIF(dirtype : longint) : __mode_t; +begin + DTTOIF:=dirtype shl 12; +end; + diff --git a/jcl/source/fpc/libclite/direnth.inc b/jcl/source/fpc/libclite/direnth.inc new file mode 100644 index 0000000000..2578401080 --- /dev/null +++ b/jcl/source/fpc/libclite/direnth.inc @@ -0,0 +1,74 @@ + + +Const + DT_UNKNOWN = 0; + DT_FIFO = 1; + DT_CHR = 2; + DT_DIR = 4; + DT_BLK = 6; + DT_REG = 8; + DT_LNK = 10; + DT_SOCK = 12; + DT_WHT = 14; + +function IFTODT(mode : __mode_t) : longint; +function DTTOIF(dirtype : longint) : __mode_t; + +type + DIR = record end; + __dirstream = DIR; + PDIR = ^DIR; + +function opendir(__name:Pchar):PDIR;cdecl;external clib name 'opendir'; +function closedir(__dirp:PDIR):longint;cdecl;external clib name 'closedir'; + +function readdir(__dirp:PDIR):Pdirent;cdecl;external clib name 'readdir'; +function readdir64(__dirp:PDIR):Pdirent64;cdecl;external clib name 'readdir64'; + +function readdir_r(__dirp:PDIR; __entry:Pdirent; __result:PPdirent):longint;cdecl;external clib name 'readdir_r'; +function readdir64_r(__dirp:PDIR; __entry:Pdirent64; __result:PPdirent64):longint;cdecl;external clib name 'readdir64_r'; + +procedure rewinddir(__dirp:PDIR);cdecl;external clib name 'rewinddir'; +procedure seekdir(__dirp:PDIR; __pos:longint);cdecl;external clib name 'seekdir'; +function telldir(__dirp:PDIR):longint;cdecl;external clib name 'telldir'; + +function dirfd(__dirp:PDIR):longint;cdecl;external clib name 'dirfd'; + +const + MAXNAMLEN = 255; + +Type + TSelectorFunc = function(const p1: PDirEnt): Integer; cdecl; + TSelectorFunc64 = function(const p1: PDirEnt64): Integer; cdecl; + TCompareFunc = function(const p1, p2: Pointer): Integer; cdecl; + +function scandir(__dir:Pchar; __namelist:PPPdirent; __selector:TSelectorfunc; __cmp:TComparefunc):longint;cdecl;external clib name 'scandir'; +function scandir64(__dir:Pchar; __namelist:PPPdirent64; __selector:TSelectorFunc64; __cmp:TCompareFunc):longint;cdecl;external clib name 'scandir64'; + +function getdirentries(__fd:longint; __buf:Pchar; __nbytes:size_t; __basep:P__off_t):__ssize_t;cdecl;external clib name 'getdirentries'; +function getdirentries64(__fd:longint; __buf:Pchar; __nbytes:size_t; __basep:P__off64_t):__ssize_t;cdecl;external clib name 'getdirentries64'; + +function alphasort(const e1: Pointer; const e2: Pointer): Integer; cdecl; external clib name 'alphasort'; +function alphasort64(const e1: Pointer; const e2: Pointer): Integer; cdecl; external clib name 'alphasort64'; +function versionsort(const e1: Pointer; const e2: Pointer): Integer; cdecl; external clib name 'versionsort'; +function versionsort64(const e1: Pointer; const e2: Pointer): Integer; cdecl; external clib name 'versionsort64'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TDirectoryStream = DIR; + PDirectoryStream = ^TDirectoryStream; + + TSelectorProc = TSelectorFunc; + TSelectorProc64 = TSelectorFunc64; + TCompareProc = TCompareFunc; + +function scandir(__dir:Pchar; var __namelist:PPdirent; __selector:TSelectorfunc; __cmp:TComparefunc):longint;cdecl;external clib name 'scandir'; +function scandir64(__dir:Pchar; var __namelist:PPdirent64; __selector:TSelectorFunc64; __cmp:TCompareFunc):longint;cdecl;external clib name 'scandir64'; + +function getdirentries(__fd:longint; __buf:Pchar; __nbytes:size_t; var __basep:__off_t):__ssize_t;cdecl;external clib name 'getdirentries'; +function getdirentries64(__fd:longint; __buf:Pchar; __nbytes:size_t; var __basep: __off64_t):__ssize_t;cdecl;external clib name 'getdirentries64'; + diff --git a/jcl/source/fpc/libclite/dlfcnh.inc b/jcl/source/fpc/libclite/dlfcnh.inc new file mode 100644 index 0000000000..053c5607b8 --- /dev/null +++ b/jcl/source/fpc/libclite/dlfcnh.inc @@ -0,0 +1,33 @@ + +Const + RTLD_NEXT = Pointer(-1); + RTLD_DEFAULT = nil; + +function dlopen(__file:Pchar; __mode:longint):pointer;cdecl;external dllib name 'dlopen'; +function dlclose(__handle:pointer):longint;cdecl;external dllib name 'dlclose'; +function dlsym(__handle:pointer; __name:Pchar):pointer;cdecl;external dllib name 'dlsym'; +function dlvsym(__handle:pointer; __name:Pchar; __version:Pchar):pointer;cdecl;external dllib name 'dlvsym'; +function dlerror:Pchar;cdecl;external clib name 'dlerror'; + +type + + PDl_info = ^Dl_info; + Dl_info = record + dli_fname : Pchar; + dli_fbase : pointer; + dli_sname : Pchar; + dli_saddr : pointer; + end; + +function dladdr(__address:pointer; __info:PDl_info):longint;cdecl;external dllib name 'dladdr'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TDLInfo = Dl_info; + PDLInfo = ^TDLInfo; + +function dladdr(__address:pointer; var __info: Dl_info):longint;cdecl;external dllib name 'dladdr'; + diff --git a/jcl/source/fpc/libclite/endianh.inc b/jcl/source/fpc/libclite/endianh.inc new file mode 100644 index 0000000000..e0e614a9df --- /dev/null +++ b/jcl/source/fpc/libclite/endianh.inc @@ -0,0 +1,20 @@ +{ --------------------------------------------------------------------- + 'h2pas -S -c -D -l libc -i' from endian.h and bits/endian.h + ---------------------------------------------------------------------} + +const + External_library='libc'; {Setup as you need} + +{$PACKRECORDS C} + +const + __LITTLE_ENDIAN = 1234; + __BIG_ENDIAN = 4321; + __PDP_ENDIAN = 3412; + __BYTE_ORDER = __LITTLE_ENDIAN; + __FLOAT_WORD_ORDER = __BYTE_ORDER; + + LITTLE_ENDIAN = __LITTLE_ENDIAN; + BIG_ENDIAN = __BIG_ENDIAN; + PDP_ENDIAN = __PDP_ENDIAN; + BYTE_ORDER = __BYTE_ORDER; diff --git a/jcl/source/fpc/libclite/envzh.inc b/jcl/source/fpc/libclite/envzh.inc new file mode 100644 index 0000000000..a620b2240f --- /dev/null +++ b/jcl/source/fpc/libclite/envzh.inc @@ -0,0 +1,17 @@ + +function envz_entry(__envz:Pchar; __envz_len:size_t; __name:Pchar):Pchar;cdecl;external clib name 'envz_entry'; +function envz_get(__envz:Pchar; __envz_len:size_t; __name:Pchar):Pchar;cdecl;external clib name 'envz_get'; +function envz_add(__envz:PPchar; __envz_len:Psize_t; __name:Pchar; __value:Pchar):error_t;cdecl;external clib name 'envz_add'; +function envz_merge(__envz:PPchar; __envz_len:Psize_t; __envz2:Pchar; __envz2_len:size_t; __override:longint):error_t;cdecl;external clib name 'envz_merge'; +procedure envz_remove(__envz:PPchar; __envz_len:Psize_t; __name:Pchar);cdecl;external clib name 'envz_remove'; +procedure envz_strip(__envz:PPchar; __envz_len:Psize_t);cdecl;external clib name 'envz_strip'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function envz_add(var __envz:Pchar; var __envz_len: size_t; __name:Pchar; __value:Pchar):error_t;cdecl;external clib name 'envz_add'; +function envz_merge(var __envz: Pchar; var __envz_len: size_t; __envz2:Pchar; __envz2_len:size_t; __override:longint):error_t;cdecl;external clib name 'envz_merge'; +procedure envz_remove(var __envz:Pchar; var __envz_len: size_t; __name:Pchar);cdecl;external clib name 'envz_remove'; +procedure envz_strip(var __envz:Pchar; var __envz_len: size_t);cdecl;external clib name 'envz_strip'; diff --git a/jcl/source/fpc/libclite/errh.inc b/jcl/source/fpc/libclite/errh.inc new file mode 100644 index 0000000000..fb4dbef0b5 --- /dev/null +++ b/jcl/source/fpc/libclite/errh.inc @@ -0,0 +1,15 @@ + +procedure warn(__format: Pchar; args: array of const); cdecl; external clib name 'warn'; +procedure vwarn(__format: Pchar; arg: Pointer); cdecl;external clib name 'vwarn'; +procedure warnx(__format: Pchar; args: array of const); cdecl; external clib name 'warnx'; +procedure vwarnx(__format: Pchar; arg: pointer); cdecl; external clib name 'vwarnx'; +procedure err(__status: Integer; __format: Pchar; args : array of const); cdecl; external clib name 'err'; +procedure verr(__status: Integer; __format: Pchar; Arg: Pointer); cdecl; external clib name 'verr'; +procedure errx(__status: Integer; __format: Pchar); cdecl; external clib name 'errx'; +procedure verrx(__status: Integer; __format: Pchar; Arg: Pointer); cdecl; external clib name 'verrx'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/errnoh.inc b/jcl/source/fpc/libclite/errnoh.inc new file mode 100644 index 0000000000..32abe748ff --- /dev/null +++ b/jcl/source/fpc/libclite/errnoh.inc @@ -0,0 +1,157 @@ + +Type + error_t = Integer; + +var +{$ifdef LIBC_OLDERRNO} + errno : error_t; cvar; external; +{$endif} + program_invocation_name : Pchar;cvar;external; + +{$ifndef LIBC_OLDERRNO} + function errno : error_t; + procedure seterrno (value : error_t); +{$endif} +{ --------------------------------------------------------------------- + asm/errno.inc + ---------------------------------------------------------------------} + + +const + EPERM = 1; + ENOENT = 2; + ESRCH = 3; + EINTR = 4; + EIO = 5; + ENXIO = 6; + E2BIG = 7; + ENOEXEC = 8; + EBADF = 9; + ECHILD = 10; + EAGAIN = 11; + ENOMEM = 12; + EACCES = 13; + EFAULT = 14; + ENOTBLK = 15; + EBUSY = 16; + EEXIST = 17; + EXDEV = 18; + ENODEV = 19; + ENOTDIR = 20; + EISDIR = 21; + EINVAL = 22; + ENFILE = 23; + EMFILE = 24; + ENOTTY = 25; + ETXTBSY = 26; + EFBIG = 27; + ENOSPC = 28; + ESPIPE = 29; + EROFS = 30; + EMLINK = 31; + EPIPE = 32; + EDOM = 33; + ERANGE = 34; + EDEADLK = 35; + ENAMETOOLONG = 36; + ENOLCK = 37; + ENOSYS = 38; + ENOTEMPTY = 39; + ELOOP = 40; + EWOULDBLOCK = EAGAIN; + ENOMSG = 42; + EIDRM = 43; + ECHRNG = 44; + EL2NSYNC = 45; + EL3HLT = 46; + EL3RST = 47; + ELNRNG = 48; + EUNATCH = 49; + ENOCSI = 50; + EL2HLT = 51; + EBADE = 52; + EBADR = 53; + EXFULL = 54; + ENOANO = 55; + EBADRQC = 56; + EBADSLT = 57; + EDEADLOCK = EDEADLK; + EBFONT = 59; + ENOSTR = 60; + ENODATA = 61; + ETIME = 62; + ENOSR = 63; + ENONET = 64; + ENOPKG = 65; + EREMOTE = 66; + ENOLINK = 67; + EADV = 68; + ESRMNT = 69; + ECOMM = 70; + EPROTO = 71; + EMULTIHOP = 72; + EDOTDOT = 73; + EBADMSG = 74; + EOVERFLOW = 75; + ENOTUNIQ = 76; + EBADFD = 77; + EREMCHG = 78; + ELIBACC = 79; + ELIBBAD = 80; + ELIBSCN = 81; + ELIBMAX = 82; + ELIBEXEC = 83; + EILSEQ = 84; + ERESTART = 85; + ESTRPIPE = 86; + EUSERS = 87; + ENOTSOCK = 88; + EDESTADDRREQ = 89; + EMSGSIZE = 90; + EPROTOTYPE = 91; + ENOPROTOOPT = 92; + EPROTONOSUPPORT = 93; + ESOCKTNOSUPPORT = 94; + EOPNOTSUPP = 95; + EPFNOSUPPORT = 96; + EAFNOSUPPORT = 97; + EADDRINUSE = 98; + EADDRNOTAVAIL = 99; + ENETDOWN = 100; + ENETUNREACH = 101; + ENETRESET = 102; + ECONNABORTED = 103; + ECONNRESET = 104; + ENOBUFS = 105; + EISCONN = 106; + ENOTCONN = 107; + ESHUTDOWN = 108; + ETOOMANYREFS = 109; + ETIMEDOUT = 110; + ECONNREFUSED = 111; + EHOSTDOWN = 112; + EHOSTUNREACH = 113; + EALREADY = 114; + EINPROGRESS = 115; + ESTALE = 116; + EUCLEAN = 117; + ENOTNAM = 118; + ENAVAIL = 119; + EISNAM = 120; + EREMOTEIO = 121; + EDQUOT = 122; + ENOMEDIUM = 123; + EMEDIUMTYPE = 124; + +{ --------------------------------------------------------------------- + bits/errno.h + ---------------------------------------------------------------------} + + +const + ENOTSUP = EOPNOTSUPP; + ECANCELED = 125; + +function __errno_location: PInteger; cdecl;external clib name '__errno_location'; + + diff --git a/jcl/source/fpc/libclite/errorh.inc b/jcl/source/fpc/libclite/errorh.inc new file mode 100644 index 0000000000..c6e03eb018 --- /dev/null +++ b/jcl/source/fpc/libclite/errorh.inc @@ -0,0 +1,9 @@ + +procedure error(status: longint; errnum: longint; format: Pchar; args: array of const); cdecl; external clib name 'error'; +procedure error_at_line(status: longint; errnum: longint; fname: Pchar; lineno: Cardinal; format: Pchar; args : array of const); cdecl; external clib name 'error_at_line'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/fcntlh.inc b/jcl/source/fpc/libclite/fcntlh.inc new file mode 100644 index 0000000000..0fa62665ff --- /dev/null +++ b/jcl/source/fpc/libclite/fcntlh.inc @@ -0,0 +1,47 @@ + +const + R_OK = 4; + W_OK = 2; + X_OK = 1; + F_OK = 0; + +const + SEEK_SET = 0; + SEEK_CUR = 1; + SEEK_END = 2; + +function fcntl(__fd:longint; __cmd:longint; args:array of const):longint;cdecl;external clib name 'fcntl'; +function fcntl(__fd:longint; __cmd:longint):longint;cdecl;varargs;external clib name 'fcntl'; + +function open(__file:Pchar; __oflag:longint; args:array of const):longint;cdecl;external clib name 'open'; +function open(__file:Pchar; __oflag:longint):longint;cdecl;varargs;external clib name 'open'; + +function open64(__file:Pchar; __oflag:longint; args:array of const):longint;cdecl;external clib name 'open64'; +function open64(__file:Pchar; __oflag:longint):longint;cdecl;varargs;external clib name 'open64'; + +function creat(__file:Pchar; __mode:__mode_t):longint;cdecl;external clib name 'creat'; +function creat64(__file:Pchar; __mode:__mode_t):longint;cdecl;external clib name 'creat64'; + +const + F_LOCK = 1; + F_TLOCK = 2; + F_TEST = 3; + +function lockf(__fd:longint; __cmd:longint; __len:__off_t):longint;cdecl;external clib name 'lockf'; +function lockf64(__fd:longint; __cmd:longint; __len:__off64_t):longint;cdecl;external clib name 'lockf64'; + +function posix_fadvise(__fd:longint; __offset:__off_t; __len:size_t; __advise:longint):longint;cdecl;external clib name 'posix_fadvise'; +function posix_fadvise64(__fd:longint; __offset:__off64_t; __len:size_t; __advise:longint):longint;cdecl;external clib name 'posix_fadvise64'; + +function posix_fallocate(__fd:longint; __offset:__off_t; __len:size_t):longint;cdecl;external clib name 'posix_fallocate'; +function posix_fallocate64(__fd:longint; __offset:__off64_t; __len:size_t):longint;cdecl;external clib name 'posix_fallocate64'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function fcntl(Handle: Integer; Command: Integer; var Lock: TFlock): Integer; cdecl; external clib name 'fcntl'; +function fcntl(Handle: Integer; Command: Integer; Arg: Longint): Integer; cdecl;external clib name 'fcntl'; + diff --git a/jcl/source/fpc/libclite/fenvh.inc b/jcl/source/fpc/libclite/fenvh.inc new file mode 100644 index 0000000000..1b6ac87e4d --- /dev/null +++ b/jcl/source/fpc/libclite/fenvh.inc @@ -0,0 +1,27 @@ + +function feclearexcept(__excepts:longint):longint;cdecl;external clib name 'feclearexcept'; +function fegetexceptflag(__flagp:Pfexcept_t; __excepts:longint):longint;cdecl;external clib name 'fegetexceptflag'; +function feraiseexcept(__excepts:longint):longint;cdecl;external clib name 'feraiseexcept'; +function fesetexceptflag(__flagp:Pfexcept_t; __excepts:longint):longint;cdecl;external clib name 'fesetexceptflag'; +function fetestexcept(__excepts:longint):longint;cdecl;external clib name 'fetestexcept'; +function fegetround:longint;cdecl;external clib name 'fegetround'; +function fesetround(__rounding_direction:longint):longint;cdecl;external clib name 'fesetround'; +function fegetenv(__envp:Pfenv_t):longint;cdecl;external clib name 'fegetenv'; +function feholdexcept(__envp:Pfenv_t):longint;cdecl;external clib name 'feholdexcept'; +function fesetenv(__envp:Pfenv_t):longint;cdecl;external clib name 'fesetenv'; +function feupdateenv(__envp:Pfenv_t):longint;cdecl;external clib name 'feupdateenv'; +function feenableexcept(__excepts:longint):longint;cdecl;external clib name 'feenableexcept'; +function fedisableexcept(__excepts:longint):longint;cdecl;external clib name 'fedisableexcept'; +function fegetexcept:longint;cdecl;external clib name 'fegetexcept'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function fegetexceptflag(var __flagp:fexcept_t; __excepts:longint):longint;cdecl;external clib name 'fegetexceptflag'; +function fesetexceptflag(const __flagp:fexcept_t; __excepts:longint):longint;cdecl;external clib name 'fesetexceptflag'; +function fegetenv(var __envp:fenv_t):longint;cdecl;external clib name 'fegetenv'; +function feholdexcept(var __envp:fenv_t):longint;cdecl;external clib name 'feholdexcept'; +function fesetenv(const __envp:fenv_t):longint;cdecl;external clib name 'fesetenv'; +function feupdateenv(var __envp:fenv_t):longint;cdecl;external clib name 'feupdateenv'; diff --git a/jcl/source/fpc/libclite/fileh.inc b/jcl/source/fpc/libclite/fileh.inc new file mode 100644 index 0000000000..7f8d021188 --- /dev/null +++ b/jcl/source/fpc/libclite/fileh.inc @@ -0,0 +1,15 @@ + +const + L_SET = 0; + L_INCR = 1; + L_XTND = 2; + + +function __flock(__fd:longint; __operation:longint):longint;cdecl;external clib name 'flock'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/fmtmsgh.inc b/jcl/source/fpc/libclite/fmtmsgh.inc new file mode 100644 index 0000000000..04aaa08e2c --- /dev/null +++ b/jcl/source/fpc/libclite/fmtmsgh.inc @@ -0,0 +1,41 @@ + +Const + MM_HARD = $001; + MM_SOFT = $002; + MM_FIRM = $004; + MM_APPL = $008; + MM_UTIL = $010; + MM_OPSYS = $020; + MM_RECOVER = $040; + MM_NRECOV = $080; + MM_PRINT = $100; + MM_CONSOLE = $200; + + MM_NOSEV = 0; + MM_HALT = 1; + MM_ERROR = 2; + MM_WARNING = 3; + MM_INFO = 4; + + MM_NULLLBL = PChar(nil); + MM_NULLSEV = 0; + MM_NULLMC = Longint(0); + MM_NULLTXT = PChar(0); + MM_NULLACT = PChar(0); + MM_NULLTAG = PChar(0); + + MM_NOTOK = -(1); + MM_OK = 0; + MM_NOMSG = 1; + MM_NOCON = 4; + + +function fmtmsg(__classification:longint; __label:Pchar; __severity:longint; __text:Pchar; __action:Pchar; __tag:Pchar):longint;cdecl;external clib name 'fmtmsg'; +function addseverity(__severity:longint; __string:Pchar):longint;cdecl;external clib name 'addseverity'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/fnmatchh.inc b/jcl/source/fpc/libclite/fnmatchh.inc new file mode 100644 index 0000000000..b80f0cc221 --- /dev/null +++ b/jcl/source/fpc/libclite/fnmatchh.inc @@ -0,0 +1,24 @@ + + + const + FNM_PATHNAME = 1 shl 0; + FNM_NOESCAPE = 1 shl 1; + FNM_PERIOD = 1 shl 2; + + FNM_FILE_NAME = FNM_PATHNAME; + FNM_LEADING_DIR = 1 shl 3; + FNM_CASEFOLD = 1 shl 4; + FNM_EXTMATCH = 1 shl 5; + + const + FNM_NOMATCH = 1; + + FNM_NOSYS = -(1); + +function fnmatch(__pattern:Pchar; __name:Pchar; __flags:longint):longint;cdecl;external clib name 'fnmatch'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/fpmake.inc b/jcl/source/fpc/libclite/fpmake.inc new file mode 100644 index 0000000000..dff916e8c7 --- /dev/null +++ b/jcl/source/fpc/libclite/fpmake.inc @@ -0,0 +1,11 @@ + StartPackage('libc'); + {$IF defined(ALLPACKAGES)} + Directory:='base/libc'; + {$ELSEIF defined(BASEPACKAGES)} + Directory:='libc'; + {$ENDIF} + OS:=[linux]; + T:=Targets.AddUnit('kerneldefs'); + T:=Targets.AddUnit('kernelioctl'); + T:=Targets.AddUnit('libc'); + EndPackage; diff --git a/jcl/source/fpc/libclite/fpmake.pp b/jcl/source/fpc/libclite/fpmake.pp new file mode 100644 index 0000000000..d4b6178682 --- /dev/null +++ b/jcl/source/fpc/libclite/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. + diff --git a/jcl/source/fpc/libclite/fstabh.inc b/jcl/source/fpc/libclite/fstabh.inc new file mode 100644 index 0000000000..443ab11419 --- /dev/null +++ b/jcl/source/fpc/libclite/fstabh.inc @@ -0,0 +1,37 @@ + +const + _PATH_FSTAB = '/etc/fstab'; + _FSTAB = '/etc/fstab'; + FSTAB_RW = 'rw'; + FSTAB_RQ = 'rq'; + FSTAB_RO = 'ro'; + FSTAB_SW = 'sw'; + FSTAB_XX = 'xx'; + +type + Pfstab = ^fstab; + fstab = record + fs_spec : Pchar; + fs_file : Pchar; + fs_vfstype : Pchar; + fs_mntops : Pchar; + fs_type : Pchar; + fs_freq : longint; + fs_passno : longint; + end; + + +function getfsent:Pfstab;cdecl;external clib name 'getfsent'; +function getfsspec(__name:Pchar):Pfstab;cdecl;external clib name 'getfsspec'; +function getfsfile(__name:Pchar):Pfstab;cdecl;external clib name 'getfsfile'; +function setfsent:longint;cdecl;external clib name 'setfsent'; +procedure endfsent;cdecl;external clib name 'endfsent'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TFSTab = fstab; + diff --git a/jcl/source/fpc/libclite/gconfigh.inc b/jcl/source/fpc/libclite/gconfigh.inc new file mode 100644 index 0000000000..ef98eebc83 --- /dev/null +++ b/jcl/source/fpc/libclite/gconfigh.inc @@ -0,0 +1,66 @@ + +type + Pwint_t = ^wint_t; + + _G_size_t = size_t; + + P_G_fpos_t = ^_G_fpos_t; + _G_fpos_t = record + __pos : __off_t; + __state : __mbstate_t; + end; + + P_G_fpos64_t = ^_G_fpos64_t; + _G_fpos64_t = record + __pos : __off64_t; + __state : __mbstate_t; + end; + + _G_ssize_t = __ssize_t; + _G_off_t = __off_t; + _G_off64_t = __off64_t; + _G_pid_t = __pid_t; + _G_uid_t = __uid_t; + _G_wchar_t = wchar_t; + _G_wint_t = wint_t; + _G_stat64 = _stat64; +type + + P_G_iconv_t = ^_G_iconv_t; + _G_iconv_t = record + case longint of + 0 : ( __cd : __gconv_info ); + 1 : ( __combined : record + __cd : __gconv_info; + __data : __gconv_step_data; + end ); + end; + +const + _G_HAVE_BOOL = 1; + _G_HAVE_ATEXIT = 1; + _G_HAVE_SYS_CDEFS = 1; + _G_HAVE_SYS_WAIT = 1; + _G_NEED_STDARG_H = 1; + _G_HAVE_PRINTF_FP = 1; + _G_HAVE_MMAP = 1; + _G_HAVE_LONG_DOUBLE_IO = 1; + _G_HAVE_IO_FILE_OPEN = 1; + _G_HAVE_IO_GETLINE_INFO = 1; + _G_IO_IO_FILE_VERSION = $20001; + + _G_BUFSIZ = 8192; + _G_NAMES_HAVE_UNDERSCORE = 0; + _G_VTABLE_LABEL_HAS_LENGTH = 1; + _G_USING_THUNKS = 1; + _G_VTABLE_LABEL_PREFIX = '__vt_'; + _G_VTABLE_LABEL_PREFIX_ID = '__vt_'; + +Type + _G_va_list = Pointer; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/gconvh.inc b/jcl/source/fpc/libclite/gconvh.inc new file mode 100644 index 0000000000..635f3d3071 --- /dev/null +++ b/jcl/source/fpc/libclite/gconvh.inc @@ -0,0 +1,109 @@ + +// function __UNKNOWN_10646_CHAR : wchar_t; + +Const +// __UNKNOWN_10646_CHAR = wchar_t($fffd); + + __GCONV_OK = 0; + __GCONV_NOCONV = 1; + __GCONV_NODB = 2; + __GCONV_NOMEM = 3; + __GCONV_EMPTY_INPUT = 4; + __GCONV_FULL_OUTPUT = 5; + __GCONV_ILLEGAL_INPUT = 6; + __GCONV_INCOMPLETE_INPUT = 7; + __GCONV_ILLEGAL_DESCRIPTOR = 8; + __GCONV_INTERNAL_ERROR = 9; + + __GCONV_IS_LAST = $0001; + __GCONV_IGNORE_ERRORS = $0002; + +type + // Forward definitions. + P__gconv_step = ^__gconv_step; + P__gconv_step_data = ^__gconv_step_data; + P__gconv_loaded_object = pointer; // ^__gconv_loaded_object; + P__gconv_trans_data = ^__gconv_trans_data; + + + __gconv_fct = function (_para1:P__gconv_step; _para2:P__gconv_step_data; _para3:PPbyte; _para4:Pbyte; _para5:PPbyte; + _para6:Psize_t; _para7:longint; _para8:longint):longint;cdecl; + + __gconv_init_fct = function (_para1:P__gconv_step):longint;cdecl; + + __gconv_end_fct = procedure (_para1:P__gconv_step);cdecl; + + __gconv_trans_fct = function (_para1:P__gconv_step; _para2:P__gconv_step_data; _para3:pointer; _para4:Pbyte; _para5:PPbyte; + _para6:Pbyte; _para7:PPbyte; _para8:Psize_t):longint;cdecl; + + __gconv_trans_context_fct = function (_para1:pointer; _para2:Pbyte; _para3:Pbyte; _para4:Pbyte; _para5:Pbyte):longint;cdecl; + + __gconv_trans_query_fct = function (_para1:Pchar; _para2:PPPchar; _para3:Psize_t):longint;cdecl; + + __gconv_trans_init_fct = function (_para1:Ppointer; _para2:Pchar):longint;cdecl; + + __gconv_trans_end_fct = procedure (_para1:pointer);cdecl; + + __gconv_trans_data = record + __trans_fct : __gconv_trans_fct; + __trans_context_fct : __gconv_trans_context_fct; + __trans_end_fct : __gconv_trans_end_fct; + __data : pointer; + __next : P__gconv_trans_data; + end; + + __gconv_step = record + __shlib_handle : P__gconv_loaded_object; + __modname : Pchar; + __counter : longint; + __from_name : Pchar; + __to_name : Pchar; + __fct : __gconv_fct; + __init_fct : __gconv_init_fct; + __end_fct : __gconv_end_fct; + __min_needed_from : longint; + __max_needed_from : longint; + __min_needed_to : longint; + __max_needed_to : longint; + __stateful : longint; + __data : pointer; + end; + + __gconv_step_data = record + __outbuf : Pbyte; + __outbufend : Pbyte; + __flags : longint; + __invocation_counter : longint; + __internal_use : longint; + __statep : P__mbstate_t; + __state : __mbstate_t; + __trans : P__gconv_trans_data; + end; + + + P__gconv_info = ^__gconv_info; + __gconv_info = record + __nsteps : size_t; + __steps : P__gconv_step; + end; + __gconv_t = P__gconv_info; + P__gconv_t = ^__gconv_t; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TGConvStep = __gconv_step; + PGConvStep = ^__gconv_step; + + TGConvStepData = __gconv_step_data; + PGConvStepData = ^TGConvStepData; + + TGConvTransData = __gconv_trans_data; + PGConvTransData = ^TGConvTransData; + + TGConvInfo = __gconv_info; + PGConvInfo = ^TGConvInfo; + diff --git a/jcl/source/fpc/libclite/getopth.inc b/jcl/source/fpc/libclite/getopth.inc new file mode 100644 index 0000000000..7319aec0b5 --- /dev/null +++ b/jcl/source/fpc/libclite/getopth.inc @@ -0,0 +1,34 @@ + +var + optarg : Pchar;cvar;external; + optind : longint;cvar;external; + opterr : longint;cvar;external; + optopt : longint;cvar;external; + +type + Poption = ^option; + option = record + name : Pchar; + has_arg : longint; + flag : Plongint; + val : longint; + end; + + +const + no_argument = 0; + required_argument = 1; + optional_argument = 2; + + +function getopt(___argc:longint; ___argv:PPchar; __shortopts:Pchar):longint;cdecl;external clib name 'getopt'; +function getopt_long(___argc:longint; ___argv:PPchar; __shortopts:Pchar; __longopts:Poption; __longind:Plongint):longint;cdecl;external clib name 'getopt_long'; +function getopt_long_only(___argc:longint; ___argv:PPchar; __shortopts:Pchar; __longopts:Poption; __longind:Plongint):longint;cdecl;external clib name 'getopt_long_only'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function getopt_long(___argc:longint; ___argv:PPchar; __shortopts:Pchar; const __longopts:option; var __longind:longint):longint;cdecl;external clib name 'getopt_long'; +function getopt_long_only(___argc:longint; ___argv:PPchar; __shortopts:Pchar; const __longopts:option; var __longind:longint):longint;cdecl;external clib name 'getopt_long_only'; diff --git a/jcl/source/fpc/libclite/glibc_versionh.inc b/jcl/source/fpc/libclite/glibc_versionh.inc new file mode 100644 index 0000000000..c716955a24 --- /dev/null +++ b/jcl/source/fpc/libclite/glibc_versionh.inc @@ -0,0 +1,9 @@ + +function gnu_get_libc_release:Pchar;cdecl;external clib name 'gnu_get_libc_release'; +function gnu_get_libc_version:Pchar;cdecl;external clib name 'gnu_get_libc_version'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/globh.inc b/jcl/source/fpc/libclite/globh.inc new file mode 100644 index 0000000000..98b8238d75 --- /dev/null +++ b/jcl/source/fpc/libclite/globh.inc @@ -0,0 +1,87 @@ +Const + GLOB_ERR = 1 shl 0; + GLOB_MARK = 1 shl 1; + GLOB_NOSORT = 1 shl 2; + GLOB_DOOFFS = 1 shl 3; + GLOB_NOCHECK = 1 shl 4; + GLOB_APPEND = 1 shl 5; + GLOB_NOESCAPE = 1 shl 6; + GLOB_PERIOD = 1 shl 7; + GLOB_MAGCHAR = 1 shl 8; + GLOB_ALTDIRFUNC = 1 shl 9; + GLOB_BRACE = 1 shl 10; + GLOB_NOMAGIC = 1 shl 11; + GLOB_TILDE = 1 shl 12; + GLOB_ONLYDIR = 1 shl 13; + GLOB_TILDE_CHECK = 1 shl 14; + __GLOB_FLAGS = ((((((((((((GLOB_ERR or GLOB_MARK) or GLOB_NOSORT) or GLOB_DOOFFS) or GLOB_NOESCAPE) or GLOB_NOCHECK) or GLOB_APPEND) or GLOB_PERIOD) or GLOB_ALTDIRFUNC) or GLOB_BRACE) or GLOB_NOMAGIC) or GLOB_TILDE) or GLOB_ONLYDIR) or GLOB_TILDE_CHECK; + GLOB_NOSPACE = 1; + GLOB_ABORTED = 2; + GLOB_NOMATCH = 3; + GLOB_NOSYS = 4; + + GLOB_ABEND = GLOB_ABORTED; + +Type + TGlobCloseDirProc = procedure(Param: Pointer); cdecl; + TGlobReadDirFunc = function(Param: Pointer): PDirEnt; cdecl; + TGlobOpenDirFunc = function(Param: PChar): __ptr_t; cdecl; + TGlobStatFunc = function(Param1: PChar; Param2: PStatBuf): longint; cdecl; + + Pglob_t = ^glob_t; + glob_t = record + gl_pathc : size_t; + gl_pathv : ^Pchar; + gl_offs : size_t; + gl_flags : longint; + gl_closedir : TGlobClosedirProc; + gl_readdir : TGlobReaddirFunc; + gl_opendir : TGlobOpendirFunc; + gl_lstat : TGlobStatFunc; + gl_stat : TGlobStatFunc; + end; + + TGlobReadDir64Func = function(Param: Pointer): PDirEnt64; cdecl; + TGlobStat64Func = function(Param1: PChar; Param2: PStatBuf64): longint; cdecl; + + Pglob64_t = ^glob64_t; + glob64_t = record + gl_pathc: size_t; + gl_pathv: PPChar; + gl_offs: size_t; + gl_flags: longint; + gl_closedir: TGlobCloseDirProc; + gl_readdir: TGlobReaddir64Func; + gl_opendir: TGlobOpenDirFunc; + gl_lstat: TGlobStat64Func; + gl_stat: TGlobStat64Func; + end; + + TGlobErrFunc = function(PathName: PChar; ErrNo: longint): longint; cdecl; + +function glob(__pattern:Pchar; __flags:longint; __errfunc:TGlobErrFunc; __pglob:Pglob_t):longint;cdecl;external clib name 'glob'; +procedure globfree(__pglob:Pglob_t);cdecl;external clib name 'globfree'; + +function glob64(__pattern: PChar; __flags: longint; __errfunc: TGlobErrFunc; __pglob: Pglob64_t): longint; cdecl;external clib name 'glob64'; +procedure globfree64(__pglob: Pglob64_t); cdecl;external clib name 'globfree64'; + +function glob_pattern_p(__pattern: PChar; __quote: longint): longint; cdecl;external clib name 'glob_pattern_p'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TGlobData = glob_t; + PGlobData = ^TGlobData; + + TGlob64Data = glob_t; + PGlob64Data = ^TGlob64Data; + + TGlobReadDirProc = TGlobReadDirFunc; + TGlobOpenDirProc = TGlobOpenDirFunc; + TGlobStatProc = TGlobStatFunc; + + TGlobReadDir64Proc = TGlobReadDir64Func; + TGlobStat64Proc = TGlobStat64Func; diff --git a/jcl/source/fpc/libclite/glue.inc b/jcl/source/fpc/libclite/glue.inc new file mode 100644 index 0000000000..48b7ec3b1a --- /dev/null +++ b/jcl/source/fpc/libclite/glue.inc @@ -0,0 +1,51 @@ +{ --------------------------------------------------------------------- + glue.inc : Glue between libc and Pascal types + ---------------------------------------------------------------------} + +Type + + __ptr_t = Pointer; + P__ptr_t = ^__ptr_t; + ptrdiff_t = Integer; + __long_double_t = Extended; + P__long_double_t = ^__long_double_t; + size_t = Cardinal; + Psize_t = ^size_t; + UInt64 = 0..High(Int64); // Must be unsigned. + wchar_t = widechar; + Pwchar_t = ^wchar_t; + PPwchar_t = ^Pwchar_t; + +{ --------------------------------------------------------------------- + Declarations moved forward because C headers are a mess. + ---------------------------------------------------------------------} + +Type + __sighandler_t = procedure(SigNum: Integer); cdecl; + + timespec = record + tv_sec: Longint; + tv_nsec: Longint; + end; + + wint_t = Cardinal; + __mbstate_t = record + count: Integer; + case { __value } Integer of + 0: (__wch: wint_t); + 1: (__wchb: packed array[0..4 - 1] of Char); + end; + mbstate_t = __mbstate_t; + P__mbstate_t = ^__mbstate_t; + +{ --------------------------------------------------------------------- + Borland compatibility types for forward declarations. + ---------------------------------------------------------------------} + + TSignalHandler = __sighandler_t; + TTimeSpec = timespec; + PTimeSpec = ^TTimeSpec; + TMultiByteState = __mbstate_t; + PMultiByteState = ^TMultiByteState; + + diff --git a/jcl/source/fpc/libclite/grph.inc b/jcl/source/fpc/libclite/grph.inc new file mode 100644 index 0000000000..8fe7add931 --- /dev/null +++ b/jcl/source/fpc/libclite/grph.inc @@ -0,0 +1,45 @@ + +type + Pgroup = ^group; + group = record + gr_name : Pchar; + gr_passwd : Pchar; + gr_gid : __gid_t; + gr_mem : ^Pchar; + end; + PPgroup = ^Pgroup; + +procedure setgrent;cdecl;external clib name 'setgrent'; +procedure endgrent;cdecl;external clib name 'endgrent'; +function getgrent:Pgroup;cdecl;external clib name 'getgrent'; +function fgetgrent(__stream:PFILE):Pgroup;cdecl;external clib name 'fgetgrent'; +function putgrent(__p:Pgroup; __f:PFILE):longint;cdecl;external clib name 'putgrent'; +function getgrgid(__gid:__gid_t):Pgroup;cdecl;external clib name 'getgrgid'; +function getgrnam(__name:Pchar):Pgroup;cdecl;external clib name 'getgrnam'; + +const + NSS_BUFLEN_GROUP = 1024; + +function getgrent_r(__resultbuf:Pgroup; __buffer:Pchar; __buflen:size_t; __result:PPgroup):longint;cdecl;external clib name 'getgrent_r'; +function getgrgid_r(__gid:__gid_t; __resultbuf:Pgroup; __buffer:Pchar; __buflen:size_t; __result:PPgroup):longint;cdecl;external clib name 'getgrgid_r'; +function getgrnam_r(__name:Pchar; __resultbuf:Pgroup; __buffer:Pchar; __buflen:size_t; __result:PPgroup):longint;cdecl;external clib name 'getgrnam_r'; +function fgetgrent_r(__stream:PFILE; __resultbuf:Pgroup; __buffer:Pchar; __buflen:size_t; __result:PPgroup):longint;cdecl;external clib name 'fgetgrent_r'; +function setgroups(__n:size_t; __groups:P__gid_t):longint;cdecl;external clib name 'setgroups'; +function getgrouplist(__user:Pchar; __group:__gid_t; __groups:P__gid_t; __ngroups:Plongint):longint;cdecl;external clib name 'getgrouplist'; +function initgroups(__user:Pchar; __group:__gid_t):longint;cdecl;external clib name 'initgroups'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TGroup = group; + +function putgrent(const __p: group; __f:PFILE):longint;cdecl;external clib name 'putgrent'; +function getgrent_r(var __resultbuf: group; __buffer:Pchar; __buflen:size_t; var __result: Pgroup):longint;cdecl;external clib name 'getgrent_r'; +function getgrgid_r(__gid:__gid_t; var __resultbuf:group; __buffer:Pchar; __buflen:size_t; var __result:Pgroup):longint;cdecl;external clib name 'getgrgid_r'; +function getgrnam_r(__name:Pchar; var __resultbuf:group; __buffer:Pchar; __buflen:size_t; var __result:Pgroup):longint;cdecl;external clib name 'getgrnam_r'; +function fgetgrent_r(__stream:PFILE; var __resultbuf:group; __buffer:Pchar; __buflen:size_t; var __result:Pgroup):longint;cdecl;external clib name 'fgetgrent_r'; +function getgrouplist(__user:Pchar; __group:__gid_t; var __groups: __gid_t; var __ngroups:longint):longint;cdecl;external clib name 'getgrouplist'; + diff --git a/jcl/source/fpc/libclite/iconvh.inc b/jcl/source/fpc/libclite/iconvh.inc new file mode 100644 index 0000000000..d82f8fbf63 --- /dev/null +++ b/jcl/source/fpc/libclite/iconvh.inc @@ -0,0 +1,16 @@ + +type + + Piconv_t = ^iconv_t; + iconv_t = pointer; + +function iconv_open(__tocode:Pchar; __fromcode:Pchar):iconv_t;cdecl;external clib name 'iconv_open'; +function iconv(__cd:iconv_t; __inbuf:PPchar; __inbytesleft:Psize_t; __outbuf:PPchar; __outbytesleft:Psize_t):size_t;cdecl;external clib name 'iconv'; +function iconv_close(__cd:iconv_t):longint;cdecl;external clib name 'iconv_close'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +function iconv(__cd:iconv_t; var __inbuf:Pchar; var __inbytesleft:size_t; var __outbuf:Pchar; var __outbytesleft: size_t):size_t;cdecl;external clib name 'iconv'; diff --git a/jcl/source/fpc/libclite/igmph.inc b/jcl/source/fpc/libclite/igmph.inc new file mode 100644 index 0000000000..a7c457e3c9 --- /dev/null +++ b/jcl/source/fpc/libclite/igmph.inc @@ -0,0 +1,6 @@ + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/inttypesh.inc b/jcl/source/fpc/libclite/inttypesh.inc new file mode 100644 index 0000000000..01cb638d00 --- /dev/null +++ b/jcl/source/fpc/libclite/inttypesh.inc @@ -0,0 +1,15 @@ + +type + Pimaxdiv_t = ^imaxdiv_t; + imaxdiv_t = record + quot : int64; + rem : int64; + end; + +function imaxabs (__n : intmax_t) : intmax_t; cdecl; external clib name 'imaxabs'; +function imaxdiv (__numer: intmax_t; __denom: intmax_t): imaxdiv_t; cdecl;external clib name 'imaxdiv'; +function strtoimax(__nptr: PChar; __endptr: PPChar; __base: Integer): intmax_t;cdecl;external clib name 'strtoimax'; +function strtoumax(__nptr: PChar; __endptr: PPChar; __base: Integer): uintmax_t; cdecl; external clib name 'strtoumax'; +function wcstoimax(__nptr: Pwchar_t; __endptr: PPwchar_t; __base: Integer): intmax_t; cdecl;external clib name 'wcstoimax'; +function wcstoumax(__nptr: Pwchar_t; __endptr: PPwchar_t; __base: Integer): uintmax_t; cdecl;external clib name 'wcstoumax'; + diff --git a/jcl/source/fpc/libclite/ioctl_typesh.inc b/jcl/source/fpc/libclite/ioctl_typesh.inc new file mode 100644 index 0000000000..6b797be4fa --- /dev/null +++ b/jcl/source/fpc/libclite/ioctl_typesh.inc @@ -0,0 +1,62 @@ + +type + Pwinsize = ^winsize; + winsize = record + ws_row : word; + ws_col : word; + ws_xpixel : word; + ws_ypixel : word; + end; + + +const + NCC = 8; +type + Ptermio = ^termio; + termio = record + c_iflag : word; + c_oflag : word; + c_cflag : word; + c_lflag : word; + c_line : byte; + c_cc : array[0..(NCC)-1] of byte; + end; + + +const + TIOCM_LE = $001; + TIOCM_DTR = $002; + TIOCM_RTS = $004; + TIOCM_ST = $008; + TIOCM_SR = $010; + TIOCM_CTS = $020; + TIOCM_CAR = $040; + TIOCM_RNG = $080; + TIOCM_DSR = $100; + TIOCM_CD = TIOCM_CAR; + TIOCM_RI = TIOCM_RNG; + N_TTY = 0; + N_SLIP = 1; + N_MOUSE = 2; + N_PPP = 3; + N_STRIP = 4; + N_AX25 = 5; + N_X25 = 6; + N_6PACK = 7; + N_MASC = 8; + N_R3964 = 9; + N_PROFIBUS_FDL = 10; + N_IRDA = 11; + N_SMSBLOCK = 12; + N_HDLC = 13; + N_SYNC_PPP = 14; + N_HCI = 15; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TWinSize = winsize; + diff --git a/jcl/source/fpc/libclite/ioctlsh.inc b/jcl/source/fpc/libclite/ioctlsh.inc new file mode 100644 index 0000000000..c3aad5bc82 --- /dev/null +++ b/jcl/source/fpc/libclite/ioctlsh.inc @@ -0,0 +1,62 @@ + +const + SIOCADDRT = $890B; + SIOCDELRT = $890C; + SIOCRTMSG = $890D; + SIOCGIFNAME = $8910; + SIOCSIFLINK = $8911; + SIOCGIFCONF = $8912; + SIOCGIFFLAGS = $8913; + SIOCSIFFLAGS = $8914; + SIOCGIFADDR = $8915; + SIOCSIFADDR = $8916; + SIOCGIFDSTADDR = $8917; + SIOCSIFDSTADDR = $8918; + SIOCGIFBRDADDR = $8919; + SIOCSIFBRDADDR = $891a; + SIOCGIFNETMASK = $891b; + SIOCSIFNETMASK = $891c; + SIOCGIFMETRIC = $891d; + SIOCSIFMETRIC = $891e; + SIOCGIFMEM = $891f; + SIOCSIFMEM = $8920; + SIOCGIFMTU = $8921; + SIOCSIFMTU = $8922; + SIOCSIFHWADDR = $8924; + SIOCGIFENCAP = $8925; + SIOCSIFENCAP = $8926; + SIOCGIFHWADDR = $8927; + SIOCGIFSLAVE = $8929; + SIOCSIFSLAVE = $8930; + SIOCADDMULTI = $8931; + SIOCDELMULTI = $8932; + SIOCGIFINDEX = $8933; + SIOGIFINDEX = SIOCGIFINDEX; + SIOCSIFPFLAGS = $8934; + SIOCGIFPFLAGS = $8935; + SIOCDIFADDR = $8936; + SIOCSIFHWBROADCAST = $8937; + SIOCGIFCOUNT = $8938; + SIOCGIFBR = $8940; + SIOCSIFBR = $8941; + SIOCGIFTXQLEN = $8942; + SIOCSIFTXQLEN = $8943; + SIOCDARP = $8953; + SIOCGARP = $8954; + SIOCSARP = $8955; + SIOCDRARP = $8960; + SIOCGRARP = $8961; + SIOCSRARP = $8962; + SIOCGIFMAP = $8970; + SIOCSIFMAP = $8971; + SIOCADDDLCI = $8980; + SIOCDELDLCI = $8981; + SIOCDEVPRIVATE = $89F0; + SIOCPROTOPRIVATE = $89E0; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/kioctlsh.inc b/jcl/source/fpc/libclite/kioctlsh.inc new file mode 100644 index 0000000000..dedbdb1eee --- /dev/null +++ b/jcl/source/fpc/libclite/kioctlsh.inc @@ -0,0 +1,109 @@ + +{$ifndef __ARCH_I386_IOCTLS_H__} +{$define __ARCH_I386_IOCTLS_H__} +{$include } + +const + TCGETS = $5401; + TCSETS = $5402; + TCSETSW = $5403; + TCSETSF = $5404; + TCGETA = $5405; + TCSETA = $5406; + TCSETAW = $5407; + TCSETAF = $5408; + TCSBRK = $5409; + TCXONC = $540A; + TCFLSH = $540B; + TIOCEXCL = $540C; + TIOCNXCL = $540D; + TIOCSCTTY = $540E; + TIOCGPGRP = $540F; + TIOCSPGRP = $5410; + TIOCOUTQ = $5411; + TIOCSTI = $5412; + TIOCGWINSZ = $5413; + TIOCSWINSZ = $5414; + TIOCMGET = $5415; + TIOCMBIS = $5416; + TIOCMBIC = $5417; + TIOCMSET = $5418; + TIOCGSOFTCAR = $5419; + TIOCSSOFTCAR = $541A; + FIONREAD = $541B; + TIOCINQ = FIONREAD; + TIOCLINUX = $541C; + TIOCCONS = $541D; + TIOCGSERIAL = $541E; + TIOCSSERIAL = $541F; + TIOCPKT = $5420; + FIONBIO = $5421; + TIOCNOTTY = $5422; + TIOCSETD = $5423; + TIOCGETD = $5424; + TCSBRKP = $5425; + TIOCTTYGSTRUCT = $5426; + TIOCSBRK = $5427; + TIOCCBRK = $5428; + TIOCGSID = $5429; +function TIOCGPTN : longint; + { return type might be wrong } + +function TIOCSPTLCK : longint; + { return type might be wrong } + +function TIOCGDEV : longint; + { return type might be wrong } + + +const + FIONCLEX = $5450; + FIOCLEX = $5451; + FIOASYNC = $5452; + TIOCSERCONFIG = $5453; + TIOCSERGWILD = $5454; + TIOCSERSWILD = $5455; + TIOCGLCKTRMIOS = $5456; + TIOCSLCKTRMIOS = $5457; + TIOCSERGSTRUCT = $5458; + TIOCSERGETLSR = $5459; + TIOCSERGETMULTI = $545A; + TIOCSERSETMULTI = $545B; + TIOCMIWAIT = $545C; + TIOCGICOUNT = $545D; + TIOCGHAYESESP = $545E; + TIOCSHAYESESP = $545F; + TIOCPKT_DATA = 0; + TIOCPKT_FLUSHREAD = 1; + TIOCPKT_FLUSHWRITE = 2; + TIOCPKT_STOP = 4; + TIOCPKT_START = 8; + TIOCPKT_NOSTOP = 16; + TIOCPKT_DOSTOP = 32; + TIOCSER_TEMT = $01; +{$endif} +function TIOCGPTN : longint; + { return type might be wrong } + begin + TIOCGPTN:=_IOR('T',$30,dword); + end; + +function TIOCSPTLCK : longint; + { return type might be wrong } + begin + TIOCSPTLCK:=_IOW('T',$31,longint); + end; + +function TIOCGDEV : longint; + { return type might be wrong } + begin + TIOCGDEV:=_IOR('T',$32,dword); + end; + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/langinfoh.inc b/jcl/source/fpc/libclite/langinfoh.inc new file mode 100644 index 0000000000..7bd89a4b31 --- /dev/null +++ b/jcl/source/fpc/libclite/langinfoh.inc @@ -0,0 +1,375 @@ + + Const + ABDAY_1 = (__LC_TIME shl 16); + ABDAY_2 = (ABDAY_1)+1; + ABDAY_3 = (ABDAY_1)+2; + ABDAY_4 = (ABDAY_1)+3; + ABDAY_5 = (ABDAY_1)+4; + ABDAY_6 = (ABDAY_1)+5; + ABDAY_7 = (ABDAY_1)+6; + DAY_1 = (ABDAY_1)+7; + DAY_2 = (ABDAY_1)+8; + DAY_3 = (ABDAY_1)+9; + DAY_4 = (ABDAY_1)+10; + DAY_5 = (ABDAY_1)+11; + DAY_6 = (ABDAY_1)+12; + DAY_7 = (ABDAY_1)+13; + ABMON_1 = (ABDAY_1)+14; + ABMON_2 = (ABDAY_1)+15; + ABMON_3 = (ABDAY_1)+16; + ABMON_4 = (ABDAY_1)+17; + ABMON_5 = (ABDAY_1)+18; + ABMON_6 = (ABDAY_1)+19; + ABMON_7 = (ABDAY_1)+20; + ABMON_8 = (ABDAY_1)+21; + ABMON_9 = (ABDAY_1)+22; + ABMON_10 = (ABDAY_1)+23; + ABMON_11 = (ABDAY_1)+24; + ABMON_12 = (ABDAY_1)+25; + MON_1 = (ABDAY_1)+26; + MON_2 = (ABDAY_1)+27; + MON_3 = (ABDAY_1)+28; + MON_4 = (ABDAY_1)+29; + MON_5 = (ABDAY_1)+30; + MON_6 = (ABDAY_1)+31; + MON_7 = (ABDAY_1)+32; + MON_8 = (ABDAY_1)+33; + MON_9 = (ABDAY_1)+34; + MON_10 = (ABDAY_1)+35; + MON_11 = (ABDAY_1)+36; + MON_12 = (ABDAY_1)+37; + AM_STR = (ABDAY_1)+38; + PM_STR = (ABDAY_1)+39; + D_T_FMT = (ABDAY_1)+40; + D_FMT = (ABDAY_1)+41; + T_FMT = (ABDAY_1)+42; + T_FMT_AMPM = (ABDAY_1)+43; + ERA = (ABDAY_1)+44; + __ERA_YEAR = (ABDAY_1)+45; + ERA_D_FMT = (ABDAY_1)+46; + ALT_DIGITS = (ABDAY_1)+47; + ERA_D_T_FMT = (ABDAY_1)+48; + ERA_T_FMT = (ABDAY_1)+49; + _NL_TIME_ERA_NUM_ENTRIES = (ABDAY_1)+50; + _NL_TIME_ERA_ENTRIES = (ABDAY_1)+51; + _NL_WABDAY_1 = (ABDAY_1)+52; + _NL_WABDAY_2 = (ABDAY_1)+53; + _NL_WABDAY_3 = (ABDAY_1)+54; + _NL_WABDAY_4 = (ABDAY_1)+55; + _NL_WABDAY_5 = (ABDAY_1)+56; + _NL_WABDAY_6 = (ABDAY_1)+57; + _NL_WABDAY_7 = (ABDAY_1)+58; + _NL_WDAY_1 = (ABDAY_1)+59; + _NL_WDAY_2 = (ABDAY_1)+60; + _NL_WDAY_3 = (ABDAY_1)+61; + _NL_WDAY_4 = (ABDAY_1)+62; + _NL_WDAY_5 = (ABDAY_1)+63; + _NL_WDAY_6 = (ABDAY_1)+64; + _NL_WDAY_7 = (ABDAY_1)+65; + _NL_WABMON_1 = (ABDAY_1)+66; + _NL_WABMON_2 = (ABDAY_1)+67; + _NL_WABMON_3 = (ABDAY_1)+68; + _NL_WABMON_4 = (ABDAY_1)+69; + _NL_WABMON_5 = (ABDAY_1)+70; + _NL_WABMON_6 = (ABDAY_1)+71; + _NL_WABMON_7 = (ABDAY_1)+72; + _NL_WABMON_8 = (ABDAY_1)+73; + _NL_WABMON_9 = (ABDAY_1)+74; + _NL_WABMON_10 = (ABDAY_1)+75; + _NL_WABMON_11 = (ABDAY_1)+76; + _NL_WABMON_12 = (ABDAY_1)+77; + _NL_WMON_1 = (ABDAY_1)+78; + _NL_WMON_2 = (ABDAY_1)+79; + _NL_WMON_3 = (ABDAY_1)+80; + _NL_WMON_4 = (ABDAY_1)+81; + _NL_WMON_5 = (ABDAY_1)+82; + _NL_WMON_6 = (ABDAY_1)+83; + _NL_WMON_7 = (ABDAY_1)+84; + _NL_WMON_8 = (ABDAY_1)+85; + _NL_WMON_9 = (ABDAY_1)+86; + _NL_WMON_10 = (ABDAY_1)+87; + _NL_WMON_11 = (ABDAY_1)+88; + _NL_WMON_12 = (ABDAY_1)+89; + _NL_WAM_STR = (ABDAY_1)+90; + _NL_WPM_STR = (ABDAY_1)+91; + _NL_WD_T_FMT = (ABDAY_1)+92; + _NL_WD_FMT = (ABDAY_1)+93; + _NL_WT_FMT = (ABDAY_1)+94; + _NL_WT_FMT_AMPM = (ABDAY_1)+95; + _NL_WERA_YEAR = (ABDAY_1)+96; + _NL_WERA_D_FMT = (ABDAY_1)+97; + _NL_WALT_DIGITS = (ABDAY_1)+98; + _NL_WERA_D_T_FMT = (ABDAY_1)+99; + _NL_WERA_T_FMT = (ABDAY_1)+100; + _NL_TIME_WEEK_NDAYS = (ABDAY_1)+101; + _NL_TIME_WEEK_1STDAY = (ABDAY_1)+102; + _NL_TIME_WEEK_1STWEEK = (ABDAY_1)+103; + _NL_TIME_FIRST_WEEKDAY = (ABDAY_1)+104; + _NL_TIME_FIRST_WORKDAY = (ABDAY_1)+105; + _NL_TIME_CAL_DIRECTION = (ABDAY_1)+106; + _NL_TIME_TIMEZONE = (ABDAY_1)+107; + _DATE_FMT = (ABDAY_1)+108; + _NL_W_DATE_FMT = (ABDAY_1)+109; + _NL_TIME_CODESET = (ABDAY_1)+110; + _NL_NUM_LC_TIME = (ABDAY_1)+111; + _NL_COLLATE_NRULES = (__LC_COLLATE shl 16); + _NL_COLLATE_RULESETS = (_NL_COLLATE_NRULES)+1; + _NL_COLLATE_TABLEMB = (_NL_COLLATE_NRULES)+2; + _NL_COLLATE_WEIGHTMB = (_NL_COLLATE_NRULES)+3; + _NL_COLLATE_EXTRAMB = (_NL_COLLATE_NRULES)+4; + _NL_COLLATE_INDIRECTMB = (_NL_COLLATE_NRULES)+5; + _NL_COLLATE_GAP1 = (_NL_COLLATE_NRULES)+6; + _NL_COLLATE_GAP2 = (_NL_COLLATE_NRULES)+7; + _NL_COLLATE_GAP3 = (_NL_COLLATE_NRULES)+8; + _NL_COLLATE_TABLEWC = (_NL_COLLATE_NRULES)+9; + _NL_COLLATE_WEIGHTWC = (_NL_COLLATE_NRULES)+10; + _NL_COLLATE_EXTRAWC = (_NL_COLLATE_NRULES)+11; + _NL_COLLATE_INDIRECTWC = (_NL_COLLATE_NRULES)+12; + _NL_COLLATE_SYMB_HASH_SIZEMB = (_NL_COLLATE_NRULES)+13; + _NL_COLLATE_SYMB_TABLEMB = (_NL_COLLATE_NRULES)+14; + _NL_COLLATE_SYMB_EXTRAMB = (_NL_COLLATE_NRULES)+15; + _NL_COLLATE_COLLSEQMB = (_NL_COLLATE_NRULES)+16; + _NL_COLLATE_COLLSEQWC = (_NL_COLLATE_NRULES)+17; + _NL_COLLATE_CODESET = (_NL_COLLATE_NRULES)+18; + _NL_NUM_LC_COLLATE = (_NL_COLLATE_NRULES)+19; + _NL_CTYPE_CLASS = (__LC_CTYPE shl 16); + _NL_CTYPE_TOUPPER = (_NL_CTYPE_CLASS)+1; + _NL_CTYPE_GAP1 = (_NL_CTYPE_CLASS)+2; + _NL_CTYPE_TOLOWER = (_NL_CTYPE_CLASS)+3; + _NL_CTYPE_GAP2 = (_NL_CTYPE_CLASS)+4; + _NL_CTYPE_CLASS32 = (_NL_CTYPE_CLASS)+5; + _NL_CTYPE_GAP3 = (_NL_CTYPE_CLASS)+6; + _NL_CTYPE_GAP4 = (_NL_CTYPE_CLASS)+7; + _NL_CTYPE_GAP5 = (_NL_CTYPE_CLASS)+8; + _NL_CTYPE_GAP6 = (_NL_CTYPE_CLASS)+9; + _NL_CTYPE_CLASS_NAMES = (_NL_CTYPE_CLASS)+10; + _NL_CTYPE_MAP_NAMES = (_NL_CTYPE_CLASS)+11; + _NL_CTYPE_WIDTH = (_NL_CTYPE_CLASS)+12; + _NL_CTYPE_MB_CUR_MAX = (_NL_CTYPE_CLASS)+13; + _NL_CTYPE_CODESET_NAME = (_NL_CTYPE_CLASS)+14; + CODESET = _NL_CTYPE_CODESET_NAME; + _NL_CTYPE_TOUPPER32 = (_NL_CTYPE_CODESET_NAME)+1; + _NL_CTYPE_TOLOWER32 = (_NL_CTYPE_CODESET_NAME)+2; + _NL_CTYPE_CLASS_OFFSET = (_NL_CTYPE_CODESET_NAME)+3; + _NL_CTYPE_MAP_OFFSET = (_NL_CTYPE_CODESET_NAME)+4; + _NL_CTYPE_INDIGITS_MB_LEN = (_NL_CTYPE_CODESET_NAME)+5; + _NL_CTYPE_INDIGITS0_MB = (_NL_CTYPE_CODESET_NAME)+6; + _NL_CTYPE_INDIGITS1_MB = (_NL_CTYPE_CODESET_NAME)+7; + _NL_CTYPE_INDIGITS2_MB = (_NL_CTYPE_CODESET_NAME)+8; + _NL_CTYPE_INDIGITS3_MB = (_NL_CTYPE_CODESET_NAME)+9; + _NL_CTYPE_INDIGITS4_MB = (_NL_CTYPE_CODESET_NAME)+10; + _NL_CTYPE_INDIGITS5_MB = (_NL_CTYPE_CODESET_NAME)+11; + _NL_CTYPE_INDIGITS6_MB = (_NL_CTYPE_CODESET_NAME)+12; + _NL_CTYPE_INDIGITS7_MB = (_NL_CTYPE_CODESET_NAME)+13; + _NL_CTYPE_INDIGITS8_MB = (_NL_CTYPE_CODESET_NAME)+14; + _NL_CTYPE_INDIGITS9_MB = (_NL_CTYPE_CODESET_NAME)+15; + _NL_CTYPE_INDIGITS_WC_LEN = (_NL_CTYPE_CODESET_NAME)+16; + _NL_CTYPE_INDIGITS0_WC = (_NL_CTYPE_CODESET_NAME)+17; + _NL_CTYPE_INDIGITS1_WC = (_NL_CTYPE_CODESET_NAME)+18; + _NL_CTYPE_INDIGITS2_WC = (_NL_CTYPE_CODESET_NAME)+19; + _NL_CTYPE_INDIGITS3_WC = (_NL_CTYPE_CODESET_NAME)+20; + _NL_CTYPE_INDIGITS4_WC = (_NL_CTYPE_CODESET_NAME)+21; + _NL_CTYPE_INDIGITS5_WC = (_NL_CTYPE_CODESET_NAME)+22; + _NL_CTYPE_INDIGITS6_WC = (_NL_CTYPE_CODESET_NAME)+23; + _NL_CTYPE_INDIGITS7_WC = (_NL_CTYPE_CODESET_NAME)+24; + _NL_CTYPE_INDIGITS8_WC = (_NL_CTYPE_CODESET_NAME)+25; + _NL_CTYPE_INDIGITS9_WC = (_NL_CTYPE_CODESET_NAME)+26; + _NL_CTYPE_OUTDIGIT0_MB = (_NL_CTYPE_CODESET_NAME)+27; + _NL_CTYPE_OUTDIGIT1_MB = (_NL_CTYPE_CODESET_NAME)+28; + _NL_CTYPE_OUTDIGIT2_MB = (_NL_CTYPE_CODESET_NAME)+29; + _NL_CTYPE_OUTDIGIT3_MB = (_NL_CTYPE_CODESET_NAME)+30; + _NL_CTYPE_OUTDIGIT4_MB = (_NL_CTYPE_CODESET_NAME)+31; + _NL_CTYPE_OUTDIGIT5_MB = (_NL_CTYPE_CODESET_NAME)+32; + _NL_CTYPE_OUTDIGIT6_MB = (_NL_CTYPE_CODESET_NAME)+33; + _NL_CTYPE_OUTDIGIT7_MB = (_NL_CTYPE_CODESET_NAME)+34; + _NL_CTYPE_OUTDIGIT8_MB = (_NL_CTYPE_CODESET_NAME)+35; + _NL_CTYPE_OUTDIGIT9_MB = (_NL_CTYPE_CODESET_NAME)+36; + _NL_CTYPE_OUTDIGIT0_WC = (_NL_CTYPE_CODESET_NAME)+37; + _NL_CTYPE_OUTDIGIT1_WC = (_NL_CTYPE_CODESET_NAME)+38; + _NL_CTYPE_OUTDIGIT2_WC = (_NL_CTYPE_CODESET_NAME)+39; + _NL_CTYPE_OUTDIGIT3_WC = (_NL_CTYPE_CODESET_NAME)+40; + _NL_CTYPE_OUTDIGIT4_WC = (_NL_CTYPE_CODESET_NAME)+41; + _NL_CTYPE_OUTDIGIT5_WC = (_NL_CTYPE_CODESET_NAME)+42; + _NL_CTYPE_OUTDIGIT6_WC = (_NL_CTYPE_CODESET_NAME)+43; + _NL_CTYPE_OUTDIGIT7_WC = (_NL_CTYPE_CODESET_NAME)+44; + _NL_CTYPE_OUTDIGIT8_WC = (_NL_CTYPE_CODESET_NAME)+45; + _NL_CTYPE_OUTDIGIT9_WC = (_NL_CTYPE_CODESET_NAME)+46; + _NL_CTYPE_TRANSLIT_TAB_SIZE = (_NL_CTYPE_CODESET_NAME)+47; + _NL_CTYPE_TRANSLIT_FROM_IDX = (_NL_CTYPE_CODESET_NAME)+48; + _NL_CTYPE_TRANSLIT_FROM_TBL = (_NL_CTYPE_CODESET_NAME)+49; + _NL_CTYPE_TRANSLIT_TO_IDX = (_NL_CTYPE_CODESET_NAME)+50; + _NL_CTYPE_TRANSLIT_TO_TBL = (_NL_CTYPE_CODESET_NAME)+51; + _NL_CTYPE_TRANSLIT_DEFAULT_MISSING_LEN = (_NL_CTYPE_CODESET_NAME)+52; + _NL_CTYPE_TRANSLIT_DEFAULT_MISSING = (_NL_CTYPE_CODESET_NAME)+53; + _NL_CTYPE_TRANSLIT_IGNORE_LEN = (_NL_CTYPE_CODESET_NAME)+54; + _NL_CTYPE_TRANSLIT_IGNORE = (_NL_CTYPE_CODESET_NAME)+55; + _NL_CTYPE_EXTRA_MAP_1 = (_NL_CTYPE_CODESET_NAME)+56; + _NL_CTYPE_EXTRA_MAP_2 = (_NL_CTYPE_CODESET_NAME)+57; + _NL_CTYPE_EXTRA_MAP_3 = (_NL_CTYPE_CODESET_NAME)+58; + _NL_CTYPE_EXTRA_MAP_4 = (_NL_CTYPE_CODESET_NAME)+59; + _NL_CTYPE_EXTRA_MAP_5 = (_NL_CTYPE_CODESET_NAME)+60; + _NL_CTYPE_EXTRA_MAP_6 = (_NL_CTYPE_CODESET_NAME)+61; + _NL_CTYPE_EXTRA_MAP_7 = (_NL_CTYPE_CODESET_NAME)+62; + _NL_CTYPE_EXTRA_MAP_8 = (_NL_CTYPE_CODESET_NAME)+63; + _NL_CTYPE_EXTRA_MAP_9 = (_NL_CTYPE_CODESET_NAME)+64; + _NL_CTYPE_EXTRA_MAP_10 = (_NL_CTYPE_CODESET_NAME)+65; + _NL_CTYPE_EXTRA_MAP_11 = (_NL_CTYPE_CODESET_NAME)+66; + _NL_CTYPE_EXTRA_MAP_12 = (_NL_CTYPE_CODESET_NAME)+67; + _NL_CTYPE_EXTRA_MAP_13 = (_NL_CTYPE_CODESET_NAME)+68; + _NL_CTYPE_EXTRA_MAP_14 = (_NL_CTYPE_CODESET_NAME)+69; + _NL_NUM_LC_CTYPE = (_NL_CTYPE_CODESET_NAME)+70; + __INT_CURR_SYMBOL = (__LC_MONETARY shl 16); + __CURRENCY_SYMBOL = (__INT_CURR_SYMBOL)+1; + __MON_DECIMAL_POINT = (__INT_CURR_SYMBOL)+2; + __MON_THOUSANDS_SEP = (__INT_CURR_SYMBOL)+3; + __MON_GROUPING = (__INT_CURR_SYMBOL)+4; + __POSITIVE_SIGN = (__INT_CURR_SYMBOL)+5; + __NEGATIVE_SIGN = (__INT_CURR_SYMBOL)+6; + __INT_FRAC_DIGITS = (__INT_CURR_SYMBOL)+7; + __FRAC_DIGITS = (__INT_CURR_SYMBOL)+8; + __P_CS_PRECEDES = (__INT_CURR_SYMBOL)+9; + __P_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+10; + __N_CS_PRECEDES = (__INT_CURR_SYMBOL)+11; + __N_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+12; + __P_SIGN_POSN = (__INT_CURR_SYMBOL)+13; + __N_SIGN_POSN = (__INT_CURR_SYMBOL)+14; + _NL_MONETARY_CRNCYSTR = (__INT_CURR_SYMBOL)+15; + __INT_P_CS_PRECEDES = (__INT_CURR_SYMBOL)+16; + __INT_P_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+17; + __INT_N_CS_PRECEDES = (__INT_CURR_SYMBOL)+18; + __INT_N_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+19; + __INT_P_SIGN_POSN = (__INT_CURR_SYMBOL)+20; + __INT_N_SIGN_POSN = (__INT_CURR_SYMBOL)+21; + _NL_MONETARY_DUO_INT_CURR_SYMBOL = (__INT_CURR_SYMBOL)+22; + _NL_MONETARY_DUO_CURRENCY_SYMBOL = (__INT_CURR_SYMBOL)+23; + _NL_MONETARY_DUO_INT_FRAC_DIGITS = (__INT_CURR_SYMBOL)+24; + _NL_MONETARY_DUO_FRAC_DIGITS = (__INT_CURR_SYMBOL)+25; + _NL_MONETARY_DUO_P_CS_PRECEDES = (__INT_CURR_SYMBOL)+26; + _NL_MONETARY_DUO_P_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+27; + _NL_MONETARY_DUO_N_CS_PRECEDES = (__INT_CURR_SYMBOL)+28; + _NL_MONETARY_DUO_N_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+29; + _NL_MONETARY_DUO_INT_P_CS_PRECEDES = (__INT_CURR_SYMBOL)+30; + _NL_MONETARY_DUO_INT_P_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+31; + _NL_MONETARY_DUO_INT_N_CS_PRECEDES = (__INT_CURR_SYMBOL)+32; + _NL_MONETARY_DUO_INT_N_SEP_BY_SPACE = (__INT_CURR_SYMBOL)+33; + _NL_MONETARY_DUO_P_SIGN_POSN = (__INT_CURR_SYMBOL)+34; + _NL_MONETARY_DUO_N_SIGN_POSN = (__INT_CURR_SYMBOL)+35; + _NL_MONETARY_DUO_INT_P_SIGN_POSN = (__INT_CURR_SYMBOL)+36; + _NL_MONETARY_DUO_INT_N_SIGN_POSN = (__INT_CURR_SYMBOL)+37; + _NL_MONETARY_UNO_VALID_FROM = (__INT_CURR_SYMBOL)+38; + _NL_MONETARY_UNO_VALID_TO = (__INT_CURR_SYMBOL)+39; + _NL_MONETARY_DUO_VALID_FROM = (__INT_CURR_SYMBOL)+40; + _NL_MONETARY_DUO_VALID_TO = (__INT_CURR_SYMBOL)+41; + _NL_MONETARY_CONVERSION_RATE = (__INT_CURR_SYMBOL)+42; + _NL_MONETARY_DECIMAL_POINT_WC = (__INT_CURR_SYMBOL)+43; + _NL_MONETARY_THOUSANDS_SEP_WC = (__INT_CURR_SYMBOL)+44; + _NL_MONETARY_CODESET = (__INT_CURR_SYMBOL)+45; + _NL_NUM_LC_MONETARY = (__INT_CURR_SYMBOL)+46; + __DECIMAL_POINT = (__LC_NUMERIC shl 16); + RADIXCHAR = __DECIMAL_POINT; + __THOUSANDS_SEP = (__DECIMAL_POINT)+1; + THOUSEP = __THOUSANDS_SEP; + __GROUPING = (__THOUSANDS_SEP)+1; + _NL_NUMERIC_DECIMAL_POINT_WC = (__THOUSANDS_SEP)+2; + _NL_NUMERIC_THOUSANDS_SEP_WC = (__THOUSANDS_SEP)+3; + _NL_NUMERIC_CODESET = (__THOUSANDS_SEP)+4; + _NL_NUM_LC_NUMERIC = (__THOUSANDS_SEP)+5; + __YESEXPR = (__LC_MESSAGES shl 16); + __NOEXPR = ((__LC_MESSAGES shl 16))+1; + __YESSTR = ((__LC_MESSAGES shl 16))+2; + __NOSTR = ((__LC_MESSAGES shl 16))+3; + _NL_MESSAGES_CODESET = ((__LC_MESSAGES shl 16))+4; + _NL_NUM_LC_MESSAGES = ((__LC_MESSAGES shl 16))+5; + _NL_PAPER_HEIGHT = (__LC_PAPER shl 16); + _NL_PAPER_WIDTH = (_NL_PAPER_HEIGHT)+1; + _NL_PAPER_CODESET = (_NL_PAPER_HEIGHT)+2; + _NL_NUM_LC_PAPER = (_NL_PAPER_HEIGHT)+3; + _NL_NAME_NAME_FMT = (__LC_NAME shl 16); + _NL_NAME_NAME_GEN = (_NL_NAME_NAME_FMT)+1; + _NL_NAME_NAME_MR = (_NL_NAME_NAME_FMT)+2; + _NL_NAME_NAME_MRS = (_NL_NAME_NAME_FMT)+3; + _NL_NAME_NAME_MISS = (_NL_NAME_NAME_FMT)+4; + _NL_NAME_NAME_MS = (_NL_NAME_NAME_FMT)+5; + _NL_NAME_CODESET = (_NL_NAME_NAME_FMT)+6; + _NL_NUM_LC_NAME = (_NL_NAME_NAME_FMT)+7; + _NL_ADDRESS_POSTAL_FMT = (__LC_ADDRESS shl 16); + _NL_ADDRESS_COUNTRY_NAME = (_NL_ADDRESS_POSTAL_FMT)+1; + _NL_ADDRESS_COUNTRY_POST = (_NL_ADDRESS_POSTAL_FMT)+2; + _NL_ADDRESS_COUNTRY_AB2 = (_NL_ADDRESS_POSTAL_FMT)+3; + _NL_ADDRESS_COUNTRY_AB3 = (_NL_ADDRESS_POSTAL_FMT)+4; + _NL_ADDRESS_COUNTRY_CAR = (_NL_ADDRESS_POSTAL_FMT)+5; + _NL_ADDRESS_COUNTRY_NUM = (_NL_ADDRESS_POSTAL_FMT)+6; + _NL_ADDRESS_COUNTRY_ISBN = (_NL_ADDRESS_POSTAL_FMT)+7; + _NL_ADDRESS_LANG_NAME = (_NL_ADDRESS_POSTAL_FMT)+8; + _NL_ADDRESS_LANG_AB = (_NL_ADDRESS_POSTAL_FMT)+9; + _NL_ADDRESS_LANG_TERM = (_NL_ADDRESS_POSTAL_FMT)+10; + _NL_ADDRESS_LANG_LIB = (_NL_ADDRESS_POSTAL_FMT)+11; + _NL_ADDRESS_CODESET = (_NL_ADDRESS_POSTAL_FMT)+12; + _NL_NUM_LC_ADDRESS = (_NL_ADDRESS_POSTAL_FMT)+13; + _NL_TELEPHONE_TEL_INT_FMT = (__LC_TELEPHONE shl 16); + _NL_TELEPHONE_TEL_DOM_FMT = (_NL_TELEPHONE_TEL_INT_FMT)+1; + _NL_TELEPHONE_INT_SELECT = (_NL_TELEPHONE_TEL_INT_FMT)+2; + _NL_TELEPHONE_INT_PREFIX = (_NL_TELEPHONE_TEL_INT_FMT)+3; + _NL_TELEPHONE_CODESET = (_NL_TELEPHONE_TEL_INT_FMT)+4; + _NL_NUM_LC_TELEPHONE = (_NL_TELEPHONE_TEL_INT_FMT)+5; + _NL_MEASUREMENT_MEASUREMENT = (__LC_MEASUREMENT shl 16); + _NL_MEASUREMENT_CODESET = (_NL_MEASUREMENT_MEASUREMENT)+1; + _NL_NUM_LC_MEASUREMENT = (_NL_MEASUREMENT_MEASUREMENT)+2; + _NL_IDENTIFICATION_TITLE = (__LC_IDENTIFICATION shl 16); + _NL_IDENTIFICATION_SOURCE = (_NL_IDENTIFICATION_TITLE)+1; + _NL_IDENTIFICATION_ADDRESS = (_NL_IDENTIFICATION_TITLE)+2; + _NL_IDENTIFICATION_CONTACT = (_NL_IDENTIFICATION_TITLE)+3; + _NL_IDENTIFICATION_EMAIL = (_NL_IDENTIFICATION_TITLE)+4; + _NL_IDENTIFICATION_TEL = (_NL_IDENTIFICATION_TITLE)+5; + _NL_IDENTIFICATION_FAX = (_NL_IDENTIFICATION_TITLE)+6; + _NL_IDENTIFICATION_LANGUAGE = (_NL_IDENTIFICATION_TITLE)+7; + _NL_IDENTIFICATION_TERRITORY = (_NL_IDENTIFICATION_TITLE)+8; + _NL_IDENTIFICATION_AUDIENCE = (_NL_IDENTIFICATION_TITLE)+9; + _NL_IDENTIFICATION_APPLICATION = (_NL_IDENTIFICATION_TITLE)+10; + _NL_IDENTIFICATION_ABBREVIATION = (_NL_IDENTIFICATION_TITLE)+11; + _NL_IDENTIFICATION_REVISION = (_NL_IDENTIFICATION_TITLE)+12; + _NL_IDENTIFICATION_DATE = (_NL_IDENTIFICATION_TITLE)+13; + _NL_IDENTIFICATION_CATEGORY = (_NL_IDENTIFICATION_TITLE)+14; + _NL_IDENTIFICATION_CODESET = (_NL_IDENTIFICATION_TITLE)+15; + _NL_NUM_LC_IDENTIFICATION = (_NL_IDENTIFICATION_TITLE)+16; + _NL_NUM = (_NL_IDENTIFICATION_TITLE)+17; + +const + ERA_YEAR = __ERA_YEAR; + INT_CURR_SYMBOL = __INT_CURR_SYMBOL; + CURRENCY_SYMBOL = __CURRENCY_SYMBOL; + MON_DECIMAL_POINT = __MON_DECIMAL_POINT; + MON_THOUSANDS_SEP = __MON_THOUSANDS_SEP; + MON_GROUPING = __MON_GROUPING; + POSITIVE_SIGN = __POSITIVE_SIGN; + NEGATIVE_SIGN = __NEGATIVE_SIGN; + INT_FRAC_DIGITS = __INT_FRAC_DIGITS; + FRAC_DIGITS = __FRAC_DIGITS; + P_CS_PRECEDES = __P_CS_PRECEDES; + P_SEP_BY_SPACE = __P_SEP_BY_SPACE; + N_CS_PRECEDES = __N_CS_PRECEDES; + N_SEP_BY_SPACE = __N_SEP_BY_SPACE; + P_SIGN_POSN = __P_SIGN_POSN; + N_SIGN_POSN = __N_SIGN_POSN; + INT_P_CS_PRECEDES = __INT_P_CS_PRECEDES; + INT_P_SEP_BY_SPACE = __INT_P_SEP_BY_SPACE; + INT_N_CS_PRECEDES = __INT_N_CS_PRECEDES; + INT_N_SEP_BY_SPACE = __INT_N_SEP_BY_SPACE; + INT_P_SIGN_POSN = __INT_P_SIGN_POSN; + INT_N_SIGN_POSN = __INT_N_SIGN_POSN; + DECIMAL_POINT = __DECIMAL_POINT; + THOUSANDS_SEP = __THOUSANDS_SEP; + GROUPING = __GROUPING; + YESSTR = __YESSTR; + NOSTR = __NOSTR; + + +function nl_langinfo(__item:nl_item):Pchar;cdecl;external clib name 'nl_langinfo'; +function __nl_langinfo_l(__item:nl_item; l:__locale_t):Pchar;cdecl;external clib name '__nl_langinfo_l'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/lib_namesh.inc b/jcl/source/fpc/libclite/lib_namesh.inc new file mode 100644 index 0000000000..55b5da0697 --- /dev/null +++ b/jcl/source/fpc/libclite/lib_namesh.inc @@ -0,0 +1,29 @@ + +const + + LD_LINUX_SO = 'ld-linux.so.2'; + LD_SO = 'ld-linux.so.2'; + LIBANL_SO = 'libanl.so.1'; + LIBBROKENLOCALE_SO = 'libBrokenLocale.so.1'; + LIBCRYPT_SO = 'libcrypt.so.1'; + LIBC_SO = 'libc.so.6'; + LIBDB1_SO = 'libdb1.so.2'; + LIBDB2_SO = 'libdb2.so.3'; + LIBDL_SO = 'libdl.so.2'; + LIBM_SO = 'libm.so.6'; + LIBNOVERSION_SO = 'libNoVersion.so.1'; + LIBNSL_SO = 'libnsl.so.1'; + LIBNSS_COMPAT_SO = 'libnss_compat.so.2'; + LIBNSS_DNS6_SO = 'libnss_dns6.so.2'; + LIBNSS_DNS_SO = 'libnss_dns.so.2'; + LIBNSS_FILES_SO = 'libnss_files.so.2'; + LIBNSS_HESIOD_SO = 'libnss_hesiod.so.2'; + LIBNSS_LDAP_SO = 'libnss_ldap.so.2'; + LIBNSS_NISPLUS_SO = 'libnss_nisplus.so.2'; + LIBNSS_NIS_SO = 'libnss_nis.so.2'; + LIBPTHREAD_SO = 'libpthread.so.0'; + LIBRESOLV_SO = 'libresolv.so.2'; + LIBRT_SO = 'librt.so.1'; + LIBTHREAD_DB_SO = 'libthread_db.so.1'; + LIBUTIL_SO = 'libutil.so.1'; + diff --git a/jcl/source/fpc/libclite/libclite.pp b/jcl/source/fpc/libclite/libclite.pp new file mode 100644 index 0000000000..0bb8804834 --- /dev/null +++ b/jcl/source/fpc/libclite/libclite.pp @@ -0,0 +1,255 @@ +unit libclite; + +{$mode objfpc} +{$inline on} +{$h+} + +Interface + +uses unixtype; + +Const + clib = 'c'; + dllib = 'dl'; + cryptlib = 'crypt'; + threadslib = 'pthread'; + +{$i glue.inc} // C to Pascal type mappings +{$i endianh.inc} // endian.h bits/endian.h +{$i typesh.inc} // types.h sys/types.h +{$i posixopth.inc} // bits/posix_opt.h +{$i stdinth.inc} // stdint.h +{$i wordsizeh.inc} // bits/wordsize.h +{$i limitsh.inc} // limits.h +{$i posix1_limh.inc} // bits/posix1_lim.h +{$i posix2_limh.inc} // bits/posix2_lim.h +{$i xopen_limh.inc} // bits/xopen_lim.h +{$i local_limh.inc} // bits/local_lim.h +{$i inttypesh.inc} // inttypes.h +{$i errnoh.inc} // errno.h asm/errno.h bits/errno.h +{$i pathsh.inc} // paths.h +{$i lib_namesh.inc} // gnu/lib-names.h +{$i xlocaleh.inc} // xlocale.h +{$i sigcontexth.inc} // asm/sigcontext.h (from kernel) +{$i sigseth.inc} // bits/sigset.h +{$i signumh.inc} // bits/signum.h +{$i siginfoh.inc} // bits/siginfo.h +{$i sigstackh.inc} // bits/sigstack.h +{$i sigactionh.inc} // bits/sigaction.h +{$i signalh.inc} // signal.h +{$i btimeh.inc} // bits/time.h +{$i timeh.inc} // time.h +{$i stimeh.inc} // sys/time.h +{$i timexh.inc} // sys/timex.h +{$i timesh.inc} // sys/times.h +{$i bschedh.inc} // bits/sched.h +{$i schedh.inc} // sched.h +{$i pthreadtypesh.inc} // bits/pthreadtypes.h +{$i pthreadh.inc} // pthread.h +{$i sigthreadh.inc} // bits/sigthread.h +{$i semaphoreh.inc} // semaphore.h +{$i spawnh.inc} // spawn.h +{$i bfcntlh.inc} // bits/fcntl.h +{$i fcntlh.inc} // fcntl.h +{$i fileh.inc} // sys/file.h +{$i bdirenth.inc} // bits/dirent.h +{$i direnth.inc} // dirent.h +{$i bstath.inc} // bits/stat.h +{$i sstath.inc} // sys/stat.h +{$i fnmatchh.inc} // fnmatch.h +{$i gconvh.inc} // gconv.h +{$i gconfigh.inc} // _G_config.h +{$i libioh.inc} // libio.h +{$i stdioh.inc} // stdio.h +{$i stdio_limh.inc} // bits/stdio_lim.h +{$i stdio_exth.inc} // stdio_ext.h +{$i bconfnameh.inc} // bits/confname.h +{$i unistdh.inc} // unistd.h +{$i fstabh.inc} // fstab.h +{$i mntenth.inc} // mntent.h +{$i ioctlsh.inc} // bits/ioctls.h +{$i ioctl_typesh.inc} // bits/ioctl-types.h +{$i btermiosh.inc} // bits/termios.h +{$i termiosh.inc} // termios.h +{$i sttydefaultsh.inc} // sys/ttydefaults.h +{$i sioctlh.inc} // sys/ioctl.h +{ $i srawh.inc} // sys/raw.h +{$i ptyh.inc} // pty.h +{$i smounth.inc} // sys/mount.h +{$i ssysctlh.inc} // sys/sysctl.h +{$i stringh.inc} // string.h +{$i stdlibh.inc} // stdlib.h +{$i malloch.inc} // malloc.h +{$i ssysinfoh.inc} // sys/sysinfo.h +{$i bdlfcnh.inc} // bits/dlfcn.h +{$i dlfcnh.inc} // dlfcn.h +{$i localeh.inc} // locale.h +{$i nl_typesh.inc} // nl_types.h +{$i langinfoh.inc} // langinfo.h +{$i wordexph.inc} // wordexp.h +{$i iconvh.inc} // iconv.h +{$i bresourceh.inc} // bits/resource.h +{$i sresourceh.inc} // sys/resource.h +{$i argzh.inc} // argz.h +{$i envzh.inc} // envz.h +{$i ctypeh.inc} // sys/ctype.h +{$i wctypeh.inc} // wctype.h +{$i wcharh.inc} // wchar.h +{$i bwaitflagsh.inc} // bits/waitflags.h +{$i bwaitstatush.inc} // bits/waitstatus.h +{$i swaith.inc} // sys/wait.h +{$i butsnameh.inc} // bits/utsname.h +{$i sutsnameh.inc} // sys/utsname.h +{$i bmmanh.inc} // bits/mman.h +{$i smmaph.inc} // sys/mmap.h +{$i ssyslogh.inc} // sys/syslog.h +{$i glibc_versionh.inc} // from gnu/libc-version.h +{$i buioh.inc} // bits/uio.h +{$i suioh.inc} // sys/uio.h +{$i asockiosh.inc} // asm/sockios.h +{$i asocketh.inc} // asm/socket.h +{$i bsockaddrh.inc} // bits/sockaddr.h (inlined in bits/socket.h) +{$i bsocketh.inc} // bits/socket.h +{$i ssocketh.inc} // sys/socket.h +{$i sunh.inc} // sys/un.h +{$i ninh.inc} // netinet/in.h +{$i binh.inc} // bits/in.h, inlined in netinet/in.h +{$i aineth.inc} // arpa/inet.h +{$i bnetdbh.inc} // bits/netdb.h +{$i netdbh.inc} // netdb.h +// empty anyway {$i bselecth.inc} // bits/select.h +{$i sselecth.inc} // sys/select.h +{$i pwdh.inc} // pwd.h +{$i grph.inc} // grp.h +{$i sptraceh.inc} // sys/ptrace.h +{$i ulimith.inc} // ulimit.h +{$i bpollh.inc} // bits/poll.h +{$i spollh.inc} // sys/poll.h +{$i utimeh.inc} // utime.h +{$i sysexitsh.inc} // sysexits.h +{$i bustath.inc} // bits/ustat.h +{$i sustath.inc} // sys/ustat.h +{$i errh.inc} // err.h +{$i errorh.inc} // error.h +{$i bfenvh.inc} // bits/fenv.h +{$i fenvh.inc} // fenv.h +{$i bipch.inc} // bits/ipc.h +{$i sipch.inc} // sys/ipc.h +{$i bshmh.inc} // bits/shm.h +{$i sshmh.inc} // sys/shm.h +{$i bsemh.inc} // bits/sem.h +{$i ssemh.inc} // sys/sem.h +{$i libgenh.inc} // libgen.h +{$i butmph.inc} // bits/utmp.h +{$i utmph.inc} // utmp.h +{$i butmpxh.inc} // bits/utmpx.h +{$i utmpxh.inc} // utmpx.h +{$i svtimesh.inc} // sys/vtimes.h +{$i svlimith.inc} // sys/vlimit.h +{$i sucontexth.inc} // sys/ucontext.h +{$i ucontexth.inc} // ucontext.h +{$i bmsqh.inc} // bits/msq.h +{$i smsgh.inc} // sys/msg.h +{$i bstatfsh.inc} // bits/statfs.h +{$i sstatfsh.inc} // sys/statfs.h +{$i bstatvfsh.inc} // bits/statvfs.h +{$i sstatvfsh.inc} // sys/statvfs.h +{$i monetaryh.inc} // monetary.h +{$i mcheckh.inc} // mcheck.h +{$i printfh.inc} // printf.h +{$i libintlh.inc} // libintl.h +{$i shadowh.inc} // shadow.h +{$i fmtmsgh.inc} // fmtmsg.h +{$i squotah.inc} // sys/quota.h +{$i stimebh.inc} // sys/timeb.h +{$i spermh.inc} // sys/perm.h +{ $i suserh.inc} // sys/user.h // You're not supposed to use this... +{$i sswaph.inc} // sys/swap.h +{$i ssendfileh.inc} // sys/sendfile.h +{$i srebooth.inc} // sys/reboot.h +{$i aioh.inc} // aio.h +{$i aliasesh.inc} // aliases.h +{$i globh.inc} // glob.h +{$i crypth.inc} // crypt.h +{$i sfsuidh.inc} // sys/fsuid.h +{$i sklogh.inc} // sys/klog.h +{$i skdaemonh.inc} // sys/kdaemon.h +{$i saccth.inc} // sys/acct.h +{$i bstroptsh.inc} // bits/stropts.h +{$i stroptsh.inc} // stropts.h +{$i allocah.inc} // alloca.h +{$i getopth.inc} // getopt.h +{$i argph.inc} // argp.h +{$i nssh.inc} // nss.h +{$i regexh.inc} // regex.h +{ $i regexph.inc} // regexp.h // You're not supposed to use this... +{ $i netherneth.inc} // net/ethernet.h +{$i nifh.inc} // net/if.h +{$i nif_arph.inc} // net/if_arp.h +{$i nif_packeth.inc} // net/if_packet.h +{ $i nppp_defsh.inc} // net/ppp_defs.h is empty +{ $i nif_ppph.inc} // net/if_ppp.h +{ $i nif_shaperh.inc} // net/if_shaper.h +{ $i nif_slip.h} // net/if_slip.h in kerneldefs +{ $i nppp_comp.h} // net/ppp-comp.h in kerneldefs +{$i nrouteh.inc} // net/route.h +{$i nashh.inc} // netash/ash.h +{$i nath.inc} // netatalk/at.h +{$i nax25h.inc} // netax25/ax25.h +{$i nech.inc} // neteconet/ec.h +{$i nipxh.inc} // netipx/ipx.h +{$i npacketh.inc} // netpacket/packet.h +{$i nnetromh.inc} // netrom/netrom.h +{$i nroseh.inc} // netrose/rose.h +{ $i nif_etherh.inc} // netinet/if_ether.h +{ $i netherh.inc} // netinet/ether.h +{$i nicmp6h.inc} // netinet/icmp6.h +{ $i nif_fddih.inc} // netinet/if_fddi.h +{ $i nif_trh.inc} // netinet/if_tr.h +{$i nigmph.inc} // netinet/igmp.h +{$i nin_systmh.inc} // netinet/in_systm.h +{$i niph.inc} // netinet/ip.h +{$i nip6h.inc} // netinet/ip6.h +{$i nip_icmph.inc} // netinet/ip_icmp.h +{$i ntcph.inc} // netinet/tcp.h +{$i nudph.inc} // netinet/udp.h +{$i proutedh.inc} // protocols/routed.h +{$i prwhodh.inc} // protocols/rwhod.h +{$i ptalkdh.inc} // protocols/talkd.h +{ $i ptimedh.inc} // protocols/timed.h +{$i sscsih.inc} // scsi/scsi.h +{$i sscsi_ioctlh.inc} // scsi/scsi_ioctl.h +{ $i ssgh.inc} // scsi/sg.h +{$i ttyenth.inc} // ttyent.h +{$i sgttyh.inc} // sgtty.h +{$i searchh.inc} // search.h + +Implementation + +{$i types.inc} // types.h macros. +{$i cerrno.inc} // errno.h asm/errno.h bits/errno.h macros. +{$i time.inc} // bits/time.h macros. +{$i stime.inc} // sys/time.h macros. +{$i dirent.inc} // dirent.h macros. +{$i sstat.inc} // sys/stat.h macros. +{$i libio.inc} // libio.h macros. +{$i termios.inc} // termios.h macros. +{$i sttydefaults.inc} // sys/ttydefaults.h macros. +{ $i sraw.inc} // sys/raw.h macros. +{$i bwaitstatus.inc} // bits/waitstatus.h macros. +{$i ssyslog.inc} // sys/syslog.h macros. +{$i bsocket.inc} // bits/socket.h macros. +{$i sun.inc} // sys/un.h macros. +{$i nin.inc} // netinet/in.h macros. +{$i sselect.inc} // sys/select.h macros. +{$i squota.inc} // sys/quota.h macros. +{ $i nethernet.inc} // net/ethernet.h macros. +{ $i nif_ppp.inc} // net/if_ppp.h macros. +{$i nroute.inc} // net/route.h macros. +{$i nip.inc} // netinet/ip.h macros. +{ $i nif_ether.inc} // netinet/if_ether.h macros. +{$i nicmp6.inc} // netinet/icmp6.h macros. +{$i nip_icmp.inc} // netinet/ip_icmp.h macros. +{$i pthread.inc} // pthread.h Kylix compatibility. + +end. diff --git a/jcl/source/fpc/libclite/libgenh.inc b/jcl/source/fpc/libclite/libgenh.inc new file mode 100644 index 0000000000..ad17cd7496 --- /dev/null +++ b/jcl/source/fpc/libclite/libgenh.inc @@ -0,0 +1,11 @@ + + +function dirname(__path:Pchar):Pchar;cdecl;external clib name 'dirname'; +function __xpg_basename(__path:Pchar):Pchar;cdecl;external clib name '__xpg_basename'; +// maybe add later. function basename(__path:Pchar):Pchar;cdecl;external clib name '__xpg_basename'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/libintlh.inc b/jcl/source/fpc/libclite/libintlh.inc new file mode 100644 index 0000000000..913b63f466 --- /dev/null +++ b/jcl/source/fpc/libclite/libintlh.inc @@ -0,0 +1,19 @@ + + +function gettext(__msgid:Pchar):Pchar;cdecl;external clib name 'gettext'; +function dgettext(__domainname:Pchar; __msgid:Pchar):Pchar;cdecl;external clib name 'dgettext'; +function __dgettext(__domainname:Pchar; __msgid:Pchar):Pchar;cdecl;external clib name '__dgettext'; +function dcgettext(__domainname:Pchar; __msgid:Pchar; __category:longint):Pchar;cdecl;external clib name 'dcgettext'; +function __dcgettext(__domainname:Pchar; __msgid:Pchar; __category:longint):Pchar;cdecl;external clib name '__dcgettext'; +function ngettext(__msgid1:Pchar; __msgid2:Pchar; __n:dword):Pchar;cdecl;external clib name 'ngettext'; +function dngettext(__domainname:Pchar; __msgid1:Pchar; __msgid2:Pchar; __n:dword):Pchar;cdecl;external clib name 'dngettext'; +function dcngettext(__domainname:Pchar; __msgid1:Pchar; __msgid2:Pchar; __n:dword; __category:longint):Pchar;cdecl;external clib name 'dcngettext'; +function textdomain(__domainname:Pchar):Pchar;cdecl;external clib name 'textdomain'; +function bindtextdomain(__domainname:Pchar; __dirname:Pchar):Pchar;cdecl;external clib name 'bindtextdomain'; +function bind_textdomain_codeset(__domainname:Pchar; __codeset:Pchar):Pchar;cdecl;external clib name 'bind_textdomain_codeset'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/libio.inc b/jcl/source/fpc/libclite/libio.inc new file mode 100644 index 0000000000..743efa294b --- /dev/null +++ b/jcl/source/fpc/libclite/libio.inc @@ -0,0 +1,83 @@ +{ --------------------------------------------------------------------- + Macros from libio.h + ---------------------------------------------------------------------} + +Function _IO_getc_unlocked(_fp: P_IO_FILE): longint; +begin + if _fp^._IO_read_ptr>=_fp^._IO_read_end then + Result:=__uflow(_fp) + else + begin + Result:=PByte(_fp^._IO_read_ptr)^; + Inc(_fp^._IO_read_ptr); + end; +end; + + +Function _IO_peekc_unlocked(_fp: P_IO_FILE): longint; +begin + if (_fp^._IO_read_ptr>=_fp^._IO_read_end) and (__underflow(_fp) = __EOF) then + Result:=__EOF + else + Result:=PByte(_fp^._IO_read_ptr)^; +end; + + +Function _IO_putc_unlocked(_ch: Char; _fp: P_IO_FILE): longint; +begin + if _fp^._IO_write_ptr>=_fp^._IO_write_end then + Result:=__overflow(_fp, Byte(_ch)) + else + begin + Result:=Byte(_ch); + _fp^._IO_write_ptr^:=_ch; + Inc(_fp^._IO_write_ptr); + end; +end; + + +Function _IO_getwc_unlocked(_fp: P_IO_FILE): longint; +begin + if Cardinal(_fp^._wide_data^._IO_read_ptr)>=Cardinal(_fp^._wide_data^._IO_read_end) then + Result:=__wuflow(_fp) + else + begin +//!! MVC Result:=_fp^._wide_data^._IO_read_ptr^; + Inc(_fp^._wide_data^._IO_read_ptr); + end; +end; + + +Function _IO_putwc_unlocked(_wch: wchar_t; _fp: P_IO_FILE): longint; +begin +{ //!! MVC + if Cardinal(_fp^._wide_data^._IO_write_ptr)>=Cardinal(_fp^._wide_data^._IO_write_end) then + Result:=__woverflow(_fp, _wch) + else + begin + Result:=_wch; + _fp^._wide_data^._IO_write_ptr^:=_wch; + Inc(_fp^._wide_data^._IO_write_ptr); + end; +} +end; + + +Function _IO_feof_unlocked(_fp: P_IO_FILE): longint; +begin + Result:=Ord((_fp^._flags and _IO_EOF_SEEN)<>0); +end; + + +Function _IO_ferror_unlocked(_fp: P_IO_FILE): longint; +begin + Result:=Ord((_fp^._flags and _IO_ERR_SEEN)<>0); +end; + + +Function _IO_PENDING_OUTPUT_COUNT(_fp: P_IO_FILE): longint; +begin + Result:=(_fp^._IO_write_ptr)-(_fp^._IO_write_base); +end; + + diff --git a/jcl/source/fpc/libclite/libioh.inc b/jcl/source/fpc/libclite/libioh.inc new file mode 100644 index 0000000000..b0c6353cfe --- /dev/null +++ b/jcl/source/fpc/libclite/libioh.inc @@ -0,0 +1,312 @@ + +Type + _IO_pos_t = _G_fpos_t; + _IO_fpos_t = _G_fpos_t; + _IO_fpos64_t = _G_fpos64_t; + _IO_size_t = _G_size_t; + _IO_ssize_t = _G_ssize_t; + _IO_off_t = _G_off_t; + _IO_off64_t = _G_off64_t; + _IO_pid_t = _G_pid_t; + _IO_uid_t = _G_uid_t; + _IO_iconv_t = _G_iconv_t; + + P_IO_pos_t = ^_IO_pos_t; + P_IO_fpos_t = ^_IO_fpos_t; + P_IO_fpos64_t = ^_IO_fpos64_t; + P_IO_size_t = ^_IO_size_t; + P_IO_ssize_t = ^_IO_ssize_t; + P_IO_off_t = ^_IO_off_t; + P_IO_off64_t = ^_IO_off64_t; + P_IO_pid_t = ^_IO_pid_t; + P_IO_uid_t = ^_IO_uid_t; + P_IO_iconv_t = ^_IO_iconv_t; + +Const + _IO_BUFSIZ = _G_BUFSIZ; + +Type + _IO_va_list = _G_va_list; + _IO_wint_t = _G_wint_t; + + +const + _IO_UNIFIED_JUMPTABLES = 1; + _IO_USE_DTOA = 1; + + __EOF = -(1); + +const + _IOS_INPUT = 1; + _IOS_OUTPUT = 2; + _IOS_ATEND = 4; + _IOS_APPEND = 8; + _IOS_TRUNC = 16; + _IOS_NOCREATE = 32; + _IOS_NOREPLACE = 64; + _IOS_BIN = 128; + _IO_MAGIC = $FBAD0000; + _OLD_STDIO_MAGIC = $FABC0000; + _IO_MAGIC_MASK = $FFFF0000; + _IO_USER_BUF = 1; + _IO_UNBUFFERED = 2; + _IO_NO_READS = 4; + _IO_NO_WRITES = 8; + _IO_EOF_SEEN = $10; + _IO_ERR_SEEN = $20; + _IO_DELETE_DONT_CLOSE = $40; + _IO_LINKED = $80; + _IO_IN_BACKUP = $100; + _IO_LINE_BUF = $200; + _IO_TIED_PUT_GET = $400; + _IO_CURRENTLY_PUTTING = $800; + _IO_IS_APPENDING = $1000; + _IO_IS_FILEBUF = $2000; + _IO_BAD_SEEN = $4000; + _IO_USER_LOCK = $8000; + _IO_SKIPWS = 01; + _IO_LEFT = 02; + _IO_RIGHT = 04; + _IO_INTERNAL = 010; + _IO_DEC = 020; + _IO_OCT = 040; + _IO_HEX = 0100; + _IO_SHOWBASE = 0200; + _IO_SHOWPOINT = 0400; + _IO_UPPERCASE = 01000; + _IO_SHOWPOS = 02000; + _IO_SCIENTIFIC = 04000; + _IO_FIXED = 010000; + _IO_UNITBUF = 020000; + _IO_STDIO = 040000; + _IO_DONT_CLOSE = 0100000; + _IO_BOOLALPHA = 0200000; + +type + P_IO_jump_t = ^_IO_jump_t; + _IO_jump_t = record + end; + + P_IO_lock_t = ^_IO_lock_t; + _IO_lock_t = pointer; + P_IO_lock = P_IO_lock_t; +type + __codecvt_result = Longint; + +Const + __codecvt_ok = 0; + __codecvt_partial = 1; + __codecvt_error = 2; + __codecvt_noconv = 3; + +type + P_IO_codecvt = ^_IO_codecvt; + + // The following function declarations are used anonymously in the header file. + TCodeCvtDestrProc = procedure(p1: P_IO_codecvt); cdecl; + TCodeCvtDoOutFunc = function(p1: P_IO_codecvt; p2: PMultiByteState; p3, p4: Pwchar_t; p5: PPwchar_t; p6, p7: PChar; p8: PPChar): __codecvt_result; cdecl; + TCodeCvtDoUnshiftFunc = function(p1: P_IO_codecvt; p2: PMultiByteState; p3: PChar; p4: PChar; p5: PPChar): __codecvt_result; cdecl; + TCodeCvtDoInFunc = function(p1: P_IO_codecvt; p2: PMultiByteState; p3: PChar; p4: PChar; p5: PPChar; p6: Pwchar_t; p7: Pwchar_t; p8: PPwchar_t): __codecvt_result; cdecl; + TCodeCvtDoEncodingFunc = function(p1: P_IO_codecvt): Integer; cdecl; + TCodeCvtDoAlwaysNoConvFunc = function(p1: P_IO_codecvt): Integer; cdecl; + TCodeCvtDoLengthFunc = function(p1: P_IO_codecvt; p2: PMultiByteState; p3: PChar; p4: PChar; p5: _IO_size_t): Integer; cdecl; + TCodeCvtDoMaxLengthFunc = function(p1: P_IO_codecvt): Integer; cdecl; + + _IO_codecvt = record + __codecvt_destr : TCodeCvtDestrProc; + __codecvt_do_out : TCodeCvtDoOutFunc; + __codecvt_do_unshift : TCodeCvtDoUnshiftFunc; + __codecvt_do_in : TCodeCvtDoInFunc; + __codecvt_do_encoding : TCodeCvtDoEncodingFunc; + __codecvt_do_always_noconv : TCodeCvtDoAlwaysNoConvFunc; + __codecvt_do_length : TCodeCvtDoLengthFunc; + __codecvt_do_max_length : TCodeCvtDoMaxLengthFunc; + __cd_in : _IO_iconv_t; + __cd_out : _IO_iconv_t; + end; + + P_IO_wide_data = ^_IO_wide_data; + _IO_wide_data = record + _IO_read_ptr : Pwchar_t; + _IO_read_end : Pwchar_t; + _IO_read_base : Pwchar_t; + _IO_write_base : Pwchar_t; + _IO_write_ptr : Pwchar_t; + _IO_write_end : Pwchar_t; + _IO_buf_base : Pwchar_t; + _IO_buf_end : Pwchar_t; + _IO_save_base : Pwchar_t; + _IO_backup_base : Pwchar_t; + _IO_save_end : Pwchar_t; + _IO_state : __mbstate_t; + _IO_last_state : __mbstate_t; + _codecvt : _IO_codecvt; + _shortbuf : array[0..0] of wchar_t; + _wide_vtable : P_IO_jump_t; + end; + + P_IO_FILE = ^_IO_FILE; + PIOMarker = ^_IO_marker; + _IO_marker = {packed} record + _next: PIOMarker; + _sbuf: P_IO_File; + _pos: Integer; + end; + + _IO_FILE = {packed} record + _flags: Longint; + _IO_read_ptr: PChar; + _IO_read_end: PChar; + _IO_read_base: PChar; + _IO_write_base: PChar; + _IO_write_ptr: PChar; + _IO_write_end: PChar; + _IO_buf_base: PChar; + _IO_buf_end: PChar; + _IO_save_base: PChar; + _IO_backup_base: PChar; + _IO_save_end: PChar; + _markers: PIOMarker; + _chain: P_IO_File; + _fileno: Integer; + _blksize: Integer; + _old_offset: _IO_off_t; + _cur_column: word; + _vtable_offset: shortint; + _shortbuf: packed array[0..1-1] of Char; + _lock: P_IO_Lock; + _offset: _IO_off64_t; + _codecvt: ^_IO_codecvt; + _wide_data: ^_IO_wide_data; + _mode: longint; + _unused2: packed array[0..(15*SizeOf(Integer) - 2*SizeOf(Pointer))-1] of Byte; + end; + + P_IO_FILE_complete = ^_IO_FILE_complete; + _IO_FILE_complete = record + _file : _IO_FILE; + _offset : _IO_off64_t; + _codecvt : P_IO_codecvt; + _wide_data : P_IO_wide_data; + __pad1 : pointer; + __pad2 : pointer; + _mode : longint; + end; + + P_IO_FILE_plus = ^_IO_FILE_plus; + _IO_FILE_plus = record + {undefined structure} + end; + +var + _IO_2_1_stdin_ : _IO_FILE_plus;cvar;external; + _IO_2_1_stdout_ : _IO_FILE_plus;cvar;external; + _IO_2_1_stderr_ : _IO_FILE_plus;cvar;external; + + _IO_stdin : P_IO_FILE;cvar;external; + _IO_stdout : P_IO_FILE;cvar;external; + _IO_stderr : P_IO_FILE;cvar;external; + +type + __io_read_fn = function(__cookie: Pointer; __buf: PChar; __nbytes: size_t): __ssize_t; cdecl; + __io_write_fn = function(__cookie: Pointer; __buf: PChar; __n: size_t): __ssize_t; cdecl; + __io_seek_fn = function(__cookie: Pointer; __pos: P_IO_off64_t; __w: Integer): Integer; cdecl; + __io_close_fn = function(__cookie: Pointer): Integer; cdecl; + + + Pcookie_read_function_t = ^cookie_read_function_t; + cookie_read_function_t = __io_read_fn; + + Pcookie_write_function_t = ^cookie_write_function_t; + cookie_write_function_t = __io_write_fn; + + Pcookie_seek_function_t = ^cookie_seek_function_t; + cookie_seek_function_t = __io_seek_fn; + + Pcookie_close_function_t = ^cookie_close_function_t; + cookie_close_function_t = __io_close_fn; + + P_IO_cookie_io_functions_t = ^_IO_cookie_io_functions_t; + _IO_cookie_io_functions_t = record + read : __io_read_fn; + write : __io_write_fn; + seek : __io_seek_fn; + close : __io_close_fn; + end; + + Pcookie_io_functions_t = ^cookie_io_functions_t; + cookie_io_functions_t = _IO_cookie_io_functions_t; + P_IO_cookie_file = ^_IO_cookie_file; + _IO_cookie_file = record + _file: _IO_FILE; + vtable: Pointer; + cookie: Pointer; + io_functions: _IO_cookie_io_functions_t; + end; + + +function __underflow(_para1:P_IO_FILE):longint;cdecl;external clib name '__underflow'; +function __uflow(_para1:P_IO_FILE):longint;cdecl;external clib name '__uflow'; +function __overflow(_para1:P_IO_FILE; _para2:longint):longint;cdecl;external clib name '__overflow'; +function __wunderflow(_para1:P_IO_FILE):_IO_wint_t;cdecl;external clib name '__wunderflow'; +function __wuflow(_para1:P_IO_FILE):_IO_wint_t;cdecl;external clib name '__wuflow'; +function __woverflow(_para1:P_IO_FILE; _para2:_IO_wint_t):_IO_wint_t;cdecl;external clib name '__woverflow'; + +function _IO_getc_unlocked(_fp: P_IO_File): Longint; +function _IO_peekc_unlocked(_fp: P_IO_File): Longint; +function _IO_putc_unlocked(_ch: Char; _fp: P_IO_File): Longint; + +function _IO_getwc_unlocked(_fp: P_IO_File): Longint; +function _IO_putwc_unlocked(_wch: wchar_t; _fp: P_IO_File): Longint; + +function _IO_feof_unlocked(_fp: P_IO_File): Longint; +function _IO_ferror_unlocked(_fp: P_IO_File): Longint; + +function _IO_getc(__fp:P_IO_FILE):longint;cdecl;external clib name '_IO_getc'; +function _IO_putc(__c:longint; __fp:P_IO_FILE):longint;cdecl;external clib name '_IO_putc'; +function _IO_feof(__fp:P_IO_FILE):longint;cdecl;external clib name '_IO_feof'; +function _IO_ferror(__fp:P_IO_FILE):longint;cdecl;external clib name '_IO_ferror'; +function _IO_peekc_locked(__fp:P_IO_FILE):longint;cdecl;external clib name '_IO_peekc_locked'; + +function _IO_PENDING_OUTPUT_COUNT(_fp : P_IO_File) : longint; + +procedure _IO_flockfile(_para1:P_IO_FILE);cdecl;external clib name '_IO_flockfile'; +procedure _IO_funlockfile(_para1:P_IO_FILE);cdecl;external clib name '_IO_funlockfile'; +function _IO_ftrylockfile(_para1:P_IO_FILE):longint;cdecl;external clib name '_IO_ftrylockfile'; + +function _IO_vfscanf(_para1:P_IO_FILE; _para2:Pchar; _para3:_IO_va_list; _para4:Plongint):longint;cdecl;external clib name '_IO_vfscanf'; +function _IO_vfprintf(_para1:P_IO_FILE; _para2:Pchar; _para3:_IO_va_list):longint;cdecl;external clib name '_IO_vfprintf'; +function _IO_padn(_para1:P_IO_FILE; _para2:longint; _para3:_IO_ssize_t):_IO_ssize_t;cdecl;external clib name '_IO_padn'; +function _IO_sgetn(_para1:P_IO_FILE; _para2:pointer; _para3:_IO_size_t):_IO_size_t;cdecl;external clib name '_IO_sgetn'; +function _IO_seekoff(_para1:P_IO_FILE; _para2:_IO_off64_t; _para3:longint; _para4:longint):_IO_off64_t;cdecl;external clib name '_IO_seekoff'; +function _IO_seekpos(_para1:P_IO_FILE; _para2:_IO_off64_t; _para3:longint):_IO_off64_t;cdecl;external clib name '_IO_seekpos'; +procedure _IO_free_backup_area(_para1:P_IO_FILE);cdecl;external clib name '_IO_free_backup_area'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + + Type + TIOLock = _IO_lock_t; + PIOLock = ^TIOLock; + + TIOCodeVect = _IO_codecvt; + PIOCodeVect = ^TIOCodeVect; + + TCodeCvtDoOutProc = TCodeCvtDoOutFunc; + TCodeCvtDoUnshiftProc = TCodeCvtDoUnshiftFunc; + TCodeCvtDoInProc = TCodeCvtDoInFunc; + TCodeCvtDoEncodingProc = TCodeCvtDoEncodingFunc; + TCodeCvtDoAlwaysNoConvProc = TCodeCvtDoAlwaysNoConvFunc; + TCodeCvtDoLengthProc = TCodeCvtDoLengthFunc; + TCodeCvtDoMaxLengthProc = TCodeCvtDoMaxLengthFunc; + + TIOFile = _IO_FILE; + PIOFile = ^TIOFile; + + TIOCookieFunctions = _IO_cookie_io_functions_t; + PIOCookieFunctions = ^TIOCookieFunctions; + + TIOCookieFile = _IO_cookie_file; + PIOCookieFile = ^TIOCookieFile; + diff --git a/jcl/source/fpc/libclite/limitsh.inc b/jcl/source/fpc/libclite/limitsh.inc new file mode 100644 index 0000000000..98167834ea --- /dev/null +++ b/jcl/source/fpc/libclite/limitsh.inc @@ -0,0 +1,23 @@ + +const + MB_LEN_MAX = 16; + CHAR_BIT = 8; + SCHAR_MIN = -(128); + SCHAR_MAX = 127; + UCHAR_MAX = 255; + CHAR_MIN = SCHAR_MIN; + CHAR_MAX = SCHAR_MAX; + + SHRT_MIN = -(32768); + SHRT_MAX = 32767; + USHRT_MAX = 65535; + INT_MAX = 2147483647; + INT_MIN = (-(INT_MAX)) - 1; + UINT_MAX = 4294967295; + LONG_MAX = 2147483647; + + LONG_MIN = (-(LONG_MAX)) - 1; + ULONG_MAX = 4294967295; + LLONG_MAX = QWord(9223372036854775807); + LLONG_MIN = (-LLONG_MAX - 1); + ULLONG_MAX = 18446744073709551615; diff --git a/jcl/source/fpc/libclite/local_limh.inc b/jcl/source/fpc/libclite/local_limh.inc new file mode 100644 index 0000000000..8e47bb82e5 --- /dev/null +++ b/jcl/source/fpc/libclite/local_limh.inc @@ -0,0 +1,12 @@ + +const + _POSIX_THREAD_KEYS_MAX = 128; + PTHREAD_KEYS_MAX = 1024; + _POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4; + PTHREAD_DESTRUCTOR_ITERATIONS = _POSIX_THREAD_DESTRUCTOR_ITERATIONS; + _POSIX_THREAD_THREADS_MAX = 64; + PTHREAD_THREADS_MAX = 1024; + AIO_PRIO_DELTA_MAX = 20; + PTHREAD_STACK_MIN = 16384; + TIMER_MAX = 256; + diff --git a/jcl/source/fpc/libclite/localeh.inc b/jcl/source/fpc/libclite/localeh.inc new file mode 100644 index 0000000000..81d459a52d --- /dev/null +++ b/jcl/source/fpc/libclite/localeh.inc @@ -0,0 +1,79 @@ + +const + __LC_CTYPE = 0; + __LC_NUMERIC = 1; + __LC_TIME = 2; + __LC_COLLATE = 3; + __LC_MONETARY = 4; + __LC_MESSAGES = 5; + __LC_ALL = 6; + __LC_PAPER = 7; + __LC_NAME = 8; + __LC_ADDRESS = 9; + __LC_TELEPHONE = 10; + __LC_MEASUREMENT = 11; + __LC_IDENTIFICATION = 12; + + LC_CTYPE = __LC_CTYPE; + LC_NUMERIC = __LC_NUMERIC; + LC_TIME = __LC_TIME; + LC_COLLATE = __LC_COLLATE; + LC_MONETARY = __LC_MONETARY; + LC_MESSAGES = __LC_MESSAGES; + LC_ALL = __LC_ALL; + LC_PAPER = __LC_PAPER; + LC_NAME = __LC_NAME; + LC_ADDRESS = __LC_ADDRESS; + LC_TELEPHONE = __LC_TELEPHONE; + LC_MEASUREMENT = __LC_MEASUREMENT; + LC_IDENTIFICATION = __LC_IDENTIFICATION; + +type + Plconv = ^lconv; + lconv = record + decimal_point : Pchar; + thousands_sep : Pchar; + grouping : Pchar; + int_curr_symbol : Pchar; + currency_symbol : Pchar; + mon_decimal_point : Pchar; + mon_thousands_sep : Pchar; + mon_grouping : Pchar; + positive_sign : Pchar; + negative_sign : Pchar; + int_frac_digits : char; + frac_digits : char; + p_cs_precedes : char; + p_sep_by_space : char; + n_cs_precedes : char; + n_sep_by_space : char; + p_sign_posn : char; + n_sign_posn : char; + int_p_cs_precedes : char; + int_p_sep_by_space : char; + int_n_cs_precedes : char; + int_n_sep_by_space : char; + int_p_sign_posn : char; + int_n_sign_posn : char; + __int_p_cs_precedes : char; + __int_p_sep_by_space : char; + __int_n_cs_precedes : char; + __int_n_sep_by_space : char; + __int_p_sign_posn : char; + __int_n_sign_posn : char; + end; + + +function setlocale(__category:longint; __locale:Pchar):Pchar;cdecl;external clib name 'setlocale'; +function localeconv:Plconv;cdecl;external clib name 'localeconv'; +function __newlocale(__category_mask:longint; __locale:Pchar; __base:__locale_t):__locale_t;cdecl;external clib name '__newlocale'; +function __duplocale(__dataset:__locale_t):__locale_t;cdecl;external clib name '__duplocale'; +procedure __freelocale(__dataset:__locale_t);cdecl;external clib name '__freelocale'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TLConv = lconv; + _lconv = lconv; diff --git a/jcl/source/fpc/libclite/malloch.inc b/jcl/source/fpc/libclite/malloch.inc new file mode 100644 index 0000000000..6c25c02826 --- /dev/null +++ b/jcl/source/fpc/libclite/malloch.inc @@ -0,0 +1,76 @@ + +var + __malloc_initialized : longint;cvar;external; + +function malloc(__size:size_t):pointer;cdecl;external clib name 'malloc'; +function calloc(__nmemb:size_t; __size:size_t):pointer;cdecl;external clib name 'calloc'; +function realloc(__ptr:pointer; __size:size_t):pointer;cdecl;external clib name 'realloc'; +procedure free(__ptr:pointer);cdecl;external clib name 'free'; +procedure cfree(__ptr:pointer);cdecl;external clib name 'cfree'; +function memalign(__alignment:size_t; __size:size_t):pointer;cdecl;external clib name 'memalign'; +function valloc(__size:size_t):pointer;cdecl;external clib name 'valloc'; +function pvalloc(__size:size_t):pointer;cdecl;external clib name 'pvalloc'; + +var + __morecore : function (__size:ptrdiff_t):pointer;cvar;external; + +function __default_morecore(__size:ptrdiff_t):pointer;cdecl;external clib name '__default_morecore'; + +type + Pmallinfo = ^_mallinfo; + _mallinfo = record + arena : longint; + ordblks : longint; + smblks : longint; + hblks : longint; + hblkhd : longint; + usmblks : longint; + fsmblks : longint; + uordblks : longint; + fordblks : longint; + keepcost : longint; + end; + +// not sure about this one ? Returns struct value?? +function mallinfo:_mallinfo;cdecl;external clib name 'mallinfo'; + +const + M_MXFAST = 1; + M_NLBLKS = 2; + M_GRAIN = 3; + M_KEEP = 4; + + M_TRIM_THRESHOLD = -1; + M_TOP_PAD = -2; + M_MMAP_THRESHOLD = -3; + M_MMAP_MAX = -4; + M_CHECK_ACTION = -5; + + +function mallopt(__param:longint; __val:longint):longint;cdecl;external clib name 'mallopt'; +function malloc_trim(__pad:size_t):longint;cdecl;external clib name 'malloc_trim'; +function malloc_usable_size(__ptr:pointer):size_t;cdecl;external clib name 'malloc_usable_size'; +procedure malloc_stats;cdecl;external clib name 'malloc_stats'; +function malloc_get_state:pointer;cdecl;external clib name 'malloc_get_state'; +function malloc_set_state(__ptr:pointer):longint;cdecl;external clib name 'malloc_set_state'; + +var + __malloc_initialize_hook : procedure ;cvar;external; + __free_hook : procedure (__ptr:pointer; _para2:pointer);cvar;external; + __malloc_hook : function (__size:size_t; _para2:pointer):pointer;cvar;external; + __realloc_hook : function (__ptr:pointer; __size:size_t; _para3:pointer):pointer;cvar;external; + __memalign_hook : function (__alignment:size_t; __size:size_t; _para3:pointer):pointer;cvar;external; + __after_morecore_hook : procedure ;cvar;external; + +procedure __malloc_check_init;cdecl;external clib name '__malloc_check_init'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TMallocInfo = _mallinfo; + PMallocInfo = ^TMallocInfo; + + diff --git a/jcl/source/fpc/libclite/mcheckh.inc b/jcl/source/fpc/libclite/mcheckh.inc new file mode 100644 index 0000000000..737b23eb04 --- /dev/null +++ b/jcl/source/fpc/libclite/mcheckh.inc @@ -0,0 +1,27 @@ + +type + mcheck_status = ( + MCHECK_DISABLED := -(1), + MCHECK_OK := 0, + MCHECK_FREE := 1, + MCHECK_HEAD := 2, + MCHECK_TAIL := 3 + ); + +type + TMemCheckAbortProc = procedure(MCheckStatus: mcheck_status); cdecl; // Used anonymously in header file + + +function mcheck(__abortfunc: TMemCheckAbortProc):longint;cdecl;external clib name 'mcheck'; +function mcheck_pedantic(__abortfunc:TMemCheckAbortProc):longint;cdecl;external clib name 'mcheck_pedantic'; +procedure mcheck_check_all;cdecl;external clib name 'mcheck_check_all'; +function mprobe(__ptr:pointer):mcheck_status;cdecl;external clib name 'mprobe'; +procedure mtrace;cdecl;external clib name 'mtrace'; +procedure muntrace;cdecl;external clib name 'muntrace'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/mntenth.inc b/jcl/source/fpc/libclite/mntenth.inc new file mode 100644 index 0000000000..3e79efa61c --- /dev/null +++ b/jcl/source/fpc/libclite/mntenth.inc @@ -0,0 +1,48 @@ + + +const + MNTTAB = _PATH_MNTTAB; + MOUNTED = _PATH_MOUNTED; + MNTTYPE_IGNORE = 'ignore'; + MNTTYPE_NFS = 'nfs'; + MNTTYPE_SWAP = 'swap'; + MNTOPT_DEFAULTS = 'defaults'; + MNTOPT_RO = 'ro'; + MNTOPT_RW = 'rw'; + MNTOPT_SUID = 'suid'; + MNTOPT_NOSUID = 'nosuid'; + MNTOPT_NOAUTO = 'noauto'; + +type + Pmntent = ^mntent; + mntent = record + mnt_fsname : Pchar; + mnt_dir : Pchar; + mnt_type : Pchar; + mnt_opts : Pchar; + mnt_freq : longint; + mnt_passno : longint; + end; + + +function setmntent(__file:Pchar; __mode:Pchar):PFILE;cdecl;external clib name 'setmntent'; +function getmntent(__stream:PFILE):Pmntent;cdecl;external clib name 'getmntent'; +function getmntent_r(__stream:PFILE; __result:Pmntent; __buffer:Pchar; __bufsize:longint):Pmntent;cdecl;external clib name 'getmntent_r'; + +function addmntent(__stream:PFILE; __mnt:Pmntent):longint;cdecl;external clib name 'addmntent'; +function endmntent(__stream:PFILE):longint;cdecl;external clib name 'endmntent'; +function hasmntopt(__mnt:Pmntent; __opt:Pchar):Pchar;cdecl;external clib name 'hasmntopt'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TMountEntry = mntent; + PMountEntry = ^TMountEntry; + +function getmntent_r(__stream:PFILE; var __result: mntent; __buffer:Pchar; __bufsize:longint):Pmntent;cdecl;external clib name 'getmntent_r'; +function addmntent(__stream:PFILE; const __mnt: mntent):longint;cdecl;external clib name 'addmntent'; +function hasmntopt(const __mnt: mntent; __opt:Pchar):Pchar;cdecl;external clib name 'hasmntopt'; + diff --git a/jcl/source/fpc/libclite/monetaryh.inc b/jcl/source/fpc/libclite/monetaryh.inc new file mode 100644 index 0000000000..0a6a0d49a0 --- /dev/null +++ b/jcl/source/fpc/libclite/monetaryh.inc @@ -0,0 +1,13 @@ + + +function strfmon(__s:Pchar; __maxsize:size_t; __format:Pchar; args:array of const):ssize_t;cdecl;external clib name 'strfmon'; +function strfmon(__s:Pchar; __maxsize:size_t; __format:Pchar):ssize_t;cdecl;varargs;external clib name 'strfmon'; +function __strfmon_l(__s:Pchar; __maxsize:size_t; loc:__locale_t; __format:Pchar; args:array of const):ssize_t;cdecl;external clib name '__strfmon_l'; +function __strfmon_l(__s:Pchar; __maxsize:size_t; loc:__locale_t; __format:Pchar):ssize_t;cdecl;varargs;external clib name '__strfmon_l'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nashh.inc b/jcl/source/fpc/libclite/nashh.inc new file mode 100644 index 0000000000..f62f1303bd --- /dev/null +++ b/jcl/source/fpc/libclite/nashh.inc @@ -0,0 +1,22 @@ + +type + Psockaddr_ash = ^sockaddr_ash; + sockaddr_ash = record + sash_family : sa_family_t; + sash_ifindex : longint; + sash_channel : byte; + sash_plen : dword; + sash_prefix : array[0..15] of byte; + end; + + +const + ASH_CHANNEL_ANY = 0; + ASH_CHANNEL_CONTROL = 1; + ASH_CHANNEL_REALTIME = 2; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nath.inc b/jcl/source/fpc/libclite/nath.inc new file mode 100644 index 0000000000..fc3d341d52 --- /dev/null +++ b/jcl/source/fpc/libclite/nath.inc @@ -0,0 +1,10 @@ + +const + SOL_ATALK = 258; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nax25h.inc b/jcl/source/fpc/libclite/nax25h.inc new file mode 100644 index 0000000000..5b5c481057 --- /dev/null +++ b/jcl/source/fpc/libclite/nax25h.inc @@ -0,0 +1,144 @@ + +const + SOL_AX25 = 257; + AX25_WINDOW = 1; + AX25_T1 = 2; + AX25_T2 = 5; + AX25_T3 = 4; + AX25_N2 = 3; + AX25_BACKOFF = 6; + AX25_EXTSEQ = 7; + AX25_PIDINCL = 8; + AX25_IDLE = 9; + AX25_PACLEN = 10; + AX25_IPMAXQUEUE = 11; + AX25_IAMDIGI = 12; + AX25_KILL = 99; + SIOCAX25GETUID = SIOCPROTOPRIVATE; + SIOCAX25ADDUID = SIOCPROTOPRIVATE + 1; + SIOCAX25DELUID = SIOCPROTOPRIVATE + 2; + SIOCAX25NOUID = SIOCPROTOPRIVATE + 3; + SIOCAX25BPQADDR = SIOCPROTOPRIVATE + 4; + SIOCAX25GETPARMS = SIOCPROTOPRIVATE + 5; + SIOCAX25SETPARMS = SIOCPROTOPRIVATE + 6; + SIOCAX25OPTRT = SIOCPROTOPRIVATE + 7; + SIOCAX25CTLCON = SIOCPROTOPRIVATE + 8; + SIOCAX25GETINFO = SIOCPROTOPRIVATE + 9; + SIOCAX25ADDFWD = SIOCPROTOPRIVATE + 10; + SIOCAX25DELFWD = SIOCPROTOPRIVATE + 11; + AX25_NOUID_DEFAULT = 0; + AX25_NOUID_BLOCK = 1; + AX25_SET_RT_IPMODE = 2; + AX25_DIGI_INBAND = $01; + AX25_DIGI_XBAND = $02; + AX25_MAX_DIGIS = 8; + +type + + Pax25_address = ^ax25_address; + ax25_address = record + ax25_call : array[0..6] of char; + end; + Psockaddr_ax25 = ^sockaddr_ax25; + sockaddr_ax25 = record + sax25_family : sa_family_t; + sax25_call : ax25_address; + sax25_ndigis : longint; + end; + + Pfull_sockaddr_ax25 = ^full_sockaddr_ax25; + full_sockaddr_ax25 = record + fsa_ax25 : sockaddr_ax25; + fsa_digipeater : array[0..(AX25_MAX_DIGIS)-1] of ax25_address; + end; + + +type + Pax25_routes_struct = ^ax25_routes_struct; + ax25_routes_struct = record + port_addr : ax25_address; + dest_addr : ax25_address; + digi_count : byte; + digi_addr : array[0..(AX25_MAX_DIGIS)-1] of ax25_address; + end; + + Pax25_ctl_struct = ^ax25_ctl_struct; + ax25_ctl_struct = record + port_addr : ax25_address; + source_addr : ax25_address; + dest_addr : ax25_address; + cmd : dword; + arg : dword; + digi_count : byte; + digi_addr : array[0..(AX25_MAX_DIGIS)-1] of ax25_address; + end; + + Pax25_info_struct = ^ax25_info_struct; + ax25_info_struct = record + n2 : dword; + n2count : dword; + t1 : dword; + t1timer : dword; + t2 : dword; + t2timer : dword; + t3 : dword; + t3timer : dword; + idle : dword; + idletimer : dword; + state : dword; + rcv_q : dword; + snd_q : dword; + end; + + Pax25_fwd_struct = ^ax25_fwd_struct; + ax25_fwd_struct = record + port_from : ax25_address; + port_to : ax25_address; + end; + + Pax25_route_opt_struct = ^ax25_route_opt_struct; + ax25_route_opt_struct = record + port_addr : ax25_address; + dest_addr : ax25_address; + cmd : longint; + arg : longint; + end; + + Pax25_bpqaddr_struct = ^ax25_bpqaddr_struct; + ax25_bpqaddr_struct = record + dev : array[0..15] of char; + addr : ax25_address; + end; + + +const + AX25_VALUES_IPDEFMODE = 0; + AX25_VALUES_AXDEFMODE = 1; + AX25_VALUES_NETROM = 2; + AX25_VALUES_TEXT = 3; + AX25_VALUES_BACKOFF = 4; + AX25_VALUES_CONMODE = 5; + AX25_VALUES_WINDOW = 6; + AX25_VALUES_EWINDOW = 7; + AX25_VALUES_T1 = 8; + AX25_VALUES_T2 = 9; + AX25_VALUES_T3 = 10; + AX25_VALUES_N2 = 11; + AX25_VALUES_DIGI = 12; + AX25_VALUES_IDLE = 13; + AX25_VALUES_PACLEN = 14; + AX25_VALUES_IPMAXQUEUE = 15; + AX25_MAX_VALUES = 20; +type + Pax25_parms_struct = ^ax25_parms_struct; + ax25_parms_struct = record + port_addr : ax25_address; + values : array[0..(AX25_MAX_VALUES)-1] of word; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nech.inc b/jcl/source/fpc/libclite/nech.inc new file mode 100644 index 0000000000..b2f385351f --- /dev/null +++ b/jcl/source/fpc/libclite/nech.inc @@ -0,0 +1,34 @@ + +type + Pec_addr = ^ec_addr; + ec_addr = record + station : byte; + net : byte; + end; + + Psockaddr_ec = ^sockaddr_ec; + sockaddr_ec = record + sec_family : sa_family_t; + port : byte; + cb : byte; + _type : byte; + addr : ec_addr; + cookie : dword; + end; + + +const + ECTYPE_PACKET_RECEIVED = 0; + ECTYPE_TRANSMIT_STATUS = $10; + ECTYPE_TRANSMIT_OK = 1; + ECTYPE_TRANSMIT_NOT_LISTENING = 2; + ECTYPE_TRANSMIT_NET_ERROR = 3; + ECTYPE_TRANSMIT_NO_CLOCK = 4; + ECTYPE_TRANSMIT_LINE_JAMMED = 5; + ECTYPE_TRANSMIT_NOT_PRESENT = 6; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/netdbh.inc b/jcl/source/fpc/libclite/netdbh.inc new file mode 100644 index 0000000000..0e1cb1a35e --- /dev/null +++ b/jcl/source/fpc/libclite/netdbh.inc @@ -0,0 +1,199 @@ + + +const + _PATH_HEQUIV = '/etc/hosts.equiv'; + _PATH_HOSTS = '/etc/hosts'; + _PATH_NETWORKS = '/etc/networks'; + _PATH_NSSWITCH_CONF = '/etc/nsswitch.conf'; + _PATH_PROTOCOLS = '/etc/protocols'; + _PATH_SERVICES = '/etc/services'; + +var + h_errno : longint;cvar;external; + +function __h_errno_location:Plongint;cdecl;external clib name '__h_errno_location'; + +const + NETDB_INTERNAL = -(1); + NETDB_SUCCESS = 0; + HOST_NOT_FOUND = 1; + TRY_AGAIN = 2; + NO_RECOVERY = 3; + NO_DATA = 4; + NO_ADDRESS = NO_DATA; + SCOPE_DELIMITER = '%'; + +procedure herror(__str:Pchar);cdecl;external clib name 'herror'; +function hstrerror(__err_num:longint):Pchar;cdecl;external clib name 'hstrerror'; + +type + Phostent = ^hostent; + hostent = record + h_name: PChar; + h_aliases: PPChar; + h_addrtype: Integer; + h_length: socklen_t; + case Byte of + 0: (h_addr_list: PPChar); + 1: (h_addr: PPChar); + end; + PPhostent = ^Phostent; + +procedure sethostent(__stay_open:longint);cdecl;external clib name 'sethostent'; +procedure endhostent;cdecl;external clib name 'endhostent'; +function gethostent:Phostent;cdecl;external clib name 'gethostent'; +function gethostbyaddr(__addr:pointer; __len:__socklen_t; __type:longint):Phostent;cdecl;external clib name 'gethostbyaddr'; +function gethostbyname(__name:Pchar):Phostent;cdecl;external clib name 'gethostbyname'; +function gethostbyname2(__name:Pchar; __af:longint):Phostent;cdecl;external clib name 'gethostbyname2'; +function gethostent_r(__result_buf:Phostent; __buf:Pchar; __buflen:size_t; __result:PPhostent; __h_errnop:Plongint):longint;cdecl;external clib name 'gethostent_r'; +function gethostbyaddr_r(__addr:pointer; __len:__socklen_t; __type:longint; __result_buf:Phostent; __buf:Pchar; + __buflen:size_t; __result:PPhostent; __h_errnop:Plongint):longint;cdecl;external clib name 'gethostbyaddr_r'; +function gethostbyname_r(__name:Pchar; __result_buf:Phostent; __buf:Pchar; __buflen:size_t; __result:PPhostent; + __h_errnop:Plongint):longint;cdecl;external clib name 'gethostbyname_r'; +function gethostbyname2_r(__name:Pchar; __af:longint; __result_buf:Phostent; __buf:Pchar; __buflen:size_t; + __result:PPhostent; __h_errnop:Plongint):longint;cdecl;external clib name 'gethostbyname2_r'; +procedure setnetent(__stay_open:longint);cdecl;external clib name 'setnetent'; +procedure endnetent;cdecl;external clib name 'endnetent'; +function getnetent:Pnetent;cdecl;external clib name 'getnetent'; +function getnetbyaddr(__net:uint32_t; __type:longint):Pnetent;cdecl;external clib name 'getnetbyaddr'; +function getnetbyname(__name:Pchar):Pnetent;cdecl;external clib name 'getnetbyname'; +function getnetent_r(__result_buf:Pnetent; __buf:Pchar; __buflen:size_t; __result:PPnetent; __h_errnop:Plongint):longint;cdecl;external clib name 'getnetent_r'; +function getnetbyaddr_r(__net:uint32_t; __type:longint; __result_buf:Pnetent; __buf:Pchar; __buflen:size_t; + __result:PPnetent; __h_errnop:Plongint):longint;cdecl;external clib name 'getnetbyaddr_r'; +function getnetbyname_r(__name:Pchar; __result_buf:Pnetent; __buf:Pchar; __buflen:size_t; __result:PPnetent; + __h_errnop:Plongint):longint;cdecl;external clib name 'getnetbyname_r'; +type + Pservent = ^servent; + servent = record + s_name : Pchar; + s_aliases : ^Pchar; + s_port : longint; + s_proto : Pchar; + end; + PPservent = ^Pservent; + +procedure setservent(__stay_open:longint);cdecl;external clib name 'setservent'; +procedure endservent;cdecl;external clib name 'endservent'; +function getservent:Pservent;cdecl;external clib name 'getservent'; +function getservbyname(__name:Pchar; __proto:Pchar):Pservent;cdecl;external clib name 'getservbyname'; +function getservbyport(__port:longint; __proto:Pchar):Pservent;cdecl;external clib name 'getservbyport'; +function getservent_r(__result_buf:Pservent; __buf:Pchar; __buflen:size_t; __result:PPservent):longint;cdecl;external clib name 'getservent_r'; +function getservbyname_r(__name:Pchar; __proto:Pchar; __result_buf:Pservent; __buf:Pchar; __buflen:size_t; + __result:PPservent):longint;cdecl;external clib name 'getservbyname_r'; +function getservbyport_r(__port:longint; __proto:Pchar; __result_buf:Pservent; __buf:Pchar; __buflen:size_t; + __result:PPservent):longint;cdecl;external clib name 'getservbyport_r'; +type + Pprotoent = ^protoent; + protoent = record + p_name : Pchar; + p_aliases : ^Pchar; + p_proto : longint; + end; + PPprotoent = ^Pprotoent; + +procedure setprotoent(__stay_open:longint);cdecl;external clib name 'setprotoent'; +procedure endprotoent;cdecl;external clib name 'endprotoent'; +function getprotoent:Pprotoent;cdecl;external clib name 'getprotoent'; +function getprotobyname(__name:Pchar):Pprotoent;cdecl;external clib name 'getprotobyname'; +function getprotobynumber(__proto:longint):Pprotoent;cdecl;external clib name 'getprotobynumber'; +function getprotoent_r(__result_buf:Pprotoent; __buf:Pchar; __buflen:size_t; __result:PPprotoent):longint;cdecl;external clib name 'getprotoent_r'; +function getprotobyname_r(__name:Pchar; __result_buf:Pprotoent; __buf:Pchar; __buflen:size_t; __result:PPprotoent):longint;cdecl;external clib name 'getprotobyname_r'; +function getprotobynumber_r(__proto:longint; __result_buf:Pprotoent; __buf:Pchar; __buflen:size_t; __result:PPprotoent):longint;cdecl;external clib name 'getprotobynumber_r'; +function setnetgrent(__netgroup:Pchar):longint;cdecl;external clib name 'setnetgrent'; +procedure endnetgrent;cdecl;external clib name 'endnetgrent'; +function getnetgrent(__hostp:PPchar; __userp:PPchar; __domainp:PPchar):longint;cdecl;external clib name 'getnetgrent'; +function innetgr(__netgroup:Pchar; __host:Pchar; __user:Pchar; domain:Pchar):longint;cdecl;external clib name 'innetgr'; +function getnetgrent_r(__hostp:PPchar; __userp:PPchar; __domainp:PPchar; __buffer:Pchar; __buflen:size_t):longint;cdecl;external clib name 'getnetgrent_r'; + +function rcmd(__ahost:PPchar; __rport:word; __locuser:Pchar; __remuser:Pchar; __cmd:Pchar; + __fd2p:Plongint):longint;cdecl;external clib name 'rcmd'; +function rcmd_af(__ahost:PPchar; __rport:word; __locuser:Pchar; __remuser:Pchar; __cmd:Pchar; + __fd2p:Plongint; __af:sa_family_t):longint;cdecl;external clib name 'rcmd_af'; +function rexec(__ahost:PPchar; __rport:longint; __name:Pchar; __pass:Pchar; __cmd:Pchar; + __fd2p:Plongint):longint;cdecl;external clib name 'rexec'; +function rexec_af(__ahost:PPchar; __rport:longint; __name:Pchar; __pass:Pchar; __cmd:Pchar; + __fd2p:Plongint; __af:sa_family_t):longint;cdecl;external clib name 'rexec_af'; +function ruserok(__rhost:Pchar; __suser:longint; __remuser:Pchar; __locuser:Pchar):longint;cdecl;external clib name 'ruserok'; +function ruserok_af(__rhost:Pchar; __suser:longint; __remuser:Pchar; __locuser:Pchar; __af:sa_family_t):longint;cdecl;external clib name 'ruserok_af'; +function rresvport(__alport:Plongint):longint;cdecl;external clib name 'rresvport'; +function rresvport_af(__alport:Plongint; __af:sa_family_t):longint;cdecl;external clib name 'rresvport_af'; + +type + Paddrinfo = ^addrinfo; + addrinfo = record + ai_flags : longint; + ai_family : longint; + ai_socktype : longint; + ai_protocol : longint; + ai_addrlen : socklen_t; + ai_addr : Psockaddr; + ai_canonname : Pchar; + ai_next : Paddrinfo; + end; + PPaddrinfo = ^Paddrinfo; + + Pgaicb = ^gaicb; + gaicb = record + ar_name : Pchar; + ar_service : Pchar; + ar_request : Paddrinfo; + ar_result : Paddrinfo; + __return : longint; + __unused : array[0..4] of longint; + end; + PPgaicb = ^Pgaicb; + + +const + GAI_WAIT = 0; + GAI_NOWAIT = 1; + + AI_PASSIVE = $0001; + AI_CANONNAME = $0002; + AI_NUMERICHOST = $0004; + EAI_BADFLAGS = -(1); + EAI_NONAME = -(2); + EAI_AGAIN = -(3); + EAI_FAIL = -(4); + EAI_NODATA = -(5); + EAI_FAMILY = -(6); + EAI_SOCKTYPE = -(7); + EAI_SERVICE = -(8); + EAI_ADDRFAMILY = -(9); + EAI_MEMORY = -(10); + EAI_SYSTEM = -(11); + + EAI_INPROGRESS = -(100); + EAI_CANCELED = -(101); + EAI_NOTCANCELED = -(102); + EAI_ALLDONE = -(103); + EAI_INTR = -(104); + + NI_MAXHOST = 1025; + NI_MAXSERV = 32; + NI_NUMERICHOST = 1; + NI_NUMERICSERV = 2; + NI_NOFQDN = 4; + NI_NAMEREQD = 8; + NI_DGRAM = 16; + +function getaddrinfo(__name:Pchar; __service:Pchar; __req:Paddrinfo; __pai:PPaddrinfo):longint;cdecl;external clib name 'getaddrinfo'; +procedure freeaddrinfo(__ai:Paddrinfo);cdecl;external clib name 'freeaddrinfo'; +function gai_strerror(__ecode:longint):Pchar;cdecl;external clib name 'gai_strerror'; +function getnameinfo(__sa:Psockaddr; __salen:socklen_t; __host:Pchar; __hostlen:socklen_t; __serv:Pchar; + __servlen:socklen_t; __flags:dword):longint;cdecl;external clib name 'getnameinfo'; +function getaddrinfo_a(__mode:longint; __list: PPgaicb; __ent:longint; __sig:Psigevent):longint;cdecl;external clib name 'getaddrinfo_a'; +function gai_suspend(__list:array of Pgaicb; __ent:longint; __timeout:Ptimespec):longint;cdecl;external clib name 'gai_suspend'; +function gai_error(__req:Pgaicb):longint;cdecl;external clib name 'gai_error'; +function gai_cancel(__gaicbp:Pgaicb):longint;cdecl;external clib name 'gai_cancel'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + THostEnt = hostent; + TServEnt = servent; + TProtoEnt = protoent; + TAddressInfo = addrinfo; + diff --git a/jcl/source/fpc/libclite/netherh.inc b/jcl/source/fpc/libclite/netherh.inc new file mode 100644 index 0000000000..716bdd1c43 --- /dev/null +++ b/jcl/source/fpc/libclite/netherh.inc @@ -0,0 +1,18 @@ + +const + _NETINET_ETHER_H = 1; + +function ether_ntoa(__addr:Pether_addr):Pchar;cdecl;external clib name 'ether_ntoa'; +function ether_ntoa_r(__addr:Pether_addr; __buf:Pchar):Pchar;cdecl;external clib name 'ether_ntoa_r'; +function ether_aton(__asc:Pchar):Pether_addr;cdecl;external clib name 'ether_aton'; +function ether_aton_r(__asc:Pchar; __addr:Pether_addr):Pether_addr;cdecl;external clib name 'ether_aton_r'; +function ether_ntohost(__hostname:Pchar; __addr:Pether_addr):longint;cdecl;external clib name 'ether_ntohost'; +function ether_hostton(__hostname:Pchar; __addr:Pether_addr):longint;cdecl;external clib name 'ether_hostton'; +function ether_line(__line:Pchar; __addr:Pether_addr; __hostname:Pchar):longint;cdecl;external clib name 'ether_line'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nethernet.inc b/jcl/source/fpc/libclite/nethernet.inc new file mode 100644 index 0000000000..5fe1ac8afd --- /dev/null +++ b/jcl/source/fpc/libclite/nethernet.inc @@ -0,0 +1,4 @@ +function ETHER_IS_VALID_LEN(foo : Cardinal) : boolean; +begin + ETHER_IS_VALID_LEN:=(foo>=ETHER_MIN_LEN) and (foo<=ETHER_MAX_LEN); +end; diff --git a/jcl/source/fpc/libclite/netherneth.inc b/jcl/source/fpc/libclite/netherneth.inc new file mode 100644 index 0000000000..7073c14511 --- /dev/null +++ b/jcl/source/fpc/libclite/netherneth.inc @@ -0,0 +1,46 @@ + + +type + Pether_addr = ^ether_addr; + ether_addr = record + ether_addr_octet : array[0..(ETH_ALEN)-1] of u_int8_t; + end; + + Pether_header = ^ether_header; + ether_header = record + ether_dhost : array[0..(ETH_ALEN)-1] of u_int8_t; + ether_shost : array[0..(ETH_ALEN)-1] of u_int8_t; + ether_type : u_int16_t; + end; + + +const + ETHERTYPE_PUP = $0200; + ETHERTYPE_IP = $0800; + ETHERTYPE_ARP = $0806; + ETHERTYPE_REVARP = $8035; + ETHER_ADDR_LEN = ETH_ALEN; + ETHER_TYPE_LEN = 2; + ETHER_CRC_LEN = 4; + ETHER_HDR_LEN = ETH_HLEN; + ETHER_MIN_LEN = ETH_ZLEN + ETHER_CRC_LEN; + ETHER_MAX_LEN = ETH_FRAME_LEN + ETHER_CRC_LEN; + +function ETHER_IS_VALID_LEN(foo : cardinal) : boolean; + + +const + ETHERTYPE_TRAIL = $1000; + ETHERTYPE_NTRAILER = 16; + ETHERMTU = ETH_DATA_LEN; + ETHERMIN = (ETHER_MIN_LEN - ETHER_HDR_LEN) - ETHER_CRC_LEN; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TEtherAddr = ether_addr; + PEtherAddr = ^TEtherAddr; + + diff --git a/jcl/source/fpc/libclite/nicmp6.inc b/jcl/source/fpc/libclite/nicmp6.inc new file mode 100644 index 0000000000..0d1ae680b7 --- /dev/null +++ b/jcl/source/fpc/libclite/nicmp6.inc @@ -0,0 +1,31 @@ +function ICMP6_FILTER_WILLPASS(__type: Integer; const filterp: TICMP6_Filter): Boolean; +begin + Result := (filterp.data[__type shr 5] and (1 shl (__type and 31))) = 0; +end; + +function ICMP6_FILTER_WILLBLOCK(__type: Integer; const filterp: TICMP6_Filter): Boolean; +begin + Result := (filterp.data[__type shr 5] and (1 shl (__type and 31))) <> 0; +end; + +procedure ICMP6_FILTER_SETPASS(__type: Integer; var filterp: TICMP6_Filter); +begin + filterp.data[__type shr 5] := filterp.data[__type shr 5] and not + (1 shl (__type and 31)); +end; + +procedure ICMP6_FILTER_SETBLOCK(__type: Integer; var filterp: TICMP6_Filter); +begin + filterp.data[__type shr 5] := filterp.data[__type shr 5] or + (1 shl (__type and 31)); +end; + +procedure ICMP6_FILTER_SETPASSALL(var filterp: TICMP6_Filter); +begin + FillChar(filterp, SizeOf(filterp), 0); +end; + +procedure ICMP6_FILTER_SETBLOCKALL(var filterp: TICMP6_Filter); +begin + FillChar(filterp, SizeOf(filterp), $FF); +end; diff --git a/jcl/source/fpc/libclite/nicmp6h.inc b/jcl/source/fpc/libclite/nicmp6h.inc new file mode 100644 index 0000000000..5917a6b788 --- /dev/null +++ b/jcl/source/fpc/libclite/nicmp6h.inc @@ -0,0 +1,190 @@ + + +const + ICMP6_FILTER = 1; + ICMP6_FILTER_BLOCK = 1; + ICMP6_FILTER_PASS = 2; + ICMP6_FILTER_BLOCKOTHERS = 3; + ICMP6_FILTER_PASSONLY = 4; +type + Picmp6_filter = ^_icmp6_filter; + _icmp6_filter = record + data : array[0..7] of uint32_t; + end; + TICMP6_Filter = _icmp6_filter; + + Picmp6_hdr = ^icmp6_hdr; + icmp6_hdr = record + icmp6_type : uint8_t; + icmp6_code : uint8_t; + icmp6_cksum : uint16_t; + icmp6_dataun : record + case longint of + 0 : ( icmp6_un_data32 : array[0..0] of uint32_t ); + 1 : ( icmp6_un_data16 : array[0..1] of uint16_t ); + 2 : ( icmp6_un_data8 : array[0..3] of uint8_t ); + end; + end; + + + +const + ICMP6_DST_UNREACH = 1; + ICMP6_PACKET_TOO_BIG = 2; + ICMP6_TIME_EXCEEDED = 3; + ICMP6_PARAM_PROB = 4; + ICMP6_INFOMSG_MASK = $80; + ICMP6_ECHO_REQUEST = 128; + ICMP6_ECHO_REPLY = 129; + ICMP6_MEMBERSHIP_QUERY = 130; + ICMP6_MEMBERSHIP_REPORT = 131; + ICMP6_MEMBERSHIP_REDUCTION = 132; + ICMP6_DST_UNREACH_NOROUTE = 0; + ICMP6_DST_UNREACH_ADMIN = 1; + ICMP6_DST_UNREACH_NOTNEIGHBOR = 2; + ICMP6_DST_UNREACH_ADDR = 3; + ICMP6_DST_UNREACH_NOPORT = 4; + ICMP6_TIME_EXCEED_TRANSIT = 0; + ICMP6_TIME_EXCEED_REASSEMBLY = 1; + ICMP6_PARAMPROB_HEADER = 0; + ICMP6_PARAMPROB_NEXTHEADER = 1; + ICMP6_PARAMPROB_OPTION = 2; + +function ICMP6_FILTER_WILLPASS(__type: Integer; const filterp: TICMP6_Filter): Boolean; +function ICMP6_FILTER_WILLBLOCK(__type: Integer; const filterp: TICMP6_Filter): Boolean; +procedure ICMP6_FILTER_SETPASS(__type: Integer; var filterp: TICMP6_Filter); +procedure ICMP6_FILTER_SETBLOCK(__type: Integer; var filterp: TICMP6_Filter); +procedure ICMP6_FILTER_SETPASSALL(var filterp: TICMP6_Filter); +procedure ICMP6_FILTER_SETBLOCKALL(var filterp: TICMP6_Filter); + + const + ND_ROUTER_SOLICIT = 133; + ND_ROUTER_ADVERT = 134; + ND_NEIGHBOR_SOLICIT = 135; + ND_NEIGHBOR_ADVERT = 136; + ND_REDIRECT = 137; + + type + Pnd_router_solicit = ^_nd_router_solicit; + _nd_router_solicit = record + nd_rs_hdr : icmp6_hdr; + end; + + type + Pnd_router_advert = ^_nd_router_advert; + _nd_router_advert = record + nd_ra_hdr : icmp6_hdr; + nd_ra_reachable : uint32_t; + nd_ra_retransmit : uint32_t; + end; + + + const + ND_RA_FLAG_MANAGED = $80; + ND_RA_FLAG_OTHER = $40; + ND_RA_FLAG_HOME_AGENT = $20; + + type + Pnd_neighbor_solicit = ^_nd_neighbor_solicit; + _nd_neighbor_solicit = record + nd_ns_hdr : icmp6_hdr; + nd_ns_target : in6_addr; + end; + + + type + Pnd_neighbor_advert = ^_nd_neighbor_advert; + _nd_neighbor_advert = record + nd_na_hdr : icmp6_hdr; + nd_na_target : in6_addr; + end; + + + const + ND_NA_FLAG_ROUTER = $00000080; + ND_NA_FLAG_SOLICITED = $00000040; + ND_NA_FLAG_OVERRIDE = $00000020; + + type + Pnd_redirect = ^_nd_redirect; + _nd_redirect = record + nd_rd_hdr : icmp6_hdr; + nd_rd_target : in6_addr; + nd_rd_dst : in6_addr; + end; + + + type + Pnd_opt_hdr = ^nd_opt_hdr; + nd_opt_hdr = record + nd_opt_type : uint8_t; + nd_opt_len : uint8_t; + end; + + + const + ND_OPT_SOURCE_LINKADDR = 1; + ND_OPT_TARGET_LINKADDR = 2; + ND_OPT_PREFIX_INFORMATION = 3; + ND_OPT_REDIRECTED_HEADER = 4; + ND_OPT_MTU = 5; + ND_OPT_RTR_ADV_INTERVAL = 7; + ND_OPT_HOME_AGENT_INFO = 8; + type + Pnd_opt_prefix_info = ^nd_opt_prefix_info; + nd_opt_prefix_info = record + nd_opt_pi_type : uint8_t; + nd_opt_pi_len : uint8_t; + nd_opt_pi_prefix_len : uint8_t; + nd_opt_pi_flags_reserved : uint8_t; + nd_opt_pi_valid_time : uint32_t; + nd_opt_pi_preferred_time : uint32_t; + nd_opt_pi_reserved2 : uint32_t; + nd_opt_pi_prefix : in6_addr; + end; + + + const + ND_OPT_PI_FLAG_ONLINK = $80; + ND_OPT_PI_FLAG_AUTO = $40; + ND_OPT_PI_FLAG_RADDR = $20; + type + Pnd_opt_rd_hdr = ^nd_opt_rd_hdr; + nd_opt_rd_hdr = record + nd_opt_rh_type : uint8_t; + nd_opt_rh_len : uint8_t; + nd_opt_rh_reserved1 : uint16_t; + nd_opt_rh_reserved2 : uint32_t; + end; + + Pnd_opt_mtu = ^_nd_opt_mtu; + _nd_opt_mtu = record + nd_opt_mtu_type : uint8_t; + nd_opt_mtu_len : uint8_t; + nd_opt_mtu_reserved : uint16_t; + nd_opt_mtu_mtu : uint32_t; + end; + + Pnd_opt_adv_interval = ^_nd_opt_adv_interval; + _nd_opt_adv_interval = record + nd_opt_adv_interval_type : uint8_t; + nd_opt_adv_interval_len : uint8_t; + nd_opt_adv_interval_reserved : uint16_t; + nd_opt_adv_interval_ival : uint32_t; + end; + + Pnd_opt_home_agent_info = ^_nd_opt_home_agent_info; + _nd_opt_home_agent_info = record + nd_opt_home_agent_info_type : uint8_t; + nd_opt_home_agent_info_len : uint8_t; + nd_opt_home_agent_info_reserved : uint16_t; + nd_opt_home_agent_info_preference : int16_t; + nd_opt_home_agent_info_lifetime : uint16_t; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nif_arph.inc b/jcl/source/fpc/libclite/nif_arph.inc new file mode 100644 index 0000000000..47bbb98422 --- /dev/null +++ b/jcl/source/fpc/libclite/nif_arph.inc @@ -0,0 +1,119 @@ + +const + MAX_ADDR_LEN = 7; + ARPOP_REQUEST = 1; + ARPOP_REPLY = 2; + ARPOP_RREQUEST = 3; + ARPOP_RREPLY = 4; + ARPOP_InREQUEST = 8; + ARPOP_InREPLY = 9; + ARPOP_NAK = 10; + +type + Parphdr = ^arphdr; + arphdr = record + ar_hrd : word; + ar_pro : word; + ar_hln : byte; + ar_pln : byte; + ar_op : word; + end; + + +const + ARPHRD_NETROM = 0; + ARPHRD_ETHER = 1; + ARPHRD_EETHER = 2; + ARPHRD_AX25 = 3; + ARPHRD_PRONET = 4; + ARPHRD_CHAOS = 5; + ARPHRD_IEEE802 = 6; + ARPHRD_ARCNET = 7; + ARPHRD_APPLETLK = 8; + ARPHRD_DLCI = 15; + ARPHRD_ATM = 19; + ARPHRD_METRICOM = 23; + ARPHRD_SLIP = 256; + ARPHRD_CSLIP = 257; + ARPHRD_SLIP6 = 258; + ARPHRD_CSLIP6 = 259; + ARPHRD_RSRVD = 260; + ARPHRD_ADAPT = 264; + ARPHRD_ROSE = 270; + ARPHRD_X25 = 271; + ARPHDR_HWX25 = 272; + ARPHRD_PPP = 512; + ARPHRD_CISCO = 513; + ARPHRD_HDLC = ARPHRD_CISCO; + ARPHRD_LAPB = 516; + ARPHRD_DDCMP = 517; + ARPHRD_RAWHDLC = 518; + ARPHRD_TUNNEL = 768; + ARPHRD_TUNNEL6 = 769; + ARPHRD_FRAD = 770; + ARPHRD_SKIP = 771; + ARPHRD_LOOPBACK = 772; + ARPHRD_LOCALTLK = 773; + ARPHRD_FDDI = 774; + ARPHRD_BIF = 775; + ARPHRD_SIT = 776; + ARPHRD_IPDDP = 777; + ARPHRD_IPGRE = 778; + ARPHRD_PIMREG = 779; + ARPHRD_HIPPI = 780; + ARPHRD_ASH = 781; + ARPHRD_ECONET = 782; + ARPHRD_IRDA = 783; + ARPHRD_FCPP = 784; + ARPHRD_FCAL = 785; + ARPHRD_FCPL = 786; + ARPHRD_FCPFABRIC = 787; + ARPHRD_IEEE802_TR = 800; + ARPHRD_IEEE80211 = 801; +type + Parpreq = ^arpreq; + arpreq = record + arp_pa : sockaddr; + arp_ha : sockaddr; + arp_flags : longint; + arp_netmask : sockaddr; + arp_dev : array[0..15] of char; + end; + + Parpreq_old = ^arpreq_old; + arpreq_old = record + arp_pa : sockaddr; + arp_ha : sockaddr; + arp_flags : longint; + arp_netmask : sockaddr; + end; + + +const + ATF_COM = $02; + ATF_PERM = $04; + ATF_PUBL = $08; + ATF_USETRAILERS = $10; + ATF_NETMASK = $20; + ATF_DONTPUB = $40; + ATF_MAGIC = $80; + ARPD_UPDATE = $01; + ARPD_LOOKUP = $02; + ARPD_FLUSH = $03; + +type + Parpd_request = ^arpd_request; + arpd_request = record + req : word; + ip : u_int32_t; + dev : dword; + stamp : dword; + updated : dword; + ha : array[0..(MAX_ADDR_LEN)-1] of byte; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nif_ether.inc b/jcl/source/fpc/libclite/nif_ether.inc new file mode 100644 index 0000000000..28adffd94d --- /dev/null +++ b/jcl/source/fpc/libclite/nif_ether.inc @@ -0,0 +1,12 @@ + +procedure ETHER_MAP_IP_MULTICAST(const ipaddr: in_addr; enaddr: PEthernetAddress); +begin + enaddr^[0] := $01; + enaddr^[1] := $00; + enaddr^[2] := $5e; + enaddr^[3] := ipaddr.S_un_b.s_b2 and $7f; + enaddr^[4] := ipaddr.S_un_b.s_b3; + enaddr^[5] := ipaddr.S_un_b.s_b4; +end; + + diff --git a/jcl/source/fpc/libclite/nif_etherh.inc b/jcl/source/fpc/libclite/nif_etherh.inc new file mode 100644 index 0000000000..a4bca52c88 --- /dev/null +++ b/jcl/source/fpc/libclite/nif_etherh.inc @@ -0,0 +1,21 @@ + +type + Pether_arp = ^ether_arp; + ether_arp = record + ea_hdr : arphdr; + arp_sha : array[0..(ETH_ALEN)-1] of u_int8_t; + arp_spa : array[0..3] of u_int8_t; + arp_tha : array[0..(ETH_ALEN)-1] of u_int8_t; + arp_tpa : array[0..3] of u_int8_t; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +type + TEthernetAddress = packed array[0..ETH_ALEN-1] of u_char; + PEthernetAddress = ^TEthernetAddress; + +procedure ETHER_MAP_IP_MULTICAST(const ipaddr: in_addr; enaddr: PEthernetAddress); + diff --git a/jcl/source/fpc/libclite/nif_fddih.inc b/jcl/source/fpc/libclite/nif_fddih.inc new file mode 100644 index 0000000000..5ea578be4b --- /dev/null +++ b/jcl/source/fpc/libclite/nif_fddih.inc @@ -0,0 +1,15 @@ + +type + Pfddi_header = ^fddi_header; + fddi_header = record + fddi_fc : u_int8_t; + fddi_dhost : array[0..(FDDI_K_ALEN)-1] of u_int8_t; + fddi_shost : array[0..(FDDI_K_ALEN)-1] of u_int8_t; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nif_packeth.inc b/jcl/source/fpc/libclite/nif_packeth.inc new file mode 100644 index 0000000000..742f373740 --- /dev/null +++ b/jcl/source/fpc/libclite/nif_packeth.inc @@ -0,0 +1,14 @@ + +type + Psockaddr_pkt = ^sockaddr_pkt; + sockaddr_pkt = record + spkt_family: sa_family_t; + spkt_device : array[0..13] of byte; + spkt_protocol : word; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nif_ppp.inc b/jcl/source/fpc/libclite/nif_ppp.inc new file mode 100644 index 0000000000..d4ae553087 --- /dev/null +++ b/jcl/source/fpc/libclite/nif_ppp.inc @@ -0,0 +1,133 @@ + + +Function PPPIOCGFLAGS: cardinal; + +begin + Result:=_IOR(ord('t'),90,SizeOf(longint)); +end; + + +Function PPPIOCSFLAGS: cardinal; + +begin + Result:=_IOW(ord('t'),89,SizeOf(longint)); +end; + + +Function PPPIOCGASYNCMAP: cardinal; + +begin + Result:=_IOR(ord('t'),88,SizeOf(longint)); +end; + + +Function PPPIOCSASYNCMAP: cardinal; + +begin + Result:=_IOW(ord('t'),87,SizeOf(longint)); +end; + + +Function PPPIOCGUNIT: cardinal; + +begin + Result:=_IOR(ord('t'),86,SizeOf(longint)); +end; + + +Function PPPIOCGRASYNCMAP: cardinal; + +begin + Result:=_IOR(ord('t'),85,SizeOf(longint)); +end; + + +Function PPPIOCSRASYNCMAP: cardinal; + +begin + Result:=_IOW(ord('t'),84,SizeOf(longint)); +end; + + +Function PPPIOCGMRU: cardinal; + +begin + Result:=_IOR(ord('t'),83,SizeOf(longint)); +end; + + +Function PPPIOCSMRU: cardinal; + +begin + Result:=_IOW(ord('t'),82,SizeOf(longint)); +end; + + +Function PPPIOCSMAXCID: cardinal; + +begin + Result:=_IOW(ord('t'),81,SizeOf(longint)); +end; + + +Function PPPIOCGXASYNCMAP: cardinal; + +begin + Result:=_IOR(ord('t'),80,SizeOf(ext_accm)); +end; + + +Function PPPIOCSXASYNCMAP: cardinal; + +begin + Result:=_IOW(ord('t'),79,SizeOf(ext_accm)); +end; + + +Function PPPIOCXFERUNIT: cardinal; + +begin + Result:=_IO(ord('t'),78); +end; + + +Function PPPIOCSCOMPRESS: cardinal; + +begin + Result:=_IOW(ord('t'),77,SizeOf(ppp_option_data)); +end; + + +Function PPPIOCGNPMODE: cardinal; + +begin + Result:=_IOWR(ord('t'),76,SizeOf(npioctl)); +end; + + +Function PPPIOCSNPMODE: cardinal; + +begin + Result:=_IOW(ord('t'),75,SizeOf(npioctl)); +end; + + +Function PPPIOCGDEBUG: cardinal; + +begin + Result:=_IOR(ord('t'),65,SizeOf(longint)); +end; + + +Function PPPIOCSDEBUG: cardinal; + +begin + Result:=_IOW(ord('t'),64,SizeOf(longint)); +end; + + +Function PPPIOCGIDLE: cardinal; + +begin + Result:=_IOR(ord('t'),63,SizeOf(ppp_idle)); +end; diff --git a/jcl/source/fpc/libclite/nif_ppph.inc b/jcl/source/fpc/libclite/nif_ppph.inc new file mode 100644 index 0000000000..6f4998bad2 --- /dev/null +++ b/jcl/source/fpc/libclite/nif_ppph.inc @@ -0,0 +1,94 @@ + + +const + PPP_MTU = 1500; + PPP_MAXMRU = 65000; + PPP_VERSION = '2.2.0'; + PPP_MAGIC = $5002; + PROTO_IPX = $002b; + PROTO_DNA_RT = $0027; + SC_COMP_PROT = $00000001; + SC_COMP_AC = $00000002; + SC_COMP_TCP = $00000004; + SC_NO_TCP_CCID = $00000008; + SC_REJ_COMP_AC = $00000010; + SC_REJ_COMP_TCP = $00000020; + SC_CCP_OPEN = $00000040; + SC_CCP_UP = $00000080; + SC_ENABLE_IP = $00000100; + SC_COMP_RUN = $00001000; + SC_DECOMP_RUN = $00002000; + SC_DEBUG = $00010000; + SC_LOG_INPKT = $00020000; + SC_LOG_OUTPKT = $00040000; + SC_LOG_RAWIN = $00080000; + SC_LOG_FLUSH = $00100000; + SC_MASK = $0fE0ffff; + SC_ESCAPED = $80000000; + SC_FLUSH = $40000000; + SC_VJ_RESET = $20000000; + SC_XMIT_BUSY = $10000000; + SC_RCV_ODDP = $08000000; + SC_RCV_EVNP = $04000000; + SC_RCV_B7_1 = $02000000; + SC_RCV_B7_0 = $01000000; + SC_DC_FERROR = $00800000; + SC_DC_ERROR = $00400000; + +type + Pnpioctl = ^npioctl; + npioctl = record + protocol : longint; + mode : NPmode; + end; + + Pppp_option_data = ^ppp_option_data; + ppp_option_data = record + ptr : Pu_int8_t; + length : u_int32_t; + transmit : longint; + end; + + Pifpppstatsreq = ^ifpppstatsreq; + ifpppstatsreq = record + b : ifreq; + stats : ppp_stats; + end; + + Pifpppcstatsreq = ^ifpppcstatsreq; + ifpppcstatsreq = record + b : ifreq; + stats : ppp_comp_stats; + end; + +function PPPIOCGFLAGS: Cardinal; +function PPPIOCSFLAGS: Cardinal; +function PPPIOCGASYNCMAP: Cardinal; +function PPPIOCSASYNCMAP: Cardinal; +function PPPIOCGUNIT: Cardinal; +function PPPIOCGRASYNCMAP: Cardinal; +function PPPIOCSRASYNCMAP: Cardinal; +function PPPIOCGMRU: Cardinal; +function PPPIOCSMRU: Cardinal; +function PPPIOCSMAXCID: Cardinal; +function PPPIOCGXASYNCMAP: Cardinal; +function PPPIOCSXASYNCMAP: Cardinal; +function PPPIOCXFERUNIT: Cardinal; +function PPPIOCSCOMPRESS: Cardinal; +function PPPIOCGNPMODE: Cardinal; +function PPPIOCSNPMODE: Cardinal; +function PPPIOCGDEBUG: Cardinal; +function PPPIOCSDEBUG: Cardinal; +function PPPIOCGIDLE: Cardinal; + + const + SIOCGPPPSTATS = SIOCDEVPRIVATE + 0; + SIOCGPPPVER = SIOCDEVPRIVATE + 1; + SIOCGPPPCSTATS = SIOCDEVPRIVATE + 2; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nif_shaperh.inc b/jcl/source/fpc/libclite/nif_shaperh.inc new file mode 100644 index 0000000000..8e2c1c93fb --- /dev/null +++ b/jcl/source/fpc/libclite/nif_shaperh.inc @@ -0,0 +1,30 @@ + +const + SHAPER_QLEN = 10; + SHAPER_LATENCY = 5 * HZ; + SHAPER_MAXSLIP = 2; + SHAPER_BURST = HZ / 50; + SHAPER_SET_DEV = $0001; + SHAPER_SET_SPEED = $0002; + SHAPER_GET_DEV = $0003; + SHAPER_GET_SPEED = $0004; + +type + Pshaperconf = ^shaperconf; + shaperconf_u = record + case Integer of + 0: (ssu_name: packed array[0..14-1] of Char); + 1: (ssu_speed: u_int32_t); + end; + + shaperconf = record + ss_cmd: u_int16_t; + ss_u: shaperconf_u; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nif_trh.inc b/jcl/source/fpc/libclite/nif_trh.inc new file mode 100644 index 0000000000..00576068cc --- /dev/null +++ b/jcl/source/fpc/libclite/nif_trh.inc @@ -0,0 +1,18 @@ + +type + Ptrn_hdr = ^trn_hdr; + trn_hdr = record + trn_ac : u_int8_t; + trn_fc : u_int8_t; + trn_dhost : array[0..(TR_ALEN)-1] of u_int8_t; + trn_shost : array[0..(TR_ALEN)-1] of u_int8_t; + trn_rcf : u_int16_t; + trn_rseg : array[0..7] of u_int16_t; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nifh.inc b/jcl/source/fpc/libclite/nifh.inc new file mode 100644 index 0000000000..15ef1588bd --- /dev/null +++ b/jcl/source/fpc/libclite/nifh.inc @@ -0,0 +1,107 @@ + +const + IF_NAMESIZE = 16; + +type + Pif_nameindex = ^_if_nameindex; + _if_nameindex = record + if_index : dword; + if_name : Pchar; + end; + P_if_nameindex = ^_if_nameindex; + + Const + IFF_UP = $1; + IFF_BROADCAST = $2; + IFF_DEBUG = $4; + IFF_LOOPBACK = $8; + IFF_POINTOPOINT = $10; + IFF_NOTRAILERS = $20; + IFF_RUNNING = $40; + IFF_NOARP = $80; + IFF_PROMISC = $100; + IFF_ALLMULTI = $200; + IFF_MASTER = $400; + IFF_SLAVE = $800; + IFF_MULTICAST = $1000; + IFF_PORTSEL = $2000; + IFF_AUTOMEDIA = $4000; + +type + Pifaddr = ^ifaddr; + ifaddr = record + ifa_addr : sockaddr; + ifa_ifu : record + case longint of + 0 : ( ifu_broadaddr : sockaddr ); + 1 : ( ifu_dstaddr : sockaddr ); + end; + ifa_ifp : Pointer; // Piface; + ifa_next : Pifaddr; + end; + + Pifmap = ^ifmap; + ifmap = record + mem_start : dword; + mem_end : dword; + base_addr : word; + irq : byte; + dma : byte; + port : byte; + end; + + +const + IFHWADDRLEN = 6; + IFNAMSIZ = IF_NAMESIZE; + +type + Pifreq = ^ifreq; + ifreq = record + ifr_ifrn : record + case longint of + 0 : ( ifrn_name : array[0..(IFNAMSIZ)-1] of char ); + end; + ifr_ifru : record + case longint of + 0 : ( ifru_addr : sockaddr ); + 1 : ( ifru_dstaddr : sockaddr ); + 2 : ( ifru_broadaddr : sockaddr ); + 3 : ( ifru_netmask : sockaddr ); + 4 : ( ifru_hwaddr : sockaddr ); + 5 : ( ifru_flags : smallint ); + 6 : ( ifru_ivalue : longint ); + 7 : ( ifru_mtu : longint ); + 8 : ( ifru_map : ifmap ); + 9 : ( ifru_slave : array[0..(IFNAMSIZ)-1] of char ); + 10 : ( ifru_newname : array[0..(IFNAMSIZ)-1] of char ); + 11 : ( ifru_data : __caddr_t ); + end; + end; + + Pifconf = ^ifconf; + ifconf = record + ifc_len : longint; + ifc_ifcu : record + case longint of + 0 : ( ifcu_buf : __caddr_t ); + 1 : ( ifcu_req : Pifreq ); + end; + end; + + +function if_nametoindex(__ifname:Pchar):dword;cdecl;external clib name 'if_nametoindex'; +function if_indextoname(__ifindex:dword; __ifname:Pchar):Pchar;cdecl;external clib name 'if_indextoname'; +function if_nameindex:Pif_nameindex;cdecl;external clib name 'if_nameindex'; +procedure if_freenameindex(__ptr:Pif_nameindex);cdecl;external clib name 'if_freenameindex'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TIfNameIndex = _if_nameindex; + PIfNameIndex = ^TIfNameIndex; + + TIfAddr = ifaddr; + TIFreq = ifreq; diff --git a/jcl/source/fpc/libclite/nigmph.inc b/jcl/source/fpc/libclite/nigmph.inc new file mode 100644 index 0000000000..9291b6401e --- /dev/null +++ b/jcl/source/fpc/libclite/nigmph.inc @@ -0,0 +1,22 @@ + +type + Pigmp = ^igmp; + igmp = record + igmp_type : u_int8_t; + igmp_code : u_int8_t; + igmp_cksum : u_int16_t; + igmp_group : in_addr; + end; + + +const + IGMP_MEMBERSHIP_QUERY = $11; + IGMP_V1_MEMBERSHIP_REPORT = $12; + IGMP_V2_MEMBERSHIP_REPORT = $16; + IGMP_V2_LEAVE_GROUP = $17; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nin.inc b/jcl/source/fpc/libclite/nin.inc new file mode 100644 index 0000000000..217b89707b --- /dev/null +++ b/jcl/source/fpc/libclite/nin.inc @@ -0,0 +1,123 @@ +Function IN_CLASSA(a: in_addr_t): Boolean; + +begin + Result:=((a and $80000000)=0); +end; + + +Function IN_CLASSB(a: in_addr_t): Boolean; + +begin + Result:=((a and $c0000000)=$80000000); +end; + +Function IN_CLASSC(a: in_addr_t): Boolean; +begin + Result:=((a and $e0000000)=$c0000000); +end; + +Function IN_CLASSD(a: in_addr_t): Boolean; +begin + Result:=((a and $f0000000)=$e0000000); +end; + +Function IN_MULTICAST(a: in_addr_t): Boolean; +begin + Result:=IN_CLASSD(a); +end; + +Function IN_EXPERIMENTAL(a: in_addr_t): Boolean; +begin + Result:=((a and $e0000000)=$e0000000); +end; + +Function IN_BADCLASS(a: in_addr_t): Boolean; +begin + Result:=((a and $f0000000)=$f0000000); +end; + + +Function IN6_IS_ADDR_UNSPECIFIED(const a: in6_addr): Boolean; +begin + Result:=(a.s6_addr32[0]=0) and + (a.s6_addr32[1]=0) and + (a.s6_addr32[2]=0) and + (a.s6_addr32[3]=0); +end; + +Function IN6_IS_ADDR_LOOPBACK(const a: in6_addr): Boolean; +begin + Result:=(a.s6_addr32[0]=0) and + (a.s6_addr32[1]=0) and + (a.s6_addr32[2]=0) and + (a.s6_addr32[3]=htonl(1)); +end; + +Function IN6_IS_ADDR_MULTICAST(const a: in6_addr): Boolean; +begin + Result:=(a.s6_addr[0]=$ff); +end; + +Function IN6_IS_ADDR_LINKLOCAL(const a: in6_addr): Boolean; +begin + Result:=((a.s6_addr32[0] and htonl($ffc00000))=htonl($fe800000)); +end; + +Function IN6_IS_ADDR_SITELOCAL(const a: in6_addr): Boolean; +begin + Result:=((a.s6_addr32[0] and htonl($ffc00000))=htonl($fec00000)) +end; + +Function IN6_IS_ADDR_V4MAPPED(const a: in6_addr): Boolean; +begin + Result:=(a.s6_addr32[0]=0) and + (a.s6_addr32[1]=0) and + (a.s6_addr32[2]=htonl($ffff)); +end; + +Function IN6_IS_ADDR_V4COMPAT(const a: in6_addr): Boolean; +begin + Result:=(a.s6_addr32[0]=0) and + (a.s6_addr32[1]=0) and + (a.s6_addr32[2]=0) and + (ntohl(a.s6_addr32[3]) > 1); +end; + +Function IN6_ARE_ADDR_EQUAL(const a, b: in6_addr): Boolean; +begin + Result:=(a.s6_addr32[0]=b.s6_addr32[0]) and + (a.s6_addr32[1]=b.s6_addr32[1]) and + (a.s6_addr32[2]=b.s6_addr32[2]) and + (a.s6_addr32[3]=b.s6_addr32[3]); +end; + +Function IN6_IS_ADDR_MC_NODELOCAL(const a: in6_addr): Boolean; +begin + Result:=IN6_IS_ADDR_MULTICAST(a) and + ((a.s6_addr[1] and $f)=$1); +end; + +Function IN6_IS_ADDR_MC_LINKLOCAL(const a: in6_addr): Boolean; +begin + Result:=IN6_IS_ADDR_MULTICAST(a) and + ((a.s6_addr[1] and $f)=$2); +end; + +Function IN6_IS_ADDR_MC_SITELOCAL(const a: in6_addr): Boolean; +begin + Result:=IN6_IS_ADDR_MULTICAST(a) and + ((a.s6_addr[1] and $f)=$5); +end; + +Function IN6_IS_ADDR_MC_ORGLOCAL(const a: in6_addr): Boolean; +begin + Result:=IN6_IS_ADDR_MULTICAST(a) and + ((a.s6_addr[1] and $f)=$8); +end; + +Function IN6_IS_ADDR_MC_GLOBAL(const a: in6_addr): Boolean; +begin + Result:=IN6_IS_ADDR_MULTICAST(a) and + ((a.s6_addr[1] and $f)=$e); +end; + diff --git a/jcl/source/fpc/libclite/nin_systmh.inc b/jcl/source/fpc/libclite/nin_systmh.inc new file mode 100644 index 0000000000..c113592db8 --- /dev/null +++ b/jcl/source/fpc/libclite/nin_systmh.inc @@ -0,0 +1,17 @@ + +type + + Pn_short = ^n_short; + n_short = u_int16_t; + + Pn_long = ^n_long; + n_long = u_int32_t; + + Pn_time = ^n_time; + n_time = u_int32_t; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/ninh.inc b/jcl/source/fpc/libclite/ninh.inc new file mode 100644 index 0000000000..f2cf6da610 --- /dev/null +++ b/jcl/source/fpc/libclite/ninh.inc @@ -0,0 +1,181 @@ + + +Const + IPPROTO_IP = 0; + IPPROTO_HOPOPTS = 0; + IPPROTO_ICMP = 1; + IPPROTO_IGMP = 2; + IPPROTO_IPIP = 4; + IPPROTO_TCP = 6; + IPPROTO_EGP = 8; + IPPROTO_PUP = 12; + IPPROTO_UDP = 17; + IPPROTO_IDP = 22; + IPPROTO_TP = 29; + IPPROTO_IPV6 = 41; + IPPROTO_ROUTING = 43; + IPPROTO_FRAGMENT = 44; + IPPROTO_RSVP = 46; + IPPROTO_GRE = 47; + IPPROTO_ESP = 50; + IPPROTO_AH = 51; + IPPROTO_ICMPV6 = 58; + IPPROTO_NONE = 59; + IPPROTO_DSTOPTS = 60; + IPPROTO_MTP = 92; + IPPROTO_ENCAP = 98; + IPPROTO_PIM = 103; + IPPROTO_COMP = 108; + IPPROTO_RAW = 255; + IPPROTO_MAX = 256; + + +type + Pin_port_t = ^in_port_t; + in_port_t = uint16_t; + +Const + IPPORT_ECHO = 7; + IPPORT_DISCARD = 9; + IPPORT_SYSTAT = 11; + IPPORT_DAYTIME = 13; + IPPORT_NETSTAT = 15; + IPPORT_FTP = 21; + IPPORT_TELNET = 23; + IPPORT_SMTP = 25; + IPPORT_TIMESERVER = 37; + IPPORT_NAMESERVER = 42; + IPPORT_WHOIS = 43; + IPPORT_MTP = 57; + IPPORT_TFTP = 69; + IPPORT_RJE = 77; + IPPORT_FINGER = 79; + IPPORT_TTYLINK = 87; + IPPORT_SUPDUP = 95; + IPPORT_EXECSERVER = 512; + IPPORT_LOGINSERVER = 513; + IPPORT_CMDSERVER = 514; + IPPORT_EFSSERVER = 520; + IPPORT_BIFFUDP = 512; + IPPORT_WHOSERVER = 513; + IPPORT_ROUTESERVER = 520; + IPPORT_RESERVED = 1024; + IPPORT_USERRESERVED = 5000; + +type + + Pin_addr_t = ^in_addr_t; + in_addr_t = uint32_t; + Pin_addr = ^in_addr; +{ + in_addr = record + s_addr : in_addr_t; + end; +} + + +const + IN_CLASSA_NET = $ff000000; + IN_CLASSA_NSHIFT = 24; + IN_CLASSA_HOST = $ffffffff and ( not (IN_CLASSA_NET)); + IN_CLASSA_MAX = 128; + +const + IN_CLASSB_NET = $ffff0000; + IN_CLASSB_NSHIFT = 16; + IN_CLASSB_HOST = $ffffffff and ( not (IN_CLASSB_NET)); + IN_CLASSB_MAX = 65536; + + +const + IN_CLASSC_NET = $ffffff00; + IN_CLASSC_NSHIFT = 8; + IN_CLASSC_HOST = $ffffffff and ( not (IN_CLASSC_NET)); + +Function IN_CLASSA(a: in_addr_t): Boolean; +Function IN_CLASSB(a: in_addr_t): Boolean; +Function IN_CLASSC(a: in_addr_t): Boolean; +Function IN_CLASSD(a: in_addr_t): Boolean; +Function IN_MULTICAST(a: in_addr_t): Boolean; +Function IN_EXPERIMENTAL(a: in_addr_t): Boolean; +Function IN_BADCLASS(a: in_addr_t): Boolean; + + +const + IN_LOOPBACKNET = 127; + INADDR_LOOPBACK = in_addr_t($7f000001); + INADDR_UNSPEC_GROUP = in_addr_t($e0000000); + INADDR_ALLHOSTS_GROUP = in_addr_t($e0000001); + INADDR_ALLRTRS_GROUP = in_addr_t($0000002); + INADDR_MAX_LOCAL_GROUP = in_addr_t($e00000ff); + +type + Pin6_addr = ^in6_addr; + in6_addr = record + case longint of + 0 : ( in6_u : record + case longint of + 0 : ( u6_addr8 : array[0..15] of uint8_t ); + 1 : ( u6_addr16 : array[0..7] of uint16_t ); + 2 : ( u6_addr32 : array[0..3] of uint32_t ); + end;); + 1 : (case Integer of + 0: (s6_addr: packed array [0..16-1] of __uint8_t); + 1: (s6_addr16: packed array [0..8-1] of uint16_t); + 2: (s6_addr32: packed array [0..4-1] of uint32_t); + ); + end; + + +Const + IN6ADDR_ANY_INIT : in6_addr = ( in6_u : (U6_addr8 : (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 )) ); + IN6ADDR_LOOPBACK_INIT : in6_addr = ( in6_u : (U6_addr8 : ( 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 ))); + +const + INET_ADDRSTRLEN = 16; + INET6_ADDRSTRLEN = 46; + +Type + Psockaddr_in6 = ^sockaddr_in6; + sockaddr_in6 = record + sin6_family: sa_family_t; + sin6_port : in_port_t; + sin6_flowinfo : uint32_t; + sin6_addr : in6_addr; + sin6_scope_id : uint32_t; + end; + + Pipv6_mreq = ^ipv6_mreq; + ipv6_mreq = record + ipv6mr_multiaddr : in6_addr; + ipv6mr_interface : dword; + end; + +type + in6_pktinfo = {packed} record + ipi6_addr: in6_addr; { src/dst IPv6 address } + ipi6_ifindex: Cardinal; { send/recv interface index } + end; + +Function IN6_IS_ADDR_UNSPECIFIED(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_LOOPBACK(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_MULTICAST(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_LINKLOCAL(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_SITELOCAL(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_V4MAPPED(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_V4COMPAT(const a: in6_addr): Boolean; +Function IN6_ARE_ADDR_EQUAL(const a, b: in6_addr): Boolean; +Function IN6_IS_ADDR_MC_NODELOCAL(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_MC_LINKLOCAL(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_MC_SITELOCAL(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_MC_ORGLOCAL(const a: in6_addr): Boolean; +Function IN6_IS_ADDR_MC_GLOBAL(const a: in6_addr): Boolean; + +function ntohl(__netlong:uint32_t):uint32_t;cdecl;external clib name 'ntohl'; +function ntohs(__netshort:uint16_t):uint16_t;cdecl;external clib name 'ntohs'; +function htonl(__hostlong:uint32_t):uint32_t;cdecl;external clib name 'htonl'; +function htons(__hostshort:uint16_t):uint16_t;cdecl;external clib name 'htons'; + +function bindresvport6(__sockfd:longint; __sock_in:Psockaddr_in6):longint;cdecl;external clib name 'bindresvport6'; +function bindresvport(__sockfd:longint; __sock_in:Psockaddr_in):longint;cdecl;external clib name 'bindresvport'; + diff --git a/jcl/source/fpc/libclite/nip.inc b/jcl/source/fpc/libclite/nip.inc new file mode 100644 index 0000000000..6accedef0e --- /dev/null +++ b/jcl/source/fpc/libclite/nip.inc @@ -0,0 +1,25 @@ +function IPTOS_TOS(tos : longint) : longint; +begin + IPTOS_TOS:=tos and IPTOS_TOS_MASK; +end; + +function IPTOS_PREC(tos : longint) : longint; +begin + IPTOS_PREC:=tos and IPTOS_PREC_MASK; +end; + +function IPOPT_COPIED(o : longint) : longint; +begin + IPOPT_COPIED:=o and IPOPT_COPY; +end; + +function IPOPT_CLASS(o : longint) : longint; +begin + IPOPT_CLASS:=o and IPOPT_CLASS_MASK; +end; + +function IPOPT_NUMBER(o : longint) : longint; +begin + IPOPT_NUMBER:=o and IPOPT_NUMBER_MASK; +end; + diff --git a/jcl/source/fpc/libclite/nip6h.inc b/jcl/source/fpc/libclite/nip6h.inc new file mode 100644 index 0000000000..bcd19834ed --- /dev/null +++ b/jcl/source/fpc/libclite/nip6h.inc @@ -0,0 +1,68 @@ + +type + Pip6_hdr = ^ip6_hdr; + ip6_hdr = record + ip6_ctlun : record + case longint of + 0 : ( ip6_un1 : record + ip6_un1_flow : uint32_t; + ip6_un1_plen : uint16_t; + ip6_un1_nxt : uint8_t; + ip6_un1_hlim : uint8_t; + end ); + 1 : ( ip6_un2_vfc : uint8_t ); + end; + ip6_src : in6_addr; + ip6_dst : in6_addr; + end; + + + Pip6_hbh = ^ip6_hbh; + ip6_hbh = record + ip6h_nxt : uint8_t; + ip6h_len : uint8_t; + end; + + Pip6_dest = ^ip6_dest; + ip6_dest = record + ip6d_nxt : uint8_t; + ip6d_len : uint8_t; + end; + + Pip6_rthdr = ^ip6_rthdr; + ip6_rthdr = record + ip6r_nxt : uint8_t; + ip6r_len : uint8_t; + ip6r_type : uint8_t; + ip6r_segleft : uint8_t; + end; + + Pip6_rthdr0 = ^ip6_rthdr0; + ip6_rthdr0 = record + ip6r0_nxt : uint8_t; + ip6r0_len : uint8_t; + ip6r0_type : uint8_t; + ip6r0_segleft : uint8_t; + ip6r0_reserved : uint8_t; + ip6r0_slmap : array[0..2] of uint8_t; + ip6r0_addr : array[0..0] of in6_addr; + end; + + Pip6_frag = ^ip6_frag; + ip6_frag = record + ip6f_nxt : uint8_t; + ip6f_reserved : uint8_t; + ip6f_offlg : uint16_t; + ip6f_ident : uint32_t; + end; + +const + IP6F_OFF_MASK = $fff8; + IP6F_RESERVED_MASK = $0006; + IP6F_MORE_FRAG = $0001; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nip_icmp.inc b/jcl/source/fpc/libclite/nip_icmp.inc new file mode 100644 index 0000000000..8a746ed86d --- /dev/null +++ b/jcl/source/fpc/libclite/nip_icmp.inc @@ -0,0 +1,25 @@ + +Function ICMP_ADVLEN(const p: icmp): cardinal; + +var + L : Longint; + +begin + L:=p.icmp_dun.id_ip.idi_ip.flag0 and $F; + Result:=(8+(L shl 2) + 8); +end; + +Function ICMP_INFOTYPE(_type: cardinal): Boolean; + +begin + Result := (_type=ICMP_ECHOREPLY) or + (_type=ICMP_ECHO) or + (_type=ICMP_ROUTERADVERT) or + (_type=ICMP_ROUTERSOLICIT) or + (_type=ICMP_TSTAMP) or + (_type=ICMP_TSTAMPREPLY) or + (_type=ICMP_IREQ) or + (_type=ICMP_IREQREPLY) or + (_type=ICMP_MASKREQ) or + (_type=ICMP_MASKREPLY); +end; diff --git a/jcl/source/fpc/libclite/nip_icmph.inc b/jcl/source/fpc/libclite/nip_icmph.inc new file mode 100644 index 0000000000..9a6d83cac6 --- /dev/null +++ b/jcl/source/fpc/libclite/nip_icmph.inc @@ -0,0 +1,162 @@ + +type + Picmphdr = ^icmphdr; + icmphdr = record + _type : u_int8_t; + code : u_int8_t; + checksum : u_int16_t; + un : record + case longint of + 0 : ( echo : record + id : u_int16_t; + sequence : u_int16_t; + end ); + 1 : ( gateway : u_int32_t ); + 2 : ( frag : record + __unused : u_int16_t; + mtu : u_int16_t; + end ); + end; + end; + + +const + ICMP_ECHOREPLY = 0; + ICMP_DEST_UNREACH = 3; + ICMP_SOURCE_QUENCH = 4; + ICMP_REDIRECT = 5; + ICMP_ECHO = 8; + ICMP_TIME_EXCEEDED = 11; + ICMP_PARAMETERPROB = 12; + ICMP_TIMESTAMP = 13; + ICMP_TIMESTAMPREPLY = 14; + ICMP_INFO_REQUEST = 15; + ICMP_INFO_REPLY = 16; + ICMP_ADDRESS = 17; + ICMP_ADDRESSREPLY = 18; + NR_ICMP_TYPES = 18; + ICMP_NET_UNREACH = 0; + ICMP_HOST_UNREACH = 1; + ICMP_PROT_UNREACH = 2; + ICMP_PORT_UNREACH = 3; + ICMP_FRAG_NEEDED = 4; + ICMP_SR_FAILED = 5; + ICMP_NET_UNKNOWN = 6; + ICMP_HOST_UNKNOWN = 7; + ICMP_HOST_ISOLATED = 8; + ICMP_NET_ANO = 9; + ICMP_HOST_ANO = 10; + ICMP_NET_UNR_TOS = 11; + ICMP_HOST_UNR_TOS = 12; + ICMP_PKT_FILTERED = 13; + ICMP_PREC_VIOLATION = 14; + ICMP_PREC_CUTOFF = 15; + NR_ICMP_UNREACH = 15; + ICMP_REDIR_NET = 0; + ICMP_REDIR_HOST = 1; + ICMP_REDIR_NETTOS = 2; + ICMP_REDIR_HOSTTOS = 3; + ICMP_EXC_TTL = 0; + ICMP_EXC_FRAGTIME = 1; + +type + Picmp_ra_addr = ^icmp_ra_addr; + icmp_ra_addr = record + ira_addr : u_int32_t; + ira_preference : u_int32_t; + end; + + Picmp = ^icmp; + icmp = record + icmp_type : u_int8_t; + icmp_code : u_int8_t; + icmp_cksum : u_int16_t; + icmp_hun : record + case longint of + 0 : ( ih_pptr : u_char ); + 1 : ( ih_gwaddr : in_addr ); + 2 : ( ih_idseq : record + icd_id : u_int16_t; + icd_seq : u_int16_t; + end ); + 3 : ( ih_void : u_int32_t ); + 4 : ( ih_pmtu : record + ipm_void : u_int16_t; + ipm_nextmtu : u_int16_t; + end ); + 5 : ( ih_rtradv : record + irt_num_addrs : u_int8_t; + irt_wpa : u_int8_t; + irt_lifetime : u_int16_t; + end ); + end; + icmp_dun : record + case longint of + 0 : ( id_ts : record + its_otime : u_int32_t; + its_rtime : u_int32_t; + its_ttime : u_int32_t; + end ); + 1 : ( id_ip : record + idi_ip : ip; + end ); + 2 : ( id_radv : icmp_ra_addr ); + 3 : ( id_mask : u_int32_t ); + 4 : ( id_data : array[0..0] of u_int8_t ); + end; + end; + + +const + ICMP_MINLEN = 8; + ICMP_TSLEN = 8 + (3 * (sizeof(n_time))); + ICMP_MASKLEN = 12; + ICMP_ADVLENMIN = (8 + SizeOf(ip)+8); + + const + ICMP_UNREACH = 3; + ICMP_SOURCEQUENCH = 4; + ICMP_ROUTERADVERT = 9; + ICMP_ROUTERSOLICIT = 10; + ICMP_TIMXCEED = 11; + ICMP_PARAMPROB = 12; + ICMP_TSTAMP = 13; + ICMP_TSTAMPREPLY = 14; + ICMP_IREQ = 15; + ICMP_IREQREPLY = 16; + ICMP_MASKREQ = 17; + ICMP_MASKREPLY = 18; + ICMP_MAXTYPE = 18; + ICMP_UNREACH_NET = 0; + ICMP_UNREACH_HOST = 1; + ICMP_UNREACH_PROTOCOL = 2; + ICMP_UNREACH_PORT = 3; + ICMP_UNREACH_NEEDFRAG = 4; + ICMP_UNREACH_SRCFAIL = 5; + ICMP_UNREACH_NET_UNKNOWN = 6; + ICMP_UNREACH_HOST_UNKNOWN = 7; + ICMP_UNREACH_ISOLATED = 8; + ICMP_UNREACH_NET_PROHIB = 9; + ICMP_UNREACH_HOST_PROHIB = 10; + ICMP_UNREACH_TOSNET = 11; + ICMP_UNREACH_TOSHOST = 12; + ICMP_UNREACH_FILTER_PROHIB = 13; + ICMP_UNREACH_HOST_PRECEDENCE = 14; + ICMP_UNREACH_PRECEDENCE_CUTOFF = 15; + ICMP_REDIRECT_NET = 0; + ICMP_REDIRECT_HOST = 1; + ICMP_REDIRECT_TOSNET = 2; + ICMP_REDIRECT_TOSHOST = 3; + ICMP_TIMXCEED_INTRANS = 0; + ICMP_TIMXCEED_REASS = 1; + ICMP_PARAMPROB_OPTABSENT = 1; + +function ICMP_ADVLEN(const p: icmp): cardinal; +Function ICMP_INFOTYPE(_type: cardinal): boolean; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/niph.inc b/jcl/source/fpc/libclite/niph.inc new file mode 100644 index 0000000000..9cc9c9aeb4 --- /dev/null +++ b/jcl/source/fpc/libclite/niph.inc @@ -0,0 +1,140 @@ + +Type + Ptimestamp = ^timestamp; + timestamp = record + len : u_int8_t; + ptr : u_int8_t; + flag0 : dword; + data : array[0..8] of u_int32_t; + end; + + Piphdr = ^iphdr; + iphdr = record + flag0 : byte; + tos : u_int8_t; + tot_len : u_int16_t; + id : u_int16_t; + frag_off : u_int16_t; + ttl : u_int8_t; + protocol : u_int8_t; + check : u_int16_t; + saddr : u_int32_t; + daddr : u_int32_t; + end; + + Pip = ^ip; + ip = record + flag0 : byte; + ip_tos : u_int8_t; + ip_len : u_short; + ip_id : u_short; + ip_off : u_short; + ip_ttl : u_int8_t; + ip_p : u_int8_t; + ip_sum : u_short; + ip_src : in_addr; + ip_dst : in_addr; + end; + +const + IP_RF = $8000; + IP_DF = $4000; + IP_MF = $2000; + IP_OFFMASK = $1fff; + +type + Pip_timestamp = ^ip_timestamp; + ip_timestamp = record + ipt_code : u_int8_t; + ipt_len : u_int8_t; + ipt_ptr : u_int8_t; + flag0 : dword; + data : array[0..8] of u_int32_t; + end; + +const + IPVERSION = 4; + IP_MAXPACKET = 65535; + IPTOS_TOS_MASK = $1E; + +function IPTOS_TOS(tos : longint) : longint; + + +const + IPTOS_LOWDELAY = $10; + IPTOS_THROUGHPUT = $08; + IPTOS_RELIABILITY = $04; + IPTOS_LOWCOST = $02; + IPTOS_MINCOST = IPTOS_LOWCOST; + IPTOS_PREC_MASK = $e0; + +function IPTOS_PREC(tos : longint) : longint; + + +const + IPTOS_PREC_NETCONTROL = $e0; + IPTOS_PREC_INTERNETCONTROL = $c0; + IPTOS_PREC_CRITIC_ECP = $a0; + IPTOS_PREC_FLASHOVERRIDE = $80; + IPTOS_PREC_FLASH = $60; + IPTOS_PREC_IMMEDIATE = $40; + IPTOS_PREC_PRIORITY = $20; + IPTOS_PREC_ROUTINE = $00; + IPOPT_COPY = $80; + IPOPT_CLASS_MASK = $60; + IPOPT_NUMBER_MASK = $1f; + +function IPOPT_COPIED(o : longint) : longint; + +function IPOPT_CLASS(o : longint) : longint; + +function IPOPT_NUMBER(o : longint) : longint; + + +const + IPOPT_CONTROL = $00; + IPOPT_RESERVED1 = $20; + IPOPT_DEBMEAS = $40; + IPOPT_MEASUREMENT = IPOPT_DEBMEAS; + IPOPT_RESERVED2 = $60; + IPOPT_EOL = 0; + IPOPT_END = IPOPT_EOL; + IPOPT_NOP = 1; + IPOPT_NOOP = IPOPT_NOP; + IPOPT_RR = 7; + IPOPT_TS = 68; + IPOPT_TIMESTAMP = IPOPT_TS; + IPOPT_SECURITY = 130; + IPOPT_SEC = IPOPT_SECURITY; + IPOPT_LSRR = 131; + IPOPT_SATID = 136; + IPOPT_SID = IPOPT_SATID; + IPOPT_SSRR = 137; + IPOPT_RA = 148; + IPOPT_OPTVAL = 0; + IPOPT_OLEN = 1; + IPOPT_OFFSET = 2; + IPOPT_MINOFF = 4; + MAX_IPOPTLEN = 40; + IPOPT_TS_TSONLY = 0; + IPOPT_TS_TSANDADDR = 1; + IPOPT_TS_PRESPEC = 3; + IPOPT_SECUR_UNCLASS = $0000; + IPOPT_SECUR_CONFID = $f135; + IPOPT_SECUR_EFTO = $789a; + IPOPT_SECUR_MMMM = $bc4d; + IPOPT_SECUR_RESTR = $af13; + IPOPT_SECUR_SECRET = $d788; + IPOPT_SECUR_TOPSECRET = $6bc5; + MAXTTL = 255; + IPDEFTTL = 64; + IPFRAGTTL = 60; + IPTTLDEC = 1; + IP_MSS = 576; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nipxh.inc b/jcl/source/fpc/libclite/nipxh.inc new file mode 100644 index 0000000000..9c9369765b --- /dev/null +++ b/jcl/source/fpc/libclite/nipxh.inc @@ -0,0 +1,84 @@ + +const + SOL_IPX = 256; + IPX_TYPE = 1; + IPX_NODE_LEN = 6; + IPX_MTU = 576; + +type + Psockaddr_ipx = ^sockaddr_ipx; + sockaddr_ipx = record + sipx_family : sa_family_t; + sipx_port : u_int16_t; + sipx_network : u_int32_t; + sipx_node : array[0..(IPX_NODE_LEN)-1] of byte; + sipx_type : u_int8_t; + sipx_zero : byte; + end; + + +const + IPX_DLTITF = 0; + IPX_CRTITF = 1; + +type + + Pipx_route_definition = ^ipx_route_definition; + ipx_route_definition = record + ipx_network : dword; + ipx_router_network : dword; + ipx_router_node : array[0..(IPX_NODE_LEN)-1] of byte; + end; + + Pipx_interface_definition = ^ipx_interface_definition; + ipx_interface_definition = record + ipx_network : dword; + ipx_device : array[0..15] of byte; + ipx_dlink_type : byte; + ipx_special : byte; + ipx_node : array[0..(IPX_NODE_LEN)-1] of byte; + end; + +const + IPX_FRAME_NONE = 0; + IPX_FRAME_SNAP = 1; + IPX_FRAME_8022 = 2; + IPX_FRAME_ETHERII = 3; + IPX_FRAME_8023 = 4; + IPX_FRAME_TR_8022 = 5; + IPX_SPECIAL_NONE = 0; + IPX_PRIMARY = 1; + IPX_INTERNAL = 2; +type + + Pipx_config_data = ^ipx_config_data; + ipx_config_data = record + ipxcfg_auto_select_primary : byte; + ipxcfg_auto_create_interfaces : byte; + end; + Pipx_route_def = ^ipx_route_def; + ipx_route_def = record + ipx_network : dword; + ipx_router_network : dword; + ipx_router_node : array[0..(IPX_NODE_LEN)-1] of byte; + ipx_device : array[0..15] of byte; + ipx_flags : word; + end; + + +const + IPX_ROUTE_NO_ROUTER = 0; + IPX_RT_SNAP = 8; + IPX_RT_8022 = 4; + IPX_RT_BLUEBOOK = 2; + IPX_RT_ROUTED = 1; + SIOCAIPXITFCRT = SIOCPROTOPRIVATE; + SIOCAIPXPRISLT = SIOCPROTOPRIVATE + 1; + SIOCIPXCFGDATA = SIOCPROTOPRIVATE + 2; + SIOCIPXNCPCONN = SIOCPROTOPRIVATE + 3; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nl_typesh.inc b/jcl/source/fpc/libclite/nl_typesh.inc new file mode 100644 index 0000000000..8fb915d598 --- /dev/null +++ b/jcl/source/fpc/libclite/nl_typesh.inc @@ -0,0 +1,22 @@ + +const + NL_SETD = 1; + NL_CAT_LOCALE = 1; + +type + + Pnl_catd = ^nl_catd; + nl_catd = pointer; + + Pnl_item = ^nl_item; + nl_item = longint; + +function catopen(__cat_name:Pchar; __flag:longint):nl_catd;cdecl;external clib name 'catopen'; +function catgets(__catalog:nl_catd; __set:longint; __number:longint; __string:Pchar):Pchar;cdecl;external clib name 'catgets'; +function catclose(__catalog:nl_catd):longint;cdecl;external clib name 'catclose'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nnetromh.inc b/jcl/source/fpc/libclite/nnetromh.inc new file mode 100644 index 0000000000..e93bc7c488 --- /dev/null +++ b/jcl/source/fpc/libclite/nnetromh.inc @@ -0,0 +1,63 @@ + +const + SOL_NETROM = 259; + NETROM_T1 = 1; + NETROM_T2 = 2; + NETROM_N2 = 3; + NETROM_PACLEN = 5; + NETROM_T4 = 6; + NETROM_IDLE = 7; + NETROM_KILL = 99; + NETROM_NEIGH = 0; + NETROM_NODE = 1; + +type + Pnr_route_struct = ^nr_route_struct; + nr_route_struct = record + _type : longint; + callsign : ax25_address; + device : array[0..15] of char; + quality : dword; + mnemonic : array[0..6] of char; + neighbour : ax25_address; + obs_count : dword; + ndigis : dword; + digipeaters : array[0..(AX25_MAX_DIGIS)-1] of ax25_address; + end; + + +const + SIOCNRGETPARMS = SIOCPROTOPRIVATE + 0; + SIOCNRSETPARMS = SIOCPROTOPRIVATE + 1; + SIOCNRDECOBS = SIOCPROTOPRIVATE + 2; + SIOCNRRTCTL = SIOCPROTOPRIVATE + 3; + SIOCNRCTLCON = SIOCPROTOPRIVATE + 4; + +type + Pnr_parms_struct = ^nr_parms_struct; + nr_parms_struct = record + quality : dword; + obs_count : dword; + ttl : dword; + timeout : dword; + ack_delay : dword; + busy_delay : dword; + tries : dword; + window : dword; + paclen : dword; + end; + + Pnr_ctl_struct = ^nr_ctl_struct; + nr_ctl_struct = record + index : byte; + id : byte; + cmd : dword; + arg : dword; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/npacketh.inc b/jcl/source/fpc/libclite/npacketh.inc new file mode 100644 index 0000000000..b1667fb7c9 --- /dev/null +++ b/jcl/source/fpc/libclite/npacketh.inc @@ -0,0 +1,47 @@ + +type + Psockaddr_ll = ^sockaddr_ll; + sockaddr_ll = record + sll_family : word; + sll_protocol : word; + sll_ifindex : longint; + sll_hatype : word; + sll_pkttype : byte; + sll_halen : byte; + sll_addr : array[0..7] of byte; + end; + + +const + PACKET_HOST = 0; + PACKET_BROADCAST = 1; + PACKET_MULTICAST = 2; + PACKET_OTHERHOST = 3; + PACKET_OUTGOING = 4; + PACKET_LOOPBACK = 5; + PACKET_FASTROUTE = 6; + PACKET_ADD_MEMBERSHIP = 1; + PACKET_DROP_MEMBERSHIP = 2; + PACKET_RECV_OUTPUT = 3; + PACKET_RX_RING = 5; + PACKET_STATISTICS = 6; +type + Ppacket_mreq = ^packet_mreq; + packet_mreq = record + mr_ifindex : longint; + mr_type : word; + mr_alen : word; + mr_address : array[0..7] of byte; + end; + + +const + PACKET_MR_MULTICAST = 0; + PACKET_MR_PROMISC = 1; + PACKET_MR_ALLMULTI = 2; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nroseh.inc b/jcl/source/fpc/libclite/nroseh.inc new file mode 100644 index 0000000000..a9cc18dfe0 --- /dev/null +++ b/jcl/source/fpc/libclite/nroseh.inc @@ -0,0 +1,91 @@ + +const + + SOL_ROSE = 260; + ROSE_MTU = 251; + ROSE_MAX_DIGIS = 6; + ROSE_DEFER = 1; + ROSE_T1 = 2; + ROSE_T2 = 3; + ROSE_T3 = 4; + ROSE_IDLE = 5; + ROSE_QBITINCL = 6; + ROSE_HOLDBACK = 7; + SIOCRSGCAUSE = SIOCPROTOPRIVATE + 0; + SIOCRSSCAUSE = SIOCPROTOPRIVATE + 1; + SIOCRSL2CALL = SIOCPROTOPRIVATE + 2; + SIOCRSSL2CALL = SIOCPROTOPRIVATE + 2; + SIOCRSACCEPT = SIOCPROTOPRIVATE + 3; + SIOCRSCLRRT = SIOCPROTOPRIVATE + 4; + SIOCRSGL2CALL = SIOCPROTOPRIVATE + 5; + SIOCRSGFACILITIES = SIOCPROTOPRIVATE + 6; + ROSE_DTE_ORIGINATED = $00; + ROSE_NUMBER_BUSY = $01; + ROSE_INVALID_FACILITY = $03; + ROSE_NETWORK_CONGESTION = $05; + ROSE_OUT_OF_ORDER = $09; + ROSE_ACCESS_BARRED = $0B; + ROSE_NOT_OBTAINABLE = $0D; + ROSE_REMOTE_PROCEDURE = $11; + ROSE_LOCAL_PROCEDURE = $13; + ROSE_SHIP_ABSENT = $39; +type + + Prose_address = ^rose_address; + rose_address = record + rose_addr : array[0..4] of char; + end; + Psockaddr_rose = ^sockaddr_rose; + sockaddr_rose = record + srose_family : sa_family_t; + srose_addr : rose_address; + srose_call : ax25_address; + srose_ndigis : longint; + srose_digi : ax25_address; + end; + + Pfull_sockaddr_rose = ^full_sockaddr_rose; + full_sockaddr_rose = record + srose_family : sa_family_t; + srose_addr : rose_address; + srose_call : ax25_address; + srose_ndigis : dword; + srose_digis : array[0..(ROSE_MAX_DIGIS)-1] of ax25_address; + end; + + Prose_route_struct = ^rose_route_struct; + rose_route_struct = record + address : rose_address; + mask : word; + neighbour : ax25_address; + device : array[0..15] of char; + ndigis : byte; + digipeaters : array[0..(AX25_MAX_DIGIS)-1] of ax25_address; + end; + + Prose_cause_struct = ^rose_cause_struct; + rose_cause_struct = record + cause : byte; + diagnostic : byte; + end; + + Prose_facilities_struct = ^rose_facilities_struct; + rose_facilities_struct = record + source_addr : rose_address; + dest_addr : rose_address; + source_call : ax25_address; + dest_call : ax25_address; + source_ndigis : byte; + dest_ndigis : byte; + source_digis : array[0..(ROSE_MAX_DIGIS)-1] of ax25_address; + dest_digis : array[0..(ROSE_MAX_DIGIS)-1] of ax25_address; + rand : dword; + fail_addr : rose_address; + fail_call : ax25_address; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nroute.inc b/jcl/source/fpc/libclite/nroute.inc new file mode 100644 index 0000000000..b865cda700 --- /dev/null +++ b/jcl/source/fpc/libclite/nroute.inc @@ -0,0 +1,19 @@ + +Function RT_ADDRCLASS(flags: u_int32_t): u_int32_t; + +begin + Result:=flags shr 23; +end; + + +Function RT_TOS(tos: Integer): Integer; + +begin + Result:=tos and IPTOS_TOS_MASK; +end; + +Function RT_LOCALADDR(flags: u_int32_t): Boolean; + +begin + Result:=(flags and RTF_ADDRCLASSMASK)=(RTF_LOCAL or RTF_INTERFACE); +end; diff --git a/jcl/source/fpc/libclite/nrouteh.inc b/jcl/source/fpc/libclite/nrouteh.inc new file mode 100644 index 0000000000..83b7e4dc2e --- /dev/null +++ b/jcl/source/fpc/libclite/nrouteh.inc @@ -0,0 +1,107 @@ + +type + + Prtentry = ^rtentry; + rtentry = record + rt_pad1 : dword; + rt_dst : sockaddr; + rt_gateway : sockaddr; + rt_genmask : sockaddr; + rt_flags : word; + rt_pad2 : smallint; + rt_pad3 : dword; + rt_tos : byte; + rt_class : byte; + rt_pad4 : smallint; + rt_metric : smallint; + rt_dev : Pchar; + rt_mtu : dword; + rt_window : dword; + rt_irtt : word; + end; + + +type + Pin6_rtmsg = ^in6_rtmsg; + in6_rtmsg = record + rtmsg_dst : in6_addr; + rtmsg_src : in6_addr; + rtmsg_gateway : in6_addr; + rtmsg_type : u_int32_t; + rtmsg_dst_len : u_int16_t; + rtmsg_src_len : u_int16_t; + rtmsg_metric : u_int32_t; + rtmsg_info : dword; + rtmsg_flags : u_int32_t; + rtmsg_ifindex : longint; + end; + + +const + RTF_UP = $0001; + RTF_GATEWAY = $0002; + RTF_HOST = $0004; + RTF_REINSTATE = $0008; + RTF_DYNAMIC = $0010; + RTF_MODIFIED = $0020; + RTF_MTU = $0040; + RTF_MSS = RTF_MTU; + RTF_WINDOW = $0080; + RTF_IRTT = $0100; + RTF_REJECT = $0200; + RTF_STATIC = $0400; + RTF_XRESOLVE = $0800; + RTF_NOFORWARD = $1000; + RTF_THROW = $2000; + RTF_NOPMTUDISC = $4000; + RTF_DEFAULT = $00010000; + RTF_ALLONLINK = $00020000; + RTF_ADDRCONF = $00040000; + RTF_LINKRT = $00100000; + RTF_NONEXTHOP = $00200000; + RTF_CACHE = $01000000; + RTF_FLOW = $02000000; + RTF_POLICY = $04000000; + RTCF_VALVE = $00200000; + RTCF_MASQ = $00400000; + RTCF_NAT = $00800000; + RTCF_DOREDIRECT = $01000000; + RTCF_LOG = $02000000; + RTCF_DIRECTSRC = $04000000; + RTF_LOCAL = $80000000; + RTF_INTERFACE = $40000000; + RTF_MULTICAST = $20000000; + RTF_BROADCAST = $10000000; + RTF_NAT = $08000000; + RTF_ADDRCLASSMASK = $F8000000; + +Function RT_ADDRCLASS(flags: u_int32_t): u_int32_t; +Function RT_TOS(tos: Integer): Integer; +Function RT_LOCALADDR(flags: u_int32_t): Boolean; + + +const + RT_CLASS_UNSPEC = 0; + RT_CLASS_DEFAULT = 253; + RT_CLASS_MAIN = 254; + RT_CLASS_LOCAL = 255; + RT_CLASS_MAX = 255; + +// RTMSG_ACK = NLMSG_ACK; +// RTMSG_OVERRUN = NLMSG_OVERRUN; + RTMSG_NEWDEVICE = $11; + RTMSG_DELDEVICE = $12; + RTMSG_NEWROUTE = $21; + RTMSG_DELROUTE = $22; + RTMSG_NEWRULE = $31; + RTMSG_DELRULE = $32; + RTMSG_CONTROL = $40; + RTMSG_AR_FAILED = $51; + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nssh.inc b/jcl/source/fpc/libclite/nssh.inc new file mode 100644 index 0000000000..f4886e42b7 --- /dev/null +++ b/jcl/source/fpc/libclite/nssh.inc @@ -0,0 +1,19 @@ + +type + nss_status = + ( + NSS_STATUS_TRYAGAIN := -2, + NSS_STATUS_UNAVAIL := -1, + NSS_STATUS_NOTFOUND := 0, + NSS_STATUS_SUCCESS := 1, + NSS_STATUS_RETURN := 2 + ); + +function __nss_configure_lookup(__dbname:Pchar; __string:Pchar):longint;cdecl;external clib name '__nss_configure_lookup'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/ntcph.inc b/jcl/source/fpc/libclite/ntcph.inc new file mode 100644 index 0000000000..c09a20084b --- /dev/null +++ b/jcl/source/fpc/libclite/ntcph.inc @@ -0,0 +1,119 @@ + + +const + TCP_NODELAY = 1; + TCP_MAXSEG = 2; + TCP_CORK = 3; + TCP_KEEPIDLE = 4; + TCP_KEEPINTVL = 5; + TCP_KEEPCNT = 6; + TCP_SYNCNT = 7; + TCP_LINGER2 = 8; + TCP_DEFER_ACCEPT = 9; + TCP_WINDOW_CLAMP = 10; + TCP_INFO = 11; + TCP_QUICKACK = 12; + +const + TH_FIN = $01; + TH_SYN = $02; + TH_RST = $04; + TH_PUSH = $08; + TH_ACK = $10; + TH_URG = $20; + +type + Ptcphdr = ^tcphdr; + tcphdr = record + source : u_int16_t; + dest : u_int16_t; + seq : u_int32_t; + ack_seq : u_int32_t; + flag0 : u_int16_t; + window : u_int16_t; + check : u_int16_t; + urg_ptr : u_int16_t; + end; + + Const + TCP_ESTABLISHED = 1; + TCP_SYN_SENT = 2; + TCP_SYN_RECV = 3; + TCP_FIN_WAIT1 = 4; + TCP_FIN_WAIT2 = 5; + TCP_TIME_WAIT = 6; + TCP_CLOSE = 7; + TCP_CLOSE_WAIT = 8; + TCP_LAST_ACK = 9; + TCP_LISTEN = 10; + TCP_CLOSING = 11; + + TCPOPT_EOL = 0; + TCPOPT_NOP = 1; + TCPOPT_MAXSEG = 2; + TCPOLEN_MAXSEG = 4; + TCPOPT_WINDOW = 3; + TCPOLEN_WINDOW = 3; + TCPOPT_SACK_PERMITTED = 4; + TCPOLEN_SACK_PERMITTED = 2; + TCPOPT_SACK = 5; + TCPOPT_TIMESTAMP = 8; + TCPOLEN_TIMESTAMP = 10; + TCPOLEN_TSTAMP_APPA = TCPOLEN_TIMESTAMP + 2; + TCPOPT_TSTAMP_HDR = (((TCPOPT_NOP shl 24) or (TCPOPT_NOP shl 16)) or (TCPOPT_TIMESTAMP shl 8)) or TCPOLEN_TIMESTAMP; + TCP_MSS = 512; + TCP_MAXWIN = 65535; + TCP_MAX_WINSHIFT = 14; + + SOL_TCP = 6; + + TCPI_OPT_TIMESTAMPS = 1; + TCPI_OPT_SACK = 2; + TCPI_OPT_WSCALE = 4; + TCPI_OPT_ECN = 8; +type + tcp_ca_state = ( + TCP_CA_Open := 0, + TCP_CA_Disorder := 1, + TCP_CA_CWR := 2, + TCP_CA_Recovery := 3, + TCP_CA_Loss := 4); + +type + Ptcp_info = ^_tcp_info; + _tcp_info = record // Renamed, conflicts with TCP_INFO + tcpi_state : u_int8_t; + tcpi_ca_state : u_int8_t; + tcpi_retransmits : u_int8_t; + tcpi_probes : u_int8_t; + tcpi_backoff : u_int8_t; + tcpi_options : u_int8_t; + flag0 : u_int8_t; + tcpi_rto : u_int32_t; + tcpi_ato : u_int32_t; + tcpi_snd_mss : u_int32_t; + tcpi_rcv_mss : u_int32_t; + tcpi_unacked : u_int32_t; + tcpi_sacked : u_int32_t; + tcpi_lost : u_int32_t; + tcpi_retrans : u_int32_t; + tcpi_fackets : u_int32_t; + tcpi_last_data_sent : u_int32_t; + tcpi_last_ack_sent : u_int32_t; + tcpi_last_data_recv : u_int32_t; + tcpi_last_ack_recv : u_int32_t; + tcpi_pmtu : u_int32_t; + tcpi_rcv_ssthresh : u_int32_t; + tcpi_rtt : u_int32_t; + tcpi_rttvar : u_int32_t; + tcpi_snd_ssthresh : u_int32_t; + tcpi_snd_cwnd : u_int32_t; + tcpi_advmss : u_int32_t; + tcpi_reordering : u_int32_t; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nudph.inc b/jcl/source/fpc/libclite/nudph.inc new file mode 100644 index 0000000000..9bceaff54b --- /dev/null +++ b/jcl/source/fpc/libclite/nudph.inc @@ -0,0 +1,19 @@ + +type + Pudphdr = ^udphdr; + udphdr = record + source : u_int16_t; + dest : u_int16_t; + len : u_int16_t; + check : u_int16_t; + end; + +const + SOL_UDP = 17; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/nupdh.inc b/jcl/source/fpc/libclite/nupdh.inc new file mode 100644 index 0000000000..a7c457e3c9 --- /dev/null +++ b/jcl/source/fpc/libclite/nupdh.inc @@ -0,0 +1,6 @@ + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/pathsh.inc b/jcl/source/fpc/libclite/pathsh.inc new file mode 100644 index 0000000000..249060176c --- /dev/null +++ b/jcl/source/fpc/libclite/pathsh.inc @@ -0,0 +1,35 @@ + +const + _PATH_DEFPATH = '/usr/bin:/bin'; + _PATH_STDPATH = '/usr/bin:/bin:/usr/sbin:/sbin'; + _PATH_BSHELL = '/bin/sh'; + _PATH_CONSOLE = '/dev/console'; + _PATH_CSHELL = '/bin/csh'; + _PATH_DEVDB = '/var/run/dev.db'; + _PATH_DEVNULL = '/dev/null'; + _PATH_DRUM = '/dev/drum'; + _PATH_KLOG = '/proc/kmsg'; + _PATH_KMEM = '/dev/kmem'; + _PATH_LASTLOG = '/var/log/lastlog'; + _PATH_MAILDIR = '/var/mail'; + _PATH_MAN = '/usr/share/man'; + _PATH_MEM = '/dev/mem'; + _PATH_MNTTAB = '/etc/fstab'; + _PATH_MOUNTED = '/etc/mtab'; + _PATH_NOLOGIN = '/etc/nologin'; + _PATH_PRESERVE = '/var/lib'; + _PATH_RWHODIR = '/var/spool/rwho'; + _PATH_SENDMAIL = '/usr/sbin/sendmail'; + _PATH_SHADOW = '/etc/shadow'; + _PATH_SHELLS = '/etc/shells'; + _PATH_TTY = '/dev/tty'; + _PATH_UNIX = '/boot/vmlinux'; + _PATH_UTMP = '/var/run/utmp'; + _PATH_VI = '/usr/bin/vi'; + _PATH_WTMP = '/var/log/wtmp'; + _PATH_DEV = '/dev/'; + _PATH_TMP = '/tmp/'; + _PATH_VARDB = '/var/db/'; + _PATH_VARRUN = '/var/run/'; + _PATH_VARTMP = '/var/tmp/'; + diff --git a/jcl/source/fpc/libclite/posix1_limh.inc b/jcl/source/fpc/libclite/posix1_limh.inc new file mode 100644 index 0000000000..30f0cb109a --- /dev/null +++ b/jcl/source/fpc/libclite/posix1_limh.inc @@ -0,0 +1,36 @@ + +const + + _POSIX_AIO_LISTIO_MAX = 2; + _POSIX_AIO_MAX = 1; + _POSIX_ARG_MAX = 4096; + _POSIX_CHILD_MAX = 6; + _POSIX_DELAYTIMER_MAX = 32; + _POSIX_LINK_MAX = 8; + _POSIX_MAX_CANON = 255; + _POSIX_MAX_INPUT = 255; + _POSIX_MQ_OPEN_MAX = 8; + _POSIX_MQ_PRIO_MAX = 32; + _POSIX_NGROUPS_MAX = 0; + _POSIX_OPEN_MAX = 16; + _POSIX_FD_SETSIZE = _POSIX_OPEN_MAX; + _POSIX_NAME_MAX = 14; + _POSIX_PATH_MAX = 256; + _POSIX_PIPE_BUF = 512; + _POSIX_RTSIG_MAX = 8; + _POSIX_SEM_NSEMS_MAX = 256; + _POSIX_SEM_VALUE_MAX = 32767; + _POSIX_SIGQUEUE_MAX = 32; + _POSIX_SSIZE_MAX = 32767; + _POSIX_STREAM_MAX = 8; + _POSIX_TZNAME_MAX = 6; + _POSIX_QLIMIT = 1; + _POSIX_HIWAT = _POSIX_PIPE_BUF; + _POSIX_UIO_MAXIOV = 16; + _POSIX_TTY_NAME_MAX = 9; + _POSIX_TIMER_MAX = 32; + _POSIX_LOGIN_NAME_MAX = 9; + _POSIX_CLOCKRES_MIN = 20000000; + SSIZE_MAX = INT_MAX; + NGROUPS_MAX = _POSIX_NGROUPS_MAX; + diff --git a/jcl/source/fpc/libclite/posix2_limh.inc b/jcl/source/fpc/libclite/posix2_limh.inc new file mode 100644 index 0000000000..7d3f5233e8 --- /dev/null +++ b/jcl/source/fpc/libclite/posix2_limh.inc @@ -0,0 +1,24 @@ + +const + _POSIX2_BC_BASE_MAX = 99; + _POSIX2_BC_DIM_MAX = 2048; + _POSIX2_BC_SCALE_MAX = 99; + _POSIX2_BC_STRING_MAX = 1000; + _POSIX2_COLL_WEIGHTS_MAX = 2; + _POSIX2_EXPR_NEST_MAX = 32; + _POSIX2_LINE_MAX = 2048; + _POSIX2_RE_DUP_MAX = 255; + _POSIX2_CHARCLASS_NAME_MAX = 14; + + BC_BASE_MAX = _POSIX2_BC_BASE_MAX; + BC_DIM_MAX = _POSIX2_BC_DIM_MAX; + BC_SCALE_MAX = _POSIX2_BC_SCALE_MAX; + BC_STRING_MAX = _POSIX2_BC_STRING_MAX; + + COLL_WEIGHTS_MAX = 255; + EXPR_NEST_MAX = _POSIX2_EXPR_NEST_MAX; + LINE_MAX = _POSIX2_LINE_MAX; + CHARCLASS_NAME_MAX = 2048; + RE_DUP_MAX = $7fff; + + diff --git a/jcl/source/fpc/libclite/posixopth.inc b/jcl/source/fpc/libclite/posixopth.inc new file mode 100644 index 0000000000..270b375ee8 --- /dev/null +++ b/jcl/source/fpc/libclite/posixopth.inc @@ -0,0 +1,46 @@ + +const + _POSIX_JOB_CONTROL = 1; + _POSIX_SAVED_IDS = 1; + _POSIX_PRIORITY_SCHEDULING = 1; + _POSIX_SYNCHRONIZED_IO = 1; + _POSIX_FSYNC = 1; + _POSIX_MAPPED_FILES = 1; + _POSIX_MEMLOCK = 1; + _POSIX_MEMLOCK_RANGE = 1; + _POSIX_MEMORY_PROTECTION = 1; + _POSIX_POLL = 1; + _POSIX_SELECT = 1; + _POSIX_CHOWN_RESTRICTED = 1; + _POSIX_VDISABLE = #0; + _POSIX_NO_TRUNC = 1; + _XOPEN_REALTIME = 1; + _XOPEN_REALTIME_THREADS = 1; + _XOPEN_SHM = 1; + _POSIX_THREADS = 1; + _POSIX_REENTRANT_FUNCTIONS = 1; + _POSIX_THREAD_SAFE_FUNCTIONS = 1; + _POSIX_THREAD_PRIORITY_SCHEDULING = 1; + _POSIX_THREAD_ATTR_STACKSIZE = 1; + _POSIX_THREAD_ATTR_STACKADDR = 1; + _POSIX_SEMAPHORES = 1; + _POSIX_REALTIME_SIGNALS = 1; + _POSIX_ASYNCHRONOUS_IO = 1; + _POSIX_ASYNC_IO = 1; + _LFS_ASYNCHRONOUS_IO = 1; + _LFS64_ASYNCHRONOUS_IO = 1; + _LFS_LARGEFILE = 1; + _LFS64_LARGEFILE = 1; + _LFS64_STDIO = 1; + _POSIX_SHARED_MEMORY_OBJECTS = 1; + _POSIX_CPUTIME = 200912; + _POSIX_THREAD_CPUTIME = 200912; + _POSIX_REGEXP = 1; + _POSIX_READER_WRITER_LOCKS = 200912; + _POSIX_SHELL = 1; + _POSIX_TIMEOUTS = 200912; + _POSIX_SPIN_LOCKS = 200912; + _POSIX_SPAWN = 200912; + _POSIX_TIMERS = 1; + _POSIX_BARRIERS = 200912; + diff --git a/jcl/source/fpc/libclite/printfh.inc b/jcl/source/fpc/libclite/printfh.inc new file mode 100644 index 0000000000..0e38f47405 --- /dev/null +++ b/jcl/source/fpc/libclite/printfh.inc @@ -0,0 +1,45 @@ + +type + Pprintf_info = ^printf_info; + printf_info = record + prec : longint; + width : longint; + spec : wchar_t; + flag0 : dword; + pad : wchar_t; + end; + + printf_function = function(__stream: PIOFile; const __info: printf_info; __args: PPointer): Integer; cdecl; + printf_arginfo_function = function(const __info: printf_info; __n: size_t; var __argtypes: Integer): Integer; cdecl; + +function register_printf_function(__spec:longint; __func:printf_function; __arginfo:printf_arginfo_function):longint;cdecl;external clib name 'register_printf_function'; +function parse_printf_format(__fmt:Pchar; __n:size_t; __argtypes:Plongint):size_t;cdecl;external clib name 'parse_printf_format'; + +Const + PA_INT = 0; + PA_CHAR = 1; + PA_WCHAR = 2; + PA_STRING = 3; + PA_WSTRING = 4; + PA_POINTER = 5; + PA_FLOAT = 6; + PA_DOUBLE = 7; + PA_LAST = 8; + + PA_FLAG_MASK = $ff00; + PA_FLAG_LONG_LONG = 1 shl 8; + PA_FLAG_LONG_DOUBLE = PA_FLAG_LONG_LONG; + PA_FLAG_LONG = 1 shl 9; + PA_FLAG_SHORT = 1 shl 10; + PA_FLAG_PTR = 1 shl 11; + +function printf_size(__fp:PFILE; __info:Pprintf_info; __args:Ppointer):longint;cdecl;external clib name 'printf_size'; +function printf_size_info(__info:Pprintf_info; __n:size_t; __argtypes:Plongint):longint;cdecl;external clib name 'printf_size_info'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPrintfInfo = printf_info; + PPrintfInfo = ^TPrintfInfo; diff --git a/jcl/source/fpc/libclite/proutedh.inc b/jcl/source/fpc/libclite/proutedh.inc new file mode 100644 index 0000000000..fa505b0726 --- /dev/null +++ b/jcl/source/fpc/libclite/proutedh.inc @@ -0,0 +1,48 @@ + +const + RIPVERSION = 1; + +type + Pnetinfo = ^netinfo; + netinfo = record + rip_dst : sockaddr; + rip_metric : longint; + end; + + Prip = ^rip; + rip = record + rip_cmd : u_char; + rip_vers : u_char; + rip_res1 : array[0..1] of u_char; + ripun : record + case longint of + 0 : ( ru_nets : array[0..0] of netinfo ); + 1 : ( ru_tracefile : array[0..0] of char ); + end; + end; + + +const + RIPCMD_REQUEST = 1; + RIPCMD_RESPONSE = 2; + RIPCMD_TRACEON = 3; + RIPCMD_TRACEOFF = 4; + RIPCMD_MAX = 5; + + ripcmds : array [0..RIPCMD_MAX-1] of pchar = ( ''#0, 'REQUEST', 'RESPONSE', 'TRACEON', 'TRACEOFF' ); + +const + HOPCNT_INFINITY = 16; + MAXPACKETSIZE = 512; + TIMER_RATE = 30; + SUPPLY_INTERVAL = 30; + MIN_WAITTIME = 2; + MAX_WAITTIME = 5; + EXPIRE_TIME = 180; + GARBAGE_TIME = 240; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/prwhodh.inc b/jcl/source/fpc/libclite/prwhodh.inc new file mode 100644 index 0000000000..6a0a689ef8 --- /dev/null +++ b/jcl/source/fpc/libclite/prwhodh.inc @@ -0,0 +1,37 @@ + +type + Poutmp = ^outmp; + outmp = record + out_line : array[0..7] of char; + out_name : array[0..7] of char; + out_time : int32_t; + end; + + whoent = record + we_utmp: outmp; + we_idle: Integer; + end; + + Pwhod = ^whod; + whod = record + wd_vers : char; + wd_type : char; + wd_pad : array[0..1] of char; + wd_sendtime : longint; + wd_recvtime : longint; + wd_hostname : array[0..31] of char; + wd_loadav : array[0..2] of longint; + wd_boottime : longint; + wd_we: packed array[0..(1024 div SizeOf(whoent))-1] of whoent; + end; + + +const + WHODVERSION = 1; + WHODTYPE_STATUS = 1; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/ptalkdh.inc b/jcl/source/fpc/libclite/ptalkdh.inc new file mode 100644 index 0000000000..8ce4331cd5 --- /dev/null +++ b/jcl/source/fpc/libclite/ptalkdh.inc @@ -0,0 +1,56 @@ + + +const + NAME_SIZE = 12; + TTY_SIZE = 16; +type + + PCTL_MSG = ^CTL_MSG; + CTL_MSG = record + vers : u_char; + _type : u_char; + answer : u_char; + pad : u_char; + id_num : u_int32_t; + addr : osockaddr; + ctl_addr : osockaddr; + pid : int32_t; + l_name : array[0..(NAME_SIZE)-1] of char; + r_name : array[0..(NAME_SIZE)-1] of char; + r_tty : array[0..(TTY_SIZE)-1] of char; + end; + + PCTL_RESPONSE = ^CTL_RESPONSE; + CTL_RESPONSE = record + vers : u_char; + _type : u_char; + answer : u_char; + pad : u_char; + id_num : u_int32_t; + addr : osockaddr; + end; + +const + TALK_VERSION = 1; + LEAVE_INVITE = 0; + LOOK_UP = 1; + __DELETE = 2; + ANNOUNCE = 3; + SUCCESS = 0; + NOT_HERE = 1; + FAILED = 2; + MACHINE_UNKNOWN = 3; + PERMISSION_DENIED = 4; + UNKNOWN_REQUEST = 5; + BADVERSION = 6; + BADADDR = 7; + BADCTLADDR = 8; + MAX_LIFE = 60; + RING_WAIT = 30; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/pthread.inc b/jcl/source/fpc/libclite/pthread.inc new file mode 100644 index 0000000000..2e341061f6 --- /dev/null +++ b/jcl/source/fpc/libclite/pthread.inc @@ -0,0 +1,23 @@ +Function InitializeCriticalSection(var lpCriticalSection: TRTLCriticalSection): Integer; + +var + Attr : pthread_mutexattr_t; + +begin + Result:=pthread_mutexattr_init(Attr); + if Result=0 then + Try + Result:=pthread_mutexattr_settype(Attr,PTHREAD_MUTEX_RECURSIVE); + if Result=0 then + Result:=pthread_mutex_init(lpCriticalSection, Attr); + Finally + pthread_mutexattr_destroy(Attr); + end; +end; + +function TryEnterCriticalSection(var lpCriticalSection: TRTLCriticalSection): Boolean; +begin + Result:=EBUSY<>pthread_mutex_trylock(lpCriticalSection); +end; + + \ No newline at end of file diff --git a/jcl/source/fpc/libclite/pthreadh.inc b/jcl/source/fpc/libclite/pthreadh.inc new file mode 100644 index 0000000000..d9f4baa12c --- /dev/null +++ b/jcl/source/fpc/libclite/pthreadh.inc @@ -0,0 +1,266 @@ + +Const + PTHREAD_CREATE_JOINABLE = 0; + PTHREAD_CREATE_DETACHED = 1; + + PTHREAD_INHERIT_SCHED = 0; + PTHREAD_EXPLICIT_SCHED = 1; + + PTHREAD_SCOPE_SYSTEM = 0; + PTHREAD_SCOPE_PROCESS = 1; + + PTHREAD_MUTEX_TIMED_NP = 0; + PTHREAD_MUTEX_RECURSIVE_NP = 1; + PTHREAD_MUTEX_ERRORCHECK_NP = 2; + PTHREAD_MUTEX_ADAPTIVE_NP = 3; + PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_TIMED_NP; + PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP; + PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP; + PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL; + PTHREAD_MUTEX_FAST_NP = PTHREAD_MUTEX_ADAPTIVE_NP; + + PTHREAD_PROCESS_PRIVATE = 0; + PTHREAD_PROCESS_SHARED = 1; + + PTHREAD_RWLOCK_PREFER_READER_NP = 0; + PTHREAD_RWLOCK_PREFER_WRITER_NP = 1; + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP = 2; + PTHREAD_RWLOCK_DEFAULT_NP = PTHREAD_RWLOCK_PREFER_WRITER_NP; + + PTHREAD_ONCE_INIT = 0; + +type + TPThreadCleanupRoutine = procedure(Arg: Pointer); cdecl; + + P_pthread_cleanup_buffer = ^_pthread_cleanup_buffer; + _pthread_cleanup_buffer = record + __routine : TPThreadCleanupRoutine; + __arg : pointer; + __canceltype : longint; + __prev : P_pthread_cleanup_buffer; + end; + + +Const + PTHREAD_CANCEL_ENABLE = 0; + PTHREAD_CANCEL_DISABLE = 1; + + PTHREAD_CANCEL_DEFERRED = 0; + PTHREAD_CANCEL_ASYNCHRONOUS = 1; + + PTHREAD_CANCELED = Pointer(-1); + PTHREAD_BARRIER_SERIAL_THREAD = -1; + + NONRECURSIVE = 0; + RECURSIVE = 1; + + + + + // procedural types used in parameters to pthread functions +Type + TStartRoutine = function (_para1:pointer): integer; cdecl;// pthread_create + TKeyValueDestructor = procedure(ValueInKey: Pointer); cdecl; + TInitOnceProc = Procedure;cdecl; + TForkHandler = procedure; cdecl; + + + +procedure __pthread_initialize;cdecl;external threadslib name '__pthread_initialize'; +function pthread_create(__thread:Ppthread_t; __attr:Ppthread_attr_t; __start_routine:TStartRoutine; __arg:pointer):longint;cdecl;external threadslib name 'pthread_create'; +function pthread_self:pthread_t;cdecl;external threadslib name 'pthread_self'; +function pthread_equal(__thread1:pthread_t; __thread2:pthread_t):longint;cdecl;external threadslib name 'pthread_equal'; +procedure pthread_exit(__retval:pointer);cdecl;external threadslib name 'pthread_exit'; +function pthread_join(__th:pthread_t; __thread_return:Ppointer):longint;cdecl;external threadslib name 'pthread_join'; +function pthread_detach(__th:pthread_t):longint;cdecl;external threadslib name 'pthread_detach'; +function pthread_attr_init(__attr:Ppthread_attr_t):longint;cdecl;external threadslib name 'pthread_attr_init'; +function pthread_attr_destroy(__attr:Ppthread_attr_t):longint;cdecl;external threadslib name 'pthread_attr_destroy'; +function pthread_attr_setdetachstate(__attr:Ppthread_attr_t; __detachstate:longint):longint;cdecl;external threadslib name 'pthread_attr_setdetachstate'; +function pthread_attr_getdetachstate(__attr:Ppthread_attr_t; __detachstate:Plongint):longint;cdecl;external threadslib name 'pthread_attr_getdetachstate'; +function pthread_attr_setschedparam(__attr:Ppthread_attr_t; __param:Psched_param):longint;cdecl;external threadslib name 'pthread_attr_setschedparam'; +function pthread_attr_getschedparam(__attr:Ppthread_attr_t; __param:Psched_param):longint;cdecl;external threadslib name 'pthread_attr_getschedparam'; +function pthread_attr_setschedpolicy(__attr:Ppthread_attr_t; __policy:longint):longint;cdecl;external threadslib name 'pthread_attr_setschedpolicy'; +function pthread_attr_getschedpolicy(__attr:Ppthread_attr_t; __policy:Plongint):longint;cdecl;external threadslib name 'pthread_attr_getschedpolicy'; +function pthread_attr_setinheritsched(__attr:Ppthread_attr_t; __inherit:longint):longint;cdecl;external threadslib name 'pthread_attr_setinheritsched'; +function pthread_attr_getinheritsched(__attr:Ppthread_attr_t; __inherit:Plongint):longint;cdecl;external threadslib name 'pthread_attr_getinheritsched'; +function pthread_attr_setscope(__attr:Ppthread_attr_t; __scope:longint):longint;cdecl;external threadslib name 'pthread_attr_setscope'; +function pthread_attr_getscope(__attr:Ppthread_attr_t; __scope:Plongint):longint;cdecl;external threadslib name 'pthread_attr_getscope'; +function pthread_attr_setguardsize(__attr:Ppthread_attr_t; __guardsize:size_t):longint;cdecl;external threadslib name 'pthread_attr_setguardsize'; +function pthread_attr_getguardsize(__attr:Ppthread_attr_t; __guardsize:Psize_t):longint;cdecl;external threadslib name 'pthread_attr_getguardsize'; +function pthread_attr_setstackaddr(__attr:Ppthread_attr_t; __stackaddr:pointer):longint;cdecl;external threadslib name 'pthread_attr_setstackaddr'; +function pthread_attr_getstackaddr(__attr:Ppthread_attr_t; __stackaddr:Ppointer):longint;cdecl;external threadslib name 'pthread_attr_getstackaddr'; +function pthread_attr_setstack(__attr:Ppthread_attr_t; __stackaddr:pointer; __stacksize:size_t):longint;cdecl;external threadslib name 'pthread_attr_setstack'; +function pthread_attr_getstack(__attr:Ppthread_attr_t; __stackaddr:Ppointer; __stacksize:Psize_t):longint;cdecl;external threadslib name 'pthread_attr_getstack'; +function pthread_attr_setstacksize(__attr:Ppthread_attr_t; __stacksize:size_t):longint;cdecl;external threadslib name 'pthread_attr_setstacksize'; +function pthread_attr_getstacksize(__attr:Ppthread_attr_t; __stacksize:Psize_t):longint;cdecl;external threadslib name 'pthread_attr_getstacksize'; +function pthread_getattr_np(__th:pthread_t; __attr:Ppthread_attr_t):longint;cdecl;external threadslib name 'pthread_getattr_np'; +function pthread_setschedparam(__target_thread:pthread_t; __policy:longint; __param:Psched_param):longint;cdecl;external threadslib name 'pthread_setschedparam'; +function pthread_getschedparam(__target_thread:pthread_t; __policy:Plongint; __param:Psched_param):longint;cdecl;external threadslib name 'pthread_getschedparam'; +function pthread_getconcurrency:longint;cdecl;external threadslib name 'pthread_getconcurrency'; +function pthread_setconcurrency(__level:longint):longint;cdecl;external threadslib name 'pthread_setconcurrency'; +function pthread_yield:longint;cdecl;external threadslib name 'pthread_yield'; +function pthread_mutex_init(__mutex:Ppthread_mutex_t; __mutex_attr:Ppthread_mutexattr_t):longint;cdecl;external threadslib name 'pthread_mutex_init'; +function pthread_mutex_destroy(__mutex:Ppthread_mutex_t):longint;cdecl;external threadslib name 'pthread_mutex_destroy'; +function pthread_mutex_trylock(__mutex:Ppthread_mutex_t):longint;cdecl;external threadslib name 'pthread_mutex_trylock'; +function pthread_mutex_lock(__mutex:Ppthread_mutex_t):longint;cdecl;external threadslib name 'pthread_mutex_lock'; +function pthread_mutex_timedlock(__mutex:Ppthread_mutex_t; __abstime:Ptimespec):longint;cdecl;external threadslib name 'pthread_mutex_timedlock'; +function pthread_mutex_unlock(__mutex:Ppthread_mutex_t):longint;cdecl;external threadslib name 'pthread_mutex_unlock'; +function pthread_mutexattr_init(__attr:Ppthread_mutexattr_t):longint;cdecl;external threadslib name 'pthread_mutexattr_init'; +function pthread_mutexattr_destroy(__attr:Ppthread_mutexattr_t):longint;cdecl;external threadslib name 'pthread_mutexattr_destroy'; +function pthread_mutexattr_getpshared(__attr:Ppthread_mutexattr_t; __pshared:Plongint):longint;cdecl;external threadslib name 'pthread_mutexattr_getpshared'; +function pthread_mutexattr_setpshared(__attr:Ppthread_mutexattr_t; __pshared:longint):longint;cdecl;external threadslib name 'pthread_mutexattr_setpshared'; +function pthread_mutexattr_settype(__attr:Ppthread_mutexattr_t; __kind:longint):longint;cdecl;external threadslib name 'pthread_mutexattr_settype'; +function pthread_mutexattr_gettype(__attr:Ppthread_mutexattr_t; __kind:Plongint):longint;cdecl;external threadslib name 'pthread_mutexattr_gettype'; +function pthread_cond_init(__cond:Ppthread_cond_t; __cond_attr:Ppthread_condattr_t):longint;cdecl;external threadslib name 'pthread_cond_init'; +function pthread_cond_destroy(__cond:Ppthread_cond_t):longint;cdecl;external threadslib name 'pthread_cond_destroy'; +function pthread_cond_signal(__cond:Ppthread_cond_t):longint;cdecl;external threadslib name 'pthread_cond_signal'; +function pthread_cond_broadcast(__cond:Ppthread_cond_t):longint;cdecl;external threadslib name 'pthread_cond_broadcast'; +function pthread_cond_wait(__cond:Ppthread_cond_t; __mutex:Ppthread_mutex_t):longint;cdecl;external threadslib name 'pthread_cond_wait'; +function pthread_cond_timedwait(__cond:Ppthread_cond_t; __mutex:Ppthread_mutex_t; __abstime:Ptimespec):longint;cdecl;external threadslib name 'pthread_cond_timedwait'; +function pthread_condattr_init(__attr:Ppthread_condattr_t):longint;cdecl;external threadslib name 'pthread_condattr_init'; +function pthread_condattr_destroy(__attr:Ppthread_condattr_t):longint;cdecl;external threadslib name 'pthread_condattr_destroy'; +function pthread_condattr_getpshared(__attr:Ppthread_condattr_t; __pshared:Plongint):longint;cdecl;external threadslib name 'pthread_condattr_getpshared'; +function pthread_condattr_setpshared(__attr:Ppthread_condattr_t; __pshared:longint):longint;cdecl;external threadslib name 'pthread_condattr_setpshared'; +function pthread_rwlock_init(__rwlock:Ppthread_rwlock_t; __attr:Ppthread_rwlockattr_t):longint;cdecl;external threadslib name 'pthread_rwlock_init'; +function pthread_rwlock_destroy(__rwlock:Ppthread_rwlock_t):longint;cdecl;external threadslib name 'pthread_rwlock_destroy'; +function pthread_rwlock_rdlock(__rwlock:Ppthread_rwlock_t):longint;cdecl;external threadslib name 'pthread_rwlock_rdlock'; +function pthread_rwlock_tryrdlock(__rwlock:Ppthread_rwlock_t):longint;cdecl;external threadslib name 'pthread_rwlock_tryrdlock'; +function pthread_rwlock_timedrdlock(__rwlock:Ppthread_rwlock_t; __abstime:Ptimespec):longint;cdecl;external threadslib name 'pthread_rwlock_timedrdlock'; +function pthread_rwlock_wrlock(__rwlock:Ppthread_rwlock_t):longint;cdecl;external threadslib name 'pthread_rwlock_wrlock'; +function pthread_rwlock_trywrlock(__rwlock:Ppthread_rwlock_t):longint;cdecl;external threadslib name 'pthread_rwlock_trywrlock'; +function pthread_rwlock_timedwrlock(__rwlock:Ppthread_rwlock_t; __abstime:Ptimespec):longint;cdecl;external threadslib name 'pthread_rwlock_timedwrlock'; +function pthread_rwlock_unlock(__rwlock:Ppthread_rwlock_t):longint;cdecl;external threadslib name 'pthread_rwlock_unlock'; +function pthread_rwlockattr_init(__attr:Ppthread_rwlockattr_t):longint;cdecl;external threadslib name 'pthread_rwlockattr_init'; +function pthread_rwlockattr_destroy(__attr:Ppthread_rwlockattr_t):longint;cdecl;external threadslib name 'pthread_rwlockattr_destroy'; +function pthread_rwlockattr_getpshared(__attr:Ppthread_rwlockattr_t; __pshared:Plongint):longint;cdecl;external threadslib name 'pthread_rwlockattr_getpshared'; +function pthread_rwlockattr_setpshared(__attr:Ppthread_rwlockattr_t; __pshared:longint):longint;cdecl;external threadslib name 'pthread_rwlockattr_setpshared'; +function pthread_rwlockattr_getkind_np(__attr:Ppthread_rwlockattr_t; __pref:Plongint):longint;cdecl;external threadslib name 'pthread_rwlockattr_getkind_np'; +function pthread_rwlockattr_setkind_np(__attr:Ppthread_rwlockattr_t; __pref:longint):longint;cdecl;external threadslib name 'pthread_rwlockattr_setkind_np'; +function pthread_spin_init(__lock:Ppthread_spinlock_t; __pshared:longint):longint;cdecl;external threadslib name 'pthread_spin_init'; +function pthread_spin_destroy(__lock:Ppthread_spinlock_t):longint;cdecl;external threadslib name 'pthread_spin_destroy'; +function pthread_spin_lock(__lock:Ppthread_spinlock_t):longint;cdecl;external threadslib name 'pthread_spin_lock'; +function pthread_spin_trylock(__lock:Ppthread_spinlock_t):longint;cdecl;external threadslib name 'pthread_spin_trylock'; +function pthread_spin_unlock(__lock:Ppthread_spinlock_t):longint;cdecl;external threadslib name 'pthread_spin_unlock'; +function pthread_barrier_init(__barrier:Ppthread_barrier_t; __attr:Ppthread_barrierattr_t; __count:dword):longint;cdecl;external threadslib name 'pthread_barrier_init'; +function pthread_barrier_destroy(__barrier:Ppthread_barrier_t):longint;cdecl;external threadslib name 'pthread_barrier_destroy'; +function pthread_barrierattr_init(__attr:Ppthread_barrierattr_t):longint;cdecl;external threadslib name 'pthread_barrierattr_init'; +function pthread_barrierattr_destroy(__attr:Ppthread_barrierattr_t):longint;cdecl;external threadslib name 'pthread_barrierattr_destroy'; +function pthread_barrierattr_getpshared(__attr:Ppthread_barrierattr_t; __pshared:Plongint):longint;cdecl;external threadslib name 'pthread_barrierattr_getpshared'; +function pthread_barrierattr_setpshared(__attr:Ppthread_barrierattr_t; __pshared:longint):longint;cdecl;external threadslib name 'pthread_barrierattr_setpshared'; +function pthread_barrier_wait(__barrier:Ppthread_barrier_t):longint;cdecl;external threadslib name 'pthread_barrier_wait'; +function pthread_key_create(__key:Ppthread_key_t; __destr_function:TKeyValueDestructor):longint;cdecl;external threadslib name 'pthread_key_create'; +function pthread_key_delete(__key:pthread_key_t):longint;cdecl;external threadslib name 'pthread_key_delete'; +function pthread_setspecific(__key:pthread_key_t; __pointer:pointer):longint;cdecl;external threadslib name 'pthread_setspecific'; +function pthread_getspecific(__key:pthread_key_t):pointer;cdecl;external threadslib name 'pthread_getspecific'; +function pthread_once(__once_control:Ppthread_once_t; __init_routine:TinitOnceProc ):longint;cdecl;external threadslib name 'pthread_once'; +function pthread_setcancelstate(__state:longint; __oldstate:Plongint):longint;cdecl;external threadslib name 'pthread_setcancelstate'; +function pthread_setcanceltype(__type:longint; __oldtype:Plongint):longint;cdecl;external threadslib name 'pthread_setcanceltype'; +function pthread_cancel(__thread:pthread_t):longint;cdecl;external threadslib name 'pthread_cancel'; +procedure pthread_testcancel;cdecl;external threadslib name 'pthread_testcancel'; +procedure _pthread_cleanup_push(__buffer:P_pthread_cleanup_buffer;__routine:TPThreadCleanupRoutine; __arg:pointer);cdecl;external threadslib name '_pthread_cleanup_push'; +procedure _pthread_cleanup_pop(__buffer:P_pthread_cleanup_buffer; __execute:longint);cdecl;external threadslib name '_pthread_cleanup_pop'; +procedure _pthread_cleanup_push_defer(__buffer:P_pthread_cleanup_buffer; __routine:TPThreadCleanupRoutine; __arg:pointer);cdecl;external threadslib name '_pthread_cleanup_push_defer'; +procedure _pthread_cleanup_pop_restore(__buffer:P_pthread_cleanup_buffer; __execute:longint);cdecl;external threadslib name '_pthread_cleanup_pop_restore'; +function pthread_getcpuclockid(__thread_id:pthread_t; __clock_id:Pclockid_t):longint;cdecl;external threadslib name 'pthread_getcpuclockid'; +function pthread_atfork(__prepare:TForkHandler ; _parent:TForkHandler ; __child:TForkHandler ):longint;cdecl;external threadslib name 'pthread_atfork'; +procedure pthread_kill_other_threads_np;cdecl;external threadslib name 'pthread_kill_other_threads_np'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPthreadCleanupBuffer = _pthread_cleanup_buffer; + +function pthread_create(var __thread:pthread_t; var __attr: pthread_attr_t; __start_routine:TStartRoutine; __arg:pointer):longint;cdecl; external threadslib; +function pthread_join(__th:pthread_t; var __thread_return:pointer):longint;cdecl; external threadslib; +function pthread_attr_init(var __attr: pthread_attr_t):longint;cdecl; external threadslib; +function pthread_attr_destroy(var __attr: pthread_attr_t):longint;cdecl; external threadslib; +function pthread_attr_setdetachstate(var __attr: pthread_attr_t; __detachstate:longint):longint;cdecl; external threadslib; +function pthread_attr_getdetachstate(var __attr: pthread_attr_t; var __detachstate:longint):longint;cdecl; external threadslib; +function pthread_attr_setschedparam(var __attr: pthread_attr_t; const __param: sched_param):longint;cdecl; external threadslib; +function pthread_attr_getschedparam(var __attr: pthread_attr_t; var __param: sched_param):longint;cdecl; external threadslib; +function pthread_attr_setschedpolicy(var __attr: pthread_attr_t; __policy:longint):longint;cdecl; external threadslib; +function pthread_attr_getschedpolicy(var __attr: pthread_attr_t; var __policy:longint):longint;cdecl; external threadslib; +function pthread_attr_setinheritsched(var __attr: pthread_attr_t; __inherit:longint):longint;cdecl; external threadslib; +function pthread_attr_getinheritsched(var __attr: pthread_attr_t; var __inherit: longint):longint;cdecl; external threadslib; +function pthread_attr_setscope(var __attr: pthread_attr_t; __scope:longint):longint;cdecl; external threadslib; +function pthread_attr_getscope(var __attr: pthread_attr_t; var __scope: longint):longint;cdecl; external threadslib; +function pthread_attr_setstackaddr(var __attr: pthread_attr_t; __stackaddr:pointer):longint;cdecl; external threadslib; +function pthread_attr_getstackaddr(var __attr: pthread_attr_t; var __stackaddr:pointer):longint;cdecl; external threadslib; +function pthread_attr_setstacksize(var __attr: pthread_attr_t; __stacksize:size_t):longint;cdecl; external threadslib; +function pthread_attr_getstacksize(var __attr: pthread_attr_t; var __stacksize: size_t):longint;cdecl; external threadslib; +function pthread_attr_getguardsize(var __attr: pthread_attr_t; var Guardsize: Cardinal): Integer; cdecl;external threadslib; +function pthread_attr_setguardsize(var __attr: pthread_attr_t; Guardsize: Cardinal): Integer; cdecl;external threadslib; +function pthread_setschedparam(__target_thread:pthread_t; __policy:longint; const __param: sched_param):longint;cdecl; external threadslib; +function pthread_getschedparam(__target_thread:pthread_t; var __policy: longint; var __param: sched_param):longint;cdecl; external threadslib; +function pthread_mutex_init(var __mutex: pthread_mutex_t; var __mutex_attr: pthread_mutexattr_t):longint;cdecl; external threadslib; +function pthread_mutex_destroy(var __mutex: pthread_mutex_t):longint;cdecl; external threadslib; +function pthread_mutex_trylock(var __mutex: pthread_mutex_t):longint;cdecl; external threadslib; +function pthread_mutex_lock(var __mutex: pthread_mutex_t):longint;cdecl; external threadslib; +function pthread_mutex_unlock(var __mutex: pthread_mutex_t):longint;cdecl; external threadslib; +function pthread_mutexattr_init(var __attr: pthread_mutexattr_t):longint;cdecl; external threadslib; +function pthread_mutexattr_destroy(var __attr: pthread_mutexattr_t):longint;cdecl; external threadslib; +function pthread_mutexattr_getpshared(var __attr: pthread_mutexattr_t; var __pshared: longint):longint;cdecl; external threadslib; +function pthread_mutexattr_setpshared(var __attr: pthread_mutexattr_t; __pshared:longint):longint;cdecl; external threadslib; +function pthread_mutexattr_settype(var __attr: pthread_mutexattr_t; Kind: Integer): Integer; cdecl;external threadslib; +function pthread_mutexattr_gettype(var __attr: pthread_mutexattr_t; var Kind: Integer): Integer; cdecl;external threadslib; +function pthread_cond_init(var __cond: pthread_cond_t;var __cond_attr: pthread_condattr_t):longint;cdecl; external threadslib; +function pthread_cond_destroy(var __cond: pthread_cond_t):longint;cdecl; external threadslib; +function pthread_cond_signal(var __cond: pthread_cond_t):longint;cdecl; external threadslib; +function pthread_cond_broadcast(var __cond: pthread_cond_t):longint;cdecl; external threadslib; +function pthread_cond_wait(var __cond: pthread_cond_t; var __mutex: pthread_mutex_t):longint;cdecl; external threadslib; +function pthread_cond_timedwait(var __cond: pthread_cond_t; var __mutex: pthread_mutex_t; var __abstime: timespec):longint;cdecl; external threadslib; +function pthread_condattr_init(var __attr: pthread_condattr_t):longint;cdecl; external threadslib; +function pthread_condattr_destroy(var __attr: pthread_condattr_t):longint;cdecl; external threadslib; +function pthread_condattr_getpshared(var __attr: pthread_condattr_t; var __pshared:longint):longint;cdecl; external threadslib; +function pthread_condattr_setpshared(var __attr: pthread_condattr_t; __pshared:longint):longint;cdecl; external threadslib; +function pthread_rwlock_init(var __rwlock: pthread_rwlock_t; var __attr: pthread_rwlockattr_t):longint;cdecl; external threadslib; +function pthread_rwlock_destroy(var __rwlock: pthread_rwlock_t):longint;cdecl;external threadslib; +function pthread_rwlock_rdlock(var __rwlock: pthread_rwlock_t):longint;cdecl;external threadslib; +function pthread_rwlock_tryrdlock(var __rwlock: pthread_rwlock_t):longint;cdecl;external threadslib; +function pthread_rwlock_timedrdlock(var __rwlock: pthread_rwlock_t; __abstime:Ptimespec):longint;cdecl;external threadslib; +function pthread_rwlock_wrlock(var __rwlock: pthread_rwlock_t):longint;cdecl;external threadslib; +function pthread_rwlock_trywrlock(var __rwlock: pthread_rwlock_t):longint;cdecl; external threadslib; +function pthread_rwlock_timedwrlock(var __rwlock: pthread_rwlock_t; __abstime:Ptimespec):longint;cdecl;external threadslib; +function pthread_rwlock_unlock(var __rwlock: pthread_rwlock_t):longint;cdecl;external threadslib; +function pthread_rwlockattr_init(var __attr: pthread_rwlockattr_t):longint;cdecl;external threadslib; +function pthread_rwlockattr_destroy(var __attr: pthread_rwlockattr_t):longint;cdecl;external threadslib; +function pthread_rwlockattr_getpshared(var __attr: pthread_rwlockattr_t; var __pshared: longint):longint;cdecl;external threadslib; +function pthread_rwlockattr_setpshared(var __attr: pthread_rwlockattr_t; __pshared:longint):longint;cdecl;external threadslib; +function pthread_rwlockattr_getkind_np(var __attr: pthread_rwlockattr_t; var __pref: longint):longint;cdecl;external threadslib; +function pthread_rwlockattr_setkind_np(var __attr: pthread_rwlockattr_t; __pref:longint):longint;cdecl;external threadslib; +function pthread_spin_init(var __lock: pthread_spinlock_t; __pshared:longint):longint;cdecl;external threadslib; +function pthread_spin_destroy(var __lock: pthread_spinlock_t):longint;cdecl;external threadslib; +function pthread_spin_lock(var __lock: pthread_spinlock_t):longint;cdecl;external threadslib; +function pthread_spin_trylock(var __lock: pthread_spinlock_t):longint;cdecl;external threadslib; +function pthread_spin_unlock(var __lock: pthread_spinlock_t):longint;cdecl;external threadslib; +function pthread_barrier_init(var __barrier: pthread_barrier_t;var __attr: pthread_barrierattr_t; __count:dword):longint;cdecl;external threadslib; +function pthread_barrier_destroy(var __barrier: pthread_barrier_t):longint;cdecl;external threadslib; +function pthread_barrierattr_init(var __attr: pthread_barrierattr_t):longint;cdecl;external threadslib; +function pthread_barrierattr_destroy(var __attr: pthread_barrierattr_t):longint;cdecl;external threadslib; +function pthread_barrierattr_getpshared(var __attr: pthread_barrierattr_t; var __pshared:longint):longint;cdecl;external threadslib; +function pthread_barrierattr_setpshared(var __attr: pthread_barrierattr_t; __pshared:longint):longint;cdecl;external threadslib; +function pthread_barrier_wait(var __barrier: pthread_barrier_t):longint;cdecl;external threadslib; +function pthread_key_create(var __key: pthread_key_t; __destr_function :TKeyValueDestructor):longint;cdecl; external threadslib; +function pthread_once(var __once_control: pthread_once_t; __init_routine:Tprocedure ):longint;cdecl; external threadslib; +function pthread_setcancelstate(__state:longint; var __oldstate:longint):longint;cdecl; external threadslib; +function pthread_setcanceltype(__type:longint;var __oldtype:longint):longint;cdecl; external threadslib; + +procedure _pthread_cleanup_push(var __buffer: _pthread_cleanup_buffer; __routine:TPthreadCleanupRoutine; __arg:pointer);cdecl; external threadslib; +procedure _pthread_cleanup_pop(var __buffer:_pthread_cleanup_buffer; __execute:longint);cdecl; external threadslib; +function pthread_sigmask(__how:longint; var __newmask:__sigset_t; var __oldmask:__sigset_t):longint;cdecl; external threadslib; + +{ Borland compatibility } + +function GetCurrentThreadID: TTHreadID ; cdecl; external threadslib name 'pthread_self'; +function InitializeCriticalSection(var lpCriticalSection: TRTLCriticalSection): Integer; +function EnterCriticalSection(var lpCriticalSection: TRTLCriticalSection): Integer; cdecl; external threadslib name 'pthread_mutex_lock'; +function LeaveCriticalSection(var lpCriticalSection: TRTLCriticalSection): Integer; cdecl; external threadslib name 'pthread_mutex_unlock'; +function TryEnterCriticalSection(var lpCriticalSection: TRTLCriticalSection): Boolean; +function DeleteCriticalSection(var lpCriticalSection: TRTLCriticalSection): Integer; cdecl; external threadslib name 'pthread_mutex_destroy'; + +Type + TPThreadFunc = function(Parameter: Pointer): Integer; cdecl; + PPthreadCleanupBuffer = ^_pthread_cleanup_buffer; \ No newline at end of file diff --git a/jcl/source/fpc/libclite/pthreadtypesh.inc b/jcl/source/fpc/libclite/pthreadtypesh.inc new file mode 100644 index 0000000000..3fabc3c3a3 --- /dev/null +++ b/jcl/source/fpc/libclite/pthreadtypesh.inc @@ -0,0 +1,140 @@ + +type + P_pthread_fastlock = ^_pthread_fastlock; + _pthread_fastlock = record + __status : longint; + __spinlock : longint; + end; + + P_pthread_descr = ^_pthread_descr; + _pthread_descr = pointer; // Opaque type. + + P__pthread_attr_s = ^__pthread_attr_s; + __pthread_attr_s = record + __detachstate : longint; + __schedpolicy : longint; + __schedparam : __sched_param; + __inheritsched : longint; + __scope : longint; + __guardsize : size_t; + __stackaddr_set : longint; + __stackaddr : pointer; + __stacksize : size_t; + end; + pthread_attr_t = __pthread_attr_s; + Ppthread_attr_t = ^pthread_attr_t; + + Ppthread_cond_t = ^pthread_cond_t; + pthread_cond_t = unixtype.pthread_cond_t; + {record + __c_lock : _pthread_fastlock; + __c_waiting : _pthread_descr; + end;} + + Ppthread_condattr_t = ^pthread_condattr_t; + pthread_condattr_t = record + __dummy : longint; + end; + + Ppthread_key_t = ^pthread_key_t; + pthread_key_t = dword; + + Ppthread_mutex_t = ^pthread_mutex_t; + pthread_mutex_t = record + __m_reserved : longint; + __m_count : longint; + __m_owner : _pthread_descr; + __m_kind : longint; + __m_lock : _pthread_fastlock; + end; + + Ppthread_mutexattr_t = ^pthread_mutexattr_t; + pthread_mutexattr_t = record + __mutexkind : longint; + end; + + Ppthread_once_t = ^pthread_once_t; + pthread_once_t = longint; + + P_pthread_rwlock_t = ^_pthread_rwlock_t; + _pthread_rwlock_t = record + __rw_lock : _pthread_fastlock; + __rw_readers : longint; + __rw_writer : _pthread_descr; + __rw_read_waiting : _pthread_descr; + __rw_write_waiting : _pthread_descr; + __rw_kind : longint; + __rw_pshared : longint; + end; + pthread_rwlock_t = _pthread_rwlock_t; + Ppthread_rwlock_t = ^pthread_rwlock_t; + + Ppthread_rwlockattr_t = ^pthread_rwlockattr_t; + pthread_rwlockattr_t = record + __lockkind : longint; + __pshared : longint; + end; + + Ppthread_spinlock_t = ^pthread_spinlock_t; + pthread_spinlock_t = longint; + + Ppthread_barrier_t = ^pthread_barrier_t; + pthread_barrier_t = record + __ba_lock : _pthread_fastlock; + __ba_required : longint; + __ba_present : longint; + __ba_waiting : _pthread_descr; + end; + + Ppthread_barrierattr_t = ^pthread_barrierattr_t; + pthread_barrierattr_t = record + __pshared : longint; + end; + + Ppthread_t = ^pthread_t; + pthread_t = dword; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPthreadFastlock = _pthread_fastlock; + PPthreadFastlock = ^TPthreadFastlock; + + TCondVar = pthread_cond_t; + PCondVar = ^TCondVar; + + TPthreadCondattr = pthread_condattr_t; + PPthreadCondattr = ^TPthreadCondattr; + + TPthreadMutex = pthread_mutex_t; + PPthreadMutex = ^TPthreadMutex; + TRTLCriticalSection = TPthreadMutex; + PRTLCriticalSection = ^TRTLCriticalSection; + + TMutexAttribute = pthread_mutexattr_t; + PMutexAttribute = ^TMutexAttribute; + + TPThreadOnce = pthread_once_t; + PPThreadOnce = ^pthread_once_t; + + TPthreadRWlock = pthread_rwlock_t; + PPthreadRWlock = ^TPthreadRWlock; + + TPthreadRWlockAttribute = pthread_rwlockattr_t; + PPthreadRWlockAttribute = ^TPthreadRWlockAttribute; + + TPthreadSpinlock = pthread_spinlock_t; + PPthreadSpinlock = ^TPthreadSpinlock; + + TPthreadBarrier = pthread_barrier_t; + PPthreadBarrier = ^TPthreadBarrier; + + TPthreadBarrierAttribute = pthread_barrierattr_t; + PPthreadBarrierAttribute = ^TPthreadBarrierAttribute; + + TThreadID = pthread_t; + TPThreadKey = pthread_key_t; + + diff --git a/jcl/source/fpc/libclite/ptimedh.inc b/jcl/source/fpc/libclite/ptimedh.inc new file mode 100644 index 0000000000..bb18f659d4 --- /dev/null +++ b/jcl/source/fpc/libclite/ptimedh.inc @@ -0,0 +1,60 @@ + +const + TSPVERSION = 1; + ANYADDR = Nil; + +type + Ptsp = ^tsp; + tsp = record + tsp_type : u_char; + tsp_vers : u_char; + tsp_seq : u_short; + tsp_u : record + case longint of + 0 : ( tspu_time : timeval ); + 1 : ( tspu_hopcnt : char ); + end; + tsp_name : array[0..(MAXHOSTNAMELEN)-1] of char; + end; + + +const + TSP_ANY = 0; + TSP_ADJTIME = 1; + TSP_ACK = 2; + TSP_MASTERREQ = 3; + TSP_MASTERACK = 4; + TSP_SETTIME = 5; + TSP_MASTERUP = 6; + TSP_SLAVEUP = 7; + TSP_ELECTION = 8; + TSP_ACCEPT = 9; + TSP_REFUSE = 10; + TSP_CONFLICT = 11; + TSP_RESOLVE = 12; + TSP_QUIT = 13; + TSP_DATE = 14; + TSP_DATEREQ = 15; + TSP_DATEACK = 16; + TSP_TRACEON = 17; + TSP_TRACEOFF = 18; + TSP_MSITE = 19; + TSP_MSITEREQ = 20; + TSP_TEST = 21; + TSP_SETDATE = 22; + TSP_SETDATEREQ = 23; + TSP_LOOP = 24; + TSPTYPENUMBER = 25; + + tsptype : array [0..TSPTYPENUMBER-1] of pchar = + ( + 'ANY', 'ADJTIME', 'ACK', 'MASTERREQ', 'MASTERACK', 'SETTIME', 'MASTERUP', + 'SLAVEUP', 'ELECTION', 'ACCEPT', 'REFUSE', 'CONFLICT', 'RESOLVE', 'QUIT', + 'DATE', 'DATEREQ', 'DATEACK', 'TRACEON', 'TRACEOFF', 'MSITE', 'MSITEREQ', + 'TEST', 'SETDATE', 'SETDATEREQ', 'LOOP' ); + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/ptyh.inc b/jcl/source/fpc/libclite/ptyh.inc new file mode 100644 index 0000000000..121bdcf5fb --- /dev/null +++ b/jcl/source/fpc/libclite/ptyh.inc @@ -0,0 +1,10 @@ + +function openpty(__amaster:Plongint; __aslave:Plongint; __name:Pchar; __termp:Ptermios; __winp:Pwinsize):longint;cdecl;external clib name 'openpty'; +function forkpty(__amaster:Plongint; __name:Pchar; __termp:Ptermios; __winp:Pwinsize):longint;cdecl;external clib name 'forkpty'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/pwdh.inc b/jcl/source/fpc/libclite/pwdh.inc new file mode 100644 index 0000000000..7d3f033e8a --- /dev/null +++ b/jcl/source/fpc/libclite/pwdh.inc @@ -0,0 +1,44 @@ + +type + Ppasswd = ^passwd; + passwd = record + pw_name : Pchar; + pw_passwd : Pchar; + pw_uid : __uid_t; + pw_gid : __gid_t; + pw_gecos : Pchar; + pw_dir : Pchar; + pw_shell : Pchar; + end; + PPpasswd = ^Ppasswd; + +procedure setpwent;cdecl;external clib name 'setpwent'; +procedure endpwent;cdecl;external clib name 'endpwent'; +function getpwent:Ppasswd;cdecl;external clib name 'getpwent'; +function fgetpwent(__stream:PFILE):Ppasswd;cdecl;external clib name 'fgetpwent'; +function putpwent(__p:Ppasswd; __f:PFILE):longint;cdecl;external clib name 'putpwent'; +function getpwuid(__uid:__uid_t):Ppasswd;cdecl;external clib name 'getpwuid'; +function getpwnam(__name:Pchar):Ppasswd;cdecl;external clib name 'getpwnam'; + +const + NSS_BUFLEN_PASSWD = 1024; + +function getpwent_r(__resultbuf:Ppasswd; __buffer:Pchar; __buflen:size_t; __result:PPpasswd):longint;cdecl;external clib name 'getpwent_r'; +function getpwuid_r(__uid:__uid_t; __resultbuf:Ppasswd; __buffer:Pchar; __buflen:size_t; __result:PPpasswd):longint;cdecl;external clib name 'getpwuid_r'; +function getpwnam_r(__name:Pchar; __resultbuf:Ppasswd; __buffer:Pchar; __buflen:size_t; __result:PPpasswd):longint;cdecl;external clib name 'getpwnam_r'; +function fgetpwent_r(__stream:PFILE; __resultbuf:Ppasswd; __buffer:Pchar; __buflen:size_t; __result:PPpasswd):longint;cdecl;external clib name 'fgetpwent_r'; +function getpw(__uid:__uid_t; __buffer:Pchar):longint;cdecl;external clib name 'getpw'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPasswordRecord = passwd; + PPasswordRecord = ^TPasswordRecord; + +function putpwent(const __p:passwd; __f:PFILE):longint;cdecl;external clib name 'putpwent'; +function getpwent_r(var __resultbuf:passwd; __buffer:Pchar; __buflen:size_t; var __result:Ppasswd):longint;cdecl;external clib name 'getpwent_r'; +function getpwuid_r(__uid:__uid_t; var __resultbuf:passwd; __buffer:Pchar; __buflen:size_t; var __result: Ppasswd):longint;cdecl;external clib name 'getpwuid_r'; +function getpwnam_r(__name:Pchar; var __resultbuf:passwd; __buffer:Pchar; __buflen:size_t; var __result:Ppasswd):longint;cdecl;external clib name 'getpwnam_r'; +function fgetpwent_r(__stream:PFILE; var __resultbuf:passwd; __buffer:Pchar; __buflen:size_t; var __result:Ppasswd):longint;cdecl;external clib name 'fgetpwent_r'; diff --git a/jcl/source/fpc/libclite/regexh.inc b/jcl/source/fpc/libclite/regexh.inc new file mode 100644 index 0000000000..27cb12a881 --- /dev/null +++ b/jcl/source/fpc/libclite/regexh.inc @@ -0,0 +1,184 @@ + +type + + Ps_reg_t = ^s_reg_t; + s_reg_t = longint; + + Pactive_reg_t = ^active_reg_t; + active_reg_t = dword; + + Preg_syntax_t = ^reg_syntax_t; + reg_syntax_t = dword; + +Const + RE_BACKSLASH_ESCAPE_IN_LISTS = dword(1); + +const + RE_BK_PLUS_QM = RE_BACKSLASH_ESCAPE_IN_LISTS shl 1; + RE_CHAR_CLASSES = RE_BK_PLUS_QM shl 1; + RE_CONTEXT_INDEP_ANCHORS = RE_CHAR_CLASSES shl 1; + RE_CONTEXT_INDEP_OPS = RE_CONTEXT_INDEP_ANCHORS shl 1; + RE_CONTEXT_INVALID_OPS = RE_CONTEXT_INDEP_OPS shl 1; + RE_DOT_NEWLINE = RE_CONTEXT_INVALID_OPS shl 1; + RE_DOT_NOT_NULL = RE_DOT_NEWLINE shl 1; + RE_HAT_LISTS_NOT_NEWLINE = RE_DOT_NOT_NULL shl 1; + RE_INTERVALS = RE_HAT_LISTS_NOT_NEWLINE shl 1; + RE_LIMITED_OPS = RE_INTERVALS shl 1; + RE_NEWLINE_ALT = RE_LIMITED_OPS shl 1; + RE_NO_BK_BRACES = RE_NEWLINE_ALT shl 1; + RE_NO_BK_PARENS = RE_NO_BK_BRACES shl 1; + RE_NO_BK_REFS = RE_NO_BK_PARENS shl 1; + RE_NO_BK_VBAR = RE_NO_BK_REFS shl 1; + RE_NO_EMPTY_RANGES = RE_NO_BK_VBAR shl 1; + RE_UNMATCHED_RIGHT_PAREN_ORD = RE_NO_EMPTY_RANGES shl 1; + RE_NO_POSIX_BACKTRACKING = RE_UNMATCHED_RIGHT_PAREN_ORD shl 1; + RE_NO_GNU_OPS = RE_NO_POSIX_BACKTRACKING shl 1; + RE_DEBUG = RE_NO_GNU_OPS shl 1; + RE_INVALID_INTERVAL_ORD = RE_DEBUG shl 1; + +var + re_syntax_options : reg_syntax_t;cvar;external; + +const + _RE_SYNTAX_POSIX_COMMON = (((RE_CHAR_CLASSES or RE_DOT_NEWLINE) or RE_DOT_NOT_NULL) or RE_INTERVALS) or RE_NO_EMPTY_RANGES; + RE_SYNTAX_POSIX_EXTENDED = ((((((_RE_SYNTAX_POSIX_COMMON or RE_CONTEXT_INDEP_ANCHORS) or RE_CONTEXT_INDEP_OPS) or RE_NO_BK_BRACES) or RE_NO_BK_PARENS) or RE_NO_BK_VBAR) or RE_CONTEXT_INVALID_OPS) or RE_UNMATCHED_RIGHT_PAREN_ORD; + RE_SYNTAX_POSIX_BASIC = _RE_SYNTAX_POSIX_COMMON or RE_BK_PLUS_QM; + RE_SYNTAX_POSIX_MINIMAL_BASIC = _RE_SYNTAX_POSIX_COMMON or RE_LIMITED_OPS; + RE_SYNTAX_POSIX_MINIMAL_EXTENDED = ((((((_RE_SYNTAX_POSIX_COMMON or RE_CONTEXT_INDEP_ANCHORS) or RE_CONTEXT_INVALID_OPS) or RE_NO_BK_BRACES) or RE_NO_BK_PARENS) or RE_NO_BK_REFS) or RE_NO_BK_VBAR) or RE_UNMATCHED_RIGHT_PAREN_ORD; + RE_SYNTAX_EMACS = 0; + RE_SYNTAX_AWK = ((((((((RE_BACKSLASH_ESCAPE_IN_LISTS or RE_DOT_NOT_NULL) or RE_NO_BK_PARENS) or RE_NO_BK_REFS) or RE_NO_BK_VBAR) or RE_NO_EMPTY_RANGES) or RE_DOT_NEWLINE) or RE_CONTEXT_INDEP_ANCHORS) or RE_UNMATCHED_RIGHT_PAREN_ORD) or RE_NO_GNU_OPS; + RE_SYNTAX_GNU_AWK = ((RE_SYNTAX_POSIX_EXTENDED or RE_BACKSLASH_ESCAPE_IN_LISTS) or RE_DEBUG) and ( not ((RE_DOT_NOT_NULL or RE_INTERVALS) or RE_CONTEXT_INDEP_OPS)); + RE_SYNTAX_POSIX_AWK = ((RE_SYNTAX_POSIX_EXTENDED or RE_BACKSLASH_ESCAPE_IN_LISTS) or RE_INTERVALS) or RE_NO_GNU_OPS; + RE_SYNTAX_GREP = (((RE_BK_PLUS_QM or RE_CHAR_CLASSES) or RE_HAT_LISTS_NOT_NEWLINE) or RE_INTERVALS) or RE_NEWLINE_ALT; + RE_SYNTAX_EGREP = (((((RE_CHAR_CLASSES or RE_CONTEXT_INDEP_ANCHORS) or RE_CONTEXT_INDEP_OPS) or RE_HAT_LISTS_NOT_NEWLINE) or RE_NEWLINE_ALT) or RE_NO_BK_PARENS) or RE_NO_BK_VBAR; + RE_SYNTAX_POSIX_EGREP = ((RE_SYNTAX_EGREP or RE_INTERVALS) or RE_NO_BK_BRACES) or RE_INVALID_INTERVAL_ORD; + RE_SYNTAX_ED = RE_SYNTAX_POSIX_BASIC; + RE_SYNTAX_SED = RE_SYNTAX_POSIX_BASIC; + +const + // Already in posix2_limh.inc: + // RE_DUP_MAX = $7fff; + REG_EXTENDED = 1; + REG_ICASE = REG_EXTENDED shl 1; + REG_NEWLINE = REG_ICASE shl 1; + REG_NOSUB = REG_NEWLINE shl 1; + REG_NOTBOL = 1; + REG_NOTEOL = 1 shl 1; + +type + RE_TRANSLATE_TYPE = PChar; + +const + REGS_UNALLOCATED = 0; + REGS_REALLOCATE = 1; + REGS_FIXED = 2; + +type + Preg_errcode_t = ^reg_errcode_t; + reg_errcode_t =( + REG_ENOSYS := -(1), + REG_NOERROR := 0, + REG_NOMATCH := 1, + REG_BADPAT := 2, + REG_ECOLLATE := 3, + REG_ECTYPE := 4, + REG_EESCAPE := 5, + REG_ESUBREG := 6, + REG_EBRACK := 7, + REG_EPAREN := 8, + REG_EBRACE := 9, + REG_BADBR := 10, + REG_ERANGE := 11, + REG_ESPACE := 12, + REG_BADRPT := 13, + REG_EEND := 14, + REG_ESIZE := 15, + REG_ERPAREN := 16); + +type + Pre_pattern_buffer = ^re_pattern_buffer; + re_pattern_buffer = record + buffer: PByte; + allocated: LongWord; + used: LongWord; + syntax: reg_syntax_t; + fastmap: PChar; + translate: RE_TRANSLATE_TYPE; + re_nsub: size_t; + __bitfield: Cardinal; (* In this case 8 bits use 32 bits *) + end; + regex_t = re_pattern_buffer; + pregex_t = ^regex_t; + + Pregoff_t = ^regoff_t; + regoff_t = longint; + Pre_registers = ^re_registers; + re_registers = record + num_regs : dword; + start : Pregoff_t; + end_ : Pregoff_t; + end; + +const + RE_NREGS = 30; + +type + Pregmatch_t = ^regmatch_t; + regmatch_t = record + rm_so : regoff_t; + rm_eo : regoff_t; + end; + +function re_set_syntax(syntax:reg_syntax_t):reg_syntax_t;cdecl;external clib name 're_set_syntax'; +function re_compile_pattern(pattern:Pchar; length:size_t; buffer:Pre_pattern_buffer):Pchar;cdecl;external clib name 're_compile_pattern'; +function re_compile_fastmap(buffer:Pre_pattern_buffer):longint;cdecl;external clib name 're_compile_fastmap'; +function re_search(buffer:Pre_pattern_buffer; _string:Pchar; length:longint; start:longint; range:longint; + regs:Pre_registers):longint;cdecl;external clib name 're_search'; +function re_search_2(buffer:Pre_pattern_buffer; string1:Pchar; length1:longint; string2:Pchar; length2:longint; + start:longint; range:longint; regs:Pre_registers; stop:longint):longint;cdecl;external clib name 're_search_2'; +function re_match(buffer:Pre_pattern_buffer; _string:Pchar; length:longint; start:longint; regs:Pre_registers):longint;cdecl;external clib name 're_match'; +function re_match_2(buffer:Pre_pattern_buffer; string1:Pchar; length1:longint; string2:Pchar; length2:longint; + start:longint; regs:Pre_registers; stop:longint):longint;cdecl;external clib name 're_match_2'; +procedure re_set_registers(buffer:Pre_pattern_buffer; regs:Pre_registers; num_regs:dword; starts:Pregoff_t; ends:Pregoff_t);cdecl;external clib name 're_set_registers'; +function regcomp(__preg:Pregex_t; __pattern:Pchar; __cflags:longint):longint;cdecl;external clib name 'regcomp'; +function regexec(__preg:Pregex_t; __string:Pchar; __nmatch:size_t; __pmatch:array of regmatch_t; __eflags:longint):longint;cdecl;external clib name 'regexec'; +function regerror(__errcode:longint; __preg:Pregex_t; __errbuf:Pchar; __errbuf_size:size_t):size_t;cdecl;external clib name 'regerror'; +procedure regfree(__preg:Pregex_t);cdecl;external clib name 'regfree'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TRePatternBuffer = re_pattern_buffer; + PRePatternBuffer = ^TRePatternBuffer; + + TRegOff = regoff_t; + PRegOff = ^TRegOff; + + TReRegisters = re_registers; + PReRegisters = ^TReRegisters; + + TRegEx = regex_t; + PRegEx = ^TRegEx; + + TRegMatch = regmatch_t; + PRegMatch = ^TRegMatch; + +function re_compile_pattern(pattern:Pchar; length:size_t; var buffer: re_pattern_buffer):Pchar;cdecl;external clib name 're_compile_pattern'; +function re_compile_fastmap(var buffer: re_pattern_buffer):longint;cdecl;external clib name 're_compile_fastmap'; +function re_search(var buffer:re_pattern_buffer; _string:Pchar; length:longint; start:longint; range:longint; regs:Pre_registers):longint;cdecl;external clib name 're_search'; +function re_search(var buffer:re_pattern_buffer; _string:Pchar; length:longint; start:longint; range:longint; var regs:re_registers):longint;cdecl;external clib name 're_search'; +function re_search_2(var buffer:re_pattern_buffer; string1:Pchar; length1:longint; string2:Pchar; length2:longint; start:longint; range:longint; regs:Pre_registers; stop:longint):longint;cdecl;external clib name 're_search_2'; +function re_search_2(var buffer:re_pattern_buffer; string1:Pchar; length1:longint; string2:Pchar; length2:longint; start:longint; range:longint; var regs:re_registers; stop:longint):longint;cdecl;external clib name 're_search_2'; +function re_match(var buffer:re_pattern_buffer; _string:Pchar; length:longint; start:longint; regs:Pre_registers):longint;cdecl;external clib name 're_match'; +function re_match(var buffer:re_pattern_buffer; _string:Pchar; length:longint; start:longint; var regs:re_registers):longint;cdecl;external clib name 're_match'; +function re_match_2(var buffer:re_pattern_buffer; string1:Pchar; length1:longint; string2:Pchar; length2:longint; start:longint; regs:Pre_registers; stop:longint):longint;cdecl;external clib name 're_match_2'; +function re_match_2(var buffer:re_pattern_buffer; string1:Pchar; length1:longint; string2:Pchar; length2:longint; start:longint; var regs:re_registers; stop:longint):longint;cdecl;external clib name 're_match_2'; +procedure re_set_registers(var buffer:re_pattern_buffer; var regs:re_registers; num_regs:dword; var starts:regoff_t; var ends:regoff_t);cdecl;external clib name 're_set_registers'; +function regcomp(var __preg:regex_t; __pattern:Pchar; __cflags:longint):longint;cdecl;external clib name 'regcomp'; +function regexec(var __preg:regex_t; __string:Pchar; __nmatch:size_t; __pmatch: Pregmatch_t; __eflags:longint):longint;cdecl;external clib name 'regexec'; +function regerror(__errcode:longint; const __preg:regex_t; __errbuf:Pchar; __errbuf_size:size_t):size_t;cdecl;external clib name 'regerror'; +procedure regfree(var __preg:regex_t);cdecl;external clib name 'regfree'; + diff --git a/jcl/source/fpc/libclite/regexph.inc b/jcl/source/fpc/libclite/regexph.inc new file mode 100644 index 0000000000..ec4e9a6e75 --- /dev/null +++ b/jcl/source/fpc/libclite/regexph.inc @@ -0,0 +1,128 @@ + +{$ifndef _REGEXP_H} + +const + _REGEXP_H = 1; +{$include } +{$include } +{$include } +{$include } +{$include } + var + loc1 : Pchar;cvar;external; + loc2 : Pchar;cvar;external; + locs : Pchar;cvar;external; +{$ifndef __DO_NOT_DEFINE_COMPILE} +(* error +{ + in declarator_list *) + var + : char; +(* error + size_t __input_size = 0; + in declarator_list *) +(* error + size_t __current_size = 0; + in declarator_list *) + __ch : longint;cvar;public; + __error : longint;cvar;public; +(* error + regex_t *__expr_ptr; + in declarator_list *) +{$if defined __GNUC__ && __GNUC__ >= 2} +(* error + const size_t __req = __alignof__ (regex_t *); + in declarator_list *) +{$else} +(* error + const size_t __req = 8; + in declarator_list *) +{$endif} +(* error + expbuf += __req; +in declaration at line 122 *) +(* error + expbuf -= (expbuf - ((char *) 0)) % __req; +in declaration at line 123 *) +(* error + if (endbuf < expbuf + sizeof (regex_t)) + in declarator_list *) +(* error + } +in declaration at line 128 *) +(* error + __expr_ptr->buffer = expbuf + sizeof (regex_t); +(* error + __expr_ptr->buffer = expbuf + sizeof (regex_t); + in declarator_list *) +(* error + __expr_ptr->allocated = endbuf - (char *) __expr_ptr->buffer; +(* error + __expr_ptr->allocated = endbuf - (char *) __expr_ptr->buffer; + in declarator_list *) +(* error + while ((__ch = (GETC ())) != eof) + in declarator_list *) +(* error + break; +in declaration at line 139 *) +(* error + } +in declaration at line 144 *) +(* error + char *__new_room = (char *) alloca (__new_size); + in declarator_list *) +(* error + if (__new_room + __new_size == __input_buffer) + in declarator_list *) +(* error + __input_buffer = (char *) memcpy (__new_room, __input_buffer, +in declaration at line 151 *) +(* error + } +in declaration at line 154 *) +(* error + { +in declaration at line 157 *) +(* error + __input_buffer = (char *) memcpy (__new_room, __input_buffer, +in declaration at line 159 *) +(* error + } +in declaration at line 162 *) +(* error + } +in declaration at line 164 *) +(* error + __error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE); +in declaration at line 167 *) +(* error + if (__error != 0) + in declarator_list *) + var + REG_ESUBREG : case;cvar;public; + REG_EBRACK : case;cvar;public; + REG_EPAREN : case;cvar;public; + REG_EBRACE : case;cvar;public; + REG_BADBR : case;cvar;public; + REG_ERANGE : case;cvar;public; +(* error + case REG_ESIZE: + in declarator_list *) +(* error + } +in declaration at line 200 *) +(* error +} +{$endif} +in declaration at line 210 *) + +function advance(__string:Pchar; __expbuf:Pchar):longint;cdecl;external clib name 'advance'; +{$endif} + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/saccth.inc b/jcl/source/fpc/libclite/saccth.inc new file mode 100644 index 0000000000..17cefecbfb --- /dev/null +++ b/jcl/source/fpc/libclite/saccth.inc @@ -0,0 +1,50 @@ + +const + ACCT_COMM = 16; + +type + + Pcomp_t = ^comp_t; + comp_t = u_int16_t; + + Pacct = ^_acct; + _acct = record + ac_flag : char; + ac_uid : u_int16_t; + ac_gid : u_int16_t; + ac_tty : u_int16_t; + ac_btime : u_int32_t; + ac_utime : comp_t; + ac_stime : comp_t; + ac_etime : comp_t; + ac_mem : comp_t; + ac_io : comp_t; + ac_rw : comp_t; + ac_minflt : comp_t; + ac_majflt : comp_t; + ac_swaps : comp_t; + ac_exitcode : u_int32_t; + ac_comm : array[0..(ACCT_COMM + 1)-1] of char; + ac_pad : array[0..9] of char; + end; + P_acct = ^_acct; + +Const + AFORK = $01; + ASU = $02; + ACORE = $08; + AXSIG = $10; + + AHZ = 100; + +// Already defined in unistdh.inc +//function acct(__filename:Pchar):longint;cdecl;external clib name 'acct'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TAccountingRecord = _acct; + + diff --git a/jcl/source/fpc/libclite/schedh.inc b/jcl/source/fpc/libclite/schedh.inc new file mode 100644 index 0000000000..af83998536 --- /dev/null +++ b/jcl/source/fpc/libclite/schedh.inc @@ -0,0 +1,19 @@ + + +function sched_setparam(__pid:__pid_t; __param:Psched_param):longint;cdecl;external clib name 'sched_setparam'; +function sched_getparam(__pid:__pid_t; __param:Psched_param):longint;cdecl;external clib name 'sched_getparam'; +function sched_setscheduler(__pid:__pid_t; __policy:longint; __param:Psched_param):longint;cdecl;external clib name 'sched_setscheduler'; +function sched_getscheduler(__pid:__pid_t):longint;cdecl;external clib name 'sched_getscheduler'; +function sched_yield:longint;cdecl;external clib name 'sched_yield'; +function sched_get_priority_max(__algorithm:longint):longint;cdecl;external clib name 'sched_get_priority_max'; +function sched_get_priority_min(__algorithm:longint):longint;cdecl;external clib name 'sched_get_priority_min'; +function sched_rr_get_interval(__pid:__pid_t; __t:Ptimespec):longint;cdecl;external clib name 'sched_rr_get_interval'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +function sched_setparam(__pid:__pid_t; var __param: sched_param):longint;cdecl;external clib name 'sched_setparam'; +function sched_getparam(__pid:__pid_t; var __param: sched_param):longint;cdecl;external clib name 'sched_getparam'; +function sched_setscheduler(__pid:__pid_t; __policy:longint; var __param: sched_param):longint;cdecl;external clib name 'sched_setscheduler'; +function sched_rr_get_interval(__pid:__pid_t; var __t: timespec):longint;cdecl;external clib name 'sched_rr_get_interval'; diff --git a/jcl/source/fpc/libclite/searchh.inc b/jcl/source/fpc/libclite/searchh.inc new file mode 100644 index 0000000000..0d95649546 --- /dev/null +++ b/jcl/source/fpc/libclite/searchh.inc @@ -0,0 +1,94 @@ + +type + Pqelem = ^qelem; + qelem = record + q_forw : Pqelem; + q_back : Pqelem; + q_data : array[0..0] of char; + end; + +procedure insque(__elem:pointer; __prev:pointer);cdecl;external clib name 'insque'; +procedure remque(__elem:pointer);cdecl;external clib name 'remque'; + +type +// __compar_fn_t = function (_para1:pointer; _para2:pointer):longint;cdecl; + + Pcomparison_fn_t = ^comparison_fn_t; +// comparison_fn_t = __compar_fn_t; + +type + hsearch_ACTION = (FIND, ENTER); + PACTION = ^ACTION; + ACTION = Longint; + +{ Pentry = ^entry; + entry = record + key : Pchar; + data : pointer; + end; +} + Phsearch_ENTRY = ^hsearch_ENTRY; + hsearch_ENTRY = record + {undefined structure} + end; + PPhsearch_ENTRY = ^Phsearch_ENTRY; + + +function hsearch(__item:hsearch_ENTRY; __action:hsearch_ACTION):Phsearch_ENTRY;cdecl;external clib name 'hsearch'; +function hcreate(__nel:size_t):longint;cdecl;external clib name 'hcreate'; +procedure hdestroy;cdecl;external clib name 'hdestroy'; + +type + Phsearch_data = ^hsearch_data; + hsearch_data = record + table : Phsearch_ENTRY; + size : dword; + filled : dword; + end; + + +function hsearch_r(__item:hsearch_ENTRY; __action:hsearch_ACTION; __retval:PPhsearch_ENTRY; __htab:Phsearch_data):longint;cdecl;external clib name 'hsearch_r'; +function hcreate_r(__nel:size_t; __htab:Phsearch_data):longint;cdecl;external clib name 'hcreate_r'; +procedure hdestroy_r(__htab:Phsearch_data);cdecl;external clib name 'hdestroy_r'; + +type + PSearch_VISIT = ^tsearch_VISIT; + tsearch_VISIT = (preorder, postorder, endorder, leaf); + +function tsearch(__key:pointer; __rootp:Ppointer; __compar:__compar_fn_t):pointer;cdecl;external clib name 'tsearch'; +function tfind(__key:pointer; __rootp:Ppointer; __compar:__compar_fn_t):pointer;cdecl;external clib name 'tfind'; +function tdelete(__key:pointer; __rootp:Ppointer; __compar:__compar_fn_t):pointer;cdecl;external clib name 'tdelete'; + +type + __action_fn_t = procedure (__nodep:pointer; __value:tsearch_VISIT; __level:longint);cdecl; + +procedure twalk(__root:pointer; __action:__action_fn_t);cdecl;external clib name 'twalk'; + +type + __free_fn_t = procedure (__nodep:pointer);cdecl; + +procedure tdestroy(__root:pointer; __freefct:__free_fn_t);cdecl;external clib name 'tdestroy'; +function lfind(__key:pointer; __base:pointer; __nmemb:Psize_t; __size:size_t; __compar:__compar_fn_t):pointer;cdecl;external clib name 'lfind'; +function lsearch(__key:pointer; __base:pointer; __nmemb:Psize_t; __size:size_t; __compar:__compar_fn_t):pointer;cdecl;external clib name 'lsearch'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + PQElement = ^TQElement; + TQElement = qelem; + + THSearchEntry = hsearch_ENTRY; + PHSearchEntry = ^THSearchEntry; + + THSearchEntryOpaque = hsearch_ENTRY; + PHSearchEntryOpaque = ^THSearchEntryOpaque; + +function hsearch_r(__item:hsearch_ENTRY; __action:hsearch_ACTION; var __retval:Phsearch_ENTRY; __htab:Phsearch_data):longint;cdecl;external clib name 'hsearch_r'; + +function tsearch(__key:pointer; var __rootp:pointer; __compar:__compar_fn_t):pointer;cdecl;external clib name 'tsearch'; +function tfind(__key:pointer; var __rootp:pointer; __compar:__compar_fn_t):pointer;cdecl;external clib name 'tfind'; +function tdelete(__key:pointer; var __rootp:pointer; __compar:__compar_fn_t):pointer;cdecl;external clib name 'tdelete'; + diff --git a/jcl/source/fpc/libclite/semaphoreh.inc b/jcl/source/fpc/libclite/semaphoreh.inc new file mode 100644 index 0000000000..1777c3e784 --- /dev/null +++ b/jcl/source/fpc/libclite/semaphoreh.inc @@ -0,0 +1,52 @@ + +type + Psem_t = ^sem_t; + sem_t = record + __sem_lock : _pthread_fastlock; + __sem_value : longint; + __sem_waiting : _pthread_descr; + end; + + +Const + SEM_FAILED = Psem_t(nil); + SEM_VALUE_MAX = ((not 0) shr 1); + +function sem_init(__sem:Psem_t; __pshared:longint; __value:dword):longint;cdecl;external threadslib name 'sem_init'; +function sem_destroy(__sem:Psem_t):longint;cdecl;external threadslib name 'sem_destroy'; +function sem_open(__name:Pchar; __oflag:longint; args:array of const):Psem_t;cdecl;external threadslib name 'sem_open'; +function sem_open(__name:Pchar; __oflag:longint):Psem_t;cdecl;varargs;external threadslib name 'sem_open'; +function sem_close(__sem:Psem_t):longint;cdecl;external threadslib name 'sem_close'; +function sem_unlink(__name:Pchar):longint;cdecl;external threadslib name 'sem_unlink'; +function sem_wait(__sem:Psem_t):longint;cdecl;external threadslib name 'sem_wait'; +function sem_timedwait(__sem:Psem_t; __abstime:Ptimespec):longint;cdecl;external threadslib name 'sem_timedwait'; +function sem_trywait(__sem:Psem_t):longint;cdecl;external threadslib name 'sem_trywait'; +function sem_post(__sem:Psem_t):longint;cdecl;external threadslib name 'sem_post'; +function sem_getvalue(__sem:Psem_t; __sval:Plongint):longint;cdecl;external threadslib name 'sem_getvalue'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSemaphore = sem_t; + PSemaphore = ^TSemaphore; + + __sem_lock_t = record { Not in header file - anonymous , should equal _pthread_fastlock} + status: Longint; + spinlock: Integer; + end; + + TPCharArray = System.TPCharArray; + PPCharArray = System.PPCharArray; + +function sem_init(var __sem: sem_t; __pshared:longint; __value:dword):longint;cdecl;external threadslib name 'sem_init'; +function sem_destroy(var __sem: sem_t):longint;cdecl;external threadslib name 'sem_destroy'; +function sem_close(var __sem: sem_t):longint;cdecl;external threadslib name 'sem_close'; +function sem_wait(var __sem: sem_t):longint;cdecl;external threadslib name 'sem_wait'; +function sem_timedwait(var __sem: sem_t; __abstime:Ptimespec):longint;cdecl;external threadslib name 'sem_timedwait'; +function sem_trywait(var __sem: sem_t):longint;cdecl;external threadslib name 'sem_trywait'; +function sem_post(var __sem: sem_t):longint;cdecl;external threadslib name 'sem_post'; +function sem_getvalue(var __sem: sem_t; __sval:Plongint):longint;cdecl;external threadslib name 'sem_getvalue'; + + diff --git a/jcl/source/fpc/libclite/sfsuidh.inc b/jcl/source/fpc/libclite/sfsuidh.inc new file mode 100644 index 0000000000..affe7be128 --- /dev/null +++ b/jcl/source/fpc/libclite/sfsuidh.inc @@ -0,0 +1,9 @@ + +function setfsuid(__uid:__uid_t):longint;cdecl;external clib name 'setfsuid'; +function setfsgid(__gid:__gid_t):longint;cdecl;external clib name 'setfsgid'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sgttyh.inc b/jcl/source/fpc/libclite/sgttyh.inc new file mode 100644 index 0000000000..35c2d4e34f --- /dev/null +++ b/jcl/source/fpc/libclite/sgttyh.inc @@ -0,0 +1,17 @@ + +type + Psgttyb = ^sgttyb; + sgttyb = record + {undefined structure} + end; + + +function gtty(__fd:longint; __params:Psgttyb):longint;cdecl;external clib name 'gtty'; +function stty(__fd:longint; __params:Psgttyb):longint;cdecl;external clib name 'stty'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSgTTyB = sgttyb; diff --git a/jcl/source/fpc/libclite/shadowh.inc b/jcl/source/fpc/libclite/shadowh.inc new file mode 100644 index 0000000000..cddca5bf96 --- /dev/null +++ b/jcl/source/fpc/libclite/shadowh.inc @@ -0,0 +1,46 @@ + +const + SHADOW = _PATH_SHADOW; + +type + Pspwd = ^spwd; + spwd = record + sp_namp : Pchar; + sp_pwdp : Pchar; + sp_lstchg : longint; + sp_min : longint; + sp_max : longint; + sp_warn : longint; + sp_inact : longint; + sp_expire : longint; + sp_flag : dword; + end; + PPspwd = ^Pspwd; + +procedure setspent;cdecl;external clib name 'setspent'; +procedure endspent;cdecl;external clib name 'endspent'; +function getspent:Pspwd;cdecl;external clib name 'getspent'; +function getspnam(__name:Pchar):Pspwd;cdecl;external clib name 'getspnam'; +function sgetspent(__string:Pchar):Pspwd;cdecl;external clib name 'sgetspent'; +function fgetspent(__stream:PFILE):Pspwd;cdecl;external clib name 'fgetspent'; +function putspent(__p:Pspwd; __stream:PFILE):longint;cdecl;external clib name 'putspent'; +function getspent_r(__result_buf:Pspwd; __buffer:Pchar; __buflen:size_t; __result:PPspwd):longint;cdecl;external clib name 'getspent_r'; +function getspnam_r(__name:Pchar; __result_buf:Pspwd; __buffer:Pchar; __buflen:size_t; __result:PPspwd):longint;cdecl;external clib name 'getspnam_r'; +function sgetspent_r(__string:Pchar; __result_buf:Pspwd; __buffer:Pchar; __buflen:size_t; __result:PPspwd):longint;cdecl;external clib name 'sgetspent_r'; +function fgetspent_r(__stream:PFILE; __result_buf:Pspwd; __buffer:Pchar; __buflen:size_t; __result:PPspwd):longint;cdecl;external clib name 'fgetspent_r'; +function lckpwdf:longint;cdecl;external clib name 'lckpwdf'; +function ulckpwdf:longint;cdecl;external clib name 'ulckpwdf'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPasswordFileEntry = spwd; + PPasswordFileEntry = ^TPasswordFileEntry; + +function putspent(const __p:spwd; __stream:PFILE):longint;cdecl;external clib name 'putspent'; +function getspent_r(var __result_buf: spwd; __buffer:Pchar; __buflen:size_t; var __result: Pspwd):longint;cdecl;external clib name 'getspent_r'; +function getspnam_r(__name:Pchar; var __result_buf:spwd; __buffer:Pchar; __buflen:size_t; var __result:Pspwd):longint;cdecl;external clib name 'getspnam_r'; +function sgetspent_r(__string:Pchar; var __result_buf:spwd; __buffer:Pchar; __buflen:size_t; var __result:Pspwd):longint;cdecl;external clib name 'sgetspent_r'; +function fgetspent_r(__stream:PFILE; var __result_buf:spwd; __buffer:Pchar; __buflen:size_t; var __result:Pspwd):longint;cdecl;external clib name 'fgetspent_r'; diff --git a/jcl/source/fpc/libclite/sigactionh.inc b/jcl/source/fpc/libclite/sigactionh.inc new file mode 100644 index 0000000000..30032a05e8 --- /dev/null +++ b/jcl/source/fpc/libclite/sigactionh.inc @@ -0,0 +1,47 @@ + +type + P_sigaction = ^_sigaction; + _sigaction = record // Renamed, avoid conflict with sigaction function + case integer of + 1: (sa_handler : __sighandler_t; + sa_mask : __sigset_t; + sa_flags : longint; + sa_restorer : procedure ;cdecl; + ); + // Kylix compatibility + 2: (__sigaction_handler: __sighandler_t); + end; + +const + SA_NOCLDSTOP = 1; + SA_NOCLDWAIT = 2; + SA_SIGINFO = 4; + +const + SA_ONSTACK = $08000000; + SA_RESTART = $10000000; + SA_NODEFER = $40000000; + SA_RESETHAND = $80000000; + + SA_INTERRUPT = $20000000; + SA_NOMASK = SA_NODEFER; + SA_ONESHOT = SA_RESETHAND; + SA_STACK = SA_ONSTACK; + +const + SIG_BLOCK = 0; + SIG_UNBLOCK = 1; + SIG_SETMASK = 2; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSigAction = _sigaction; + PSigAction = ^TSigAction; + TRestoreHandler = procedure; cdecl; + __sigaction = _sigaction; + TSigActionHandler = procedure(Signal: Integer); cdecl; + + diff --git a/jcl/source/fpc/libclite/sigcontexth.inc b/jcl/source/fpc/libclite/sigcontexth.inc new file mode 100644 index 0000000000..7292903580 --- /dev/null +++ b/jcl/source/fpc/libclite/sigcontexth.inc @@ -0,0 +1,89 @@ + +type + P_fpreg = ^_fpreg; + _fpreg = record + significand : array[0..3] of word; + exponent : word; + end; + + P_fpxreg = ^_fpxreg; + _fpxreg = record + significand : array[0..3] of word; + exponent : word; + padding : array[0..2] of word; + end; + + P_xmmreg = ^_xmmreg; + _xmmreg = record + element : array[0..3] of dword; + end; + + P_fpstate = ^_fpstate; + _fpstate = record + cw : dword; + sw : dword; + tag : dword; + ipoff : dword; + cssel : dword; + dataoff : dword; + datasel : dword; + _st : array[0..7] of _fpreg; + status : word; + magic : word; + _fxsr_env : array[0..5] of dword; + mxcsr : dword; + reserved : dword; + _fxsr_st : array[0..7] of _fpxreg; + _xmm : array[0..7] of _xmmreg; + padding : array[0..55] of dword; + end; + + +const + X86_FXSR_MAGIC = $0000; + +type + Psigcontext = ^sigcontext; + sigcontext = record + gs : word; + __gsh : word; + fs : word; + __fsh : word; + es : word; + __esh : word; + ds : word; + __dsh : word; + edi : dword; + esi : dword; + ebp : dword; + esp : dword; + ebx : dword; + edx : dword; + ecx : dword; + eax : dword; + trapno : dword; + err : dword; + eip : dword; + cs : word; + __csh : word; + eflags : dword; + esp_at_signal : dword; + ss : word; + __ssh : word; + fpstate : P_fpstate; + oldmask : dword; + cr2 : dword; + end; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + TFPreg = _fpreg; + PFPreg = ^TFPreg; + + TFPstate = _fpstate; + PFPstate = ^TFPstate; + + TSigContext = sigcontext; + diff --git a/jcl/source/fpc/libclite/siginfoh.inc b/jcl/source/fpc/libclite/siginfoh.inc new file mode 100644 index 0000000000..e184a3e2e3 --- /dev/null +++ b/jcl/source/fpc/libclite/siginfoh.inc @@ -0,0 +1,167 @@ +const + __SI_MAX_SIZE = 128; + __SI_PAD_SIZE = (__SI_MAX_SIZE div sizeof (Integer)) - 3; + +type + + Psigval = ^sigval; + sigval = record + case longint of + 0 : ( sival_int : longint ); + 1 : ( sival_ptr : pointer ); + end; + sigval_t = sigval; + Psigval_t = ^sigval_t; + + + // Borland compatibility types moved here, needed for siginfo + _si_sigchld = record + si_pid: __pid_t; + si_uid: __uid_t; + si_status: Integer; + si_utime: __clock_t; + si_stime: __clock_t; + end; + + _si_kill = record + si_pid: __pid_t; + si_uid: __uid_t; + end; + _si_pad = packed array[0..__SI_PAD_SIZE-1] of Integer; + _si_sigfault = record + si_addr: Pointer; + end; + _si_sigpoll = record + si_band: Longint; + si_fd: Integer; + end; + _si_timer = record + _timer1: Cardinal; + _timer2: Cardinal; + end; + _si_rt = record + si_pid: __pid_t; + si_uid: __uid_t; + si_sigval: sigval_t; + end; + + + + +type + + Psiginfo = ^siginfo; + siginfo = record + si_signo : longint; + si_errno : longint; + si_code : longint; + Case integer of + 0: (_pad: _si_pad); + 1: (_kill: _si_kill); + 2: (_timer: _si_timer); + 3: (_rt: _si_rt); + 4: (_sigchld: _si_sigchld); + 5: (_sigfault: _si_sigfault); + 6: (_sigpoll: _si_sigpoll); + end; + siginfo_t = siginfo; + Psiginfo_t = ^siginfo_t; + Tsiginfo_t = siginfo_t; + +Const + + SI_ASYNCNL = -(6); + SI_SIGIO = (-(6))+1; + SI_ASYNCIO = (-(6))+2; + SI_MESGQ = (-(6))+3; + SI_TIMER = (-(6))+4; + SI_QUEUE = (-(6))+5; + SI_USER = (-(6))+6; + SI_KERNEL = $80; + + ILL_ILLOPC = 1; + ILL_ILLOPN = 2; + ILL_ILLADR = 3; + ILL_ILLTRP = 4; + ILL_PRVOPC = 5; + ILL_PRVREG = 6; + ILL_COPROC = 7; + ILL_BADSTK = 8; + + FPE_INTDIV = 1; + FPE_INTOVF = 2; + FPE_FLTDIV = 3; + FPE_FLTOVF = 4; + FPE_FLTUND = 5; + FPE_FLTRES = 6; + FPE_FLTINV = 7; + FPE_FLTSUB = 8; + + SEGV_MAPERR = 1; + SEGV_ACCERR = 2; + + BUS_ADRALN = 1; + BUS_ADRERR = 2; + BUS_OBJERR = 3; + + TRAP_BRKPT = 1; + TRAP_TRACE = 2; + + CLD_EXITED = 1; + CLD_KILLED = 2; + CLD_DUMPED = 3; + CLD_TRAPPED = 4; + CLD_STOPPED = 5; + CLD_CONTINUED = 6; + + POLL_IN = 1; + POLL_OUT = 2; + POLL_MSG = 3; + POLL_ERR = 4; + POLL_PRI = 5; + POLL_HUP = 6; + +__SIGEV_MAX_SIZE = 64; +__SIGEV_PAD_SIZE = (__SIGEV_MAX_SIZE div SizeOf(Integer)) - 3; + +type + // Glue structures. + _se_pad = packed array[0..__SIGEV_PAD_SIZE-1] of Integer; + TSignalEventStartProc = procedure(Param: sigval_t); cdecl; + + _se_sigev_thread = {packed} record + _function: TSignalEventStartProc; { Function to start. } + _attribute: Pointer; { Really pthread_attr_t. } + end; + + Psigevent = ^sigevent; + sigevent = record + sigev_value : sigval_t; + sigev_signo : longint; + sigev_notify : longint; + _sigev_un : record + case longint of + 0 : ( _pad : array[0..(__SIGEV_PAD_SIZE)-1] of longint ); + 1 : ( _sigev_thread :_se_sigev_thread;); + end; + end; + sigevent_t = sigevent; + Psigevent_t = ^sigevent_t; + +Const + SIGEV_SIGNAL = 0; + SIGEV_NONE = 1; + SIGEV_THREAD = 2; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSigval = sigval_t; + + TSigInfo = siginfo; + + TSigEvent = sigevent; + + \ No newline at end of file diff --git a/jcl/source/fpc/libclite/signalh.inc b/jcl/source/fpc/libclite/signalh.inc new file mode 100644 index 0000000000..d6c8b1932b --- /dev/null +++ b/jcl/source/fpc/libclite/signalh.inc @@ -0,0 +1,90 @@ + +function sysv_signal(__sig:longint; __handler:__sighandler_t):__sighandler_t;cdecl;external clib name 'sysv_signal'; +function signal(__sig:longint; __handler:__sighandler_t):__sighandler_t;cdecl;external clib name 'signal'; +function bsd_signal(__sig:longint; __handler:__sighandler_t):__sighandler_t;cdecl;external clib name 'bsd_signal'; +function kill(__pid:__pid_t; __sig:longint):longint;cdecl;external clib name 'kill'; +function killpg(__pgrp:__pid_t; __sig:longint):longint;cdecl;external clib name 'killpg'; +function __raise(__sig:longint):longint;cdecl;external clib name 'raise'; +function ssignal(__sig:longint; __handler:__sighandler_t):__sighandler_t;cdecl;external clib name 'ssignal'; +function gsignal(__sig:longint):longint;cdecl;external clib name 'gsignal'; +procedure psignal(__sig:longint; __s:Pchar);cdecl;external clib name 'psignal'; +function __sigpause(__sig_or_mask:longint; __is_sig:longint):longint;cdecl;external clib name '__sigpause'; +function sigpause(__mask:longint):longint;cdecl;external clib name 'sigpause'; +function sigblock(__mask:longint):longint;cdecl;external clib name 'sigblock'; +function sigsetmask(__mask:longint):longint;cdecl;external clib name 'sigsetmask'; +function siggetmask:longint;cdecl;external clib name 'siggetmask'; + +const + NSIG = _NSIG; + +Type + Psighandler_t = ^sighandler_t; + sighandler_t = __sighandler_t; + + Psig_t = ^sig_t; + sig_t = __sighandler_t; + + +var + _sys_siglist : array[0..(_NSIG)-1] of Pchar;cvar;external; + sys_siglist : array[0..(_NSIG)-1] of Pchar;cvar;external; + +Type + P_sigvec = ^_sigvec; + _sigvec = record + sv_handler : __sighandler_t; + sv_mask : longint; + sv_flags : longint; + end; + + +const + SV_ONSTACK = 1 shl 0; + SV_INTERRUPT = 1 shl 1; + SV_RESETHAND = 1 shl 2; + +function sigvec(__sig:longint; __vec:p_sigvec; __ovec:p_sigvec):longint;cdecl;external clib name 'sigvec'; +function sigreturn(__scp:Psigcontext):longint;cdecl;external clib name 'sigreturn'; +function siginterrupt(__sig:longint; __interrupt:longint):longint;cdecl;external clib name 'siginterrupt'; +function sigstack(__ss:Psigstack; __oss:Psigstack):longint;cdecl;external clib name 'sigstack'; +function sigaltstack(__ss:Psigaltstack; __oss:Psigaltstack):longint;cdecl;external clib name 'sigaltstack'; +function sighold(__sig:longint):longint;cdecl;external clib name 'sighold'; +function sigrelse(__sig:longint):longint;cdecl;external clib name 'sigrelse'; +function sigignore(__sig:longint):longint;cdecl;external clib name 'sigignore'; +function sigset(__sig:longint; __disp:__sighandler_t):__sighandler_t;cdecl;external clib name 'sigset'; +function sigaction(__sig: longint; Action: PSigAction; OldAction: PSigAction): Integer; cdecl;external clib name 'sigaction'; + +function __libc_current_sigrtmin:longint;cdecl;external clib name '__libc_current_sigrtmin'; +function __libc_current_sigrtmax:longint;cdecl;external clib name '__libc_current_sigrtmax'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSigVec = _sigvec; + PSigVec = ^TSigVec; + + +function sigemptyset(var SigSet : TSigSet):longint;cdecl;external clib name 'sigemptyset'; +function sigfillset(var SigSet : TSigSet):longint;cdecl;external clib name 'sigfillset'; +function sigaddset(var SigSet : TSigSet; SigNum : Longint):longint;cdecl;external clib name 'sigaddset'; +function sigdelset(var SigSet : TSigSet; SigNum : Longint):longint;cdecl;external clib name 'sigdelset'; +function sigismember(const SigSet : TSigSet; SigNum : Longint):longint;cdecl;external clib name 'sigismember'; +function sigisemptyset(const SigSet : TSigSet):longint;cdecl;external clib name 'sigisemptyset'; +function sigandset(var SigSet : TSigSet; const Left : TSigSet; const Right : TSigSet):longint;cdecl;external clib name 'sigandset'; +function sigorset(var SigSet : TSigSet; const Left : TSigSet; const Right : TSigSet):longint;cdecl;external clib name 'sigorset'; +function sigprocmask(__how:longint; var SigSet : TSigSet; var oldset: Tsigset):longint;cdecl;external clib name 'sigprocmask'; +function sigsuspend(SigSet : TSigSet):longint;cdecl;external clib name 'sigsuspend'; +function sigaction(__sig:longint; Const act: _sigaction; Var oldact: _sigaction):longint;cdecl;external clib name 'sigaction'; +function sigpending(SigSet : TSigSet):longint;cdecl;external clib name 'sigpending'; +function sigwait(SigSet : TSigSet; Var __sig:longint):longint;cdecl;external clib name 'sigwait'; +function sigwaitinfo(SigSet : TSigSet; var __info: tsiginfo_t):longint;cdecl;external clib name 'sigwaitinfo'; +function sigtimedwait(SigSet : TSigSet; var __info: tsiginfo_t; var __timeout: ttimespec):longint;cdecl;external clib name 'sigtimedwait'; +function sigqueue(__pid:__pid_t; __sig:longint; __val:sigval):longint;cdecl;external clib name 'sigqueue'; + +function sigvec(__sig:longint; const vec: tsigvec; __ovec:p_sigvec):longint;cdecl;external clib name 'sigvec'; +function sigvec(__sig:longint; const vec: tsigvec; var __ovec: tsigvec):longint;cdecl;external clib name 'sigvec'; + + diff --git a/jcl/source/fpc/libclite/signumh.inc b/jcl/source/fpc/libclite/signumh.inc new file mode 100644 index 0000000000..54d313693d --- /dev/null +++ b/jcl/source/fpc/libclite/signumh.inc @@ -0,0 +1,52 @@ + +Const + SIG_ERR = (-1); + SIG_DFL = (0); + SIG_IGN = (1); + SIG_HOLD = (2); + + +const + SIGHUP = 1; + SIGINT = 2; + SIGQUIT = 3; + SIGILL = 4; + SIGTRAP = 5; + SIGABRT = 6; + SIGIOT = 6; + SIGBUS = 7; + SIGFPE = 8; + SIGKILL = 9; + SIGUSR1 = 10; + SIGSEGV = 11; + SIGUSR2 = 12; + SIGPIPE = 13; + SIGALRM = 14; + SIGTERM = 15; + SIGSTKFLT = 16; + SIGCHLD = 17; + SIGCLD = SIGCHLD; + SIGCONT = 18; + SIGSTOP = 19; + SIGTSTP = 20; + SIGTTIN = 21; + SIGTTOU = 22; + SIGURG = 23; + SIGXCPU = 24; + SIGXFSZ = 25; + SIGVTALRM = 26; + SIGPROF = 27; + SIGWINCH = 28; + SIGIO = 29; + SIGPOLL = SIGIO; + SIGPWR = 30; + SIGSYS = 31; + SIGUNUSED = 31; + _NSIG = 64; + +const + __SIGRTMIN = 32; + __SIGRTMAX = _NSIG - 1; + +function SIGRTMIN : longint;cdecl; external clib name '__libc_current_sigrtmin'; +function SIGRTMAX : longint;cdecl; external clib name '__libc_current_sigrtmax'; diff --git a/jcl/source/fpc/libclite/sigseth.inc b/jcl/source/fpc/libclite/sigseth.inc new file mode 100644 index 0000000000..ef445999f2 --- /dev/null +++ b/jcl/source/fpc/libclite/sigseth.inc @@ -0,0 +1,31 @@ + +type + + P__sig_atomic_t = ^__sig_atomic_t; + __sig_atomic_t = longint; +Const + _SIGSET_NWORDS = 1024 div (8 * (sizeof(dword))); + +type + + P__sigset_t = ^__sigset_t; + __sigset_t = record + __val : array[0..(_SIGSET_NWORDS)-1] of dword; + end; + sigset_t = __sigset_t; + Psigset_t = ^sigset_t; + +function __sigismember(_para1:P__sigset_t; _para2:longint):longint;cdecl;external clib name '__sigismember'; +function __sigaddset(_para1:P__sigset_t; _para2:longint):longint;cdecl;external clib name '__sigaddset'; +function __sigdelset(_para1:P__sigset_t; _para2:longint):longint;cdecl;external clib name '__sigdelset'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSigset = __sigset_t; + PSigset = ^TSigset; + sig_atomic_t = __sig_atomic_t; + + diff --git a/jcl/source/fpc/libclite/sigstackh.inc b/jcl/source/fpc/libclite/sigstackh.inc new file mode 100644 index 0000000000..8ebd1eb792 --- /dev/null +++ b/jcl/source/fpc/libclite/sigstackh.inc @@ -0,0 +1,38 @@ + +type + P_sigstack = ^_sigstack; + _sigstack = record // Renamed to avoid clash with sigstack function. + ss_sp : pointer; + ss_onstack : longint; + end; + +Const + SS_ONSTACK = 1; + SS_DISABLE = 2; + + MINSIGSTKSZ = 2048; + SIGSTKSZ = 8192; + +Type + Psigaltstack = ^_sigaltstack; + _sigaltstack = record // Renamed to avoid clash with sigaltstack function. + ss_sp : pointer; + ss_flags : longint; + ss_size : size_t; + end; + stack_t = _sigaltstack; + Pstack_t = ^stack_t; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSigStack = _sigstack; + PSigStack = ^TSigStack; + + TStack = stack_t; + PStack = ^TStack; + + diff --git a/jcl/source/fpc/libclite/sigthreadh.inc b/jcl/source/fpc/libclite/sigthreadh.inc new file mode 100644 index 0000000000..5342ef1e7b --- /dev/null +++ b/jcl/source/fpc/libclite/sigthreadh.inc @@ -0,0 +1,10 @@ + + +function pthread_sigmask(__how:longint; __newmask:P__sigset_t; __oldmask:P__sigset_t):longint;cdecl;external threadslib name 'pthread_sigmask'; +function pthread_kill(__thread:pthread_t; __signo:longint):longint;cdecl;external threadslib name 'pthread_kill'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sioctlh.inc b/jcl/source/fpc/libclite/sioctlh.inc new file mode 100644 index 0000000000..afb8719d62 --- /dev/null +++ b/jcl/source/fpc/libclite/sioctlh.inc @@ -0,0 +1,10 @@ + +function ioctl(__fd:longint; __request:dword; args:array of const):longint;cdecl;external clib name 'ioctl'; +function ioctl(__fd:longint; __request:dword):longint;cdecl;varargs;external clib name 'ioctl'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function ioctl(__fd:longint; __request:dword; args:pointer):longint;cdecl;external clib name 'ioctl'; diff --git a/jcl/source/fpc/libclite/sipch.inc b/jcl/source/fpc/libclite/sipch.inc new file mode 100644 index 0000000000..74ca542860 --- /dev/null +++ b/jcl/source/fpc/libclite/sipch.inc @@ -0,0 +1,10 @@ + + +function ftok(__pathname:Pchar; __proj_id:longint):key_t;cdecl;external clib name 'ftok'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/skdaemonh.inc b/jcl/source/fpc/libclite/skdaemonh.inc new file mode 100644 index 0000000000..eb0e8fe836 --- /dev/null +++ b/jcl/source/fpc/libclite/skdaemonh.inc @@ -0,0 +1,8 @@ + +function bdflush(__func:longint; __data:longint):longint;cdecl;external clib name 'bdflush'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sklogh.inc b/jcl/source/fpc/libclite/sklogh.inc new file mode 100644 index 0000000000..1ffc4be769 --- /dev/null +++ b/jcl/source/fpc/libclite/sklogh.inc @@ -0,0 +1,9 @@ + + +function klogctl(__type:longint; __bufp:Pchar; __len:longint):longint;cdecl;external clib name 'klogctl'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/smmaph.inc b/jcl/source/fpc/libclite/smmaph.inc new file mode 100644 index 0000000000..0fec34482b --- /dev/null +++ b/jcl/source/fpc/libclite/smmaph.inc @@ -0,0 +1,32 @@ + + +Const + MAP_FAILED = pointer(-1); + +Const + rtlib = 'rt'; + +function mmap(__addr:pointer; __len:size_t; __prot:longint; __flags:longint; __fd:longint; + __offset:__off_t):pointer;cdecl;external clib name 'mmap'; +function mmap64(__addr:pointer; __len:size_t; __prot:longint; __flags:longint; __fd:longint; + __offset:__off64_t):pointer;cdecl;external clib name 'mmap64'; +function munmap(__addr:pointer; __len:size_t):longint;cdecl;external clib name 'munmap'; +function mprotect(__addr:pointer; __len:size_t; __prot:longint):longint;cdecl;external clib name 'mprotect'; +function msync(__addr:pointer; __len:size_t; __flags:longint):longint;cdecl;external clib name 'msync'; +function madvise(__addr:pointer; __len:size_t; __advice:longint):longint;cdecl;external clib name 'madvise'; +function posix_madvise(__addr:pointer; __len:size_t; __advice:longint):longint;cdecl;external clib name 'posix_madvise'; +function mlock(__addr:pointer; __len:size_t):longint;cdecl;external clib name 'mlock'; +function munlock(__addr:pointer; __len:size_t):longint;cdecl;external clib name 'munlock'; +function mlockall(__flags:longint):longint;cdecl;external clib name 'mlockall'; +function munlockall:longint;cdecl;external clib name 'munlockall'; +function mremap(__addr:pointer; __old_len:size_t; __new_len:size_t; __may_move:longint):pointer;cdecl;external clib name 'mremap'; +function mincore(__start:pointer; __len:size_t; __vec:Pbyte):longint;cdecl;external clib name 'mincore'; +function shm_open(__name:Pchar; __oflag:longint; __mode:mode_t):longint;cdecl;external rtlib name 'shm_open'; +function shm_unlink(__name:Pchar):longint;cdecl;external rtlib name 'shm_unlink'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/smounth.inc b/jcl/source/fpc/libclite/smounth.inc new file mode 100644 index 0000000000..fbd5b1f8bd --- /dev/null +++ b/jcl/source/fpc/libclite/smounth.inc @@ -0,0 +1,30 @@ + + +const + BLOCK_SIZE = 1024; + BLOCK_SIZE_BITS = 10; + + MS_RDONLY = 1; + MS_NOSUID = 2; + MS_NODEV = 4; + MS_NOEXEC = 8; + MS_SYNCHRONOUS = 16; + MS_REMOUNT = 32; + MS_MANDLOCK = 64; + S_WRITE = 128; + S_APPEND = 256; + S_IMMUTABLE = 512; + MS_NOATIME = 1024; + MS_NODIRATIME = 2048; + MS_BIND = 4096; + + MS_RMT_MASK = MS_RDONLY or MS_MANDLOCK; + MS_MGC_VAL = $c0ed0000; + MS_MGC_MSK = $ffff0000; + + MNT_FORCE = 1; + +function mount(__special_file:Pchar; __dir:Pchar; __fstype:Pchar; __rwflag:dword; __data:pointer):longint;cdecl;external clib name 'mount'; +function umount(__special_file:Pchar):longint;cdecl;external clib name 'umount'; +function umount2(__special_file:Pchar; __flags:longint):longint;cdecl;external clib name 'umount2'; + diff --git a/jcl/source/fpc/libclite/smsgh.inc b/jcl/source/fpc/libclite/smsgh.inc new file mode 100644 index 0000000000..938143512a --- /dev/null +++ b/jcl/source/fpc/libclite/smsgh.inc @@ -0,0 +1,23 @@ + +Type + Pmsgbuf = ^msgbuf; + msgbuf = record + mtype : longint; + mtext : array[0..0] of char; + end; + + +function msgctl(__msqid:longint; __cmd:longint; __buf:Pmsqid_ds):longint;cdecl;external clib name 'msgctl'; +function msgget(__key:key_t; __msgflg:longint):longint;cdecl;external clib name 'msgget'; +function msgrcv(__msqid:longint; __msgp:pointer; __msgsz:size_t; __msgtyp:longint; __msgflg:longint):longint;cdecl;external clib name 'msgrcv'; +function msgsnd(__msqid:longint; __msgp:pointer; __msgsz:size_t; __msgflg:longint):longint;cdecl;external clib name 'msgsnd'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function msgctl(__msqid:longint; __cmd:longint; const __buf:msqid_ds):longint;cdecl;external clib name 'msgctl'; +function msgrcv(__msqid:longint; var __msgp; __msgsz:size_t; __msgtyp:longint; __msgflg:longint):longint;cdecl;external clib name 'msgrcv'; +function msgsnd(__msqid:longint; const __msgp; __msgsz:size_t; __msgflg:longint):longint;cdecl;external clib name 'msgsnd'; diff --git a/jcl/source/fpc/libclite/spawnh.inc b/jcl/source/fpc/libclite/spawnh.inc new file mode 100644 index 0000000000..02134def50 --- /dev/null +++ b/jcl/source/fpc/libclite/spawnh.inc @@ -0,0 +1,87 @@ + +type + + Pposix_spawnattr_t = ^posix_spawnattr_t; + posix_spawnattr_t = record + __flags : smallint; + __pgrp : pid_t; + __sd : sigset_t; + __ss : sigset_t; + __sp : sched_param; + __policy : longint; + __pad : array[0..15] of longint; + end; + + __spawn_action = record end; // Used anonymously in header file; opaque structure + P__spawn_action = ^__spawn_action; + + + + Pposix_spawn_file_actions_t = ^posix_spawn_file_actions_t; + posix_spawn_file_actions_t = record + __allocated : longint; + __used : longint; + __actions : P__spawn_action; + __pad : array[0..15] of longint; + end; + +const + POSIX_SPAWN_RESETIDS = $01; + POSIX_SPAWN_SETPGROUP = $02; + POSIX_SPAWN_SETSIGDEF = $04; + POSIX_SPAWN_SETSIGMASK = $08; + POSIX_SPAWN_SETSCHEDPARAM = $10; + POSIX_SPAWN_SETSCHEDULER = $20; + +function posix_spawn(__pid:Ppid_t; __path:Pchar; __file_actions:Pposix_spawn_file_actions_t; __attrp:Pposix_spawnattr_t; argv:ppchar;envp:ppchar):longint;cdecl;external clib name 'posix_spawn'; +function posix_spawnp(__pid:Ppid_t; __file:Pchar; __file_actions:Pposix_spawn_file_actions_t; __attrp:Pposix_spawnattr_t; argv:PPchar;envp:ppchar):longint;cdecl;external clib name 'posix_spawnp'; +function posix_spawnattr_init(__attr:Pposix_spawnattr_t):longint;cdecl;external clib name 'posix_spawnattr_init'; +function posix_spawnattr_destroy(__attr:Pposix_spawnattr_t):longint;cdecl;external clib name 'posix_spawnattr_destroy'; +function posix_spawnattr_getsigdefault(__attr:Pposix_spawnattr_t; __sigdefault:Psigset_t):longint;cdecl;external clib name 'posix_spawnattr_getsigdefault'; +function posix_spawnattr_setsigdefault(__attr:Pposix_spawnattr_t; __sigdefault:Psigset_t):longint;cdecl;external clib name 'posix_spawnattr_setsigdefault'; +function posix_spawnattr_getsigmask(__attr:Pposix_spawnattr_t; __sigmask:Psigset_t):longint;cdecl;external clib name 'posix_spawnattr_getsigmask'; +function posix_spawnattr_setsigmask(__attr:Pposix_spawnattr_t; __sigmask:Psigset_t):longint;cdecl;external clib name 'posix_spawnattr_setsigmask'; +function posix_spawnattr_getflags(__attr:Pposix_spawnattr_t; __flags:Psmallint):longint;cdecl;external clib name 'posix_spawnattr_getflags'; +function posix_spawnattr_setflags(_attr:Pposix_spawnattr_t; __flags:smallint):longint;cdecl;external clib name 'posix_spawnattr_setflags'; +function posix_spawnattr_getpgroup(__attr:Pposix_spawnattr_t; __pgroup:Ppid_t):longint;cdecl;external clib name 'posix_spawnattr_getpgroup'; +function posix_spawnattr_setpgroup(__attr:Pposix_spawnattr_t; __pgroup:pid_t):longint;cdecl;external clib name 'posix_spawnattr_setpgroup'; +function posix_spawnattr_getschedpolicy(__attr:Pposix_spawnattr_t; __schedpolicy:Plongint):longint;cdecl;external clib name 'posix_spawnattr_getschedpolicy'; +function posix_spawnattr_setschedpolicy(__attr:Pposix_spawnattr_t; __schedpolicy:longint):longint;cdecl;external clib name 'posix_spawnattr_setschedpolicy'; +function posix_spawnattr_getschedparam(__attr:Pposix_spawnattr_t; __schedparam:Psched_param):longint;cdecl;external clib name 'posix_spawnattr_getschedparam'; +function posix_spawnattr_setschedparam(__attr:Pposix_spawnattr_t; __schedparam:Psched_param):longint;cdecl;external clib name 'posix_spawnattr_setschedparam'; +function posix_spawn_file_actions_init(__file_actions:Pposix_spawn_file_actions_t):longint;cdecl;external clib name 'posix_spawn_file_actions_init'; +function posix_spawn_file_actions_destroy(__file_actions:Pposix_spawn_file_actions_t):longint;cdecl;external clib name 'posix_spawn_file_actions_destroy'; +function posix_spawn_file_actions_addopen(__file_actions:Pposix_spawn_file_actions_t; __fd:longint; __path:Pchar; __oflag:longint; __mode:mode_t):longint;cdecl;external clib name 'posix_spawn_file_actions_addopen'; +function posix_spawn_file_actions_addclose(__file_actions:Pposix_spawn_file_actions_t; __fd:longint):longint;cdecl;external clib name 'posix_spawn_file_actions_addclose'; +function posix_spawn_file_actions_adddup2(__file_actions:Pposix_spawn_file_actions_t; __fd:longint; __newfd:longint):longint;cdecl;external clib name 'posix_spawn_file_actions_adddup2'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSpawnAction = __spawn_action; + PSpawnAction = ^TSpawnAction; + +function posix_spawn(__pid:Ppid_t; __path:Pchar; var __file_actions: posix_spawn_file_actions_t; var __attrp:posix_spawnattr_t; argv:ppchar;envp:ppchar):longint;cdecl;external clib name 'posix_spawn'; +function posix_spawnp(__pid:Ppid_t; __file:Pchar; var __file_actions: posix_spawn_file_actions_t; var __attrp: posix_spawnattr_t; argv:PPchar;envp:ppchar):longint;cdecl;external clib name 'posix_spawnp'; +function posix_spawnattr_init(var __attr: posix_spawnattr_t):longint;cdecl;external clib name 'posix_spawnattr_init'; +function posix_spawnattr_destroy(var __attr: posix_spawnattr_t):longint;cdecl;external clib name 'posix_spawnattr_destroy'; +function posix_spawnattr_getsigdefault(var __attr: posix_spawnattr_t; var __sigdefault: sigset_t):longint;cdecl;external clib name 'posix_spawnattr_getsigdefault'; +function posix_spawnattr_setsigdefault(var __attr: posix_spawnattr_t; var __sigdefault: sigset_t):longint;cdecl;external clib name 'posix_spawnattr_setsigdefault'; +function posix_spawnattr_getsigmask(var __attr: posix_spawnattr_t; var __sigmask:sigset_t):longint;cdecl;external clib name 'posix_spawnattr_getsigmask'; +function posix_spawnattr_setsigmask(var __attr: posix_spawnattr_t; var __sigmask:sigset_t):longint;cdecl;external clib name 'posix_spawnattr_setsigmask'; +function posix_spawnattr_getflags(var __attr: posix_spawnattr_t; var __flags: smallint):longint;cdecl;external clib name 'posix_spawnattr_getflags'; +function posix_spawnattr_setflags(var __attr: posix_spawnattr_t; __flags:smallint):longint;cdecl;external clib name 'posix_spawnattr_setflags'; +function posix_spawnattr_getpgroup(var __attr: posix_spawnattr_t; var __pgroup:pid_t):longint;cdecl;external clib name 'posix_spawnattr_getpgroup'; +function posix_spawnattr_setpgroup(var __attr: posix_spawnattr_t; __pgroup:pid_t):longint;cdecl;external clib name 'posix_spawnattr_setpgroup'; +function posix_spawnattr_getschedpolicy(var __attr: posix_spawnattr_t; var __schedpolicy:longint):longint;cdecl;external clib name 'posix_spawnattr_getschedpolicy'; +function posix_spawnattr_setschedpolicy(var __attr: posix_spawnattr_t; __schedpolicy:longint):longint;cdecl;external clib name 'posix_spawnattr_setschedpolicy'; +function posix_spawnattr_getschedparam(var __attr: posix_spawnattr_t; var __schedparam:sched_param):longint;cdecl;external clib name 'posix_spawnattr_getschedparam'; +function posix_spawnattr_setschedparam(var __attr: posix_spawnattr_t; var __schedparam:sched_param):longint;cdecl;external clib name 'posix_spawnattr_setschedparam'; +function posix_spawn_file_actions_init(var __file_actions: posix_spawn_file_actions_t):longint;cdecl;external clib name 'posix_spawn_file_actions_init'; +function posix_spawn_file_actions_destroy(var __file_actions: posix_spawn_file_actions_t):longint;cdecl;external clib name 'posix_spawn_file_actions_destroy'; +function posix_spawn_file_actions_addopen(var __file_actions: posix_spawn_file_actions_t; __fd:longint; __path:Pchar; __oflag:longint; __mode:mode_t):longint;cdecl;external clib name 'posix_spawn_file_actions_addopen'; +function posix_spawn_file_actions_addclose(var __file_actions: posix_spawn_file_actions_t; __fd:longint):longint;cdecl;external clib name 'posix_spawn_file_actions_addclose'; +function posix_spawn_file_actions_adddup2(var __file_actions: posix_spawn_file_actions_t; __fd:longint; __newfd:longint):longint;cdecl;external clib name 'posix_spawn_file_actions_adddup2'; diff --git a/jcl/source/fpc/libclite/spermh.inc b/jcl/source/fpc/libclite/spermh.inc new file mode 100644 index 0000000000..833c31b798 --- /dev/null +++ b/jcl/source/fpc/libclite/spermh.inc @@ -0,0 +1,10 @@ + +function ioperm(__from:dword; __num:dword; __turn_on:longint):longint;cdecl;external clib name 'ioperm'; +function iopl(__level:longint):longint;cdecl;external clib name 'iopl'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/spollh.inc b/jcl/source/fpc/libclite/spollh.inc new file mode 100644 index 0000000000..8d4347c624 --- /dev/null +++ b/jcl/source/fpc/libclite/spollh.inc @@ -0,0 +1,23 @@ + +type + Pnfds_t = ^nfds_t; + nfds_t = dword; + + Ppollfd = ^pollfd; + pollfd = record + fd : longint; + events : smallint; + revents : smallint; + end; + + +function poll(__fds: Ppollfd; __nfds:nfds_t; __timeout:longint):longint;cdecl;external clib name 'poll'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPollFD = pollfd; + diff --git a/jcl/source/fpc/libclite/sptraceh.inc b/jcl/source/fpc/libclite/sptraceh.inc new file mode 100644 index 0000000000..bd81b08bb1 --- /dev/null +++ b/jcl/source/fpc/libclite/sptraceh.inc @@ -0,0 +1,57 @@ + +type + + __ptrace_request =( + PTRACE_TRACEME := 0, + PTRACE_PEEKTEXT := 1, + PTRACE_PEEKDATA := 2, + PTRACE_PEEKUSER := 3, + PTRACE_POKETEXT := 4, + PTRACE_POKEDATA := 5, + PTRACE_POKEUSER := 6, + PTRACE_CONT := 7, + PTRACE_KILL := 8, + PTRACE_SINGLESTEP := 9, + PTRACE_GETREGS := 12, + PTRACE_SETREGS := 13, + PTRACE_GETFPREGS := 14, + PTRACE_SETFPREGS := 15, + PTRACE_ATTACH := 16, + PTRACE_DETACH := 17, + PTRACE_GETFPXREGS := 18, + PTRACE_SETFPXREGS := 19, + PTRACE_SYSCALL := 24 + ); + +Const + PT_TRACE_ME = PTRACE_TRACEME; + PT_READ_I = PTRACE_PEEKTEXT; + PT_READ_D = PTRACE_PEEKDATA; + PT_READ_U = PTRACE_PEEKUSER; + PT_WRITE_I = PTRACE_POKETEXT; + PT_WRITE_D = PTRACE_POKEDATA; + PT_WRITE_U = PTRACE_POKEUSER; + PT_CONTINUE = PTRACE_CONT; + PT_KILL = PTRACE_KILL; + PT_STEP = PTRACE_SINGLESTEP; + PT_GETREGS = PTRACE_GETREGS; + PT_SETREGS = PTRACE_SETREGS; + PT_GETFPREGS = PTRACE_GETFPREGS; + PT_SETFPREGS = PTRACE_SETFPREGS; + PT_ATTACH = PTRACE_ATTACH; + PT_DETACH = PTRACE_DETACH; + PT_GETFPXREGS = PTRACE_GETFPXREGS; + PT_SETFPXREGS = PTRACE_SETFPXREGS; + PT_SYSCALL = PTRACE_SYSCALL; + +function ptrace(__request:__ptrace_request; args:array of const):longint;cdecl;external clib name 'ptrace'; +function ptrace(__request:__ptrace_request):longint;cdecl;varargs;external clib name 'ptrace'; +function ptrace(__request: __ptrace_request; PID: pid_t; Address: Pointer; Data: Longint): longint; cdecl; external clib name 'ptrace'; +function ptrace(__request: __ptrace_request; PID: pid_t; Address: Pointer; Data: Longint; Addr2: Pointer): longint; cdecl; external clib name 'ptrace'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/squota.inc b/jcl/source/fpc/libclite/squota.inc new file mode 100644 index 0000000000..817a7079bb --- /dev/null +++ b/jcl/source/fpc/libclite/squota.inc @@ -0,0 +1,34 @@ + +Function dbtob(num: cardinal): cardinal; + +begin + Result:=num shl 10; +end; + + +Function btodb(num: cardinal): cardinal; + +begin + Result:=num shr 10; +end; + + +Function fs_to_dq_blocks(num, blksize: cardinal): quad_t; + +begin + Result:=(num*blksize) div BLOCK_SIZE; +end; + + +Function QCMD(cmd, _type: cardinal): cardinal; + +begin + Result:=(cmd shl SUBCMDSHIFT) or (_type and SUBCMDMASK); +end; + + +Function dqoff(UID: loff_t): quad_t; + +begin + Result:=UID*SizeOf(dqblk); +end; diff --git a/jcl/source/fpc/libclite/squotah.inc b/jcl/source/fpc/libclite/squotah.inc new file mode 100644 index 0000000000..52707bf424 --- /dev/null +++ b/jcl/source/fpc/libclite/squotah.inc @@ -0,0 +1,75 @@ + +function dbtob(num: cardinal): cardinal; +function btodb(num: cardinal): cardinal; +function fs_to_dq_blocks(num, blksize: cardinal): quad_t; + + +const + MAX_IQ_TIME = 604800; + MAX_DQ_TIME = 604800; + MAXQUOTAS = 2; + USRQUOTA = 0; + GRPQUOTA = 1; + +const + INITQFNAMES: array[0..2] of PChar = ('user','group','undefined'); + + QUOTAFILENAME = 'quota'; + QUOTAGROUP = 'staff'; + + NR_DQHASH = 43; + NR_DQUOTS = 256; + SUBCMDMASK = $00ff; + SUBCMDSHIFT = 8; + +function QCMD(cmd, _type: cardinal): cardinal; + + +const + Q_QUOTAON = $0100; + Q_QUOTAOFF = $0200; + Q_GETQUOTA = $0300; + Q_SETQUOTA = $0400; + Q_SETUSE = $0500; + Q_SYNC = $0600; + Q_SETQLIM = $0700; + Q_GETSTATS = $0800; + Q_RSQUASH = $1000; + +type + Pdqblk = ^dqblk; + dqblk = record + dqb_bhardlimit : u_int32_t; + dqb_bsoftlimit : u_int32_t; + dqb_curblocks : u_int32_t; + dqb_ihardlimit : u_int32_t; + dqb_isoftlimit : u_int32_t; + dqb_curinodes : u_int32_t; + dqb_btime : time_t; + dqb_itime : time_t; + end; + +function dqoff(UID: loff_t): quad_t; + + +type + Pdqstats = ^dqstats; + dqstats = record + lookups : u_int32_t; + drops : u_int32_t; + reads : u_int32_t; + writes : u_int32_t; + cache_hits : u_int32_t; + allocated_dquots : u_int32_t; + free_dquots : u_int32_t; + syncs : u_int32_t; + end; + + +function quotactl(__cmd:longint; __special:Pchar; __id:longint; __addr:caddr_t):longint;cdecl;external clib name 'quotactl'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sraw.inc b/jcl/source/fpc/libclite/sraw.inc new file mode 100644 index 0000000000..738ca72f8c --- /dev/null +++ b/jcl/source/fpc/libclite/sraw.inc @@ -0,0 +1,15 @@ +{ --------------------------------------------------------------------- + macros from sys/raw.h + ---------------------------------------------------------------------} + +function RAW_SETBIND : cardinal; + + begin + RAW_SETBIND:=_IO($ac,0); + end; + +function RAW_GETBIND : cardinal; + + begin + RAW_GETBIND:=_IO($ac,1); + end; diff --git a/jcl/source/fpc/libclite/srawh.inc b/jcl/source/fpc/libclite/srawh.inc new file mode 100644 index 0000000000..643e11f951 --- /dev/null +++ b/jcl/source/fpc/libclite/srawh.inc @@ -0,0 +1,23 @@ + +const + RAW_MAJOR = 162; + +function RAW_SETBIND : cardinal; +function RAW_GETBIND : cardinal; + +type + Praw_config_request = ^raw_config_request; + raw_config_request = record + raw_minor : longint; + block_major : uint64_t; + block_minor : uint64_t; + end; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TRawConfigRequest = raw_config_request; + PRawConfigRequest = ^TRawConfigRequest; + diff --git a/jcl/source/fpc/libclite/srebooth.inc b/jcl/source/fpc/libclite/srebooth.inc new file mode 100644 index 0000000000..a95831c62a --- /dev/null +++ b/jcl/source/fpc/libclite/srebooth.inc @@ -0,0 +1,17 @@ + + +const + RB_AUTOBOOT = $01234567; + RB_HALT_SYSTEM = $cdef0123; + RB_ENABLE_CAD = $89abcdef; + RB_DISABLE_CAD = 0; + RB_POWER_OFF = $4321fedc; + +function reboot(__howto:longint):longint;cdecl;external clib name 'reboot'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sresourceh.inc b/jcl/source/fpc/libclite/sresourceh.inc new file mode 100644 index 0000000000..097de49fcf --- /dev/null +++ b/jcl/source/fpc/libclite/sresourceh.inc @@ -0,0 +1,23 @@ +type + __RLIMIT_RESOURCE_T = __RLIMIT_RESOURCE; + __RUSAGE_T = RUSAGE; + __RUSAGE_WHO_T = __rusage_who; + __priority_which_t = __priority_which; + +function getrlimit(__resource:__rlimit_resource_t; __rlimits:Prlimit):longint;cdecl;external clib name 'getrlimit'; +function getrlimit64(__resource:__rlimit_resource_t; __rlimits:Prlimit64):longint;cdecl;external clib name 'getrlimit64'; +function setrlimit(__resource:__rlimit_resource_t; __rlimits:Prlimit):longint;cdecl;external clib name 'setrlimit'; +function setrlimit64(__resource:__rlimit_resource_t; __rlimits:Prlimit64):longint;cdecl;external clib name 'setrlimit64'; + +function getrusage(__who:__rusage_who_t; __usage:Prusage):longint;cdecl;external clib name 'getrusage'; +function getpriority(__which:__priority_which_t; __who:id_t):longint;cdecl;external clib name 'getpriority'; +function setpriority(__which:__priority_which_t; __who:id_t; __prio:longint):longint;cdecl;external clib name 'setpriority'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type + +Function setrlimit (__resource: __rlimit_resource_t; const __rlimits: TRLimit): longint; cdecl; external clib name 'setrlimit'; diff --git a/jcl/source/fpc/libclite/sscsi_ioctlh.inc b/jcl/source/fpc/libclite/sscsi_ioctlh.inc new file mode 100644 index 0000000000..afe8966ffb --- /dev/null +++ b/jcl/source/fpc/libclite/sscsi_ioctlh.inc @@ -0,0 +1,16 @@ + +const + SCSI_IOCTL_SEND_COMMAND = 1; + SCSI_IOCTL_TEST_UNIT_READY = 2; + SCSI_IOCTL_BENCHMARK_COMMAND = 3; + SCSI_IOCTL_SYNC = 4; + SCSI_IOCTL_START_UNIT = 5; + SCSI_IOCTL_STOP_UNIT = 6; + SCSI_IOCTL_DOORLOCK = $5380; + SCSI_IOCTL_DOORUNLOCK = $5381; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sscsih.inc b/jcl/source/fpc/libclite/sscsih.inc new file mode 100644 index 0000000000..a42a3171c2 --- /dev/null +++ b/jcl/source/fpc/libclite/sscsih.inc @@ -0,0 +1,159 @@ + + +const + __TEST_UNIT_READY = $00; + __REZERO_UNIT = $01; + __REQUEST_SENSE = $03; + __FORMAT_UNIT = $04; + __READ_BLOCK_LIMITS = $05; + __REASSIGN_BLOCKS = $07; + __READ_6 = $08; + __WRITE_6 = $0a; + __SEEK_6 = $0b; + __READ_REVERSE = $0f; + __WRITE_FILEMARKS = $10; + __SPACE = $11; + __INQUIRY = $12; + __RECOVER_BUFFERED_DATA = $14; + __MODE_SELECT = $15; + __RESERVE = $16; + __RELEASE = $17; + __COPY = $18; + __ERASE = $19; + __MODE_SENSE = $1a; + __START_STOP = $1b; + __RECEIVE_DIAGNOSTIC = $1c; + __SEND_DIAGNOSTIC = $1d; + __ALLOW_MEDIUM_REMOVAL = $1e; + __SET_WINDOW = $24; + __READ_CAPACITY = $25; + __READ_10 = $28; + __WRITE_10 = $2a; + __SEEK_10 = $2b; + __WRITE_VERIFY = $2e; + __VERIFY = $2f; + __SEARCH_HIGH = $30; + __SEARCH_EQUAL = $31; + __SEARCH_LOW = $32; + __SET_LIMITS = $33; + __PRE_FETCH = $34; + __READ_POSITION = $34; + __SYNCHRONIZE_CACHE = $35; + __LOCK_UNLOCK_CACHE = $36; + __READ_DEFECT_DATA = $37; + __MEDIUM_SCAN = $38; + __COMPARE = $39; + __COPY_VERIFY = $3a; + __WRITE_BUFFER = $3b; + __READ_BUFFER = $3c; + __UPDATE_BLOCK = $3d; + __READ_LONG = $3e; + __WRITE_LONG = $3f; + __CHANGE_DEFINITION = $40; + __WRITE_SAME = $41; + __READ_TOC = $43; + __LOG_SELECT = $4c; + __LOG_SENSE = $4d; + __MODE_SELECT_10 = $55; + __RESERVE_10 = $56; + __RELEASE_10 = $57; + __MODE_SENSE_10 = $5a; + __PERSISTENT_RESERVE_IN = $5e; + __PERSISTENT_RESERVE_OUT = $5f; + __MOVE_MEDIUM = $a5; + __READ_12 = $a8; + __WRITE_12 = $aa; + __WRITE_VERIFY_12 = $ae; + __SEARCH_HIGH_12 = $b0; + __SEARCH_EQUAL_12 = $b1; + __SEARCH_LOW_12 = $b2; + __READ_ELEMENT_STATUS = $b8; + __SEND_VOLUME_TAG = $b6; + __WRITE_LONG_2 = $ea; + + GOOD = $00; + CHECK_CONDITION = $01; + CONDITION_GOOD = $02; + BUSY = $04; + INTERMEDIATE_GOOD = $08; + INTERMEDIATE_C_GOOD = $0a; + RESERVATION_CONFLICT = $0c; + COMMAND_TERMINATED = $11; + QUEUE_FULL = $14; + STATUS_MASK = $3e; + NO_SENSE = $00; + RECOVERED_ERROR = $01; + NOT_READY = $02; + MEDIUM_ERROR = $03; + HARDWARE_ERROR = $04; + ILLEGAL_REQUEST = $05; + UNIT_ATTENTION = $06; + DATA_PROTECT = $07; + BLANK_CHECK = $08; + COPY_ABORTED = $0a; + ABORTED_COMMAND = $0b; + VOLUME_OVERFLOW = $0d; + MISCOMPARE = $0e; + TYPE_DISK = $00; + TYPE_TAPE = $01; + TYPE_PROCESSOR = $03; + TYPE_WORM = $04; + TYPE_ROM = $05; + TYPE_SCANNER = $06; + TYPE_MOD = $07; + TYPE_MEDIUM_CHANGER = $08; + TYPE_ENCLOSURE = $0d; + TYPE_NO_LUN = $7f; + +type + Pccs_modesel_head = ^ccs_modesel_head; + ccs_modesel_head = record + _r1 : byte; + medium : byte; + _r2 : byte; + block_desc_length : byte; + density : byte; + number_blocks_hi : byte; + number_blocks_med : byte; + number_blocks_lo : byte; + _r3 : byte; + block_length_hi : byte; + block_length_med : byte; + block_length_lo : byte; + end; + + +const + COMMAND_COMPLETE = $00; + EXTENDED_MESSAGE = $01; + EXTENDED_MODIFY_DATA_POINTER = $00; + EXTENDED_SDTR = $01; + EXTENDED_EXTENDED_IDENTIFY = $02; + EXTENDED_WDTR = $03; + SAVE_POINTERS = $02; + RESTORE_POINTERS = $03; + DISCONNECT = $04; + INITIATOR_ERROR = $05; + ABORT = $06; + MESSAGE_REJECT = $07; + NOP = $08; + MSG_PARITY_ERROR = $09; + LINKED_CMD_COMPLETE = $0a; + LINKED_FLG_CMD_COMPLETE = $0b; + BUS_DEVICE_RESET = $0c; + INITIATE_RECOVERY = $0f; + RELEASE_RECOVERY = $10; + SIMPLE_QUEUE_TAG = $20; + HEAD_OF_QUEUE_TAG = $21; + ORDERED_QUEUE_TAG = $22; + SCSI_IOCTL_GET_IDLUN = $5382; + SCSI_IOCTL_TAGGED_ENABLE = $5383; + SCSI_IOCTL_TAGGED_DISABLE = $5384; + SCSI_IOCTL_PROBE_HOST = $5385; + SCSI_IOCTL_GET_BUS_NUMBER = $5386; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sselect.inc b/jcl/source/fpc/libclite/sselect.inc new file mode 100644 index 0000000000..d23743e248 --- /dev/null +++ b/jcl/source/fpc/libclite/sselect.inc @@ -0,0 +1,33 @@ + +Function FD_ISSET(fd: longint; const fdset: _fd_set): Boolean; + +begin + Result:=(fdset.fds_bits[__FDELT(fd)] and __FDMASK(fd))<>0; +end; + + +Procedure FD_SET(fd: longint; var fdset: _fd_set); + +begin + fdset.fds_bits[__FDELT(fd)]:=fdset.fds_bits[__FDELT(fd)] or __FDMASK(fd); +end; + + +Procedure FD_CLR(fd: longint; var fdset: _fd_set); + +begin + fdset.fds_bits[__FDELT(fd)]:=fdset.fds_bits[__FDELT(fd)] and (not __FDMASK(fd)); +end; + + +Procedure FD_ZERO(var fdset: _fd_set); + +var + I: Integer; + +begin + with fdset do + for I:=Low(fds_bits) to High(fds_bits) do + fds_bits[I]:=0; +end; + diff --git a/jcl/source/fpc/libclite/sselecth.inc b/jcl/source/fpc/libclite/sselecth.inc new file mode 100644 index 0000000000..a0f1d8c1b9 --- /dev/null +++ b/jcl/source/fpc/libclite/sselecth.inc @@ -0,0 +1,33 @@ + +Type + Pfd_set = ^_fd_set; + _fd_set = __fd_set; + +const + FD_SETSIZE = __FD_SETSIZE; + +Type + Pfd_mask = ^fd_mask; + fd_mask = __fd_mask; + +const + NFDBITS = __NFDBITS; + +procedure FD_ZERO(var fdset: _fd_set); +procedure FD_SET(fd: longint; var fdset: _fd_Set); +procedure FD_CLR(fd: longint; var fdset: _fd_set); +function FD_ISSET(fd: longint; const fdset: _fd_set): Boolean; + +function select(__nfds:longint; __readfds:Pfd_set; __writefds:Pfd_set; __exceptfds:Pfd_set; __timeout:Ptimeval):longint;cdecl;external clib name 'select'; +function pselect(__nfds:longint; __readfds:Pfd_set; __writefds:Pfd_set; __exceptfds:Pfd_set; __timeout:Ptimespec; + __sigmask:P__sigset_t):longint;cdecl;external clib name 'pselect'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function select(__nfds:longint; __readfds: Pfd_set; __writefds: Pfd_set; __exceptfds: Pfd_set; var __timeout:timeval):longint;cdecl;external clib name 'select'; +function select(__nfds:longint; var __readfds,__writefds, __exceptfds: _fd_set; var __timeout:timeval):longint;cdecl;external clib name 'select'; +function pselect(__nfds:longint; __readfds:Pfd_set; __writefds:Pfd_set; __exceptfds:Pfd_set; var __timeout:timespec; const __sigmask: __sigset_t):longint;cdecl;external clib name 'pselect'; +function pselect(__nfds:longint; Var __readfds, __writefds, __exceptfds: _fd_set; var __timeout:timespec; const __sigmask: __sigset_t):longint;cdecl;external clib name 'pselect'; diff --git a/jcl/source/fpc/libclite/ssemh.inc b/jcl/source/fpc/libclite/ssemh.inc new file mode 100644 index 0000000000..669f26fc52 --- /dev/null +++ b/jcl/source/fpc/libclite/ssemh.inc @@ -0,0 +1,25 @@ + +type + Psembuf = ^sembuf; + sembuf = record + sem_num : word; + sem_op : smallint; + sem_flg : smallint; + end; + + +function semctl(__semid:longint; __semnum:longint; __cmd:longint; args:array of const):longint;cdecl;external clib name 'semctl'; +function semctl(__semid:longint; __semnum:longint; __cmd:longint):longint;varargs;cdecl;external clib name 'semctl'; +function semget(__key:key_t; __nsems:longint; __semflg:longint):longint;cdecl;external clib name 'semget'; +function semop(__semid:longint; __sops:psembuf; __nsops:size_t):longint;cdecl;external clib name 'semop'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSemaphoreBuffer = sembuf; + PSemaphoreBuffer = ^TSemaphoreBuffer; + +function semop(__semid:longint; var __sops:sembuf; __nsops:size_t):longint;cdecl;external clib name 'semop'; diff --git a/jcl/source/fpc/libclite/ssendfileh.inc b/jcl/source/fpc/libclite/ssendfileh.inc new file mode 100644 index 0000000000..220b4de14f --- /dev/null +++ b/jcl/source/fpc/libclite/ssendfileh.inc @@ -0,0 +1,10 @@ + +function sendfile(__out_fd:longint; __in_fd:longint; offset:Poff_t; __count:size_t):ssize_t;cdecl;external clib name 'sendfile'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function sendfile(__out_fd:longint; __in_fd:longint; var offset: off_t; __count:size_t):ssize_t;cdecl;external clib name 'sendfile'; diff --git a/jcl/source/fpc/libclite/ssgh.inc b/jcl/source/fpc/libclite/ssgh.inc new file mode 100644 index 0000000000..d375ec594b --- /dev/null +++ b/jcl/source/fpc/libclite/ssgh.inc @@ -0,0 +1,142 @@ + +type + Psg_iovec = ^sg_iovec; + sg_iovec = record + iov_base : pointer; + iov_len : size_t; + end; + sg_iovec_t = sg_iovec; + Psg_iovec_t = ^sg_iovec_t; + + Psg_io_hdr = ^sg_io_hdr; + sg_io_hdr = record + interface_id : longint; + dxfer_direction : longint; + cmd_len : byte; + mx_sb_len : byte; + iovec_count : word; + dxfer_len : dword; + dxferp : pointer; + cmdp : Pbyte; + sbp : Pbyte; + timeout : dword; + flags : dword; + pack_id : longint; + usr_ptr : pointer; + status : byte; + masked_status : byte; + msg_status : byte; + sb_len_wr : byte; + host_status : word; + driver_status : word; + resid : longint; + duration : dword; + info : dword; + end; + sg_io_hdr_t = sg_io_hdr; + Psg_io_hdr_t = ^sg_io_hdr_t; + +const + SG_DXFER_NONE = -(1); + SG_DXFER_TO_DEV = -(2); + SG_DXFER_FROM_DEV = -(3); + SG_DXFER_TO_FROM_DEV = -(4); + SG_FLAG_DIRECT_IO = 1; + SG_FLAG_LUN_INHIBIT = 2; + SG_FLAG_NO_DXFER = $10000; + SG_INFO_OK_MASK = $1; + SG_INFO_OK = $0; + SG_INFO_CHECK = $1; + SG_INFO_DIRECT_IO_MASK = $6; + SG_INFO_INDIRECT_IO = $0; + SG_INFO_DIRECT_IO = $2; + SG_INFO_MIXED_IO = $4; +type + Psg_scsi_id = ^sg_scsi_id; + sg_scsi_id = record + host_no : longint; + channel : longint; + scsi_id : longint; + lun : longint; + scsi_type : longint; + h_cmd_per_lun : smallint; + d_queue_depth : smallint; + unused : array[0..1] of longint; + end; + + + Psg_req_info = ^sg_req_info; + sg_req_info = record + req_state : char; + orphan : char; + sg_io_owned : char; + problem : char; + pack_id : longint; + usr_ptr : pointer; + duration : dword; + unused : longint; + end; + sg_req_info_t = sg_req_info; + Psg_req_info_t = ^sg_req_info_t; + +const + SG_EMULATED_HOST = $2203; + SG_SET_TRANSFORM = $2204; + SG_GET_TRANSFORM = $2205; + SG_SET_RESERVED_SIZE = $2275; + SG_GET_RESERVED_SIZE = $2272; + SG_GET_SCSI_ID = $2276; + SG_SET_FORCE_LOW_DMA = $2279; + SG_GET_LOW_DMA = $227a; + SG_SET_FORCE_PACK_ID = $227b; + SG_GET_PACK_ID = $227c; + SG_GET_NUM_WAITING = $227d; + SG_GET_SG_TABLESIZE = $227F; + SG_GET_VERSION_NUM = $2282; + SG_SCSI_RESET = $2284; + SG_SCSI_RESET_NOTHING = 0; + SG_SCSI_RESET_DEVICE = 1; + SG_SCSI_RESET_BUS = 2; + SG_SCSI_RESET_HOST = 3; + SG_IO = $2285; + SG_GET_REQUEST_TABLE = $2286; + SG_SET_KEEP_ORPHAN = $2287; + SG_GET_KEEP_ORPHAN = $2288; + SG_SCATTER_SZ = 8 * 4096; + SG_DEFAULT_RETRIES = 1; + SG_DEF_FORCE_LOW_DMA = 0; + SG_DEF_FORCE_PACK_ID = 0; + SG_DEF_KEEP_ORPHAN = 0; + SG_DEF_RESERVED_SIZE = SG_SCATTER_SZ; + SG_MAX_QUEUE = 16; + SG_BIG_BUFF = SG_DEF_RESERVED_SIZE; + +const + SG_MAX_SENSE = 16; +type + Psg_header = ^sg_header; + sg_header = record + pack_len : longint; + reply_len : longint; + pack_id : longint; + result : longint; + flag0 : cardinal; + sense_buffer : array[0..(SG_MAX_SENSE)-1] of byte; + end; + +const + SG_SET_TIMEOUT = $2201; + SG_GET_TIMEOUT = $2202; + SG_GET_COMMAND_Q = $2270; + SG_SET_COMMAND_Q = $2271; + SG_SET_DEBUG = $227e; + SG_NEXT_CMD_LEN = $2283; + SG_DEFAULT_TIMEOUT = 60 * HZ; + SG_DEF_COMMAND_Q = 0; + SG_DEF_UNDERRUN_FLAG = 0; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sshmh.inc b/jcl/source/fpc/libclite/sshmh.inc new file mode 100644 index 0000000000..91ebaa6dba --- /dev/null +++ b/jcl/source/fpc/libclite/sshmh.inc @@ -0,0 +1,14 @@ + +function SHMLBA : longint;cdecl; external clib name '__getpagesize'; +function __getpagesize:longint;cdecl;external clib name '__getpagesize'; +function shmctl(__shmid:longint; __cmd:longint; __buf:Pshmid_ds):longint;cdecl;external clib name 'shmctl'; +function shmget(__key:key_t; __size:size_t; __shmflg:longint):longint;cdecl;external clib name 'shmget'; +function shmat(__shmid:longint; __shmaddr:pointer; __shmflg:longint):pointer;cdecl;external clib name 'shmat'; +function shmdt(__shmaddr:pointer):longint;cdecl;external clib name 'shmdt'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function shmctl(__shmid:longint; __cmd:longint; var __buf:shmid_ds):longint;cdecl;external clib name 'shmctl'; diff --git a/jcl/source/fpc/libclite/ssocketh.inc b/jcl/source/fpc/libclite/ssocketh.inc new file mode 100644 index 0000000000..379824d5b5 --- /dev/null +++ b/jcl/source/fpc/libclite/ssocketh.inc @@ -0,0 +1,51 @@ + +Const + SHUT_RD = 0; + SHUT_WR = 1; + SHUT_RDWR = 2; + +function socket(__domain:longint; __type:longint; __protocol:longint):longint;cdecl;external clib name 'socket'; +function socketpair(__domain:longint; __type:longint; __protocol:longint; __fds: plongint):longint;cdecl;external clib name 'socketpair'; +function bind(__fd:longint; __addr:Psockaddr; __len:socklen_t):longint;cdecl;external clib name 'bind'; +function getsockname(__fd:longint; __addr:Psockaddr; __len:Psocklen_t):longint;cdecl;external clib name 'getsockname'; +function connect(__fd:longint; __addr:Psockaddr; __len:socklen_t):longint;cdecl;external clib name 'connect'; +function getpeername(__fd:longint; __addr:Psockaddr; __len:Psocklen_t):longint;cdecl;external clib name 'getpeername'; +function send(__fd:longint; __buf:pointer; __n:size_t; __flags:longint):ssize_t;cdecl;external clib name 'send'; +function recv(__fd:longint; __buf:pointer; __n:size_t; __flags:longint):ssize_t;cdecl;external clib name 'recv'; +function sendto(__fd:longint; __buf:pointer; __n:size_t; __flags:longint; __addr:Psockaddr; __addr_len:socklen_t):ssize_t;cdecl;external clib name 'sendto'; +function recvfrom(__fd:longint; __buf:pointer; __n:size_t; __flags:longint; __addr:Psockaddr; __addr_len:Psocklen_t):ssize_t;cdecl;external clib name 'recvfrom'; +function sendmsg(__fd:longint; __message:Pmsghdr; __flags:longint):ssize_t;cdecl;external clib name 'sendmsg'; +function recvmsg(__fd:longint; __message:Pmsghdr; __flags:longint):ssize_t;cdecl;external clib name 'recvmsg'; +function getsockopt(__fd:longint; __level:longint; __optname:longint; __optval:pointer; __optlen:Psocklen_t):longint;cdecl;external clib name 'getsockopt'; +function setsockopt(__fd:longint; __level:longint; __optname:longint; __optval:pointer; __optlen:socklen_t):longint;cdecl;external clib name 'setsockopt'; +function listen(__fd:longint; __n:longint):longint;cdecl;external clib name 'listen'; +function accept(__fd:longint; __addr:Psockaddr; __addr_len:Psocklen_t):longint;cdecl;external clib name 'accept'; +function shutdown(__fd:longint; __how:longint):longint;cdecl;external clib name 'shutdown'; +function isfdtype(__fd:longint; __fdtype:longint):longint;cdecl;external clib name 'isfdtype'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +type + TSocketPair = packed array[0..1] of TSocket; + +function socket(__domain: Integer; __type: __socket_type; __protocol: Integer): TSocket; cdecl;external clib name 'socket'; +function socketpair(__domain, __type, __protocol: Integer; var __fds: TSocketPair): Integer; cdecl;external clib name 'socketpair'; +function socketpair(__domain: Integer; __type: __socket_type; __protocol: Integer; var __fds: TSocketPair): Integer; cdecl;external clib name 'socketpair'; + +function bind(__fd:longint; var __addr: sockaddr; __len:socklen_t):longint;cdecl;external clib name 'bind'; +function getsockname(__fd:longint; var __addr: sockaddr; var __len: socklen_t):longint;cdecl;external clib name 'getsockname'; +function connect(__fd:longint; const __addr: sockaddr; __len:socklen_t):longint;cdecl;external clib name 'connect'; +function getpeername(__fd:longint; var __addr: sockaddr; var __len: socklen_t):longint;cdecl;external clib name 'getpeername'; +function sendto(__fd:longint; __buf:pointer; __n:size_t; __flags:longint; var __addr: sockaddr; __addr_len:socklen_t):ssize_t;cdecl;external clib name 'sendto'; +function recvfrom(__fd:longint; __buf:pointer; __n:size_t; __flags:longint; var __addr: sockaddr; __addr_len:Psocklen_t):ssize_t;cdecl;external clib name 'recvfrom'; +function sendmsg(__fd:longint; const __message: msghdr; __flags:longint):ssize_t;cdecl;external clib name 'sendmsg'; +function recvmsg(__fd:longint; var __message: msghdr; __flags:longint):ssize_t;cdecl;external clib name 'recvmsg'; +function getsockopt(__fd:longint; __level:longint; __optname:longint; __optval:pointer; var __optlen: socklen_t):longint;cdecl;external clib name 'getsockopt'; +function accept(__fd:longint; var __addr: sockaddr; var __addr_len:socklen_t):longint;cdecl;external clib name 'accept'; +function send(__fd:longint; const __buf; __n:size_t; __flags:longint):ssize_t;cdecl;external clib name 'send'; +function recv(__fd:longint; var __buf; __n:size_t; __flags:longint):ssize_t;cdecl;external clib name 'recv'; +function sendto(__fd:longint; const __buf; __n:size_t; __flags:longint; __addr:Psockaddr; __addr_len:socklen_t):ssize_t;cdecl;external clib name 'sendto'; +function recvfrom(__fd:longint; var __buf; __n:size_t; __flags:longint; __addr:Psockaddr; __addr_len:Psocklen_t):ssize_t;cdecl;external clib name 'recvfrom'; diff --git a/jcl/source/fpc/libclite/sstat.inc b/jcl/source/fpc/libclite/sstat.inc new file mode 100644 index 0000000000..22240985f7 --- /dev/null +++ b/jcl/source/fpc/libclite/sstat.inc @@ -0,0 +1,116 @@ +{ --------------------------------------------------------------------- + Macros from sys/stat.h + ---------------------------------------------------------------------} + +function __S_ISTYPE(mode,mask : __mode_t) : boolean; +begin + __S_ISTYPE:=(mode and __S_IFMT) = mask; +end; + +function S_ISDIR(mode : __mode_t) : boolean; +begin + S_ISDIR:=__S_ISTYPE(mode,__S_IFDIR); +end; + +function S_ISCHR(mode : __mode_t) : boolean; +begin + S_ISCHR:=__S_ISTYPE(mode,__S_IFCHR); +end; + +function S_ISBLK(mode : __mode_t) : boolean; +begin + S_ISBLK:=__S_ISTYPE(mode,__S_IFBLK); +end; + +function S_ISREG(mode : __mode_t) : boolean; +begin + S_ISREG:=__S_ISTYPE(mode,__S_IFREG); +end; + +function S_ISFIFO(mode : __mode_t) : boolean; +begin + S_ISFIFO:=__S_ISTYPE(mode,__S_IFIFO); +end; + +function S_ISLNK(mode : __mode_t) : boolean; +begin + S_ISLNK:=__S_ISTYPE(mode,__S_IFLNK); +end; + + +function S_ISSOCK(mode : __mode_t) : boolean; +begin + S_ISSOCK:=__S_ISTYPE(mode,__S_IFSOCK); +end; + + +function fstat(__fd:longint; __buf:Pstat):longint; + begin + fstat:=__fxstat(_STAT_VER,__fd,__buf); + end; + + +function lstat(__file:Pchar; __buf:Pstat):longint; + begin + lstat:=__lxstat(_STAT_VER,__file,__buf); + end; + + +function stat(__file:Pchar; __buf:Pstat):longint; + begin + stat:=__xstat(_STAT_VER,__file,__buf); + end; + + +function fstat64(__fd:longint; __buf:Pstat64):longint; + begin + fstat64:=__fxstat64(_STAT_VER,__fd,__buf); + end; + + +function lstat64(__file:Pchar; __buf:Pstat64):longint; + begin + lstat64:=__lxstat64(_STAT_VER,__file,__buf); + end; + + +function stat64(__file:Pchar; __buf:Pstat64):longint; + begin + stat64:=__xstat64(_STAT_VER,__file,__buf); + end; + + +function stat(__file:Pchar; var __buf:_stat):longint; + begin + stat:=__xstat(_STAT_VER,__file,__buf); + end; + + +function fstat(__fd:longint; var __buf:_stat):longint; + begin + fstat:=__fxstat(_STAT_VER,__fd,__buf); + end; + + +function stat64(__file:Pchar; var __buf: _stat64):longint; + begin + stat64:=__xstat64(_STAT_VER,__file,__buf); + end; + + +function fstat64(__fd:longint; var __buf: _stat64):longint; + begin + fstat64:=__fxstat64(_STAT_VER,__fd,__buf); + end; + + +function lstat(__file:Pchar; var __buf:_stat):longint; + begin + lstat:=__lxstat(_STAT_VER,__file,__buf); + end; + + +function lstat64(__file:Pchar; var __buf:_stat64):longint; + begin + lstat64:=__lxstat64(_STAT_VER,__file,__buf); + end; diff --git a/jcl/source/fpc/libclite/sstatfsh.inc b/jcl/source/fpc/libclite/sstatfsh.inc new file mode 100644 index 0000000000..a26f601384 --- /dev/null +++ b/jcl/source/fpc/libclite/sstatfsh.inc @@ -0,0 +1,16 @@ + + +function statfs(__file:Pchar; __buf:Pstatfs):longint;cdecl;external clib name 'statfs'; +function statfs64(__file:Pchar; __buf:Pstatfs64):longint;cdecl;external clib name 'statfs64'; +function fstatfs(__fildes:longint; __buf:Pstatfs):longint;cdecl;external clib name 'fstatfs'; +function fstatfs64(__fildes:longint; __buf:Pstatfs64):longint;cdecl;external clib name 'fstatfs64'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function statfs(__file:Pchar; var __buf:_statfs):longint;cdecl;external clib name 'statfs'; +function statfs64(__file:Pchar; var __buf:_statfs64):longint;cdecl;external clib name 'statfs64'; +function fstatfs(__fildes:longint; var __buf:_statfs):longint;cdecl;external clib name 'fstatfs'; +function fstatfs64(__fildes:longint; var __buf:_statfs64):longint;cdecl;external clib name 'fstatfs64'; diff --git a/jcl/source/fpc/libclite/sstath.inc b/jcl/source/fpc/libclite/sstath.inc new file mode 100644 index 0000000000..bc1c62fe6d --- /dev/null +++ b/jcl/source/fpc/libclite/sstath.inc @@ -0,0 +1,101 @@ + +const + S_IFMT = __S_IFMT; + S_IFDIR = __S_IFDIR; + S_IFCHR = __S_IFCHR; + S_IFBLK = __S_IFBLK; + S_IFREG = __S_IFREG; + S_IFIFO = __S_IFIFO; + S_IFLNK = __S_IFLNK; + S_IFSOCK = __S_IFSOCK; + + +function __S_ISTYPE(mode,mask : __mode_t) : boolean; +function S_ISDIR(mode : __mode_t) : boolean; +function S_ISCHR(mode : __mode_t) : boolean; +function S_ISBLK(mode : __mode_t) : boolean; +function S_ISREG(mode : __mode_t) : boolean; +function S_ISFIFO(mode : __mode_t) : boolean; +function S_ISLNK(mode : __mode_t) : boolean; +function S_ISSOCK(mode : __mode_t) : boolean; + +const + S_ISUID = __S_ISUID; + S_ISGID = __S_ISGID; + S_ISVTX = __S_ISVTX; + + S_IRUSR = __S_IREAD; + S_IWUSR = __S_IWRITE; + S_IXUSR = __S_IEXEC; + S_IRWXU = (__S_IREAD or __S_IWRITE) or __S_IEXEC; + + S_IREAD = S_IRUSR; + S_IWRITE = S_IWUSR; + S_IEXEC = S_IXUSR; + + S_IRGRP = S_IRUSR shr 3; + S_IWGRP = S_IWUSR shr 3; + S_IXGRP = S_IXUSR shr 3; + S_IRWXG = S_IRWXU shr 3; + S_IROTH = S_IRGRP shr 3; + S_IWOTH = S_IWGRP shr 3; + S_IXOTH = S_IXGRP shr 3; + S_IRWXO = S_IRWXG shr 3; + +const + ACCESSPERMS = (S_IRWXU or S_IRWXG) or S_IRWXO; + ALLPERMS = ((((S_ISUID or S_ISGID) or S_ISVTX) or S_IRWXU) or S_IRWXG) or S_IRWXO; + DEFFILEMODE = ((((S_IRUSR or S_IWUSR) or S_IRGRP) or S_IWGRP) or S_IROTH) or S_IWOTH; + S_BLKSIZE = 512; + +function stat(__file:Pchar; __buf:Pstat):longint; +function fstat(__fd:longint; __buf:Pstat):longint; + +function stat64(__file:Pchar; __buf:Pstat64):longint; +function fstat64(__fd:longint; __buf:Pstat64):longint; + +function lstat(__file:Pchar; __buf:Pstat):longint; +function lstat64(__file:Pchar; __buf:Pstat64):longint; + +function chmod(__file:Pchar; __mode:__mode_t):longint;cdecl;external clib name 'chmod'; +function fchmod(__fd:longint; __mode:__mode_t):longint;cdecl;external clib name 'fchmod'; +function umask(__mask:__mode_t):__mode_t;cdecl;external clib name 'umask'; +function getumask:__mode_t;cdecl;external clib name 'getumask'; + +function __mkdir(__path:Pchar; __mode:__mode_t):longint;cdecl;external clib name 'mkdir'; +function mknod(__path:Pchar; __mode:__mode_t; __dev:__dev_t):longint;cdecl;external clib name 'mknod'; +function mkfifo(__path:Pchar; __mode:__mode_t):longint;cdecl;external clib name 'mkfifo'; + +function __fxstat(__ver:longint; __fildes:longint; __stat_buf:Pstat):longint;cdecl;external clib name '__fxstat'; +function __xstat(__ver:longint; __filename:Pchar; __stat_buf:Pstat):longint;cdecl;external clib name '__xstat'; +function __lxstat(__ver:longint; __filename:Pchar; __stat_buf:Pstat):longint;cdecl;external clib name '__lxstat'; + +function __fxstat64(__ver:longint; __fildes:longint; __stat_buf:Pstat64):longint;cdecl;external clib name '__fxstat64'; +function __xstat64(__ver:longint; __filename:Pchar; __stat_buf:Pstat64):longint;cdecl;external clib name '__xstat64'; +function __lxstat64(__ver:longint; __filename:Pchar; __stat_buf:Pstat64):longint;cdecl;external clib name '__lxstat64'; + +function __xmknod(__ver:longint; __path:Pchar; __mode:__mode_t; __dev:P__dev_t):longint;cdecl;external clib name '__xmknod'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function stat(__file:Pchar; var __buf:_stat):longint; +function fstat(__fd:longint; var __buf:_stat):longint; + +function stat64(__file:Pchar; var __buf: _stat64):longint; +function fstat64(__fd:longint; var __buf: _stat64):longint; + +function lstat(__file:Pchar; var __buf:_stat):longint; +function lstat64(__file:Pchar; var __buf:_stat64):longint; + +function __fxstat(__ver:longint; __fildes:longint; var __stat_buf: _stat):longint;cdecl;external clib name '__fxstat'; +function __xstat(__ver:longint; __filename:Pchar; var __stat_buf: _stat):longint;cdecl;external clib name '__xstat'; +function __lxstat(__ver:longint; __filename:Pchar; var __stat_buf: _stat):longint;cdecl;external clib name '__lxstat'; + +function __fxstat64(__ver:longint; __fildes:longint; var __stat_buf: _stat64):longint;cdecl;external clib name '__fxstat64'; +function __xstat64(__ver:longint; __filename:Pchar; var __stat_buf: _stat64):longint;cdecl;external clib name '__xstat64'; +function __lxstat64(__ver:longint; __filename:Pchar; var __stat_buf: _stat64):longint;cdecl;external clib name '__lxstat64'; + +function __xmknod(__ver:longint; __path:Pchar; __mode:__mode_t; var __dev: __dev_t):longint;cdecl;external clib name '__xmknod'; diff --git a/jcl/source/fpc/libclite/sstatvfsh.inc b/jcl/source/fpc/libclite/sstatvfsh.inc new file mode 100644 index 0000000000..eeaf546ce0 --- /dev/null +++ b/jcl/source/fpc/libclite/sstatvfsh.inc @@ -0,0 +1,17 @@ + + +function statvfs(__file:Pchar; __buf:Pstatvfs):longint;cdecl;external clib name 'statvfs'; +function statvfs64(__file:Pchar; __buf:Pstatvfs64):longint;cdecl;external clib name 'statvfs64'; +function fstatvfs(__fildes:longint; __buf:Pstatvfs):longint;cdecl;external clib name 'fstatvfs'; +function fstatvfs64(__fildes:longint; __buf:Pstatvfs64):longint;cdecl;external clib name 'fstatvfs64'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function statvfs(__file:Pchar; var __buf: _statvfs):longint;cdecl;external clib name 'statvfs'; +function statvfs64(__file:Pchar; var __buf: _statvfs64):longint;cdecl;external clib name 'statvfs64'; +function fstatvfs(__fildes:longint; var __buf: _statvfs):longint;cdecl;external clib name 'fstatvfs'; +function fstatvfs64(__fildes:longint; var __buf: _statvfs64):longint;cdecl;external clib name 'fstatvfs64'; diff --git a/jcl/source/fpc/libclite/sswaph.inc b/jcl/source/fpc/libclite/sswaph.inc new file mode 100644 index 0000000000..b9437b661c --- /dev/null +++ b/jcl/source/fpc/libclite/sswaph.inc @@ -0,0 +1,14 @@ + +const + SWAP_FLAG_PREFER = $8000; + SWAP_FLAG_PRIO_MASK = $7fff; + SWAP_FLAG_PRIO_SHIFT = 0; + +function swapon(__path:Pchar; __flags:longint):longint;cdecl;external clib name 'swapon'; +function swapoff(__path:Pchar):longint;cdecl;external clib name 'swapoff'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/ssysctlh.inc b/jcl/source/fpc/libclite/ssysctlh.inc new file mode 100644 index 0000000000..0e7ad3c373 --- /dev/null +++ b/jcl/source/fpc/libclite/ssysctlh.inc @@ -0,0 +1,11 @@ + + +function sysctl(__name:Plongint; __nlen:longint; __oldval:pointer; __oldlenp:Psize_t; __newval:pointer; + __newlen:size_t):longint;cdecl;external clib name 'sysctl'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/ssysinfoh.inc b/jcl/source/fpc/libclite/ssysinfoh.inc new file mode 100644 index 0000000000..2692723572 --- /dev/null +++ b/jcl/source/fpc/libclite/ssysinfoh.inc @@ -0,0 +1,34 @@ + +Const + SI_LOAD_SHIFT = 16; + +type + PSysInfo = ^_sysInfo; + _sysinfo = {packed} record // Renamed due to identifier conflict with sysinfo function + uptime: Integer; { Seconds since boot } + loads: packed array[0..2] of LongWord;{ 1, 5, and 15 minute load averages } + totalram: LongWord; { Total usable main memory size } + freeram: LongWord; { Available memory size } + sharedram: LongWord; { Amount of shared memory } + bufferram: LongWord; { Memory used by buffers } + totalswap: LongWord; { Total swap space size } + freeswap: LongWord; { swap space still available } + procs: Word; { Number of current processes } + _f: packed array[0..21] of Char; { Pads structure to 64 bytes } + end; + P_sysInfo = ^_sysInfo; + + +function sysinfo(__info:Psysinfo):longint;cdecl;external clib name 'sysinfo'; +function get_nprocs_conf:longint;cdecl;external clib name 'get_nprocs_conf'; +function get_nprocs:longint;cdecl;external clib name 'get_nprocs'; +function get_phys_pages:longint;cdecl;external clib name 'get_phys_pages'; +function get_avphys_pages:longint;cdecl;external clib name 'get_avphys_pages'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSysInfo = _sysinfo; diff --git a/jcl/source/fpc/libclite/ssyslog.inc b/jcl/source/fpc/libclite/ssyslog.inc new file mode 100644 index 0000000000..224145c08c --- /dev/null +++ b/jcl/source/fpc/libclite/ssyslog.inc @@ -0,0 +1,31 @@ + + +function LOG_PRI(p : longint) : longint; + +begin + LOG_PRI:=(p and LOG_PRIMASK); +end; + +function LOG_MAKEPRI(fac,pri : longint) : longint; + +begin + LOG_MAKEPRI:=(fac shl 3) or pri; +end; + +function LOG_FAC(p : longint) : longint; + +begin + LOG_FAC:=(p and LOG_FACMASK) shr 3; +end; + +function LOG_MASK(pri : longint) : longint; + +begin + LOG_MASK:=1 shl pri; +end; + + +function LOG_UPTO(pri : longint) : longint; +begin + LOG_UPTO:=(1 shl (pri + 1)) - 1; +end; diff --git a/jcl/source/fpc/libclite/ssyslogh.inc b/jcl/source/fpc/libclite/ssyslogh.inc new file mode 100644 index 0000000000..23cb09524d --- /dev/null +++ b/jcl/source/fpc/libclite/ssyslogh.inc @@ -0,0 +1,127 @@ + +const + _PATH_LOG = '/dev/log'; + LOG_EMERG = 0; + LOG_ALERT = 1; + LOG_CRIT = 2; + LOG_ERR = 3; + LOG_WARNING = 4; + LOG_NOTICE = 5; + LOG_INFO = 6; + LOG_DEBUG = 7; + LOG_PRIMASK = $07; + +function LOG_PRI(p : longint) : longint; +function LOG_MAKEPRI(fac,pri : longint) : longint; + +const + INTERNAL_NOPRI = $10; + INTERNAL_MARK = 24 shl 3; + +type + + P_code = ^_code; + _code = record + c_name : Pchar; + c_val : longint; + end; + CODE = _code; + PCODE = ^CODE; + +Const + prioritynames: array[0..12] of _code = + ( + (c_name: 'alert'; c_val: LOG_ALERT), + (c_name: 'crit'; c_val: LOG_CRIT), + (c_name: 'debug'; c_val: LOG_DEBUG), + (c_name: 'emerg'; c_val: LOG_EMERG), + (c_name: 'err'; c_val: LOG_ERR), + (c_name: 'error'; c_val: LOG_ERR), + (c_name: 'info'; c_val: LOG_INFO), + (c_name: 'none'; c_val: INTERNAL_NOPRI), + (c_name: 'notice'; c_val: LOG_NOTICE), + (c_name: 'panic'; c_val: LOG_EMERG), + (c_name: 'warn'; c_val: LOG_WARNING), + (c_name: 'warning'; c_val: LOG_WARNING), + (c_name: nil; c_val: -1) + ); + +const + LOG_KERN = 0 shl 3; + LOG_USER = 1 shl 3; + LOG_MAIL = 2 shl 3; + LOG_DAEMON = 3 shl 3; + LOG_AUTH = 4 shl 3; + LOG_SYSLOG = 5 shl 3; + LOG_LPR = 6 shl 3; + LOG_NEWS = 7 shl 3; + LOG_UUCP = 8 shl 3; + LOG_CRON = 9 shl 3; + LOG_AUTHPRIV = 10 shl 3; + LOG_FTP = 11 shl 3; + LOG_LOCAL0 = 16 shl 3; + LOG_LOCAL1 = 17 shl 3; + LOG_LOCAL2 = 18 shl 3; + LOG_LOCAL3 = 19 shl 3; + LOG_LOCAL4 = 20 shl 3; + LOG_LOCAL5 = 21 shl 3; + LOG_LOCAL6 = 22 shl 3; + LOG_LOCAL7 = 23 shl 3; + LOG_NFACILITIES = 24; + LOG_FACMASK = $03f8; + +const + facilitynames: array[0..22] of _code = + ( + (c_name: 'auth'; c_val: LOG_AUTH), + (c_name: 'authpriv'; c_val: LOG_AUTHPRIV), + (c_name: 'cron'; c_val: LOG_CRON), + (c_name: 'daemon'; c_val: LOG_DAEMON), + (c_name: 'ftp'; c_val: LOG_FTP), + (c_name: 'kern'; c_val: LOG_KERN), + (c_name: 'lpr'; c_val: LOG_LPR), + (c_name: 'mail'; c_val: LOG_MAIL), + (c_name: 'mark'; c_val: INTERNAL_MARK), + (c_name: 'news'; c_val: LOG_NEWS), + (c_name: 'security'; c_val: LOG_AUTH), + (c_name: 'syslog'; c_val: LOG_SYSLOG), + (c_name: 'user'; c_val: LOG_USER), + (c_name: 'uucp'; c_val: LOG_UUCP), + (c_name: 'local0'; c_val: LOG_LOCAL0), + (c_name: 'local1'; c_val: LOG_LOCAL1), + (c_name: 'local2'; c_val: LOG_LOCAL2), + (c_name: 'local3'; c_val: LOG_LOCAL3), + (c_name: 'local4'; c_val: LOG_LOCAL4), + (c_name: 'local5'; c_val: LOG_LOCAL5), + (c_name: 'local6'; c_val: LOG_LOCAL6), + (c_name: 'local7'; c_val: LOG_LOCAL7), + (c_name: nil; c_val: -1) + ); + + +function LOG_FAC(p : longint) : longint; +function LOG_MASK(pri : longint) : longint; +function LOG_UPTO(pri : longint) : longint; + + +const + LOG_PID = $01; + LOG_CONS = $02; + LOG_ODELAY = $04; + LOG_NDELAY = $08; + LOG_NOWAIT = $10; + LOG_PERROR = $20; + +procedure closelog;cdecl;external clib name 'closelog'; +procedure openlog(__ident:Pchar; __option:longint; __facility:longint);cdecl;external clib name 'openlog'; +function setlogmask(__mask:longint):longint;cdecl;external clib name 'setlogmask'; +procedure syslog(__pri: Integer; __fmt: PChar; arg : array of const); cdecl; external clib name 'syslog'; +procedure vsyslog(__pri: Integer; Fmt: PChar; Arg: Pointer);cdecl; external clib name 'vsyslog'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSysLogCode = _code; diff --git a/jcl/source/fpc/libclite/stdinth.inc b/jcl/source/fpc/libclite/stdinth.inc new file mode 100644 index 0000000000..5de9b9e20b --- /dev/null +++ b/jcl/source/fpc/libclite/stdinth.inc @@ -0,0 +1,97 @@ + +type + int64_t = Int64; + uint8_t = byte; + + uint16_t = word; + uint32_t = dword; + uint64_t = qword; + int_least8_t = char; + int_least16_t = smallint; + int_least32_t = longint; + int_least64_t = int64; + uint_least8_t = byte; + uint_least16_t = word; + uint_least32_t = dword; + uint_least64_t = qword; + + int_fast8_t = shortint; + int_fast16_t = longint; + int_fast32_t = longint; + int_fast64_t = int64; + uint_fast8_t = byte; + + uint_fast16_t = dword; + uint_fast32_t = dword; + uint_fast64_t = qword; + + intptr_t = longint; + uintptr_t = dword; + intmax_t = Int64; + uintmax_t = QWord; + +const + INT8_MIN = -(128); + INT16_MIN = (-(32767)) - 1; + INT32_MIN = (-(2147483647)) - 1; + INT64_MIN = int64_t(-int64_t(9223372036854775807)-1); + + INT8_MAX = 127; + INT16_MAX = 32767; + INT32_MAX = 2147483647; + INT64_MAX = int64_t(9223372036854775807); + + UINT8_MAX = 255; + UINT16_MAX = 65535; + UINT32_MAX = 4294967295; + UINT64_MAX = uint64_t(-1); + + INT_LEAST8_MIN = -(128); + INT_LEAST16_MIN = (-(32767)) - 1; + INT_LEAST32_MIN = (-(2147483647)) - 1; + INT_LEAST64_MIN = int_least64_t(-int64_t(9223372036854775807)-1); + + INT_LEAST8_MAX = 127; + INT_LEAST16_MAX = 32767; + INT_LEAST32_MAX = 2147483647; + INT_LEAST64_MAX = int_least64_t(9223372036854775807); + + UINT_LEAST8_MAX = 255; + UINT_LEAST16_MAX = 65535; + UINT_LEAST32_MAX = 4294967295; + UINT_LEAST64_MAX = uint_least64_t(-1); + + INT_FAST8_MIN = -(128); + INT_FAST16_MIN = (-(2147483647)) - 1; + INT_FAST32_MIN = (-(2147483647)) - 1; + INT_FAST64_MIN = int_fast64_t(-Int64(9223372036854775807)-1); + + INT_FAST8_MAX = 127; + INT_FAST16_MAX = 2147483647; + INT_FAST32_MAX = 2147483647; + INT_FAST64_MAX = int_fast64_t(9223372036854775807); + + UINT_FAST8_MAX = 255; + UINT_FAST16_MAX = 4294967295; + UINT_FAST32_MAX = 4294967295; + UINT_FAST64_MAX = uint_fast64_t(-1); + + INTPTR_MIN = (-(2147483647)) - 1; + INTPTR_MAX = 2147483647; + UINTPTR_MAX = 4294967295; + + INTMAX_MIN = Int64(-Int64(9223372036854775807)-1); + INTMAX_MAX = Int64(9223372036854775807); + UINTMAX_MAX = QWord(-1); + + PTRDIFF_MIN = (-(2147483647)) - 1; + PTRDIFF_MAX = 2147483647; + + SIG_ATOMIC_MIN = (-(2147483647)) - 1; + SIG_ATOMIC_MAX = 2147483647; + + SIZE_MAX = 4294967295; + + WINT_MIN = 0; + WINT_MAX = 4294967295; + diff --git a/jcl/source/fpc/libclite/stdio_exth.inc b/jcl/source/fpc/libclite/stdio_exth.inc new file mode 100644 index 0000000000..6426888c54 --- /dev/null +++ b/jcl/source/fpc/libclite/stdio_exth.inc @@ -0,0 +1,22 @@ + +const + FSETLOCKING_QUERY = 0; + FSETLOCKING_INTERNAL = 1; + FSETLOCKING_BYCALLER = 2; + +function __fbufsize(__fp:PFILE):size_t;cdecl;external clib name '__fbufsize'; +function __freading(__fp:PFILE):longint;cdecl;external clib name '__freading'; +function __fwriting(__fp:PFILE):longint;cdecl;external clib name '__fwriting'; +function __freadable(__fp:PFILE):longint;cdecl;external clib name '__freadable'; +function __fwritable(__fp:PFILE):longint;cdecl;external clib name '__fwritable'; +function __flbf(__fp:PFILE):longint;cdecl;external clib name '__flbf'; +procedure __fpurge(__fp:PFILE);cdecl;external clib name '__fpurge'; +function __fpending(__fp:PFILE):size_t;cdecl;external clib name '__fpending'; +procedure _flushlbf;cdecl;external clib name '_flushlbf'; +function __fsetlocking(__fp:PFILE; __type:longint):longint;cdecl;external clib name '__fsetlocking'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/stdio_limh.inc b/jcl/source/fpc/libclite/stdio_limh.inc new file mode 100644 index 0000000000..c7fefb0646 --- /dev/null +++ b/jcl/source/fpc/libclite/stdio_limh.inc @@ -0,0 +1,22 @@ + +const + L_tmpnam = 20; + TMP_MAX = 238328; + FILENAME_MAX = 4096; + +const + L_ctermid = 9; + L_cuserid = 9; + +const + FOPEN_MAX = 16; + +const + IOV_MAX = 1024; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/stdioh.inc b/jcl/source/fpc/libclite/stdioh.inc new file mode 100644 index 0000000000..540b2e5dd6 --- /dev/null +++ b/jcl/source/fpc/libclite/stdioh.inc @@ -0,0 +1,161 @@ + +type + Pfpos_t = ^fpos_t; + fpos_t = _G_fpos_t; + + Pfpos64_t = ^fpos64_t; + fpos64_t = _G_fpos64_t; + + PFILE = P_IO_FILE; + +const + _IOFBF = 0; + _IOLBF = 1; + _IONBF = 2; + + BUFSIZ = _IO_BUFSIZ; + + +const + P_tmpdir = '/tmp'; + +function remove(__filename:Pchar):longint;cdecl;external clib name 'remove'; +function __rename(__old:Pchar; __new:Pchar):longint;cdecl;external clib name 'rename'; + +function tmpfile:PFILE;cdecl;external clib name 'tmpfile'; +function tmpfile64:PFILE;cdecl;external clib name 'tmpfile64'; + +function tmpnam(__s:Pchar):Pchar;cdecl;external clib name 'tmpnam'; +function tmpnam_r(__s:Pchar):Pchar;cdecl;external clib name 'tmpnam_r'; +function tempnam(dir,pfx: PChar): PChar; cdecl; external clib name 'tempnam'; + +function fclose(__stream:PFILE):longint;cdecl;external clib name 'fclose'; +function fflush(__stream:PFILE):longint;cdecl;external clib name 'fflush'; +function fflush_unlocked(__stream:PFILE):longint;cdecl;external clib name 'fflush_unlocked'; +function fcloseall:longint;cdecl;external clib name 'fcloseall'; + +function fopen(__filename:Pchar; __modes:Pchar):PFILE;cdecl;external clib name 'fopen'; +function freopen(__filename:Pchar; __modes:Pchar; __stream:PFILE):PFILE;cdecl;external clib name 'freopen'; + +function fopen64(__filename:Pchar; __modes:Pchar):PFILE;cdecl;external clib name 'fopen64'; +function freopen64(__filename:Pchar; __modes:Pchar; __stream:PFILE):PFILE;cdecl;external clib name 'freopen64'; + +function fdopen(__fd:longint; __modes:Pchar):PFILE;cdecl;external clib name 'fdopen'; + +function fopencookie(__magic_cookie:pointer; __modes:Pchar; __io_funcs:_IO_cookie_io_functions_t):PFILE;cdecl;external clib name 'fopencookie'; +function fmemopen(__s:pointer; __len:size_t; __modes:Pchar):PFILE;cdecl;external clib name 'fmemopen'; +function open_memstream(__bufloc:PPchar; __sizeloc:Psize_t):PFILE;cdecl;external clib name 'open_memstream'; + +procedure setbuf(__stream:PFILE; __buf:Pchar);cdecl;external clib name 'setbuf'; +function setvbuf(__stream:PFILE; __buf:Pchar; __modes:longint; __n:size_t):longint;cdecl;external clib name 'setvbuf'; + +procedure setbuffer(__stream:PFILE; __buf:Pchar; __size:size_t);cdecl;external clib name 'setbuffer'; +procedure setlinebuf(__stream:PFILE);cdecl;external clib name 'setlinebuf'; + +function fprintf(__stream:PFILE; __format:Pchar; args:array of const):longint;cdecl;external clib name 'fprintf'; +function fprintf(__stream:PFILE; __format:Pchar):longint;cdecl;varargs;external clib name 'fprintf'; +function printf(__format:Pchar; args:array of const):longint;cdecl;external clib name 'printf'; +function printf(__format:Pchar):longint;cdecl;varargs;external clib name 'printf'; +function sprintf(__s:Pchar; __format:Pchar; args:array of const):longint;cdecl;external clib name 'sprintf'; +function sprintf(__s:Pchar; __format:Pchar):longint;varargs;cdecl;external clib name 'sprintf'; +function vfprintf(__s:PFILE; __format:Pchar; __arg:_G_va_list):longint;cdecl;external clib name 'vfprintf'; +function vprintf(__format:Pchar; __arg:_G_va_list):longint;cdecl;external clib name 'vprintf'; +function vsprintf(__s:Pchar; __format:Pchar; __arg:_G_va_list):longint;cdecl;external clib name 'vsprintf'; + +function fscanf(__stream:PFILE; __format:Pchar; args:array of const):longint;cdecl;external clib name 'fscanf'; +function fscanf(__stream:PFILE; __format:Pchar):longint;varargs;cdecl;external clib name 'fscanf'; +function scanf(__format:Pchar; args:array of const):longint;cdecl;external clib name 'scanf'; +function scanf(__format:Pchar):longint;cdecl;varargs;external clib name 'scanf'; +function sscanf(__s:Pchar; __format:Pchar; args:array of const):longint;cdecl;external clib name 'sscanf'; +function sscanf(__s:Pchar; __format:Pchar):longint;cdecl;varargs;external clib name 'sscanf'; + +function fgetc(__stream:PFILE):longint;cdecl;external clib name 'fgetc'; +function getc(__stream:PFILE):longint;cdecl;external clib name 'getc'; +function getchar:longint;cdecl;external clib name 'getchar'; + + +function getc_unlocked(__stream:PFILE):longint;cdecl;external clib name 'getc_unlocked'; +function getchar_unlocked:longint;cdecl;external clib name 'getchar_unlocked'; + +function fputc(__c:longint; __stream:PFILE):longint;cdecl;external clib name 'fputc'; +function putc(__c:longint; __stream:PFILE):longint;cdecl;external clib name 'putc'; +function putchar(__c:longint):longint;cdecl;external clib name 'putchar'; + +function fputc_unlocked(__c:longint; __stream:PFILE):longint;cdecl;external clib name 'fputc_unlocked'; +function putchar_unlocked(__c:longint):longint;cdecl;external clib name 'putchar_unlocked'; + +function getw(__stream:PFILE):longint;cdecl;external clib name 'getw'; +function putw(__w:longint; __stream:PFILE):longint;cdecl;external clib name 'putw'; + +function fgets(__s:Pchar; __n:longint; __stream:PFILE):Pchar;cdecl;external clib name 'fgets'; +function fgets_unlocked(__s:Pchar; __n:longint; __stream:PFILE):Pchar;cdecl;external clib name 'fgets_unlocked'; + +function gets(__s:Pchar):Pchar;cdecl;external clib name 'gets'; + +function __getdelim(__lineptr:PPchar; __n:Psize_t; __delimiter:longint; __stream:PFILE):_IO_ssize_t;cdecl;external clib name '__getdelim'; +function getdelim(__lineptr:PPchar; __n:Psize_t; __delimiter:longint; __stream:PFILE):_IO_ssize_t;cdecl;external clib name 'getdelim'; +function getline(__lineptr:PPchar; __n:Psize_t; __stream:PFILE):_IO_ssize_t;cdecl;external clib name 'getline'; + +function fputs(__s:Pchar; __stream:PFILE):longint;cdecl;external clib name 'fputs'; +function fputs_unlocked(__s:Pchar; __stream:PFILE):longint;cdecl;external clib name 'fputs_unlocked'; + +function puts(__s:Pchar):longint;cdecl;external clib name 'puts'; +function ungetc(__c:longint; __stream:PFILE):longint;cdecl;external clib name 'ungetc'; +function fread(__ptr:pointer; __size:size_t; __n:size_t; __stream:PFILE):size_t;cdecl;external clib name 'fread'; +function fwrite(__ptr:pointer; __size:size_t; __n:size_t; __s:PFILE):size_t;cdecl;external clib name 'fwrite'; + +function fread_unlocked(__ptr:pointer; __size:size_t; __n:size_t; __stream:PFILE):size_t;cdecl;external clib name 'fread_unlocked'; +function fwrite_unlocked(__ptr:pointer; __size:size_t; __n:size_t; __stream:PFILE):size_t;cdecl;external clib name 'fwrite_unlocked'; + +function fseek(__stream:PFILE; __off:longint; __whence:longint):longint;cdecl;external clib name 'fseek'; +function ftell(__stream:PFILE):longint;cdecl;external clib name 'ftell'; +procedure rewind(__stream:PFILE);cdecl;external clib name 'rewind'; + +function fseeko(__stream:PFILE; __off:__off_t; __whence:longint):longint;cdecl;external clib name 'fseeko'; +function ftello(__stream:PFILE):__off_t;cdecl;external clib name 'ftello'; +function fgetpos(__stream:PFILE; __pos:Pfpos_t):longint;cdecl;external clib name 'fgetpos'; +function fsetpos(__stream:PFILE; __pos:Pfpos_t):longint;cdecl;external clib name 'fsetpos'; + +function fseeko64(__stream:PFILE; __off:__off64_t; __whence:longint):longint;cdecl;external clib name 'fseeko64'; +function ftello64(__stream:PFILE):__off64_t;cdecl;external clib name 'ftello64'; +function fgetpos64(__stream:PFILE; __pos:Pfpos64_t):longint;cdecl;external clib name 'fgetpos64'; +function fsetpos64(__stream:PFILE; __pos:Pfpos64_t):longint;cdecl;external clib name 'fsetpos64'; + +procedure clearerr(__stream:PFILE);cdecl;external clib name 'clearerr'; +function feof(__stream:PFILE):longint;cdecl;external clib name 'feof'; +function ferror(__stream:PFILE):longint;cdecl;external clib name 'ferror'; + +procedure clearerr_unlocked(__stream:PFILE);cdecl;external clib name 'clearerr_unlocked'; +function feof_unlocked(__stream:PFILE):longint;cdecl;external clib name 'feof_unlocked'; +function ferror_unlocked(__stream:PFILE):longint;cdecl;external clib name 'ferror_unlocked'; + +procedure perror(__s:Pchar);cdecl;external clib name 'perror'; + +function fileno_unlocked(__stream:PFILE):longint;cdecl;external clib name 'fileno_unlocked'; + +function popen(__command:PChar; __type:Pchar):PFILE;cdecl;external clib name 'popen'; +function pclose(__stream:PFILE):longint;cdecl;external clib name 'pclose'; +function ctermid(__s:Pchar):Pchar;cdecl;external clib name 'ctermid'; +function cuserid(__s:Pchar):Pchar;cdecl;external clib name 'cuserid'; + +type + Pobstack = ^obstack; + obstack = record + {undefined structure} + end; + +function obstack_printf(__obstack:Pobstack; __format:Pchar; args:array of const):longint;cdecl;external clib name 'obstack_printf'; +function obstack_printf(__obstack:Pobstack; __format:Pchar):longint;varargs;cdecl;external clib name 'obstack_printf'; +function obstack_vprintf(__obstack:Pobstack; __format:Pchar; __args:_G_va_list):longint;cdecl;external clib name 'obstack_vprintf'; + +procedure flockfile(__stream:PFILE);cdecl;external clib name 'flockfile'; +function ftrylockfile(__stream:PFILE):longint;cdecl;external clib name 'ftrylockfile'; +procedure funlockfile(__stream:PFILE);cdecl;external clib name 'funlockfile'; + + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/stdlib.inc b/jcl/source/fpc/libclite/stdlib.inc new file mode 100644 index 0000000000..0573627b3b --- /dev/null +++ b/jcl/source/fpc/libclite/stdlib.inc @@ -0,0 +1,6 @@ +function MB_CUR_MAX : longint; + { return type might be wrong } + begin + MB_CUR_MAX:=__ctype_get_mb_cur_max; + end; + diff --git a/jcl/source/fpc/libclite/stdlibh.inc b/jcl/source/fpc/libclite/stdlibh.inc new file mode 100644 index 0000000000..557e98cdb7 --- /dev/null +++ b/jcl/source/fpc/libclite/stdlibh.inc @@ -0,0 +1,210 @@ + +type + + Pdiv_t = ^div_t; + div_t = record + quot : longint; + rem : longint; + end; + + Pldiv_t = ^ldiv_t; + ldiv_t = record + quot : longint; + rem : longint; + end; + + Plldiv_t = ^lldiv_t; + lldiv_t = record + quot : int64; + rem : int64; + end; + +const + RAND_MAX = 2147483647; + EXIT_FAILURE = 1; + EXIT_SUCCESS = 0; + +function MB_CUR_MAX : size_t;cdecl; external clib name '__ctype_get_mb_cur_max'; +function __ctype_get_mb_cur_max:size_t;cdecl;external clib name '__ctype_get_mb_cur_max'; +function atof(__nptr:Pchar):double;cdecl;external clib name 'atof'; +function atoi(__nptr:Pchar):longint;cdecl;external clib name 'atoi'; +function atol(__nptr:Pchar):longint;cdecl;external clib name 'atol'; +function atoll(__nptr:Pchar):int64;cdecl;external clib name 'atoll'; +function strtod(__nptr:Pchar; __endptr:PPchar):double;cdecl;external clib name 'strtod'; +function strtof(__nptr:Pchar; __endptr:PPchar):double;cdecl;external clib name 'strtof'; +function strtold(NumPtr: PChar; EndPtr: PPChar): Extended; cdecl; external clib name 'strtold'; +function strtol(__nptr:Pchar; __endptr:PPchar; __base:longint):longint;cdecl;external clib name 'strtol'; +function strtoul(__nptr:Pchar; __endptr:PPchar; __base:longint):dword;cdecl;external clib name 'strtoul'; +function strtoq(__nptr:Pchar; __endptr:PPchar; __base:longint):int64;cdecl;external clib name 'strtoq'; +function strtouq(__nptr:Pchar; __endptr:PPchar; __base:longint):qword;cdecl;external clib name 'strtouq'; +function strtoll(__nptr:Pchar; __endptr:PPchar; __base:longint):int64;cdecl;external clib name 'strtoll'; +function strtoull(__nptr:Pchar; __endptr:PPchar; __base:longint):qword;cdecl;external clib name 'strtoull'; +function __strtol_l(__nptr:Pchar; __endptr:PPchar; __base:longint; __loc:__locale_t):longint;cdecl;external clib name '__strtol_l'; +function __strtoul_l(__nptr:Pchar; __endptr:PPchar; __base:longint; __loc:__locale_t):dword;cdecl;external clib name '__strtoul_l'; +function __strtoll_l(__nptr:Pchar; __endptr:PPchar; __base:longint; __loc:__locale_t):int64;cdecl;external clib name '__strtoll_l'; +function __strtoull_l(__nptr:Pchar; __endptr:PPchar; __base:longint; __loc:__locale_t):qword;cdecl;external clib name '__strtoull_l'; +function __strtod_l(__nptr:Pchar; __endptr:PPchar; __loc:__locale_t):double;cdecl;external clib name '__strtod_l'; +function __strtof_l(__nptr:Pchar; __endptr:PPchar; __loc:__locale_t):double;cdecl;external clib name '__strtof_l'; +function __strtold_l(__nptr: PChar; __endptr: PPChar;__loc: __locale_t): Extended; cdecl;external clib name '__strtold_l'; +function __strtod_internal(__nptr:Pchar; __endptr:PPchar; __group:longint):double;cdecl;external clib name '__strtod_internal'; +function __strtof_internal(__nptr:Pchar; __endptr:PPchar; __group:longint):double;cdecl;external clib name '__strtof_internal'; +function __strtold_internal(__nptr: PChar; __endptr: PPChar; __group: longint): Extended; cdecl;external clib name '__strtold_internal'; +function __strtol_internal(__nptr:Pchar; __endptr:PPchar; __base:longint; __group:longint):longint;cdecl;external clib name '__strtol_internal'; +function __strtoul_internal(__nptr:Pchar; __endptr:PPchar; __base:longint; __group:longint):dword;cdecl;external clib name '__strtoul_internal'; +function __strtoll_internal(__nptr:Pchar; __endptr:PPchar; __base:longint; __group:longint):int64;cdecl;external clib name '__strtoll_internal'; +function __strtoull_internal(__nptr:Pchar; __endptr:PPchar; __base:longint; __group:longint):qword;cdecl;external clib name '__strtoull_internal'; +function a64l(__s:Pchar):longint;cdecl;external clib name 'a64l'; +function l64a(N: longint): PChar; cdecl;external clib name 'l64a'; + +function __random:longint;cdecl;external clib name 'random'; +procedure srandom(__seed:dword);cdecl;external clib name 'srandom'; +function initstate(__seed:dword; __statebuf:Pchar; __statelen:size_t):Pchar;cdecl;external clib name 'initstate'; +function setstate(__statebuf:Pchar):Pchar;cdecl;external clib name 'setstate'; + +Type + Prandom_data = ^random_data; + random_data = record + fptr : Pint32_t; + rptr : Pint32_t; + state : Pint32_t; + rand_type : longint; + rand_deg : longint; + rand_sep : longint; + end_ptr : Pint32_t; + end; + + +function random_r(__buf:Prandom_data; __result:Pint32_t):longint;cdecl;external clib name 'random_r'; +function srandom_r(__seed:dword; __buf:Prandom_data):longint;cdecl;external clib name 'srandom_r'; +function initstate_r(__seed:dword; __statebuf:Pchar; __statelen:size_t; __buf:Prandom_data):longint;cdecl;external clib name 'initstate_r'; +function setstate_r(__statebuf:Pchar; __buf:Prandom_data):longint;cdecl;external clib name 'setstate_r'; +function rand:longint;cdecl;external clib name 'rand'; +procedure srand(__seed:dword);cdecl;external clib name 'srand'; +function rand_r(__seed:Pdword):longint;cdecl;external clib name 'rand_r'; +function drand48:double;cdecl;external clib name 'drand48'; + +Type + TRandWordArray = Array[0..2] of word; + +function erand48(var __xsubi: trandwordarray):double;cdecl;external clib name 'erand48'; +function lrand48:longint;cdecl;external clib name 'lrand48'; +function nrand48(var __xsubi: trandwordarray):longint;cdecl;external clib name 'nrand48'; +function mrand48:longint;cdecl;external clib name 'mrand48'; +function jrand48(var __xsubi:trandwordarray):longint;cdecl;external clib name 'jrand48'; +procedure srand48(__seedval:longint);cdecl;external clib name 'srand48'; +function seed48(var __seed16v:trandwordarray):Pword;cdecl;external clib name 'seed48'; +procedure lcong48(var __param:trandwordarray);cdecl;external clib name 'lcong48'; + +type + Pdrand48_data = ^drand48_data; + drand48_data = record + __x : array[0..2] of word; + __old_x : array[0..2] of word; + __c : word; + __init : word; + __a : qword; + end; + +function drand48_r(__buffer:Pdrand48_data; __result:Pdouble):longint;cdecl;external clib name 'drand48_r'; +function erand48_r(var __xsubi: TRandWordArray; __buffer:Pdrand48_data; __result:Pdouble):longint;cdecl;external clib name 'erand48_r'; +function lrand48_r(__buffer:Pdrand48_data; __result:Plongint):longint;cdecl;external clib name 'lrand48_r'; +function nrand48_r(var __xsubi: TRandWordArray; __buffer:Pdrand48_data; __result:Plongint):longint;cdecl;external clib name 'nrand48_r'; +function mrand48_r(__buffer:Pdrand48_data; __result:Plongint):longint;cdecl;external clib name 'mrand48_r'; +function jrand48_r(var __xsubi: TRandWordArray; __buffer:Pdrand48_data; __result:Plongint):longint;cdecl;external clib name 'jrand48_r'; +function srand48_r(__seedval:longint; __buffer:Pdrand48_data):longint;cdecl;external clib name 'srand48_r'; +function seed48_r(var __seed16v: TRandWordArray; __buffer:Pdrand48_data):longint;cdecl;external clib name 'seed48_r'; +function lcong48_r(__param: pword; __buffer:Pdrand48_data):longint;cdecl;external clib name 'lcong48_r'; + +procedure __abort; cdecl; external clib name 'abort'; + +type + TAtExitProc = procedure; cdecl; + TOnExitProc = procedure(status: longint; arg: Pointer); cdecl; + +function atexit(__func:TAtExitProc):longint;cdecl;external clib name 'atexit'; +function on_exit(__func:TOnExitProc; __arg:pointer):longint;cdecl;external clib name 'on_exit'; +procedure __exit(Status: longint); cdecl;external clib name 'exit'; +//procedure _Exit (__status : longint);cdecl; external clib name '_exit'; + +function getenv(__name:Pchar):Pchar;cdecl;external clib name 'getenv'; +function __secure_getenv(__name:Pchar):Pchar;cdecl;external clib name '__secure_getenv'; +function putenv(__string:Pchar):longint;cdecl;external clib name 'putenv'; +function setenv(__name:Pchar; __value:Pchar; __replace:longint):longint;cdecl;external clib name 'setenv'; +function unsetenv(__name:Pchar):longint;cdecl;external clib name 'unsetenv'; +function clearenv:longint;cdecl;external clib name 'clearenv'; +function mktemp(__template:Pchar):Pchar;cdecl;external clib name 'mktemp'; +function mkstemp(__template:Pchar):longint;cdecl;external clib name 'mkstemp'; +function mkstemp64(__template:Pchar):longint;cdecl;external clib name 'mkstemp64'; +function mkdtemp(__template:Pchar):Pchar;cdecl;external clib name 'mkdtemp'; +// **************** detect whether system symbol is hidden. Should be as of 1.9.4 +// **************** End of detect +function __system(__command:Pchar):longint;cdecl;external clib name 'system'; +function system(__command:Pchar):longint;cdecl;external clib name 'system'; +function canonicalize_file_name(__name:Pchar):Pchar;cdecl;external clib name 'canonicalize_file_name'; +function realpath(__name:Pchar; __resolved:Pchar):Pchar;cdecl;external clib name 'realpath'; + +Type + __compar_fn_t = function (_para1:pointer; _para2:pointer):longint;cdecl; + comparison_fn_t = __compar_fn_t; + +function bsearch(__key:pointer; __base:pointer; __nmemb:size_t; __size:size_t; __compar:__compar_fn_t):pointer;cdecl;external clib name 'bsearch'; +procedure qsort(__base:pointer; __nmemb:size_t; __size:size_t; __compar:__compar_fn_t);cdecl;external clib name 'qsort'; + +function __abs(X: longint): longint; cdecl;external clib name 'abs'; +function labs(X: Longint): Longint; cdecl;external clib name 'labs'; +function llabs(X: Int64): Int64; cdecl;external clib name 'llabs'; +function __div(Numer: longint; Denom: longint): div_t; cdecl;external clib name 'div'; +function ldiv(Numer: Longint; Denom: Longint): ldiv_t; cdecl;external clib name 'ldiv'; +function lldiv(Numer: Int64; Denom: Int64): lldiv_t; cdecl;external clib name 'lldiv'; + +function ecvt(__value:double; __ndigit:longint; __decpt:Plongint; __sign:Plongint):Pchar;cdecl;external clib name 'ecvt'; +function fcvt(__value:double; __ndigit:longint; __decpt:Plongint; __sign:Plongint):Pchar;cdecl;external clib name 'fcvt'; +function gcvt(__value:double; __ndigit:longint; __buf:Pchar):Pchar;cdecl;external clib name 'gcvt'; +function qecvt(__value: extended; __ndigit: longint; __decpt: Plongint; __sign: plongint): PChar; cdecl;external clib name 'qecvt'; +function qfcvt(__value: extended; __ndigit: longint; __decpt: plongint; __sign: plongint): PChar; cdecl;external clib name 'qfcvt'; +function qgcvt(__value: extended; __ndigit: longint; __buf: PChar): PChar; cdecl;external clib name 'qgcvt'; + +function ecvt_r(__value:double; __ndigit:longint; __decpt:Plongint; __sign:Plongint; __buf:Pchar; __len:size_t):longint;cdecl;external clib name 'ecvt_r'; +function fcvt_r(__value:double; __ndigit:longint; __decpt:Plongint; __sign:Plongint; __buf:Pchar; __len:size_t):longint;cdecl;external clib name 'fcvt_r'; +function qecvt_r(Value: Extended; __ndigit: longint; __decpt: Plongint; __sign: plongint; Buf: PChar; Len: size_t): longint; cdecl;external clib name 'qecvt_r'; +function qfcvt_r(Value: Extended; __ndigit: longint; __decpt: plongint; __sign: plongint; Buf: PChar; Len: size_t): longint; cdecl;external clib name 'qfcvt_r'; + +function mblen(__s:Pchar; __n:size_t):longint;cdecl;external clib name 'mblen'; +function mbtowc(__pwc:Pwchar_t; __s:Pchar; __n:size_t):longint;cdecl;external clib name 'mbtowc'; +function wctomb(__s:Pchar; __wchar:wchar_t):longint;cdecl;external clib name 'wctomb'; +function mbstowcs(__pwcs:Pwchar_t; __s:Pchar; __n:size_t):size_t;cdecl;external clib name 'mbstowcs'; +function wcstombs(__s:Pchar; __pwcs:Pwchar_t; __n:size_t):size_t;cdecl;external clib name 'wcstombs'; +function rpmatch(__response:Pchar):longint;cdecl;external clib name 'rpmatch'; +function getsubopt(__optionp:PPchar; __tokens:PPchar; __valuep:PPchar):longint;cdecl;external clib name 'getsubopt'; +procedure setkey(__key:Pchar);cdecl;external clib name 'setkey'; +function posix_openpt(__oflag:longint):longint;cdecl;external clib name 'posix_openpt'; +function grantpt(__fd:longint):longint;cdecl;external clib name 'grantpt'; +function unlockpt(__fd:longint):longint;cdecl;external clib name 'unlockpt'; +function ptsname(__fd:longint):Pchar;cdecl;external clib name 'ptsname'; +function ptsname_r(__fd:longint; __buf:Pchar; __buflen:size_t):longint;cdecl;external clib name 'ptsname_r'; +function getpt:longint;cdecl;external clib name 'getpt'; +function getloadavg(__loadavg:array of double; __nelem:longint):longint;cdecl;external clib name 'getloadavg'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TRandomData = random_data; + PRandomData = ^TRandomData; + + TDrand48Data = drand48_data; + PDrand48Data = ^TDrand48Data; + +function erand48(__xsubi: pword):double;cdecl;external clib name 'erand48'; +function nrand48(__xsubi: pword):longint;cdecl;external clib name 'nrand48'; +function jrand48(__xsubi: pword):longint;cdecl;external clib name 'jrand48'; +function seed48(__seed16v: pword):Pword;cdecl;external clib name 'seed48'; +procedure lcong48(__param: pword);cdecl;external clib name 'lcong48'; + +function erand48_r(__xsubi:pword; __buffer:Pdrand48_data; __result:Pdouble):longint;cdecl;external clib name 'erand48_r'; +function nrand48_r(__xsubi:pword; __buffer:Pdrand48_data; __result:Plongint):longint;cdecl;external clib name 'nrand48_r'; +function jrand48_r(__xsubi:pword; __buffer:Pdrand48_data; __result:Plongint):longint;cdecl;external clib name 'jrand48_r'; +function seed48_r(__seed16v:pword; __buffer:Pdrand48_data):longint;cdecl;external clib name 'seed48_r'; + diff --git a/jcl/source/fpc/libclite/stime.inc b/jcl/source/fpc/libclite/stime.inc new file mode 100644 index 0000000000..22e690ba3f --- /dev/null +++ b/jcl/source/fpc/libclite/stime.inc @@ -0,0 +1,79 @@ +{ --------------------------------------------------------------------- + Macros from sys/time.h + ---------------------------------------------------------------------} + + +Procedure TIMEVAL_TO_TIMESPEC(const tv: TTimeVal; var ts: TTimeSpec); +begin + ts.tv_sec:=tv.tv_sec; + ts.tv_nsec:=tv.tv_usec*1000; +end; + + +Procedure TIMESPEC_TO_TIMEVAL(var tv: TTimeVal; const ts: TTimeSpec); +begin + tv.tv_sec:=ts.tv_sec; + tv.tv_usec:=ts.tv_nsec div 1000; +end; + + +Function timerisset(const Value: TTimeVal): Boolean; +begin + Result:=(Value.tv_sec<>0) or (Value.tv_usec<>0); +end; + + +Procedure timerclear(var Value: TTimeVal); +begin + Value.tv_sec:=0; + Value.tv_usec:=0; +end; + + +Function __timercmp(const a, b: TTimeVal): Integer; + +begin + if a.tv_sec=b.tv_sec then + begin + if a.tv_usec>b.tv_usec then + Result:=1 + else if a.tv_usecb.tv_sec then + Result:=1 + else + Result:=-1; + end; +end; + + +Function timeradd(const a, b: TTimeVal): TTimeVal; + +begin + Result.tv_sec:=a.tv_sec+b.tv_sec; + Result.tv_usec:=a.tv_usec+b.tv_usec; + if Result.tv_usec>=1000000 then + begin + Inc(Result.tv_sec); + Dec(Result.tv_usec, 1000000); + end; +end; + + +Function timersub(const a, b: TTimeVal): TTimeVal; + +begin + Result.tv_sec:=a.tv_sec-b.tv_sec; + Result.tv_usec:=a.tv_usec-b.tv_usec; + if Result.tv_usec<0 then + begin + Dec(Result.tv_sec); + Inc(Result.tv_usec,1000000); + end; +end; + diff --git a/jcl/source/fpc/libclite/stimebh.inc b/jcl/source/fpc/libclite/stimebh.inc new file mode 100644 index 0000000000..7c8336fce3 --- /dev/null +++ b/jcl/source/fpc/libclite/stimebh.inc @@ -0,0 +1,19 @@ + +type + Ptimeb = ^timeb; + timeb = record + time : time_t; + millitm : word; + timezone : smallint; + dstflag : smallint; + end; + + +function ftime(__timebuf:Ptimeb):longint;cdecl;external clib name 'ftime'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function ftime(var __timebuf:timeb):longint;cdecl;external clib name 'ftime'; diff --git a/jcl/source/fpc/libclite/stimeh.inc b/jcl/source/fpc/libclite/stimeh.inc new file mode 100644 index 0000000000..489c4010cc --- /dev/null +++ b/jcl/source/fpc/libclite/stimeh.inc @@ -0,0 +1,80 @@ + +// Macros, translated. + +procedure TIMEVAL_TO_TIMESPEC(const tv: TTimeVal; var ts: TTimeSpec); +procedure TIMESPEC_TO_TIMEVAL(var tv: TTimeVal; const ts: TTimeSpec); + +var + tz_dsttime : longint;cvar;public; + +Type + timezone = record + tz_minuteswest: Integer; + tz_dsttime: Integer; + end; + ptimezone = ^timezone; + + P__timezone_ptr_t = ^__timezone_ptr_t; + __timezone_ptr_t = ^timezone; + +function gettimeofday(__tv:Ptimeval; __tz:__timezone_ptr_t):longint;cdecl;external clib name 'gettimeofday'; +function settimeofday(__tv:Ptimeval; __tz:Ptimezone):longint;cdecl;external clib name 'settimeofday'; +function adjtime(__delta:Ptimeval; __olddelta:Ptimeval):longint;cdecl;external clib name 'adjtime'; + +Type + __itimer_which = ( + ITIMER_REAL := 0, + ITIMER_VIRTUAL := 1, + ITIMER_PROF := 2 + ); + + Pitimerval = ^itimerval; + itimerval = record + it_interval : timeval; + it_value : timeval; + end; + + P__itimer_which_t = ^__itimer_which_t; + __itimer_which_t = __itimer_which; + + + +function getitimer(__which:__itimer_which_t; __value:Pitimerval):longint;cdecl;external clib name 'getitimer'; +function setitimer(__which:__itimer_which_t; __new:Pitimerval; __old:Pitimerval):longint;cdecl;external clib name 'setitimer'; +function utimes(__file:Pchar; __tvp: Ptimeval):longint;cdecl;external clib name 'utimes'; + +// Macros, translated. + +function timerisset(const Value: TTimeVal): Boolean; +procedure timerclear(var Value: TTimeVal); +function __timercmp(const a, b: TTimeVal): Integer; +function timeradd(const a, b: TTimeVal): TTimeVal; +function timersub(const a, b: TTimeVal): TTimeVal; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +type + TTimeZone = timezone; + + TAccessModificationTimes = record + AccessTime: TTimeVal; + ModificationTime: TTimeVal; + end; + PAccessModificationTimes = ^TAccessModificationTimes; + + TIntervalTimerValue = itimerval; + PIntervalTimerValue = ^TIntervalTimerValue; + + +function utimes(__file: PChar; const AccessModTimes: TAccessModificationTimes):longint;cdecl;external clib name 'utimes'; +function gettimeofday(var __tv:timeval; __tz:__timezone_ptr_t):longint;cdecl;external clib name 'gettimeofday'; +function gettimeofday(var __tv:timeval; var _tz:timezone):longint;cdecl;external clib name 'gettimeofday'; +function settimeofday(const __tv: timeval; __tz:Ptimezone):longint;cdecl;external clib name 'settimeofday'; +function settimeofday(const __tv: timeval; const __tz:timezone):longint;cdecl;external clib name 'settimeofday'; +function adjtime(const __delta: timeval; var __olddelta:timeval):longint;cdecl;external clib name 'adjtime'; +function adjtime(const __delta: timeval; __olddelta:ptimeval):longint;cdecl;external clib name 'adjtime'; + + diff --git a/jcl/source/fpc/libclite/stringh.inc b/jcl/source/fpc/libclite/stringh.inc new file mode 100644 index 0000000000..e42a3c628d --- /dev/null +++ b/jcl/source/fpc/libclite/stringh.inc @@ -0,0 +1,68 @@ + + +function memcpy(__dest:pointer; __src:pointer; __n:size_t):pointer;cdecl;external clib name 'memcpy'; +function memmove(__dest:pointer; __src:pointer; __n:size_t):pointer;cdecl;external clib name 'memmove'; +function memccpy(__dest:pointer; __src:pointer; __c:longint; __n:size_t):pointer;cdecl;external clib name 'memccpy'; +function memset(__s:pointer; __c:longint; __n:size_t):pointer;cdecl;external clib name 'memset'; +function memcmp(__s1:pointer; __s2:pointer; __n:size_t):longint;cdecl;external clib name 'memcmp'; +function memchr(__s:pointer; __c:longint; __n:size_t):pointer;cdecl;external clib name 'memchr'; +function rawmemchr(__s:pointer; __c:longint):pointer;cdecl;external clib name 'rawmemchr'; +function memrchr(__s:pointer; __c:longint; __n:size_t):pointer;cdecl;external clib name 'memrchr'; +function strcpy(__dest:Pchar; __src:Pchar):Pchar;cdecl;external clib name 'strcpy'; +function strncpy(__dest:Pchar; __src:Pchar; __n:size_t):Pchar;cdecl;external clib name 'strncpy'; +function __strcat(__dest:Pchar; __src:Pchar):Pchar;cdecl;external clib name 'strcat'; +function strncat(__dest:Pchar; __src:Pchar; __n:size_t):Pchar;cdecl;external clib name 'strncat'; +function strcmp(__s1:Pchar; __s2:Pchar):longint;cdecl;external clib name 'strcmp'; +function strncmp(__s1:Pchar; __s2:Pchar; __n:size_t):longint;cdecl;external clib name 'strncmp'; +function strcoll(__s1:Pchar; __s2:Pchar):longint;cdecl;external clib name 'strcoll'; +function strxfrm(__dest:Pchar; __src:Pchar; __n:size_t):size_t;cdecl;external clib name 'strxfrm'; +function __strcoll_l(__s1:Pchar; __s2:Pchar; __l:__locale_t):longint;cdecl;external clib name '__strcoll_l'; +function __strxfrm_l(__dest:Pchar; __src:Pchar; __n:size_t; __l:__locale_t):size_t;cdecl;external clib name '__strxfrm_l'; +function strdup(const S: PChar): PChar; cdecl;external clib name 'strdup'; +function strndup(const S: PChar; N: size_t): PChar; cdecl; external clib name 'strndup'; +function strrchr(__s:Pchar; __c:longint):Pchar;cdecl;external clib name 'strrchr'; +function strchrnul(__s:Pchar; __c:longint):Pchar;cdecl;external clib name 'strchrnul'; +function strcspn(__s:Pchar; __reject:Pchar):size_t;cdecl;external clib name 'strcspn'; +function strspn(__s:Pchar; __accept:Pchar):size_t;cdecl;external clib name 'strspn'; +function strpbrk(__s:Pchar; __accept:Pchar):Pchar;cdecl;external clib name 'strpbrk'; +function strstr(__haystack:Pchar; __needle:Pchar):Pchar;cdecl;external clib name 'strstr'; +function strcasestr(__haystack:Pchar; __needle:Pchar):Pchar;cdecl;external clib name 'strcasestr'; +function strtok(__s:Pchar; __delim:Pchar):Pchar;cdecl;external clib name 'strtok'; +function __strtok_r(__s:Pchar; __delim:Pchar; __save_ptr:PPchar):Pchar;cdecl;external clib name '__strtok_r'; +function strtok_r(__s:Pchar; __delim:Pchar; __save_ptr:PPchar):Pchar;cdecl;external clib name 'strtok_r'; +function memmem(__haystack:pointer; __haystacklen:size_t; __needle:pointer; __needlelen:size_t):pointer;cdecl;external clib name 'memmem'; +function __mempcpy(__dest:pointer; __src:pointer; __n:size_t):pointer;cdecl;external clib name '__mempcpy'; +function mempcpy(__dest:pointer; __src:pointer; __n:size_t):pointer;cdecl;external clib name 'mempcpy'; +function __strlen(__s:Pchar):size_t;cdecl;external clib name 'strlen'; +function strnlen(__string:Pchar; __maxlen:size_t):size_t;cdecl;external clib name 'strnlen'; +function strerror(__errnum:longint):Pchar;cdecl;external clib name 'strerror'; +function strerror_r(__errnum:longint; __buf:Pchar; __buflen:size_t):Pchar;cdecl;external clib name 'strerror_r'; +procedure __bzero(__s:pointer; __n:size_t);cdecl;external clib name '__bzero'; +procedure bcopy(__src:pointer; __dest:pointer; __n:size_t);cdecl;external clib name 'bcopy'; +procedure bzero(__s:pointer; __n:size_t);cdecl;external clib name 'bzero'; +function bcmp(__s1:pointer; __s2:pointer; __n:size_t):longint;cdecl;external clib name 'bcmp'; +function __index(__s:Pchar; __c:longint):Pchar;cdecl;external clib name 'index'; +function rindex(__s:Pchar; __c:longint):Pchar;cdecl;external clib name 'rindex'; +function ffs(I: Integer): Integer; cdecl; external clib name 'ffs'; +function ffsl(L: Integer): Integer; cdecl; external clib name 'ffsl'; +function ffsll(LL: Int64): Integer; cdecl; external clib name 'ffsll'; +function strcasecmp(__s1:Pchar; __s2:Pchar):longint;cdecl;external clib name 'strcasecmp'; +function strncasecmp(__s1:Pchar; __s2:Pchar; __n:size_t):longint;cdecl;external clib name 'strncasecmp'; +function __strcasecmp_l(__s1:Pchar; __s2:Pchar; __loc:__locale_t):longint;cdecl;external clib name '__strcasecmp_l'; +function __strncasecmp_l(__s1:Pchar; __s2:Pchar; __n:size_t; __loc:__locale_t):longint;cdecl;external clib name '__strncasecmp_l'; +function strsep(__stringp:PPchar; __delim:Pchar):Pchar;cdecl;external clib name 'strsep'; +function strverscmp(__s1:Pchar; __s2:Pchar):longint;cdecl;external clib name 'strverscmp'; +function strsignal(__sig:longint):Pchar;cdecl;external clib name 'strsignal'; +function __stpcpy(__dest:Pchar; __src:Pchar):Pchar;cdecl;external clib name '__stpcpy'; +function stpcpy(__dest:Pchar; __src:Pchar):Pchar;cdecl;external clib name 'stpcpy'; +function __stpncpy(__dest:Pchar; __src:Pchar; __n:size_t):Pchar;cdecl;external clib name '__stpncpy'; +function stpncpy(__dest:Pchar; __src:Pchar; __n:size_t):Pchar;cdecl;external clib name 'stpncpy'; +function strfry(__string:Pchar):Pchar;cdecl;external clib name 'strfry'; +function memfrob(__s:pointer; __n:size_t):pointer;cdecl;external clib name 'memfrob'; +function basename(__filename:Pchar):Pchar;cdecl;external clib name 'basename'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/stroptsh.inc b/jcl/source/fpc/libclite/stroptsh.inc new file mode 100644 index 0000000000..0d217c0297 --- /dev/null +++ b/jcl/source/fpc/libclite/stroptsh.inc @@ -0,0 +1,14 @@ + +function isastream(__fildes:longint):longint;cdecl;external clib name 'isastream'; +function getmsg(__fildes:longint; __ctlptr:Pstrbuf; __dataptr:Pstrbuf; __flagsp:Plongint):longint;cdecl;external clib name 'getmsg'; +function getpmsg(__fildes:longint; __ctlptr:Pstrbuf; __dataptr:Pstrbuf; __bandp:Plongint; __flagsp:Plongint):longint;cdecl;external clib name 'getpmsg'; +function putmsg(__fildes:longint; __ctlptr:Pstrbuf; __dataptr:Pstrbuf; __flags:longint):longint;cdecl;external clib name 'putmsg'; +function putpmsg(__fildes:longint; __ctlptr:Pstrbuf; __dataptr:Pstrbuf; __band:longint; __flags:longint):longint;cdecl;external clib name 'putpmsg'; +function fattach(__fildes:longint; __path:Pchar):longint;cdecl;external clib name 'fattach'; +function fdetach(__path:Pchar):longint;cdecl;external clib name 'fdetach'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sttydefaults.inc b/jcl/source/fpc/libclite/sttydefaults.inc new file mode 100644 index 0000000000..327f69744d --- /dev/null +++ b/jcl/source/fpc/libclite/sttydefaults.inc @@ -0,0 +1,5 @@ + +function CTRL(x: Char): Char; +begin + Result:=Char(Ord(x) and $1F); +end; diff --git a/jcl/source/fpc/libclite/sttydefaultsh.inc b/jcl/source/fpc/libclite/sttydefaultsh.inc new file mode 100644 index 0000000000..8370dd170d --- /dev/null +++ b/jcl/source/fpc/libclite/sttydefaultsh.inc @@ -0,0 +1,46 @@ + + +const + TTYDEF_IFLAG = ((((BRKINT or ISTRIP) or ICRNL) or IMAXBEL) or IXON) or IXANY; + TTYDEF_OFLAG = (OPOST or ONLCR) or XTABS; + TTYDEF_LFLAG = (((((ECHO or ICANON) or ISIG) or IEXTEN) or ECHOE) or ECHOKE) or ECHOCTL; + TTYDEF_CFLAG = ((CREAD or CS7) or PARENB) or HUPCL; + TTYDEF_SPEED = B9600; + +function CTRL(x : char) : char; + +Const + CEOF = Chr(Ord('d') and $1F); + CEOL = #0; { XXX avoid _POSIX_VDISABLE } + + CERASE = 0177; + CINTR = Char(Ord('c') and $1F); + + CSTATUS = #0; + CKILL = Char(Ord('u') and $1F); + + CMIN = 1; + CQUIT = 034; + + CSUSP = Char(Ord('z') and $1F); + CDSUSP = Char(Ord('y') and $1F); + CSTART = Char(Ord('q') and $1F); + CSTOP = Char(Ord('s') and $1F); + CLNEXT = Char(Ord('v') and $1F); + CDISCARD = Char(Ord('o') and $1F); + CWERASE = Char(Ord('w') and $1F); + CREPRINT = Char(Ord('r') and $1F); + CEOT = CEOF; + + CBRK = CEOL; + CRPRNT = CREPRINT; + CFLUSH = CDISCARD; + + __CTIME = #0; // renamed, ctime type conflict. + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sucontexth.inc b/jcl/source/fpc/libclite/sucontexth.inc new file mode 100644 index 0000000000..ec2802b953 --- /dev/null +++ b/jcl/source/fpc/libclite/sucontexth.inc @@ -0,0 +1,87 @@ + +Type + Pgreg_t = ^greg_t; + greg_t = longint; + +const + NGREG = 19; + +Type + Pgregset_t = ^gregset_t; + gregset_t = greg_t; + +Const + REG_GS = 0; + REG_FS = 1; + REG_ES = 2; + REG_DS = 3; + REG_EDI = 4; + REG_ESI = 5; + REG_EBP = 6; + REG_ESP = 7; + REG_EBX = 8; + REG_EDX = 9; + REG_ECX = 10; + REG_EAX = 11; + REG_TRAPNO = 12; + REG_ERR = 13; + REG_EIP = 14; + REG_CS = 15; + REG_EFL = 16; + REG_UESP = 17; + REG_SS = 18; + +type + P_libc_fpreg = ^_libc_fpreg; + _libc_fpreg = record + significand : array[0..3] of word; + exponent : word; + end; + + P_libc_fpstate = ^_libc_fpstate; + _libc_fpstate = record + cw : dword; + sw : dword; + tag : dword; + ipoff : dword; + cssel : dword; + dataoff : dword; + datasel : dword; + _st : array[0..7] of _libc_fpreg; + status : dword; + end; + + + Pfpregset_t = ^fpregset_t; + fpregset_t = _libc_fpstate; + + Pmcontext_t = ^mcontext_t; + mcontext_t = record + gregs : gregset_t; + fpregs : fpregset_t; + oldmask : dword; + cr2 : dword; + end; + + Pucontext = ^ucontext; + ucontext = record + uc_flags : dword; + uc_link : Pucontext; + uc_stack : stack_t; + uc_mcontext : mcontext_t; + uc_sigmask : __sigset_t; + __fpregs_mem : _libc_fpstate; + end; + ucontext_t = ucontext; + Pucontext_t = ^ucontext_t; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TUserContext = ucontext_t; + PUserContext = ^TUserContext; + + diff --git a/jcl/source/fpc/libclite/suioh.inc b/jcl/source/fpc/libclite/suioh.inc new file mode 100644 index 0000000000..fe63f4b5d8 --- /dev/null +++ b/jcl/source/fpc/libclite/suioh.inc @@ -0,0 +1,12 @@ + +function readv(__fd:longint; __vector:Piovec; __count:longint):ssize_t;cdecl;external clib name 'readv'; +function writev(__fd:longint; __vector:Piovec; __count:longint):ssize_t;cdecl;external clib name 'writev'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function readv(__fd:longint; var __vector: iovec; __count:longint):ssize_t;cdecl;external clib name 'readv'; +function writev(__fd:longint; var __vector: iovec; __count:longint):ssize_t;cdecl;external clib name 'writev'; diff --git a/jcl/source/fpc/libclite/sun.inc b/jcl/source/fpc/libclite/sun.inc new file mode 100644 index 0000000000..6870451e29 --- /dev/null +++ b/jcl/source/fpc/libclite/sun.inc @@ -0,0 +1,6 @@ + +function SUN_LEN(ptr: PSockAddr_un): Cardinal; + +begin + Result:=SizeOf(ptr^.sun_family)+__strlen(ptr^.sun_path); +end; diff --git a/jcl/source/fpc/libclite/sunh.inc b/jcl/source/fpc/libclite/sunh.inc new file mode 100644 index 0000000000..0588539f46 --- /dev/null +++ b/jcl/source/fpc/libclite/sunh.inc @@ -0,0 +1,17 @@ + +type + Psockaddr_un = ^sockaddr_un; + sockaddr_un = record + sun_family : sa_family_t; + sun_path : array[0..107] of char; + end; + + +Function SUN_LEN(ptr: PSockAddr_un): Cardinal; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TSockAddr_un = sockaddr_un; diff --git a/jcl/source/fpc/libclite/suserh.inc b/jcl/source/fpc/libclite/suserh.inc new file mode 100644 index 0000000000..d1faeb270d --- /dev/null +++ b/jcl/source/fpc/libclite/suserh.inc @@ -0,0 +1,87 @@ + +type + Puser_fpregs_struct = ^user_fpregs_struct; + user_fpregs_struct = record + cwd : longint; + swd : longint; + twd : longint; + fip : longint; + fcs : longint; + foo : longint; + fos : longint; + st_space : array[0..19] of longint; + end; + + Puser_fpxregs_struct = ^user_fpxregs_struct; + user_fpxregs_struct = record + cwd : word; + swd : word; + twd : word; + fop : word; + fip : longint; + fcs : longint; + foo : longint; + fos : longint; + mxcsr : longint; + reserved : longint; + st_space : array[0..31] of longint; + xmm_space : array[0..31] of longint; + padding : array[0..55] of longint; + end; + + Puser_regs_struct = ^user_regs_struct; + user_regs_struct = record + ebx : longint; + ecx : longint; + edx : longint; + esi : longint; + edi : longint; + ebp : longint; + eax : longint; + xds : longint; + xes : longint; + xfs : longint; + xgs : longint; + orig_eax : longint; + eip : longint; + xcs : longint; + eflags : longint; + esp : longint; + xss : longint; + end; + + Puser = ^user; + user = record + regs : user_regs_struct; + u_fpvalid : longint; + i387 : user_fpregs_struct; + u_tsize : dword; + u_dsize : dword; + u_ssize : dword; + start_code : dword; + start_stack : dword; + signal : longint; + reserved : longint; + u_ar0 : Puser_regs_struct; + u_fpstate : Puser_fpregs_struct; + magic : dword; + u_comm : array[0..31] of char; + u_debugreg : array[0..7] of longint; + end; + + +const + PAGE_SHIFT = 12; + PAGE_SIZE = 1 shl PAGE_SHIFT; + PAGE_MASK = not (PAGE_SIZE - 1); + NBPG = PAGE_SIZE; + UPAGES = 1; + HOST_TEXT_START_ADDR = u.start_code; + HOST_STACK_END_ADDR = (u.start_stack) + ((u.u_ssize) * NBPG); + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/sustath.inc b/jcl/source/fpc/libclite/sustath.inc new file mode 100644 index 0000000000..051f748481 --- /dev/null +++ b/jcl/source/fpc/libclite/sustath.inc @@ -0,0 +1,9 @@ + +function ustat(__dev:__dev_t; __ubuf:Pustat):longint;cdecl;external clib name 'ustat'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function ustat(__dev:__dev_t; var __ubuf:_ustat):longint;cdecl;external clib name 'ustat'; diff --git a/jcl/source/fpc/libclite/sutsnameh.inc b/jcl/source/fpc/libclite/sutsnameh.inc new file mode 100644 index 0000000000..94440b0ffa --- /dev/null +++ b/jcl/source/fpc/libclite/sutsnameh.inc @@ -0,0 +1,31 @@ + +const + _UTSNAME_NODENAME_LENGTH = _UTSNAME_LENGTH; + +type + Putsname = ^utsname; + utsname = record + sysname : array[0..(_UTSNAME_LENGTH)-1] of char; + nodename : array[0..(_UTSNAME_NODENAME_LENGTH)-1] of char; + release : array[0..(_UTSNAME_LENGTH)-1] of char; + version : array[0..(_UTSNAME_LENGTH)-1] of char; + machine : array[0..(_UTSNAME_LENGTH)-1] of char; + domainname : array[0..(_UTSNAME_DOMAIN_LENGTH)-1] of char; + __domainname : array[0..(_UTSNAME_DOMAIN_LENGTH)-1] of char; + end; + +const + SYS_NMLN = _UTSNAME_LENGTH; + +function uname(__name:Putsname):longint;cdecl;external clib name 'uname'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TUTSName = utsname; + +function uname(var __name: utsname):longint;cdecl;external clib name 'uname'; + diff --git a/jcl/source/fpc/libclite/svlimith.inc b/jcl/source/fpc/libclite/svlimith.inc new file mode 100644 index 0000000000..078791d669 --- /dev/null +++ b/jcl/source/fpc/libclite/svlimith.inc @@ -0,0 +1,22 @@ + +type + __vlimit_resource = ( + LIM_NORAISE := 0, + LIM_CPU := 1, + LIM_FSIZE := 2, + LIM_DATA := 3, + LIM_STACK := 4, + LIM_CORE := 5, + LIM_MAXRSS := 6); + +Const + VLIMIT_INFINITY = $7fffffff; + +function vlimit(__resource:__vlimit_resource; __value:longint):longint;cdecl;external clib name 'vlimit'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/svtimesh.inc b/jcl/source/fpc/libclite/svtimesh.inc new file mode 100644 index 0000000000..656a158d6f --- /dev/null +++ b/jcl/source/fpc/libclite/svtimesh.inc @@ -0,0 +1,32 @@ + +const + VTIMES_UNITS_PER_SECOND = 60; + +type + Pvtimes = ^_vtimes; + _vtimes = record + vm_utime : longint; + vm_stime : longint; + vm_idsrss : dword; + vm_ixrss : dword; + vm_maxrss : longint; + vm_majflt : longint; + vm_minflt : longint; + vm_nswap : longint; + vm_inblk : longint; + vm_oublk : longint; + end; + P_vtimes = ^_vtimes; + +function vtimes(__current:Pvtimes; __child:Pvtimes):longint;cdecl;external clib name 'vtimes'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + Tvtimes = _vtimes; + +function vtimes(var __current: _vtimes; var __child: _vtimes):longint;cdecl;external clib name 'vtimes'; +function vtimes(var __current: _vtimes; __child: pvtimes):longint;cdecl;external clib name 'vtimes'; +function vtimes( __current: pvtimes; var __child: _vtimes):longint;cdecl;external clib name 'vtimes'; diff --git a/jcl/source/fpc/libclite/swaith.inc b/jcl/source/fpc/libclite/swaith.inc new file mode 100644 index 0000000000..dc6083577e --- /dev/null +++ b/jcl/source/fpc/libclite/swaith.inc @@ -0,0 +1,34 @@ + + +type + Pidtype_t = ^idtype_t; + idtype_t = (P_ALL,P_PID,P_PGID); + +{ // used to be three constants. Why borland decided to change this is a total mystery... + Const + P_ALL = 0; + P_PID = 1; + P_PGID = 2; +} + +const + WAIT_ANY = -(1); + WAIT_MYPGRP = 0; + +function wait(__stat_loc:PLongint):__pid_t;cdecl;external clib name 'wait'; +function waitpid(__pid:__pid_t; __stat_loc:Plongint; __options:longint):__pid_t;cdecl;external clib name 'waitpid'; +function waitid(__idtype:idtype_t; __id:__id_t; __infop:Psiginfo_t; __options:longint):longint;cdecl;external clib name 'waitid'; +function wait3(__stat_loc: Plongint; __options:longint; __usage:Prusage):__pid_t;cdecl;external clib name 'wait3'; +function wait4(__pid:__pid_t; __stat_loc: Plongint; __options:longint; __usage:Prusage):__pid_t;cdecl;external clib name 'wait4'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function wait(var __stat_loc: Longint):__pid_t;cdecl;external clib name 'wait'; +function waitpid(__pid:__pid_t; var __stat_loc:longint; __options:longint):__pid_t;cdecl;external clib name 'waitpid'; +function waitid(__idtype:idtype_t; __id:__id_t; var __infop: siginfo_t; __options:longint):longint;cdecl;external clib name 'waitid'; +function wait3(var __stat_loc: longint; __options:longint; var __usage:rusage):__pid_t;cdecl;external clib name 'wait3'; +function wait4(__pid:__pid_t; var __stat_loc: longint; __options:longint; var __usage: rusage):__pid_t;cdecl;external clib name 'wait4'; diff --git a/jcl/source/fpc/libclite/sysexitsh.inc b/jcl/source/fpc/libclite/sysexitsh.inc new file mode 100644 index 0000000000..e40baba964 --- /dev/null +++ b/jcl/source/fpc/libclite/sysexitsh.inc @@ -0,0 +1,27 @@ + +const + EX_OK = 0; + EX__BASE = 64; + EX_USAGE = 64; + EX_DATAERR = 65; + EX_NOINPUT = 66; + EX_NOUSER = 67; + EX_NOHOST = 68; + EX_UNAVAILABLE = 69; + EX_SOFTWARE = 70; + EX_OSERR = 71; + EX_OSFILE = 72; + EX_CANTCREAT = 73; + EX_IOERR = 74; + EX_TEMPFAIL = 75; + EX_PROTOCOL = 76; + EX_NOPERM = 77; + EX_CONFIG = 78; + EX__MAX = 78; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/syslogh.inc b/jcl/source/fpc/libclite/syslogh.inc new file mode 100644 index 0000000000..a7c457e3c9 --- /dev/null +++ b/jcl/source/fpc/libclite/syslogh.inc @@ -0,0 +1,6 @@ + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/systypeshh.inc b/jcl/source/fpc/libclite/systypeshh.inc new file mode 100644 index 0000000000..5543322f1d --- /dev/null +++ b/jcl/source/fpc/libclite/systypeshh.inc @@ -0,0 +1,54 @@ +{ --------------------------------------------------------------------- + 'h2pas -S -c -D -l libc -i' from sys/types.h + ---------------------------------------------------------------------} + +Type + + u_char = __u_char; + u_short = __u_short; + u_int = __u_int; + u_long = __u_long; + quad_t = __quad_t; + u_quad_t = __u_quad_t; + fsid_t = __fsid_t; + loff_t = __loff_t; + ino_t = __ino_t; + ino_t = __ino64_t; + ino64_t = __ino64_t; + dev_t = __dev_t; + gid_t = __gid_t; + mode_t = __mode_t; + nlink_t = __nlink_t; + uid_t = __uid_t; + off_t = __off_t; + off64_t = __off64_t; + pid_t = __pid_t; + id_t = __id_t; + ssize_t = __ssize_t; + daddr_t = __daddr_t; + caddr_t = __caddr_t; + key_t = __key_t; + useconds_t = __useconds_t; + suseconds_t = __suseconds_t; + ulong = dword; + ushort = word; + uint = dword; + int8_t = char; + int16_t = smallint; + int32_t = longint; + u_int8_t = byte; + u_int16_t = word; + u_int32_t = dword; + register_t = longint; + blksize_t = __blksize_t; + blkcnt_t = __blkcnt_t; + fsblkcnt_t = __fsblkcnt_t; + fsfilcnt_t = __fsfilcnt_t; + blkcnt_t = __blkcnt64_t; + fsblkcnt_t = __fsblkcnt64_t; + fsfilcnt_t = __fsfilcnt64_t; + blkcnt64_t = __blkcnt64_t; + fsblkcnt64_t = __fsblkcnt64_t; + fsfilcnt64_t = __fsfilcnt64_t; + u_int64_t = QWord; + \ No newline at end of file diff --git a/jcl/source/fpc/libclite/termios.inc b/jcl/source/fpc/libclite/termios.inc new file mode 100644 index 0000000000..272cebaef2 --- /dev/null +++ b/jcl/source/fpc/libclite/termios.inc @@ -0,0 +1,5 @@ +function CCEQ(val,c : cc_t) : boolean ; +begin + CCEQ:=((c=val) and (val<>_POSIX_VDISABLE)); +end; + diff --git a/jcl/source/fpc/libclite/termiosh.inc b/jcl/source/fpc/libclite/termiosh.inc new file mode 100644 index 0000000000..e1d36be3c0 --- /dev/null +++ b/jcl/source/fpc/libclite/termiosh.inc @@ -0,0 +1,29 @@ + +function CCEQ(val,c : cc_t) : boolean; + +function cfgetospeed(__termios_p:Ptermios):speed_t;cdecl;external clib name 'cfgetospeed'; +function cfgetispeed(__termios_p:Ptermios):speed_t;cdecl;external clib name 'cfgetispeed'; +function cfsetospeed(__termios_p:Ptermios; __speed:speed_t):longint;cdecl;external clib name 'cfsetospeed'; +function cfsetispeed(__termios_p:Ptermios; __speed:speed_t):longint;cdecl;external clib name 'cfsetispeed'; +function cfsetspeed(__termios_p:Ptermios; __speed:speed_t):longint;cdecl;external clib name 'cfsetspeed'; +function tcgetattr(__fd:longint; __termios_p:Ptermios):longint;cdecl;external clib name 'tcgetattr'; +function tcsetattr(__fd:longint; __optional_actions:longint; __termios_p:Ptermios):longint;cdecl;external clib name 'tcsetattr'; +procedure cfmakeraw(__termios_p:Ptermios);cdecl;external clib name 'cfmakeraw'; +function tcsendbreak(__fd:longint; __duration:longint):longint;cdecl;external clib name 'tcsendbreak'; +function tcdrain(__fd:longint):longint;cdecl;external clib name 'tcdrain'; +function tcflush(__fd:longint; __queue_selector:longint):longint;cdecl;external clib name 'tcflush'; +function tcflow(__fd:longint; __action:longint):longint;cdecl;external clib name 'tcflow'; +function tcgetsid(__fd:longint):__pid_t;cdecl;external clib name 'tcgetsid'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +function cfgetospeed(const __termios_p: termios):speed_t;cdecl;external clib name 'cfgetospeed'; +function cfgetispeed(const __termios_p: termios):speed_t;cdecl;external clib name 'cfgetispeed'; +function cfsetospeed(var __termios_p: termios; __speed:speed_t):longint;cdecl;external clib name 'cfsetospeed'; +function cfsetispeed(var __termios_p: termios; __speed:speed_t):longint;cdecl;external clib name 'cfsetispeed'; +function cfsetspeed(var __termios_p: termios; __speed:speed_t):longint;cdecl;external clib name 'cfsetspeed'; +function tcgetattr(__fd:longint; var __termios_p: termios):longint;cdecl;external clib name 'tcgetattr'; +function tcsetattr(__fd:longint; __optional_actions:longint; const __termios_p: termios):longint;cdecl;external clib name 'tcsetattr'; +procedure cfmakeraw(var __termios_p: termios);cdecl;external clib name 'cfmakeraw'; diff --git a/jcl/source/fpc/libclite/time.inc b/jcl/source/fpc/libclite/time.inc new file mode 100644 index 0000000000..a2f1dfa356 --- /dev/null +++ b/jcl/source/fpc/libclite/time.inc @@ -0,0 +1,4 @@ +function CLK_TCK : __clock_t; + begin + CLK_TCK:=__clock_t(__sysconf(2)); + end; diff --git a/jcl/source/fpc/libclite/timeh.inc b/jcl/source/fpc/libclite/timeh.inc new file mode 100644 index 0000000000..9c5eae24d8 --- /dev/null +++ b/jcl/source/fpc/libclite/timeh.inc @@ -0,0 +1,112 @@ +type + + Pclock_t = ^clock_t; + clock_t = __clock_t; + + Ptime_t = ^time_t; + time_t = __time_t; + + Pclockid_t = ^clockid_t; + clockid_t = __clockid_t; + + Ptimer_t = ^timer_t; + timer_t = __timer_t; + +type + Ptm = ^tm; + tm = record + tm_sec : longint; + tm_min : longint; + tm_hour : longint; + tm_mday : longint; + tm_mon : longint; + tm_year : longint; + tm_wday : longint; + tm_yday : longint; + tm_isdst : longint; + case boolean of + false : (tm_gmtoff : longint;tm_zone : Pchar); + true : (__tm_gmtoff : longint;__tm_zone : Pchar); + end; + + Pitimerspec = ^itimerspec; + itimerspec = record + it_interval : timespec; + it_value : timespec; + end; + + + +var + getdate_err : longint;cvar;external; + +function clock:clock_t;cdecl;external clib name 'clock'; +function __time(__timer:Ptime_t):time_t;cdecl;external clib name 'time'; +function difftime(__time1:time_t; __time0:time_t):double;cdecl;external clib name 'difftime'; +function mktime(__tp:Ptm):time_t;cdecl;external clib name 'mktime'; +function strftime(__s:Pchar; __maxsize:size_t; __format:Pchar; __tp:Ptm):size_t;cdecl;external clib name 'strftime'; +function strptime(__s:Pchar; __fmt:Pchar; __tp:Ptm):Pchar;cdecl;external clib name 'strptime'; +function gmtime(__timer:Ptime_t):Ptm;cdecl;external clib name 'gmtime'; +function localtime(__timer:Ptime_t):Ptm;cdecl;external clib name 'localtime'; +function gmtime_r(__timer:Ptime_t; __tp:Ptm):Ptm;cdecl;external clib name 'gmtime_r'; +function localtime_r(__timer:Ptime_t; __tp:Ptm):Ptm;cdecl;external clib name 'localtime_r'; +function asctime(__tp:Ptm):Pchar;cdecl;external clib name 'asctime'; +function ctime(__timer:Ptime_t):Pchar;cdecl;external clib name 'ctime'; +function asctime_r(__tp:Ptm; __buf:Pchar):Pchar;cdecl;external clib name 'asctime_r'; +function ctime_r(__timer:Ptime_t; __buf:Pchar):Pchar;cdecl;external clib name 'ctime_r'; +procedure tzset;cdecl;external clib name 'tzset'; +function stime(__when:Ptime_t):longint;cdecl;external clib name 'stime'; +function timelocal(__tp:Ptm):time_t;cdecl;external clib name 'timelocal'; +function dysize(__year:longint):longint;cdecl;external clib name 'dysize'; +function nanosleep(__requested_time:Ptimespec; __remaining:Ptimespec):longint;cdecl;external clib name 'nanosleep'; +function clock_getres(__clock_id:clockid_t; __res:Ptimespec):longint;cdecl;external clib name 'clock_getres'; +function clock_gettime(__clock_id:clockid_t; __tp:Ptimespec):longint;cdecl;external clib name 'clock_gettime'; +function clock_settime(__clock_id:clockid_t; __tp:Ptimespec):longint;cdecl;external clib name 'clock_settime'; +function clock_nanosleep(__clock_id:clockid_t; __flags:longint; __req:Ptimespec; __rem:Ptimespec):longint;cdecl;external clib name 'clock_nanosleep'; +function clock_getcpuclockid(__pid:pid_t; __clock_id:Pclockid_t):longint;cdecl;external clib name 'clock_getcpuclockid'; +function timer_create(__clock_id:clockid_t; __evp:Psigevent; __timerid:Ptimer_t):longint;cdecl;external clib name 'timer_create'; +function timer_delete(__timerid:timer_t):longint;cdecl;external clib name 'timer_delete'; +function timer_settime(__timerid:timer_t; __flags:longint; __value:Pitimerspec; __ovalue:Pitimerspec):longint;cdecl;external clib name 'timer_settime'; +function timer_gettime(__timerid:timer_t; __value:Pitimerspec):longint;cdecl;external clib name 'timer_gettime'; +function timer_getoverrun(__timerid:timer_t):longint;cdecl;external clib name 'timer_getoverrun'; +function getdate(__string:Pchar):Ptm;cdecl;external clib name 'getdate'; +function getdate_r(__string:Pchar; __resbufp:Ptm):longint;cdecl;external clib name 'getdate_r'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TTime_T = Time_t; + TCLOCKID_T = CLOCKID_T; + TUnixTime = tm; + PUnixTime = ^TUnixTime; + + TITimerSpec = itimerspec; + +function __time(var __timer : ttime_t):time_t;cdecl;external clib name 'time'; +function mktime(var __tp:tm):time_t;cdecl;external clib name 'mktime'; +function strftime(__s:Pchar; __maxsize:size_t; __format:Pchar; var __tp:tm):size_t;cdecl;external clib name 'strftime'; +function strptime(__s:Pchar; __fmt:Pchar; var __tp: tm):Pchar;cdecl;external clib name 'strptime'; +function gmtime(var __timer : ttime_t):Ptm;cdecl;external clib name 'gmtime'; +function localtime(var __timer : ttime_t):Ptm;cdecl;external clib name 'localtime'; +function gmtime_r(var __timer : ttime_t; var __tp:tm):Ptm;cdecl;external clib name 'gmtime_r'; +function localtime_r(var __timer : ttime_t; var __tp: tm):Ptm;cdecl;external clib name 'localtime_r'; +function asctime(var __tp: tm):Pchar;cdecl;external clib name 'asctime'; +function ctime(var __timer : ttime_t):Pchar;cdecl;external clib name 'ctime'; +function asctime_r(var __tp:tm; __buf:Pchar):Pchar;cdecl;external clib name 'asctime_r'; +function ctime_r(var __timer : ttime_t; __buf:Pchar):Pchar;cdecl;external clib name 'ctime_r'; + +function stime(var __when : ttime_t):longint;cdecl;external clib name 'stime'; +function timegm(var __tp:tm):time_t;cdecl;external clib name 'timegm'; +function timelocal(var __tp: tm):time_t;cdecl;external clib name 'timelocal'; +function nanosleep(var __requested_time : ttimespec; var __remaining : ttimespec):longint;cdecl;external clib name 'nanosleep'; +function clock_getres(var __clock_id:clockid_t; __res : ttimespec):longint;cdecl;external clib name 'clock_getres'; +function clock_gettime(var __clock_id:clockid_t; __tp : ttimespec):longint;cdecl;external clib name 'clock_gettime'; +function clock_settime(var __clock_id:clockid_t; __tp : ttimespec):longint;cdecl;external clib name 'clock_settime'; +function clock_nanosleep(var __clock_id:clockid_t; __flags:longint; __req : ttimespec; var __rem : ttimespec):longint;cdecl;external clib name 'clock_nanosleep'; +function clock_getcpuclockid(__pid:pid_t; var __clock_id: tclockid_t):longint;cdecl;external clib name 'clock_getcpuclockid'; +function timer_create(__clock_id:clockid_t; var __ev :tsigevent; var __timerid:timer_t):longint;cdecl;external clib name 'timer_create'; +function timer_settime(__timerid:timer_t; __flags:longint; const __value: titimerspec; var __ovalue:titimerspec):longint;cdecl;external clib name 'timer_settime'; +function timer_gettime(__timerid:timer_t; var __value: titimerspec):longint;cdecl;external clib name 'timer_gettime'; + diff --git a/jcl/source/fpc/libclite/timesh.inc b/jcl/source/fpc/libclite/timesh.inc new file mode 100644 index 0000000000..7c8fa49195 --- /dev/null +++ b/jcl/source/fpc/libclite/timesh.inc @@ -0,0 +1,22 @@ + +type + Ptms = ^tms; + tms = record + tms_utime : clock_t; + tms_stime : clock_t; + tms_cutime : clock_t; + tms_cstime : clock_t; + end; + +function times(__buffer:Ptms):clock_t;cdecl;external clib name 'times'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TTimes = tms; + PTimes = ^TTimes; + +function times(var __buffer:tms):clock_t;cdecl;external clib name 'times'; + diff --git a/jcl/source/fpc/libclite/timexh.inc b/jcl/source/fpc/libclite/timexh.inc new file mode 100644 index 0000000000..55c6f39442 --- /dev/null +++ b/jcl/source/fpc/libclite/timexh.inc @@ -0,0 +1,96 @@ + +type + Pntptimeval = ^ntptimeval; + ntptimeval = record + time : timeval; + maxerror : longint; + esterror : longint; + end; + + Ptimex = ^timex; + timex = record + modes : dword; + offset : longint; + freq : longint; + maxerror : longint; + esterror : longint; + status : longint; + constant : longint; + precision : longint; + tolerance : longint; + time : timeval; + tick : longint; + ppsfreq : longint; + jitter : longint; + shift : longint; + stabil : longint; + jitcnt : longint; + calcnt : longint; + errcnt : longint; + stbcnt : longint; + bitfield11 : longint; + bitfield12 : longint; + bitfield13 : longint; + bitfield14 : longint; + bitfield21 : longint; + bitfield22 : longint; + bitfield23 : longint; + bitfield24 : longint; + bitfield31 : longint; + bitfield32 : longint; + bitfield33 : longint; + bitfield34 : longint; + end; + + +const + ADJ_OFFSET = $0001; + ADJ_FREQUENCY = $0002; + ADJ_MAXERROR = $0004; + ADJ_ESTERROR = $0008; + ADJ_STATUS = $0010; + ADJ_TIMECONST = $0020; + ADJ_TICK = $4000; + ADJ_OFFSET_SINGLESHOT = $8001; + MOD_OFFSET = ADJ_OFFSET; + MOD_FREQUENCY = ADJ_FREQUENCY; + MOD_MAXERROR = ADJ_MAXERROR; + MOD_ESTERROR = ADJ_ESTERROR; + MOD_STATUS = ADJ_STATUS; + MOD_TIMECONST = ADJ_TIMECONST; + MOD_CLKB = ADJ_TICK; + MOD_CLKA = ADJ_OFFSET_SINGLESHOT; + STA_PLL = $0001; + STA_PPSFREQ = $0002; + STA_PPSTIME = $0004; + STA_FLL = $0008; + STA_INS = $0010; + STA_DEL = $0020; + STA_UNSYNC = $0040; + STA_FREQHOLD = $0080; + STA_PPSSIGNAL = $0100; + STA_PPSJITTER = $0200; + STA_PPSWANDER = $0400; + STA_PPSERROR = $0800; + STA_CLOCKERR = $1000; + STA_RONLY = (((STA_PPSSIGNAL or STA_PPSJITTER) or STA_PPSWANDER) or STA_PPSERROR) or STA_CLOCKERR; + TIME_OK = 0; + TIME_INS = 1; + TIME_DEL = 2; + TIME_OOP = 3; + TIME_WAIT = 4; + TIME_ERROR = 5; + TIME_BAD = TIME_ERROR; + MAXTC = 6; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type + +function __adjtimex(var __ntx:timex):longint;cdecl;external clib name '__adjtimex'; +function adjtimex(var __ntx:timex):longint;cdecl;external clib name 'adjtimex'; +function ntp_gettime(var __ntv:ntptimeval):longint;cdecl;external clib name 'ntp_gettime'; +function ntp_adjtime(var __tntx:timex):longint;cdecl;external clib name 'ntp_adjtime'; diff --git a/jcl/source/fpc/libclite/ttyenth.inc b/jcl/source/fpc/libclite/ttyenth.inc new file mode 100644 index 0000000000..c06d406dd6 --- /dev/null +++ b/jcl/source/fpc/libclite/ttyenth.inc @@ -0,0 +1,36 @@ + +const + _PATH_TTYS = '/etc/ttys'; + _TTYS_OFF = 'off'; + _TTYS_ON = 'on'; + _TTYS_SECURE = 'secure'; + _TTYS_WINDOW = 'window'; + +type + Pttyent = ^ttyent; + ttyent = record + ty_name : Pchar; + ty_getty : Pchar; + ty_type : Pchar; + ty_status : longint; + ty_window : Pchar; + ty_comment : Pchar; + end; + + +const + TTY_ON = $01; + TTY_SECURE = $02; + +function getttyent:Pttyent;cdecl;external clib name 'getttyent'; +function getttynam(__tty:Pchar):Pttyent;cdecl;external clib name 'getttynam'; +function setttyent:longint;cdecl;external clib name 'setttyent'; +function endttyent:longint;cdecl;external clib name 'endttyent'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TTtyEnt = ttyent; + diff --git a/jcl/source/fpc/libclite/types.inc b/jcl/source/fpc/libclite/types.inc new file mode 100644 index 0000000000..b1ae6437ea --- /dev/null +++ b/jcl/source/fpc/libclite/types.inc @@ -0,0 +1,11 @@ +Function __FDELT(d: longint): Integer; + +begin + Result:=d div __NFDBITS; +end; + + +Function __FDMASK(d: longint): __fd_mask; +begin + Result:=1 shl (d mod __NFDBITS); +end; diff --git a/jcl/source/fpc/libclite/typesh.inc b/jcl/source/fpc/libclite/typesh.inc new file mode 100644 index 0000000000..23703218ed --- /dev/null +++ b/jcl/source/fpc/libclite/typesh.inc @@ -0,0 +1,229 @@ +{ --------------------------------------------------------------------- + 'h2pas -S -c -D -l libc -i' from bits/types.h sys/types.h + ---------------------------------------------------------------------} + +type + __u_char = byte; + __u_short = word; + __u_int = dword; + __u_long = dword; + __u_quad_t = qword; + __quad_t = int64; + + __int8_t = char; + __uint8_t = byte; + __int16_t = smallint; + __uint16_t = word; + __int32_t = longint; + __uint32_t = dword; + __int64_t = Int64; + __uint64_t = Qword; + + __qaddr_t = __quad_t; + __dev_t = __u_quad_t; + __uid_t = __u_int; + __gid_t = __u_int; + __ino_t = __u_long; + __mode_t = __u_int; + __nlink_t = __u_int; + __off_t = longint; + __loff_t = __quad_t; + __pid_t = longint; + __ssize_t = longint; + __rlim_t = __u_long; + __rlim64_t = __u_quad_t; + __id_t = __u_int; + __fsid_t = record + __val : array[0..1] of longint; + end; + __daddr_t = longint; + __caddr_t = char; + __time_t = longint; + __useconds_t = dword; + __suseconds_t = longint; + __swblk_t = longint; + __clock_t = longint; + __clockid_t = longint; + __timer_t = longint; + __fd_mask = dWord; + +const + __FD_SETSIZE = 1024; + __NFDBITS = 8 * sizeof(__fd_mask); + +type + __fd_set = record + fds_bits: packed array[0..(__FD_SETSIZE div __NFDBITS)-1] of __fd_mask; + end; + TFdSet = __fd_set; + PFdSet = ^TFdSet; + + +type + __key_t = longint; + __ipc_pid_t = word; + __blksize_t = longint; + __blkcnt_t = longint; + __blkcnt64_t = __quad_t; + __fsblkcnt_t = __u_long; + __fsblkcnt64_t = __u_quad_t; + __fsfilcnt_t = __u_long; + __fsfilcnt64_t = __u_quad_t; + __ino64_t = __u_quad_t; + __off64_t = __loff_t; + __t_scalar_t = longint; + __t_uscalar_t = dword; + __intptr_t = longint; + __socklen_t = dword; + TFileDescriptor = integer; + +Const + stdin = 0; + stdout = 1; + stderr = 2; + + +{ --------------------------------------------------------------------- + 'h2pas -S -c -D -l libc -i' from sys/types.h + ---------------------------------------------------------------------} + +Type + + u_char = __u_char; + u_short = __u_short; + u_int = __u_int; + u_long = __u_long; + quad_t = __quad_t; + u_quad_t = __u_quad_t; + fsid_t = __fsid_t; + loff_t = __loff_t; + ino_t = __ino_t; + ino64_t = __ino64_t; + dev_t = __dev_t; + gid_t = __gid_t; + mode_t = __mode_t; + nlink_t = __nlink_t; + uid_t = __uid_t; + off_t = __off_t; + off64_t = __off64_t; + pid_t = __pid_t; + id_t = __id_t; + ssize_t = __ssize_t; + daddr_t = __daddr_t; + caddr_t = __caddr_t; + key_t = __key_t; + useconds_t = __useconds_t; + suseconds_t = __suseconds_t; + ulong = dword; + ushort = word; + uint = dword; + int8_t = char; + int16_t = smallint; + int32_t = longint; + u_int8_t = byte; + u_int16_t = word; + u_int32_t = dword; + register_t = longint; + blksize_t = __blksize_t; + blkcnt_t = __blkcnt_t; + fsblkcnt_t = __fsblkcnt_t; + fsfilcnt_t = __fsfilcnt_t; + blkcnt64_t = __blkcnt64_t; + fsblkcnt64_t = __fsblkcnt64_t; + fsfilcnt64_t = __fsfilcnt64_t; + + P__key_t = ^__key_t; + P__ipc_pid_t = ^__ipc_pid_t; + P__blksize_t = ^__blksize_t; + P__blkcnt_t = ^__blkcnt_t; + P__blkcnt64_t = ^__blkcnt64_t; + P__fsblkcnt_t = ^__fsblkcnt_t; + P__fsblkcnt64_t = ^__fsblkcnt64_t; + P__fsfilcnt_t = ^__fsfilcnt_t; + P__fsfilcnt64_t = ^__fsfilcnt64_t; + P__ino64_t = ^__ino64_t; + P__off64_t = ^__off64_t; + P__t_scalar_t = ^__t_scalar_t; + P__t_uscalar_t = ^__t_uscalar_t; + P__intptr_t = ^__intptr_t; + P__socklen_t = ^__socklen_t; + + + Pu_char = ^u_char; + Pu_short = ^u_short; + Pu_int = ^u_int; + Pu_long = ^u_long; + Pquad_t = ^quad_t; + Pu_quad_t = ^u_quad_t; + Pfsid_t = ^fsid_t; + Ploff_t = ^loff_t; + Pino_t = ^ino_t; + Pino64_t = ^ino64_t; + Pdev_t = ^dev_t; + Pgid_t = ^gid_t; + Pmode_t = ^mode_t; + Pnlink_t = ^nlink_t; + Puid_t = ^uid_t; + Poff_t = ^off_t; + Poff64_t = ^off64_t; + Ppid_t = ^pid_t; + Pssize_t = ^ssize_t; + Pdaddr_t = ^daddr_t; + Pcaddr_t = ^caddr_t; + Pkey_t = ^key_t; + Puseconds_t = ^useconds_t; + Psuseconds_t = ^suseconds_t; + Pulong = ^ulong; + Pushort = ^ushort; + Puint = ^uint; + Pint8_t = ^int8_t; + Pint16_t = ^int16_t; + Pint32_t = ^int32_t; + Pu_int8_t = ^u_int8_t; + Pu_int16_t = ^u_int16_t; + Pu_int32_t = ^u_int32_t; + Pregister_t = ^register_t; + Pblksize_t = ^blksize_t; + Pblkcnt_t = ^blkcnt_t; + Pfsblkcnt_t = ^fsblkcnt_t; + Pfsfilcnt_t = ^fsfilcnt_t; + Pblkcnt64_t = ^blkcnt64_t; + Pfsblkcnt64_t = ^fsblkcnt64_t; + Pfsfilcnt64_t = ^fsfilcnt64_t; + + P__qaddr_t = ^__qaddr_t; + P__dev_t = ^__dev_t; + P__uid_t = ^__uid_t; + P__gid_t = ^__gid_t; + P__ino_t = ^__ino_t; + P__mode_t = ^__mode_t; + P__nlink_t = ^__nlink_t; + P__off_t = ^__off_t; + P__loff_t = ^__loff_t; + P__pid_t = ^__pid_t; + P__ssize_t = ^__ssize_t; + P__rlim_t = ^__rlim_t; + P__rlim64_t = ^__rlim64_t; + P__id_t = ^__id_t; + P__fsid_t = ^__fsid_t; + P__daddr_t = ^__daddr_t; + P__caddr_t = ^__caddr_t; + P__time_t = ^__time_t; + P__useconds_t = ^__useconds_t; + P__suseconds_t = ^__suseconds_t; + P__swblk_t = ^__swblk_t; + P__clock_t = ^__clock_t; + P__clockid_t = ^__clockid_t; + P__timer_t = ^__timer_t; + + +{ Macros } +Function __FDELT(d: longint): Integer; +Function __FDMASK(d: longint): __fd_mask; + +{ Borland compatibility } +Type + + TFsID = __fsid_t; + PFsID = ^TFsID; + diff --git a/jcl/source/fpc/libclite/ucontexth.inc b/jcl/source/fpc/libclite/ucontexth.inc new file mode 100644 index 0000000000..761b509b73 --- /dev/null +++ b/jcl/source/fpc/libclite/ucontexth.inc @@ -0,0 +1,21 @@ + +type + TMakeContextProc = procedure; // Used anonymously in header file. + +function getcontext(__ucp:Pucontext_t):longint;cdecl;external clib name 'getcontext'; +function setcontext(__ucp:Pucontext_t):longint;cdecl;external clib name 'setcontext'; +function swapcontext(__oucp:Pucontext_t; __ucp:Pucontext_t):longint;cdecl;external clib name 'swapcontext'; +procedure makecontext(__ucp:Pucontext_t; __func:TMakeContextProc; __argc:longint; args:array of const);cdecl;external clib name 'makecontext'; +procedure makecontext(__ucp:Pucontext_t; __func:TMakeContextProc; __argc:longint);cdecl;varargs;external clib name 'makecontext'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function getcontext(var __ucp:ucontext_t):longint;cdecl;external clib name 'getcontext'; +function setcontext(const __ucp: ucontext_t):longint;cdecl;external clib name 'setcontext'; +function swapcontext(var __oucp:ucontext_t; const __ucp: ucontext_t):longint;cdecl;external clib name 'swapcontext'; +procedure makecontext(var __ucp:ucontext_t; __func:TMakeContextProc; __argc:longint; args:array of const);cdecl;external clib name 'makecontext'; +procedure makecontext(var __ucp:ucontext_t; __func:TMakeContextProc; __argc:longint);cdecl;external clib name 'makecontext'; diff --git a/jcl/source/fpc/libclite/ulimith.inc b/jcl/source/fpc/libclite/ulimith.inc new file mode 100644 index 0000000000..0ee01a357a --- /dev/null +++ b/jcl/source/fpc/libclite/ulimith.inc @@ -0,0 +1,16 @@ + +Const + UL_GETFSIZE = 1; + UL_SETFSIZE = 2; + __UL_GETMAXBRK = 3; + __UL_GETOPENMAX = 4; + + +function ulimit(__cmd:longint; args:array of const):longint;cdecl;external clib name 'ulimit'; +function ulimit(__cmd:longint):longint;cdecl;varargs;external clib name 'ulimit'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/unistdh.inc b/jcl/source/fpc/libclite/unistdh.inc new file mode 100644 index 0000000000..3f468d3315 --- /dev/null +++ b/jcl/source/fpc/libclite/unistdh.inc @@ -0,0 +1,202 @@ + + +const + _POSIX_VERSION = 199506; + _POSIX2_C_VERSION = 199209; + _POSIX2_VERSION = 199209; + _POSIX2_C_BIND = 1; + _POSIX2_C_DEV = 1; + _POSIX2_SW_DEV = 1; + _POSIX2_LOCALEDEF = 1; + +const + _XOPEN_VERSION = 500; + +const + _XOPEN_XCU_VERSION = 4; + _XOPEN_XPG2 = 1; + _XOPEN_XPG3 = 1; + _XOPEN_XPG4 = 1; + _XOPEN_UNIX = 1; + _XOPEN_CRYPT = 1; + _XOPEN_ENH_I18N = 1; + _XOPEN_LEGACY = 1; + +const + STDIN_FILENO = 0; + STDOUT_FILENO = 1; + STDERR_FILENO = 2; + +type + + Pintptr_t = ^intptr_t; + + +function access(__name:Pchar; __type:longint):longint;cdecl;external clib name 'access'; + +function euidaccess(__name:Pchar; __type:longint):longint;cdecl;external clib name 'euidaccess'; + +function lseek(__fd:longint; __offset:__off_t; __whence:longint):__off_t;cdecl;external clib name 'lseek'; +function lseek64(__fd:longint; __offset:__off64_t; __whence:longint):__off64_t;cdecl;external clib name 'lseek64'; + +{ // Removed, conflicts with system routines +function close(__fd:longint):longint;cdecl;external clib name 'close'; +function read(__fd:longint; __buf:pointer; __nbytes:size_t):ssize_t;cdecl;external clib name 'read'; +function write(__fd:longint; __buf:pointer; __n:size_t):ssize_t;cdecl;external clib name 'write'; +} + +function pread(__fd:longint; __buf:pointer; __nbytes:size_t; __offset:__off_t):ssize_t;cdecl;external clib name 'pread'; +function pwrite(__fd:longint; __buf:pointer; __n:size_t; __offset:__off_t):ssize_t;cdecl;external clib name 'pwrite'; + +function pread64(__fd:longint; __buf:pointer; __nbytes:size_t; __offset:__off64_t):ssize_t;cdecl;external clib name 'pread64'; +function pwrite64(__fd:longint; __buf:pointer; __n:size_t; __offset:__off64_t):ssize_t;cdecl;external clib name 'pwrite64'; + +Type + TPipes = Array[0..1] of longint; + PPipes = ^TPipes; + +function pipe(var __pipedes: TPipes):longint;cdecl;external clib name 'pipe'; +function pipe(__pipedes: Plongint):longint;cdecl;external clib name 'pipe'; +function alarm(__seconds:dword):dword;cdecl;external clib name 'alarm'; +function __sleep(__seconds:dword):dword;cdecl;external clib name 'sleep'; + +function ualarm(__value:__useconds_t; __interval:__useconds_t):__useconds_t;cdecl;external clib name 'ualarm'; +function usleep(__useconds:__useconds_t):longint;cdecl;external clib name 'usleep'; + +function pause:longint;cdecl;external clib name 'pause'; +function chown(__file:Pchar; __owner:__uid_t; __group:__gid_t):longint;cdecl;external clib name 'chown'; + +function fchown(__fd:longint; __owner:__uid_t; __group:__gid_t):longint;cdecl;external clib name 'fchown'; +function lchown(__file:Pchar; __owner:__uid_t; __group:__gid_t):longint;cdecl;external clib name 'lchown'; + +function __chdir(__path:Pchar):longint;cdecl;external clib name 'chdir'; +function fchdir(__fd:longint):longint;cdecl;external clib name 'fchdir'; + +function getcwd(__buf:Pchar; __size:size_t):Pchar;cdecl;external clib name 'getcwd'; +function get_current_dir_name:Pchar;cdecl;external clib name 'get_current_dir_name'; +function getwd(__buf:Pchar):Pchar;cdecl;external clib name 'getwd'; + +function dup(__fd:longint):longint;cdecl;external clib name 'dup'; +function dup2(__fd:longint; __fd2:longint):longint;cdecl;external clib name 'dup2'; + + var + __environ : ^Pchar;cvar;external; + environ : ^Pchar;cvar;external; + +function execve(__path:Pchar; __argv:PPchar; __envp:PPchar):longint;cdecl;external clib name 'execve'; +function fexecve(__fd:longint; __argv:PPchar; __envp:PPchar):longint;cdecl;external clib name 'fexecve'; + +function execv(__path:Pchar; __argv:PPchar):longint;cdecl;external clib name 'execv'; +function execle(__path:Pchar; __arg:Pchar; args:array of const):longint;cdecl;varargs;external clib name 'execle'; +function execle(__path:Pchar; __arg:Pchar):longint;cdecl;external clib name 'execle'; +function execl(__path:Pchar; __arg:Pchar; args:array of const):longint;cdecl;external clib name 'execl'; +function execl(__path:Pchar; __arg:Pchar):longint;cdecl;varargs;external clib name 'execl'; +function execvp(__file:Pchar; __argv:PPchar):longint;cdecl;external clib name 'execvp'; +function execlp(__file:Pchar; __arg:Pchar; args:array of const):longint;cdecl;external clib name 'execlp'; +function execlp(__file:Pchar; __arg:Pchar):longint;cdecl;varargs;external clib name 'execlp'; + +function nice(__inc:longint):longint;cdecl;external clib name 'nice'; +procedure _exit (__status : longint); cdecl; external clib name '_exit'; + +function pathconf(__path:Pchar; __name:longint):longint;cdecl;external clib name 'pathconf'; +function fpathconf(__fd:longint; __name:longint):longint;cdecl;external clib name 'fpathconf'; + +function sysconf (__name : longint) : longint; cdecl; external clib name 'sysconf'; +function confstr(__name:longint; __buf:Pchar; __len:size_t):size_t;cdecl;external clib name 'confstr'; + +function getpid:__pid_t;cdecl;external clib name 'getpid'; +function getppid:__pid_t;cdecl;external clib name 'getppid'; +function getpgrp:__pid_t;cdecl;external clib name 'getpgrp'; + +function __getpgid(__pid:__pid_t):__pid_t;cdecl;external clib name '__getpgid'; + +function getpgid(__pid:__pid_t):__pid_t;cdecl;external clib name 'getpgid'; + +function setpgid(__pid:__pid_t; __pgid:__pid_t):longint;cdecl;external clib name 'setpgid'; +function setpgrp:longint;cdecl;external clib name 'setpgrp'; + +function setsid:__pid_t;cdecl;external clib name 'setsid'; +function getsid(__pid:__pid_t):__pid_t;cdecl;external clib name 'getsid'; +function getuid:__uid_t;cdecl;external clib name 'getuid'; +function geteuid:__uid_t;cdecl;external clib name 'geteuid'; +function getgid:__gid_t;cdecl;external clib name 'getgid'; +function getegid:__gid_t;cdecl;external clib name 'getegid'; +function getgroups(__size:longint; __list:array of __gid_t):longint;cdecl;external clib name 'getgroups'; +function group_member(__gid:__gid_t):longint;cdecl;external clib name 'group_member'; +function setuid(__uid:__uid_t):longint;cdecl;external clib name 'setuid'; +function setreuid(__ruid:__uid_t; __euid:__uid_t):longint;cdecl;external clib name 'setreuid'; +function seteuid(__uid:__uid_t):longint;cdecl;external clib name 'seteuid'; +function setgid(__gid:__gid_t):longint;cdecl;external clib name 'setgid'; + +function setregid(__rgid:__gid_t; __egid:__gid_t):longint;cdecl;external clib name 'setregid'; +function setegid(__gid:__gid_t):longint;cdecl;external clib name 'setegid'; +function fork:__pid_t;cdecl;external clib name 'fork'; +function vfork:__pid_t;cdecl;external clib name 'vfork'; +function ttyname(__fd:longint):Pchar;cdecl;external clib name 'ttyname'; +function ttyname_r(__fd:longint; __buf:Pchar; __buflen:size_t):longint;cdecl;external clib name 'ttyname_r'; +function isatty(__fd:longint):longint;cdecl;external clib name 'isatty'; +function link(__from:Pchar; __to:Pchar):longint;cdecl;external clib name 'link'; +function symlink(__from:Pchar; __to:Pchar):longint;cdecl;external clib name 'symlink'; +function readlink(__path:Pchar; __buf:Pchar; __len:size_t):longint;cdecl;external clib name 'readlink'; +function unlink(__name:Pchar):longint;cdecl;external clib name 'unlink'; +function __rmdir(__path:Pchar):longint;cdecl;external clib name 'rmdir'; +function tcgetpgrp(__fd:longint):__pid_t;cdecl;external clib name 'tcgetpgrp'; +function tcsetpgrp(__fd:longint; __pgrp_id:__pid_t):longint;cdecl;external clib name 'tcsetpgrp'; +function getlogin:Pchar;cdecl;external clib name 'getlogin'; +function getlogin_r(__name:Pchar; __name_len:size_t):longint;cdecl;external clib name 'getlogin_r'; +function setlogin(__name:Pchar):longint;cdecl;external clib name 'setlogin'; +function gethostname(__name:Pchar; __len:size_t):longint;cdecl;external clib name 'gethostname'; +function sethostname(__name:Pchar; __len:size_t):longint;cdecl;external clib name 'sethostname'; +function sethostid(__id:longint):longint;cdecl;external clib name 'sethostid'; +function getdomainname(__name:Pchar; __len:size_t):longint;cdecl;external clib name 'getdomainname'; +function setdomainname(__name:Pchar; __len:size_t):longint;cdecl;external clib name 'setdomainname'; +function vhangup:longint;cdecl;external clib name 'vhangup'; +function revoke(__file:Pchar):longint;cdecl;external clib name 'revoke'; +function profil(__sample_buffer:Pword; __size:size_t; __offset:size_t; __scale:dword):longint;cdecl;external clib name 'profil'; +function acct(__name:Pchar):longint;cdecl;external clib name 'acct'; +function getusershell:Pchar;cdecl;external clib name 'getusershell'; +procedure endusershell;cdecl;external clib name 'endusershell'; +procedure setusershell;cdecl;external clib name 'setusershell'; +function daemon(__nochdir:longint; __noclose:longint):longint;cdecl;external clib name 'daemon'; +function chroot(__path:Pchar):longint;cdecl;external clib name 'chroot'; +function getpass(__prompt:Pchar):Pchar;cdecl;external clib name 'getpass'; +function fsync(__fd:longint):longint;cdecl;external clib name 'fsync'; +function gethostid:longint;cdecl;external clib name 'gethostid'; +procedure sync;cdecl;external clib name 'sync'; +function getpagesize : longint;cdecl; external clib name 'getpagesize'; +function __truncate(__file:Pchar; __length:__off_t):longint;cdecl;external clib name 'truncate'; +function truncate64(__file:Pchar; __length:__off64_t):longint;cdecl;external clib name 'truncate64'; +function ftruncate(__fd:longint; __length:__off_t):longint;cdecl;external clib name 'ftruncate'; +function ftruncate64(__fd:longint; __length:__off64_t):longint;cdecl;external clib name 'ftruncate64'; +function getdtablesize:longint;cdecl;external clib name 'getdtablesize'; +function brk(__addr:pointer):longint;cdecl;external clib name 'brk'; +function sbrk(__delta:intptr_t):pointer;cdecl;external clib name 'sbrk'; + +function syscall(__sysno:longint; args:array of const):longint;cdecl;external clib name 'syscall'; +function syscall(__sysno:longint):longint;cdecl;varargs;external clib name 'syscall'; + + +function crypt(__key:Pchar; __salt:Pchar):Pchar;cdecl;external clib name 'crypt'; +procedure encrypt(__block:Pchar; __edflag:longint);cdecl;external clib name 'encrypt'; +procedure swab(__from:pointer; __to:pointer; __n:ssize_t);cdecl;external clib name 'swab'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TPipeDescriptors = {packed} record + ReadDes: Integer; + WriteDes: Integer; + end; + PPipeDescriptors = ^TPipeDescriptors; + +function pipe(var PipeDes: TPipeDescriptors): Integer; cdecl; external clib name 'pipe'; +function __read(Handle: Integer; var Buffer; Count: size_t): ssize_t; cdecl;external clib name 'read'; +function __write(Handle: Integer; const Buffer; Count: size_t): ssize_t; cdecl;external clib name 'write'; +function __close(Handle: Integer): Integer; cdecl;external clib name 'close'; + + + + diff --git a/jcl/source/fpc/libclite/utimeh.inc b/jcl/source/fpc/libclite/utimeh.inc new file mode 100644 index 0000000000..6552b6a92d --- /dev/null +++ b/jcl/source/fpc/libclite/utimeh.inc @@ -0,0 +1,20 @@ + +type + Putimbuf = ^utimbuf; + utimbuf = record + actime : __time_t; + modtime : __time_t; + end; + + +function utime(__file:Pchar; __file_times:Putimbuf):longint;cdecl;external clib name 'utime'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +type + TUTimeBuffer = utimbuf; + PUTimeBuffer = ^TUTimeBuffer; + +function utime(__file:Pchar; const __file_times: utimbuf):longint;cdecl;external clib name 'utime'; diff --git a/jcl/source/fpc/libclite/utmph.inc b/jcl/source/fpc/libclite/utmph.inc new file mode 100644 index 0000000000..3271b2b33e --- /dev/null +++ b/jcl/source/fpc/libclite/utmph.inc @@ -0,0 +1,37 @@ + + +const + UTMP_FILE = _PATH_UTMP; + UTMP_FILENAME = _PATH_UTMP; + WTMP_FILE = _PATH_WTMP; + WTMP_FILENAME = _PATH_WTMP; + +function login_tty(__fd:longint):longint;cdecl;external clib name 'login_tty'; +procedure login(__entry:Putmp);cdecl;external clib name 'login'; +function logout(__ut_line:Pchar):longint;cdecl;external clib name 'logout'; +procedure logwtmp(__ut_line:Pchar; __ut_name:Pchar; __ut_host:Pchar);cdecl;external clib name 'logwtmp'; +procedure updwtmp(__wtmp_file:Pchar; __utmp:Putmp);cdecl;external clib name 'updwtmp'; +function utmpname(__file:Pchar):longint;cdecl;external clib name 'utmpname'; +function getutent:Putmp;cdecl;external clib name 'getutent'; +procedure setutent;cdecl;external clib name 'setutent'; +procedure endutent;cdecl;external clib name 'endutent'; +function getutid(__id:Putmp):Putmp;cdecl;external clib name 'getutid'; +function getutline(__line:Putmp):Putmp;cdecl;external clib name 'getutline'; +function pututline(__utmp_ptr:Putmp):Putmp;cdecl;external clib name 'pututline'; +function getutent_r(__buffer:Putmp; __result:PPutmp):longint;cdecl;external clib name 'getutent_r'; +function getutid_r(__id:Putmp; __buffer:Putmp; __result:PPutmp):longint;cdecl;external clib name 'getutid_r'; +function getutline_r(__line:Putmp; __buffer:Putmp; __result:PPutmp):longint;cdecl;external clib name 'getutline_r'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +procedure login(const __entry: utmp);cdecl;external clib name 'login'; +procedure updwtmp(__wtmp_file:Pchar; const __utmp:utmp);cdecl;external clib name 'updwtmp'; +function getutid(const __id: utmp):Putmp;cdecl;external clib name 'getutid'; +function getutline(const __line:utmp):Putmp;cdecl;external clib name 'getutline'; +function pututline(const __utmp_ptr: utmp):Putmp;cdecl;external clib name 'pututline'; +function getutent_r(var __buffer:Putmp; var __result: Putmp):longint;cdecl;external clib name 'getutent_r'; +function getutid_r(const __id:utmp; var __buffer: utmp; var __result:Putmp):longint;cdecl;external clib name 'getutid_r'; +function getutline_r(const __line:utmp; var __buffer: utmp; var __result:Putmp):longint;cdecl;external clib name 'getutline_r'; diff --git a/jcl/source/fpc/libclite/utmpxh.inc b/jcl/source/fpc/libclite/utmpxh.inc new file mode 100644 index 0000000000..0efda3949b --- /dev/null +++ b/jcl/source/fpc/libclite/utmpxh.inc @@ -0,0 +1,29 @@ + +const + UTMPX_FILE = _PATH_UTMPX; + UTMPX_FILENAME = _PATH_UTMPX; + WTMPX_FILE = _PATH_WTMPX; + WTMPX_FILENAME = _PATH_WTMPX; + +procedure setutxent;cdecl;external clib name 'setutxent'; +procedure endutxent;cdecl;external clib name 'endutxent'; +function getutxent:Putmpx;cdecl;external clib name 'getutxent'; +function getutxid(__id:Putmpx):Putmpx;cdecl;external clib name 'getutxid'; +function getutxline(__line:Putmpx):Putmpx;cdecl;external clib name 'getutxline'; +function pututxline(__utmpx:Putmpx):Putmpx;cdecl;external clib name 'pututxline'; +function utmpxname(__file:Pchar):longint;cdecl;external clib name 'utmpxname'; +procedure updwtmpx(__wtmpx_file:Pchar; __utmpx:Putmpx);cdecl;external clib name 'updwtmpx'; +procedure getutmp(__utmpx:Putmpx; __utmp:Putmp);cdecl;external clib name 'getutmp'; +procedure getutmpx(__utmp:Putmp; __utmpx:Putmpx);cdecl;external clib name 'getutmpx'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type +function getutxid(const __id:utmpx):Putmpx;cdecl;external clib name 'getutxid'; +function getutxline(const __line:utmpx):Putmpx;cdecl;external clib name 'getutxline'; +function pututxline(const __utmpx:utmpx):Putmpx;cdecl;external clib name 'pututxline'; +procedure updwtmpx(__wtmpx_file:Pchar;const __utmpx:utmpx);cdecl;external clib name 'updwtmpx'; +procedure getutmp(const __utmpx:utmpx; var __utmp:utmp);cdecl;external clib name 'getutmp'; +procedure getutmpx(var __utmp:utmp; var __utmpx:utmpx);cdecl;external clib name 'getutmpx'; diff --git a/jcl/source/fpc/libclite/wcharh.inc b/jcl/source/fpc/libclite/wcharh.inc new file mode 100644 index 0000000000..b87f91c4a8 --- /dev/null +++ b/jcl/source/fpc/libclite/wcharh.inc @@ -0,0 +1,122 @@ + +type + Pmbstate_t = ^mbstate_t; + P__FILE = PFILE; + __GNUC_VA_LIST = pointer; + +function wcscpy(__dest:Pwchar_t; __src:Pwchar_t):Pwchar_t;cdecl;external clib name 'wcscpy'; +function wcsncpy(__dest:Pwchar_t; __src:Pwchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wcsncpy'; +function wcscat(__dest:Pwchar_t; __src:Pwchar_t):Pwchar_t;cdecl;external clib name 'wcscat'; +function wcsncat(__dest:Pwchar_t; __src:Pwchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wcsncat'; +function wcscmp(__s1:Pwchar_t; __s2:Pwchar_t):longint;cdecl;external clib name 'wcscmp'; +function wcsncmp(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t):longint;cdecl;external clib name 'wcsncmp'; +function wcscasecmp(__s1:Pwchar_t; __s2:Pwchar_t):longint;cdecl;external clib name 'wcscasecmp'; +function wcsncasecmp(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t):longint;cdecl;external clib name 'wcsncasecmp'; +function __wcscasecmp_l(__s1:Pwchar_t; __s2:Pwchar_t; __loc:__locale_t):longint;cdecl;external clib name '__wcscasecmp_l'; +function __wcsncasecmp_l(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t; __loc:__locale_t):longint;cdecl;external clib name '__wcsncasecmp_l'; +function wcscoll(__s1:Pwchar_t; __s2:Pwchar_t):longint;cdecl;external clib name 'wcscoll'; +function wcsxfrm(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t):size_t;cdecl;external clib name 'wcsxfrm'; +function __wcscoll_l(__s1:Pwchar_t; __s2:Pwchar_t; __loc:__locale_t):longint;cdecl;external clib name '__wcscoll_l'; +function __wcsxfrm_l(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t; __loc:__locale_t):size_t;cdecl;external clib name '__wcsxfrm_l'; +function wcsdup(__s:Pwchar_t):Pwchar_t;cdecl;external clib name 'wcsdup'; +function wcschr(__wcs:Pwchar_t; __wc:wchar_t):Pwchar_t;cdecl;external clib name 'wcschr'; +function wcsrchr(__wcs:Pwchar_t; __wc:wchar_t):Pwchar_t;cdecl;external clib name 'wcsrchr'; +function wcschrnul(__s:Pwchar_t; __wc:wchar_t):Pwchar_t;cdecl;external clib name 'wcschrnul'; +function wcscspn(__wcs:Pwchar_t; __reject:Pwchar_t):size_t;cdecl;external clib name 'wcscspn'; +function wcsspn(__wcs:Pwchar_t; __accept:Pwchar_t):size_t;cdecl;external clib name 'wcsspn'; +function wcspbrk(__wcs:Pwchar_t; __accept:Pwchar_t):Pwchar_t;cdecl;external clib name 'wcspbrk'; +function wcsstr(__haystack:Pwchar_t; __needle:Pwchar_t):Pwchar_t;cdecl;external clib name 'wcsstr'; +function wcswcs(__haystack:Pwchar_t; __needle:Pwchar_t):Pwchar_t;cdecl;external clib name 'wcswcs'; +function wcstok(__s:Pwchar_t; __delim:Pwchar_t; __ptr:PPwchar_t):Pwchar_t;cdecl;external clib name 'wcstok'; +function wcslen(__s:Pwchar_t):size_t;cdecl;external clib name 'wcslen'; +function wcsnlen(__s:Pwchar_t; __maxlen:size_t):size_t;cdecl;external clib name 'wcsnlen'; +function wmemchr(__s:Pwchar_t; __c:wchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wmemchr'; +function wmemcmp(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t):longint;cdecl;external clib name 'wmemcmp'; +function wmemcpy(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wmemcpy'; +function wmemmove(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wmemmove'; +function wmemset(__s:Pwchar_t; __c:wchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wmemset'; +function wmempcpy(__s1:Pwchar_t; __s2:Pwchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wmempcpy'; +function btowc(__c:longint):wint_t;cdecl;external clib name 'btowc'; +function wctob(__c:wint_t):longint;cdecl;external clib name 'wctob'; +function mbsinit(__ps:Pmbstate_t):longint;cdecl;external clib name 'mbsinit'; +function mbrtowc(__pwc:Pwchar_t; __s:Pchar; __n:size_t; __p:Pmbstate_t):size_t;cdecl;external clib name 'mbrtowc'; +function wcrtomb(__s:Pchar; __wc:wchar_t; __ps:Pmbstate_t):size_t;cdecl;external clib name 'wcrtomb'; +function __mbrlen(__s:Pchar; __n:size_t; __ps:Pmbstate_t):size_t;cdecl;external clib name '__mbrlen'; +function mbrlen(__s:Pchar; __n:size_t; __ps:Pmbstate_t):size_t;cdecl;external clib name 'mbrlen'; +function mbsrtowcs(__dst:Pwchar_t; __src:PPchar; __len:size_t; __ps:Pmbstate_t):size_t;cdecl;external clib name 'mbsrtowcs'; +function wcsrtombs(__dst:Pchar; __src:PPwchar_t; __len:size_t; __ps:Pmbstate_t):size_t;cdecl;external clib name 'wcsrtombs'; +function mbsnrtowcs(__dst:Pwchar_t; __src:PPchar; __nmc:size_t; __len:size_t; __ps:Pmbstate_t):size_t;cdecl;external clib name 'mbsnrtowcs'; +function wcsnrtombs(__dst:Pchar; __src:PPwchar_t; __nwc:size_t; __len:size_t; __ps:Pmbstate_t):size_t;cdecl;external clib name 'wcsnrtombs'; +function wcwidth(__c:wchar_t):longint;cdecl;external clib name 'wcwidth'; +function wcswidth(__s:Pwchar_t; __n:size_t):longint;cdecl;external clib name 'wcswidth'; +function wcstod(__nptr:Pwchar_t; __endptr:PPwchar_t):double;cdecl;external clib name 'wcstod'; +function wcstof(__nptr:Pwchar_t; __endptr:PPwchar_t):double;cdecl;external clib name 'wcstof'; +function wcstold(__nptr:Pwchar_t; __endptr:PPwchar_t):extended;cdecl;external clib name 'wcstold'; +function wcstol(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint):longint;cdecl;external clib name 'wcstol'; +function wcstoul(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint):dword;cdecl;external clib name 'wcstoul'; +function wcstoq(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint):int64;cdecl;external clib name 'wcstoq'; +function wcstouq(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint):qword;cdecl;external clib name 'wcstouq'; +function wcstoll(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint):int64;cdecl;external clib name 'wcstoll'; +function wcstoull(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint):qword;cdecl;external clib name 'wcstoull'; + +function __wcstol_l(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint; __loc:__locale_t):longint;cdecl;external clib name '__wcstol_l'; +function __wcstoul_l(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint; __loc:__locale_t):dword;cdecl;external clib name '__wcstoul_l'; +function __wcstoll_l(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint; __loc:__locale_t):int64;cdecl;external clib name '__wcstoll_l'; +function __wcstoull_l(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint; __loc:__locale_t):qword;cdecl;external clib name '__wcstoull_l'; +function __wcstod_l(__nptr:Pwchar_t; __endptr:PPwchar_t; __loc:__locale_t):double;cdecl;external clib name '__wcstod_l'; +function __wcstof_l(__nptr:Pwchar_t; __endptr:PPwchar_t; __loc:__locale_t):double;cdecl;external clib name '__wcstof_l'; +function __wcstold_l(__nptr:Pwchar_t; __endptr:PPwchar_t; __loc:__locale_t):extended;cdecl;external clib name '__wcstold_l'; + +function __wcstod_internal(__nptr:Pwchar_t; __endptr:PPwchar_t; __group:longint):double;cdecl;external clib name '__wcstod_internal'; +function __wcstof_internal(__nptr:Pwchar_t; __endptr:PPwchar_t; __group:longint):double;cdecl;external clib name '__wcstof_internal'; +function __wcstold_internal(__nptr:Pwchar_t; __endptr:PPwchar_t; __group:longint):extended;cdecl;external clib name '__wcstold_internal'; +function __wcstol_internal(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint; __group:longint):longint;cdecl;external clib name '__wcstol_internal'; +function __wcstoul_internal(__npt:Pwchar_t; __endptr:PPwchar_t; __base:longint; __group:longint):dword;cdecl;external clib name '__wcstoul_internal'; +function __wcstoll_internal(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint; __group:longint):int64;cdecl;external clib name '__wcstoll_internal'; +function __wcstoull_internal(__nptr:Pwchar_t; __endptr:PPwchar_t; __base:longint; __group:longint):qword;cdecl;external clib name '__wcstoull_internal'; + +function wcpcpy(__dest:Pwchar_t; __src:Pwchar_t):Pwchar_t;cdecl;external clib name 'wcpcpy'; +function wcpncpy(__dest:Pwchar_t; __src:Pwchar_t; __n:size_t):Pwchar_t;cdecl;external clib name 'wcpncpy'; +function fwide(__fp:P__FILE; __mode:longint):longint;cdecl;external clib name 'fwide'; +function fwprintf(__stream:P__FILE; __format:Pwchar_t; args:array of const):longint;cdecl;external clib name 'fwprintf'; +function fwprintf(__stream:P__FILE; __format:Pwchar_t):longint;cdecl;varargs;external clib name 'fwprintf'; +function wprintf(__format:Pwchar_t; args:array of const):longint;cdecl;external clib name 'wprintf'; +function wprintf(__format:Pwchar_t):longint;cdecl;varargs;external clib name 'wprintf'; +function swprintf(__s:Pwchar_t; __n:size_t; __format:Pwchar_t; args:array of const):longint;cdecl;external clib name 'swprintf'; +function swprintf(__s:Pwchar_t; __n:size_t; __format:Pwchar_t):longint;cdecl;varargs;external clib name 'swprintf'; +function vfwprintf(__s:P__FILE; __format:Pwchar_t; __arg:__gnuc_va_list):longint;cdecl;external clib name 'vfwprintf'; +function vwprintf(__format:Pwchar_t; __arg:__gnuc_va_list):longint;cdecl;external clib name 'vwprintf'; +function vswprintf(__s:Pwchar_t; __n:size_t; __format:Pwchar_t; __arg:__gnuc_va_list):longint;cdecl;external clib name 'vswprintf'; +function fwscanf(__stream:P__FILE; __format:Pwchar_t; args:array of const):longint;cdecl;external clib name 'fwscanf'; +function fwscanf(__stream:P__FILE; __format:Pwchar_t):longint;cdecl;varargs;external clib name 'fwscanf'; +function wscanf(__format:Pwchar_t; args:array of const):longint;cdecl;external clib name 'wscanf'; +function wscanf(__format:Pwchar_t):longint;cdecl;varargs;external clib name 'wscanf'; +function swscanf(__s:Pwchar_t; __format:Pwchar_t; args:array of const):longint;cdecl;external clib name 'swscanf'; +function swscanf(__s:Pwchar_t; __format:Pwchar_t):longint;cdecl;varargs;external clib name 'swscanf'; +function vfwscanf(__s:P__FILE; __format:Pwchar_t; __arg:__gnuc_va_list):longint;cdecl;external clib name 'vfwscanf'; +function vwscanf(__format:Pwchar_t; __arg:__gnuc_va_list):longint;cdecl;external clib name 'vwscanf'; +function vswscanf(__s:Pwchar_t; __format:Pwchar_t; __arg:__gnuc_va_list):longint;cdecl;external clib name 'vswscanf'; +function fgetwc(__stream:P__FILE):wint_t;cdecl;external clib name 'fgetwc'; +function getwc(__stream:P__FILE):wint_t;cdecl;external clib name 'getwc'; +function getwchar:wint_t;cdecl;external clib name 'getwchar'; +function fputwc(__wc:wchar_t; __stream:P__FILE):wint_t;cdecl;external clib name 'fputwc'; +function putwc(__wc:wchar_t; __stream:P__FILE):wint_t;cdecl;external clib name 'putwc'; +function putwchar(__wc:wchar_t):wint_t;cdecl;external clib name 'putwchar'; +function fgetws(__ws:Pwchar_t; __n:longint; __stream:P__FILE):Pwchar_t;cdecl;external clib name 'fgetws'; +function fputws(__ws:Pwchar_t; __stream:P__FILE):longint;cdecl;external clib name 'fputws'; +function ungetwc(__wc:wint_t; __stream:P__FILE):wint_t;cdecl;external clib name 'ungetwc'; +function getwc_unlocked(__stream:P__FILE):wint_t;cdecl;external clib name 'getwc_unlocked'; +function getwchar_unlocked:wint_t;cdecl;external clib name 'getwchar_unlocked'; +function fgetwc_unlocked(__stream:P__FILE):wint_t;cdecl;external clib name 'fgetwc_unlocked'; +function fputwc_unlocked(__wc:wchar_t; __stream:P__FILE):wint_t;cdecl;external clib name 'fputwc_unlocked'; +function putwc_unlocked(__wc:wchar_t; __stream:P__FILE):wint_t;cdecl;external clib name 'putwc_unlocked'; +function putwchar_unlocked(__wc:wchar_t):wint_t;cdecl;external clib name 'putwchar_unlocked'; +function fgetws_unlocked(__ws:Pwchar_t; __n:longint; __stream:P__FILE):Pwchar_t;cdecl;external clib name 'fgetws_unlocked'; +function fputws_unlocked(__ws:Pwchar_t; __stream:P__FILE):longint;cdecl;external clib name 'fputws_unlocked'; +function wcsftime(__s:Pwchar_t; __maxsize:size_t; __format:Pwchar_t; __tp:Ptm):size_t;cdecl;external clib name 'wcsftime'; + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/wctypeh.inc b/jcl/source/fpc/libclite/wctypeh.inc new file mode 100644 index 0000000000..c9506bd91b --- /dev/null +++ b/jcl/source/fpc/libclite/wctypeh.inc @@ -0,0 +1,54 @@ + + +const + WEOF = $ffffffff; + +type + + Pwctype_t = ^wctype_t; + wctype_t = dword; + Pwctrans_t = ^wctrans_t; + wctrans_t = ^int32_t; + +function iswalpha(__wc:wint_t):longint;cdecl;external clib name 'iswalpha'; +function iswcntrl(__wc:wint_t):longint;cdecl;external clib name 'iswcntrl'; +function iswdigit(__wc:wint_t):longint;cdecl;external clib name 'iswdigit'; +function iswgraph(__wc:wint_t):longint;cdecl;external clib name 'iswgraph'; +function iswlower(__wc:wint_t):longint;cdecl;external clib name 'iswlower'; +function iswprint(__wc:wint_t):longint;cdecl;external clib name 'iswprint'; +function iswpunct(__wc:wint_t):longint;cdecl;external clib name 'iswpunct'; +function iswspace(__wc:wint_t):longint;cdecl;external clib name 'iswspace'; +function iswupper(__wc:wint_t):longint;cdecl;external clib name 'iswupper'; +function iswxdigit(__wc:wint_t):longint;cdecl;external clib name 'iswxdigit'; +function iswblank(__wc:wint_t):longint;cdecl;external clib name 'iswblank'; +function wctype(__property:Pchar):wctype_t;cdecl;external clib name 'wctype'; +function iswctype(__wc:wint_t; __desc:wctype_t):longint;cdecl;external clib name 'iswctype'; +function towlower(__wc:wint_t):wint_t;cdecl;external clib name 'towlower'; +function towupper(__wc:wint_t):wint_t;cdecl;external clib name 'towupper'; +function towctrans(__wc:wint_t; __desc:wctrans_t):wint_t;cdecl;external clib name 'towctrans'; + +function __iswalnum_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswalnum_l'; +function __iswalpha_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswalpha_l'; +function __iswcntrl_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswcntrl_l'; +function __iswdigit_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswdigit_l'; +function __iswgraph_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswgraph_l'; +function __iswlower_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswlower_l'; +function __iswprint_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswprint_l'; +function __iswpunct_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswpunct_l'; +function __iswspace_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswspace_l'; +function __iswupper_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswupper_l'; +function __iswxdigit_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswxdigit_l'; +function __iswblank_l(__wc:wint_t; __locale:__locale_t):longint;cdecl;external clib name '__iswblank_l'; +function __wctype_l(__property:Pchar; __locale:__locale_t):wctype_t;cdecl;external clib name '__wctype_l'; +function __iswctype_l(__wc:wint_t; __desc:wctype_t; __locale:__locale_t):longint;cdecl;external clib name '__iswctype_l'; +function __towlower_l(__wc:wint_t; __locale:__locale_t):wint_t;cdecl;external clib name '__towlower_l'; +function __towupper_l(__wc:wint_t; __locale:__locale_t):wint_t;cdecl;external clib name '__towupper_l'; +function __wctrans_l(__property:Pchar; __locale:__locale_t):wctrans_t;cdecl;external clib name '__wctrans_l'; +function __towctrans_l(__wc:wint_t; __desc:wctrans_t; __locale:__locale_t):wint_t;cdecl;external clib name '__towctrans_l'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +// Type diff --git a/jcl/source/fpc/libclite/wordexph.inc b/jcl/source/fpc/libclite/wordexph.inc new file mode 100644 index 0000000000..f0abb84ed2 --- /dev/null +++ b/jcl/source/fpc/libclite/wordexph.inc @@ -0,0 +1,41 @@ + + Const + WRDE_DOOFFS = 1 shl 0; + WRDE_APPEND = 1 shl 1; + WRDE_NOCMD = 1 shl 2; + WRDE_REUSE = 1 shl 3; + WRDE_SHOWERR = 1 shl 4; + WRDE_UNDEF = 1 shl 5; + __WRDE_FLAGS = ((((WRDE_DOOFFS or WRDE_APPEND) or WRDE_NOCMD) or WRDE_REUSE) or WRDE_SHOWERR) or WRDE_UNDEF; + +Type + Pwordexp_t = ^wordexp_t; + wordexp_t = record + we_wordc : size_t; + we_wordv : ^Pchar; + we_offs : size_t; + end; + +Const + WRDE_NOSYS = -(1); + WRDE_NOSPACE = 1; + WRDE_BADCHAR = 2; + WRDE_BADVAL = 3; + WRDE_CMDSUB = 4; + WRDE_SYNTAX = 5; + +function wordexp(__words:Pchar; __pwordexp:Pwordexp_t; __flags:longint):longint;cdecl;external clib name 'wordexp'; +procedure wordfree(__wordexp:Pwordexp_t);cdecl;external clib name 'wordfree'; + + +{ --------------------------------------------------------------------- + Borland compatibility types + ---------------------------------------------------------------------} + +Type + TWordExp = wordexp_t; + PWordExp = ^TWordExp; + +function wordexp(__words:Pchar; var __pwordexp: wordexp_t; __flags:longint):longint;cdecl;external clib name 'wordexp'; +procedure wordfree(var __wordexp: wordexp_t);cdecl;external clib name 'wordfree'; + diff --git a/jcl/source/fpc/libclite/wordsizeh.inc b/jcl/source/fpc/libclite/wordsizeh.inc new file mode 100644 index 0000000000..aac52c9f12 --- /dev/null +++ b/jcl/source/fpc/libclite/wordsizeh.inc @@ -0,0 +1,4 @@ + +const + __WORDSIZE = 32; + diff --git a/jcl/source/fpc/libclite/xlocaleh.inc b/jcl/source/fpc/libclite/xlocaleh.inc new file mode 100644 index 0000000000..0df6f41362 --- /dev/null +++ b/jcl/source/fpc/libclite/xlocaleh.inc @@ -0,0 +1,21 @@ +type + // Dummy opaque record + _locale_data = Record + end; + Plocale_data = ^_locale_data; + + TLocaleData = _locale_data; + PLocaleData = ^TLocaleData; + + P__locale_struct = ^__locale_struct; + __locale_struct = record + __locales : array[0..12] of Plocale_data; + __ctype_b : Pword; + __ctype_tolower : Plongint; + __ctype_toupper : Plongint; + end; + __locale_t = P__locale_struct; + P__locale_t = ^__locale_t; + + TLocale = __locale_struct; + PLocale = ^TLocale; diff --git a/jcl/source/fpc/libclite/xopen_limh.inc b/jcl/source/fpc/libclite/xopen_limh.inc new file mode 100644 index 0000000000..84fea00784 --- /dev/null +++ b/jcl/source/fpc/libclite/xopen_limh.inc @@ -0,0 +1,13 @@ + +const + _XOPEN_IOV_MAX = _POSIX_UIO_MAXIOV; + NL_ARGMAX = _POSIX_ARG_MAX; + NL_LANGMAX = _POSIX2_LINE_MAX; + NL_MSGMAX = INT_MAX; + NL_NMAX = INT_MAX; + NL_SETMAX = INT_MAX; + NL_TEXTMAX = INT_MAX; + NZERO = 20; + WORD_BIT = 32; + LONG_BIT = 32; + diff --git a/jcl/source/include/jcl.inc b/jcl/source/include/jcl.inc index 0ec22539b0..9b36546644 100644 --- a/jcl/source/include/jcl.inc +++ b/jcl/source/include/jcl.inc @@ -654,7 +654,12 @@ ALERT_jedi_inc_incompatible {$UNDEF UNITVERSIONING} {$ENDIF DELPHI2005} +{$IFDEF RTL200_UP} + {$DEFINE HAS_TOSTRING} +{$ENDIF RTL200_UP} + {$IFDEF FPC} {$DEFINE DEBUG_NO_TD32} {$ENDIF FPC} +{$DEFINE THREADSAFE} diff --git a/jcl/source/include/jedi.inc b/jcl/source/include/jedi.inc new file mode 100644 index 0000000000..62622972fb --- /dev/null +++ b/jcl/source/include/jedi.inc @@ -0,0 +1,1813 @@ +{$IFNDEF JEDI_INC} +{$DEFINE JEDI_INC} + +{**************************************************************************************************} +{ } +{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");} +{ you may not use this file except in compliance with the License. You may obtain a copy of the } +{ License at http://www.mozilla.org/MPL/ } +{ } +{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF } +{ ANY KIND, either express or implied. See the License for the specific language governing rights } +{ and limitations under the License. } +{ } +{ The Original Code is: jedi.inc. } +{ The Initial Developer of the Original Code is Project JEDI http://www.delphi-jedi.org } +{ } +{ Alternatively, the contents of this file may be used under the terms of the GNU Lesser General } +{ Public License (the "LGPL License"), in which case the provisions of the LGPL License are } +{ applicable instead of those above. If you wish to allow use of your version of this file only } +{ under the terms of the LGPL License and not to allow others to use your version of this file } +{ under the MPL, indicate your decision by deleting the provisions above and replace them with } +{ the notice and other provisions required by the LGPL License. If you do not delete the } +{ provisions above, a recipient may use your version of this file under either the MPL or the } +{ LGPL License. } +{ } +{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html } +{ } +{**************************************************************************************************} +{ } +{ This file defines various generic compiler directives used in different libraries, e.g. in the } +{ JEDI Code Library (JCL) and JEDI Visual Component Library Library (JVCL). The directives in } +{ this file are of generic nature and consist mostly of mappings from the VERXXX directives } +{ defined by Delphi, C++Builder and FPC to friendly names such as DELPHI5 and } +{ SUPPORTS_WIDESTRING. These friendly names are subsequently used in the libraries to test for } +{ compiler versions and/or whether the compiler supports certain features (such as widestrings or } +{ 64 bit integers. The libraries provide an additional, library specific, include file. For the } +{ JCL e.g. this is jcl.inc. These files should be included in source files instead of this file } +{ (which is pulled in automatically). } +{ } +{**************************************************************************************************} +{ } +{ Last modified: $Date:: $ } +{ Revision: $Rev:: $ } +{ Author: $Author:: $ } +{ } +{**************************************************************************************************} + +(* + +- Development environment directives + + This file defines two directives to indicate which development environment the + library is being compiled with. Currently this can either be Delphi, Kylix, + C++Builder or FPC. + + Directive Description + ------------------------------------------------------------------------------ + DELPHI Defined if compiled with Delphi + KYLIX Defined if compiled with Kylix + DELPHICOMPILER Defined if compiled with Delphi or Kylix/Delphi + BCB Defined if compiled with C++Builder + CPPBUILDER Defined if compiled with C++Builder (alias for BCB) + BCBCOMPILER Defined if compiled with C++Builder or Kylix/C++ + DELPHILANGUAGE Defined if compiled with Delphi, Kylix or C++Builder + BORLAND Defined if compiled with Delphi, Kylix or C++Builder + FPC Defined if compiled with FPC + +- Platform Directives + + Platform directives are not all explicitly defined in this file, some are + defined by the compiler itself. They are listed here only for completeness. + + Directive Description + ------------------------------------------------------------------------------ + WIN32 Defined when target platform is 32 bit Windows + WIN64 Defined when target platform is 64 bit Windows + MSWINDOWS Defined when target platform is 32 bit Windows + LINUX Defined when target platform is Linux + UNIX Defined when target platform is Unix-like (including Linux) + CLR Defined when target platform is .NET + +- Architecture directives. These are auto-defined by FPC + CPU32 and CPU64 are mostly for generic pointer size dependant differences rather + than for a specific architecture. + + CPU386 Defined when target platform is native x86 (win32) + CPUx86_64 Defined when target platform is native x86_64 (win64) + CPU32 Defined when target is 32-bit + CPU64 Defined when target is 64-bit + CPUASM Defined when target assembler is available + +- Visual library Directives + + The following directives indicate for a visual library. In a Delphi/BCB + (Win32) application you need to define the VisualCLX symbol in the project + options, if you want to use the VisualCLX library. Alternatively you can use + the IDE expert, which is distributed with the JCL to do this automatically. + + Directive Description + ------------------------------------------------------------------------------ + VCL Defined for Delphi/BCB (Win32) exactly if VisualCLX is not defined + VisualCLX Defined for Kylix; needs to be defined for Delphi/BCB to + use JCL with VisualCLX applications. + + +- Other cross-platform related defines + + These symbols are intended to help in writing portable code. + + Directive Description + ------------------------------------------------------------------------------ + PUREPASCAL Code is machine-independent (as opposed to assembler code) + Win32API Code is specific for the Win32 API; + use instead of "{$IFNDEF CLR} {$IFDEF MSWINDOWS}" constructs + + +- Delphi Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. These directives are only defined if + the compiler is Delphi (ie DELPHI is defined). + + Directive Description + ------------------------------------------------------------------------------ + DELPHI1 Defined when compiling with Delphi 1 (Codename WASABI/MANGO) + DELPHI2 Defined when compiling with Delphi 2 (Codename POLARIS) + DELPHI3 Defined when compiling with Delphi 3 (Codename IVORY) + DELPHI4 Defined when compiling with Delphi 4 (Codename ALLEGRO) + DELPHI5 Defined when compiling with Delphi 5 (Codename ARGUS) + DELPHI6 Defined when compiling with Delphi 6 (Codename ILLIAD) + DELPHI7 Defined when compiling with Delphi 7 (Codename AURORA) + DELPHI8 Defined when compiling with Delphi 8 (Codename OCTANE) + DELPHI2005 Defined when compiling with Delphi 2005 (Codename DIAMONDBACK) + DELPHI9 Alias for DELPHI2005 + DELPHI10 Defined when compiling with Delphi 2006 (Codename DEXTER) + DELPHI2006 Alias for DELPHI10 + DELPHI11 Defined when compiling with Delphi 2007 for Win32 (Codename SPACELY) + DELPHI2007 Alias for DELPHI11 + DELPHI12 Defined when compiling with Delphi 2009 for Win32 (Codename TIBURON) + DELPHI2009 Alias for DELPHI12 + DELPHI14 Defined when compiling with Delphi 2010 for Win32 (Codename WEAVER) + DELPHI2010 Alias for DELPHI14 + DELPHI15 Defined when compiling with Delphi XE for Win32 (Codename FULCRUM) + DELPHIXE Alias for DELPHI15 + DELPHI16 Defined when compiling with Delphi XE2 for Win32 (Codename PULSAR) + DELPHIXE2 Alias for DELPHI16 + DELPHI17 Defined when compiling with Delphi XE3 for Win32 (Codename WATERDRAGON) + DELPHIXE3 Alias for DELPHI17 + DELPHI18 Defined when compiling with Delphi XE4 for Win32 (Codename QUINTESSENCE) + DELPHIXE4 Alias for DELPHI18 + DELPHI19 Defined when compiling with Delphi XE5 for Win32 (Codename ZEPHYR) + DELPHIXE5 Alias for DELPHI19 + DELPHI20 Defined when compiling with Delphi XE6 for Win32 (Codename PROTEUS) + DELPHIXE6 Alias for DELPHI20 + DELPHI21 Defined when compiling with Delphi XE7 for Win32 (Codename CARPATHIA) + DELPHIXE7 Alias for DELPHI21 + DELPHI22 Defined when compiling with Delphi XE8 for Win32 (Codename ELBRUS) + DELPHIXE8 Alias for DELPHI22 + DELPHI23 Defined when compiling with Delphi 10 for Win32 (Codename AITANA) + DELPHIX_SEATTLE Alias for DELPHI23 + DELPHI24 Defined when compiling with Delphi 10.1 for Win32 (Codename BIGBEN) + DELPHIX_BERLIN Alias for DELPHI24 + DELPHI25 Defined when compiling with Delphi 10.2 for Win32 (Codename GODZILLA) + DELPHIX_TOKYO Alias for DELPHI25 + DELPHI1_UP Defined when compiling with Delphi 1 or higher + DELPHI2_UP Defined when compiling with Delphi 2 or higher + DELPHI3_UP Defined when compiling with Delphi 3 or higher + DELPHI4_UP Defined when compiling with Delphi 4 or higher + DELPHI5_UP Defined when compiling with Delphi 5 or higher + DELPHI6_UP Defined when compiling with Delphi 6 or higher + DELPHI7_UP Defined when compiling with Delphi 7 or higher + DELPHI8_UP Defined when compiling with Delphi 8 or higher + DELPHI2005_UP Defined when compiling with Delphi 2005 or higher + DELPHI9_UP Alias for DELPHI2005_UP + DELPHI10_UP Defined when compiling with Delphi 2006 or higher + DELPHI2006_UP Alias for DELPHI10_UP + DELPHI11_UP Defined when compiling with Delphi 2007 for Win32 or higher + DELPHI2007_UP Alias for DELPHI11_UP + DELPHI12_UP Defined when compiling with Delphi 2009 for Win32 or higher + DELPHI2009_UP Alias for DELPHI12_UP + DELPHI14_UP Defined when compiling with Delphi 2010 for Win32 or higher + DELPHI2010_UP Alias for DELPHI14_UP + DELPHI15_UP Defined when compiling with Delphi XE for Win32 or higher + DELPHIXE_UP Alias for DELPHI15_UP + DELPHI16_UP Defined when compiling with Delphi XE2 for Win32 or higher + DELPHIXE2_UP Alias for DELPHI16_UP + DELPHI17_UP Defined when compiling with Delphi XE3 for Win32 or higher + DELPHIXE3_UP Alias for DELPHI17_UP + DELPHI18_UP Defined when compiling with Delphi XE4 for Win32 or higher + DELPHIXE4_UP Alias for DELPHI18_UP + DELPHI19_UP Defined when compiling with Delphi XE5 for Win32 or higher + DELPHIXE5_UP Alias for DELPHI19_UP + DELPHI20_UP Defined when compiling with Delphi XE6 for Win32 or higher + DELPHIXE6_UP Alias for DELPHI20_UP + DELPHI21_UP Defined when compiling with Delphi XE7 for Win32 or higher + DELPHIXE7_UP Alias for DELPHI21_UP + DELPHI22_UP Defined when compiling with Delphi XE8 for Win32 or higher + DELPHIXE8_UP Alias for DELPHI22_UP + DELPHI23_UP Defined when compiling with Delphi 10 for Win32 or higher + DELPHIX_SEATTLE_UP Alias for DELPHI23_UP + DELPHI24_UP Defined when compiling with Delphi 10.1 for Win32 or higher + DELPHIX_BERLIN_UP Alias for DELPHI24_UP + DELPHI25_UP Defined when compiling with Delphi 10.2 for Win32 or higher + DELPHIX_TOKYO_UP Alias for DELPHI25_UP + + +- Kylix Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. These directives are only defined if + the compiler is Kylix (ie KYLIX is defined). + + Directive Description + ------------------------------------------------------------------------------ + KYLIX1 Defined when compiling with Kylix 1 + KYLIX2 Defined when compiling with Kylix 2 + KYLIX3 Defined when compiling with Kylix 3 (Codename CORTEZ) + KYLIX1_UP Defined when compiling with Kylix 1 or higher + KYLIX2_UP Defined when compiling with Kylix 2 or higher + KYLIX3_UP Defined when compiling with Kylix 3 or higher + + +- Delphi Compiler Versions (Delphi / Kylix, not in BCB mode) + + Directive Description + ------------------------------------------------------------------------------ + DELPHICOMPILER1 Defined when compiling with Delphi 1 + DELPHICOMPILER2 Defined when compiling with Delphi 2 + DELPHICOMPILER3 Defined when compiling with Delphi 3 + DELPHICOMPILER4 Defined when compiling with Delphi 4 + DELPHICOMPILER5 Defined when compiling with Delphi 5 + DELPHICOMPILER6 Defined when compiling with Delphi 6 or Kylix 1, 2 or 3 + DELPHICOMPILER7 Defined when compiling with Delphi 7 + DELPHICOMPILER8 Defined when compiling with Delphi 8 + DELPHICOMPILER9 Defined when compiling with Delphi 2005 + DELPHICOMPILER10 Defined when compiling with Delphi Personality of BDS 4.0 + DELPHICOMPILER11 Defined when compiling with Delphi 2007 for Win32 + DELPHICOMPILER12 Defined when compiling with Delphi Personality of BDS 6.0 + DELPHICOMPILER14 Defined when compiling with Delphi Personality of BDS 7.0 + DELPHICOMPILER15 Defined when compiling with Delphi Personality of BDS 8.0 + DELPHICOMPILER16 Defined when compiling with Delphi Personality of BDS 9.0 + DELPHICOMPILER17 Defined when compiling with Delphi Personality of BDS 10.0 + DELPHICOMPILER18 Defined when compiling with Delphi Personality of BDS 11.0 + DELPHICOMPILER19 Defined when compiling with Delphi Personality of BDS 12.0 + DELPHICOMPILER20 Defined when compiling with Delphi Personality of BDS 14.0 + DELPHICOMPILER21 Defined when compiling with Delphi Personality of BDS 15.0 + DELPHICOMPILER22 Defined when compiling with Delphi Personality of BDS 16.0 + DELPHICOMPILER23 Defined when compiling with Delphi Personality of BDS 17.0 + DELPHICOMPILER24 Defined when compiling with Delphi Personality of BDS 18.0 + DELPHICOMPILER25 Defined when compiling with Delphi Personality of BDS 19.0 + DELPHICOMPILER1_UP Defined when compiling with Delphi 1 or higher + DELPHICOMPILER2_UP Defined when compiling with Delphi 2 or higher + DELPHICOMPILER3_UP Defined when compiling with Delphi 3 or higher + DELPHICOMPILER4_UP Defined when compiling with Delphi 4 or higher + DELPHICOMPILER5_UP Defined when compiling with Delphi 5 or higher + DELPHICOMPILER6_UP Defined when compiling with Delphi 6 or Kylix 1, 2 or 3 or higher + DELPHICOMPILER7_UP Defined when compiling with Delphi 7 or higher + DELPHICOMPILER8_UP Defined when compiling with Delphi 8 or higher + DELPHICOMPILER9_UP Defined when compiling with Delphi 2005 + DELPHICOMPILER10_UP Defined when compiling with Delphi 2006 or higher + DELPHICOMPILER11_UP Defined when compiling with Delphi 2007 for Win32 or higher + DELPHICOMPILER12_UP Defined when compiling with Delphi 2009 for Win32 or higher + DELPHICOMPILER14_UP Defined when compiling with Delphi 2010 for Win32 or higher + DELPHICOMPILER15_UP Defined when compiling with Delphi XE for Win32 or higher + DELPHICOMPILER16_UP Defined when compiling with Delphi XE2 for Win32 or higher + DELPHICOMPILER17_UP Defined when compiling with Delphi XE3 for Win32 or higher + DELPHICOMPILER18_UP Defined when compiling with Delphi XE4 for Win32 or higher + DELPHICOMPILER19_UP Defined when compiling with Delphi XE5 for Win32 or higher + DELPHICOMPILER20_UP Defined when compiling with Delphi XE6 for Win32 or higher + DELPHICOMPILER21_UP Defined when compiling with Delphi XE7 for Win32 or higher + DELPHICOMPILER22_UP Defined when compiling with Delphi XE8 for Win32 or higher + DELPHICOMPILER23_UP Defined when compiling with Delphi 10 for Win32 or higher + DELPHICOMPILER24_UP Defined when compiling with Delphi 10.1 for Win32 or higher + DELPHICOMPILER25_UP Defined when compiling with Delphi 10.2 for Win32 or higher + + +- C++Builder Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. These directives are only defined if + the compiler is C++Builder (ie BCB is defined). + + Directive Description + ------------------------------------------------------------------------------ + BCB1 Defined when compiling with C++Builder 1 + BCB3 Defined when compiling with C++Builder 3 + BCB4 Defined when compiling with C++Builder 4 + BCB5 Defined when compiling with C++Builder 5 (Codename RAMPAGE) + BCB6 Defined when compiling with C++Builder 6 (Codename RIPTIDE) + BCB10 Defined when compiling with C++Builder Personality of BDS 4.0 (also known as C++Builder 2006) (Codename DEXTER) + BCB11 Defined when compiling with C++Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) (Codename COGSWELL) + BCB12 Defined when compiling with C++Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) (Codename TIBURON) + BCB14 Defined when compiling with C++Builder Personality of RAD Studio 2010 (also known as C++Builder 2010) (Codename WEAVER) + BCB15 Defined when compiling with C++Builder Personality of RAD Studio XE (also known as C++Builder XE) (Codename FULCRUM) + BCB16 Defined when compiling with C++Builder Personality of RAD Studio XE2 (also known as C++Builder XE2) (Codename PULSAR) + BCB17 Defined when compiling with C++Builder Personality of RAD Studio XE3 (also known as C++Builder XE3) (Codename WATERDRAGON) + BCB18 Defined when compiling with C++Builder Personality of RAD Studio XE4 (also known as C++Builder XE4) (Codename QUINTESSENCE) + BCB19 Defined when compiling with C++Builder Personality of RAD Studio XE5 (also known as C++Builder XE5) (Codename ZEPHYR) + BCB20 Defined when compiling with C++Builder Personality of RAD Studio XE6 (also known as C++Builder XE6) (Codename PROTEUS) + BCB21 Defined when compiling with C++Builder Personality of RAD Studio XE7 (also known as C++Builder XE7) (Codename CARPATHIA) + BCB22 Defined when compiling with C++Builder Personality of RAD Studio XE8 (also known as C++Builder XE8) (Codename ELBRUS) + BCB23 Defined when compiling with C++Builder Personality of RAD Studio 10 Seattle (also known as C++Builder 10 Seattle) (Codename AITANA) + BCB24 Defined when compiling with C++Builder Personality of RAD Studio 10.1 Berlin (also known as C++Builder 10.1 Berlin) (Codename BIGBEN) + BCB25 Defined when compiling with C++Builder Personality of RAD Studio 10.2 Tokyo (also known as C++Builder 10.2 Tokyo) (Codename GODZILLA) + BCB1_UP Defined when compiling with C++Builder 1 or higher + BCB3_UP Defined when compiling with C++Builder 3 or higher + BCB4_UP Defined when compiling with C++Builder 4 or higher + BCB5_UP Defined when compiling with C++Builder 5 or higher + BCB6_UP Defined when compiling with C++Builder 6 or higher + BCB10_UP Defined when compiling with C++Builder Personality of BDS 4.0 or higher + BCB11_UP Defined when compiling with C++Builder Personality of RAD Studio 2007 or higher + BCB12_UP Defined when compiling with C++Builder Personality of RAD Studio 2009 or higher + BCB14_UP Defined when compiling with C++Builder Personality of RAD Studio 2010 or higher + BCB15_UP Defined when compiling with C++Builder Personality of RAD Studio XE or higher + BCB16_UP Defined when compiling with C++Builder Personality of RAD Studio XE2 or higher + BCB17_UP Defined when compiling with C++Builder Personality of RAD Studio XE3 or higher + BCB18_UP Defined when compiling with C++Builder Personality of RAD Studio XE4 or higher + BCB19_UP Defined when compiling with C++Builder Personality of RAD Studio XE5 or higher + BCB20_UP Defined when compiling with C++Builder Personality of RAD Studio XE6 or higher + BCB21_UP Defined when compiling with C++Builder Personality of RAD Studio XE7 or higher + BCB22_UP Defined when compiling with C++Builder Personality of RAD Studio XE8 or higher + BCB23_UP Defined when compiling with C++Builder Personality of RAD Studio 10 or higher + BCB24_UP Defined when compiling with C++Builder Personality of RAD Studio 10.1 or higher + BCB25_UP Defined when compiling with C++Builder Personality of RAD Studio 10.2 or higher + + +- RAD Studio / Borland Developer Studio Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated IDE. These directives are only defined if + the IDE is Borland Developer Studio Version 2 or above. + + Note: Borland Developer Studio 2006 is marketed as Delphi 2006 or C++Builder 2006, + but those provide only different labels for identical content. + + Directive Description + ------------------------------------------------------------------------------ + BDS Defined when compiling with BDS version of dcc32.exe (Codename SIDEWINDER) + BDS2 Defined when compiling with BDS 2.0 (Delphi 8) (Codename OCTANE) + BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) (Codename DIAMONDBACK) + BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) (Codename DEXTER) + BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) (Codename HIGHLANDER) + BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) (Codename TIBURON) + BDS7 Defined when compiling with BDS 7.0 (Embarcadero RAD Studio 2010) (Codename WEAVER) + BDS8 Defined when compiling with BDS 8.0 (Embarcadero RAD Studio XE) (Codename FULCRUM) + BDS9 Defined when compiling with BDS 9.0 (Embarcadero RAD Studio XE2) (Codename PULSAR) + BDS10 Defined when compiling with BDS 10.0 (Embarcadero RAD Studio XE3) (Codename WATERDRAGON) + BDS11 Defined when compiling with BDS 11.0 (Embarcadero RAD Studio XE4) (Codename QUINTESSENCE) + BDS12 Defined when compiling with BDS 12.0 (Embarcadero RAD Studio XE5) (Codename ZEPHYR) + BDS14 Defined when compiling with BDS 14.0 (Embarcadero RAD Studio XE6) (Codename PROTEUS) + BDS15 Defined when compiling with BDS 15.0 (Embarcadero RAD Studio XE7) (Codename CARPATHIA) + BDS16 Defined when compiling with BDS 16.0 (Embarcadero RAD Studio XE8) (Codename ELBRUS) + BDS17 Defined when compiling with BDS 17.0 (Embarcadero RAD Studio 10) (Codename AITANA) + BDS18 Defined when compiling with BDS 18.0 (Embarcadero RAD Studio 10.1) (Codename BIGBEN) + BDS19 Defined when compiling with BDS 19.0 (Embarcadero RAD Studio 10.2) (Codename GODZILLA) + BDS2_UP Defined when compiling with BDS 2.0 or higher + BDS3_UP Defined when compiling with BDS 3.0 or higher + BDS4_UP Defined when compiling with BDS 4.0 or higher + BDS5_UP Defined when compiling with BDS 5.0 or higher + BDS6_UP Defined when compiling with BDS 6.0 or higher + BDS7_UP Defined when compiling with BDS 7.0 or higher + BDS8_UP Defined when compiling with BDS 8.0 or higher + BDS9_UP Defined when compiling with BDS 9.0 or higher + BDS10_UP Defined when compiling with BDS 10.0 or higher + BDS11_UP Defined when compiling with BDS 11.0 or higher + BDS12_UP Defined when compiling with BDS 12.0 or higher + BDS14_UP Defined when compiling with BDS 14.0 or higher + BDS15_UP Defined when compiling with BDS 15.0 or higher + BDS16_UP Defined when compiling with BDS 16.0 or higher + BDS17_UP Defined when compiling with BDS 17.0 or higher + BDS18_UP Defined when compiling with BDS 18.0 or higher + BDS19_UP Defined when compiling with BDS 19.0 or higher + +- Compiler Versions + + The following directives are direct mappings from the VERXXX directives to a + friendly name of the associated compiler. Unlike the DELPHI_X and BCB_X + directives, these directives are indepedent of the development environment. + That is, they are defined regardless of whether compilation takes place using + Delphi or C++Builder. + + Directive Description + ------------------------------------------------------------------------------ + COMPILER1 Defined when compiling with Delphi 1 + COMPILER2 Defined when compiling with Delphi 2 or C++Builder 1 + COMPILER3 Defined when compiling with Delphi 3 + COMPILER35 Defined when compiling with C++Builder 3 + COMPILER4 Defined when compiling with Delphi 4 or C++Builder 4 + COMPILER5 Defined when compiling with Delphi 5 or C++Builder 5 + COMPILER6 Defined when compiling with Delphi 6 or C++Builder 6 + COMPILER7 Defined when compiling with Delphi 7 + COMPILER8 Defined when compiling with Delphi 8 + COMPILER9 Defined when compiling with Delphi 9 + COMPILER10 Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 + COMPILER11 Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 + COMPILER12 Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 + COMPILER14 Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 + COMPILER15 Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 + COMPILER16 Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 + COMPILER17 Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 + COMPILER18 Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 + COMPILER19 Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 + COMPILER20 Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 + COMPILER21 Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 + COMPILER22 Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 + COMPILER23 Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 + COMPILER24 Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 + COMPILER25 Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 + COMPILER1_UP Defined when compiling with Delphi 1 or higher + COMPILER2_UP Defined when compiling with Delphi 2 or C++Builder 1 or higher + COMPILER3_UP Defined when compiling with Delphi 3 or higher + COMPILER35_UP Defined when compiling with C++Builder 3 or higher + COMPILER4_UP Defined when compiling with Delphi 4 or C++Builder 4 or higher + COMPILER5_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher + COMPILER6_UP Defined when compiling with Delphi 6 or C++Builder 6 or higher + COMPILER7_UP Defined when compiling with Delphi 7 + COMPILER8_UP Defined when compiling with Delphi 8 + COMPILER9_UP Defined when compiling with Delphi Personalities of BDS 3.0 + COMPILER10_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher + COMPILER11_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher + COMPILER12_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher + COMPILER14_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher + COMPILER15_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher + COMPILER16_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher + COMPILER17_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher + COMPILER18_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 or higher + COMPILER19_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 or higher + COMPILER20_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 or higher + COMPILER21_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 or higher + COMPILER22_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 or higher + COMPILER23_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 or higher + COMPILER24_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 or higher + COMPILER25_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 or higher + + +- RTL Versions + + Use e.g. following to determine the exact RTL version since version 14.0: + {$IFDEF CONDITIONALEXPRESSIONS} + {$IF Declared(RTLVersion) and (RTLVersion >= 14.2)} + // code for Delphi 6.02 or higher, Kylix 2 or higher, C++Builder 6 or higher + ... + {$IFEND} + {$ENDIF} + + Directive Description + ------------------------------------------------------------------------------ + RTL80_UP Defined when compiling with Delphi 1 or higher + RTL90_UP Defined when compiling with Delphi 2 or higher + RTL93_UP Defined when compiling with C++Builder 1 or higher + RTL100_UP Defined when compiling with Delphi 3 or higher + RTL110_UP Defined when compiling with C++Builder 3 or higher + RTL120_UP Defined when compiling with Delphi 4 or higher + RTL125_UP Defined when compiling with C++Builder 4 or higher + RTL130_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher + RTL140_UP Defined when compiling with Delphi 6, Kylix 1, 2 or 3 or C++Builder 6 or higher + RTL150_UP Defined when compiling with Delphi 7 or higher + RTL160_UP Defined when compiling with Delphi 8 or higher + RTL170_UP Defined when compiling with Delphi Personalities of BDS 3.0 or higher + RTL180_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher + RTL185_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher + RTL190_UP Defined when compiling with Delphi.NET of BDS 5.0 or higher + RTL200_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher + RTL210_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher + RTL220_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher + RTL230_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher + RTL240_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher + RTL250_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 or higher + RTL260_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 or higher + RTL270_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 or higher + RTL280_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 or higher + RTL290_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 or higher + RTL300_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 or higher + RTL310_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 or higher + RTL320_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 or higher + + +- CLR Versions + + Directive Description + ------------------------------------------------------------------------------ + CLR Defined when compiling for .NET + CLR10 Defined when compiling for .NET 1.0 (may be overriden by FORCE_CLR10) + CLR10_UP Defined when compiling for .NET 1.0 or higher + CLR11 Defined when compiling for .NET 1.1 (may be overriden by FORCE_CLR11) + CLR11_UP Defined when compiling for .NET 1.1 or higher + CLR20 Defined when compiling for .NET 2.0 (may be overriden by FORCE_CLR20) + CLR20_UP Defined when compiling for .NET 2.0 or higher + + +- Feature Directives + + The features directives are used to test if the compiler supports specific + features, such as method overloading, and adjust the sources accordingly. Use + of these directives is preferred over the use of the DELPHI and COMPILER + directives. + + Directive Description + ------------------------------------------------------------------------------ + SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+) + SUPPORTS_SINGLE Compiler supports the Single type (D1+) + SUPPORTS_DOUBLE Compiler supports the Double type (D1+) + SUPPORTS_EXTENDED Compiler supports the Extended type (D1+) + SUPPORTS_CURRENCY Compiler supports the Currency type (D2+) + SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+) + SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+) + SUPPORTS_VARIANT Compiler supports variant (D2+) + SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+) + SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+) + SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+) + SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+) + SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC) + SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+) + SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+) + SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+) + SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+) + SUPPORTS_UINT64 Compiler supports the UInt64 type (D7+) + SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+) + SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+) + SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+) + SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+) + SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+) + SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+) + SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC) + SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+) + SUPPORTS_SETPEFLAGS Compiler supports the SetPEFlags directive (D6+/BCB6+) + SUPPORTS_EXPERIMENTAL_WARNINGS Compiler supports the WARN SYMBOL_EXPERIMENTAL and WARN UNIT_EXPERIMENTAL directives (D6+/BCB6+) + SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC) + SUPPORTS_FOR_IN Compiler supports for in loops (D9+) + SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+) + SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+) + SUPPORTS_REGION Compiler supports the REGION and ENDREGION directives (D9+) + SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+) + SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+) + SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+) + SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+) + SUPPORTS_CLASS_CTORDTORS Compiler supports class contructors/destructors (D14+) + SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+) + SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+) + SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+) + SUPPORTS_METHODINFO Compiler supports the METHODINFO directives (D10+) + SUPPORTS_GENERICS Compiler supports generic implementations (D11.NET, D12+) + SUPPORTS_DEPRECATED_DETAILS Compiler supports additional text for the deprecated directive (D11.NET, D12+) + ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC) + ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC) + ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+) + SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+) + SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+) + SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+) + SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+) + SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+) + SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+) + SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7) + SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive + SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive + SUPPORTS_PACKAGES Compiler supports Packages + HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86) + HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC) + HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC) + HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC) + HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC) + HAS_UNIT_HTTPPROD Unit HTTPProd exists (D9+) + HAS_UNIT_GIFIMG Unit GifImg exists (D11+) + HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+) + HAS_UNIT_PNGIMAGE Unit PngImage exists (D12+) + HAS_UNIT_CHARACTER Unit Character exists (D12+) + XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC) + SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.NET, D12+) + SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+) + SUPPORTS_INT_ALIASES Types Int8, Int16, Int32, UInt8, UInt16 and UInt32 are defined in the unit System (D12+) + HAS_UNIT_RTTI Unit RTTI is available (D14+) + SUPPORTS_CAST_INTERFACE_TO_OBJ The compiler supports casts from interfaces to objects (D14+) + SUPPORTS_DELAYED_LOADING The compiler generates stubs for delaying imported function loads (D14+) + HAS_UNIT_REGULAREXPRESSIONSAPI Unit RegularExpressionsAPI is available (D15+) + HAS_UNIT_SYSTEM_UITYPES Unit System.UITypes is available (D16+) + HAS_UNIT_SYSTEM_ACTIONS Unit System.Actions is available (D17+) + DEPRECATED_SYSUTILS_ANSISTRINGS AnsiString functions from SysUtils are deprecated and moved to System.AnsiStrings (D18+) + HAS_PROPERTY_STYLEELEMENTS TControl has a StyleElements property (D17+) + HAS_AUTOMATIC_DB_FIELDS Database fields are automatically created/refreshed (D20+) + HAS_EARGUMENTEXCEPTION Exception class EArgumentException is available (D14+) + HAS_ENOTIMPLEMENTED Exception class ENotImplemented is available (D15+) + HAS_UNIT_VCL_THEMES Unit Vcl.Themes is available (D16+) + HAS_UNIT_UXTHEME Unit (Vcl.)UxTheme is available (D7+) + HAS_EXCEPTION_STACKTRACE Exception class has the StackTrace propery (D12+) + + +- Compiler Settings + + The compiler settings directives indicate whether a specific compiler setting + is in effect. This facilitates changing compiler settings locally in a more + compact and readible manner. + + Directive Description + ------------------------------------------------------------------------------ + ALIGN_ON Compiling in the A+ state (no alignment) + BOOLEVAL_ON Compiling in the B+ state (complete boolean evaluation) + ASSERTIONS_ON Compiling in the C+ state (assertions on) + DEBUGINFO_ON Compiling in the D+ state (debug info generation on) + IMPORTEDDATA_ON Compiling in the G+ state (creation of imported data references) + LONGSTRINGS_ON Compiling in the H+ state (string defined as AnsiString) + IOCHECKS_ON Compiling in the I+ state (I/O checking enabled) + WRITEABLECONST_ON Compiling in the J+ state (typed constants can be modified) + LOCALSYMBOLS Compiling in the L+ state (local symbol generation) + LOCALSYMBOLS_ON Alias of LOCALSYMBOLS + TYPEINFO_ON Compiling in the M+ state (RTTI generation on) + OPTIMIZATION_ON Compiling in the O+ state (code optimization on) + OPENSTRINGS_ON Compiling in the P+ state (variable string parameters are openstrings) + OVERFLOWCHECKS_ON Compiling in the Q+ state (overflow checing on) + RANGECHECKS_ON Compiling in the R+ state (range checking on) + TYPEDADDRESS_ON Compiling in the T+ state (pointers obtained using the @ operator are typed) + SAFEDIVIDE_ON Compiling in the U+ state (save FDIV instruction through RTL emulation) + VARSTRINGCHECKS_ON Compiling in the V+ state (type checking of shortstrings) + STACKFRAMES_ON Compiling in the W+ state (generation of stack frames) + EXTENDEDSYNTAX_ON Compiling in the X+ state (Delphi extended syntax enabled) +*) + +{$DEFINE BORLAND} + +{ Set FreePascal to Delphi mode } +{$IFDEF FPC} + {$MODE DELPHI} + {$ASMMODE Intel} + {$UNDEF BORLAND} + {$DEFINE CPUASM} + // FPC defines CPU32, CPU64 and Unix automatically +{$ENDIF} + +{$IFDEF BORLAND} + {$IFDEF LINUX} + {$DEFINE KYLIX} + {$ENDIF LINUX} + {$IFNDEF CLR} + {$IFNDEF CPUX86} + // CPUX86 is not defined, which means it most likely is a 64 bits compiler. + // However, this is only the case if either of two other symbols are defined: + // http://docwiki.embarcadero.com/RADStudio/Seattle/en/Conditional_compilation_%28Delphi%29 + {$DEFINE CPU64} + {$DEFINE DELPHI64_TEMPORARY} + {$IFNDEF CPUX64} + {$IFNDEF CPU64BITS} + {$DEFINE CPU386} // None of the two 64-bits symbols are defined, assume this is 32-bit + {$DEFINE CPU32} + {$UNDEF CPU64} + {$UNDEF DELPHI64_TEMPORARY} + {$ENDIF ~CPU64BITS} + {$ENDIF ~CPUX64} + {$ELSE ~CPUX86} + {$DEFINE CPU386} + {$DEFINE CPU32} + {$ENDIF ~CPUX86} + + // The ASSEMBLER symbol appeared with Delphi 7 + {$IFNDEF COMPILER7_UP} + {$DEFINE CPUASM} + {$ELSE} + {$IFDEF ASSEMBLER} + {$DEFINE CPUASM} + {$ENDIF ASSEMBLER} + {$ENDIF ~COMPILER7_UP} + {$ENDIF ~CLR} +{$ENDIF BORLAND} + +{------------------------------------------------------------------------------} +{ VERXXX to COMPILERX, DELPHIX and BCBX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF BORLAND} + {$IFDEF KYLIX} + {$I kylix.inc} // FPC incompatible stuff + {$ELSE ~KYLIX} + + {$DEFINE UNKNOWN_COMPILER_VERSION} + + {$IFDEF VER80} + {$DEFINE COMPILER1} + {$DEFINE DELPHI1} + {$DEFINE DELPHICOMPILER1} + {$DEFINE RTL80_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER90} + {$DEFINE COMPILER2} + {$DEFINE DELPHI2} + {$DEFINE DELPHICOMPILER2} + {$DEFINE RTL90_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER93} + {$DEFINE COMPILER2} + {$DEFINE BCB1} + {$DEFINE BCB} + {$DEFINE RTL93_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER100} + {$DEFINE COMPILER3} + {$DEFINE DELPHI3} + {$DEFINE DELPHICOMPILER3} + {$DEFINE RTL100_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER110} + {$DEFINE COMPILER35} + {$DEFINE BCB3} + {$DEFINE BCB} + {$DEFINE RTL110_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER120} + {$DEFINE COMPILER4} + {$DEFINE DELPHI4} + {$DEFINE DELPHICOMPILER4} + {$DEFINE RTL120_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER125} + {$DEFINE COMPILER4} + {$DEFINE BCB4} + {$DEFINE BCB} + {$DEFINE RTL125_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER130} + {$DEFINE COMPILER5} + {$IFDEF BCB} + {$DEFINE BCB5} + {$ELSE} + {$DEFINE DELPHI5} + {$DEFINE DELPHICOMPILER5} + {$ENDIF} + {$DEFINE RTL130_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER140} + {$DEFINE COMPILER6} + {$IFDEF BCB} + {$DEFINE BCB6} + {$ELSE} + {$DEFINE DELPHI6} + {$DEFINE DELPHICOMPILER6} + {$ENDIF} + {$DEFINE RTL140_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER150} + {$DEFINE COMPILER7} + {$DEFINE DELPHI7} + {$DEFINE DELPHICOMPILER7} + {$DEFINE RTL150_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER160} + {$DEFINE BDS2} + {$DEFINE BDS} + {$IFDEF CLR} + {$DEFINE CLR10} + {$ENDIF CLR} + {$DEFINE COMPILER8} + {$DEFINE DELPHI8} + {$DEFINE DELPHICOMPILER8} + {$DEFINE RTL160_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER170} + {$DEFINE BDS3} + {$DEFINE BDS} + {$IFDEF CLR} + {$DEFINE CLR11} + {$ENDIF CLR} + {$DEFINE COMPILER9} + {$DEFINE DELPHI9} + {$DEFINE DELPHI2005} // synonym to DELPHI9 + {$DEFINE DELPHICOMPILER9} + {$DEFINE RTL170_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER180} + {$DEFINE BDS} + {$IFDEF CLR} + {$DEFINE CLR11} + {$ENDIF CLR} + {$IFDEF VER185} + {$DEFINE BDS5} + {$DEFINE COMPILER11} + {$IFDEF BCB} + {$DEFINE BCB11} + {$ELSE} + {$DEFINE DELPHI11} + {$DEFINE DELPHI2007} // synonym to DELPHI11 + {$DEFINE DELPHICOMPILER11} + {$ENDIF} + {$DEFINE RTL185_UP} + {$ELSE ~~VER185} + {$DEFINE BDS4} + {$DEFINE COMPILER10} + {$IFDEF BCB} + {$DEFINE BCB10} + {$ELSE} + {$DEFINE DELPHI10} + {$DEFINE DELPHI2006} // synonym to DELPHI10 + {$DEFINE DELPHICOMPILER10} + {$ENDIF} + {$DEFINE RTL180_UP} + {$ENDIF ~VER185} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$IFDEF VER190} // Delphi 2007 for .NET + {$DEFINE BDS} + {$DEFINE BDS5} + {$IFDEF CLR} + {$DEFINE CLR20} + {$ENDIF CLR} + {$DEFINE COMPILER11} + {$DEFINE DELPHI11} + {$DEFINE DELPHI2007} // synonym to DELPHI11 + {$DEFINE DELPHICOMPILER11} + {$DEFINE RTL190_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER190} + + {$IFDEF VER200} // RAD Studio 2009 + {$DEFINE BDS} + {$DEFINE BDS6} + {$IFDEF CLR} + {$DEFINE CLR20} + {$ENDIF CLR} + {$DEFINE COMPILER12} + {$IFDEF BCB} + {$DEFINE BCB12} + {$ELSE} + {$DEFINE DELPHI12} + {$DEFINE DELPHI2009} // synonym to DELPHI12 + {$DEFINE DELPHICOMPILER12} + {$ENDIF BCB} + {$IFDEF CLR} + {$DEFINE RTL190_UP} + {$ELSE} + {$DEFINE RTL200_UP} + {$ENDIF} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER200} + + {$IFDEF VER210} // RAD Studio 2010 + {$DEFINE BDS} + {$DEFINE BDS7} + {$DEFINE COMPILER14} + {$IFDEF BCB} + {$DEFINE BCB14} + {$ELSE} + {$DEFINE DELPHI14} + {$DEFINE DELPHI2010} // synonym to DELPHI14 + {$DEFINE DELPHICOMPILER14} + {$ENDIF BCB} + {$DEFINE RTL210_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER210} + + {$IFDEF VER220} // RAD Studio XE + {$DEFINE BDS} + {$DEFINE BDS8} + {$DEFINE COMPILER15} + {$IFDEF BCB} + {$DEFINE BCB15} + {$ELSE} + {$DEFINE DELPHI15} + {$DEFINE DELPHIXE} // synonym to DELPHI15 + {$DEFINE DELPHICOMPILER15} + {$ENDIF BCB} + {$DEFINE RTL220_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER220} + + {$IFDEF VER230} // RAD Studio XE2 + {$DEFINE BDS} + {$DEFINE BDS9} + {$DEFINE COMPILER16} + {$IFDEF BCB} + {$DEFINE BCB16} + {$ELSE} + {$DEFINE DELPHI16} + {$DEFINE DELPHIXE2} // synonym to DELPHI16 + {$DEFINE DELPHICOMPILER16} + {$ENDIF BCB} + {$DEFINE RTL230_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER230} + + {$IFDEF VER240} // RAD Studio XE3 + {$DEFINE BDS} + {$DEFINE BDS10} + {$DEFINE COMPILER17} + {$IFDEF BCB} + {$DEFINE BCB17} + {$ELSE} + {$DEFINE DELPHI17} + {$DEFINE DELPHIXE3} // synonym to DELPHI17 + {$DEFINE DELPHICOMPILER17} + {$ENDIF BCB} + {$DEFINE RTL240_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER240} + + {$IFDEF VER250} // RAD Studio XE4 + {$DEFINE BDS} + {$DEFINE BDS11} + {$DEFINE COMPILER18} + {$IFDEF BCB} + {$DEFINE BCB18} + {$ELSE} + {$DEFINE DELPHI18} + {$DEFINE DELPHIXE4} // synonym to DELPHI18 + {$DEFINE DELPHICOMPILER18} + {$ENDIF BCB} + {$DEFINE RTL250_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER250} + + {$IFDEF VER260} // RAD Studio XE5 + {$DEFINE BDS} + {$DEFINE BDS12} + {$DEFINE COMPILER19} + {$IFDEF BCB} + {$DEFINE BCB19} + {$ELSE} + {$DEFINE DELPHI19} + {$DEFINE DELPHIXE5} // synonym to DELPHI19 + {$DEFINE DELPHICOMPILER19} + {$ENDIF BCB} + {$DEFINE RTL260_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER260} + + {$IFDEF VER270} // RAD Studio XE6 + {$DEFINE BDS} + {$DEFINE BDS14} + {$DEFINE COMPILER20} + {$IFDEF BCB} + {$DEFINE BCB20} + {$ELSE} + {$DEFINE DELPHI20} + {$DEFINE DELPHIXE6} // synonym to DELPHI20 + {$DEFINE DELPHICOMPILER20} + {$ENDIF BCB} + {$DEFINE RTL270_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER270} + + {$IFDEF VER280} // RAD Studio XE7 + {$DEFINE BDS} + {$DEFINE BDS15} + {$DEFINE COMPILER21} + {$IFDEF BCB} + {$DEFINE BCB21} + {$ELSE} + {$DEFINE DELPHI21} + {$DEFINE DELPHIXE7} // synonym to DELPHI21 + {$DEFINE DELPHICOMPILER21} + {$ENDIF BCB} + {$DEFINE RTL280_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER280} + + {$IFDEF VER290} // RAD Studio XE8 + {$DEFINE BDS} + {$DEFINE BDS16} + {$DEFINE COMPILER22} + {$IFDEF BCB} + {$DEFINE BCB22} + {$ELSE} + {$DEFINE DELPHI22} + {$DEFINE DELPHIXE8} // synonym to DELPHI22 + {$DEFINE DELPHICOMPILER22} + {$ENDIF BCB} + {$DEFINE RTL290_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER290} + + {$IFDEF VER300} // RAD Studio 10 + {$DEFINE BDS} + {$DEFINE BDS17} + {$DEFINE COMPILER23} + {$IFDEF BCB} + {$DEFINE BCB23} + {$ELSE} + {$DEFINE DELPHI23} + {$DEFINE DELPHIX_SEATTLE} // synonym to DELPHI23 + {$DEFINE DELPHICOMPILER23} + {$ENDIF BCB} + {$DEFINE RTL300_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER300} + + {$IFDEF VER310} // RAD Studio 10.1 + {$DEFINE BDS} + {$DEFINE BDS18} + {$DEFINE COMPILER24} + {$IFDEF BCB} + {$DEFINE BCB24} + {$ELSE} + {$DEFINE DELPHI24} + {$DEFINE DELPHIX_BERLIN} // synonym to DELPHI24 + {$DEFINE DELPHICOMPILER24} + {$ENDIF BCB} + {$DEFINE RTL310_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER310} + + {$IFDEF VER320} // RAD Studio 10.2 + {$DEFINE BDS} + {$DEFINE BDS19} + {$DEFINE COMPILER25} + {$IFDEF BCB} + {$DEFINE BCB25} + {$ELSE} + {$DEFINE DELPHI25} + {$DEFINE DELPHIX_TOKYO} // synonym to DELPHI25 + {$DEFINE DELPHICOMPILER25} + {$ENDIF BCB} + {$DEFINE RTL320_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER320} + + {$IFDEF UNKNOWN_COMPILER_VERSION} // adjust for newer version (always use latest version) + {$DEFINE BDS} + {$DEFINE BDS19} + {$DEFINE COMPILER25} + {$IFDEF BCB} + {$DEFINE BCB25} + {$ELSE} + {$DEFINE DELPHI25} + {$DEFINE DELPHICOMPILER25} + {$ENDIF BCB} + {$DEFINE RTL320_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF} + + {$ENDIF ~KYLIX} + + {$IFDEF BCB} + {$DEFINE CPPBUILDER} + {$DEFINE BCBCOMPILER} + {$ELSE ~BCB} + {$DEFINE DELPHI} + {$DEFINE DELPHICOMPILER} + {$ENDIF ~BCB} + +{$ENDIF BORLAND} + +{------------------------------------------------------------------------------} +{ DELPHIX_UP from DELPHIX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF DELPHI25} {$DEFINE DELPHI25_UP} {$ENDIF} +{$IFDEF DELPHI24} {$DEFINE DELPHI24_UP} {$ENDIF} +{$IFDEF DELPHI23} {$DEFINE DELPHI23_UP} {$ENDIF} +{$IFDEF DELPHI22} {$DEFINE DELPHI22_UP} {$ENDIF} +{$IFDEF DELPHI21} {$DEFINE DELPHI21_UP} {$ENDIF} +{$IFDEF DELPHI20} {$DEFINE DELPHI20_UP} {$ENDIF} +{$IFDEF DELPHI19} {$DEFINE DELPHI19_UP} {$ENDIF} +{$IFDEF DELPHI18} {$DEFINE DELPHI18_UP} {$ENDIF} +{$IFDEF DELPHI17} {$DEFINE DELPHI17_UP} {$ENDIF} +{$IFDEF DELPHI16} {$DEFINE DELPHI16_UP} {$ENDIF} +{$IFDEF DELPHI15} {$DEFINE DELPHI15_UP} {$ENDIF} +{$IFDEF DELPHI14} {$DEFINE DELPHI14_UP} {$ENDIF} +{$IFDEF DELPHI12} {$DEFINE DELPHI12_UP} {$ENDIF} +{$IFDEF DELPHI11} {$DEFINE DELPHI11_UP} {$ENDIF} +{$IFDEF DELPHI10} {$DEFINE DELPHI10_UP} {$ENDIF} +{$IFDEF DELPHI9} {$DEFINE DELPHI9_UP} {$ENDIF} +{$IFDEF DELPHI8} {$DEFINE DELPHI8_UP} {$ENDIF} +{$IFDEF DELPHI7} {$DEFINE DELPHI7_UP} {$ENDIF} +{$IFDEF DELPHI6} {$DEFINE DELPHI6_UP} {$ENDIF} +{$IFDEF DELPHI5} {$DEFINE DELPHI5_UP} {$ENDIF} +{$IFDEF DELPHI4} {$DEFINE DELPHI4_UP} {$ENDIF} +{$IFDEF DELPHI3} {$DEFINE DELPHI3_UP} {$ENDIF} +{$IFDEF DELPHI2} {$DEFINE DELPHI2_UP} {$ENDIF} +{$IFDEF DELPHI1} {$DEFINE DELPHI1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ DELPHIX_UP from DELPHIX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF DELPHI25_UP} + {$DEFINE DELPHIX_TOKYO_UP} // synonym to DELPHI25_UP + {$DEFINE DELPHI24_UP} +{$ENDIF} + +{$IFDEF DELPHI24_UP} + {$DEFINE DELPHIX_BERLIN_UP} // synonym to DELPHI24_UP + {$DEFINE DELPHI23_UP} +{$ENDIF} + +{$IFDEF DELPHI23_UP} + {$DEFINE DELPHIX_SEATTLE_UP} // synonym to DELPHI23_UP + {$DEFINE DELPHI22_UP} +{$ENDIF} + +{$IFDEF DELPHI22_UP} + {$DEFINE DELPHIXE8_UP} // synonym to DELPHI22_UP + {$DEFINE DELPHI21_UP} +{$ENDIF} + +{$IFDEF DELPHI21_UP} + {$DEFINE DELPHIXE7_UP} // synonym to DELPHI21_UP + {$DEFINE DELPHI20_UP} +{$ENDIF} + +{$IFDEF DELPHI20_UP} + {$DEFINE DELPHIXE6_UP} // synonym to DELPHI20_UP + {$DEFINE DELPHI19_UP} +{$ENDIF} + +{$IFDEF DELPHI19_UP} + {$DEFINE DELPHIXE5_UP} // synonym to DELPHI19_UP + {$DEFINE DELPHI18_UP} +{$ENDIF} + +{$IFDEF DELPHI18_UP} + {$DEFINE DELPHIXE4_UP} // synonym to DELPHI18_UP + {$DEFINE DELPHI17_UP} +{$ENDIF} + +{$IFDEF DELPHI17_UP} + {$DEFINE DELPHIXE3_UP} // synonym to DELPHI17_UP + {$DEFINE DELPHI16_UP} +{$ENDIF} + +{$IFDEF DELPHI16_UP} + {$DEFINE DELPHIXE2_UP} // synonym to DELPHI16_UP + {$DEFINE DELPHI15_UP} +{$ENDIF} + +{$IFDEF DELPHI15_UP} + {$DEFINE DELPHIXE_UP} // synonym to DELPHI15_UP + {$DEFINE DELPHI14_UP} +{$ENDIF} + +{$IFDEF DELPHI14_UP} + {$DEFINE DELPHI2010_UP} // synonym to DELPHI14_UP + {$DEFINE DELPHI12_UP} +{$ENDIF} + +{$IFDEF DELPHI12_UP} + {$DEFINE DELPHI2009_UP} // synonym to DELPHI12_UP + {$DEFINE DELPHI11_UP} +{$ENDIF} + +{$IFDEF DELPHI11_UP} + {$DEFINE DELPHI2007_UP} // synonym to DELPHI11_UP + {$DEFINE DELPHI10_UP} +{$ENDIF} + +{$IFDEF DELPHI10_UP} + {$DEFINE DELPHI2006_UP} // synonym to DELPHI10_UP + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE DELPHI2005_UP} // synonym to DELPHI9_UP + {$DEFINE DELPHI8_UP} +{$ENDIF} + +{$IFDEF DELPHI8_UP} {$DEFINE DELPHI7_UP} {$ENDIF} +{$IFDEF DELPHI7_UP} {$DEFINE DELPHI6_UP} {$ENDIF} +{$IFDEF DELPHI6_UP} {$DEFINE DELPHI5_UP} {$ENDIF} +{$IFDEF DELPHI5_UP} {$DEFINE DELPHI4_UP} {$ENDIF} +{$IFDEF DELPHI4_UP} {$DEFINE DELPHI3_UP} {$ENDIF} +{$IFDEF DELPHI3_UP} {$DEFINE DELPHI2_UP} {$ENDIF} +{$IFDEF DELPHI2_UP} {$DEFINE DELPHI1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ BCBX_UP from BCBX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF BCB25} {$DEFINE BCB25_UP} {$ENDIF} +{$IFDEF BCB24} {$DEFINE BCB24_UP} {$ENDIF} +{$IFDEF BCB23} {$DEFINE BCB23_UP} {$ENDIF} +{$IFDEF BCB22} {$DEFINE BCB22_UP} {$ENDIF} +{$IFDEF BCB21} {$DEFINE BCB21_UP} {$ENDIF} +{$IFDEF BCB20} {$DEFINE BCB20_UP} {$ENDIF} +{$IFDEF BCB19} {$DEFINE BCB19_UP} {$ENDIF} +{$IFDEF BCB18} {$DEFINE BCB18_UP} {$ENDIF} +{$IFDEF BCB17} {$DEFINE BCB17_UP} {$ENDIF} +{$IFDEF BCB16} {$DEFINE BCB16_UP} {$ENDIF} +{$IFDEF BCB15} {$DEFINE BCB15_UP} {$ENDIF} +{$IFDEF BCB14} {$DEFINE BCB14_UP} {$ENDIF} +{$IFDEF BCB12} {$DEFINE BCB12_UP} {$ENDIF} +{$IFDEF BCB11} {$DEFINE BCB11_UP} {$ENDIF} +{$IFDEF BCB10} {$DEFINE BCB10_UP} {$ENDIF} +{$IFDEF BCB6} {$DEFINE BCB6_UP} {$ENDIF} +{$IFDEF BCB5} {$DEFINE BCB5_UP} {$ENDIF} +{$IFDEF BCB4} {$DEFINE BCB4_UP} {$ENDIF} +{$IFDEF BCB3} {$DEFINE BCB3_UP} {$ENDIF} +{$IFDEF BCB1} {$DEFINE BCB1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ BCBX_UP from BCBX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF BCB25_UP} {$DEFINE BCB24_UP} {$ENDIF} +{$IFDEF BCB24_UP} {$DEFINE BCB23_UP} {$ENDIF} +{$IFDEF BCB23_UP} {$DEFINE BCB22_UP} {$ENDIF} +{$IFDEF BCB22_UP} {$DEFINE BCB21_UP} {$ENDIF} +{$IFDEF BCB21_UP} {$DEFINE BCB20_UP} {$ENDIF} +{$IFDEF BCB20_UP} {$DEFINE BCB19_UP} {$ENDIF} +{$IFDEF BCB19_UP} {$DEFINE BCB18_UP} {$ENDIF} +{$IFDEF BCB18_UP} {$DEFINE BCB17_UP} {$ENDIF} +{$IFDEF BCB17_UP} {$DEFINE BCB16_UP} {$ENDIF} +{$IFDEF BCB16_UP} {$DEFINE BCB15_UP} {$ENDIF} +{$IFDEF BCB15_UP} {$DEFINE BCB14_UP} {$ENDIF} +{$IFDEF BCB14_UP} {$DEFINE BCB12_UP} {$ENDIF} +{$IFDEF BCB12_UP} {$DEFINE BCB11_UP} {$ENDIF} +{$IFDEF BCB11_UP} {$DEFINE BCB10_UP} {$ENDIF} +{$IFDEF BCB10_UP} {$DEFINE BCB6_UP} {$ENDIF} +{$IFDEF BCB6_UP} {$DEFINE BCB5_UP} {$ENDIF} +{$IFDEF BCB5_UP} {$DEFINE BCB4_UP} {$ENDIF} +{$IFDEF BCB4_UP} {$DEFINE BCB3_UP} {$ENDIF} +{$IFDEF BCB3_UP} {$DEFINE BCB1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ BDSX_UP from BDSX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF BDS19} {$DEFINE BDS19_UP} {$ENDIF} +{$IFDEF BDS18} {$DEFINE BDS18_UP} {$ENDIF} +{$IFDEF BDS17} {$DEFINE BDS17_UP} {$ENDIF} +{$IFDEF BDS16} {$DEFINE BDS16_UP} {$ENDIF} +{$IFDEF BDS15} {$DEFINE BDS15_UP} {$ENDIF} +{$IFDEF BDS14} {$DEFINE BDS14_UP} {$ENDIF} +{$IFDEF BDS12} {$DEFINE BDS12_UP} {$ENDIF} +{$IFDEF BDS11} {$DEFINE BDS11_UP} {$ENDIF} +{$IFDEF BDS10} {$DEFINE BDS10_UP} {$ENDIF} +{$IFDEF BDS9} {$DEFINE BDS9_UP} {$ENDIF} +{$IFDEF BDS8} {$DEFINE BDS8_UP} {$ENDIF} +{$IFDEF BDS7} {$DEFINE BDS7_UP} {$ENDIF} +{$IFDEF BDS6} {$DEFINE BDS6_UP} {$ENDIF} +{$IFDEF BDS5} {$DEFINE BDS5_UP} {$ENDIF} +{$IFDEF BDS4} {$DEFINE BDS4_UP} {$ENDIF} +{$IFDEF BDS3} {$DEFINE BDS3_UP} {$ENDIF} +{$IFDEF BDS2} {$DEFINE BDS2_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ BDSX_UP from BDSX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF BDS19_UP} {$DEFINE BDS18_UP} {$ENDIF} +{$IFDEF BDS18_UP} {$DEFINE BDS17_UP} {$ENDIF} +{$IFDEF BDS17_UP} {$DEFINE BDS16_UP} {$ENDIF} +{$IFDEF BDS16_UP} {$DEFINE BDS15_UP} {$ENDIF} +{$IFDEF BDS15_UP} {$DEFINE BDS14_UP} {$ENDIF} +{$IFDEF BDS14_UP} {$DEFINE BDS12_UP} {$ENDIF} +{$IFDEF BDS12_UP} {$DEFINE BDS11_UP} {$ENDIF} +{$IFDEF BDS11_UP} {$DEFINE BDS10_UP} {$ENDIF} +{$IFDEF BDS10_UP} {$DEFINE BDS9_UP} {$ENDIF} +{$IFDEF BDS9_UP} {$DEFINE BDS8_UP} {$ENDIF} +{$IFDEF BDS8_UP} {$DEFINE BDS7_UP} {$ENDIF} +{$IFDEF BDS7_UP} {$DEFINE BDS6_UP} {$ENDIF} +{$IFDEF BDS6_UP} {$DEFINE BDS5_UP} {$ENDIF} +{$IFDEF BDS5_UP} {$DEFINE BDS4_UP} {$ENDIF} +{$IFDEF BDS4_UP} {$DEFINE BDS3_UP} {$ENDIF} +{$IFDEF BDS3_UP} {$DEFINE BDS2_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ DELPHICOMPILERX_UP from DELPHICOMPILERX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF DELPHICOMPILER25} {$DEFINE DELPHICOMPILER25_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER24} {$DEFINE DELPHICOMPILER24_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER23} {$DEFINE DELPHICOMPILER23_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER22} {$DEFINE DELPHICOMPILER22_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER21} {$DEFINE DELPHICOMPILER21_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER20} {$DEFINE DELPHICOMPILER20_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER19} {$DEFINE DELPHICOMPILER19_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER18} {$DEFINE DELPHICOMPILER18_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER17} {$DEFINE DELPHICOMPILER17_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER16} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER15} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER14} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER12} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER11} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER10} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER9} {$DEFINE DELPHICOMPILER9_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER8} {$DEFINE DELPHICOMPILER8_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER7} {$DEFINE DELPHICOMPILER7_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER6} {$DEFINE DELPHICOMPILER6_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER5} {$DEFINE DELPHICOMPILER5_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER4} {$DEFINE DELPHICOMPILER4_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER3} {$DEFINE DELPHICOMPILER3_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER2} {$DEFINE DELPHICOMPILER2_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER1} {$DEFINE DELPHICOMPILER1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ DELPHICOMPILERX_UP from DELPHICOMPILERX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF DELPHICOMPILER25_UP} {$DEFINE DELPHICOMPILER24_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER24_UP} {$DEFINE DELPHICOMPILER23_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER23_UP} {$DEFINE DELPHICOMPILER22_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER22_UP} {$DEFINE DELPHICOMPILER21_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER21_UP} {$DEFINE DELPHICOMPILER20_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER20_UP} {$DEFINE DELPHICOMPILER19_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER19_UP} {$DEFINE DELPHICOMPILER18_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER18_UP} {$DEFINE DELPHICOMPILER17_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER17_UP} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER16_UP} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER15_UP} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER14_UP} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER12_UP} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER11_UP} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER10_UP} {$DEFINE DELPHICOMPILER9_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER9_UP} {$DEFINE DELPHICOMPILER8_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER8_UP} {$DEFINE DELPHICOMPILER7_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER8_UP} {$DEFINE DELPHICOMPILER7_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER7_UP} {$DEFINE DELPHICOMPILER6_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER6_UP} {$DEFINE DELPHICOMPILER5_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER5_UP} {$DEFINE DELPHICOMPILER4_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER4_UP} {$DEFINE DELPHICOMPILER3_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER3_UP} {$DEFINE DELPHICOMPILER2_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER2_UP} {$DEFINE DELPHICOMPILER1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ COMPILERX_UP from COMPILERX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF COMPILER25} {$DEFINE COMPILER25_UP} {$ENDIF} +{$IFDEF COMPILER24} {$DEFINE COMPILER24_UP} {$ENDIF} +{$IFDEF COMPILER23} {$DEFINE COMPILER23_UP} {$ENDIF} +{$IFDEF COMPILER22} {$DEFINE COMPILER22_UP} {$ENDIF} +{$IFDEF COMPILER21} {$DEFINE COMPILER21_UP} {$ENDIF} +{$IFDEF COMPILER20} {$DEFINE COMPILER20_UP} {$ENDIF} +{$IFDEF COMPILER19} {$DEFINE COMPILER19_UP} {$ENDIF} +{$IFDEF COMPILER18} {$DEFINE COMPILER18_UP} {$ENDIF} +{$IFDEF COMPILER17} {$DEFINE COMPILER17_UP} {$ENDIF} +{$IFDEF COMPILER16} {$DEFINE COMPILER16_UP} {$ENDIF} +{$IFDEF COMPILER15} {$DEFINE COMPILER15_UP} {$ENDIF} +{$IFDEF COMPILER14} {$DEFINE COMPILER14_UP} {$ENDIF} +{$IFDEF COMPILER12} {$DEFINE COMPILER12_UP} {$ENDIF} +{$IFDEF COMPILER11} {$DEFINE COMPILER11_UP} {$ENDIF} +{$IFDEF COMPILER10} {$DEFINE COMPILER10_UP} {$ENDIF} +{$IFDEF COMPILER9} {$DEFINE COMPILER9_UP} {$ENDIF} +{$IFDEF COMPILER8} {$DEFINE COMPILER8_UP} {$ENDIF} +{$IFDEF COMPILER7} {$DEFINE COMPILER7_UP} {$ENDIF} +{$IFDEF COMPILER6} {$DEFINE COMPILER6_UP} {$ENDIF} +{$IFDEF COMPILER5} {$DEFINE COMPILER5_UP} {$ENDIF} +{$IFDEF COMPILER4} {$DEFINE COMPILER4_UP} {$ENDIF} +{$IFDEF COMPILER35} {$DEFINE COMPILER35_UP} {$ENDIF} +{$IFDEF COMPILER3} {$DEFINE COMPILER3_UP} {$ENDIF} +{$IFDEF COMPILER2} {$DEFINE COMPILER2_UP} {$ENDIF} +{$IFDEF COMPILER1} {$DEFINE COMPILER1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ COMPILERX_UP from COMPILERX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF COMPILER25_UP} {$DEFINE COMPILER24_UP} {$ENDIF} +{$IFDEF COMPILER24_UP} {$DEFINE COMPILER23_UP} {$ENDIF} +{$IFDEF COMPILER23_UP} {$DEFINE COMPILER22_UP} {$ENDIF} +{$IFDEF COMPILER22_UP} {$DEFINE COMPILER21_UP} {$ENDIF} +{$IFDEF COMPILER21_UP} {$DEFINE COMPILER20_UP} {$ENDIF} +{$IFDEF COMPILER20_UP} {$DEFINE COMPILER19_UP} {$ENDIF} +{$IFDEF COMPILER19_UP} {$DEFINE COMPILER18_UP} {$ENDIF} +{$IFDEF COMPILER18_UP} {$DEFINE COMPILER17_UP} {$ENDIF} +{$IFDEF COMPILER17_UP} {$DEFINE COMPILER16_UP} {$ENDIF} +{$IFDEF COMPILER16_UP} {$DEFINE COMPILER15_UP} {$ENDIF} +{$IFDEF COMPILER15_UP} {$DEFINE COMPILER14_UP} {$ENDIF} +{$IFDEF COMPILER14_UP} {$DEFINE COMPILER12_UP} {$ENDIF} +{$IFDEF COMPILER12_UP} {$DEFINE COMPILER11_UP} {$ENDIF} +{$IFDEF COMPILER11_UP} {$DEFINE COMPILER10_UP} {$ENDIF} +{$IFDEF COMPILER10_UP} {$DEFINE COMPILER9_UP} {$ENDIF} +{$IFDEF COMPILER9_UP} {$DEFINE COMPILER8_UP} {$ENDIF} +{$IFDEF COMPILER8_UP} {$DEFINE COMPILER7_UP} {$ENDIF} +{$IFDEF COMPILER7_UP} {$DEFINE COMPILER6_UP} {$ENDIF} +{$IFDEF COMPILER6_UP} {$DEFINE COMPILER5_UP} {$ENDIF} +{$IFDEF COMPILER5_UP} {$DEFINE COMPILER4_UP} {$ENDIF} +{$IFDEF COMPILER4_UP} {$DEFINE COMPILER35_UP} {$ENDIF} +{$IFDEF COMPILER35_UP} {$DEFINE COMPILER3_UP} {$ENDIF} +{$IFDEF COMPILER3_UP} {$DEFINE COMPILER2_UP} {$ENDIF} +{$IFDEF COMPILER2_UP} {$DEFINE COMPILER1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ RTLX_UP from RTLX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF RTL320_UP} {$DEFINE RTL310_UP} {$ENDIF} +{$IFDEF RTL310_UP} {$DEFINE RTL300_UP} {$ENDIF} +{$IFDEF RTL300_UP} {$DEFINE RTL290_UP} {$ENDIF} +{$IFDEF RTL290_UP} {$DEFINE RTL280_UP} {$ENDIF} +{$IFDEF RTL280_UP} {$DEFINE RTL270_UP} {$ENDIF} +{$IFDEF RTL270_UP} {$DEFINE RTL260_UP} {$ENDIF} +{$IFDEF RTL260_UP} {$DEFINE RTL250_UP} {$ENDIF} +{$IFDEF RTL250_UP} {$DEFINE RTL240_UP} {$ENDIF} +{$IFDEF RTL240_UP} {$DEFINE RTL230_UP} {$ENDIF} +{$IFDEF RTL230_UP} {$DEFINE RTL220_UP} {$ENDIF} +{$IFDEF RTL220_UP} {$DEFINE RTL210_UP} {$ENDIF} +{$IFDEF RTL210_UP} {$DEFINE RTL200_UP} {$ENDIF} +{$IFDEF RTL200_UP} {$DEFINE RTL190_UP} {$ENDIF} +{$IFDEF RTL190_UP} {$DEFINE RTL185_UP} {$ENDIF} +{$IFDEF RTL185_UP} {$DEFINE RTL180_UP} {$ENDIF} +{$IFDEF RTL180_UP} {$DEFINE RTL170_UP} {$ENDIF} +{$IFDEF RTL170_UP} {$DEFINE RTL160_UP} {$ENDIF} +{$IFDEF RTL160_UP} {$DEFINE RTL150_UP} {$ENDIF} +{$IFDEF RTL150_UP} {$DEFINE RTL145_UP} {$ENDIF} +{$IFDEF RTL145_UP} {$DEFINE RTL142_UP} {$ENDIF} +{$IFDEF RTL142_UP} {$DEFINE RTL140_UP} {$ENDIF} +{$IFDEF RTL140_UP} {$DEFINE RTL130_UP} {$ENDIF} +{$IFDEF RTL130_UP} {$DEFINE RTL125_UP} {$ENDIF} +{$IFDEF RTL125_UP} {$DEFINE RTL120_UP} {$ENDIF} +{$IFDEF RTL120_UP} {$DEFINE RTL110_UP} {$ENDIF} +{$IFDEF RTL110_UP} {$DEFINE RTL100_UP} {$ENDIF} +{$IFDEF RTL100_UP} {$DEFINE RTL93_UP} {$ENDIF} +{$IFDEF RTL93_UP} {$DEFINE RTL90_UP} {$ENDIF} +{$IFDEF RTL90_UP} {$DEFINE RTL80_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ Check for CLR overrides of default detection } +{------------------------------------------------------------------------------} + +{$IFDEF CLR} + {$IFDEF FORCE_CLR10} + {$DEFINE CLR10} + {$UNDEF CLR11} + {$UNDEF CLR20} + {$ENDIF FORCE_CLR10} + + {$IFDEF FORCE_CLR11} + {$UNDEF CLR10} + {$DEFINE CLR11} + {$UNDEF CLR20} + {$ENDIF FORCE_CLR11} + + {$IFDEF FORCE_CLR20} + {$UNDEF CLR10} + {$UNDEF CLR11} + {$DEFINE CLR20} + {$ENDIF FORCE_CLR20} +{$ENDIF CLR} + +{------------------------------------------------------------------------------} +{ CLRX from CLRX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF CLR10} {$DEFINE CLR10_UP} {$ENDIF} +{$IFDEF CLR11} {$DEFINE CLR11_UP} {$ENDIF} +{$IFDEF CLR20} {$DEFINE CLR20_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ CLRX_UP from CLRX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF CLR20_UP} {$DEFINE CLR11_UP} {$ENDIF} +{$IFDEF CLR11_UP} {$DEFINE CLR10_UP} {$ENDIF} + +{------------------------------------------------------------------------------} + +{$IFDEF DELPHICOMPILER} + {$DEFINE DELPHILANGUAGE} +{$ENDIF} + +{$IFDEF BCBCOMPILER} + {$DEFINE DELPHILANGUAGE} +{$ENDIF} + +{------------------------------------------------------------------------------} +{ KYLIXX_UP from KYLIXX mappings } +{------------------------------------------------------------------------------} + +{$IFDEF KYLIX3} {$DEFINE KYLIX3_UP} {$ENDIF} +{$IFDEF KYLIX2} {$DEFINE KYLIX2_UP} {$ENDIF} +{$IFDEF KYLIX1} {$DEFINE KYLIX1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ KYLIXX_UP from KYLIXX_UP mappings } +{------------------------------------------------------------------------------} + +{$IFDEF KYLIX3_UP} {$DEFINE KYLIX2_UP} {$ENDIF} +{$IFDEF KYLIX2_UP} {$DEFINE KYLIX1_UP} {$ENDIF} + +{------------------------------------------------------------------------------} +{ Map COMPILERX_UP to friendly feature names } +{------------------------------------------------------------------------------} + +{$IFDEF FPC} + {$IFDEF VER1_0} + Please use FPC 2.0 or higher to compile this. + {$ELSE} + {$DEFINE SUPPORTS_OUTPARAMS} + {$DEFINE SUPPORTS_WIDECHAR} + {$DEFINE SUPPORTS_WIDESTRING} + {$IFDEF HASINTF} + {$DEFINE SUPPORTS_INTERFACE} + {$ENDIF} + {$IFDEF HASVARIANT} + {$DEFINE SUPPORTS_VARIANT} + {$ENDIF} + {$IFDEF FPC_HAS_TYPE_SINGLE} + {$DEFINE SUPPORTS_SINGLE} + {$ENDIF} + {$IFDEF FPC_HAS_TYPE_DOUBLE} + {$DEFINE SUPPORTS_DOUBLE} + {$ENDIF} + {$IFDEF FPC_HAS_TYPE_EXTENDED} + {$DEFINE SUPPORTS_EXTENDED} + {$ENDIF} + {$IFDEF HASCURRENCY} + {$DEFINE SUPPORTS_CURRENCY} + {$ENDIF} + {$DEFINE SUPPORTS_THREADVAR} + {$DEFINE SUPPORTS_CONSTPARAMS} + {$DEFINE SUPPORTS_LONGWORD} + {$DEFINE SUPPORTS_INT64} + {$DEFINE SUPPORTS_DYNAMICARRAYS} + {$DEFINE SUPPORTS_DEFAULTPARAMS} + {$DEFINE SUPPORTS_OVERLOAD} + {$DEFINE ACCEPT_DEPRECATED} // 2.2 also gives warnings + {$DEFINE ACCEPT_PLATFORM} // 2.2 also gives warnings + {$DEFINE ACCEPT_LIBRARY} + {$DEFINE SUPPORTS_EXTSYM} + {$DEFINE SUPPORTS_NODEFINE} + + {$DEFINE SUPPORTS_CUSTOMVARIANTS} + {$DEFINE SUPPORTS_VARARGS} + {$DEFINE SUPPORTS_ENUMVALUE} + {$IFDEF LINUX} + {$DEFINE HAS_UNIT_LIBC} + {$ENDIF LINUX} + {$DEFINE HAS_UNIT_CONTNRS} + {$DEFINE HAS_UNIT_TYPES} + {$DEFINE HAS_UNIT_VARIANTS} + {$DEFINE HAS_UNIT_STRUTILS} + {$DEFINE HAS_UNIT_DATEUTILS} + {$DEFINE HAS_UNIT_RTLCONSTS} + + {$DEFINE XPLATFORM_RTL} + + {$IFDEF VER2_2} + {$DEFINE SUPPORTS_DISPINTERFACE} + {$DEFINE SUPPORTS_IMPLEMENTS} + {$DEFINE SUPPORTS_DISPID} + {$ELSE} + {$UNDEF SUPPORTS_DISPINTERFACE} + {$UNDEF SUPPORTS_IMPLEMENTS} + {$endif} + {$UNDEF SUPPORTS_UNSAFE_WARNINGS} + {$ENDIF} +{$ENDIF FPC} + +{$IFDEF CLR} + {$DEFINE SUPPORTS_UNICODE} +{$ENDIF CLR} + +{$IFDEF COMPILER1_UP} + {$DEFINE SUPPORTS_CONSTPARAMS} + {$DEFINE SUPPORTS_SINGLE} + {$DEFINE SUPPORTS_DOUBLE} + {$DEFINE SUPPORTS_EXTENDED} + {$DEFINE SUPPORTS_PACKAGES} +{$ENDIF COMPILER1_UP} + +{$IFDEF COMPILER2_UP} + {$DEFINE SUPPORTS_CURRENCY} + {$DEFINE SUPPORTS_THREADVAR} + {$DEFINE SUPPORTS_VARIANT} + {$DEFINE SUPPORTS_WIDECHAR} +{$ENDIF COMPILER2_UP} + +{$IFDEF COMPILER3_UP} + {$DEFINE SUPPORTS_OUTPARAMS} + {$DEFINE SUPPORTS_WIDESTRING} + {$DEFINE SUPPORTS_INTERFACE} + {$DEFINE SUPPORTS_DISPINTERFACE} + {$DEFINE SUPPORTS_DISPID} + {$DEFINE SUPPORTS_WEAKPACKAGEUNIT} +{$ENDIF COMPILER3_UP} + +{$IFDEF COMPILER35_UP} + {$DEFINE SUPPORTS_EXTSYM} + {$DEFINE SUPPORTS_NODEFINE} +{$ENDIF COMPILER35_UP} + +{$IFDEF COMPILER4_UP} + {$DEFINE SUPPORTS_LONGWORD} + {$DEFINE SUPPORTS_INT64} + {$DEFINE SUPPORTS_DYNAMICARRAYS} + {$DEFINE SUPPORTS_DEFAULTPARAMS} + {$DEFINE SUPPORTS_OVERLOAD} + {$DEFINE SUPPORTS_IMPLEMENTS} +{$ENDIF COMPILER4_UP} + +{$IFDEF COMPILER6_UP} + {$DEFINE SUPPORTS_DEPRECATED} + {$DEFINE SUPPORTS_LIBRARY} + {$DEFINE SUPPORTS_PLATFORM} + {$DEFINE SUPPORTS_LOCAL} + {$DEFINE SUPPORTS_SETPEFLAGS} + {$DEFINE SUPPORTS_EXPERIMENTAL_WARNINGS} + {$DEFINE ACCEPT_DEPRECATED} + {$DEFINE ACCEPT_PLATFORM} + {$DEFINE ACCEPT_LIBRARY} + {$DEFINE SUPPORTS_DEPRECATED_WARNINGS} + {$DEFINE SUPPORTS_LIBRARY_WARNINGS} + {$DEFINE SUPPORTS_PLATFORM_WARNINGS} + {$DEFINE SUPPORTS_CUSTOMVARIANTS} + {$DEFINE SUPPORTS_VARARGS} + {$DEFINE SUPPORTS_ENUMVALUE} + {$DEFINE SUPPORTS_COMPILETIME_MESSAGES} +{$ENDIF COMPILER6_UP} + +{$IFDEF COMPILER7_UP} + {$DEFINE SUPPORTS_UNSAFE_WARNINGS} + {$DEFINE SUPPORTS_UINT64} +{$ENDIF COMPILER7_UP} + +{$IFDEF COMPILER9_UP} + {$DEFINE SUPPORTS_FOR_IN} + {$DEFINE SUPPORTS_INLINE} + {$DEFINE SUPPORTS_NESTED_CONSTANTS} + {$DEFINE SUPPORTS_NESTED_TYPES} + {$DEFINE SUPPORTS_REGION} + {$IFDEF CLR} + {$DEFINE SUPPORTS_ENHANCED_RECORDS} + {$DEFINE SUPPORTS_CLASS_FIELDS} + {$DEFINE SUPPORTS_CLASS_HELPERS} + {$DEFINE SUPPORTS_CLASS_OPERATORS} + {$DEFINE SUPPORTS_STRICT} + {$DEFINE SUPPORTS_STATIC} + {$DEFINE SUPPORTS_FINAL} + {$ENDIF CLR} +{$ENDIF COMPILER9_UP} + +{$IFDEF COMPILER10_UP} + {$DEFINE SUPPORTS_ENHANCED_RECORDS} + {$DEFINE SUPPORTS_CLASS_FIELDS} + {$DEFINE SUPPORTS_CLASS_HELPERS} + {$DEFINE SUPPORTS_CLASS_OPERATORS} + {$DEFINE SUPPORTS_STRICT} + {$DEFINE SUPPORTS_STATIC} + {$DEFINE SUPPORTS_FINAL} + {$DEFINE SUPPORTS_METHODINFO} +{$ENDIF COMPILER10_UP} + +{$IFDEF COMPILER11_UP} + {$IFDEF CLR} + {$DEFINE SUPPORTS_GENERICS} + {$DEFINE SUPPORTS_DEPRECATED_DETAILS} + {$ENDIF CLR} +{$ENDIF COMPILER11_UP} + +{$IFDEF COMPILER12_UP} + {$DEFINE SUPPORTS_GENERICS} + {$DEFINE SUPPORTS_DEPRECATED_DETAILS} + {$DEFINE SUPPORTS_INT_ALIASES} + {$IFNDEF CLR} + {$DEFINE SUPPORTS_UNICODE} + {$DEFINE SUPPORTS_UNICODE_STRING} + {$ENDIF CLR} +{$ENDIF COMPILER12_UP} + +{$IFDEF COMPILER14_UP} + {$DEFINE SUPPORTS_CLASS_CTORDTORS} + {$DEFINE HAS_UNIT_RTTI} + {$DEFINE SUPPORTS_CAST_INTERFACE_TO_OBJ} + {$DEFINE SUPPORTS_DELAYED_LOADING} +{$ENDIF COMPILER14_UP} + +{$IFDEF COMPILER16_UP} + {$DEFINE USE_64BIT_TYPES} +{$ENDIF COMPILER16_UP} + +{$IFDEF RTL130_UP} + {$DEFINE HAS_UNIT_CONTNRS} +{$ENDIF RTL130_UP} + +{$IFDEF RTL140_UP} + {$IFDEF LINUX} + {$DEFINE HAS_UNIT_LIBC} + {$ENDIF LINUX} + {$DEFINE HAS_UNIT_RTLCONSTS} + {$DEFINE HAS_UNIT_TYPES} + {$DEFINE HAS_UNIT_VARIANTS} + {$DEFINE HAS_UNIT_STRUTILS} + {$DEFINE HAS_UNIT_DATEUTILS} + {$DEFINE XPLATFORM_RTL} +{$ENDIF RTL140_UP} + +{$IFDEF RTL150_UP} + {$DEFINE HAS_UNIT_UXTHEME} +{$ENDIF RTL150_UP} + +{$IFDEF RTL170_UP} + {$DEFINE HAS_UNIT_HTTPPROD} +{$ENDIF RTL170_UP} + +{$IFDEF RTL185_UP} + {$DEFINE HAS_UNIT_GIFIMG} +{$ENDIF RTL185_UP} + +{$IFDEF RTL200_UP} + {$DEFINE HAS_UNIT_ANSISTRINGS} + {$DEFINE HAS_UNIT_PNGIMAGE} + {$DEFINE HAS_UNIT_CHARACTER} + {$DEFINE HAS_EXCEPTION_STACKTRACE} +{$ENDIF RTL200_UP} + +{$IFDEF RTL210_UP} + {$DEFINE HAS_EARGUMENTEXCEPTION} +{$ENDIF RTL210_UP} + +{$IFDEF RTL220_UP} + {$DEFINE HAS_UNIT_REGULAREXPRESSIONSAPI} + {$DEFINE HAS_ENOTIMPLEMENTED} +{$ENDIF RTL220_UP} + +{$IFDEF RTL230_UP} + {$DEFINE HAS_UNITSCOPE} + {$DEFINE HAS_UNIT_SYSTEM_UITYPES} + {$DEFINE HAS_UNIT_VCL_THEMES} +{$ENDIF RTL230_UP} + +{$IFDEF RTL240_UP} + {$DEFINE HAS_UNIT_SYSTEM_ACTIONS} + {$DEFINE HAS_PROPERTY_STYLEELEMENTS} +{$ENDIF RTL240_UP} + +{$IFDEF RTL250_UP} + {$DEFINE DEPRECATED_SYSUTILS_ANSISTRINGS} +{$ENDIF RTL250_UP} + +{$IFDEF RTL270_UP} + {$DEFINE HAS_AUTOMATIC_DB_FIELDS} +{$ENDIF RTL270_UP} + +{------------------------------------------------------------------------------} +{ Cross-platform related defines } +{------------------------------------------------------------------------------} + +{$IFNDEF CPUASM} + {$DEFINE PUREPASCAL} +{$ENDIF ~CPUASM} + +{$IFDEF WIN32} + {$DEFINE MSWINDOWS} // predefined for D6+/BCB6+ + {$DEFINE Win32API} +{$ENDIF} + +{$IFDEF DELPHILANGUAGE} + {$IFDEF LINUX} + {$DEFINE UNIX} + {$ENDIF} + + {$IFNDEF CONSOLE} + {$IFDEF LINUX} + {$DEFINE VisualCLX} + {$ENDIF} + {$IFNDEF VisualCLX} + {$DEFINE VCL} + {$ENDIF} + {$ENDIF ~CONSOLE} +{$ENDIF DELPHILANGUAGE} + +{------------------------------------------------------------------------------} +{ Compiler settings } +{------------------------------------------------------------------------------} + +{$IFOPT A+} {$DEFINE ALIGN_ON} {$ENDIF} +{$IFOPT B+} {$DEFINE BOOLEVAL_ON} {$ENDIF} +{$IFDEF COMPILER2_UP} + {$IFOPT C+} {$DEFINE ASSERTIONS_ON} {$ENDIF} +{$ENDIF} +{$IFOPT D+} {$DEFINE DEBUGINFO_ON} {$ENDIF} +{$IFOPT G+} {$DEFINE IMPORTEDDATA_ON} {$ENDIF} +{$IFDEF COMPILER2_UP} + {$IFOPT H+} {$DEFINE LONGSTRINGS_ON} {$ENDIF} +{$ENDIF} + +// Hints +{$IFOPT I+} {$DEFINE IOCHECKS_ON} {$ENDIF} +{$IFDEF COMPILER2_UP} + {$IFOPT J+} {$DEFINE WRITEABLECONST_ON} {$ENDIF} +{$ENDIF} +{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$DEFINE LOCALSYMBOLS_ON} {$ENDIF} +{$IFOPT M+} {$DEFINE TYPEINFO_ON} {$ENDIF} +{$IFOPT O+} {$DEFINE OPTIMIZATION_ON} {$ENDIF} +{$IFOPT P+} {$DEFINE OPENSTRINGS_ON} {$ENDIF} +{$IFOPT Q+} {$DEFINE OVERFLOWCHECKS_ON} {$ENDIF} +{$IFOPT R+} {$DEFINE RANGECHECKS_ON} {$ENDIF} + +// Real compatibility +{$IFOPT T+} {$DEFINE TYPEDADDRESS_ON} {$ENDIF} +{$IFOPT U+} {$DEFINE SAFEDIVIDE_ON} {$ENDIF} +{$IFOPT V+} {$DEFINE VARSTRINGCHECKS_ON} {$ENDIF} +{$IFOPT W+} {$DEFINE STACKFRAMES_ON} {$ENDIF} + +// Warnings +{$IFOPT X+} {$DEFINE EXTENDEDSYNTAX_ON} {$ENDIF} + +// for Delphi/BCB trial versions remove the point from the line below +{.$UNDEF SUPPORTS_WEAKPACKAGEUNIT} + +{$ENDIF ~JEDI_INC} diff --git a/jcl/source/include/kylix.inc b/jcl/source/include/kylix.inc new file mode 100644 index 0000000000..2ea06d704a --- /dev/null +++ b/jcl/source/include/kylix.inc @@ -0,0 +1,30 @@ +// +// This is FPC-incompatible code and was excluded from jedi.inc for this reason +// +// Kylix 3/C++ for some reason evaluates CompilerVersion comparisons to False, +// if the constant to compare with is a floating point value - weird. +// The "+" sign prevents Kylix/Delphi from issueing a warning about comparing +// signed and unsigned values. +// + {$IF not Declared(CompilerVersion)} + {$DEFINE KYLIX1} + {$DEFINE COMPILER6} + {$DEFINE DELPHICOMPILER6} + {$DEFINE RTL140_UP} + {$ELSEIF Declared(CompilerVersion) and (CompilerVersion > +14)} + {$DEFINE KYLIX2} + {$DEFINE COMPILER6} + {$DEFINE DELPHICOMPILER6} + {$DEFINE RTL142_UP} + {$ELSEIF Declared(CompilerVersion) and (CompilerVersion < +15)} + {$DEFINE KYLIX3} + {$DEFINE COMPILER6} + {$IFNDEF BCB} + {$DEFINE DELPHICOMPILER6} + {$ENDIF} + {$DEFINE RTL145_UP} + {$ELSE} + Add new Kylix version + {$IFEND} + + diff --git a/jcl/source/include/windowsonly.inc b/jcl/source/include/windowsonly.inc index 486b685f4f..ffa02953e9 100644 --- a/jcl/source/include/windowsonly.inc +++ b/jcl/source/include/windowsonly.inc @@ -44,7 +44,7 @@ ALERT_jedi_inc_missing {$IFNDEF MSWINDOWS} {$IFDEF SUPPORTS_COMPILETIME_MESSAGES} - {$MESSAGE FATAL 'This unit is only supported on Windows!'} + // {$MESSAGE FATAL 'This unit is only supported on Windows!'} {$ELSE} 'This unit is only supported on Windows!' {$ENDIF SUPPORTS_COMPILETIME_MESSAGES} diff --git a/jcl/source/prototypes/JclArrayLists.pas b/jcl/source/prototypes/JclArrayLists.pas index 09591386ed..9ab2dd587f 100644 --- a/jcl/source/prototypes/JclArrayLists.pas +++ b/jcl/source/prototypes/JclArrayLists.pas @@ -47,7 +47,10 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} JclAlgorithms, - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf + {$IFDEF THREADSAFE} + ,JclSynch + {$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclArrayLists.int} {$I containers\JclArrayLists.imp} diff --git a/jcl/source/prototypes/JclArraySets.pas b/jcl/source/prototypes/JclArraySets.pas index a27be55ed1..e0226bf519 100644 --- a/jcl/source/prototypes/JclArraySets.pas +++ b/jcl/source/prototypes/JclArraySets.pas @@ -49,7 +49,7 @@ interface {$IFDEF SUPPORTS_GENERICS} JclAlgorithms, {$ENDIF SUPPORTS_GENERICS} - JclBase, JclAbstractContainers, JclContainerIntf, JclArrayLists, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf, JclArrayLists, {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclArraySets.int} {$I containers\JclArraySets.imp} diff --git a/jcl/source/prototypes/JclBinaryTrees.pas b/jcl/source/prototypes/JclBinaryTrees.pas index cbee1045b5..f9c95a71ad 100644 --- a/jcl/source/prototypes/JclBinaryTrees.pas +++ b/jcl/source/prototypes/JclBinaryTrees.pas @@ -46,7 +46,10 @@ interface {$ELSE ~HAS_UNITSCOPE} Classes, {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclAbstractContainers, JclAlgorithms, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclAlgorithms, JclContainerIntf + {$IFDEF THREADSAFE} + ,JclSynch + {$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclBinaryTrees.imp} {$I containers\JclBinaryTrees.int} diff --git a/jcl/source/prototypes/JclGraphics.pas b/jcl/source/prototypes/JclGraphics.pas index 8e0a1a997a..f117782be1 100644 --- a/jcl/source/prototypes/JclGraphics.pas +++ b/jcl/source/prototypes/JclGraphics.pas @@ -525,7 +525,11 @@ function CreateRegionFromBitmap(Bitmap: TBitmap; RegionColor: TColor; RegionBitmapMode: TJclRegionBitmapMode; UseAlphaChannel: Boolean = False): HRGN; procedure ScreenShot(bm: TBitmap; Left, Top, Width, Height: Integer; Window: THandle = HWND_DESKTOP); overload; procedure ScreenShot(bm: TBitmap; IncludeTaskBar: Boolean = True); overload; +procedure ScreenShot(bm: TBitmap; ControlToPrint: TWinControl); overload; +procedure ScreenShot(bm: TBitmap; ControlToPrint: string); overload; +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: TWinControl); overload; procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm); overload; +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: String); overload; function MapWindowRect(hWndFrom, hWndTo: THandle; ARect: TRect):TRect; {$ENDIF VCL} @@ -2210,6 +2214,40 @@ procedure ScreenShot(bm: TBitmap; IncludeTaskBar: Boolean = True); overload; ScreenShot(bm, R.Left, R.Top, R.Right, R.Bottom, HWND_DESKTOP); end; +procedure ScreenShot(bm: TBitmap; ControlToPrint: TWinControl); overload; +begin + //uses the ActiveForm property of TScreen to determine on which form the control will be searched for. + if ControlToPrint <> nil then + ScreenShot(bm, Screen.ActiveForm, ControlToPrint) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) +end; + +procedure ScreenShot(bm: TBitmap; ControlToPrint: string); overload; +begin + //uses the ActiveForm property of TScreen to determine on which form the control will be searched for. + if Length(ControlToPrint) > 0 then + ScreenShot(bm, Screen.ActiveForm, ControlToPrint) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['Component']) +end; + +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: TWinControl); overload; +begin + if FormToPrint <> nil then + begin + if (ControlToPrint is TWinControl) then + ScreenShot(bm, FormToPrint, ControlToPrint.Name) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidControlType,[ControlToPrint.Name]) + end + else + if ControlToPrint <> nil then + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) +end; + procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm); overload; begin //Prints the entire forms area. @@ -2219,6 +2257,33 @@ procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm); overload; raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) end; +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: String); overload; +var + Component: TComponent; +begin + if FormToPrint <> nil then + begin + if Length(ControlToPrint) =0 then + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['component']) + else + begin + Component :=nil; + FormToPrint.FindComponent(ControlToPrint); + if Component =nil then + raise EJclGraphicsError.CreateResFmt(@RsComponentDoesNotExist,[ControlToPrint, FormToPrint.Name]) + else + begin + if Component is TWinControl then + ScreenShot(bm, TWinControl(Component).Left, TWinControl(Component).Top, TWinControl(Component).Width, TWinControl(Component).Height, TWinControl(Component).Handle) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidControlType,[ControlToPrint]); + end; + end; + end + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) +end; + function MapWindowRect(hWndFrom, hWndTo: THandle; ARect:TRect):TRect; begin MapWindowPoints(hWndFrom, hWndTo, ARect, 2); diff --git a/jcl/source/prototypes/JclHashMaps.pas b/jcl/source/prototypes/JclHashMaps.pas index 2153516d21..0e8f1f6d3c 100644 --- a/jcl/source/prototypes/JclHashMaps.pas +++ b/jcl/source/prototypes/JclHashMaps.pas @@ -47,7 +47,10 @@ interface Classes, {$ENDIF ~HAS_UNITSCOPE} JclAlgorithms, - JclBase, JclSynch, + JclBase, + {$IFDEF THREADSAFE} + JclSynch, + {$ENDIF THREADSAFE} JclContainerIntf, JclAbstractContainers, JclArrayLists, JclArraySets; {$I containers\JclContainerCommon.imp} {$I containers\JclHashMaps.imp} diff --git a/jcl/source/prototypes/JclHashSets.pas b/jcl/source/prototypes/JclHashSets.pas index eb45ddde0c..d9e4cc58fa 100644 --- a/jcl/source/prototypes/JclHashSets.pas +++ b/jcl/source/prototypes/JclHashSets.pas @@ -47,7 +47,10 @@ interface SysUtils, Classes, {$ENDIF ~HAS_UNITSCOPE} JclAlgorithms, - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf + {$IFDEF THREADSAFE} + ,JclSynch + {$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclHashSets.imp} {$I containers\JclHashSets.int} diff --git a/jcl/source/prototypes/JclLinkedLists.pas b/jcl/source/prototypes/JclLinkedLists.pas index baef525efe..98abeddf8f 100644 --- a/jcl/source/prototypes/JclLinkedLists.pas +++ b/jcl/source/prototypes/JclLinkedLists.pas @@ -49,7 +49,7 @@ interface {$ELSE ~HAS_UNITSCOPE} Classes, {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf{$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclLinkedLists.imp} {$I containers\JclLinkedLists.int} diff --git a/jcl/source/prototypes/JclQueues.pas b/jcl/source/prototypes/JclQueues.pas index c7d63e13c0..33f1faa9f5 100644 --- a/jcl/source/prototypes/JclQueues.pas +++ b/jcl/source/prototypes/JclQueues.pas @@ -42,7 +42,7 @@ interface JclUnitVersioning, {$ENDIF UNITVERSIONING} JclAlgorithms, - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf{$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclQueues.imp} {$I containers\JclQueues.int} diff --git a/jcl/source/prototypes/JclSortedMaps.pas b/jcl/source/prototypes/JclSortedMaps.pas index 51177189e3..ee3a500ec9 100644 --- a/jcl/source/prototypes/JclSortedMaps.pas +++ b/jcl/source/prototypes/JclSortedMaps.pas @@ -46,7 +46,10 @@ interface Classes, {$ENDIF ~HAS_UNITSCOPE} JclAlgorithms, - JclBase, JclSynch, + JclBase, + {$IFDEF THREADSAFE} + JclSynch, + {$ENDIF THREADSAFE} JclAbstractContainers, JclContainerIntf, JclArrayLists, JclArraySets; {$I containers\JclContainerCommon.imp} {$I containers\JclSortedMaps.imp} diff --git a/jcl/source/prototypes/JclStacks.pas b/jcl/source/prototypes/JclStacks.pas index 23768b57fc..3891703e2e 100644 --- a/jcl/source/prototypes/JclStacks.pas +++ b/jcl/source/prototypes/JclStacks.pas @@ -52,7 +52,7 @@ interface JclAlgorithms, {$ENDIF SUPPORTS_GENERICS} {$ENDIF ~HAS_UNITSCOPE} - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf {$IFDEF THREADSAFE}, JclSynch{$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclStacks.imp} {$I containers\JclStacks.int} diff --git a/jcl/source/prototypes/JclTrees.pas b/jcl/source/prototypes/JclTrees.pas index d1fe1f9647..e894037717 100644 --- a/jcl/source/prototypes/JclTrees.pas +++ b/jcl/source/prototypes/JclTrees.pas @@ -48,7 +48,10 @@ interface {$IFDEF SUPPORTS_GENERICS} JclAlgorithms, {$ENDIF SUPPORTS_GENERICS} - JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclBase, JclAbstractContainers, JclContainerIntf + {$IFDEF THREADSAFE} + , JclSynch + {$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclTrees.imp} {$I containers\JclTrees.int} diff --git a/jcl/source/prototypes/JclVectors.pas b/jcl/source/prototypes/JclVectors.pas index 2820f18eb6..eb97923ece 100644 --- a/jcl/source/prototypes/JclVectors.pas +++ b/jcl/source/prototypes/JclVectors.pas @@ -49,7 +49,10 @@ interface {$ELSE ~HAS_UNITSCOPE} Classes, {$ENDIF ~HAS_UNITSCOPE} - JclAlgorithms, JclBase, JclAbstractContainers, JclContainerIntf, JclSynch; + JclAlgorithms, JclBase, JclAbstractContainers, JclContainerIntf + {$IFDEF THREADSAFE} + ,JclSynch + {$ENDIF THREADSAFE}; {$I containers\JclContainerCommon.imp} {$I containers\JclVectors.imp} {$I containers\JclVectors.int} diff --git a/jcl/source/vcl/JclGraphUtils.pas b/jcl/source/vcl/JclGraphUtils.pas index d4aff254bd..c1bdd97dc9 100644 --- a/jcl/source/vcl/JclGraphUtils.pas +++ b/jcl/source/vcl/JclGraphUtils.pas @@ -48,7 +48,13 @@ interface {$IFDEF HAS_UNITSCOPE} System.Types, Winapi.Windows, System.SysUtils, Vcl.Graphics, {$ELSE ~HAS_UNITSCOPE} - Types, Windows, SysUtils, Graphics, + Types, + {$IFDEF FPC} + LCLIntf, LCLType, + {$ELSE ~FPC} + Windows, + {$ENDIF ~FPC} + SysUtils, Graphics, {$ENDIF ~HAS_UNITSCOPE} {$IFDEF UNITVERSIONING} JclUnitVersioning, @@ -134,11 +140,13 @@ THLSVector = record procedure EMMS; +{$IFNDEF FPC} // Dialog Functions function DialogUnitsToPixelsX(const DialogUnits: Word): Word; function DialogUnitsToPixelsY(const DialogUnits: Word): Word; function PixelsToDialogUnitsX(const PixelUnits: Word): Word; function PixelsToDialogUnitsY(const PixelUnits: Word): Word; +{$ENDIF ~FPC} // Points function NullPoint: TPoint; @@ -249,13 +257,17 @@ function RGBToHLS(const RGBColor: TColorRef): THLSVector; overload; function HSLToRGB(const H, S, L: Single): TColor32; overload; procedure RGBToHSL(const RGB: TColor32; out H, S, L: Single); overload; +{$IFNDEF FPC} function SetBitmapColors(Bmp: TBitmap; const Colors: array of TColor; StartIndex: Integer): Integer; +{$ENDIF} // Misc function ColorToHTML(const Color: TColor): string; // Petr Vones +{$IFNDEF FPC} function DottedLineTo(const Canvas: TCanvas; const X, Y: Integer): Boolean; overload; +{$ENDIF ~FPC} function ShortenString(const DC: HDC; const S: WideString; const Width: Integer; const RTL: Boolean; EllipsisWidth: Integer = 0): WideString; @@ -373,6 +385,18 @@ procedure OutOfResources; raise EOutOfResources.CreateRes(@SOutOfResources); end; +{$IFDEF FPC} +procedure GDIError; +var + ErrorCode: Integer; +begin + ErrorCode := GetLastOSError; + if ErrorCode <> 0 then + raise EOutOfResources.Create(SysErrorMessage(ErrorCode)) + else + OutOfResources; +end; +{$ELSE ~FPC} procedure GDIError; var ErrorCode: Integer; @@ -385,6 +409,7 @@ procedure GDIError; else OutOfResources; end; +{$ENDIF ~FPC} function GDICheck(Value: Integer): Integer; begin @@ -964,6 +989,7 @@ procedure SetupFunctions; end; end; +{$IFNDEF FPC} //=== Dialog functions ======================================================= function DialogUnitsToPixelsX(const DialogUnits: Word): Word; @@ -985,6 +1011,7 @@ function PixelsToDialogUnitsY(const PixelUnits: Word): Word; begin Result := PixelUnits * 8 div HiWord(GetDialogBaseUnits); end; +{$ENDIF ~FPC} //=== Points ================================================================= @@ -2226,6 +2253,7 @@ function HLSToRGB(const Hue, Luminance, Saturation: THLSValue): TColorRef; Result := RGB(R, G, B); end; +{$IFNDEF FPC} function SetBitmapColors(Bmp: TBitmap; const Colors: array of TColor; StartIndex: Integer): Integer; type TRGBQuadArray = array [Byte] of TRGBQuad; @@ -2253,6 +2281,7 @@ function SetBitmapColors(Bmp: TBitmap; const Colors: array of TColor; StartIndex FreeMem(ColorTable); end; end; +{$ENDIF ~FPC} //=== Misc =================================================================== @@ -2264,6 +2293,7 @@ function ColorToHTML(const Color: TColor): string; Result := Format('#%.2x%.2x%.2x', [Temp.R, Temp.G, Temp.B]); end; +{$IFNDEF FPC} function DottedLineTo(const Canvas: TCanvas; const X, Y: Integer): Boolean; const DotBits: array [0..7] of Word = ($AA, $55, $AA, $55, $AA, $55, $AA, $55); @@ -2297,6 +2327,7 @@ function DottedLineTo(const Canvas: TCanvas; const X, Y: Integer): Boolean; DeleteObject(Bitmap); Result := True; end; +{$ENDIF ~FPC} // Adjusts the given string S so that it fits into the given width. EllipsisWidth gives the width of // the three points to be added to the shorted string. If this value is 0 then it will be determined implicitely. @@ -2310,6 +2341,9 @@ function ShortenString(const DC: HDC; const S: WideString; const Width: Integer; Size: TSize; Len: Integer; L, H, N, W: Integer; + {$IFDEF FPC} + Str: String; + {$ENDIF} begin Len := Length(S); if (Len = 0) or (Width <= 0) then @@ -2319,7 +2353,11 @@ function ShortenString(const DC: HDC; const S: WideString; const Width: Integer; // Determine width of triple point using the current DC settings (if not already done). if EllipsisWidth = 0 then begin + {$IFNDEF FPC} GetTextExtentPoint32W(DC, '...', 3, Size); + {$ELSE ~FPC} + GetTextExtentPoint32(DC, '...', 3, Size); + {$ENDIF ~FPC} EllipsisWidth := Size.cx; end; @@ -2328,13 +2366,21 @@ function ShortenString(const DC: HDC; const S: WideString; const Width: Integer; else begin // Do a binary search for the optimal string length which fits into the given width. + {$IFDEF FPC} + Str := UTF8Encode(S); + Len := Length(Str); + {$ENDIF ~FPC} L := 0; H := Len; N := 0; while L <= H do begin N := (L + H) shr 1; + {$IFNDEF FPC} GetTextExtentPoint32W(DC, PWideChar(S), N, Size); + {$ELSE ~FPC} + GetTextExtentPoint32(DC, PChar(Str), N, Size); + {$ENDIF ~FPC} W := Size.cx + EllipsisWidth; if W < Width then L := N + 1 diff --git a/jcl/source/vcl/JclGraphics.pas b/jcl/source/vcl/JclGraphics.pas index 012e0cc50f..d2b970e894 100644 --- a/jcl/source/vcl/JclGraphics.pas +++ b/jcl/source/vcl/JclGraphics.pas @@ -513,7 +513,11 @@ function CreateRegionFromBitmap(Bitmap: TBitmap; RegionColor: TColor; RegionBitmapMode: TJclRegionBitmapMode; UseAlphaChannel: Boolean = False): HRGN; procedure ScreenShot(bm: TBitmap; Left, Top, Width, Height: Integer; Window: THandle = HWND_DESKTOP); overload; procedure ScreenShot(bm: TBitmap; IncludeTaskBar: Boolean = True); overload; +procedure ScreenShot(bm: TBitmap; ControlToPrint: TWinControl); overload; +procedure ScreenShot(bm: TBitmap; ControlToPrint: string); overload; +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: TWinControl); overload; procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm); overload; +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: String); overload; function MapWindowRect(hWndFrom, hWndTo: THandle; ARect: TRect):TRect; // PolyLines and Polygons @@ -2180,6 +2184,40 @@ procedure ScreenShot(bm: TBitmap; IncludeTaskBar: Boolean = True); overload; ScreenShot(bm, R.Left, R.Top, R.Right, R.Bottom, HWND_DESKTOP); end; +procedure ScreenShot(bm: TBitmap; ControlToPrint: TWinControl); overload; +begin + //uses the ActiveForm property of TScreen to determine on which form the control will be searched for. + if ControlToPrint <> nil then + ScreenShot(bm, Screen.ActiveForm, ControlToPrint) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) +end; + +procedure ScreenShot(bm: TBitmap; ControlToPrint: string); overload; +begin + //uses the ActiveForm property of TScreen to determine on which form the control will be searched for. + if Length(ControlToPrint) > 0 then + ScreenShot(bm, Screen.ActiveForm, ControlToPrint) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['Component']) +end; + +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: TWinControl); overload; +begin + if FormToPrint <> nil then + begin + if (ControlToPrint is TWinControl) then + ScreenShot(bm, FormToPrint, ControlToPrint.Name) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidControlType,[ControlToPrint.Name]) + end + else + if ControlToPrint <> nil then + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) +end; + procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm); overload; begin //Prints the entire forms area. @@ -2189,6 +2227,33 @@ procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm); overload; raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) end; +procedure ScreenShot(bm: TBitmap; FormToPrint: TCustomForm; ControlToPrint: String); overload; +var + Component: TComponent; +begin + if FormToPrint <> nil then + begin + if Length(ControlToPrint) =0 then + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['component']) + else + begin + Component :=nil; + FormToPrint.FindComponent(ControlToPrint); + if Component =nil then + raise EJclGraphicsError.CreateResFmt(@RsComponentDoesNotExist,[ControlToPrint, FormToPrint.Name]) + else + begin + if Component is TWinControl then + ScreenShot(bm, TWinControl(Component).Left, TWinControl(Component).Top, TWinControl(Component).Width, TWinControl(Component).Height, TWinControl(Component).Handle) + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidControlType,[ControlToPrint]); + end; + end; + end + else + raise EJclGraphicsError.CreateResFmt(@RSInvalidFormOrComponent, ['form']) +end; + function MapWindowRect(hWndFrom, hWndTo: THandle; ARect:TRect):TRect; begin MapWindowPoints(hWndFrom, hWndTo, ARect, 2); diff --git a/jcl/source/vcl/JclVclResources.pas b/jcl/source/vcl/JclVclResources.pas index 8f4600bdaf..8b962c5789 100644 --- a/jcl/source/vcl/JclVclResources.pas +++ b/jcl/source/vcl/JclVclResources.pas @@ -73,7 +73,8 @@ interface RsInvalidHandleForRegion = 'Invalid handle for region'; RsInvalidRegionInfo = 'Invalid RegionInfo'; RsInvalidControlType = '%s is not descended from TWinControl'; - RsInvalidFormOrComponent = 'A %s with a nil reference has been passed to the method'; + RsComponentDoesNotExist = '%s does not exist on form %s'; + RsInvalidFormOrComponent = 'A %s with a nil reference has been pass to the routine'; RsBitmapExtension = '.bmp'; RsJpegExtension = '.jpg'; diff --git a/jcl/source/vcl/JclVersionCtrlSVNImpl.pas b/jcl/source/vcl/JclVersionCtrlSVNImpl.pas index eb8f2b158e..591ac5e62c 100644 --- a/jcl/source/vcl/JclVersionCtrlSVNImpl.pas +++ b/jcl/source/vcl/JclVersionCtrlSVNImpl.pas @@ -80,6 +80,9 @@ implementation uses JclVclResources, + {$IFDEF FPC} + JclWin32Process, + {$ENDIF} JclFileUtils, JclSysInfo, JclSysUtils, JclRegistry, JclStrings, JclSimpleXml; const diff --git a/jcl/source/windows/JclMiscel.pas b/jcl/source/windows/JclMiscel.pas index 90929f564f..305dd6ab04 100644 --- a/jcl/source/windows/JclMiscel.pas +++ b/jcl/source/windows/JclMiscel.pas @@ -125,6 +125,9 @@ implementation {$ELSE ~HAS_UNITSCOPE} SysUtils, {$ENDIF ~HAS_UNITSCOPE} + {$IFDEF FPC} + JclWin32Process, + {$ENDIF ~FPC} JclResources, JclSecurity, JclStrings, JclSysUtils, JclSysInfo; function SetDisplayResolution(const XRes, YRes: DWORD): Longint; diff --git a/jcl/source/windows/JclRegistry.pas b/jcl/source/windows/JclRegistry.pas index 143ee9c48f..ce57c5a913 100644 --- a/jcl/source/windows/JclRegistry.pas +++ b/jcl/source/windows/JclRegistry.pas @@ -62,7 +62,7 @@ interface JclBase, JclStrings; type - DelphiHKEY = {$IFDEF CPUX64}type Winapi.Windows.HKEY{$ELSE}Longword{$ENDIF CPUX64}; + DelphiHKEY = {$IFDEF CPUX64}type {$IFDEF HAS_UNITSCOPE}Winapi.{$ENDIF}Windows.HKEY{$ELSE}Longword{$ENDIF CPUX64}; {$HPPEMIT '// BCB users must typecast the HKEY values to DelphiHKEY or use the HK-values below.'} TExecKind = (ekMachineRun, ekMachineRunOnce, ekUserRun, ekUserRunOnce, diff --git a/jcl/source/windows/JclShell.pas b/jcl/source/windows/JclShell.pas index 5a21224c2b..d39993db55 100644 --- a/jcl/source/windows/JclShell.pas +++ b/jcl/source/windows/JclShell.pas @@ -1022,7 +1022,7 @@ function StrRetToString(IdList: PItemIdList; StrRet: TStrRet; Free: Boolean): st case StrRet.uType of STRRET_WSTR: begin - Result := WideCharToString(StrRet.pOleStr); + Result := string(WideCharToString(StrRet.pOleStr)); if Free then SHFreeMem(Pointer(StrRet.pOleStr)); end; @@ -1278,7 +1278,7 @@ function SHGetItemInfoTip(const Folder: IShellFolder; Item: PItemIdList): string InfoTip := nil; if Succeeded(QueryInfo.GetInfoTip(0, InfoTip)) then begin - Result := WideCharToString(InfoTip); + Result := string(WideCharToString(InfoTip)); SHFreeMem(Pointer(InfoTip)); end; end; From e9d492029919e910ee7aff1a6f3b06ea9defc226 Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Wed, 8 Aug 2018 12:02:18 +0300 Subject: [PATCH 02/36] fix readme.md --- readme.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/readme.md b/readme.md index 85422cbf1b..dc209d2641 100644 --- a/readme.md +++ b/readme.md @@ -17,25 +17,28 @@ Source code files included in the JCL have a header which explicitly states this however, unless noted otherwise, all files including those without an MPL header, are subject to the MPL license. +This fork is attempt to solve the issue of assembling JCL in the FPC/Lazarus. +The original repository can be found here: https://github.com/project-jedi/jcl + Download the ZIP file --------------------- -If you download the JCL as a ZIP file from GitHub, you also have to download the jedi.inc and -kylix.inc files from the project and copy them to the +If you download the JCL as a ZIP file from GitHub, you have to move the jedi.inc and +kylix.inc files from the jcl\jcl\source\include to the jcl\jcl\source\include\jedi directory. Clone with GIT -------------- ``` -> git clone git://github.com/project-jedi/jcl.git jcl -> cd jcl -> git submodule update --init +> git clone git://github.com/Makhaon/jcl.git jcl + ``` This will get you the JCL repository and initializes the submodule that contains the jedi.inc and kylix.inc files. How to install -------------- -Start the **jcl\install.bat** +Under Windows start the **jcl\install.bat** +Under Linux just unpack archive to a folder Daily snapshots --------------- From e0cb19b6b4a76784a46788ebbf805cf79120bd75 Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Wed, 8 Aug 2018 12:04:13 +0300 Subject: [PATCH 03/36] fix readme.md --- readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme.md b/readme.md index dc209d2641..59d7b1c25b 100644 --- a/readme.md +++ b/readme.md @@ -30,10 +30,9 @@ Clone with GIT -------------- ``` > git clone git://github.com/Makhaon/jcl.git jcl - ``` -This will get you the JCL repository and initializes the submodule that contains the jedi.inc and kylix.inc files. +This will get you the JCL repository. How to install -------------- From a1ff0a43b55b0c42b8cb1ef86fc77b3a75734e1b Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Wed, 8 Aug 2018 14:21:28 +0300 Subject: [PATCH 04/36] include/jclfpc.inc, update of readme.md --- jcl/source/include/jclfpc.inc | 150 ++++++++++++++++++++++++++++++++++ readme.md | 32 ++++++++ 2 files changed, 182 insertions(+) create mode 100644 jcl/source/include/jclfpc.inc diff --git a/jcl/source/include/jclfpc.inc b/jcl/source/include/jclfpc.inc new file mode 100644 index 0000000000..36bb4d7580 --- /dev/null +++ b/jcl/source/include/jclfpc.inc @@ -0,0 +1,150 @@ +{**************************************************************************************************} +{ } +{ Project JEDI Code Library (JCL) } +{ } +{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); } +{ you may not use this file except in compliance with the License. You may obtain a copy of the } +{ License at http://www.mozilla.org/MPL/ } +{ } +{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF } +{ ANY KIND, either express or implied. See the License for the specific language governing rights } +{ and limitations under the License. } +{ } +{ The Original Code is jcl.inc } +{ } +{ The Initial Developer of the Original Code is Marcel van Brakel. } +{ Portions created by Marcel van Brakel are Copyright (C) Marcel van Brakel. } +{ } +{ Contributors: } +{ Marcel van Brakel } +{ Matthias Thoma (mthoma) } +{ Petr Vones } +{ Robert Marquardt (marquardt) } +{ Robert Rossmair (rrossmair) } +{ Florent Ouchet (outchy) } +{ } +{**************************************************************************************************} +{ } +{ This include file defines various JCL specific defines. } +{ The more generic JCL defines are defined in jcl.inc and the generic defines in the jedi.inc file } +{ which is shared with the JEDI VCL. } +{ } +{**************************************************************************************************} +{ } +{ This file is filled by the JCL installer, all the changes made in its content will be lost the } +{ next time the JCL is installed. } +{ } +{**************************************************************************************************} + +// $Id$ + +// Math precision selection, mutually exclusive +// FPC does not support EXTENDED when targetting x86_64, MATH_DOUBLE_PRECISION is the default in this situation +{.$DEFINE MATH_EXTENDED_PRECISION} // default +{.$DEFINE MATH_DOUBLE_PRECISION} +{.$DEFINE MATH_SINGLE_PRECISION} + + +// Math functions takes care of infinites and NaN +{.$DEFINE MATH_EXT_EXTREMEVALUES} + + +// JclHookExcept support for hooking exceptions from DLLs +{.$DEFINE HOOK_DLL_EXCEPTIONS} + + +//Threadsafe directive +{.$DEFINE THREADSAFE} + + +// To exclude obsolete code from compilation, remove the point from the line below +{.$DEFINE DROP_OBSOLETE_CODE} + + +//Support for JclUnitVersioning.pas, not supported by Delphi 2005 (automatically disabled afterward) +{.$DEFINE UNITVERSIONING} + + +// debug sources +// defining these symbols will the debug source to be automatically registered +{.$DEFINE DEBUG_NO_BINARY} +{.$DEFINE DEBUG_NO_TD32} // automatically defined for FPC +{.$DEFINE DEBUG_NO_MAP} +{.$DEFINE DEBUG_NO_EXPORTS} +{.$DEFINE DEBUG_NO_SYMBOLS} + + +// PCRE options, mutually exclusive +// IMPORTANT: The static link works only for Delphi 2005 and newer +// (an internal error is raised on other compilers) +// Only one of the following defines can be defined at a time +// static link: PCRE_STATICLINK +// static dll import: PCRE_LINKDLL +// dynamic dll import: PCRE_LINKONREQUEST +// RTL's RegularExpressionsAPI: PCRE_RTL + +{.$DEFINE PCRE_STATICLINK} +{.$DEFINE PCRE_LINKDLL} +{.$DEFINE PCRE_LINKONREQUEST} // default +{.$DEFINE PCRE_RTL} // DXE and newer + +// ANSI/UTF8 PCRE +{$DEFINE PCRE_8} +// UCS2/UTF16 enabled PCRE +{$DEFINE PCRE_16} // only valid when PCRE_STATICLINK is enabled, the RTL does not support it and the DLL found over the internet are completly outdated. + +// use PCRE16 when available rather than good old PCRE8 +{$DEFINE PCRE_PREFER_16} + +// BZIP2 options, mutually exclusive + +{.$DEFINE BZIP2_STATICLINK} // default +{.$DEFINE BZIP2_LINKDLL} +{.$DEFINE BZIP2_LINKONREQUEST} + + +// ZLIB options, mutually exclusive + +{.$DEFINE ZLIB_STATICLINK} // default +{.$DEFINE ZLIB_LINKDLL} +{.$DEFINE ZLIB_LINKONREQUEST} +{.$DEFINE ZLIB_RTL} // DXE2 and newer only + + +// Unicode options +// use RTL Character Database rather than JCL one, less accurate but reduce executable size +{.$DEFINE UNICODE_RTL_DATABASE} + +// insert a replacement character if sequence is corrupted rather than raising an exception +{.$DEFINE UNICODE_SILENT_FAILURE} + +// defines resource compression (uncompressed, compressed with ZLib, compressed with BZip2), mutually exclusive +{.$DEFINE UNICODE_RAW_DATA} // default +{.$DEFINE UNICODE_ZLIB_DATA} +{.$DEFINE UNICODE_BZIP2_DATA} + + +// container options +// define mapping of TJclStr* containers to TJclAnsiStr* or TJclWideStr* (mutually exclusive) +{.$DEFINE CONTAINER_ANSISTR} // default for D2007 and older +{.$DEFINE CONTAINER_WIDESTR} +{.$DEFINE CONTAINER_UNICODESTR} // default for D2009 and newer, not supported for Delphi 2007 and older +{.$DEFINE CONTAINER_NOSTR} + + +// 7Zip options, mutually exclusive +// IMPORTANT: The static link is not supported yet + +{.$DEFINE 7ZIP_STATICLINK} // not supported yet +{.$DEFINE 7ZIP_LINKDLL} +{.$DEFINE 7ZIP_LINKONREQUEST} // default +{.$UNDEF HAS_UNIT_LIBC} +{$IFNDEF WINDOWS} + {$DEFINE PUREPASCAL} + {$DEFINE FPCNONWINDOWS} +{$ENDIF ~WINDOWS} +{$IFDEF UNIX} +{$DEFINE FPCUNIX} +{$ENDIF ~UNIX} +{$DEFINE HAS_TOSTRING} + diff --git a/readme.md b/readme.md index 59d7b1c25b..0aa24bba33 100644 --- a/readme.md +++ b/readme.md @@ -59,6 +59,8 @@ please report them to us. To make the bug reporting as efficient as possible, pl If you do not have a login, please [register](http://issuetracker.delphi-jedi.org/signup_page.php), it's quick and will allow you to receive email updates when the bug you posted gets through the resolution process. +Spicialized fpc bugs you can report here: https://github.com/Makhaon/jcl/issues + Contact ------- The JCL is built by the community, but more importantly, for the community. Therefore we would like to hear from you. If you have @@ -77,3 +79,33 @@ Note that we also like to hear about you if everything is fine, as this will let - Web gateway If you can't access to the newsgroups directly (because of firewalls or company policy), there is also a [web gateway to the newsgroups](http://newsportal.delphi-jedi.org/). + +Fixes are made +------- +List of main fixes are made in the jcl to be patially comitible with fpc/Windows/Linux. +PathUncPrefix const added in JclFileUtils +All Libc uses are changed to libclite +JclSynch are surrounded with IFDEFs as totally incompatible with Linux +Fixes for fpc mode: +StrAddRef StrDecRef are removed from JclAnsiStrings +PULARGE_INTEGER are redefined in JclBase +TJclAddr redefined in common way as NativeUInt in JclBase +HWND redefined as System.THandle +GetMem removed as unnecessary and incompatible with current fpc versions +Uses of zlibh, bzip2 and formats are removed as incompatible from JclCompression +Uses of BaseUnix, dateutils are added in the Linux mode in JclDateTime unit +LocalDateTimeToDateTime, DateTimeToLocalDateTime are fixed to work in Linux +DeleteDirectory, CopyDirectory, MoveDirectory are surrounded with IFDEFs as worked under Windows (shell) +FileExists is removed as already existed and intefered with rtl library +FileGetTempName is fixed to work in Linux +GetSizeOfFile is fixed to work in Linux +$UNDEF SUPPORTS_EXTENDED added in fpc/CPUX64 mode in JclMath unit +FastDegToRad, FastRadToDeg, FastGradToRad, FastRadToGrad, FastDegToGrad, FastGradToDeg are surrounded with IFDEFs as worked under Windows +InitExceptObjProc is fixed to work in Windows +TJclHandleStream is fixed to work in Linux +Uses of FpWinAPICompatibility is added to JclStringConversions +_AddRef and _Release are changed in TJclInterfacedStringList and TJclStringList +TTabSetData.AddRef and TTabSetData.ReleaseRef are fixed +GetIPAddress, GetCurrentFolder, SetEnvironmentVar and DelEnvironmentVar are fixed to work in Linux +GetAccessToHandleList is fixed +SystemTObjectInstance and IsCompiledWithPackages are surrounded with IFDEFs as worked under Windows From 6489a2519d33109fc87848b1c836c4d4e830dadd Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Wed, 8 Aug 2018 14:25:01 +0300 Subject: [PATCH 05/36] fixed readme.md --- readme.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/readme.md b/readme.md index 0aa24bba33..e9bc2121ee 100644 --- a/readme.md +++ b/readme.md @@ -83,29 +83,29 @@ Note that we also like to hear about you if everything is fine, as this will let Fixes are made ------- List of main fixes are made in the jcl to be patially comitible with fpc/Windows/Linux. -PathUncPrefix const added in JclFileUtils -All Libc uses are changed to libclite -JclSynch are surrounded with IFDEFs as totally incompatible with Linux -Fixes for fpc mode: -StrAddRef StrDecRef are removed from JclAnsiStrings -PULARGE_INTEGER are redefined in JclBase -TJclAddr redefined in common way as NativeUInt in JclBase -HWND redefined as System.THandle -GetMem removed as unnecessary and incompatible with current fpc versions -Uses of zlibh, bzip2 and formats are removed as incompatible from JclCompression -Uses of BaseUnix, dateutils are added in the Linux mode in JclDateTime unit -LocalDateTimeToDateTime, DateTimeToLocalDateTime are fixed to work in Linux -DeleteDirectory, CopyDirectory, MoveDirectory are surrounded with IFDEFs as worked under Windows (shell) -FileExists is removed as already existed and intefered with rtl library -FileGetTempName is fixed to work in Linux -GetSizeOfFile is fixed to work in Linux -$UNDEF SUPPORTS_EXTENDED added in fpc/CPUX64 mode in JclMath unit -FastDegToRad, FastRadToDeg, FastGradToRad, FastRadToGrad, FastDegToGrad, FastGradToDeg are surrounded with IFDEFs as worked under Windows -InitExceptObjProc is fixed to work in Windows -TJclHandleStream is fixed to work in Linux -Uses of FpWinAPICompatibility is added to JclStringConversions -_AddRef and _Release are changed in TJclInterfacedStringList and TJclStringList -TTabSetData.AddRef and TTabSetData.ReleaseRef are fixed -GetIPAddress, GetCurrentFolder, SetEnvironmentVar and DelEnvironmentVar are fixed to work in Linux -GetAccessToHandleList is fixed -SystemTObjectInstance and IsCompiledWithPackages are surrounded with IFDEFs as worked under Windows + - PathUncPrefix const added in JclFileUtils + - All Libc uses are changed to libclite + - JclSynch are surrounded with IFDEFs as totally incompatible with Linux + - Fixes for fpc mode: + - StrAddRef StrDecRef are removed from JclAnsiStrings + - PULARGE_INTEGER are redefined in JclBase + - TJclAddr redefined in common way as NativeUInt in JclBase + - HWND redefined as System.THandle + - GetMem removed as unnecessary and incompatible with current fpc versions + - Uses of zlibh, bzip2 and formats are removed as incompatible from JclCompression + - Uses of BaseUnix, dateutils are added in the Linux mode in JclDateTime unit + - LocalDateTimeToDateTime, DateTimeToLocalDateTime are fixed to work in Linux + - DeleteDirectory, CopyDirectory, MoveDirectory are surrounded with IFDEFs as worked under Windows (shell) + - FileExists is removed as already existed and intefered with rtl library + - FileGetTempName is fixed to work in Linux + - GetSizeOfFile is fixed to work in Linux + - $UNDEF SUPPORTS_EXTENDED added in fpc/CPUX64 mode in JclMath unit + - FastDegToRad, FastRadToDeg, FastGradToRad, FastRadToGrad, FastDegToGrad, FastGradToDeg are surrounded with IFDEFs as worked under Windows + - InitExceptObjProc is fixed to work in Windows + - TJclHandleStream is fixed to work in Linux + - Uses of FpWinAPICompatibility is added to JclStringConversions + - _AddRef and _Release are changed in TJclInterfacedStringList and TJclStringList + - TTabSetData.AddRef and TTabSetData.ReleaseRef are fixed + - GetIPAddress, GetCurrentFolder, SetEnvironmentVar and DelEnvironmentVar are fixed to work in Linux + - GetAccessToHandleList is fixed + - SystemTObjectInstance and IsCompiledWithPackages are surrounded with IFDEFs as worked under Windows From 37846b021effcaf4cc7a99347e5c66efefcc0827 Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Wed, 8 Aug 2018 14:26:52 +0300 Subject: [PATCH 06/36] fixed readme.md --- readme.md | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/readme.md b/readme.md index e9bc2121ee..e01eee768c 100644 --- a/readme.md +++ b/readme.md @@ -82,30 +82,30 @@ Note that we also like to hear about you if everything is fine, as this will let Fixes are made ------- -List of main fixes are made in the jcl to be patially comitible with fpc/Windows/Linux. - - PathUncPrefix const added in JclFileUtils - - All Libc uses are changed to libclite - - JclSynch are surrounded with IFDEFs as totally incompatible with Linux - - Fixes for fpc mode: - - StrAddRef StrDecRef are removed from JclAnsiStrings - - PULARGE_INTEGER are redefined in JclBase - - TJclAddr redefined in common way as NativeUInt in JclBase - - HWND redefined as System.THandle - - GetMem removed as unnecessary and incompatible with current fpc versions - - Uses of zlibh, bzip2 and formats are removed as incompatible from JclCompression - - Uses of BaseUnix, dateutils are added in the Linux mode in JclDateTime unit - - LocalDateTimeToDateTime, DateTimeToLocalDateTime are fixed to work in Linux - - DeleteDirectory, CopyDirectory, MoveDirectory are surrounded with IFDEFs as worked under Windows (shell) - - FileExists is removed as already existed and intefered with rtl library - - FileGetTempName is fixed to work in Linux - - GetSizeOfFile is fixed to work in Linux - - $UNDEF SUPPORTS_EXTENDED added in fpc/CPUX64 mode in JclMath unit - - FastDegToRad, FastRadToDeg, FastGradToRad, FastRadToGrad, FastDegToGrad, FastGradToDeg are surrounded with IFDEFs as worked under Windows - - InitExceptObjProc is fixed to work in Windows - - TJclHandleStream is fixed to work in Linux - - Uses of FpWinAPICompatibility is added to JclStringConversions - - _AddRef and _Release are changed in TJclInterfacedStringList and TJclStringList - - TTabSetData.AddRef and TTabSetData.ReleaseRef are fixed - - GetIPAddress, GetCurrentFolder, SetEnvironmentVar and DelEnvironmentVar are fixed to work in Linux - - GetAccessToHandleList is fixed - - SystemTObjectInstance and IsCompiledWithPackages are surrounded with IFDEFs as worked under Windows +- List of main fixes are made in the jcl to be patially comitible with fpc/Windows/Linux. +- PathUncPrefix const added in JclFileUtils +- All Libc uses are changed to libclite +- JclSynch are surrounded with IFDEFs as totally incompatible with Linux +- Fixes for fpc mode: +- StrAddRef StrDecRef are removed from JclAnsiStrings +- PULARGE_INTEGER are redefined in JclBase +- TJclAddr redefined in common way as NativeUInt in JclBase +- HWND redefined as System.THandle +- GetMem removed as unnecessary and incompatible with current fpc versions +- Uses of zlibh, bzip2 and formats are removed as incompatible from JclCompression +- Uses of BaseUnix, dateutils are added in the Linux mode in JclDateTime unit +- LocalDateTimeToDateTime, DateTimeToLocalDateTime are fixed to work in Linux +- DeleteDirectory, CopyDirectory, MoveDirectory are surrounded with IFDEFs as worked under Windows (shell) +- FileExists is removed as already existed and intefered with rtl library +- FileGetTempName is fixed to work in Linux +- GetSizeOfFile is fixed to work in Linux +- $UNDEF SUPPORTS_EXTENDED added in fpc/CPUX64 mode in JclMath unit +- FastDegToRad, FastRadToDeg, FastGradToRad, FastRadToGrad, FastDegToGrad, FastGradToDeg are surrounded with IFDEFs as worked under Windows +- InitExceptObjProc is fixed to work in Windows +- TJclHandleStream is fixed to work in Linux +- Uses of FpWinAPICompatibility is added to JclStringConversions +- _AddRef and _Release are changed in TJclInterfacedStringList and TJclStringList +- TTabSetData.AddRef and TTabSetData.ReleaseRef are fixed +- GetIPAddress, GetCurrentFolder, SetEnvironmentVar and DelEnvironmentVar are fixed to work in Linux +- GetAccessToHandleList is fixed +- SystemTObjectInstance and IsCompiledWithPackages are surrounded with IFDEFs as worked under Windows From 9acb8ba691bd306ddbddac838ab4def2eaecd886 Mon Sep 17 00:00:00 2001 From: Makhaon <35131832+Makhaon@users.noreply.github.com> Date: Wed, 8 Aug 2018 14:28:08 +0300 Subject: [PATCH 07/36] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index e01eee768c..0f835a2d7f 100644 --- a/readme.md +++ b/readme.md @@ -82,7 +82,7 @@ Note that we also like to hear about you if everything is fine, as this will let Fixes are made ------- -- List of main fixes are made in the jcl to be patially comitible with fpc/Windows/Linux. +List of main fixes are made in the jcl to be patially comitible with fpc/Windows/Linux. - PathUncPrefix const added in JclFileUtils - All Libc uses are changed to libclite - JclSynch are surrounded with IFDEFs as totally incompatible with Linux From e09b64531239a7e569ce24234970dab3edbe2b30 Mon Sep 17 00:00:00 2001 From: Makhaon <35131832+Makhaon@users.noreply.github.com> Date: Wed, 8 Aug 2018 20:48:32 +0300 Subject: [PATCH 08/36] Update readme.md --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 0f835a2d7f..e0956b1f08 100644 --- a/readme.md +++ b/readme.md @@ -85,10 +85,10 @@ Fixes are made List of main fixes are made in the jcl to be patially comitible with fpc/Windows/Linux. - PathUncPrefix const added in JclFileUtils - All Libc uses are changed to libclite -- JclSynch are surrounded with IFDEFs as totally incompatible with Linux +- JclSynch is surrounded with IFDEFs as totally incompatible with Linux - Fixes for fpc mode: - StrAddRef StrDecRef are removed from JclAnsiStrings -- PULARGE_INTEGER are redefined in JclBase +- PULARGE_INTEGER is redefined in JclBase - TJclAddr redefined in common way as NativeUInt in JclBase - HWND redefined as System.THandle - GetMem removed as unnecessary and incompatible with current fpc versions From a26572441e4341078517e4ba74faf28cc0ef5d84 Mon Sep 17 00:00:00 2001 From: Makhaon <35131832+Makhaon@users.noreply.github.com> Date: Wed, 8 Aug 2018 20:51:26 +0300 Subject: [PATCH 09/36] Update readme.md --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index e0956b1f08..9e8d2a284a 100644 --- a/readme.md +++ b/readme.md @@ -36,8 +36,8 @@ This will get you the JCL repository. How to install -------------- -Under Windows start the **jcl\install.bat** -Under Linux just unpack archive to a folder +For install on Delphi start the **jcl\install.bat** +For install on FPC under Linux or Windows just unpack archive to a folder Daily snapshots --------------- @@ -86,7 +86,7 @@ List of main fixes are made in the jcl to be patially comitible with fpc/Windows - PathUncPrefix const added in JclFileUtils - All Libc uses are changed to libclite - JclSynch is surrounded with IFDEFs as totally incompatible with Linux -- Fixes for fpc mode: +Fixes for fpc mode: - StrAddRef StrDecRef are removed from JclAnsiStrings - PULARGE_INTEGER is redefined in JclBase - TJclAddr redefined in common way as NativeUInt in JclBase From 1e5ed93ca36f882a005bc6f575be7b53ae8029a5 Mon Sep 17 00:00:00 2001 From: Makhaon <35131832+Makhaon@users.noreply.github.com> Date: Wed, 8 Aug 2018 20:51:57 +0300 Subject: [PATCH 10/36] Update readme.md --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 9e8d2a284a..c202a15314 100644 --- a/readme.md +++ b/readme.md @@ -36,8 +36,8 @@ This will get you the JCL repository. How to install -------------- -For install on Delphi start the **jcl\install.bat** -For install on FPC under Linux or Windows just unpack archive to a folder +- For install on Delphi start the **jcl\install.bat** +- For install on FPC under Linux or Windows just unpack archive to a folder Daily snapshots --------------- From 0222679b0493623cb486b0f32bb33d05ee3bbddc Mon Sep 17 00:00:00 2001 From: Makhaon <35131832+Makhaon@users.noreply.github.com> Date: Thu, 9 Aug 2018 21:06:43 +0300 Subject: [PATCH 11/36] Update readme.md --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index c202a15314..51a970a40e 100644 --- a/readme.md +++ b/readme.md @@ -22,8 +22,7 @@ The original repository can be found here: https://github.com/project-jedi/jcl Download the ZIP file --------------------- -If you download the JCL as a ZIP file from GitHub, you have to move the jedi.inc and -kylix.inc files from the jcl\jcl\source\include to the +you have to move the jedi.inc and kylix.inc files from the jcl\jcl\source\include to the jcl\jcl\source\include\jedi directory. Clone with GIT @@ -31,8 +30,9 @@ Clone with GIT ``` > git clone git://github.com/Makhaon/jcl.git jcl ``` - This will get you the JCL repository. +you have to move the jedi.inc and kylix.inc files from the jcl\jcl\source\include to the +jcl\jcl\source\include\jedi directory. How to install -------------- From 62f42f956ea01a8dd828bb870a5e649f38ef3cc0 Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Fri, 10 Aug 2018 12:40:37 +0300 Subject: [PATCH 12/36] fix types --- jcl/source/common/JclBase.pas | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jcl/source/common/JclBase.pas b/jcl/source/common/JclBase.pas index 06b88ab71f..635aa8d02d 100644 --- a/jcl/source/common/JclBase.pas +++ b/jcl/source/common/JclBase.pas @@ -335,22 +335,21 @@ function StringOf(const Bytes: Pointer; Size: Cardinal): AnsiString; overload; {$IFDEF FPC} TJclAddr64 = QWord; {$IFDEF CPU64} - //TJclAddr = QWord; + TJclAddr = QWord; {$ENDIF CPU64} {$IFDEF CPU32} - //TJclAddr = Cardinal; + TJclAddr = Cardinal; {$ENDIF CPU32} {$ENDIF FPC} {$IFDEF BORLAND} TJclAddr64 = Int64; {$IFDEF CPU64} - //TJclAddr = TJclAddr64; + TJclAddr = TJclAddr64; {$ENDIF CPU64} {$IFDEF CPU32} - //TJclAddr = TJclAddr32; + TJclAddr = TJclAddr32; {$ENDIF CPU32} {$ENDIF BORLAND} - TJclAddr = NativeUInt; PJclAddr = ^TJclAddr; EJclAddr64Exception = class(EJclError); From 253a8f15bf10a917336d5d0257c7c7069f451ac9 Mon Sep 17 00:00:00 2001 From: Makhaon <35131832+Makhaon@users.noreply.github.com> Date: Fri, 10 Aug 2018 12:44:35 +0300 Subject: [PATCH 13/36] Update readme.md --- readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 51a970a40e..8c149781d0 100644 --- a/readme.md +++ b/readme.md @@ -86,10 +86,9 @@ List of main fixes are made in the jcl to be patially comitible with fpc/Windows - PathUncPrefix const added in JclFileUtils - All Libc uses are changed to libclite - JclSynch is surrounded with IFDEFs as totally incompatible with Linux -Fixes for fpc mode: +- Fixes for fpc mode: - StrAddRef StrDecRef are removed from JclAnsiStrings - PULARGE_INTEGER is redefined in JclBase -- TJclAddr redefined in common way as NativeUInt in JclBase - HWND redefined as System.THandle - GetMem removed as unnecessary and incompatible with current fpc versions - Uses of zlibh, bzip2 and formats are removed as incompatible from JclCompression From 3a616b88ffcc09334403207e74c446a8b8f97fee Mon Sep 17 00:00:00 2001 From: Dm Bel Date: Sun, 12 Aug 2018 01:22:07 +0300 Subject: [PATCH 14/36] compatibility fixes --- jcl/packages/fpc/Jcl.lpk | 33 +- jcl/packages/fpc/Jcl.pas | 103 +-- jcl/packages/fpc/JclCommon.lpk | 222 ++++++ jcl/packages/fpc/JclCommon.pas | 21 + jcl/source/common/Jcl8087.pas | 14 +- jcl/source/common/JclNotify.pas | 3 + jcl/source/common/JclSynch.pas | 35 +- jcl/source/common/JclSysInfo.pas | 28 +- jcl/source/common/JclUnitVersioning.pas | 14 +- .../common/JclUnitVersioningProviders.pas | 8 +- jcl/source/include/jclfpc.inc | 1 + jcl/source/windows/JclRegistry.pas | 5 +- jcl/source/windows/JclWin32Process.pas | 743 ++++++++++++++++++ 13 files changed, 1108 insertions(+), 122 deletions(-) create mode 100644 jcl/packages/fpc/JclCommon.lpk create mode 100644 jcl/packages/fpc/JclCommon.pas create mode 100644 jcl/source/windows/JclWin32Process.pas diff --git a/jcl/packages/fpc/Jcl.lpk b/jcl/packages/fpc/Jcl.lpk index 054ba08268..23ed8240eb 100644 --- a/jcl/packages/fpc/Jcl.lpk +++ b/jcl/packages/fpc/Jcl.lpk @@ -1,17 +1,16 @@ - + - + - - + - - + + @@ -24,23 +23,21 @@ - + + - - - - - + + @@ -337,6 +334,18 @@ + + + + + + + + + + + + diff --git a/jcl/packages/fpc/Jcl.pas b/jcl/packages/fpc/Jcl.pas index 26c3ef48bc..239033f595 100644 --- a/jcl/packages/fpc/Jcl.pas +++ b/jcl/packages/fpc/Jcl.pas @@ -1,92 +1,27 @@ -{ ------------------------------------------------------------------------------ - DO NOT EDIT THIS FILE, IT IS GENERATED BY THE PACKAGE GENERATOR - ALWAYS EDIT THE RELATED XML FILE (Jcl-R.xml) +{ This file was automatically created by Lazarus. Do not edit! + This source is only used to compile and install the package. + } - Last generated: 14-08-2012 09:49:00 UTC ------------------------------------------------------------------------------ -} - -unit Jcl; +unit Jcl; interface uses - bzip2, - Jcl8087, - JclAnsiStrings, - JclBase, - JclCharsets, - JclComplex, - JclCompression, - JclCounter, - JclDateTime, - JclFileUtils, - JclIniFiles, - JclLogic, - JclMath, - JclMIDI, - JclMime, - JclNotify, - JclPCRE, - JclResources, - JclRTTI, - JclSchedule, - JclSimpleXml, - JclStatistics, - JclStreams, - JclStringConversions, - JclStringLists, - JclStrings, - JclSynch, - JclSysInfo, - JclSysUtils, - JclUnicode, - JclUnitConv, - JclUnitVersioning, - JclUnitVersioningProviders, - JclValidation, - JclWideStrings, - pcre, - zlibh, - Hardlinks, - JclAppInst, - JclCIL, - JclCLR, - JclCOM, - JclConsole, - JclCppException, - JclDebug, - JclDebugSerialization, - JclDebugXMLDeserializer, - JclDebugXMLSerializer, - JclDotNet, - JclHookExcept, - JclLANMan, - JclLocales, - JclMetadata, - JclMiscel, - JclMsdosSys, - JclMultimedia, - JclNTFS, - JclPeImage, - JclRegistry, - JclSecurity, - JclShell, - JclStructStorage, - JclSvcCtrl, - JclTask, - JclTD32, - JclTimeZones, - JclWin32, - JclWin32Ex, - JclWinMIDI, - mscoree_TLB, - mscorlib_TLB, - MSTask, - sevenzip, - Snmp - ; + bzip2, Jcl8087, JclAnsiStrings, JclBase, JclCharsets, JclComplex, + JclCompression, JclCounter, JclDateTime, JclFileUtils, JclIniFiles, + JclLogic, JclMath, JclMIDI, JclMime, JclNotify, JclPCRE, JclResources, + JclRTTI, JclSchedule, JclSimpleXml, JclStatistics, JclStreams, + JclStringConversions, JclStringLists, JclStrings, JclSynch, JclSysInfo, + JclSysUtils, JclUnicode, JclUnitConv, JclUnitVersioning, + JclUnitVersioningProviders, JclValidation, JclWideStrings, pcre, zlibh, + Hardlinks, JclAppInst, JclCIL, JclCLR, JclCOM, JclConsole, JclCppException, + JclDebug, JclDebugSerialization, JclDebugXMLDeserializer, + JclDebugXMLSerializer, JclDotNet, JclHookExcept, JclLANMan, JclLocales, + JclMetadata, JclMiscel, JclMsdosSys, JclMultimedia, JclNTFS, JclPeImage, + JclRegistry, JclSecurity, JclShell, JclStructStorage, JclSvcCtrl, JclTask, + JclTD32, JclTimeZones, JclWin32, JclWin32Ex, JclWinMIDI, mscoree_TLB, + mscorlib_TLB, MSTask, sevenzip, Snmp, FpLibcCompatibility, FpStringHash, + FpWinAPICompatibility; implementation diff --git a/jcl/packages/fpc/JclCommon.lpk b/jcl/packages/fpc/JclCommon.lpk new file mode 100644 index 0000000000..64c50b6a29 --- /dev/null +++ b/jcl/packages/fpc/JclCommon.lpk @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + +